@appsurify-testmap/rrweb 2.1.3-alpha.4 → 3.1.1-alpha.1
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/rrweb.cjs +1415 -176
- package/dist/rrweb.cjs.map +1 -1
- package/dist/rrweb.js +1415 -176
- package/dist/rrweb.js.map +1 -1
- package/dist/rrweb.umd.cjs +1453 -182
- package/dist/rrweb.umd.cjs.map +3 -3
- package/dist/rrweb.umd.min.cjs +36 -36
- package/dist/rrweb.umd.min.cjs.map +3 -3
- package/package.json +5 -5
package/dist/rrweb.js
CHANGED
|
@@ -298,6 +298,7 @@ function stringifyRule(rule2, sheetHref) {
|
|
|
298
298
|
return importStringified;
|
|
299
299
|
} else {
|
|
300
300
|
let ruleStringified = rule2.cssText;
|
|
301
|
+
if (rule2.type === CSSRule.KEYFRAMES_RULE || rule2.type === CSSRule.KEYFRAME_RULE) ;
|
|
301
302
|
if (isCSSStyleRule(rule2) && rule2.selectorText.includes(":")) {
|
|
302
303
|
ruleStringified = fixSafariColons(ruleStringified);
|
|
303
304
|
}
|
|
@@ -520,19 +521,19 @@ function splitCssText(cssText, style, _testNoPxNorm = false) {
|
|
|
520
521
|
_testNoPxNorm
|
|
521
522
|
);
|
|
522
523
|
const jLimit = 100;
|
|
523
|
-
let
|
|
524
|
-
for (;
|
|
524
|
+
let j2 = 3;
|
|
525
|
+
for (; j2 < textContentNorm.length; j2++) {
|
|
525
526
|
if (
|
|
526
527
|
// keep consuming css identifiers (to get a decent chunk more quickly)
|
|
527
|
-
textContentNorm[
|
|
528
|
-
textContentNorm.indexOf(textContentNorm.substring(0,
|
|
528
|
+
textContentNorm[j2].match(/[a-zA-Z0-9]/) || // substring needs to be unique to this section
|
|
529
|
+
textContentNorm.indexOf(textContentNorm.substring(0, j2), 1) !== -1
|
|
529
530
|
) {
|
|
530
531
|
continue;
|
|
531
532
|
}
|
|
532
533
|
break;
|
|
533
534
|
}
|
|
534
|
-
for (;
|
|
535
|
-
let startSubstring = textContentNorm.substring(0,
|
|
535
|
+
for (; j2 < textContentNorm.length; j2++) {
|
|
536
|
+
let startSubstring = textContentNorm.substring(0, j2);
|
|
536
537
|
let cssNormSplits = cssTextNorm.split(startSubstring);
|
|
537
538
|
let splitNorm = -1;
|
|
538
539
|
if (cssNormSplits.length === 2) {
|
|
@@ -549,11 +550,11 @@ function splitCssText(cssText, style, _testNoPxNorm = false) {
|
|
|
549
550
|
splits.push(cssText);
|
|
550
551
|
return splits;
|
|
551
552
|
}
|
|
552
|
-
|
|
553
|
-
} else if (
|
|
553
|
+
j2 = jLimit + 1;
|
|
554
|
+
} else if (j2 === textContentNorm.length - 1) {
|
|
554
555
|
splitNorm = cssTextNorm.indexOf(startSubstring);
|
|
555
556
|
}
|
|
556
|
-
if (cssNormSplits.length >= 2 &&
|
|
557
|
+
if (cssNormSplits.length >= 2 && j2 > jLimit) {
|
|
557
558
|
const prevTextContent = childNodes2[i2 - 1].textContent;
|
|
558
559
|
if (prevTextContent && typeof prevTextContent === "string") {
|
|
559
560
|
const prevMinLength = normalizeCssString(prevTextContent).length;
|
|
@@ -564,29 +565,29 @@ function splitCssText(cssText, style, _testNoPxNorm = false) {
|
|
|
564
565
|
}
|
|
565
566
|
}
|
|
566
567
|
if (splitNorm !== -1) {
|
|
567
|
-
let
|
|
568
|
-
for (;
|
|
568
|
+
let k2 = Math.floor(splitNorm / normFactor);
|
|
569
|
+
for (; k2 > 0 && k2 < cssText.length; ) {
|
|
569
570
|
iterCount += 1;
|
|
570
571
|
if (iterCount > 50 * childNodes2.length) {
|
|
571
572
|
splits.push(cssText);
|
|
572
573
|
return splits;
|
|
573
574
|
}
|
|
574
575
|
const normPart = normalizeCssString(
|
|
575
|
-
cssText.substring(0,
|
|
576
|
+
cssText.substring(0, k2),
|
|
576
577
|
_testNoPxNorm
|
|
577
578
|
);
|
|
578
579
|
if (normPart.length === splitNorm) {
|
|
579
|
-
splits.push(cssText.substring(0,
|
|
580
|
-
cssText = cssText.substring(
|
|
580
|
+
splits.push(cssText.substring(0, k2));
|
|
581
|
+
cssText = cssText.substring(k2);
|
|
581
582
|
cssTextNorm = cssTextNorm.substring(splitNorm);
|
|
582
583
|
break;
|
|
583
584
|
} else if (normPart.length < splitNorm) {
|
|
584
|
-
|
|
585
|
+
k2 += Math.max(
|
|
585
586
|
1,
|
|
586
587
|
Math.floor((splitNorm - normPart.length) / normFactor)
|
|
587
588
|
);
|
|
588
589
|
} else {
|
|
589
|
-
|
|
590
|
+
k2 -= Math.max(
|
|
590
591
|
1,
|
|
591
592
|
Math.floor((normPart.length - splitNorm) * normFactor)
|
|
592
593
|
);
|
|
@@ -604,96 +605,6 @@ function splitCssText(cssText, style, _testNoPxNorm = false) {
|
|
|
604
605
|
function markCssSplits(cssText, style) {
|
|
605
606
|
return splitCssText(cssText, style).join("/* rr_split */");
|
|
606
607
|
}
|
|
607
|
-
function isSelectorUnique(selector, target) {
|
|
608
|
-
try {
|
|
609
|
-
const matches = document.querySelectorAll(selector);
|
|
610
|
-
return matches.length === 1 && matches[0] === target;
|
|
611
|
-
} catch {
|
|
612
|
-
return false;
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
function buildSelector(node2) {
|
|
616
|
-
if (!(node2 instanceof Element)) return null;
|
|
617
|
-
if (node2.id) {
|
|
618
|
-
return `#${CSS.escape(node2.id)}`;
|
|
619
|
-
}
|
|
620
|
-
const parts = [];
|
|
621
|
-
const tag = node2.tagName.toLowerCase();
|
|
622
|
-
if (node2.classList.length) {
|
|
623
|
-
parts.push(...Array.from(node2.classList).map((cls) => `.${CSS.escape(cls)}`));
|
|
624
|
-
}
|
|
625
|
-
Array.from(node2.attributes).forEach((attr) => {
|
|
626
|
-
if (attr.name.startsWith("data-")) {
|
|
627
|
-
parts.push(`[${attr.name}="${CSS.escape(attr.value)}"]`);
|
|
628
|
-
}
|
|
629
|
-
});
|
|
630
|
-
const shortSelector = `${tag}${parts.join("")}`;
|
|
631
|
-
if (isSelectorUnique(shortSelector, node2)) {
|
|
632
|
-
return shortSelector;
|
|
633
|
-
}
|
|
634
|
-
const pathParts = [];
|
|
635
|
-
let current = node2;
|
|
636
|
-
while (current && current.nodeType === Node.ELEMENT_NODE) {
|
|
637
|
-
const parent = current.parentElement;
|
|
638
|
-
const tagName = current.tagName.toLowerCase();
|
|
639
|
-
let nth = "";
|
|
640
|
-
if (parent) {
|
|
641
|
-
const siblings = Array.from(parent.children).filter(
|
|
642
|
-
(el) => el.tagName.toLowerCase() === tagName
|
|
643
|
-
);
|
|
644
|
-
if (siblings.length > 1) {
|
|
645
|
-
nth = `:nth-of-type(${siblings.indexOf(current) + 1})`;
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
pathParts.unshift(`${tagName}${nth}`);
|
|
649
|
-
current = parent;
|
|
650
|
-
}
|
|
651
|
-
return pathParts.join(" > ") || null;
|
|
652
|
-
}
|
|
653
|
-
function buildXPath(node2) {
|
|
654
|
-
switch (node2.nodeType) {
|
|
655
|
-
case Node.DOCUMENT_NODE:
|
|
656
|
-
return "/";
|
|
657
|
-
case Node.DOCUMENT_TYPE_NODE:
|
|
658
|
-
return "/html/doctype";
|
|
659
|
-
case Node.ELEMENT_NODE: {
|
|
660
|
-
const element = node2;
|
|
661
|
-
if (element.id) {
|
|
662
|
-
return `//*[@id="${CSS.escape(element.id)}"]`;
|
|
663
|
-
}
|
|
664
|
-
if (element.tagName.toLowerCase() === "html") return "/html";
|
|
665
|
-
if (element === document.head) return "/html/head";
|
|
666
|
-
if (element === document.body) return "/html/body";
|
|
667
|
-
const parent = element.parentNode;
|
|
668
|
-
if (!parent) return "";
|
|
669
|
-
const tag = element.tagName.toLowerCase();
|
|
670
|
-
const siblings = Array.from(parent.children).filter(
|
|
671
|
-
(el) => el.tagName.toLowerCase() === tag
|
|
672
|
-
);
|
|
673
|
-
const index2 = siblings.length > 1 ? `[${siblings.indexOf(element) + 1}]` : "";
|
|
674
|
-
return `${buildXPath(parent)}/${tag}${index2}`;
|
|
675
|
-
}
|
|
676
|
-
case Node.TEXT_NODE:
|
|
677
|
-
case Node.CDATA_SECTION_NODE:
|
|
678
|
-
case Node.COMMENT_NODE: {
|
|
679
|
-
const parent = node2.parentNode;
|
|
680
|
-
if (!parent) return "";
|
|
681
|
-
const typeMap = {
|
|
682
|
-
[Node.TEXT_NODE]: "text()",
|
|
683
|
-
[Node.CDATA_SECTION_NODE]: "text()",
|
|
684
|
-
// CDATA ≡ text() в XPath
|
|
685
|
-
[Node.COMMENT_NODE]: "comment()"
|
|
686
|
-
};
|
|
687
|
-
const sameTypeSiblings = Array.from(parent.childNodes).filter(
|
|
688
|
-
(sibling) => sibling.nodeType === node2.nodeType
|
|
689
|
-
);
|
|
690
|
-
const index2 = sameTypeSiblings.length > 1 ? `[${sameTypeSiblings.indexOf(node2)}]` : "";
|
|
691
|
-
return `${buildXPath(parent)}/${typeMap[node2.nodeType]}${index2}`;
|
|
692
|
-
}
|
|
693
|
-
default:
|
|
694
|
-
return "";
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
608
|
function isTextVisible(n2) {
|
|
698
609
|
var _a2;
|
|
699
610
|
const parent = index$1.parentNode(n2);
|
|
@@ -826,6 +737,1274 @@ try {
|
|
|
826
737
|
}
|
|
827
738
|
} catch (error) {
|
|
828
739
|
}
|
|
740
|
+
const L = {
|
|
741
|
+
ANCHOR: 0.4,
|
|
742
|
+
PATH: 0.3,
|
|
743
|
+
TARGET: 0.2,
|
|
744
|
+
UNIQUENESS: 0.1
|
|
745
|
+
}, I = {
|
|
746
|
+
SEMANTIC_TAG: 0.5,
|
|
747
|
+
ROLE: 0.3,
|
|
748
|
+
ARIA_LABEL: 0.1,
|
|
749
|
+
STABLE_ID: 0.1,
|
|
750
|
+
TEST_MARKER: 0.05,
|
|
751
|
+
DEPTH_PENALTY_THRESHOLD: 5,
|
|
752
|
+
DEPTH_PENALTY_FACTOR: 0.05,
|
|
753
|
+
DEGRADED_SCORE: 0.3
|
|
754
|
+
}, ct = {
|
|
755
|
+
MIN_CONFIDENCE_FOR_SKIP: 0.7
|
|
756
|
+
}, X = [
|
|
757
|
+
"form",
|
|
758
|
+
"main",
|
|
759
|
+
"nav",
|
|
760
|
+
"section",
|
|
761
|
+
"article",
|
|
762
|
+
"footer",
|
|
763
|
+
"header"
|
|
764
|
+
], K = [
|
|
765
|
+
"form",
|
|
766
|
+
"navigation",
|
|
767
|
+
"main",
|
|
768
|
+
"region",
|
|
769
|
+
"contentinfo",
|
|
770
|
+
"complementary",
|
|
771
|
+
"banner",
|
|
772
|
+
"search"
|
|
773
|
+
], lt = [
|
|
774
|
+
// HTML5 Semantic
|
|
775
|
+
"article",
|
|
776
|
+
"aside",
|
|
777
|
+
"details",
|
|
778
|
+
"figcaption",
|
|
779
|
+
"figure",
|
|
780
|
+
"footer",
|
|
781
|
+
"header",
|
|
782
|
+
"main",
|
|
783
|
+
"mark",
|
|
784
|
+
"nav",
|
|
785
|
+
"section",
|
|
786
|
+
"summary",
|
|
787
|
+
"time",
|
|
788
|
+
// Form elements
|
|
789
|
+
"button",
|
|
790
|
+
"datalist",
|
|
791
|
+
"fieldset",
|
|
792
|
+
"form",
|
|
793
|
+
"input",
|
|
794
|
+
"label",
|
|
795
|
+
"legend",
|
|
796
|
+
"meter",
|
|
797
|
+
"optgroup",
|
|
798
|
+
"option",
|
|
799
|
+
"output",
|
|
800
|
+
"progress",
|
|
801
|
+
"select",
|
|
802
|
+
"textarea",
|
|
803
|
+
// Interactive
|
|
804
|
+
"a",
|
|
805
|
+
"audio",
|
|
806
|
+
"video",
|
|
807
|
+
"canvas",
|
|
808
|
+
"dialog",
|
|
809
|
+
"menu",
|
|
810
|
+
// Text content
|
|
811
|
+
"blockquote",
|
|
812
|
+
"dd",
|
|
813
|
+
"dl",
|
|
814
|
+
"dt",
|
|
815
|
+
"hr",
|
|
816
|
+
"li",
|
|
817
|
+
"ol",
|
|
818
|
+
"ul",
|
|
819
|
+
"p",
|
|
820
|
+
"pre",
|
|
821
|
+
"h1",
|
|
822
|
+
"h2",
|
|
823
|
+
"h3",
|
|
824
|
+
"h4",
|
|
825
|
+
"h5",
|
|
826
|
+
"h6",
|
|
827
|
+
// Table
|
|
828
|
+
"caption",
|
|
829
|
+
"col",
|
|
830
|
+
"colgroup",
|
|
831
|
+
"table",
|
|
832
|
+
"tbody",
|
|
833
|
+
"td",
|
|
834
|
+
"tfoot",
|
|
835
|
+
"th",
|
|
836
|
+
"thead",
|
|
837
|
+
"tr",
|
|
838
|
+
// SVG
|
|
839
|
+
"svg",
|
|
840
|
+
"path",
|
|
841
|
+
"circle",
|
|
842
|
+
"rect",
|
|
843
|
+
"line",
|
|
844
|
+
"polyline",
|
|
845
|
+
"polygon",
|
|
846
|
+
"ellipse",
|
|
847
|
+
"g",
|
|
848
|
+
"text",
|
|
849
|
+
"use"
|
|
850
|
+
], w = {
|
|
851
|
+
// Test attributes (highest priority)
|
|
852
|
+
"data-testid": 100,
|
|
853
|
+
"data-qa": 99,
|
|
854
|
+
"data-cy": 98,
|
|
855
|
+
"data-test": 97,
|
|
856
|
+
"data-test-id": 96,
|
|
857
|
+
// ARIA (accessibility semantics)
|
|
858
|
+
"aria-label": 90,
|
|
859
|
+
"aria-labelledby": 85,
|
|
860
|
+
"aria-describedby": 80,
|
|
861
|
+
// Semantic HTML attributes
|
|
862
|
+
name: 75,
|
|
863
|
+
href: 70,
|
|
864
|
+
// for <a>
|
|
865
|
+
src: 70,
|
|
866
|
+
// for <img>, <script>, etc.
|
|
867
|
+
type: 65,
|
|
868
|
+
role: 60,
|
|
869
|
+
alt: 55,
|
|
870
|
+
title: 50,
|
|
871
|
+
for: 45,
|
|
872
|
+
placeholder: 40,
|
|
873
|
+
// Any data-* attribute (if not above)
|
|
874
|
+
"data-*": 30,
|
|
875
|
+
// Any aria-* attribute (if not above)
|
|
876
|
+
"aria-*": 25
|
|
877
|
+
}, B = /* @__PURE__ */ new Set([
|
|
878
|
+
"id",
|
|
879
|
+
// handled separately
|
|
880
|
+
"class",
|
|
881
|
+
// handled separately
|
|
882
|
+
"style",
|
|
883
|
+
// unstable
|
|
884
|
+
"xmlns",
|
|
885
|
+
// service attribute for SVG
|
|
886
|
+
"tabindex",
|
|
887
|
+
// can change
|
|
888
|
+
"contenteditable"
|
|
889
|
+
]), ut = {
|
|
890
|
+
maxPathDepth: 10,
|
|
891
|
+
enableSvgFingerprint: true,
|
|
892
|
+
confidenceThreshold: 0.1,
|
|
893
|
+
fallbackToBody: true,
|
|
894
|
+
includeUtilityClasses: false,
|
|
895
|
+
source: "dom-dsl"
|
|
896
|
+
};
|
|
897
|
+
function D(n2) {
|
|
898
|
+
return !!(/^[a-z]+-\d+$/i.test(n2) || /^[a-z]+(-[a-z]+)+-\d+$/i.test(n2) || /^[a-z]+(_[a-z]+)*_\d+$/i.test(n2) || /^\d+$/.test(n2) || /^:[a-z0-9]+:$/i.test(n2) || /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(n2) || /^[a-z]{1,3}[A-Za-z0-9]{8,}$/.test(n2) && (/\d/.test(n2) || /[A-Z]/.test(n2)) || /^radix-/.test(n2) || /^mui-\d+$/.test(n2));
|
|
899
|
+
}
|
|
900
|
+
const G = /* @__PURE__ */ new Set([
|
|
901
|
+
"aria-labelledby",
|
|
902
|
+
"aria-describedby",
|
|
903
|
+
"aria-controls",
|
|
904
|
+
"aria-owns",
|
|
905
|
+
"aria-activedescendant",
|
|
906
|
+
"for",
|
|
907
|
+
"form",
|
|
908
|
+
"list",
|
|
909
|
+
"headers",
|
|
910
|
+
"aria-details",
|
|
911
|
+
"aria-errormessage",
|
|
912
|
+
"aria-flowto"
|
|
913
|
+
]);
|
|
914
|
+
function V(n2) {
|
|
915
|
+
return n2.trim().split(/\s+/).some((e2) => D(e2));
|
|
916
|
+
}
|
|
917
|
+
class ft {
|
|
918
|
+
constructor(t2, e2) {
|
|
919
|
+
this.maxDepth = t2.maxPathDepth ?? 10, this.cache = e2;
|
|
920
|
+
}
|
|
921
|
+
/**
|
|
922
|
+
* Finds the best anchor element for the target
|
|
923
|
+
* @param target - Target element to find anchor for
|
|
924
|
+
* @returns Anchor result or null if not found
|
|
925
|
+
*/
|
|
926
|
+
findAnchor(t2) {
|
|
927
|
+
if (this.cache) {
|
|
928
|
+
const i2 = this.cache.getAnchor(t2);
|
|
929
|
+
if (i2 !== void 0)
|
|
930
|
+
return i2;
|
|
931
|
+
}
|
|
932
|
+
let e2 = t2.parentElement, s2 = 0, r2 = null;
|
|
933
|
+
for (; e2 && s2 < this.maxDepth; ) {
|
|
934
|
+
if (e2.tagName.toLowerCase() === "body")
|
|
935
|
+
return r2 || {
|
|
936
|
+
element: e2,
|
|
937
|
+
score: I.DEGRADED_SCORE,
|
|
938
|
+
tier: "C",
|
|
939
|
+
depth: s2
|
|
940
|
+
};
|
|
941
|
+
const i2 = this.scoreAnchor(e2);
|
|
942
|
+
if (i2 > 0) {
|
|
943
|
+
const o2 = this.applyDepthPenalty(i2, s2), l2 = this.getTier(e2), u2 = { element: e2, score: o2, tier: l2, depth: s2 };
|
|
944
|
+
if (l2 === "A")
|
|
945
|
+
return u2;
|
|
946
|
+
(!r2 || o2 > r2.score) && (r2 = u2);
|
|
947
|
+
}
|
|
948
|
+
e2 = e2.parentElement, s2++;
|
|
949
|
+
}
|
|
950
|
+
const a2 = r2;
|
|
951
|
+
return this.cache && this.cache.setAnchor(t2, a2), a2;
|
|
952
|
+
}
|
|
953
|
+
/**
|
|
954
|
+
* Scores an element as anchor candidate (without depth penalty)
|
|
955
|
+
* @param element - Element to score
|
|
956
|
+
* @returns Raw score from 0 to 1
|
|
957
|
+
*/
|
|
958
|
+
scoreAnchor(t2) {
|
|
959
|
+
let e2 = 0;
|
|
960
|
+
const s2 = t2.tagName.toLowerCase();
|
|
961
|
+
X.includes(s2) && (e2 += I.SEMANTIC_TAG);
|
|
962
|
+
const r2 = t2.getAttribute("role");
|
|
963
|
+
r2 && K.includes(r2) && (e2 += I.ROLE), (t2.hasAttribute("aria-label") || t2.hasAttribute("aria-labelledby")) && (e2 += I.ARIA_LABEL);
|
|
964
|
+
const a2 = t2.id;
|
|
965
|
+
return a2 && !D(a2) && (e2 += I.STABLE_ID), (t2.hasAttribute("data-testid") || t2.hasAttribute("data-qa") || t2.hasAttribute("data-test")) && (e2 += I.TEST_MARKER), Math.min(e2, 1);
|
|
966
|
+
}
|
|
967
|
+
/**
|
|
968
|
+
* Applies depth penalty to score
|
|
969
|
+
* Following SPECIFICATION.md §7: depthPenalty = (depth - threshold) * factor
|
|
970
|
+
*/
|
|
971
|
+
applyDepthPenalty(t2, e2) {
|
|
972
|
+
if (e2 <= I.DEPTH_PENALTY_THRESHOLD)
|
|
973
|
+
return t2;
|
|
974
|
+
const s2 = (e2 - I.DEPTH_PENALTY_THRESHOLD) * I.DEPTH_PENALTY_FACTOR;
|
|
975
|
+
return Math.max(0, t2 - s2);
|
|
976
|
+
}
|
|
977
|
+
/**
|
|
978
|
+
* Determines the tier of an anchor element
|
|
979
|
+
*/
|
|
980
|
+
getTier(t2) {
|
|
981
|
+
const e2 = t2.tagName.toLowerCase();
|
|
982
|
+
if (X.includes(e2))
|
|
983
|
+
return "A";
|
|
984
|
+
const s2 = t2.getAttribute("role");
|
|
985
|
+
return s2 && K.includes(s2) ? "B" : "C";
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
const gt = [
|
|
989
|
+
// CSS-in-JS
|
|
990
|
+
/^css-[a-z0-9]+$/i,
|
|
991
|
+
/^sc-[a-z0-9]+-\d+$/i,
|
|
992
|
+
/^[a-z]{5,8}$/i,
|
|
993
|
+
// Short generated classes (abcdef)
|
|
994
|
+
// Material-UI / MUI
|
|
995
|
+
/^Mui[A-Z]\w+-\w+-\w+/,
|
|
996
|
+
/^makeStyles-\w+-\d+$/,
|
|
997
|
+
// JSS
|
|
998
|
+
/^jss\d+$/,
|
|
999
|
+
// Emotion / Linaria
|
|
1000
|
+
/^(emotion|linaria)-[a-z0-9]+/i,
|
|
1001
|
+
// Component libraries with hashes
|
|
1002
|
+
/^(chakra|tw-|ant-)[a-z0-9]+-\w+/i,
|
|
1003
|
+
// Hash-based (hashes in classes)
|
|
1004
|
+
/-[a-f0-9]{6,}$/i,
|
|
1005
|
+
/^_[a-z0-9]{5,}$/i,
|
|
1006
|
+
/\d{5,}/
|
|
1007
|
+
// 5+ digits in a row
|
|
1008
|
+
], pt = [
|
|
1009
|
+
// === FIX 4: Tailwind arbitrary values and variants (highest priority) ===
|
|
1010
|
+
/^\[/,
|
|
1011
|
+
// Any arbitrary value or variant starting with [ (e.g., [&_svg]:..., [mask-type:luminance])
|
|
1012
|
+
// === FIX 4: Pseudo-class variants (must be before specific patterns) ===
|
|
1013
|
+
/^(first|last|odd|even|only|first-of-type|last-of-type|only-of-type):/,
|
|
1014
|
+
// first:, last:, etc.
|
|
1015
|
+
/^(hover|focus|active|disabled|enabled|checked|indeterminate|default|required|valid|invalid|in-range|out-of-range|placeholder-shown|autofill|read-only):/,
|
|
1016
|
+
// State pseudo-classes
|
|
1017
|
+
/^(focus-within|focus-visible|visited|target|open):/,
|
|
1018
|
+
// Advanced pseudo-classes
|
|
1019
|
+
// === FIX 4: Responsive variants (must be before specific patterns) ===
|
|
1020
|
+
/^(sm|md|lg|xl|2xl|3xl|4xl|5xl|6xl|7xl):/,
|
|
1021
|
+
// === FIX 4: Dark mode and directional variants ===
|
|
1022
|
+
/^dark:/,
|
|
1023
|
+
/^(rtl|ltr):/,
|
|
1024
|
+
// === FIX 4: Group and peer variants ===
|
|
1025
|
+
/^(group|peer)(-hover|-focus|-active)?:/,
|
|
1026
|
+
// === FIX 4: Tailwind utilities with fraction values ===
|
|
1027
|
+
/\/([\d.]+|full|auto|screen)$/,
|
|
1028
|
+
// /50, /100, /full, /auto, /screen
|
|
1029
|
+
// === FIX 4: Positioning utilities ===
|
|
1030
|
+
/^(inset|top|right|bottom|left)(-|$)/,
|
|
1031
|
+
// inset-0, top-0, left-0
|
|
1032
|
+
// === Layout & Display ===
|
|
1033
|
+
/^(flex|inline-flex|grid|block|inline|inline-block|hidden|visible)$/,
|
|
1034
|
+
/^(absolute|relative|fixed|sticky|static)$/,
|
|
1035
|
+
// === Flexbox & Grid ===
|
|
1036
|
+
/^(items|justify|content|self|place)-/,
|
|
1037
|
+
/^flex-(row|col|wrap|nowrap|1|auto|initial|none)/,
|
|
1038
|
+
/^grid-(cols|rows|flow)/,
|
|
1039
|
+
// === Spacing (Tailwind) ===
|
|
1040
|
+
/^(gap|space)-/,
|
|
1041
|
+
/^[mp][trblxy]?-(\d+|auto|px)$/,
|
|
1042
|
+
// === Negative Tailwind utilities (margins, positioning, transforms) ===
|
|
1043
|
+
/^-[mp][trblxy]?-\d+$/,
|
|
1044
|
+
// -m-4, -mt-2, -mx-4, -px-4, -py-2
|
|
1045
|
+
/^-(top|right|bottom|left|inset)-\d+$/,
|
|
1046
|
+
// -top-4, -bottom-6, -left-6, -inset-0
|
|
1047
|
+
/^-z-\d+$/,
|
|
1048
|
+
// -z-10, -z-20
|
|
1049
|
+
/^-space-[xy]-\d+$/,
|
|
1050
|
+
// -space-x-2, -space-y-4
|
|
1051
|
+
/^-translate-[xy]-\d+$/,
|
|
1052
|
+
// -translate-x-4, -translate-y-2
|
|
1053
|
+
/^-rotate-\d+$/,
|
|
1054
|
+
// -rotate-45, -rotate-90
|
|
1055
|
+
/^-scale-\d+$/,
|
|
1056
|
+
// -scale-50, -scale-75
|
|
1057
|
+
/^-skew-[xy]-\d+$/,
|
|
1058
|
+
// -skew-x-12, -skew-y-6
|
|
1059
|
+
// === Sizing ===
|
|
1060
|
+
/^(w|h|min-w|min-h|max-w|max-h|size)-/,
|
|
1061
|
+
// === Colors & Styling ===
|
|
1062
|
+
// Note: text-* can be semantic (text-muted, text-primary) or utility (text-center, text-lg)
|
|
1063
|
+
// More specific patterns for utility text-* classes
|
|
1064
|
+
/^text-(center|left|right|justify|start|end|xs|sm|base|lg|xl|2xl|3xl|4xl|5xl|6xl|7xl|8xl|9xl)$/,
|
|
1065
|
+
/^text-(uppercase|lowercase|capitalize|normal-case|underline|line-through|no-underline)$/,
|
|
1066
|
+
/^text-(truncate|ellipsis|clip)$/,
|
|
1067
|
+
/^(bg|border|ring|shadow|outline)-/,
|
|
1068
|
+
/^rounded(-|$)/,
|
|
1069
|
+
// === Typography ===
|
|
1070
|
+
/^(font|leading|tracking|whitespace|break|truncate)-/,
|
|
1071
|
+
/^(uppercase|lowercase|capitalize|normal-case)$/,
|
|
1072
|
+
// === Transform & Animation (IMPORTANT!) ===
|
|
1073
|
+
/^(transform|transition|duration|delay|ease|animate)-/,
|
|
1074
|
+
/^(scale|rotate|translate|skew)-/,
|
|
1075
|
+
/^transform$/,
|
|
1076
|
+
/^backdrop-blur-/,
|
|
1077
|
+
/^motion-/,
|
|
1078
|
+
// Framer Motion
|
|
1079
|
+
/^(fade|slide|zoom|bounce|pulse|spin|ping)-/,
|
|
1080
|
+
// animations
|
|
1081
|
+
// === Overflow & Scrolling ===
|
|
1082
|
+
/^(overflow|overscroll|scroll)-/,
|
|
1083
|
+
/^object-(contain|cover|fill|none|scale-down)$/,
|
|
1084
|
+
// === Interactivity ===
|
|
1085
|
+
/^(cursor|pointer-events|select|resize)-/,
|
|
1086
|
+
// === Visibility & Opacity ===
|
|
1087
|
+
/^(opacity|z)-/,
|
|
1088
|
+
/^(visible|invisible|collapse)$/,
|
|
1089
|
+
// === Bootstrap utilities ===
|
|
1090
|
+
/^d-(none|inline|inline-block|block|grid|table|flex)$/,
|
|
1091
|
+
/^(float|clearfix|text)-(left|right|center|justify|start|end)$/,
|
|
1092
|
+
/^(m|p)[trblxy]?-[0-5]$/,
|
|
1093
|
+
/^(w|h)-(25|50|75|100|auto)$/,
|
|
1094
|
+
// Note: btn-* classes are semantic (component classes), not utility
|
|
1095
|
+
// /^btn-(primary|secondary|success|danger|warning|info|light|dark|link)$/,
|
|
1096
|
+
/^btn-(sm|lg|block)$/,
|
|
1097
|
+
// Only size modifiers are utility
|
|
1098
|
+
/^text-(muted|primary|success|danger|warning|info|light|dark|white)$/,
|
|
1099
|
+
/^bg-(primary|secondary|success|danger|warning|info|light|dark|white|transparent)$/,
|
|
1100
|
+
/^border(-top|-bottom|-left|-right)?(-0)?$/,
|
|
1101
|
+
/^rounded(-top|-bottom|-left|-right|-circle|-pill|-0)?$/,
|
|
1102
|
+
/^shadow(-sm|-lg|-none)?$/,
|
|
1103
|
+
/^(align|justify|order|flex)-(start|end|center|between|around|fill|grow|shrink)$/,
|
|
1104
|
+
/^col(-sm|-md|-lg|-xl)?(-\d+|-auto)?$/,
|
|
1105
|
+
/^row(-cols)?(-\d+)?$/,
|
|
1106
|
+
/^g[xy]?-[0-5]$/,
|
|
1107
|
+
/^(show|hide|invisible|visible)$/,
|
|
1108
|
+
/^(position|top|bottom|start|end)-(static|relative|absolute|fixed|sticky|-\d+)$/,
|
|
1109
|
+
// === Common utility patterns ===
|
|
1110
|
+
/^(row|col)$/,
|
|
1111
|
+
/^clearfix$/,
|
|
1112
|
+
/^pull-(left|right)$/,
|
|
1113
|
+
/^float-(left|right|none)$/
|
|
1114
|
+
];
|
|
1115
|
+
function _(n2) {
|
|
1116
|
+
return gt.some((t2) => t2.test(n2));
|
|
1117
|
+
}
|
|
1118
|
+
function q(n2) {
|
|
1119
|
+
return n2.length <= 2 || /^\d/.test(n2) ? true : pt.some((t2) => t2.test(n2));
|
|
1120
|
+
}
|
|
1121
|
+
function St(n2) {
|
|
1122
|
+
return !_(n2) && !q(n2);
|
|
1123
|
+
}
|
|
1124
|
+
function N(n2) {
|
|
1125
|
+
return n2.filter((t2) => St(t2));
|
|
1126
|
+
}
|
|
1127
|
+
function At(n2) {
|
|
1128
|
+
const t2 = [], e2 = [];
|
|
1129
|
+
for (const s2 of n2)
|
|
1130
|
+
q(s2) || _(s2) ? e2.push(s2) : t2.push(s2);
|
|
1131
|
+
return { semantic: t2, utility: e2 };
|
|
1132
|
+
}
|
|
1133
|
+
function J(n2) {
|
|
1134
|
+
return q(n2) || _(n2);
|
|
1135
|
+
}
|
|
1136
|
+
const tt = (n2) => n2.replace(/([#:.[\]@])/g, "\\$1");
|
|
1137
|
+
class xt {
|
|
1138
|
+
constructor(t2, e2) {
|
|
1139
|
+
this.maxDepth = t2.maxPathDepth ?? 10, this.cache = e2;
|
|
1140
|
+
}
|
|
1141
|
+
/**
|
|
1142
|
+
* Builds path from anchor to target (excluding both)
|
|
1143
|
+
* @param anchor - Anchor element (start)
|
|
1144
|
+
* @param target - Target element (end)
|
|
1145
|
+
* @param extractor - Semantic extractor instance
|
|
1146
|
+
* @returns Path build result with nodes and degradation info
|
|
1147
|
+
*/
|
|
1148
|
+
buildPath(t2, e2, s2) {
|
|
1149
|
+
const r2 = [];
|
|
1150
|
+
let a2 = e2.parentElement;
|
|
1151
|
+
for (; a2 && a2 !== t2 && r2.length < this.maxDepth; )
|
|
1152
|
+
r2.unshift(a2), a2 = a2.parentElement;
|
|
1153
|
+
const i2 = r2.length >= this.maxDepth && a2 !== t2;
|
|
1154
|
+
let o2 = this.filterNoise(r2);
|
|
1155
|
+
return o2 = this.ensureUniqueness(r2, o2, t2, e2, s2), {
|
|
1156
|
+
path: o2.map((u2) => {
|
|
1157
|
+
const d = u2.parentElement;
|
|
1158
|
+
let c2;
|
|
1159
|
+
if (d) {
|
|
1160
|
+
const g = Array.from(d.children).indexOf(u2);
|
|
1161
|
+
g !== -1 && (c2 = g + 1);
|
|
1162
|
+
}
|
|
1163
|
+
return {
|
|
1164
|
+
tag: u2.tagName.toLowerCase(),
|
|
1165
|
+
semantics: s2.extract(u2),
|
|
1166
|
+
score: s2.scoreElement(u2),
|
|
1167
|
+
nthChild: c2
|
|
1168
|
+
};
|
|
1169
|
+
}),
|
|
1170
|
+
degraded: i2,
|
|
1171
|
+
degradationReason: i2 ? "path-depth-overflow" : void 0
|
|
1172
|
+
};
|
|
1173
|
+
}
|
|
1174
|
+
/**
|
|
1175
|
+
* Legacy method for backward compatibility
|
|
1176
|
+
*/
|
|
1177
|
+
buildPathNodes(t2, e2, s2) {
|
|
1178
|
+
return this.buildPath(t2, e2, s2).path;
|
|
1179
|
+
}
|
|
1180
|
+
/**
|
|
1181
|
+
* Ensures path uniqueness by adding nodes if needed
|
|
1182
|
+
* Following SPECIFICATION.md §8 Disambiguation Algorithm
|
|
1183
|
+
*/
|
|
1184
|
+
ensureUniqueness(t2, e2, s2, r2, a2) {
|
|
1185
|
+
const i2 = this.buildTestSelector(s2, e2, r2);
|
|
1186
|
+
try {
|
|
1187
|
+
const o2 = r2.ownerDocument;
|
|
1188
|
+
if (!o2) return e2;
|
|
1189
|
+
let l2;
|
|
1190
|
+
if (this.cache) {
|
|
1191
|
+
const d = this.cache.getSelectorResults(i2);
|
|
1192
|
+
d !== void 0 ? l2 = d : (l2 = Array.from(o2.querySelectorAll(i2)), this.cache.setSelectorResults(i2, l2));
|
|
1193
|
+
} else
|
|
1194
|
+
l2 = o2.querySelectorAll(i2);
|
|
1195
|
+
if (l2.length <= 1)
|
|
1196
|
+
return e2;
|
|
1197
|
+
const u2 = t2.filter((d) => !e2.includes(d));
|
|
1198
|
+
for (const d of u2) {
|
|
1199
|
+
if (a2.scoreElement(d) < ct.MIN_CONFIDENCE_FOR_SKIP)
|
|
1200
|
+
continue;
|
|
1201
|
+
const h = this.insertNodeInOrder(e2, d, t2), g = this.buildTestSelector(s2, h, r2);
|
|
1202
|
+
try {
|
|
1203
|
+
let f2;
|
|
1204
|
+
if (this.cache) {
|
|
1205
|
+
const p = this.cache.getSelectorResults(g);
|
|
1206
|
+
p !== void 0 ? f2 = p : (f2 = Array.from(o2.querySelectorAll(g)), this.cache.setSelectorResults(g, f2));
|
|
1207
|
+
} else
|
|
1208
|
+
f2 = o2.querySelectorAll(g);
|
|
1209
|
+
if (f2.length === 1)
|
|
1210
|
+
return h;
|
|
1211
|
+
f2.length < l2.length && (e2 = h);
|
|
1212
|
+
} catch {
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
return e2;
|
|
1216
|
+
} catch {
|
|
1217
|
+
return e2;
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
/**
|
|
1221
|
+
* Inserts node into path maintaining original order
|
|
1222
|
+
*/
|
|
1223
|
+
insertNodeInOrder(t2, e2, s2) {
|
|
1224
|
+
const r2 = s2.indexOf(e2), a2 = [...t2];
|
|
1225
|
+
let i2 = 0;
|
|
1226
|
+
for (let o2 = 0; o2 < a2.length && !(s2.indexOf(a2[o2]) > r2); o2++)
|
|
1227
|
+
i2 = o2 + 1;
|
|
1228
|
+
return a2.splice(i2, 0, e2), a2;
|
|
1229
|
+
}
|
|
1230
|
+
/**
|
|
1231
|
+
* Builds a test CSS selector from path
|
|
1232
|
+
*/
|
|
1233
|
+
buildTestSelector(t2, e2, s2) {
|
|
1234
|
+
const r2 = [];
|
|
1235
|
+
r2.push(this.elementToSelector(t2));
|
|
1236
|
+
for (const a2 of e2)
|
|
1237
|
+
r2.push(this.elementToSelector(a2));
|
|
1238
|
+
return r2.push(this.elementToSelector(s2)), r2.join(" ");
|
|
1239
|
+
}
|
|
1240
|
+
/**
|
|
1241
|
+
* Converts element to basic CSS selector
|
|
1242
|
+
*/
|
|
1243
|
+
elementToSelector(t2) {
|
|
1244
|
+
let e2 = t2.tagName.toLowerCase();
|
|
1245
|
+
t2.id && !D(t2.id) && (e2 += `#${tt(t2.id)}`);
|
|
1246
|
+
for (const s2 of Array.from(t2.classList))
|
|
1247
|
+
J(s2) || (e2 += `.${tt(s2)}`);
|
|
1248
|
+
return e2;
|
|
1249
|
+
}
|
|
1250
|
+
/**
|
|
1251
|
+
* Filters out noise/layout elements
|
|
1252
|
+
*/
|
|
1253
|
+
filterNoise(t2) {
|
|
1254
|
+
return t2.filter((e2) => this.shouldInclude(e2));
|
|
1255
|
+
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Determines if element should be included in path
|
|
1258
|
+
*/
|
|
1259
|
+
shouldInclude(t2) {
|
|
1260
|
+
const e2 = t2.tagName.toLowerCase();
|
|
1261
|
+
return lt.includes(e2) ? true : e2 === "div" || e2 === "span" ? this.hasSemanticFeatures(t2) : false;
|
|
1262
|
+
}
|
|
1263
|
+
/**
|
|
1264
|
+
* Checks if element has meaningful semantic features
|
|
1265
|
+
*/
|
|
1266
|
+
hasSemanticFeatures(t2) {
|
|
1267
|
+
if (t2.hasAttribute("role")) return true;
|
|
1268
|
+
for (const s2 of Array.from(t2.attributes))
|
|
1269
|
+
if (s2.name.startsWith("aria-")) return true;
|
|
1270
|
+
if (t2.classList.length > 0) {
|
|
1271
|
+
for (const s2 of Array.from(t2.classList))
|
|
1272
|
+
if (!J(s2)) return true;
|
|
1273
|
+
}
|
|
1274
|
+
if (t2.hasAttribute("data-testid") || t2.hasAttribute("data-qa") || t2.hasAttribute("data-test"))
|
|
1275
|
+
return true;
|
|
1276
|
+
const e2 = t2.id;
|
|
1277
|
+
return !!(e2 && !D(e2));
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
function Q(n2) {
|
|
1281
|
+
return n2 ? n2.trim().replace(/[\n\t\r]/g, " ").replace(/\s+/g, " ") : "";
|
|
1282
|
+
}
|
|
1283
|
+
const Ct = {
|
|
1284
|
+
preserveQueryForAbsolute: true,
|
|
1285
|
+
removeDynamicHashes: true
|
|
1286
|
+
};
|
|
1287
|
+
function Tt(n2) {
|
|
1288
|
+
return n2 ? [
|
|
1289
|
+
/\d{5,}/,
|
|
1290
|
+
// 5+ digits
|
|
1291
|
+
/[a-f0-9]{8,}/i,
|
|
1292
|
+
// hex hash 8+ characters
|
|
1293
|
+
/(session|token|temp|random|timestamp|nonce|cache)/i,
|
|
1294
|
+
// dynamic words
|
|
1295
|
+
/^\d+$/,
|
|
1296
|
+
// only digits
|
|
1297
|
+
/^[a-f0-9-]{32,}$/i
|
|
1298
|
+
// UUID-like
|
|
1299
|
+
].some((e2) => e2.test(n2)) : false;
|
|
1300
|
+
}
|
|
1301
|
+
function Et(n2, t2) {
|
|
1302
|
+
if (!n2) return n2;
|
|
1303
|
+
const e2 = n2.startsWith("http://") || n2.startsWith("https://"), [s2, r2] = n2.split("#"), [a2, i2] = s2.split("?");
|
|
1304
|
+
let o2 = a2;
|
|
1305
|
+
return e2 && t2.preserveQueryForAbsolute && i2 && (o2 += `?${i2}`), r2 && (t2.removeDynamicHashes && Tt(r2) || (o2 += `#${r2}`)), o2;
|
|
1306
|
+
}
|
|
1307
|
+
function k(n2, t2, e2 = {}) {
|
|
1308
|
+
if (!t2) return t2;
|
|
1309
|
+
const s2 = { ...Ct, ...e2 };
|
|
1310
|
+
return n2 === "href" || n2 === "src" ? Et(t2, s2) : t2;
|
|
1311
|
+
}
|
|
1312
|
+
const wt = [
|
|
1313
|
+
"role",
|
|
1314
|
+
"aria-label",
|
|
1315
|
+
"aria-labelledby",
|
|
1316
|
+
"aria-describedby",
|
|
1317
|
+
"aria-controls",
|
|
1318
|
+
"aria-owns",
|
|
1319
|
+
"aria-level",
|
|
1320
|
+
"aria-posinset",
|
|
1321
|
+
"aria-setsize",
|
|
1322
|
+
"aria-haspopup"
|
|
1323
|
+
], vt = [
|
|
1324
|
+
"aria-selected",
|
|
1325
|
+
"aria-checked",
|
|
1326
|
+
"aria-pressed",
|
|
1327
|
+
"aria-expanded",
|
|
1328
|
+
"aria-hidden",
|
|
1329
|
+
"aria-disabled",
|
|
1330
|
+
"aria-current",
|
|
1331
|
+
"aria-busy",
|
|
1332
|
+
"aria-invalid",
|
|
1333
|
+
"aria-grabbed",
|
|
1334
|
+
"aria-live",
|
|
1335
|
+
"aria-atomic"
|
|
1336
|
+
], $t = [
|
|
1337
|
+
"data-state",
|
|
1338
|
+
"data-active",
|
|
1339
|
+
"data-inactive",
|
|
1340
|
+
"data-selected",
|
|
1341
|
+
"data-open",
|
|
1342
|
+
"data-closed",
|
|
1343
|
+
"data-visible",
|
|
1344
|
+
"data-hidden",
|
|
1345
|
+
"data-disabled",
|
|
1346
|
+
"data-enabled",
|
|
1347
|
+
"data-loading",
|
|
1348
|
+
"data-error",
|
|
1349
|
+
"data-success",
|
|
1350
|
+
"data-highlighted",
|
|
1351
|
+
"data-focused",
|
|
1352
|
+
"data-hover",
|
|
1353
|
+
"data-orientation",
|
|
1354
|
+
"data-theme"
|
|
1355
|
+
], Mt = [
|
|
1356
|
+
"data-radix-",
|
|
1357
|
+
"data-headlessui-",
|
|
1358
|
+
"data-reach-",
|
|
1359
|
+
"data-mui-",
|
|
1360
|
+
"data-chakra-",
|
|
1361
|
+
"data-mantine-",
|
|
1362
|
+
"data-tw-"
|
|
1363
|
+
], It = [
|
|
1364
|
+
"data-testid",
|
|
1365
|
+
"data-test-id",
|
|
1366
|
+
"data-test",
|
|
1367
|
+
"data-cy",
|
|
1368
|
+
"data-qa",
|
|
1369
|
+
"data-automation-id",
|
|
1370
|
+
"data-id",
|
|
1371
|
+
"data-component",
|
|
1372
|
+
"data-entity-id",
|
|
1373
|
+
"data-product-id",
|
|
1374
|
+
"data-user-id"
|
|
1375
|
+
], Rt = [
|
|
1376
|
+
"id",
|
|
1377
|
+
"name",
|
|
1378
|
+
"type",
|
|
1379
|
+
"placeholder",
|
|
1380
|
+
"title",
|
|
1381
|
+
"for",
|
|
1382
|
+
"alt",
|
|
1383
|
+
"href"
|
|
1384
|
+
], Nt = [
|
|
1385
|
+
"disabled",
|
|
1386
|
+
"checked",
|
|
1387
|
+
"selected",
|
|
1388
|
+
"hidden",
|
|
1389
|
+
"readonly",
|
|
1390
|
+
"required",
|
|
1391
|
+
"value"
|
|
1392
|
+
], Dt = [
|
|
1393
|
+
/^radix-/,
|
|
1394
|
+
/^headlessui-/,
|
|
1395
|
+
/^mui-/,
|
|
1396
|
+
/:\w+:/
|
|
1397
|
+
// matches :ru:, :r1:, etc.
|
|
1398
|
+
];
|
|
1399
|
+
function Ht(n2, t2) {
|
|
1400
|
+
return wt.includes(n2) ? true : vt.includes(n2) || $t.includes(n2) || Mt.some((e2) => n2.startsWith(e2)) ? false : It.includes(n2) || n2.startsWith("data-") && n2.endsWith("-id") ? true : n2 === "id" ? !Dt.some((e2) => e2.test(t2)) : Rt.includes(n2) ? true : Nt.includes(n2) ? false : !!n2.startsWith("data-");
|
|
1401
|
+
}
|
|
1402
|
+
class Pt {
|
|
1403
|
+
constructor(t2, e2) {
|
|
1404
|
+
this.includeUtilityClasses = t2.includeUtilityClasses ?? false, this.cache = e2;
|
|
1405
|
+
}
|
|
1406
|
+
/**
|
|
1407
|
+
* Extracts semantic features from element
|
|
1408
|
+
* @param element - DOM element to extract from
|
|
1409
|
+
* @returns Semantic features object
|
|
1410
|
+
*/
|
|
1411
|
+
extract(t2) {
|
|
1412
|
+
if (this.cache) {
|
|
1413
|
+
const i2 = this.cache.getSemantics(t2);
|
|
1414
|
+
if (i2 !== void 0)
|
|
1415
|
+
return i2;
|
|
1416
|
+
}
|
|
1417
|
+
const e2 = {}, s2 = t2.id;
|
|
1418
|
+
if (s2 && !D(s2) && (e2.id = s2), t2.classList.length > 0) {
|
|
1419
|
+
const i2 = Array.from(t2.classList);
|
|
1420
|
+
if (this.includeUtilityClasses)
|
|
1421
|
+
e2.classes = i2;
|
|
1422
|
+
else {
|
|
1423
|
+
const { semantic: o2 } = At(i2);
|
|
1424
|
+
o2.length > 0 && (e2.classes = o2);
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
const r2 = this.extractAttributes(t2);
|
|
1428
|
+
Object.keys(r2).length > 0 && (e2.attributes = r2);
|
|
1429
|
+
const a2 = t2.getAttribute("role");
|
|
1430
|
+
if (a2 && (e2.role = a2), this.shouldExtractText(t2)) {
|
|
1431
|
+
const i2 = this.extractText(t2);
|
|
1432
|
+
i2 && (e2.text = i2);
|
|
1433
|
+
}
|
|
1434
|
+
return this.cache && this.cache.setSemantics(t2, e2), e2;
|
|
1435
|
+
}
|
|
1436
|
+
/**
|
|
1437
|
+
* Scores element based on semantic richness
|
|
1438
|
+
* @param element - Element to score
|
|
1439
|
+
* @returns Score from 0 to 1
|
|
1440
|
+
*/
|
|
1441
|
+
scoreElement(t2) {
|
|
1442
|
+
let e2 = 0.5;
|
|
1443
|
+
const s2 = this.extract(t2);
|
|
1444
|
+
return s2.id && (e2 += 0.15), s2.classes && s2.classes.length > 0 && (e2 += 0.1), s2.attributes && Object.keys(s2.attributes).length > 0 && (e2 += 0.1), s2.role && (e2 += 0.1), s2.text && (e2 += 0.05), Math.min(e2, 1);
|
|
1445
|
+
}
|
|
1446
|
+
/**
|
|
1447
|
+
* Checks if attribute should be ignored
|
|
1448
|
+
* @param attrName - Attribute name
|
|
1449
|
+
* @returns True if should be ignored
|
|
1450
|
+
*/
|
|
1451
|
+
shouldIgnoreAttribute(t2) {
|
|
1452
|
+
return !!(B.has(t2) || t2.startsWith("on") || t2.startsWith("ng-") || t2.startsWith("_ng") || t2.startsWith("data-reactid") || t2.startsWith("data-react") || t2.startsWith("data-v-"));
|
|
1453
|
+
}
|
|
1454
|
+
/**
|
|
1455
|
+
* Gets attribute priority
|
|
1456
|
+
* @param attrName - Attribute name
|
|
1457
|
+
* @returns Priority number (higher = more priority)
|
|
1458
|
+
*/
|
|
1459
|
+
getAttributePriority(t2) {
|
|
1460
|
+
return w[t2] !== void 0 ? w[t2] : t2.startsWith("data-") ? w["data-*"] : t2.startsWith("aria-") ? w["aria-*"] : 0;
|
|
1461
|
+
}
|
|
1462
|
+
/**
|
|
1463
|
+
* Checks if attribute value is dynamic (should be ignored)
|
|
1464
|
+
* @param value - Attribute value
|
|
1465
|
+
* @returns True if value is dynamic
|
|
1466
|
+
*/
|
|
1467
|
+
isDynamicValue(t2) {
|
|
1468
|
+
return [
|
|
1469
|
+
/^[a-f0-9]{32,}$/i,
|
|
1470
|
+
// Long hashes
|
|
1471
|
+
/^\d{10,}$/,
|
|
1472
|
+
// Timestamp
|
|
1473
|
+
/^(undefined|null|\[object)/,
|
|
1474
|
+
// JS artifacts
|
|
1475
|
+
/^{{.*}}$/
|
|
1476
|
+
// Template literals
|
|
1477
|
+
].some((s2) => s2.test(t2));
|
|
1478
|
+
}
|
|
1479
|
+
/**
|
|
1480
|
+
* Extracts relevant semantic attributes from element
|
|
1481
|
+
* Iterates through all attributes and filters by priority
|
|
1482
|
+
*/
|
|
1483
|
+
extractAttributes(t2) {
|
|
1484
|
+
const e2 = {};
|
|
1485
|
+
for (const s2 of Array.from(t2.attributes)) {
|
|
1486
|
+
const r2 = s2.name;
|
|
1487
|
+
if (this.shouldIgnoreAttribute(r2) || !Ht(r2, s2.value) || G.has(r2) && V(s2.value) || this.getAttributePriority(r2) === 0) continue;
|
|
1488
|
+
const i2 = r2 === "href" || r2 === "src" ? k(r2, s2.value) : s2.value;
|
|
1489
|
+
!i2 || i2.trim() === "" || this.isDynamicValue(i2) || (e2[r2] = i2);
|
|
1490
|
+
}
|
|
1491
|
+
return e2;
|
|
1492
|
+
}
|
|
1493
|
+
/**
|
|
1494
|
+
* Extracts and normalizes text content
|
|
1495
|
+
*/
|
|
1496
|
+
extractText(t2) {
|
|
1497
|
+
const e2 = this.getDirectTextContent(t2);
|
|
1498
|
+
if (!e2) return null;
|
|
1499
|
+
const s2 = Q(e2);
|
|
1500
|
+
if (!s2) return null;
|
|
1501
|
+
const r2 = 100, a2 = e2.length > r2 ? e2.slice(0, r2) + "..." : e2, i2 = s2.length > r2 ? s2.slice(0, r2) + "..." : s2;
|
|
1502
|
+
return {
|
|
1503
|
+
raw: a2,
|
|
1504
|
+
normalized: i2
|
|
1505
|
+
};
|
|
1506
|
+
}
|
|
1507
|
+
/**
|
|
1508
|
+
* Gets direct text content excluding child elements
|
|
1509
|
+
*/
|
|
1510
|
+
getDirectTextContent(t2) {
|
|
1511
|
+
const e2 = [];
|
|
1512
|
+
for (const s2 of Array.from(t2.childNodes))
|
|
1513
|
+
if (s2.nodeType === Node.TEXT_NODE && s2.textContent) {
|
|
1514
|
+
const r2 = s2.textContent.trim();
|
|
1515
|
+
r2 && e2.push(r2);
|
|
1516
|
+
}
|
|
1517
|
+
return e2.length > 0 ? e2.join(" ") : t2.textContent ?? null;
|
|
1518
|
+
}
|
|
1519
|
+
/**
|
|
1520
|
+
* Determines if text should be extracted for this element
|
|
1521
|
+
*/
|
|
1522
|
+
shouldExtractText(t2) {
|
|
1523
|
+
const e2 = t2.tagName.toLowerCase();
|
|
1524
|
+
return [
|
|
1525
|
+
"button",
|
|
1526
|
+
"a",
|
|
1527
|
+
"label",
|
|
1528
|
+
"h1",
|
|
1529
|
+
"h2",
|
|
1530
|
+
"h3",
|
|
1531
|
+
"h4",
|
|
1532
|
+
"h5",
|
|
1533
|
+
"h6",
|
|
1534
|
+
"p",
|
|
1535
|
+
"span",
|
|
1536
|
+
"li",
|
|
1537
|
+
"th",
|
|
1538
|
+
"td",
|
|
1539
|
+
"dt",
|
|
1540
|
+
"dd",
|
|
1541
|
+
"legend",
|
|
1542
|
+
"figcaption",
|
|
1543
|
+
"summary"
|
|
1544
|
+
].includes(e2);
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
class kt {
|
|
1548
|
+
/**
|
|
1549
|
+
* Generates fingerprint for SVG element
|
|
1550
|
+
* @param element - SVG element to fingerprint
|
|
1551
|
+
* @returns SVG fingerprint object
|
|
1552
|
+
*/
|
|
1553
|
+
fingerprint(t2) {
|
|
1554
|
+
const e2 = t2.tagName.toLowerCase(), s2 = this.getShape(e2), r2 = {
|
|
1555
|
+
shape: s2,
|
|
1556
|
+
hasAnimation: this.hasAnimation(t2)
|
|
1557
|
+
};
|
|
1558
|
+
if (s2 === "path") {
|
|
1559
|
+
const o2 = t2.getAttribute("d");
|
|
1560
|
+
o2 && (r2.dHash = this.computePathHash(o2));
|
|
1561
|
+
} else ["circle", "rect", "ellipse", "line"].includes(s2) && (r2.geomHash = this.computeGeomHash(t2, s2));
|
|
1562
|
+
const a2 = t2.getAttribute("role");
|
|
1563
|
+
a2 && (r2.role = a2);
|
|
1564
|
+
const i2 = t2.querySelector("title");
|
|
1565
|
+
return (i2 == null ? void 0 : i2.textContent) && (r2.titleText = i2.textContent.trim()), r2;
|
|
1566
|
+
}
|
|
1567
|
+
/**
|
|
1568
|
+
* Computes hash from path data (first N commands)
|
|
1569
|
+
* @param d - SVG path d attribute value
|
|
1570
|
+
* @returns Hash string
|
|
1571
|
+
*/
|
|
1572
|
+
computePathHash(t2) {
|
|
1573
|
+
const e2 = this.normalizePathData(t2);
|
|
1574
|
+
return this.simpleHash(e2);
|
|
1575
|
+
}
|
|
1576
|
+
/**
|
|
1577
|
+
* Gets the shape type from tag name
|
|
1578
|
+
*/
|
|
1579
|
+
getShape(t2) {
|
|
1580
|
+
return [
|
|
1581
|
+
"path",
|
|
1582
|
+
"circle",
|
|
1583
|
+
"rect",
|
|
1584
|
+
"line",
|
|
1585
|
+
"polyline",
|
|
1586
|
+
"polygon",
|
|
1587
|
+
"ellipse",
|
|
1588
|
+
"g",
|
|
1589
|
+
"text",
|
|
1590
|
+
"use",
|
|
1591
|
+
"svg"
|
|
1592
|
+
].find((s2) => s2 === t2) ?? "path";
|
|
1593
|
+
}
|
|
1594
|
+
/**
|
|
1595
|
+
* Normalizes path data for consistent hashing
|
|
1596
|
+
*/
|
|
1597
|
+
normalizePathData(t2) {
|
|
1598
|
+
return (t2.match(/[MLHVCSQTAZ][^MLHVCSQTAZ]*/gi) ?? []).slice(0, 5).map((r2) => r2.trim().replace(/(-?\d+\.?\d*)/g, (a2) => parseFloat(a2).toFixed(1))).join(" ");
|
|
1599
|
+
}
|
|
1600
|
+
/**
|
|
1601
|
+
* Computes geometry hash for non-path shapes
|
|
1602
|
+
*/
|
|
1603
|
+
computeGeomHash(t2, e2) {
|
|
1604
|
+
const s2 = [];
|
|
1605
|
+
switch (e2) {
|
|
1606
|
+
case "circle":
|
|
1607
|
+
s2.push(`r=${t2.getAttribute("r") ?? "0"}`);
|
|
1608
|
+
break;
|
|
1609
|
+
case "rect":
|
|
1610
|
+
{
|
|
1611
|
+
const r2 = parseFloat(t2.getAttribute("width") ?? "0"), a2 = parseFloat(t2.getAttribute("height") ?? "0");
|
|
1612
|
+
r2 > 0 && a2 > 0 && s2.push(`ratio=${(r2 / a2).toFixed(2)}`);
|
|
1613
|
+
}
|
|
1614
|
+
break;
|
|
1615
|
+
case "ellipse":
|
|
1616
|
+
{
|
|
1617
|
+
const r2 = parseFloat(t2.getAttribute("rx") ?? "0"), a2 = parseFloat(t2.getAttribute("ry") ?? "0");
|
|
1618
|
+
r2 > 0 && a2 > 0 && s2.push(`ratio=${(r2 / a2).toFixed(2)}`);
|
|
1619
|
+
}
|
|
1620
|
+
break;
|
|
1621
|
+
case "line":
|
|
1622
|
+
{
|
|
1623
|
+
const r2 = parseFloat(t2.getAttribute("x1") ?? "0"), a2 = parseFloat(t2.getAttribute("y1") ?? "0"), i2 = parseFloat(t2.getAttribute("x2") ?? "0"), o2 = parseFloat(t2.getAttribute("y2") ?? "0"), l2 = Math.atan2(o2 - a2, i2 - r2);
|
|
1624
|
+
s2.push(`angle=${l2.toFixed(2)}`);
|
|
1625
|
+
}
|
|
1626
|
+
break;
|
|
1627
|
+
}
|
|
1628
|
+
return this.simpleHash(s2.join(";"));
|
|
1629
|
+
}
|
|
1630
|
+
/**
|
|
1631
|
+
* Detects animations on SVG element
|
|
1632
|
+
*/
|
|
1633
|
+
hasAnimation(t2) {
|
|
1634
|
+
if (t2.querySelector("animate, animateTransform, animateMotion"))
|
|
1635
|
+
return true;
|
|
1636
|
+
const e2 = t2.ownerDocument;
|
|
1637
|
+
if (e2 == null ? void 0 : e2.defaultView)
|
|
1638
|
+
try {
|
|
1639
|
+
const s2 = e2.defaultView.getComputedStyle(t2);
|
|
1640
|
+
if (s2.animationName !== "none" || s2.transitionProperty !== "all" && s2.transitionProperty !== "none")
|
|
1641
|
+
return true;
|
|
1642
|
+
} catch {
|
|
1643
|
+
}
|
|
1644
|
+
return false;
|
|
1645
|
+
}
|
|
1646
|
+
/**
|
|
1647
|
+
* Simple hash function for fingerprinting (not cryptographic)
|
|
1648
|
+
*/
|
|
1649
|
+
simpleHash(t2) {
|
|
1650
|
+
let e2 = 0;
|
|
1651
|
+
for (let s2 = 0; s2 < t2.length; s2++) {
|
|
1652
|
+
const r2 = t2.charCodeAt(s2);
|
|
1653
|
+
e2 = (e2 << 5) - e2 + r2, e2 = e2 & e2;
|
|
1654
|
+
}
|
|
1655
|
+
return Math.abs(e2).toString(16).padStart(8, "0");
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
function _t(n2, t2 = 0) {
|
|
1659
|
+
const e2 = n2.anchor.score, s2 = n2.path.length > 0 ? n2.path.reduce((o2, l2) => o2 + l2.score, 0) / n2.path.length : 0.5, r2 = n2.target.score, a2 = e2 * L.ANCHOR + s2 * L.PATH + r2 * L.TARGET + t2 * L.UNIQUENESS, i2 = n2.anchor.degraded ? 0.2 : 0;
|
|
1660
|
+
return Math.max(0, Math.min(1, a2 - i2));
|
|
1661
|
+
}
|
|
1662
|
+
class qt {
|
|
1663
|
+
constructor(t2) {
|
|
1664
|
+
this.cache = /* @__PURE__ */ new Map(), this.maxSize = t2;
|
|
1665
|
+
}
|
|
1666
|
+
get(t2) {
|
|
1667
|
+
const e2 = this.cache.get(t2);
|
|
1668
|
+
if (e2 !== void 0)
|
|
1669
|
+
return this.cache.delete(t2), this.cache.set(t2, e2), e2;
|
|
1670
|
+
}
|
|
1671
|
+
set(t2, e2) {
|
|
1672
|
+
if (this.cache.has(t2))
|
|
1673
|
+
this.cache.delete(t2);
|
|
1674
|
+
else if (this.cache.size >= this.maxSize) {
|
|
1675
|
+
const s2 = this.cache.keys().next().value;
|
|
1676
|
+
s2 !== void 0 && this.cache.delete(s2);
|
|
1677
|
+
}
|
|
1678
|
+
this.cache.set(t2, e2);
|
|
1679
|
+
}
|
|
1680
|
+
has(t2) {
|
|
1681
|
+
return this.cache.has(t2);
|
|
1682
|
+
}
|
|
1683
|
+
delete(t2) {
|
|
1684
|
+
this.cache.delete(t2);
|
|
1685
|
+
}
|
|
1686
|
+
clear() {
|
|
1687
|
+
this.cache.clear();
|
|
1688
|
+
}
|
|
1689
|
+
get size() {
|
|
1690
|
+
return this.cache.size;
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
class Lt {
|
|
1694
|
+
constructor(t2 = {}) {
|
|
1695
|
+
this.eidCache = /* @__PURE__ */ new WeakMap(), this.selectorResultCache = new qt(
|
|
1696
|
+
t2.maxSelectorCacheSize ?? 1e3
|
|
1697
|
+
), this.anchorCache = /* @__PURE__ */ new WeakMap(), this.semanticsCache = /* @__PURE__ */ new WeakMap(), this.stats = {
|
|
1698
|
+
eidHits: 0,
|
|
1699
|
+
eidMisses: 0,
|
|
1700
|
+
selectorHits: 0,
|
|
1701
|
+
selectorMisses: 0,
|
|
1702
|
+
anchorHits: 0,
|
|
1703
|
+
anchorMisses: 0,
|
|
1704
|
+
semanticsHits: 0,
|
|
1705
|
+
semanticsMisses: 0,
|
|
1706
|
+
selectorCacheSize: 0,
|
|
1707
|
+
maxSelectorCacheSize: t2.maxSelectorCacheSize ?? 1e3
|
|
1708
|
+
};
|
|
1709
|
+
}
|
|
1710
|
+
/**
|
|
1711
|
+
* Get cached EID for element
|
|
1712
|
+
*/
|
|
1713
|
+
getEID(t2) {
|
|
1714
|
+
const e2 = this.eidCache.get(t2);
|
|
1715
|
+
if (e2 !== void 0)
|
|
1716
|
+
return this.stats.eidHits++, e2;
|
|
1717
|
+
this.stats.eidMisses++;
|
|
1718
|
+
}
|
|
1719
|
+
/**
|
|
1720
|
+
* Cache EID for element
|
|
1721
|
+
*/
|
|
1722
|
+
setEID(t2, e2) {
|
|
1723
|
+
this.eidCache.set(t2, e2);
|
|
1724
|
+
}
|
|
1725
|
+
/**
|
|
1726
|
+
* Get cached selector results
|
|
1727
|
+
*/
|
|
1728
|
+
getSelectorResults(t2) {
|
|
1729
|
+
const e2 = this.selectorResultCache.get(t2);
|
|
1730
|
+
if (e2 !== void 0)
|
|
1731
|
+
return this.stats.selectorHits++, this.stats.selectorCacheSize = this.selectorResultCache.size, e2;
|
|
1732
|
+
this.stats.selectorMisses++, this.stats.selectorCacheSize = this.selectorResultCache.size;
|
|
1733
|
+
}
|
|
1734
|
+
/**
|
|
1735
|
+
* Cache selector results
|
|
1736
|
+
*/
|
|
1737
|
+
setSelectorResults(t2, e2) {
|
|
1738
|
+
this.selectorResultCache.set(t2, e2), this.stats.selectorCacheSize = this.selectorResultCache.size;
|
|
1739
|
+
}
|
|
1740
|
+
/**
|
|
1741
|
+
* Get cached anchor result
|
|
1742
|
+
*/
|
|
1743
|
+
getAnchor(t2) {
|
|
1744
|
+
if (this.anchorCache.has(t2))
|
|
1745
|
+
return this.stats.anchorHits++, this.anchorCache.get(t2);
|
|
1746
|
+
this.stats.anchorMisses++;
|
|
1747
|
+
}
|
|
1748
|
+
/**
|
|
1749
|
+
* Cache anchor result
|
|
1750
|
+
*/
|
|
1751
|
+
setAnchor(t2, e2) {
|
|
1752
|
+
this.anchorCache.set(t2, e2);
|
|
1753
|
+
}
|
|
1754
|
+
/**
|
|
1755
|
+
* Get cached semantics
|
|
1756
|
+
*/
|
|
1757
|
+
getSemantics(t2) {
|
|
1758
|
+
const e2 = this.semanticsCache.get(t2);
|
|
1759
|
+
if (e2 !== void 0)
|
|
1760
|
+
return this.stats.semanticsHits++, e2;
|
|
1761
|
+
this.stats.semanticsMisses++;
|
|
1762
|
+
}
|
|
1763
|
+
/**
|
|
1764
|
+
* Cache semantics
|
|
1765
|
+
*/
|
|
1766
|
+
setSemantics(t2, e2) {
|
|
1767
|
+
this.semanticsCache.set(t2, e2);
|
|
1768
|
+
}
|
|
1769
|
+
/**
|
|
1770
|
+
* Clear all caches
|
|
1771
|
+
*/
|
|
1772
|
+
clear() {
|
|
1773
|
+
this.selectorResultCache.clear(), this.stats.selectorCacheSize = 0, this.stats = {
|
|
1774
|
+
eidHits: 0,
|
|
1775
|
+
eidMisses: 0,
|
|
1776
|
+
selectorHits: 0,
|
|
1777
|
+
selectorMisses: 0,
|
|
1778
|
+
anchorHits: 0,
|
|
1779
|
+
anchorMisses: 0,
|
|
1780
|
+
semanticsHits: 0,
|
|
1781
|
+
semanticsMisses: 0,
|
|
1782
|
+
selectorCacheSize: 0,
|
|
1783
|
+
maxSelectorCacheSize: this.stats.maxSelectorCacheSize
|
|
1784
|
+
};
|
|
1785
|
+
}
|
|
1786
|
+
/**
|
|
1787
|
+
* Invalidate cache for a specific element
|
|
1788
|
+
* Note: WeakMaps don't support deletion, but we can clear selector cache
|
|
1789
|
+
* if needed. This method is mainly for future extensibility.
|
|
1790
|
+
*/
|
|
1791
|
+
invalidateElement(t2) {
|
|
1792
|
+
}
|
|
1793
|
+
/**
|
|
1794
|
+
* Invalidate a specific selector from cache
|
|
1795
|
+
*/
|
|
1796
|
+
invalidateSelector(t2) {
|
|
1797
|
+
this.selectorResultCache.delete(t2), this.stats.selectorCacheSize = this.selectorResultCache.size;
|
|
1798
|
+
}
|
|
1799
|
+
/**
|
|
1800
|
+
* Get cache statistics
|
|
1801
|
+
*/
|
|
1802
|
+
getStats() {
|
|
1803
|
+
return {
|
|
1804
|
+
...this.stats,
|
|
1805
|
+
selectorCacheSize: this.selectorResultCache.size
|
|
1806
|
+
};
|
|
1807
|
+
}
|
|
1808
|
+
/**
|
|
1809
|
+
* Get cache hit rate for EID cache
|
|
1810
|
+
*/
|
|
1811
|
+
getEIDHitRate() {
|
|
1812
|
+
const t2 = this.stats.eidHits + this.stats.eidMisses;
|
|
1813
|
+
return t2 > 0 ? this.stats.eidHits / t2 : 0;
|
|
1814
|
+
}
|
|
1815
|
+
/**
|
|
1816
|
+
* Get cache hit rate for selector cache
|
|
1817
|
+
*/
|
|
1818
|
+
getSelectorHitRate() {
|
|
1819
|
+
const t2 = this.stats.selectorHits + this.stats.selectorMisses;
|
|
1820
|
+
return t2 > 0 ? this.stats.selectorHits / t2 : 0;
|
|
1821
|
+
}
|
|
1822
|
+
/**
|
|
1823
|
+
* Get cache hit rate for anchor cache
|
|
1824
|
+
*/
|
|
1825
|
+
getAnchorHitRate() {
|
|
1826
|
+
const t2 = this.stats.anchorHits + this.stats.anchorMisses;
|
|
1827
|
+
return t2 > 0 ? this.stats.anchorHits / t2 : 0;
|
|
1828
|
+
}
|
|
1829
|
+
/**
|
|
1830
|
+
* Get cache hit rate for semantics cache
|
|
1831
|
+
*/
|
|
1832
|
+
getSemanticsHitRate() {
|
|
1833
|
+
const t2 = this.stats.semanticsHits + this.stats.semanticsMisses;
|
|
1834
|
+
return t2 > 0 ? this.stats.semanticsHits / t2 : 0;
|
|
1835
|
+
}
|
|
1836
|
+
/**
|
|
1837
|
+
* Get overall cache hit rate
|
|
1838
|
+
*/
|
|
1839
|
+
getOverallHitRate() {
|
|
1840
|
+
const t2 = this.stats.eidHits + this.stats.selectorHits + this.stats.anchorHits + this.stats.semanticsHits, e2 = this.stats.eidMisses + this.stats.selectorMisses + this.stats.anchorMisses + this.stats.semanticsMisses, s2 = t2 + e2;
|
|
1841
|
+
return s2 > 0 ? t2 / s2 : 0;
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1844
|
+
function Ot(n2) {
|
|
1845
|
+
return new Lt(n2);
|
|
1846
|
+
}
|
|
1847
|
+
let O = null;
|
|
1848
|
+
function Z() {
|
|
1849
|
+
return O || (O = Ot()), O;
|
|
1850
|
+
}
|
|
1851
|
+
function Y(n2, t2 = {}) {
|
|
1852
|
+
var _a2;
|
|
1853
|
+
if (!n2 || !n2.ownerDocument || !n2.isConnected)
|
|
1854
|
+
return null;
|
|
1855
|
+
const e2 = { ...ut, ...t2 }, s2 = e2.cache ?? Z(), r2 = s2.getEID(n2);
|
|
1856
|
+
if (r2 !== void 0)
|
|
1857
|
+
return r2;
|
|
1858
|
+
const a2 = new ft(e2, s2), i2 = new xt(e2, s2), o2 = new Pt(e2, s2), l2 = new kt(), u2 = a2.findAnchor(n2);
|
|
1859
|
+
if (!u2 && !e2.fallbackToBody)
|
|
1860
|
+
return null;
|
|
1861
|
+
const d = (u2 == null ? void 0 : u2.element) ?? ((_a2 = n2.ownerDocument) == null ? void 0 : _a2.body) ?? null;
|
|
1862
|
+
if (!d) return null;
|
|
1863
|
+
const c2 = !u2 || u2.tier === "C", h = d.tagName.toLowerCase(), g = d.parentElement;
|
|
1864
|
+
let f2;
|
|
1865
|
+
if (g && h !== "body" && h !== "html") {
|
|
1866
|
+
const T = Array.from(g.children).indexOf(d);
|
|
1867
|
+
T !== -1 && (f2 = T + 1);
|
|
1868
|
+
}
|
|
1869
|
+
const p = o2.extract(d), m = {
|
|
1870
|
+
tag: d.tagName.toLowerCase(),
|
|
1871
|
+
semantics: p,
|
|
1872
|
+
score: (u2 == null ? void 0 : u2.score) ?? I.DEGRADED_SCORE,
|
|
1873
|
+
degraded: c2,
|
|
1874
|
+
nthChild: f2
|
|
1875
|
+
}, b = i2.buildPath(d, n2, o2), y = o2.extract(n2);
|
|
1876
|
+
e2.enableSvgFingerprint && zt(n2) && (y.svg = l2.fingerprint(n2));
|
|
1877
|
+
const v2 = n2.parentElement;
|
|
1878
|
+
let A;
|
|
1879
|
+
if (v2) {
|
|
1880
|
+
const T = Array.from(v2.children).indexOf(n2);
|
|
1881
|
+
T !== -1 && (A = T + 1);
|
|
1882
|
+
}
|
|
1883
|
+
const S = {
|
|
1884
|
+
tag: n2.tagName.toLowerCase(),
|
|
1885
|
+
semantics: y,
|
|
1886
|
+
score: o2.scoreElement(n2),
|
|
1887
|
+
nthChild: A
|
|
1888
|
+
}, $ = [], M = {
|
|
1889
|
+
onMultiple: "best-score",
|
|
1890
|
+
onMissing: "anchor-only",
|
|
1891
|
+
maxDepth: 3
|
|
1892
|
+
}, H = m.degraded || b.degraded, E = Ut(m.degraded, b), x2 = {
|
|
1893
|
+
version: "1.0",
|
|
1894
|
+
anchor: m,
|
|
1895
|
+
path: b.path,
|
|
1896
|
+
target: S,
|
|
1897
|
+
constraints: $,
|
|
1898
|
+
fallback: M,
|
|
1899
|
+
meta: {
|
|
1900
|
+
confidence: 0,
|
|
1901
|
+
// Calculated below
|
|
1902
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1903
|
+
generator: "dom-eid@1.0",
|
|
1904
|
+
source: e2.source,
|
|
1905
|
+
degraded: H,
|
|
1906
|
+
degradationReason: E
|
|
1907
|
+
}
|
|
1908
|
+
};
|
|
1909
|
+
return x2.meta.confidence = _t(x2), x2.meta.confidence < e2.confidenceThreshold ? null : (s2.setEID(n2, x2), x2);
|
|
1910
|
+
}
|
|
1911
|
+
function zt(n2) {
|
|
1912
|
+
return n2.namespaceURI === "http://www.w3.org/2000/svg" || n2.tagName.toLowerCase() === "svg" || n2 instanceof SVGElement;
|
|
1913
|
+
}
|
|
1914
|
+
function Ut(n2, t2) {
|
|
1915
|
+
if (n2 && t2.degraded)
|
|
1916
|
+
return "anchor-and-path-degraded";
|
|
1917
|
+
if (n2)
|
|
1918
|
+
return "no-semantic-anchor";
|
|
1919
|
+
if (t2.degraded)
|
|
1920
|
+
return t2.degradationReason;
|
|
1921
|
+
}
|
|
1922
|
+
const rt = {
|
|
1923
|
+
maxClasses: 2,
|
|
1924
|
+
maxAttributes: 5,
|
|
1925
|
+
includeText: true,
|
|
1926
|
+
maxTextLength: 50,
|
|
1927
|
+
simplifyTarget: true,
|
|
1928
|
+
includeConstraints: true
|
|
1929
|
+
};
|
|
1930
|
+
function et(n2) {
|
|
1931
|
+
return n2 === "id" ? 101 : w[n2] !== void 0 ? w[n2] : n2.startsWith("data-") ? w["data-*"] : n2.startsWith("aria-") ? w["aria-*"] : 0;
|
|
1932
|
+
}
|
|
1933
|
+
function Vt(n2) {
|
|
1934
|
+
return ["id", "data-testid", "data-qa", "data-cy", "href", "text", "role"].includes(n2);
|
|
1935
|
+
}
|
|
1936
|
+
function Qt(n2) {
|
|
1937
|
+
return !!(/@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/.test(n2) || /(\+?\d{1,3}[-.\s]?)?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}/.test(n2) || /\d{4}[-\s]?\d{4}[-\s]?\d{4}[-\s]?\d{4}/.test(n2));
|
|
1938
|
+
}
|
|
1939
|
+
function Zt(n2, t2) {
|
|
1940
|
+
const e2 = { ...rt, ...t2 }, s2 = `v${n2.version}`, r2 = U(n2.anchor, false, e2), a2 = n2.path.length > 0 ? n2.path.map((l2) => U(l2, false, e2)).join(" > ") + " > " : "", i2 = U(n2.target, true, e2), o2 = e2.includeConstraints ? Xt(n2) : "";
|
|
1941
|
+
return `${s2}: ${r2} :: ${a2}${i2}${o2}`;
|
|
1942
|
+
}
|
|
1943
|
+
function U(n2, t2 = false, e2 = rt) {
|
|
1944
|
+
const { tag: s2, semantics: r2 } = n2;
|
|
1945
|
+
let a2 = s2;
|
|
1946
|
+
const i2 = [], o2 = { ...r2.attributes };
|
|
1947
|
+
r2.id && (o2.id = r2.id), r2.role && !o2.role && (o2.role = r2.role);
|
|
1948
|
+
const l2 = Object.entries(o2).map(([c2, h]) => {
|
|
1949
|
+
const g = et(c2), f2 = c2 === "href" || c2 === "src" ? k(c2, h) : h;
|
|
1950
|
+
return { name: c2, value: f2, priority: g };
|
|
1951
|
+
}).filter((c2) => c2.name !== "id" && c2.name !== "class" && B.has(c2.name) || G.has(c2.name) && V(c2.value) ? false : c2.priority > 0 || c2.name === "role" || c2.name === "id");
|
|
1952
|
+
l2.sort((c2, h) => h.priority - c2.priority);
|
|
1953
|
+
const u2 = l2.slice(0, e2.maxAttributes);
|
|
1954
|
+
u2.sort((c2, h) => c2.name.localeCompare(h.name));
|
|
1955
|
+
for (const { name: c2, value: h } of u2)
|
|
1956
|
+
i2.push(`${c2}="${j(h)}"`);
|
|
1957
|
+
if (e2.includeText && r2.text && !Qt(r2.text.normalized)) {
|
|
1958
|
+
const c2 = r2.text.normalized;
|
|
1959
|
+
c2.length > 0 && c2.length <= e2.maxTextLength && i2.push(`text="${j(c2)}"`);
|
|
1960
|
+
}
|
|
1961
|
+
let d = i2;
|
|
1962
|
+
if (i2.length > 0 && (t2 && e2.simplifyTarget && r2.id && (d = i2.filter((c2) => {
|
|
1963
|
+
const h = c2.split("=")[0];
|
|
1964
|
+
return et(h) >= 60 || h === "text" || h === "id" || h === "role";
|
|
1965
|
+
})), d.length > 0 && d.sort((c2, h) => c2.localeCompare(h))), r2.classes && r2.classes.length > 0) {
|
|
1966
|
+
const c2 = N(r2.classes), h = !!r2.id || i2.some(
|
|
1967
|
+
(f2) => f2.startsWith("href=") || f2.startsWith("data-testid=") || f2.startsWith("text=") || f2.startsWith("role=")
|
|
1968
|
+
);
|
|
1969
|
+
if (!(t2 && e2.simplifyTarget && h) && c2.length > 0) {
|
|
1970
|
+
const f2 = c2.sort().slice(0, e2.maxClasses);
|
|
1971
|
+
a2 += f2.map((p) => `.${p}`).join("");
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
if (d.length > 0 && (a2 += `[${d.join(",")}]`), "nthChild" in n2 && n2.nthChild) {
|
|
1975
|
+
const c2 = !!r2.id || r2.attributes && Object.keys(r2.attributes).some(Vt);
|
|
1976
|
+
t2 && e2.simplifyTarget && c2 || (a2 += `#${n2.nthChild}`);
|
|
1977
|
+
}
|
|
1978
|
+
return a2;
|
|
1979
|
+
}
|
|
1980
|
+
function Xt(n2) {
|
|
1981
|
+
if (!n2.constraints || n2.constraints.length === 0)
|
|
1982
|
+
return "";
|
|
1983
|
+
const t2 = [];
|
|
1984
|
+
for (const e2 of n2.constraints)
|
|
1985
|
+
switch (e2.type) {
|
|
1986
|
+
case "uniqueness":
|
|
1987
|
+
t2.push("unique=true");
|
|
1988
|
+
break;
|
|
1989
|
+
case "position":
|
|
1990
|
+
e2.params && e2.params.strategy && t2.push(`pos=${e2.params.strategy}`);
|
|
1991
|
+
break;
|
|
1992
|
+
case "text-proximity":
|
|
1993
|
+
if (e2.params && e2.params.reference) {
|
|
1994
|
+
const s2 = j(String(e2.params.reference));
|
|
1995
|
+
t2.push(`text="${s2}"`);
|
|
1996
|
+
}
|
|
1997
|
+
break;
|
|
1998
|
+
}
|
|
1999
|
+
return t2.length === 0 ? "" : ` {${t2.join(",")}}`;
|
|
2000
|
+
}
|
|
2001
|
+
function j(n2) {
|
|
2002
|
+
return n2.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/>/g, "\\>").replace(/:/g, "\\:");
|
|
2003
|
+
}
|
|
2004
|
+
function le(n2, t2, e2) {
|
|
2005
|
+
const s2 = Y(n2, t2);
|
|
2006
|
+
return s2 ? Zt(s2, e2) : null;
|
|
2007
|
+
}
|
|
829
2008
|
let _id = 1;
|
|
830
2009
|
const tagNameRegex = new RegExp("[^a-z0-9-_:]");
|
|
831
2010
|
const IGNORED_NODE = -2;
|
|
@@ -947,6 +2126,7 @@ function ignoreAttribute(tagName, name, _value) {
|
|
|
947
2126
|
return (tagName === "video" || tagName === "audio") && name === "autoplay";
|
|
948
2127
|
}
|
|
949
2128
|
function isExcludeAttribute(name, exclude) {
|
|
2129
|
+
if (!exclude) return false;
|
|
950
2130
|
return typeof exclude === "string" ? name.includes(exclude) : exclude.test(name);
|
|
951
2131
|
}
|
|
952
2132
|
function _isBlockedElement(element, blockClass, blockSelector) {
|
|
@@ -1443,7 +2623,8 @@ function serializeNodeWithId(n2, options) {
|
|
|
1443
2623
|
stylesheetLoadTimeout = 5e3,
|
|
1444
2624
|
keepIframeSrcFn = () => false,
|
|
1445
2625
|
newlyAddedElement = false,
|
|
1446
|
-
cssCaptured = false
|
|
2626
|
+
cssCaptured = false,
|
|
2627
|
+
selectorOptions
|
|
1447
2628
|
} = options;
|
|
1448
2629
|
let { needsMask } = options;
|
|
1449
2630
|
let { preserveWhiteSpace = true } = options;
|
|
@@ -1488,11 +2669,20 @@ function serializeNodeWithId(n2, options) {
|
|
|
1488
2669
|
}
|
|
1489
2670
|
const serializedNode = Object.assign(_serializedNode, { id });
|
|
1490
2671
|
if (isElement(n2) || n2.nodeType === Node.TEXT_NODE) {
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
2672
|
+
if (isElement(n2) && selectorOptions !== null && selectorOptions !== void 0) {
|
|
2673
|
+
try {
|
|
2674
|
+
const seqlGeneratorOptions = {
|
|
2675
|
+
maxPathDepth: selectorOptions.maxPathDepth,
|
|
2676
|
+
enableSvgFingerprint: selectorOptions.enableSvgFingerprint,
|
|
2677
|
+
confidenceThreshold: selectorOptions.confidenceThreshold,
|
|
2678
|
+
fallbackToBody: selectorOptions.fallbackToBody
|
|
2679
|
+
};
|
|
2680
|
+
const selector = le(n2, seqlGeneratorOptions);
|
|
2681
|
+
if (selector) {
|
|
2682
|
+
serializedNode.selector = selector;
|
|
2683
|
+
}
|
|
2684
|
+
} catch (error) {
|
|
2685
|
+
console.warn("Failed to generate SEQL selector:", error);
|
|
1496
2686
|
}
|
|
1497
2687
|
}
|
|
1498
2688
|
if (n2.nodeType === Node.TEXT_NODE) {
|
|
@@ -1547,7 +2737,8 @@ function serializeNodeWithId(n2, options) {
|
|
|
1547
2737
|
onStylesheetLoad,
|
|
1548
2738
|
stylesheetLoadTimeout,
|
|
1549
2739
|
keepIframeSrcFn,
|
|
1550
|
-
cssCaptured: false
|
|
2740
|
+
cssCaptured: false,
|
|
2741
|
+
selectorOptions
|
|
1551
2742
|
};
|
|
1552
2743
|
if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;
|
|
1553
2744
|
else {
|
|
@@ -1606,7 +2797,8 @@ function serializeNodeWithId(n2, options) {
|
|
|
1606
2797
|
iframeLoadTimeout,
|
|
1607
2798
|
onStylesheetLoad,
|
|
1608
2799
|
stylesheetLoadTimeout,
|
|
1609
|
-
keepIframeSrcFn
|
|
2800
|
+
keepIframeSrcFn,
|
|
2801
|
+
selectorOptions
|
|
1610
2802
|
});
|
|
1611
2803
|
if (serializedIframeNode) {
|
|
1612
2804
|
onIframeLoad(
|
|
@@ -1648,7 +2840,8 @@ function serializeNodeWithId(n2, options) {
|
|
|
1648
2840
|
iframeLoadTimeout,
|
|
1649
2841
|
onStylesheetLoad,
|
|
1650
2842
|
stylesheetLoadTimeout,
|
|
1651
|
-
keepIframeSrcFn
|
|
2843
|
+
keepIframeSrcFn,
|
|
2844
|
+
selectorOptions
|
|
1652
2845
|
});
|
|
1653
2846
|
if (serializedLinkNode) {
|
|
1654
2847
|
onStylesheetLoad(
|
|
@@ -1685,7 +2878,8 @@ function snapshot(n2, options) {
|
|
|
1685
2878
|
iframeLoadTimeout,
|
|
1686
2879
|
onStylesheetLoad,
|
|
1687
2880
|
stylesheetLoadTimeout,
|
|
1688
|
-
keepIframeSrcFn = () => false
|
|
2881
|
+
keepIframeSrcFn = () => false,
|
|
2882
|
+
selector
|
|
1689
2883
|
} = options || {};
|
|
1690
2884
|
const maskInputOptions = maskAllInputs === true ? {
|
|
1691
2885
|
color: true,
|
|
@@ -1723,6 +2917,22 @@ function snapshot(n2, options) {
|
|
|
1723
2917
|
headMetaVerification: true
|
|
1724
2918
|
}
|
|
1725
2919
|
) : slimDOM === false ? {} : slimDOM;
|
|
2920
|
+
const selectorOptions = selector === false ? null : selector === true ? {
|
|
2921
|
+
maxPathDepth: 10,
|
|
2922
|
+
enableSvgFingerprint: true,
|
|
2923
|
+
confidenceThreshold: 0.3,
|
|
2924
|
+
fallbackToBody: true
|
|
2925
|
+
} : selector === void 0 ? {
|
|
2926
|
+
maxPathDepth: 10,
|
|
2927
|
+
enableSvgFingerprint: true,
|
|
2928
|
+
confidenceThreshold: 0.3,
|
|
2929
|
+
fallbackToBody: true
|
|
2930
|
+
} : {
|
|
2931
|
+
maxPathDepth: selector.maxPathDepth ?? 10,
|
|
2932
|
+
enableSvgFingerprint: selector.enableSvgFingerprint ?? true,
|
|
2933
|
+
confidenceThreshold: selector.confidenceThreshold ?? 0.3,
|
|
2934
|
+
fallbackToBody: selector.fallbackToBody ?? true
|
|
2935
|
+
};
|
|
1726
2936
|
return serializeNodeWithId(n2, {
|
|
1727
2937
|
doc: n2,
|
|
1728
2938
|
mirror: mirror2,
|
|
@@ -1747,7 +2957,8 @@ function snapshot(n2, options) {
|
|
|
1747
2957
|
onStylesheetLoad,
|
|
1748
2958
|
stylesheetLoadTimeout,
|
|
1749
2959
|
keepIframeSrcFn,
|
|
1750
|
-
newlyAddedElement: false
|
|
2960
|
+
newlyAddedElement: false,
|
|
2961
|
+
selectorOptions
|
|
1751
2962
|
});
|
|
1752
2963
|
}
|
|
1753
2964
|
const MEDIA_SELECTOR = /(max|min)-device-(width|height)/;
|
|
@@ -1784,6 +2995,33 @@ const pseudoClassPlugin = {
|
|
|
1784
2995
|
};
|
|
1785
2996
|
}
|
|
1786
2997
|
};
|
|
2998
|
+
const animationFillModePlugin = {
|
|
2999
|
+
postcssPlugin: "postcss-animation-fill-mode",
|
|
3000
|
+
prepare: function() {
|
|
3001
|
+
return {
|
|
3002
|
+
Rule: function(rule2) {
|
|
3003
|
+
let hasAnimation = false;
|
|
3004
|
+
let hasAnimationFillMode = false;
|
|
3005
|
+
let animationDeclaration = null;
|
|
3006
|
+
rule2.walkDecls((decl) => {
|
|
3007
|
+
if (decl.prop === "animation") {
|
|
3008
|
+
hasAnimation = true;
|
|
3009
|
+
animationDeclaration = decl;
|
|
3010
|
+
}
|
|
3011
|
+
if (decl.prop === "animation-fill-mode") {
|
|
3012
|
+
hasAnimationFillMode = true;
|
|
3013
|
+
}
|
|
3014
|
+
});
|
|
3015
|
+
if (hasAnimation && !hasAnimationFillMode && animationDeclaration) {
|
|
3016
|
+
rule2.insertAfter(animationDeclaration, {
|
|
3017
|
+
prop: "animation-fill-mode",
|
|
3018
|
+
value: "forwards"
|
|
3019
|
+
});
|
|
3020
|
+
}
|
|
3021
|
+
}
|
|
3022
|
+
};
|
|
3023
|
+
}
|
|
3024
|
+
};
|
|
1787
3025
|
function getDefaultExportFromCjs$1(x2) {
|
|
1788
3026
|
return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
|
|
1789
3027
|
}
|
|
@@ -1800,12 +3038,12 @@ function getAugmentedNamespace$1(n2) {
|
|
|
1800
3038
|
a2.prototype = f2.prototype;
|
|
1801
3039
|
} else a2 = {};
|
|
1802
3040
|
Object.defineProperty(a2, "__esModule", { value: true });
|
|
1803
|
-
Object.keys(n2).forEach(function(
|
|
1804
|
-
var d = Object.getOwnPropertyDescriptor(n2,
|
|
1805
|
-
Object.defineProperty(a2,
|
|
3041
|
+
Object.keys(n2).forEach(function(k2) {
|
|
3042
|
+
var d = Object.getOwnPropertyDescriptor(n2, k2);
|
|
3043
|
+
Object.defineProperty(a2, k2, d.get ? d : {
|
|
1806
3044
|
enumerable: true,
|
|
1807
3045
|
get: function() {
|
|
1808
|
-
return n2[
|
|
3046
|
+
return n2[k2];
|
|
1809
3047
|
}
|
|
1810
3048
|
});
|
|
1811
3049
|
});
|
|
@@ -2229,7 +3467,7 @@ function cloneNode$1(obj, parent) {
|
|
|
2229
3467
|
} else if (i2 === "source") {
|
|
2230
3468
|
cloned[i2] = value;
|
|
2231
3469
|
} else if (Array.isArray(value)) {
|
|
2232
|
-
cloned[i2] = value.map((
|
|
3470
|
+
cloned[i2] = value.map((j2) => cloneNode$1(j2, cloned));
|
|
2233
3471
|
} else {
|
|
2234
3472
|
if (type === "object" && value !== null) value = cloneNode$1(value);
|
|
2235
3473
|
cloned[i2] = value;
|
|
@@ -2464,7 +3702,7 @@ let Node$5$1 = class Node2 {
|
|
|
2464
3702
|
}
|
|
2465
3703
|
return result2;
|
|
2466
3704
|
}
|
|
2467
|
-
toJSON(
|
|
3705
|
+
toJSON(_2, inputs) {
|
|
2468
3706
|
let fixed = {};
|
|
2469
3707
|
let emitInputs = inputs == null;
|
|
2470
3708
|
inputs = inputs || /* @__PURE__ */ new Map();
|
|
@@ -4109,8 +5347,8 @@ let Parser$1$1 = class Parser {
|
|
|
4109
5347
|
if (colon === false) return;
|
|
4110
5348
|
let founded = 0;
|
|
4111
5349
|
let token;
|
|
4112
|
-
for (let
|
|
4113
|
-
token = tokens[
|
|
5350
|
+
for (let j2 = colon - 1; j2 >= 0; j2--) {
|
|
5351
|
+
token = tokens[j2];
|
|
4114
5352
|
if (token[0] !== "space") {
|
|
4115
5353
|
founded += 1;
|
|
4116
5354
|
if (founded === 2) break;
|
|
@@ -4228,8 +5466,8 @@ let Parser$1$1 = class Parser {
|
|
|
4228
5466
|
} else if (token[1].toLowerCase() === "important") {
|
|
4229
5467
|
let cache = tokens.slice(0);
|
|
4230
5468
|
let str = "";
|
|
4231
|
-
for (let
|
|
4232
|
-
let type = cache[
|
|
5469
|
+
for (let j2 = i2; j2 > 0; j2--) {
|
|
5470
|
+
let type = cache[j2][0];
|
|
4233
5471
|
if (str.trim().indexOf("!") === 0 && type !== "space") {
|
|
4234
5472
|
break;
|
|
4235
5473
|
}
|
|
@@ -5387,7 +6625,8 @@ function adaptCssForReplay(cssText, cache) {
|
|
|
5387
6625
|
try {
|
|
5388
6626
|
const ast = postcss$1$1([
|
|
5389
6627
|
mediaSelectorPlugin,
|
|
5390
|
-
pseudoClassPlugin
|
|
6628
|
+
pseudoClassPlugin,
|
|
6629
|
+
animationFillModePlugin
|
|
5391
6630
|
]).process(cssText);
|
|
5392
6631
|
result2 = ast.css;
|
|
5393
6632
|
} catch (error) {
|
|
@@ -5912,12 +7151,12 @@ function getAugmentedNamespace(n2) {
|
|
|
5912
7151
|
a2.prototype = f2.prototype;
|
|
5913
7152
|
} else a2 = {};
|
|
5914
7153
|
Object.defineProperty(a2, "__esModule", { value: true });
|
|
5915
|
-
Object.keys(n2).forEach(function(
|
|
5916
|
-
var d = Object.getOwnPropertyDescriptor(n2,
|
|
5917
|
-
Object.defineProperty(a2,
|
|
7154
|
+
Object.keys(n2).forEach(function(k2) {
|
|
7155
|
+
var d = Object.getOwnPropertyDescriptor(n2, k2);
|
|
7156
|
+
Object.defineProperty(a2, k2, d.get ? d : {
|
|
5918
7157
|
enumerable: true,
|
|
5919
7158
|
get: function() {
|
|
5920
|
-
return n2[
|
|
7159
|
+
return n2[k2];
|
|
5921
7160
|
}
|
|
5922
7161
|
});
|
|
5923
7162
|
});
|
|
@@ -6341,7 +7580,7 @@ function cloneNode(obj, parent) {
|
|
|
6341
7580
|
} else if (i2 === "source") {
|
|
6342
7581
|
cloned[i2] = value;
|
|
6343
7582
|
} else if (Array.isArray(value)) {
|
|
6344
|
-
cloned[i2] = value.map((
|
|
7583
|
+
cloned[i2] = value.map((j2) => cloneNode(j2, cloned));
|
|
6345
7584
|
} else {
|
|
6346
7585
|
if (type === "object" && value !== null) value = cloneNode(value);
|
|
6347
7586
|
cloned[i2] = value;
|
|
@@ -6576,7 +7815,7 @@ let Node$5 = class Node22 {
|
|
|
6576
7815
|
}
|
|
6577
7816
|
return result2;
|
|
6578
7817
|
}
|
|
6579
|
-
toJSON(
|
|
7818
|
+
toJSON(_2, inputs) {
|
|
6580
7819
|
let fixed = {};
|
|
6581
7820
|
let emitInputs = inputs == null;
|
|
6582
7821
|
inputs = inputs || /* @__PURE__ */ new Map();
|
|
@@ -8221,8 +9460,8 @@ let Parser$1 = class Parser2 {
|
|
|
8221
9460
|
if (colon === false) return;
|
|
8222
9461
|
let founded = 0;
|
|
8223
9462
|
let token;
|
|
8224
|
-
for (let
|
|
8225
|
-
token = tokens[
|
|
9463
|
+
for (let j2 = colon - 1; j2 >= 0; j2--) {
|
|
9464
|
+
token = tokens[j2];
|
|
8226
9465
|
if (token[0] !== "space") {
|
|
8227
9466
|
founded += 1;
|
|
8228
9467
|
if (founded === 2) break;
|
|
@@ -8340,8 +9579,8 @@ let Parser$1 = class Parser2 {
|
|
|
8340
9579
|
} else if (token[1].toLowerCase() === "important") {
|
|
8341
9580
|
let cache = tokens.slice(0);
|
|
8342
9581
|
let str = "";
|
|
8343
|
-
for (let
|
|
8344
|
-
let type = cache[
|
|
9582
|
+
for (let j2 = i2; j2 > 0; j2--) {
|
|
9583
|
+
let type = cache[j2][0];
|
|
8345
9584
|
if (str.trim().indexOf("!") === 0 && type !== "space") {
|
|
8346
9585
|
break;
|
|
8347
9586
|
}
|
|
@@ -9481,7 +10720,7 @@ const camelizeRE = /-([a-z])/g;
|
|
|
9481
10720
|
const CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9-]+$/;
|
|
9482
10721
|
const camelize = (str) => {
|
|
9483
10722
|
if (CUSTOM_PROPERTY_REGEX.test(str)) return str;
|
|
9484
|
-
return str.replace(camelizeRE, (
|
|
10723
|
+
return str.replace(camelizeRE, (_2, c2) => c2 ? c2.toUpperCase() : "");
|
|
9485
10724
|
};
|
|
9486
10725
|
const hyphenateRE = /\B([A-Z])/g;
|
|
9487
10726
|
const hyphenate = (str) => {
|
|
@@ -14534,7 +15773,7 @@ class VisibilityManager {
|
|
|
14534
15773
|
}
|
|
14535
15774
|
}
|
|
14536
15775
|
}
|
|
14537
|
-
const version$1 = "
|
|
15776
|
+
const version$1 = "3.1.1-alpha.1";
|
|
14538
15777
|
let wrappedEmit;
|
|
14539
15778
|
let takeFullSnapshot$1;
|
|
14540
15779
|
let canvasManager;
|
|
@@ -15187,30 +16426,30 @@ const mittProxy = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
|
|
|
15187
16426
|
__proto__: null,
|
|
15188
16427
|
default: mitt$1
|
|
15189
16428
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
15190
|
-
function polyfill(
|
|
15191
|
-
if ("scrollBehavior" in d.documentElement.style &&
|
|
16429
|
+
function polyfill(w2 = window, d = document) {
|
|
16430
|
+
if ("scrollBehavior" in d.documentElement.style && w2.__forceSmoothScrollPolyfill__ !== true) {
|
|
15192
16431
|
return;
|
|
15193
16432
|
}
|
|
15194
|
-
const Element2 =
|
|
16433
|
+
const Element2 = w2.HTMLElement || w2.Element;
|
|
15195
16434
|
const SCROLL_TIME = 468;
|
|
15196
16435
|
const original = {
|
|
15197
|
-
scroll:
|
|
15198
|
-
scrollBy:
|
|
16436
|
+
scroll: w2.scroll || w2.scrollTo,
|
|
16437
|
+
scrollBy: w2.scrollBy,
|
|
15199
16438
|
elementScroll: Element2.prototype.scroll || scrollElement,
|
|
15200
16439
|
scrollIntoView: Element2.prototype.scrollIntoView
|
|
15201
16440
|
};
|
|
15202
|
-
const now =
|
|
16441
|
+
const now = w2.performance && w2.performance.now ? w2.performance.now.bind(w2.performance) : Date.now;
|
|
15203
16442
|
function isMicrosoftBrowser(userAgent) {
|
|
15204
16443
|
const userAgentPatterns = ["MSIE ", "Trident/", "Edge/"];
|
|
15205
16444
|
return new RegExp(userAgentPatterns.join("|")).test(userAgent);
|
|
15206
16445
|
}
|
|
15207
|
-
const ROUNDING_TOLERANCE = isMicrosoftBrowser(
|
|
16446
|
+
const ROUNDING_TOLERANCE = isMicrosoftBrowser(w2.navigator.userAgent) ? 1 : 0;
|
|
15208
16447
|
function scrollElement(x2, y) {
|
|
15209
16448
|
this.scrollLeft = x2;
|
|
15210
16449
|
this.scrollTop = y;
|
|
15211
16450
|
}
|
|
15212
|
-
function ease(
|
|
15213
|
-
return 0.5 * (1 - Math.cos(Math.PI *
|
|
16451
|
+
function ease(k2) {
|
|
16452
|
+
return 0.5 * (1 - Math.cos(Math.PI * k2));
|
|
15214
16453
|
}
|
|
15215
16454
|
function shouldBailOut(firstArg) {
|
|
15216
16455
|
if (firstArg === null || typeof firstArg !== "object" || firstArg.behavior === void 0 || firstArg.behavior === "auto" || firstArg.behavior === "instant") {
|
|
@@ -15232,7 +16471,7 @@ function polyfill(w = window, d = document) {
|
|
|
15232
16471
|
}
|
|
15233
16472
|
}
|
|
15234
16473
|
function canOverflow(el, axis) {
|
|
15235
|
-
const overflowValue =
|
|
16474
|
+
const overflowValue = w2.getComputedStyle(el, null)["overflow" + axis];
|
|
15236
16475
|
return overflowValue === "auto" || overflowValue === "scroll";
|
|
15237
16476
|
}
|
|
15238
16477
|
function isScrollable(el) {
|
|
@@ -15258,7 +16497,7 @@ function polyfill(w = window, d = document) {
|
|
|
15258
16497
|
currentY = context.startY + (context.y - context.startY) * value;
|
|
15259
16498
|
context.method.call(context.scrollable, currentX, currentY);
|
|
15260
16499
|
if (currentX !== context.x || currentY !== context.y) {
|
|
15261
|
-
|
|
16500
|
+
w2.requestAnimationFrame(step.bind(w2, context));
|
|
15262
16501
|
}
|
|
15263
16502
|
}
|
|
15264
16503
|
function smoothScroll(el, x2, y) {
|
|
@@ -15268,9 +16507,9 @@ function polyfill(w = window, d = document) {
|
|
|
15268
16507
|
let method;
|
|
15269
16508
|
const startTime = now();
|
|
15270
16509
|
if (el === d.body) {
|
|
15271
|
-
scrollable =
|
|
15272
|
-
startX =
|
|
15273
|
-
startY =
|
|
16510
|
+
scrollable = w2;
|
|
16511
|
+
startX = w2.scrollX || w2.pageXOffset;
|
|
16512
|
+
startY = w2.scrollY || w2.pageYOffset;
|
|
15274
16513
|
method = original.scroll;
|
|
15275
16514
|
} else {
|
|
15276
16515
|
scrollable = el;
|
|
@@ -15288,43 +16527,43 @@ function polyfill(w = window, d = document) {
|
|
|
15288
16527
|
y
|
|
15289
16528
|
});
|
|
15290
16529
|
}
|
|
15291
|
-
|
|
16530
|
+
w2.scroll = w2.scrollTo = function() {
|
|
15292
16531
|
if (arguments[0] === void 0) {
|
|
15293
16532
|
return;
|
|
15294
16533
|
}
|
|
15295
16534
|
if (shouldBailOut(arguments[0]) === true) {
|
|
15296
16535
|
original.scroll.call(
|
|
15297
|
-
|
|
15298
|
-
arguments[0].left !== void 0 ? arguments[0].left : typeof arguments[0] !== "object" ? arguments[0] :
|
|
16536
|
+
w2,
|
|
16537
|
+
arguments[0].left !== void 0 ? arguments[0].left : typeof arguments[0] !== "object" ? arguments[0] : w2.scrollX || w2.pageXOffset,
|
|
15299
16538
|
// use top prop, second argument if present or fallback to scrollY
|
|
15300
|
-
arguments[0].top !== void 0 ? arguments[0].top : arguments[1] !== void 0 ? arguments[1] :
|
|
16539
|
+
arguments[0].top !== void 0 ? arguments[0].top : arguments[1] !== void 0 ? arguments[1] : w2.scrollY || w2.pageYOffset
|
|
15301
16540
|
);
|
|
15302
16541
|
return;
|
|
15303
16542
|
}
|
|
15304
16543
|
smoothScroll.call(
|
|
15305
|
-
|
|
16544
|
+
w2,
|
|
15306
16545
|
d.body,
|
|
15307
|
-
arguments[0].left !== void 0 ? ~~arguments[0].left :
|
|
15308
|
-
arguments[0].top !== void 0 ? ~~arguments[0].top :
|
|
16546
|
+
arguments[0].left !== void 0 ? ~~arguments[0].left : w2.scrollX || w2.pageXOffset,
|
|
16547
|
+
arguments[0].top !== void 0 ? ~~arguments[0].top : w2.scrollY || w2.pageYOffset
|
|
15309
16548
|
);
|
|
15310
16549
|
};
|
|
15311
|
-
|
|
16550
|
+
w2.scrollBy = function() {
|
|
15312
16551
|
if (arguments[0] === void 0) {
|
|
15313
16552
|
return;
|
|
15314
16553
|
}
|
|
15315
16554
|
if (shouldBailOut(arguments[0])) {
|
|
15316
16555
|
original.scrollBy.call(
|
|
15317
|
-
|
|
16556
|
+
w2,
|
|
15318
16557
|
arguments[0].left !== void 0 ? arguments[0].left : typeof arguments[0] !== "object" ? arguments[0] : 0,
|
|
15319
16558
|
arguments[0].top !== void 0 ? arguments[0].top : arguments[1] !== void 0 ? arguments[1] : 0
|
|
15320
16559
|
);
|
|
15321
16560
|
return;
|
|
15322
16561
|
}
|
|
15323
16562
|
smoothScroll.call(
|
|
15324
|
-
|
|
16563
|
+
w2,
|
|
15325
16564
|
d.body,
|
|
15326
|
-
~~arguments[0].left + (
|
|
15327
|
-
~~arguments[0].top + (
|
|
16565
|
+
~~arguments[0].left + (w2.scrollX || w2.pageXOffset),
|
|
16566
|
+
~~arguments[0].top + (w2.scrollY || w2.pageYOffset)
|
|
15328
16567
|
);
|
|
15329
16568
|
};
|
|
15330
16569
|
Element2.prototype.scroll = Element2.prototype.scrollTo = function() {
|
|
@@ -15389,15 +16628,15 @@ function polyfill(w = window, d = document) {
|
|
|
15389
16628
|
scrollableParent.scrollLeft + clientRects.left - parentRects.left,
|
|
15390
16629
|
scrollableParent.scrollTop + clientRects.top - parentRects.top
|
|
15391
16630
|
);
|
|
15392
|
-
if (
|
|
15393
|
-
|
|
16631
|
+
if (w2.getComputedStyle(scrollableParent).position !== "fixed") {
|
|
16632
|
+
w2.scrollBy({
|
|
15394
16633
|
left: parentRects.left,
|
|
15395
16634
|
top: parentRects.top,
|
|
15396
16635
|
behavior: "smooth"
|
|
15397
16636
|
});
|
|
15398
16637
|
}
|
|
15399
16638
|
} else {
|
|
15400
|
-
|
|
16639
|
+
w2.scrollBy({
|
|
15401
16640
|
left: clientRects.left,
|
|
15402
16641
|
top: clientRects.top,
|
|
15403
16642
|
behavior: "smooth"
|
|
@@ -15583,16 +16822,16 @@ function s(n2, o2) {
|
|
|
15583
16822
|
}(m), b = h.next(); !b.done; b = h.next()) {
|
|
15584
16823
|
var S = b.value;
|
|
15585
16824
|
if (void 0 === S) return c(p, g);
|
|
15586
|
-
var
|
|
16825
|
+
var w2 = "string" == typeof S ? { target: S } : S, j2 = w2.target, E = w2.actions, R = void 0 === E ? [] : E, N2 = w2.cond, O2 = void 0 === N2 ? function() {
|
|
15587
16826
|
return true;
|
|
15588
|
-
} :
|
|
15589
|
-
if (
|
|
15590
|
-
var
|
|
16827
|
+
} : N2, _2 = void 0 === j2, k2 = null != j2 ? j2 : p, T = n2.states[k2];
|
|
16828
|
+
if (O2(g, d)) {
|
|
16829
|
+
var q2 = t(f((_2 ? r(R) : [].concat(x2.exit, R, T.entry).filter(function(t2) {
|
|
15591
16830
|
return t2;
|
|
15592
16831
|
})).map(function(t2) {
|
|
15593
16832
|
return i(t2, y._options.actions);
|
|
15594
|
-
}), g, d), 3), z =
|
|
15595
|
-
return { value: C, context: A, actions: z, changed:
|
|
16833
|
+
}), g, d), 3), z = q2[0], A = q2[1], B2 = q2[2], C = null != j2 ? j2 : p;
|
|
16834
|
+
return { value: C, context: A, actions: z, changed: j2 !== p || z.length > 0 || B2, matches: a(C) };
|
|
15596
16835
|
}
|
|
15597
16836
|
}
|
|
15598
16837
|
} catch (t2) {
|
|
@@ -18052,7 +19291,7 @@ class Replayer {
|
|
|
18052
19291
|
this.config.logger.log(REPLAY_CONSOLE_PREFIX, ...args);
|
|
18053
19292
|
}
|
|
18054
19293
|
}
|
|
18055
|
-
const version = "
|
|
19294
|
+
const version = "3.1.1-alpha.1";
|
|
18056
19295
|
const { getVersion } = record;
|
|
18057
19296
|
const { isRecording } = record;
|
|
18058
19297
|
const { flushCustomEventQueue } = record;
|