@drskillissue/ganko 0.1.23 → 0.1.24

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.
@@ -8559,7 +8559,7 @@ function resolveMessage(template, data) {
8559
8559
  }
8560
8560
  return result;
8561
8561
  }
8562
- function createDiagnosticFromLoc(file, loc, rule, messageId, message, severity, fix) {
8562
+ function createDiagnosticFromLoc(file, loc, rule, messageId, message, severity, fix, suggest) {
8563
8563
  const result = {
8564
8564
  file,
8565
8565
  rule,
@@ -8569,13 +8569,14 @@ function createDiagnosticFromLoc(file, loc, rule, messageId, message, severity,
8569
8569
  loc: firstLine(loc)
8570
8570
  };
8571
8571
  if (fix !== void 0) result.fix = fix;
8572
+ if (suggest !== void 0 && suggest.length > 0) result.suggest = suggest;
8572
8573
  return result;
8573
8574
  }
8574
- function createDiagnosticFromComment(file, comment, rule, messageId, message, severity, fix) {
8575
- return createDiagnosticFromLoc(file, comment.loc, rule, messageId, message, severity, fix);
8575
+ function createDiagnosticFromComment(file, comment, rule, messageId, message, severity, fix, suggest) {
8576
+ return createDiagnosticFromLoc(file, comment.loc, rule, messageId, message, severity, fix, suggest);
8576
8577
  }
8577
- function createDiagnostic(file, node, rule, messageId, message, severity, fix) {
8578
- return createDiagnosticFromLoc(file, node.loc, rule, messageId, message, severity, fix);
8578
+ function createDiagnostic(file, node, rule, messageId, message, severity, fix, suggest) {
8579
+ return createDiagnosticFromLoc(file, node.loc, rule, messageId, message, severity, fix, suggest);
8579
8580
  }
8580
8581
 
8581
8582
  // src/solid/rule.ts
@@ -11731,9 +11732,9 @@ var CONDITIONAL_MOUNT_TAGS = /* @__PURE__ */ new Set([
11731
11732
  "TabPanel"
11732
11733
  ]);
11733
11734
  var messages16 = {
11734
- loadingMismatch: "createResource '{{name}}' has no initialValue but uses manual loading checks ({{name}}.loading). Without initialValue, Suspense intercepts before your loading UI renders. Add initialValue to the options: createResource(fetcher, { initialValue: ... })",
11735
- conditionalSuspense: "createResource '{{name}}' is rendered inside a conditional mount point ({{mountTag}}) with a distant Suspense boundary. When the fetcher's Promise is pending, the SuspenseContext increment fires and unmounts the entire subtree. initialValue does NOT prevent this \u2014 it only prevents the accessor from returning undefined.",
11736
- missingErrorBoundary: "createResource '{{name}}' has no <ErrorBoundary> between its component and the nearest <Suspense>. When the fetcher throws (network error, 401/403/503, timeout), the error propagates to Suspense which absorbs it and stays in its fallback state permanently. Wrap the component in <ErrorBoundary fallback={...}> or catch errors inside the fetcher."
11735
+ loadingMismatch: "createResource '{{name}}' has no initialValue but uses {{name}}.loading for manual loading UI. Suspense intercepts before your loading UI renders \u2014 the component is unmounted before the <Show>/<Switch> evaluates. Replace createResource with onMount + createSignal to decouple from Suspense entirely.",
11736
+ conditionalSuspense: "createResource '{{name}}' is inside a conditional mount point ({{mountTag}}) with a distant Suspense boundary. The SuspenseContext increment fires when the fetcher's Promise is pending and unmounts the entire page subtree \u2014 initialValue does NOT prevent this. Replace createResource with onMount + createSignal to avoid Suspense interaction.",
11737
+ missingErrorBoundary: "createResource '{{name}}' has no <ErrorBoundary> between its component and the nearest <Suspense>. When the fetcher throws (network error, 401/403/503, timeout), the error propagates to Suspense which has no error handling \u2014 the boundary breaks permanently. Wrap the component in <ErrorBoundary> or replace createResource with onMount + createSignal and catch errors in the fetcher."
11737
11738
  };
11738
11739
  var options16 = {};
11739
11740
  function hasInitialValue(call) {
@@ -11819,7 +11820,8 @@ function analyzeComponentBoundaries(graph, componentName) {
11819
11820
  const result = {
11820
11821
  conditionalMountTag: null,
11821
11822
  suspenseDistance: 0,
11822
- lacksErrorBoundary: false
11823
+ lacksErrorBoundary: false,
11824
+ usagesLackingErrorBoundary: []
11823
11825
  };
11824
11826
  const usages = graph.jsxByTag.get(componentName) ?? [];
11825
11827
  if (usages.length === 0) return result;
@@ -11841,6 +11843,7 @@ function analyzeComponentBoundaries(graph, componentName) {
11841
11843
  foundSuspense = true;
11842
11844
  if (!foundErrorBoundary) {
11843
11845
  result.lacksErrorBoundary = true;
11846
+ result.usagesLackingErrorBoundary.push(usage);
11844
11847
  }
11845
11848
  if (conditionalTag !== null && componentLevels > 1) {
11846
11849
  result.conditionalMountTag = conditionalTag;
@@ -11855,6 +11858,7 @@ function analyzeComponentBoundaries(graph, componentName) {
11855
11858
  }
11856
11859
  if (!foundSuspense && !foundErrorBoundary) {
11857
11860
  result.lacksErrorBoundary = true;
11861
+ result.usagesLackingErrorBoundary.push(usage);
11858
11862
  if (conditionalTag !== null) {
11859
11863
  result.conditionalMountTag = conditionalTag;
11860
11864
  result.suspenseDistance = componentLevels;
@@ -11878,13 +11882,28 @@ function findResourceVariable(graph, name) {
11878
11882
  }
11879
11883
  return null;
11880
11884
  }
11885
+ function buildErrorBoundaryFix(usages, graph) {
11886
+ if (usages.length === 0) return null;
11887
+ const usage = usages[0];
11888
+ if (!usage) return null;
11889
+ const jsxNode = usage.node;
11890
+ const startPos = jsxNode.range[0];
11891
+ const endPos = jsxNode.range[1];
11892
+ const ops = [
11893
+ { range: [startPos, startPos], text: "<ErrorBoundary fallback={<div>Error</div>}>" },
11894
+ { range: [endPos, endPos], text: "</ErrorBoundary>" }
11895
+ ];
11896
+ const importFix = buildSolidImportFix(graph, "ErrorBoundary");
11897
+ if (importFix) ops.unshift(importFix);
11898
+ return ops;
11899
+ }
11881
11900
  var resourceImplicitSuspense = defineSolidRule({
11882
11901
  id: "resource-implicit-suspense",
11883
11902
  severity: "warn",
11884
11903
  messages: messages16,
11885
11904
  meta: {
11886
11905
  description: "Detect createResource that implicitly triggers or permanently breaks Suspense boundaries.",
11887
- fixable: false,
11906
+ fixable: true,
11888
11907
  category: "reactivity"
11889
11908
  },
11890
11909
  options: options16,
@@ -11939,6 +11958,10 @@ var resourceImplicitSuspense = defineSolidRule({
11939
11958
  if (analysis.lacksErrorBoundary) {
11940
11959
  const fetcherFn = resolveFetcherFunction(graph, call);
11941
11960
  if (fetcherFn && fetcherCanThrow(graph, fetcherFn, throwVisited)) {
11961
+ const errorBoundaryFix = buildErrorBoundaryFix(
11962
+ analysis.usagesLackingErrorBoundary,
11963
+ graph
11964
+ );
11942
11965
  emit(
11943
11966
  createDiagnostic(
11944
11967
  graph.file,
@@ -11946,7 +11969,8 @@ var resourceImplicitSuspense = defineSolidRule({
11946
11969
  "resource-implicit-suspense",
11947
11970
  "missingErrorBoundary",
11948
11971
  resolveMessage(messages16.missingErrorBoundary, { name: resourceName }),
11949
- "error"
11972
+ "error",
11973
+ errorBoundaryFix ?? void 0
11950
11974
  )
11951
11975
  );
11952
11976
  }
@@ -29449,6 +29473,11 @@ function toLayoutElementKey(solidFile, elementId) {
29449
29473
  return `${solidFile}::${elementId}`;
29450
29474
  }
29451
29475
 
29476
+ // src/cross-file/layout/context-model.ts
29477
+ function deriveAlignmentContext(base, overrides) {
29478
+ return { ...base, ...overrides };
29479
+ }
29480
+
29452
29481
  // src/cross-file/layout/signal-model.ts
29453
29482
  var layoutSignalNames = [
29454
29483
  "line-height",
@@ -29477,6 +29506,8 @@ var layoutSignalNames = [
29477
29506
  "justify-items",
29478
29507
  "place-items",
29479
29508
  "place-self",
29509
+ "flex-direction",
29510
+ "grid-auto-flow",
29480
29511
  "appearance",
29481
29512
  "box-sizing",
29482
29513
  "padding-top",
@@ -29595,13 +29626,44 @@ function expandShorthand(property, value2) {
29595
29626
  { name: blockTarget[1], value: parsed.end }
29596
29627
  ];
29597
29628
  }
29629
+ if (property === "flex-flow") {
29630
+ return expandFlexFlow(value2);
29631
+ }
29598
29632
  return void 0;
29599
29633
  }
29634
+ var FLEX_DIRECTION_VALUES = /* @__PURE__ */ new Set(["row", "row-reverse", "column", "column-reverse"]);
29635
+ function expandFlexFlow(value2) {
29636
+ const tokens = splitWhitespaceTokens(value2.trim().toLowerCase());
29637
+ if (tokens.length === 0) return null;
29638
+ if (tokens.length > 2) return null;
29639
+ let direction = null;
29640
+ let wrap = null;
29641
+ for (let i = 0; i < tokens.length; i++) {
29642
+ const token = tokens[i];
29643
+ if (!token) continue;
29644
+ if (FLEX_DIRECTION_VALUES.has(token)) {
29645
+ if (direction !== null) return null;
29646
+ direction = token;
29647
+ } else {
29648
+ if (wrap !== null) return null;
29649
+ wrap = token;
29650
+ }
29651
+ }
29652
+ const out = [];
29653
+ if (direction !== null) {
29654
+ out.push({ name: "flex-direction", value: direction });
29655
+ }
29656
+ if (wrap !== null) {
29657
+ out.push({ name: "flex-wrap", value: wrap });
29658
+ }
29659
+ return out.length > 0 ? out : null;
29660
+ }
29600
29661
  function getShorthandLonghandNames(property) {
29601
29662
  const quad = QUAD_EXPANSIONS.get(property);
29602
29663
  if (quad !== void 0) return [...quad];
29603
29664
  const block = BLOCK_EXPANSIONS.get(property);
29604
29665
  if (block !== void 0) return [...block];
29666
+ if (property === "flex-flow") return ["flex-direction", "flex-wrap"];
29605
29667
  return null;
29606
29668
  }
29607
29669
 
@@ -29612,27 +29674,90 @@ var CONTROL_ELEMENT_TAGS = /* @__PURE__ */ new Set([
29612
29674
  "textarea",
29613
29675
  "button"
29614
29676
  ]);
29677
+ var INTRINSIC_REPLACED_TAGS = /* @__PURE__ */ new Set([
29678
+ "img",
29679
+ "svg",
29680
+ "video",
29681
+ "canvas",
29682
+ "iframe",
29683
+ "object",
29684
+ "embed"
29685
+ ]);
29686
+ var WHITESPACE_RE3 = /\s+/;
29615
29687
  function clamp(value2, min, max) {
29616
29688
  if (value2 < min) return min;
29617
29689
  if (value2 > max) return max;
29618
29690
  return value2;
29619
29691
  }
29620
- function kindRank(kind) {
29621
- if (kind === "exact") return 0;
29622
- if (kind === "interval") return 1;
29623
- if (kind === "conditional") return 2;
29624
- return 3;
29625
- }
29626
29692
  function mergeEvidenceKind(left, right) {
29627
- if (kindRank(left) >= kindRank(right)) return left;
29628
- return right;
29693
+ return left > right ? left : right;
29694
+ }
29695
+ function selectKth(values, targetIndex) {
29696
+ let left = 0;
29697
+ let right = values.length - 1;
29698
+ while (left <= right) {
29699
+ if (left === right) {
29700
+ const result = values[left];
29701
+ if (result === void 0) return 0;
29702
+ return result;
29703
+ }
29704
+ const pivotIndex = choosePivotIndex(values, left, right);
29705
+ const partitionIndex = partitionAroundPivot(values, left, right, pivotIndex);
29706
+ if (partitionIndex === targetIndex) {
29707
+ const result = values[partitionIndex];
29708
+ if (result === void 0) return 0;
29709
+ return result;
29710
+ }
29711
+ if (partitionIndex < targetIndex) {
29712
+ left = partitionIndex + 1;
29713
+ continue;
29714
+ }
29715
+ right = partitionIndex - 1;
29716
+ }
29717
+ const fallback = values[targetIndex];
29718
+ if (fallback === void 0) return 0;
29719
+ return fallback;
29720
+ }
29721
+ function choosePivotIndex(values, left, right) {
29722
+ const middle = Math.floor((left + right) / 2);
29723
+ const leftValue = values[left] ?? 0;
29724
+ const middleValue = values[middle] ?? 0;
29725
+ const rightValue = values[right] ?? 0;
29726
+ if (leftValue < middleValue) {
29727
+ if (middleValue < rightValue) return middle;
29728
+ if (leftValue < rightValue) return right;
29729
+ return left;
29730
+ }
29731
+ if (leftValue < rightValue) return left;
29732
+ if (middleValue < rightValue) return right;
29733
+ return middle;
29734
+ }
29735
+ function partitionAroundPivot(values, left, right, pivotIndex) {
29736
+ const pivotValue = values[pivotIndex] ?? 0;
29737
+ swap(values, pivotIndex, right);
29738
+ let storeIndex = left;
29739
+ for (let i = left; i < right; i++) {
29740
+ const current = values[i];
29741
+ if (current === void 0 || current > pivotValue) continue;
29742
+ swap(values, storeIndex, i);
29743
+ storeIndex++;
29744
+ }
29745
+ swap(values, storeIndex, right);
29746
+ return storeIndex;
29747
+ }
29748
+ function swap(values, left, right) {
29749
+ if (left === right) return;
29750
+ const leftValue = values[left] ?? 0;
29751
+ const rightValue = values[right] ?? 0;
29752
+ values[left] = rightValue;
29753
+ values[right] = leftValue;
29629
29754
  }
29630
29755
  function toComparableExactValue(value2) {
29631
29756
  if (value2.value !== null) {
29632
- if (value2.kind !== "exact") return null;
29757
+ if (value2.kind !== 0 /* Exact */) return null;
29633
29758
  return value2.value;
29634
29759
  }
29635
- if (value2.kind === "exact") return 0;
29760
+ if (value2.kind === 0 /* Exact */) return 0;
29636
29761
  return null;
29637
29762
  }
29638
29763
 
@@ -29646,7 +29771,8 @@ var MONITORED_SHORTHAND_SET = /* @__PURE__ */ new Set([
29646
29771
  "border-width",
29647
29772
  "margin-block",
29648
29773
  "padding-block",
29649
- "inset-block"
29774
+ "inset-block",
29775
+ "flex-flow"
29650
29776
  ]);
29651
29777
  var LENGTH_SIGNAL_SET = /* @__PURE__ */ new Set([
29652
29778
  "font-size",
@@ -29688,13 +29814,22 @@ var KEYWORD_SIGNAL_SET = /* @__PURE__ */ new Set([
29688
29814
  "justify-items",
29689
29815
  "place-items",
29690
29816
  "place-self",
29817
+ "flex-direction",
29818
+ "grid-auto-flow",
29691
29819
  "appearance",
29692
29820
  "box-sizing",
29693
29821
  "position",
29694
29822
  "writing-mode",
29695
29823
  "direction"
29696
29824
  ]);
29697
- var REPLACED_TAGS = /* @__PURE__ */ new Set(["input", "select", "textarea", "button", "img", "video", "canvas", "svg", "iframe"]);
29825
+ var REPLACED_ELEMENT_TAGS = /* @__PURE__ */ new Set([
29826
+ ...CONTROL_ELEMENT_TAGS,
29827
+ "img",
29828
+ "video",
29829
+ "canvas",
29830
+ "svg",
29831
+ "iframe"
29832
+ ]);
29698
29833
  function isMonitoredSignal(property) {
29699
29834
  if (MONITORED_SIGNAL_SET.has(property)) return true;
29700
29835
  return MONITORED_SHORTHAND_SET.has(property);
@@ -29705,7 +29840,7 @@ function isControlTag(tag) {
29705
29840
  }
29706
29841
  function isReplacedTag(tag) {
29707
29842
  if (tag === null) return false;
29708
- return REPLACED_TAGS.has(tag.toLowerCase());
29843
+ return REPLACED_ELEMENT_TAGS.has(tag.toLowerCase());
29709
29844
  }
29710
29845
  function normalizeSignalMapWithCounts(values) {
29711
29846
  const out = /* @__PURE__ */ new Map();
@@ -29716,12 +29851,11 @@ function normalizeSignalMapWithCounts(values) {
29716
29851
  "font-size",
29717
29852
  fontSizeEntry.value,
29718
29853
  fontSizeEntry.source,
29719
- fontSizeEntry.guard,
29720
29854
  fontSizeEntry.guardProvenance,
29721
29855
  null
29722
29856
  );
29723
29857
  out.set("font-size", parsedFontSize);
29724
- if (parsedFontSize.kind === "known" && parsedFontSize.guard === "unconditional") {
29858
+ if (parsedFontSize.kind === "known" && parsedFontSize.guard.kind === 0 /* Unconditional */) {
29725
29859
  fontSizePx = parsedFontSize.px;
29726
29860
  }
29727
29861
  }
@@ -29737,7 +29871,6 @@ function normalizeSignalMapWithCounts(values) {
29737
29871
  name,
29738
29872
  declaration.value,
29739
29873
  declaration.source,
29740
- declaration.guard,
29741
29874
  declaration.guardProvenance,
29742
29875
  fontSizePx
29743
29876
  );
@@ -29747,7 +29880,7 @@ function normalizeSignalMapWithCounts(values) {
29747
29880
  let unknownSignalCount = 0;
29748
29881
  let conditionalSignalCount = 0;
29749
29882
  for (const value2 of out.values()) {
29750
- if (value2.guard === "conditional") {
29883
+ if (value2.guard.kind === 1 /* Conditional */) {
29751
29884
  conditionalSignalCount++;
29752
29885
  continue;
29753
29886
  }
@@ -29775,7 +29908,7 @@ function applyExpandedShorthand(out, property, declaration, fontSizePx) {
29775
29908
  if (!longhand) continue;
29776
29909
  const name = MONITORED_SIGNAL_NAME_MAP.get(longhand);
29777
29910
  if (name === void 0) continue;
29778
- out.set(name, createUnknown(name, declaration.value, declaration.source, declaration.guard, declaration.guardProvenance, reason));
29911
+ out.set(name, createUnknown(name, declaration.source, declaration.guardProvenance, reason));
29779
29912
  }
29780
29913
  return;
29781
29914
  }
@@ -29785,127 +29918,139 @@ function applyExpandedShorthand(out, property, declaration, fontSizePx) {
29785
29918
  if (!entry) continue;
29786
29919
  const name = MONITORED_SIGNAL_NAME_MAP.get(entry.name);
29787
29920
  if (name === void 0) continue;
29788
- out.set(name, normalizeSignal(name, entry.value, declaration.source, declaration.guard, declaration.guardProvenance, fontSizePx));
29921
+ out.set(name, normalizeSignal(name, entry.value, declaration.source, declaration.guardProvenance, fontSizePx));
29789
29922
  }
29790
29923
  }
29791
29924
  function toMonitoredSignalName(property) {
29792
29925
  return MONITORED_SIGNAL_NAME_MAP.get(property) ?? null;
29793
29926
  }
29794
- function normalizeSignal(name, raw, source, guard, guardProvenance, fontSizePx) {
29927
+ function normalizeSignal(name, raw, source, guard, fontSizePx) {
29795
29928
  switch (name) {
29796
29929
  case "line-height":
29797
- return parseLineHeight(name, raw, source, guard, guardProvenance, fontSizePx);
29930
+ return parseLineHeight(name, raw, source, guard, fontSizePx);
29798
29931
  case "aspect-ratio":
29799
- return parseAspectRatio(name, raw, source, guard, guardProvenance);
29932
+ return parseAspectRatio(name, raw, source, guard);
29800
29933
  case "contain-intrinsic-size":
29801
- return parseContainIntrinsicSize(name, raw, source, guard, guardProvenance);
29934
+ return parseContainIntrinsicSize(name, raw, source, guard);
29802
29935
  case "transform":
29803
- return parseTransform(name, raw, source, guard, guardProvenance);
29936
+ return parseTransform(name, raw, source, guard);
29804
29937
  case "translate":
29805
- return parseTranslateProperty(name, raw, source, guard, guardProvenance);
29938
+ return parseTranslateProperty(name, raw, source, guard);
29806
29939
  default:
29807
29940
  break;
29808
29941
  }
29809
- if (LENGTH_SIGNAL_SET.has(name)) return parseLength(name, raw, source, guard, guardProvenance);
29810
- if (KEYWORD_SIGNAL_SET.has(name)) return parseKeyword(name, raw, source, guard, guardProvenance);
29811
- return createUnknown(name, raw, source, guard, guardProvenance, "unsupported signal");
29942
+ if (LENGTH_SIGNAL_SET.has(name)) return parseLength(name, raw, source, guard);
29943
+ if (KEYWORD_SIGNAL_SET.has(name)) return parseKeyword(name, raw, source, guard);
29944
+ return createUnknown(name, source, guard, "unsupported signal");
29812
29945
  }
29813
- function parseAspectRatio(name, raw, source, guard, guardProvenance) {
29946
+ function parseAspectRatio(name, raw, source, guard) {
29814
29947
  const trimmed = raw.trim().toLowerCase();
29815
29948
  if (trimmed.length === 0) {
29816
- return createUnknown(name, raw, source, guard, guardProvenance, "aspect-ratio value is empty");
29949
+ return createUnknown(name, source, guard, "aspect-ratio value is empty");
29817
29950
  }
29818
29951
  if (hasDynamicExpression(trimmed)) {
29819
- return createUnknown(name, raw, source, guard, guardProvenance, "aspect-ratio uses runtime-dependent function");
29952
+ return createUnknown(name, source, guard, "aspect-ratio uses runtime-dependent function");
29820
29953
  }
29821
29954
  if (trimmed === "auto") {
29822
- return createUnknown(name, raw, source, guard, guardProvenance, "aspect-ratio auto does not reserve ratio");
29955
+ return createUnknown(name, source, guard, "aspect-ratio auto does not reserve ratio");
29823
29956
  }
29824
29957
  const slash = trimmed.indexOf("/");
29825
29958
  if (slash !== -1) {
29826
29959
  const left = Number(trimmed.slice(0, slash).trim());
29827
29960
  const right = Number(trimmed.slice(slash + 1).trim());
29828
29961
  if (!Number.isFinite(left) || !Number.isFinite(right) || left <= 0 || right <= 0) {
29829
- return createUnknown(name, raw, source, guard, guardProvenance, "aspect-ratio ratio is invalid");
29962
+ return createUnknown(name, source, guard, "aspect-ratio ratio is invalid");
29830
29963
  }
29831
- return createKnown(name, raw, source, guard, guardProvenance, null, "unitless", "exact");
29964
+ return createKnown(name, raw, source, guard, null, 1 /* Unitless */, "exact");
29832
29965
  }
29833
29966
  const ratio = Number(trimmed);
29834
29967
  if (!Number.isFinite(ratio) || ratio <= 0) {
29835
- return createUnknown(name, raw, source, guard, guardProvenance, "aspect-ratio is not statically parseable");
29968
+ return createUnknown(name, source, guard, "aspect-ratio is not statically parseable");
29836
29969
  }
29837
- return createKnown(name, raw, source, guard, guardProvenance, null, "unitless", "exact");
29970
+ return createKnown(name, raw, source, guard, null, 1 /* Unitless */, "exact");
29838
29971
  }
29839
- function parseContainIntrinsicSize(name, raw, source, guard, guardProvenance) {
29972
+ function parseContainIntrinsicSize(name, raw, source, guard) {
29840
29973
  const trimmed = raw.trim().toLowerCase();
29841
29974
  if (trimmed.length === 0) {
29842
- return createUnknown(name, raw, source, guard, guardProvenance, "contain-intrinsic-size value is empty");
29975
+ return createUnknown(name, source, guard, "contain-intrinsic-size value is empty");
29843
29976
  }
29844
29977
  if (hasDynamicExpression(trimmed)) {
29845
- return createUnknown(name, raw, source, guard, guardProvenance, "contain-intrinsic-size uses runtime-dependent function");
29978
+ return createUnknown(name, source, guard, "contain-intrinsic-size uses runtime-dependent function");
29846
29979
  }
29847
29980
  if (trimmed === "none" || trimmed === "auto") {
29848
- return createUnknown(name, raw, source, guard, guardProvenance, "contain-intrinsic-size does not reserve space");
29981
+ return createUnknown(name, source, guard, "contain-intrinsic-size does not reserve space");
29849
29982
  }
29850
29983
  const parts = splitWhitespaceTokens(trimmed);
29851
29984
  for (let i = 0; i < parts.length; i++) {
29852
29985
  const part = parts[i];
29853
29986
  if (!part) continue;
29854
29987
  const px = parseSignedPxValue(part);
29855
- if (px !== null) return createKnown(name, raw, source, guard, guardProvenance, px, "px", "exact");
29988
+ if (px !== null) return createKnown(name, raw, source, guard, px, 0 /* Px */, "exact");
29856
29989
  }
29857
- return createUnknown(name, raw, source, guard, guardProvenance, "contain-intrinsic-size is not statically parseable in px");
29990
+ return createUnknown(name, source, guard, "contain-intrinsic-size is not statically parseable in px");
29858
29991
  }
29859
- function parseLineHeight(name, raw, source, guard, guardProvenance, fontSizePx) {
29992
+ function parseLineHeight(name, raw, source, guard, fontSizePx) {
29860
29993
  const unitless = parseUnitlessValue(raw);
29861
29994
  if (unitless !== null) {
29862
29995
  const base = fontSizePx === null ? 16 : fontSizePx;
29863
- return createKnown(name, raw, source, guard, guardProvenance, unitless * base, "unitless", "estimated");
29996
+ return createKnown(name, raw, source, guard, unitless * base, 1 /* Unitless */, "estimated");
29864
29997
  }
29865
29998
  const px = parseSignedPxValue(raw);
29866
- if (px !== null) return createKnown(name, raw, source, guard, guardProvenance, px, "px", "exact");
29867
- return createUnknown(name, raw, source, guard, guardProvenance, "line-height is not statically parseable");
29999
+ if (px !== null) return createKnown(name, raw, source, guard, px, 0 /* Px */, "exact");
30000
+ return createUnknown(name, source, guard, "line-height is not statically parseable");
29868
30001
  }
29869
- function parseLength(name, raw, source, guard, guardProvenance) {
30002
+ var DIMENSION_KEYWORD_SET = /* @__PURE__ */ new Set([
30003
+ "auto",
30004
+ "none",
30005
+ "fit-content",
30006
+ "min-content",
30007
+ "max-content",
30008
+ "stretch"
30009
+ ]);
30010
+ function parseLength(name, raw, source, guard) {
29870
30011
  const px = parseSignedPxValue(raw);
29871
- if (px === null) {
29872
- return createUnknown(name, raw, source, guard, guardProvenance, "length is not statically parseable in px");
30012
+ if (px !== null) {
30013
+ return createKnown(name, raw, source, guard, px, 0 /* Px */, "exact");
29873
30014
  }
29874
- return createKnown(name, raw, source, guard, guardProvenance, px, "px", "exact");
30015
+ const normalized = raw.trim().toLowerCase();
30016
+ if (DIMENSION_KEYWORD_SET.has(normalized) || normalized.startsWith("fit-content(")) {
30017
+ return createKnown(name, raw, source, guard, null, 2 /* Keyword */, "exact");
30018
+ }
30019
+ return createUnknown(name, source, guard, "length is not statically parseable in px");
29875
30020
  }
29876
- function parseKeyword(name, raw, source, guard, guardProvenance) {
30021
+ function parseKeyword(name, raw, source, guard) {
29877
30022
  const normalized = raw.trim().toLowerCase();
29878
30023
  if (normalized.length === 0) {
29879
- return createUnknown(name, raw, source, guard, guardProvenance, "keyword value is empty");
30024
+ return createUnknown(name, source, guard, "keyword value is empty");
29880
30025
  }
29881
30026
  if (hasDynamicExpression(normalized)) {
29882
- return createUnknown(name, raw, source, guard, guardProvenance, "keyword uses runtime-dependent function");
30027
+ return createUnknown(name, source, guard, "keyword uses runtime-dependent function");
29883
30028
  }
29884
- return createKnown(name, raw, source, guard, guardProvenance, null, "keyword", "exact");
30029
+ return createKnown(name, raw, source, guard, null, 2 /* Keyword */, "exact");
29885
30030
  }
29886
- function parseTransform(name, raw, source, guard, guardProvenance) {
30031
+ function parseTransform(name, raw, source, guard) {
29887
30032
  const normalized = raw.trim().toLowerCase();
29888
30033
  if (normalized.length === 0) {
29889
- return createUnknown(name, raw, source, guard, guardProvenance, "transform value is empty");
30034
+ return createUnknown(name, source, guard, "transform value is empty");
29890
30035
  }
29891
30036
  if (hasDynamicExpression(normalized)) {
29892
- return createUnknown(name, raw, source, guard, guardProvenance, "transform uses runtime-dependent function");
30037
+ return createUnknown(name, source, guard, "transform uses runtime-dependent function");
29893
30038
  }
29894
30039
  const y = extractTransformYPx(normalized);
29895
- if (y !== null) return createKnown(name, raw, source, guard, guardProvenance, y, "px", "exact");
29896
- return createUnknown(name, raw, source, guard, guardProvenance, "transform has non-translational or non-px functions");
30040
+ if (y !== null) return createKnown(name, raw, source, guard, y, 0 /* Px */, "exact");
30041
+ return createUnknown(name, source, guard, "transform has non-translational or non-px functions");
29897
30042
  }
29898
- function parseTranslateProperty(name, raw, source, guard, guardProvenance) {
30043
+ function parseTranslateProperty(name, raw, source, guard) {
29899
30044
  const trimmed = raw.trim().toLowerCase();
29900
30045
  if (trimmed.length === 0) {
29901
- return createUnknown(name, raw, source, guard, guardProvenance, "translate value is empty");
30046
+ return createUnknown(name, source, guard, "translate value is empty");
29902
30047
  }
29903
30048
  if (hasDynamicExpression(trimmed)) {
29904
- return createUnknown(name, raw, source, guard, guardProvenance, "translate uses runtime-dependent function");
30049
+ return createUnknown(name, source, guard, "translate uses runtime-dependent function");
29905
30050
  }
29906
30051
  const y = extractTranslatePropertyYPx(trimmed);
29907
- if (y !== null) return createKnown(name, raw, source, guard, guardProvenance, y, "px", "exact");
29908
- return createUnknown(name, raw, source, guard, guardProvenance, "translate property vertical component is not px");
30052
+ if (y !== null) return createKnown(name, raw, source, guard, y, 0 /* Px */, "exact");
30053
+ return createUnknown(name, source, guard, "translate property vertical component is not px");
29909
30054
  }
29910
30055
  function hasDynamicExpression(raw) {
29911
30056
  if (raw.includes("var(")) return true;
@@ -29917,28 +30062,24 @@ function hasDynamicExpression(raw) {
29917
30062
  if (raw.includes("clamp(")) return true;
29918
30063
  return false;
29919
30064
  }
29920
- function createKnown(name, raw, source, guard, guardProvenance, px, unit, quality) {
30065
+ function createKnown(name, raw, source, guard, px, unit, quality) {
29921
30066
  return {
29922
30067
  kind: "known",
29923
30068
  name,
29924
- raw,
29925
30069
  normalized: raw.trim().toLowerCase(),
29926
30070
  source,
29927
30071
  guard,
29928
- guardProvenance,
29929
30072
  unit,
29930
30073
  px,
29931
30074
  quality
29932
30075
  };
29933
30076
  }
29934
- function createUnknown(name, raw, source, guard, guardProvenance, reason) {
30077
+ function createUnknown(name, source, guard, reason) {
29935
30078
  return {
29936
30079
  kind: "unknown",
29937
30080
  name,
29938
- raw,
29939
30081
  source,
29940
30082
  guard,
29941
- guardProvenance,
29942
30083
  reason
29943
30084
  };
29944
30085
  }
@@ -29985,13 +30126,7 @@ function buildSnapshotForNode(node, cascadeByElementNode, snapshotByElementNode,
29985
30126
  const unknownSignalCount = normalized.unknownSignalCount + inherited.unknownDelta;
29986
30127
  const conditionalSignalCount = normalized.conditionalSignalCount + inherited.conditionalDelta;
29987
30128
  const snapshot = {
29988
- solidFile: node.solidFile,
29989
- elementId: node.elementId,
29990
- elementKey: node.key,
29991
- tag: node.tag,
29992
- textualContent: node.textualContent,
29993
- isControl: node.isControl,
29994
- isReplaced: node.isReplaced,
30129
+ node,
29995
30130
  signals: inherited.signals,
29996
30131
  knownSignalCount,
29997
30132
  unknownSignalCount,
@@ -30022,7 +30157,7 @@ function inheritSignalsFromParent(parentSnapshot, local) {
30022
30157
  if (!inheritedValue) continue;
30023
30158
  if (out === null) out = new Map(local);
30024
30159
  out.set(signal, inheritedValue);
30025
- if (inheritedValue.guard === "conditional") {
30160
+ if (inheritedValue.guard.kind === 1 /* Conditional */) {
30026
30161
  conditionalDelta++;
30027
30162
  continue;
30028
30163
  }
@@ -30066,7 +30201,7 @@ var EMPTY_LAYOUT_RESERVED_SPACE_FACT = Object.freeze({
30066
30201
  });
30067
30202
  var EMPTY_LAYOUT_SCROLL_CONTAINER_FACT = Object.freeze({
30068
30203
  isScrollContainer: false,
30069
- axis: "none",
30204
+ axis: 0 /* None */,
30070
30205
  overflow: null,
30071
30206
  overflowY: null,
30072
30207
  hasConditionalScroll: false,
@@ -30099,53 +30234,28 @@ function readKnownSignalWithGuard(snapshot, name) {
30099
30234
  return value2;
30100
30235
  }
30101
30236
  function toEvidenceKind(value2) {
30102
- if (value2.guard === "conditional") return "conditional";
30103
- if (value2.quality === "estimated") return "interval";
30104
- return "exact";
30105
- }
30106
- function readNumericSignalEvidence(snapshot, name) {
30107
- const value2 = snapshot.signals.get(name);
30108
- if (!value2) {
30109
- return {
30110
- value: null,
30111
- kind: "unknown"
30112
- };
30113
- }
30114
- if (value2.kind !== "known") {
30115
- if (value2.guard === "conditional") {
30116
- return {
30117
- value: null,
30118
- kind: "conditional"
30119
- };
30120
- }
30121
- return {
30122
- value: null,
30123
- kind: "unknown"
30124
- };
30125
- }
30126
- return {
30127
- value: value2.px,
30128
- kind: toEvidenceKind(value2)
30129
- };
30237
+ if (value2.guard.kind === 1 /* Conditional */) return 2 /* Conditional */;
30238
+ if (value2.quality === "estimated") return 1 /* Interval */;
30239
+ return 0 /* Exact */;
30130
30240
  }
30131
30241
  function readNormalizedSignalEvidence(snapshot, name) {
30132
30242
  const value2 = snapshot.signals.get(name);
30133
30243
  if (!value2) {
30134
30244
  return {
30135
30245
  value: null,
30136
- kind: "unknown"
30246
+ kind: 3 /* Unknown */
30137
30247
  };
30138
30248
  }
30139
30249
  if (value2.kind !== "known") {
30140
- if (value2.guard === "conditional") {
30250
+ if (value2.guard.kind === 1 /* Conditional */) {
30141
30251
  return {
30142
30252
  value: null,
30143
- kind: "conditional"
30253
+ kind: 2 /* Conditional */
30144
30254
  };
30145
30255
  }
30146
30256
  return {
30147
30257
  value: null,
30148
- kind: "unknown"
30258
+ kind: 3 /* Unknown */
30149
30259
  };
30150
30260
  }
30151
30261
  return {
@@ -30156,7 +30266,7 @@ function readNormalizedSignalEvidence(snapshot, name) {
30156
30266
  function readKnownSignal(snapshot, name) {
30157
30267
  const value2 = readKnownSignalWithGuard(snapshot, name);
30158
30268
  if (!value2) return null;
30159
- if (value2.guard !== "unconditional") return null;
30269
+ if (value2.guard.kind !== 0 /* Unconditional */) return null;
30160
30270
  return value2;
30161
30271
  }
30162
30272
  function readKnownPx(snapshot, name) {
@@ -30190,19 +30300,19 @@ function hasEffectivePosition(snapshot) {
30190
30300
  return position !== "static";
30191
30301
  }
30192
30302
  function readReservedSpaceFact(graph, node) {
30193
- return graph.reservedSpaceFactsByElementKey.get(node.key) ?? EMPTY_LAYOUT_RESERVED_SPACE_FACT;
30303
+ return graph.reservedSpaceFactsByNode.get(node) ?? EMPTY_LAYOUT_RESERVED_SPACE_FACT;
30194
30304
  }
30195
30305
  function readScrollContainerFact(graph, node) {
30196
- return graph.scrollContainerFactsByElementKey.get(node.key) ?? EMPTY_LAYOUT_SCROLL_CONTAINER_FACT;
30306
+ return graph.scrollContainerFactsByNode.get(node) ?? EMPTY_LAYOUT_SCROLL_CONTAINER_FACT;
30197
30307
  }
30198
30308
  function readFlowParticipationFact(graph, node) {
30199
- return graph.flowParticipationFactsByElementKey.get(node.key) ?? EMPTY_LAYOUT_FLOW_PARTICIPATION_FACT;
30309
+ return graph.flowParticipationFactsByNode.get(node) ?? EMPTY_LAYOUT_FLOW_PARTICIPATION_FACT;
30200
30310
  }
30201
30311
  function readContainingBlockFact(graph, node) {
30202
- return graph.containingBlockFactsByElementKey.get(node.key) ?? EMPTY_LAYOUT_CONTAINING_BLOCK_FACT;
30312
+ return graph.containingBlockFactsByNode.get(node) ?? EMPTY_LAYOUT_CONTAINING_BLOCK_FACT;
30203
30313
  }
30204
30314
  function readConditionalSignalDeltaFact(graph, node, name) {
30205
- const byProperty = graph.conditionalSignalDeltaFactsByElementKey.get(node.key);
30315
+ const byProperty = graph.conditionalSignalDeltaFactsByNode.get(node);
30206
30316
  if (!byProperty) return EMPTY_LAYOUT_CONDITIONAL_DELTA_FACT;
30207
30317
  return byProperty.get(name) ?? EMPTY_LAYOUT_CONDITIONAL_DELTA_FACT;
30208
30318
  }
@@ -30230,7 +30340,7 @@ function readScrollContainerElements(graph) {
30230
30340
  return graph.scrollContainerElements;
30231
30341
  }
30232
30342
  function readBaselineOffsetFacts(graph, node) {
30233
- return graph.baselineOffsetFactsByElementKey.get(node.key) ?? EMPTY_BASELINE_FACTS;
30343
+ return graph.baselineOffsetFactsByNode.get(node) ?? EMPTY_BASELINE_FACTS;
30234
30344
  }
30235
30345
  function readElementRef(graph, node) {
30236
30346
  return readElementRefById(graph, node.solidFile, node.elementId);
@@ -30252,7 +30362,6 @@ function readStatefulBaseValueIndex(graph) {
30252
30362
  }
30253
30363
 
30254
30364
  // src/cross-file/layout/context-classification.ts
30255
- var WHITESPACE_RE3 = /\s+/;
30256
30365
  var TABLE_SEMANTIC_TAGS = /* @__PURE__ */ new Set(["table", "thead", "tbody", "tfoot", "tr", "td", "th"]);
30257
30366
  var TABLE_DISPLAY_VALUES = /* @__PURE__ */ new Set([
30258
30367
  "table",
@@ -30269,7 +30378,6 @@ var TABLE_DISPLAY_VALUES = /* @__PURE__ */ new Set([
30269
30378
  var FLEX_DISPLAY_VALUES = /* @__PURE__ */ new Set(["flex", "inline-flex"]);
30270
30379
  var GRID_DISPLAY_VALUES = /* @__PURE__ */ new Set(["grid", "inline-grid"]);
30271
30380
  var INLINE_DISPLAY_VALUES = /* @__PURE__ */ new Set(["inline", "inline-block", "inline-list-item"]);
30272
- var DISPLAY_TOKEN_SPLIT_RE = /\s+/;
30273
30381
  function createAlignmentContextForParent(parent, snapshot) {
30274
30382
  const axis = resolveAxis(snapshot);
30275
30383
  const inlineDirection = resolveInlineDirection(snapshot);
@@ -30292,6 +30400,7 @@ function createAlignmentContextForParent(parent, snapshot) {
30292
30400
  const contextCertainty = combineCertainty(classified.certainty, axis.certainty);
30293
30401
  const certainty = combineCertainty(contextCertainty, inlineDirection.certainty);
30294
30402
  const baselineRelevance = computeBaselineRelevance(classified.kind, parentAlignItems, parentPlaceItems);
30403
+ const crossAxisInfo = resolveCrossAxisIsBlockAxis(classified.kind, snapshot, axis.value);
30295
30404
  const out = {
30296
30405
  kind: classified.kind,
30297
30406
  certainty,
@@ -30307,6 +30416,8 @@ function createAlignmentContextForParent(parent, snapshot) {
30307
30416
  parentAlignItems,
30308
30417
  parentPlaceItems,
30309
30418
  hasPositionedOffset: positionedOffset.hasPositionedOffset,
30419
+ crossAxisIsBlockAxis: crossAxisInfo.value,
30420
+ crossAxisIsBlockAxisCertainty: crossAxisInfo.certainty,
30310
30421
  baselineRelevance,
30311
30422
  evidence
30312
30423
  };
@@ -30316,7 +30427,7 @@ function classifyKind(evidence) {
30316
30427
  if (evidence.hasTableSemantics) {
30317
30428
  return {
30318
30429
  kind: "table-cell",
30319
- certainty: "resolved"
30430
+ certainty: 0 /* Resolved */
30320
30431
  };
30321
30432
  }
30322
30433
  if (evidence.containerKind === "table") {
@@ -30403,7 +30514,7 @@ function resolveContainerKind(parentDisplay, certainty) {
30403
30514
  certainty
30404
30515
  };
30405
30516
  }
30406
- const tokens = display.split(DISPLAY_TOKEN_SPLIT_RE);
30517
+ const tokens = display.split(WHITESPACE_RE3);
30407
30518
  if (tokens.length === 2) {
30408
30519
  const outside = tokens[0];
30409
30520
  const inside = tokens[1];
@@ -30453,7 +30564,7 @@ function resolveAxis(snapshot) {
30453
30564
  if (!snapshot.signals.has("writing-mode")) {
30454
30565
  return {
30455
30566
  value: "horizontal-tb",
30456
- certainty: "resolved"
30567
+ certainty: 0 /* Resolved */
30457
30568
  };
30458
30569
  }
30459
30570
  const writingMode = readNormalizedSignalEvidence(snapshot, "writing-mode");
@@ -30478,7 +30589,7 @@ function resolveInlineDirection(snapshot) {
30478
30589
  if (!snapshot.signals.has("direction")) {
30479
30590
  return {
30480
30591
  value: "ltr",
30481
- certainty: "resolved"
30592
+ certainty: 0 /* Resolved */
30482
30593
  };
30483
30594
  }
30484
30595
  const direction = readNormalizedSignalEvidence(snapshot, "direction");
@@ -30494,16 +30605,16 @@ function resolveInlineDirection(snapshot) {
30494
30605
  };
30495
30606
  }
30496
30607
  function toContextCertainty(kind) {
30497
- if (kind === "exact") return "resolved";
30498
- if (kind === "interval" || kind === "conditional") return "conditional";
30499
- return "unknown";
30608
+ if (kind === 0 /* Exact */) return 0 /* Resolved */;
30609
+ if (kind === 1 /* Interval */ || kind === 2 /* Conditional */) return 1 /* Conditional */;
30610
+ return 2 /* Unknown */;
30500
30611
  }
30501
30612
  function resolvePositionedOffset(snapshot) {
30502
30613
  const position = readKnownSignalWithGuard(snapshot, "position");
30503
30614
  if (!position) {
30504
30615
  return {
30505
30616
  hasPositionedOffset: false,
30506
- certainty: "unknown"
30617
+ certainty: 2 /* Unknown */
30507
30618
  };
30508
30619
  }
30509
30620
  const certainty = resolveSignalCertainty(position);
@@ -30518,15 +30629,33 @@ function resolvePositionedOffset(snapshot) {
30518
30629
  certainty
30519
30630
  };
30520
30631
  }
30632
+ var FLEX_ROW_VALUES = /* @__PURE__ */ new Set(["row", "row-reverse"]);
30633
+ function resolveCrossAxisIsBlockAxis(kind, snapshot, _axis) {
30634
+ if (kind !== "flex-cross-axis" && kind !== "grid-cross-axis") {
30635
+ return { value: true, certainty: 0 /* Resolved */ };
30636
+ }
30637
+ if (kind === "flex-cross-axis") {
30638
+ const signal2 = readKnownSignalWithGuard(snapshot, "flex-direction");
30639
+ if (!signal2) {
30640
+ return { value: true, certainty: 0 /* Resolved */ };
30641
+ }
30642
+ const certainty2 = resolveSignalCertainty(signal2);
30643
+ return { value: FLEX_ROW_VALUES.has(signal2.normalized), certainty: certainty2 };
30644
+ }
30645
+ const signal = readKnownSignalWithGuard(snapshot, "grid-auto-flow");
30646
+ if (!signal) {
30647
+ return { value: true, certainty: 0 /* Resolved */ };
30648
+ }
30649
+ const certainty = resolveSignalCertainty(signal);
30650
+ return { value: !signal.normalized.startsWith("column"), certainty };
30651
+ }
30521
30652
  function resolveSignalCertainty(value2) {
30522
- if (!value2) return "unknown";
30523
- if (value2.guard === "conditional") return "conditional";
30524
- return "resolved";
30653
+ if (!value2) return 2 /* Unknown */;
30654
+ if (value2.guard.kind === 1 /* Conditional */) return 1 /* Conditional */;
30655
+ return 0 /* Resolved */;
30525
30656
  }
30526
30657
  function combineCertainty(left, right) {
30527
- if (left === "unknown" || right === "unknown") return "unknown";
30528
- if (left === "conditional" || right === "conditional") return "conditional";
30529
- return "resolved";
30658
+ return left > right ? left : right;
30530
30659
  }
30531
30660
  var FLEX_GRID_GEOMETRIC_ALIGN_ITEMS = /* @__PURE__ */ new Set([
30532
30661
  "center",
@@ -30565,24 +30694,7 @@ function finalizeTableCellBaselineRelevance(contextByParentNode, cohortVerticalA
30565
30694
  if (context.kind !== "table-cell") continue;
30566
30695
  if (consensusValue === null) continue;
30567
30696
  if (!TABLE_CELL_GEOMETRIC_VERTICAL_ALIGN.has(consensusValue)) continue;
30568
- contextByParentNode.set(parent, {
30569
- kind: context.kind,
30570
- certainty: context.certainty,
30571
- parentSolidFile: context.parentSolidFile,
30572
- parentElementId: context.parentElementId,
30573
- parentElementKey: context.parentElementKey,
30574
- parentTag: context.parentTag,
30575
- axis: context.axis,
30576
- axisCertainty: context.axisCertainty,
30577
- inlineDirection: context.inlineDirection,
30578
- inlineDirectionCertainty: context.inlineDirectionCertainty,
30579
- parentDisplay: context.parentDisplay,
30580
- parentAlignItems: context.parentAlignItems,
30581
- parentPlaceItems: context.parentPlaceItems,
30582
- hasPositionedOffset: context.hasPositionedOffset,
30583
- baselineRelevance: "irrelevant",
30584
- evidence: context.evidence
30585
- });
30697
+ contextByParentNode.set(parent, deriveAlignmentContext(context, { baselineRelevance: "irrelevant" }));
30586
30698
  }
30587
30699
  }
30588
30700
 
@@ -31129,6 +31241,20 @@ function collectTransitiveCSSScope(entryPath, resolver, cssFilesByNormalizedPath
31129
31241
  }
31130
31242
 
31131
31243
  // src/cross-file/layout/perf.ts
31244
+ function createReservoir(capacity) {
31245
+ return { buffer: [], count: 0, capacity };
31246
+ }
31247
+ function reservoirPush(r, value2) {
31248
+ r.count++;
31249
+ if (r.buffer.length < r.capacity) {
31250
+ r.buffer.push(value2);
31251
+ return;
31252
+ }
31253
+ const j = Math.floor(Math.random() * r.count);
31254
+ if (j < r.capacity) {
31255
+ r.buffer[j] = value2;
31256
+ }
31257
+ }
31132
31258
  var EMPTY_STATS = {
31133
31259
  elementsScanned: 0,
31134
31260
  selectorCandidatesChecked: 0,
@@ -31185,7 +31311,7 @@ function createLayoutPerfStats() {
31185
31311
  cohortUnimodalFalse: 0,
31186
31312
  factorCoverageSum: 0,
31187
31313
  factorCoverageCount: 0,
31188
- posteriorWidths: [],
31314
+ posteriorWidths: createReservoir(200),
31189
31315
  uncertaintyEscalations: 0,
31190
31316
  signalSnapshotsBuilt: 0,
31191
31317
  signalSnapshotCacheHits: 0,
@@ -31250,14 +31376,12 @@ function maybeLogLayoutPerf(stats, log) {
31250
31376
  `[layout] elements=${view.elementsScanned} candidates=${view.selectorCandidatesChecked} compiledSelectors=${view.compiledSelectorCount} unsupportedSelectors=${view.selectorsRejectedUnsupported} conditionalSelectors=${view.selectorsGuardedConditional} ancestryChecks=${view.ancestryChecks} edges=${view.matchEdgesCreated} collected=${view.casesCollected} cases=${view.casesScored} rejectLowEvidence=${view.casesRejectedLowEvidence} rejectThreshold=${view.casesRejectedThreshold} rejectUndecidable=${view.casesRejectedUndecidable} rejectIdentifiability=${view.casesRejectedIdentifiability} undecidableInterval=${view.undecidableInterval} conditionalSignalRatio=${Math.round(view.conditionalSignalRatio * 1e3) / 1e3} conditionalSignals=${view.conditionalSignals} totalSignals=${view.totalSignals} cohortUnimodalFalse=${view.cohortUnimodalFalse} factorCoverageMean=${Math.round(view.factorCoverageMean * 1e3) / 1e3} posteriorWidthP95=${Math.round(view.posteriorWidthP95 * 1e3) / 1e3} uncertaintyEscalations=${view.uncertaintyEscalations} snapshots=${view.signalSnapshotsBuilt} snapshotHits=${view.signalSnapshotCacheHits} measurementIndexHits=${view.measurementIndexHits} contexts=${view.contextsClassified} diagnostics=${view.diagnosticsEmitted} selectorIndexMs=${Math.round(view.selectorIndexMs * 100) / 100} selectorMatchMs=${Math.round(view.selectorMatchMs * 100) / 100} cascadeBuildMs=${Math.round(view.cascadeBuildMs * 100) / 100} caseBuildMs=${Math.round(view.caseBuildMs * 100) / 100} scoringMs=${Math.round(view.scoringMs * 100) / 100} elapsedMs=${Math.round(view.elapsedMs * 100) / 100}`
31251
31377
  );
31252
31378
  }
31253
- function computeP95(values) {
31254
- if (values.length === 0) return 0;
31255
- const sorted = [...values];
31256
- sorted.sort((left, right) => left - right);
31257
- const index = Math.ceil(sorted.length * 0.95) - 1;
31258
- if (index <= 0) return sorted[0] ?? 0;
31259
- if (index >= sorted.length) return sorted[sorted.length - 1] ?? 0;
31260
- return sorted[index] ?? 0;
31379
+ function computeP95(sampler) {
31380
+ if (sampler.buffer.length === 0) return 0;
31381
+ const scratch = [...sampler.buffer];
31382
+ const index = Math.ceil(scratch.length * 0.95) - 1;
31383
+ const clamped = index <= 0 ? 0 : index >= scratch.length ? scratch.length - 1 : index;
31384
+ return selectKth(scratch, clamped);
31261
31385
  }
31262
31386
 
31263
31387
  // src/cross-file/layout/component-host.ts
@@ -33276,16 +33400,16 @@ function includesAttributeWord(value2, word) {
33276
33400
 
33277
33401
  // src/cross-file/layout/guard-model.ts
33278
33402
  var UNCONDITIONAL_GUARD = {
33279
- kind: "unconditional",
33403
+ kind: 0 /* Unconditional */,
33280
33404
  conditions: [],
33281
33405
  key: "always"
33282
33406
  };
33283
- var WHITESPACE_RE4 = /\s+/g;
33407
+ var WHITESPACE_RE_GLOBAL = /\s+/g;
33284
33408
  function resolveRuleGuard(rule) {
33285
33409
  const conditions = collectRuleConditions(rule);
33286
33410
  if (conditions.length === 0) return UNCONDITIONAL_GUARD;
33287
33411
  return {
33288
- kind: "conditional",
33412
+ kind: 1 /* Conditional */,
33289
33413
  conditions,
33290
33414
  key: conditions.map((condition) => condition.key).join("&")
33291
33415
  };
@@ -33339,7 +33463,7 @@ function buildCondition(kind, query) {
33339
33463
  }
33340
33464
  function normalizeQuery(query) {
33341
33465
  if (query === null) return null;
33342
- const normalized = query.trim().toLowerCase().replace(WHITESPACE_RE4, " ");
33466
+ const normalized = query.trim().toLowerCase().replace(WHITESPACE_RE_GLOBAL, " ");
33343
33467
  if (normalized.length === 0) return null;
33344
33468
  return normalized;
33345
33469
  }
@@ -33409,7 +33533,7 @@ function summarizeSignalFacts(snapshots) {
33409
33533
  }
33410
33534
  function accumulateSnapshotFacts(snapshot, sink) {
33411
33535
  for (const value2 of snapshot.signals.values()) {
33412
- if (value2.guard === "conditional") {
33536
+ if (value2.guard.kind === 1 /* Conditional */) {
33413
33537
  sink.addConditional();
33414
33538
  continue;
33415
33539
  }
@@ -33603,15 +33727,6 @@ function assertUnitInterval(name, value2) {
33603
33727
  }
33604
33728
 
33605
33729
  // src/cross-file/layout/content-composition.ts
33606
- var INTRINSIC_REPLACED_TAGS = /* @__PURE__ */ new Set([
33607
- "img",
33608
- "svg",
33609
- "video",
33610
- "canvas",
33611
- "iframe",
33612
- "object",
33613
- "embed"
33614
- ]);
33615
33730
  var BLOCK_FORMATTING_CONTEXT_DISPLAYS = /* @__PURE__ */ new Set([
33616
33731
  "block",
33617
33732
  "flex",
@@ -33645,7 +33760,7 @@ var VERTICAL_ALIGN_MITIGATIONS = /* @__PURE__ */ new Set([
33645
33760
  "text-top",
33646
33761
  "text-bottom"
33647
33762
  ]);
33648
- function computeContentCompositionFingerprint(elementNode, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByElementKey) {
33763
+ function computeContentCompositionFingerprint(elementNode, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByNode) {
33649
33764
  const state = {
33650
33765
  hasTextContent: false,
33651
33766
  hasInlineReplaced: false,
@@ -33659,10 +33774,10 @@ function computeContentCompositionFingerprint(elementNode, childrenByParentNode,
33659
33774
  blockChildCount: 0,
33660
33775
  inlineChildCount: 0
33661
33776
  };
33662
- if (elementNode.textualContent === "yes" || elementNode.textualContent === "dynamic-text") {
33777
+ if (elementNode.textualContent === 0 /* Yes */ || elementNode.textualContent === 3 /* DynamicText */) {
33663
33778
  state.hasTextContent = true;
33664
33779
  }
33665
- const elementHotSignals = snapshotHotSignalsByElementKey.get(elementNode.key);
33780
+ const elementHotSignals = snapshotHotSignalsByNode.get(elementNode);
33666
33781
  const elementDisplay = elementHotSignals?.display.value ?? null;
33667
33782
  if (elementDisplay !== null && establishesFormattingContext(elementDisplay)) {
33668
33783
  return {
@@ -33673,7 +33788,7 @@ function computeContentCompositionFingerprint(elementNode, childrenByParentNode,
33673
33788
  wrappingContextMitigates: false,
33674
33789
  hasVerticalAlignMitigation: false,
33675
33790
  mixedContentDepth: 0,
33676
- classification: "block-segmented",
33791
+ classification: 4 /* BlockSegmented */,
33677
33792
  analyzableChildCount: 0,
33678
33793
  totalChildCount: 0,
33679
33794
  hasOnlyBlockChildren: false
@@ -33683,7 +33798,7 @@ function computeContentCompositionFingerprint(elementNode, childrenByParentNode,
33683
33798
  elementNode,
33684
33799
  childrenByParentNode,
33685
33800
  snapshotByElementNode,
33686
- snapshotHotSignalsByElementKey,
33801
+ snapshotHotSignalsByNode,
33687
33802
  state,
33688
33803
  0
33689
33804
  );
@@ -33703,7 +33818,7 @@ function computeContentCompositionFingerprint(elementNode, childrenByParentNode,
33703
33818
  hasOnlyBlockChildren
33704
33819
  };
33705
33820
  }
33706
- function walkInlineDescendants(node, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByElementKey, state, depth) {
33821
+ function walkInlineDescendants(node, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByNode, state, depth) {
33707
33822
  const children = childrenByParentNode.get(node);
33708
33823
  if (!children) return;
33709
33824
  for (let i = 0; i < children.length; i++) {
@@ -33714,7 +33829,7 @@ function walkInlineDescendants(node, childrenByParentNode, snapshotByElementNode
33714
33829
  if (!snapshot) continue;
33715
33830
  if (depth === 0) state.analyzableChildCount++;
33716
33831
  const childTag = child.tagName?.toLowerCase() ?? null;
33717
- const hotSignals = snapshotHotSignalsByElementKey.get(child.key);
33832
+ const hotSignals = snapshotHotSignalsByNode.get(child);
33718
33833
  const childDisplay = hotSignals?.display.value ?? null;
33719
33834
  if (childTag !== null && (isIntrinsicReplacedTag(childTag) || isControlReplacedTag(childTag))) {
33720
33835
  state.hasInlineReplaced = true;
@@ -33736,16 +33851,16 @@ function walkInlineDescendants(node, childrenByParentNode, snapshotByElementNode
33736
33851
  checkVerticalAlignMitigation(snapshot, state);
33737
33852
  updateMixedContentDepth(state, depth);
33738
33853
  if (depth === 0) state.inlineChildCount++;
33739
- const parentHotSignals = snapshotHotSignalsByElementKey.get(node.key);
33854
+ const parentHotSignals = snapshotHotSignalsByNode.get(node);
33740
33855
  const parentDisplay = parentHotSignals?.display.value ?? null;
33741
33856
  if (parentDisplay !== null && isAlignmentContextWithNonBaselineAlignment(parentDisplay, parentHotSignals)) {
33742
33857
  state.wrappingContextMitigates = true;
33743
- } else if (isAlignmentContextWithNonBaselineAlignment(childDisplay, hotSignals) && containsMixedContent(child, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByElementKey)) {
33858
+ } else if (isAlignmentContextWithNonBaselineAlignment(childDisplay, hotSignals) && containsMixedContent(child, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByNode)) {
33744
33859
  state.wrappingContextMitigates = true;
33745
33860
  }
33746
33861
  continue;
33747
33862
  }
33748
- if (child.textualContent === "yes" || child.textualContent === "dynamic-text") {
33863
+ if (child.textualContent === 0 /* Yes */ || child.textualContent === 3 /* DynamicText */) {
33749
33864
  state.hasTextContent = true;
33750
33865
  }
33751
33866
  checkHeightContributions(snapshot, state);
@@ -33755,7 +33870,7 @@ function walkInlineDescendants(node, childrenByParentNode, snapshotByElementNode
33755
33870
  child,
33756
33871
  childrenByParentNode,
33757
33872
  snapshotByElementNode,
33758
- snapshotHotSignalsByElementKey,
33873
+ snapshotHotSignalsByNode,
33759
33874
  state,
33760
33875
  depth + 1
33761
33876
  );
@@ -33790,19 +33905,19 @@ function isAlignmentContextWithNonBaselineAlignment(display, hotSignals) {
33790
33905
  if (alignItems === null) return false;
33791
33906
  return alignItems !== "baseline";
33792
33907
  }
33793
- function containsMixedContent(node, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByElementKey) {
33794
- const hasText = node.textualContent === "yes" || node.textualContent === "dynamic-text";
33908
+ function containsMixedContent(node, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByNode) {
33909
+ const hasText = node.textualContent === 0 /* Yes */ || node.textualContent === 3 /* DynamicText */;
33795
33910
  const hasReplaced = false;
33796
- return scanMixedContent(node, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByElementKey, { hasText, hasReplaced });
33911
+ return scanMixedContent(node, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByNode, { hasText, hasReplaced });
33797
33912
  }
33798
- function scanMixedContent(node, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByElementKey, found) {
33913
+ function scanMixedContent(node, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByNode, found) {
33799
33914
  const children = childrenByParentNode.get(node);
33800
33915
  if (!children) return false;
33801
33916
  for (let i = 0; i < children.length; i++) {
33802
33917
  const child = children[i];
33803
33918
  if (!child) continue;
33804
33919
  const childTag = child.tagName?.toLowerCase() ?? null;
33805
- const hotSignals = snapshotHotSignalsByElementKey.get(child.key);
33920
+ const hotSignals = snapshotHotSignalsByNode.get(child);
33806
33921
  const childDisplay = hotSignals?.display.value ?? null;
33807
33922
  if (childTag !== null && (isIntrinsicReplacedTag(childTag) || isControlReplacedTag(childTag))) {
33808
33923
  found.hasReplaced = true;
@@ -33817,12 +33932,12 @@ function scanMixedContent(node, childrenByParentNode, snapshotByElementNode, sna
33817
33932
  if (found.hasText) return true;
33818
33933
  continue;
33819
33934
  }
33820
- if (child.textualContent === "yes" || child.textualContent === "dynamic-text") {
33935
+ if (child.textualContent === 0 /* Yes */ || child.textualContent === 3 /* DynamicText */) {
33821
33936
  found.hasText = true;
33822
33937
  if (found.hasReplaced) return true;
33823
33938
  }
33824
33939
  if (childDisplay === null || isInlineContinuationDisplay(childDisplay)) {
33825
- if (scanMixedContent(child, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByElementKey, found)) {
33940
+ if (scanMixedContent(child, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByNode, found)) {
33826
33941
  return true;
33827
33942
  }
33828
33943
  }
@@ -33845,30 +33960,30 @@ function updateMixedContentDepth(state, depth) {
33845
33960
  }
33846
33961
  function classifyFromState(state, elementNode, hasOnlyBlockChildren) {
33847
33962
  if (hasOnlyBlockChildren) {
33848
- return "block-segmented";
33963
+ return 4 /* BlockSegmented */;
33849
33964
  }
33850
33965
  if (state.totalChildCount === 0 && !state.hasTextContent) {
33851
- if (elementNode.textualContent === "unknown") return "unknown";
33852
- if (elementNode.textualContent === "yes" || elementNode.textualContent === "dynamic-text") {
33853
- return "text-only";
33966
+ if (elementNode.textualContent === 2 /* Unknown */) return 5 /* Unknown */;
33967
+ if (elementNode.textualContent === 0 /* Yes */ || elementNode.textualContent === 3 /* DynamicText */) {
33968
+ return 0 /* TextOnly */;
33854
33969
  }
33855
- return "unknown";
33970
+ return 5 /* Unknown */;
33856
33971
  }
33857
33972
  if (state.analyzableChildCount === 0 && state.totalChildCount > 0) {
33858
- return "unknown";
33973
+ return 5 /* Unknown */;
33859
33974
  }
33860
33975
  if (state.hasTextContent && state.hasInlineReplaced) {
33861
- if (state.wrappingContextMitigates) return "mixed-mitigated";
33862
- if (state.hasVerticalAlignMitigation) return "mixed-mitigated";
33863
- return "mixed-unmitigated";
33976
+ if (state.wrappingContextMitigates) return 3 /* MixedMitigated */;
33977
+ if (state.hasVerticalAlignMitigation) return 3 /* MixedMitigated */;
33978
+ return 2 /* MixedUnmitigated */;
33864
33979
  }
33865
33980
  if (!state.hasTextContent && state.hasInlineReplaced) {
33866
- return "replaced-only";
33981
+ return 1 /* ReplacedOnly */;
33867
33982
  }
33868
33983
  if (state.hasTextContent && !state.hasInlineReplaced) {
33869
- return "text-only";
33984
+ return 0 /* TextOnly */;
33870
33985
  }
33871
- return "unknown";
33986
+ return 5 /* Unknown */;
33872
33987
  }
33873
33988
  function isIntrinsicReplacedTag(tag) {
33874
33989
  return INTRINSIC_REPLACED_TAGS.has(tag);
@@ -33888,10 +34003,14 @@ function isInlineReplacedDisplay(display) {
33888
34003
  function isInlineContinuationDisplay(display) {
33889
34004
  return INLINE_CONTINUATION_DISPLAYS.has(display);
33890
34005
  }
33891
- function resolveCompositionDivergenceStrength(subjectFingerprint, allFingerprints, parentContext) {
33892
- if (allFingerprints.length < 2) return 0;
34006
+ var NO_DIVERGENCE = Object.freeze({
34007
+ strength: 0,
34008
+ majorityClassification: 5 /* Unknown */
34009
+ });
34010
+ function resolveCompositionDivergence(subjectFingerprint, allFingerprints, parentContext) {
34011
+ if (allFingerprints.length < 2) return NO_DIVERGENCE;
33893
34012
  if (parentContext !== null && !hasSharedBaselineAlignment(parentContext)) {
33894
- return 0;
34013
+ return NO_DIVERGENCE;
33895
34014
  }
33896
34015
  const countByClassification = /* @__PURE__ */ new Map();
33897
34016
  for (let i = 0; i < allFingerprints.length; i++) {
@@ -33903,10 +34022,7 @@ function resolveCompositionDivergenceStrength(subjectFingerprint, allFingerprint
33903
34022
  }
33904
34023
  const subjectNormalized = normalizeClassificationForComparison(subjectFingerprint.classification);
33905
34024
  const subjectCount = countByClassification.get(subjectNormalized) ?? 0;
33906
- if (subjectCount === allFingerprints.length) {
33907
- return resolveInlineReplacedKindDivergence(subjectFingerprint, allFingerprints);
33908
- }
33909
- let majorityClassification = "unknown";
34025
+ let majorityClassification = 5 /* Unknown */;
33910
34026
  let majorityCount = 0;
33911
34027
  for (const [classification, count] of countByClassification) {
33912
34028
  if (count > majorityCount) {
@@ -33914,35 +34030,38 @@ function resolveCompositionDivergenceStrength(subjectFingerprint, allFingerprint
33914
34030
  majorityClassification = classification;
33915
34031
  }
33916
34032
  }
34033
+ if (subjectCount === allFingerprints.length) {
34034
+ return { strength: resolveInlineReplacedKindDivergence(subjectFingerprint, allFingerprints), majorityClassification };
34035
+ }
33917
34036
  if (subjectNormalized === majorityClassification) {
33918
- return resolveInlineReplacedKindDivergence(subjectFingerprint, allFingerprints);
34037
+ return { strength: resolveInlineReplacedKindDivergence(subjectFingerprint, allFingerprints), majorityClassification };
33919
34038
  }
33920
- if (subjectNormalized === "unknown") {
33921
- return 0;
34039
+ if (subjectNormalized === 5 /* Unknown */) {
34040
+ return { strength: 0, majorityClassification };
33922
34041
  }
33923
34042
  const cal = alignmentStrengthCalibration;
33924
- if (majorityClassification === "text-only" && subjectNormalized === "mixed-unmitigated") {
33925
- return cal.compositionMixedUnmitigatedOutlierStrength;
34043
+ if (majorityClassification === 0 /* TextOnly */ && subjectNormalized === 2 /* MixedUnmitigated */) {
34044
+ return { strength: cal.compositionMixedUnmitigatedOutlierStrength, majorityClassification };
33926
34045
  }
33927
- if (majorityClassification === "replaced-only" && subjectNormalized === "mixed-unmitigated") {
33928
- return cal.compositionMixedOutlierAmongReplacedStrength;
34046
+ if (majorityClassification === 1 /* ReplacedOnly */ && subjectNormalized === 2 /* MixedUnmitigated */) {
34047
+ return { strength: cal.compositionMixedOutlierAmongReplacedStrength, majorityClassification };
33929
34048
  }
33930
- if (majorityClassification === "mixed-unmitigated" && subjectNormalized === "text-only") {
33931
- return cal.compositionTextOutlierAmongMixedStrength;
34049
+ if (majorityClassification === 2 /* MixedUnmitigated */ && subjectNormalized === 0 /* TextOnly */) {
34050
+ return { strength: cal.compositionTextOutlierAmongMixedStrength, majorityClassification };
33932
34051
  }
33933
- if (majorityClassification === "mixed-unmitigated" && subjectNormalized === "replaced-only") {
33934
- return cal.compositionTextOutlierAmongMixedStrength;
34052
+ if (majorityClassification === 2 /* MixedUnmitigated */ && subjectNormalized === 1 /* ReplacedOnly */) {
34053
+ return { strength: cal.compositionTextOutlierAmongMixedStrength, majorityClassification };
33935
34054
  }
33936
- if (majorityClassification === "text-only" && subjectNormalized === "replaced-only") {
33937
- return cal.compositionMixedOutlierAmongReplacedStrength;
34055
+ if (majorityClassification === 0 /* TextOnly */ && subjectNormalized === 1 /* ReplacedOnly */) {
34056
+ return { strength: cal.compositionMixedOutlierAmongReplacedStrength, majorityClassification };
33938
34057
  }
33939
- if (majorityClassification === "replaced-only" && subjectNormalized === "text-only") {
33940
- return cal.compositionTextOutlierAmongMixedStrength;
34058
+ if (majorityClassification === 1 /* ReplacedOnly */ && subjectNormalized === 0 /* TextOnly */) {
34059
+ return { strength: cal.compositionTextOutlierAmongMixedStrength, majorityClassification };
33941
34060
  }
33942
- if (majorityClassification === "unknown") {
33943
- return 0;
34061
+ if (majorityClassification === 5 /* Unknown */) {
34062
+ return { strength: 0, majorityClassification };
33944
34063
  }
33945
- return cal.compositionUnknownPenalty;
34064
+ return { strength: cal.compositionUnknownPenalty, majorityClassification };
33946
34065
  }
33947
34066
  function resolveInlineReplacedKindDivergence(subjectFingerprint, allFingerprints) {
33948
34067
  if (subjectFingerprint.inlineReplacedKind === null) return 0;
@@ -33963,28 +34082,9 @@ function resolveInlineReplacedKindDivergence(subjectFingerprint, allFingerprints
33963
34082
  function hasSharedBaselineAlignment(context) {
33964
34083
  return context.baselineRelevance === "relevant";
33965
34084
  }
33966
- function resolveMajorityClassification(allFingerprints) {
33967
- const countByClassification = /* @__PURE__ */ new Map();
33968
- for (let i = 0; i < allFingerprints.length; i++) {
33969
- const fp = allFingerprints[i];
33970
- if (!fp) continue;
33971
- const normalized = normalizeClassificationForComparison(fp.classification);
33972
- const existing = countByClassification.get(normalized) ?? 0;
33973
- countByClassification.set(normalized, existing + 1);
33974
- }
33975
- let majorityClassification = "unknown";
33976
- let majorityCount = 0;
33977
- for (const [classification, count] of countByClassification) {
33978
- if (count > majorityCount) {
33979
- majorityCount = count;
33980
- majorityClassification = classification;
33981
- }
33982
- }
33983
- return majorityClassification;
33984
- }
33985
34085
  function normalizeClassificationForComparison(classification) {
33986
- if (classification === "mixed-mitigated") return "text-only";
33987
- if (classification === "block-segmented") return "text-only";
34086
+ if (classification === 3 /* MixedMitigated */) return 0 /* TextOnly */;
34087
+ if (classification === 4 /* BlockSegmented */) return 0 /* TextOnly */;
33988
34088
  return classification;
33989
34089
  }
33990
34090
  function resolveCompositionCoverage(subjectFingerprint, allFingerprints) {
@@ -33992,12 +34092,12 @@ function resolveCompositionCoverage(subjectFingerprint, allFingerprints) {
33992
34092
  let analyzableCount = 0;
33993
34093
  for (let i = 0; i < allFingerprints.length; i++) {
33994
34094
  const fp = allFingerprints[i];
33995
- if (fp && fp.classification !== "unknown") {
34095
+ if (fp && fp.classification !== 5 /* Unknown */) {
33996
34096
  analyzableCount++;
33997
34097
  }
33998
34098
  }
33999
34099
  const analyzableShare = analyzableCount / allFingerprints.length;
34000
- if (subjectFingerprint.classification === "unknown") {
34100
+ if (subjectFingerprint.classification === 5 /* Unknown */) {
34001
34101
  return analyzableShare * 0.3;
34002
34102
  }
34003
34103
  if (subjectFingerprint.totalChildCount > 0 && subjectFingerprint.analyzableChildCount === 0) {
@@ -34005,24 +34105,19 @@ function resolveCompositionCoverage(subjectFingerprint, allFingerprints) {
34005
34105
  }
34006
34106
  return analyzableShare;
34007
34107
  }
34108
+ var COMPOSITION_LABELS = {
34109
+ [0 /* TextOnly */]: "text-only",
34110
+ [1 /* ReplacedOnly */]: "inline-replaced-only",
34111
+ [2 /* MixedUnmitigated */]: "mixed text + inline-replaced",
34112
+ [3 /* MixedMitigated */]: "mixed (alignment mitigated)",
34113
+ [4 /* BlockSegmented */]: "block-segmented",
34114
+ [5 /* Unknown */]: "unknown"
34115
+ };
34008
34116
  function formatCompositionClassification(classification) {
34009
- switch (classification) {
34010
- case "text-only":
34011
- return "text-only";
34012
- case "replaced-only":
34013
- return "inline-replaced-only";
34014
- case "mixed-unmitigated":
34015
- return "mixed text + inline-replaced";
34016
- case "mixed-mitigated":
34017
- return "mixed (alignment mitigated)";
34018
- case "block-segmented":
34019
- return "block-segmented";
34020
- case "unknown":
34021
- return "unknown";
34022
- }
34117
+ return COMPOSITION_LABELS[classification];
34023
34118
  }
34024
34119
  function formatCompositionFixSuggestion(subjectFingerprint) {
34025
- if (subjectFingerprint.classification === "mixed-unmitigated") {
34120
+ if (subjectFingerprint.classification === 2 /* MixedUnmitigated */) {
34026
34121
  if (subjectFingerprint.hasVerticalAlignMitigation) {
34027
34122
  return "verify vertical-align resolves the baseline shift";
34028
34123
  }
@@ -34057,12 +34152,12 @@ function estimateBlockOffsetWithDeclaredFromHotSignals(hot, axis) {
34057
34152
  function estimateBlockOffsetWithDeclaredFromSources(axis, position, readNumeric) {
34058
34153
  let declaredTotal = 0;
34059
34154
  let declaredCount = 0;
34060
- let declaredKind = "exact";
34061
- let declaredMissingKind = "exact";
34155
+ let declaredKind = 0 /* Exact */;
34156
+ let declaredMissingKind = 0 /* Exact */;
34062
34157
  let effectiveTotal = 0;
34063
34158
  let effectiveCount = 0;
34064
- let effectiveKind = "exact";
34065
- let effectiveMissingKind = "exact";
34159
+ let effectiveKind = 0 /* Exact */;
34160
+ let effectiveMissingKind = 0 /* Exact */;
34066
34161
  const positioned = position.value !== null && position.value !== "static";
34067
34162
  const add = (name, sign, requiresPositioning) => {
34068
34163
  const v = readNumeric(name);
@@ -34133,7 +34228,7 @@ function buildCohortIndex(input) {
34133
34228
  axisCertainty: context.axisCertainty,
34134
34229
  measurementNodeByRootKey: input.measurementNodeByRootKey,
34135
34230
  snapshotByElementNode: input.snapshotByElementNode,
34136
- snapshotHotSignalsByElementKey: input.snapshotHotSignalsByElementKey
34231
+ snapshotHotSignalsByNode: input.snapshotHotSignalsByNode
34137
34232
  });
34138
34233
  measurementIndexHits += cohortMetricsResult.measurementHits;
34139
34234
  const metrics = cohortMetricsResult.metrics;
@@ -34167,7 +34262,7 @@ function buildCohortIndex(input) {
34167
34262
  subjectMetrics.rootNode,
34168
34263
  input.childrenByParentNode,
34169
34264
  input.snapshotByElementNode,
34170
- input.snapshotHotSignalsByElementKey
34265
+ input.snapshotHotSignalsByNode
34171
34266
  );
34172
34267
  subjectsByElementKey.set(subjectMetrics.key, {
34173
34268
  element: subjectMetrics.element,
@@ -34233,7 +34328,7 @@ function collectCohortMetrics(input) {
34233
34328
  if (!snapshot) {
34234
34329
  throw new Error(`missing snapshot for measurement node ${measurementNode.key}`);
34235
34330
  }
34236
- const hotSignals = input.snapshotHotSignalsByElementKey.get(measurementNode.key);
34331
+ const hotSignals = input.snapshotHotSignalsByNode.get(measurementNode);
34237
34332
  if (!hotSignals) {
34238
34333
  throw new Error(`missing hot signals for measurement node ${measurementNode.key}`);
34239
34334
  }
@@ -34558,9 +34653,9 @@ function buildCohortSignalIndex(metrics) {
34558
34653
  const verticalAlignCounts = /* @__PURE__ */ new Map();
34559
34654
  const alignSelfCounts = /* @__PURE__ */ new Map();
34560
34655
  const placeSelfCounts = /* @__PURE__ */ new Map();
34561
- let verticalAlignMergedKind = "exact";
34562
- let alignSelfMergedKind = "exact";
34563
- let placeSelfMergedKind = "exact";
34656
+ let verticalAlignMergedKind = 0 /* Exact */;
34657
+ let alignSelfMergedKind = 0 /* Exact */;
34658
+ let placeSelfMergedKind = 0 /* Exact */;
34564
34659
  let verticalAlignComparableCount = 0;
34565
34660
  let alignSelfComparableCount = 0;
34566
34661
  let placeSelfComparableCount = 0;
@@ -34574,12 +34669,12 @@ function buildCohortSignalIndex(metrics) {
34574
34669
  const snapshot = metric.element.snapshot;
34575
34670
  const alignSelf = metric.hotSignals.alignSelf;
34576
34671
  const placeSelf = metric.hotSignals.placeSelf;
34577
- const isControlOrReplaced = snapshot.isControl || snapshot.isReplaced;
34672
+ const isControlOrReplaced = snapshot.node.isControl || snapshot.node.isReplaced;
34578
34673
  const verticalAlign = resolveComparableVerticalAlign(metric.hotSignals.verticalAlign, isControlOrReplaced);
34579
34674
  if (isControlOrReplaced) controlOrReplacedCount++;
34580
- if (snapshot.textualContent === "yes" || snapshot.textualContent === "dynamic-text") textYesCount++;
34581
- if (snapshot.textualContent === "no") textNoCount++;
34582
- if (snapshot.textualContent === "unknown") textUnknownCount++;
34675
+ if (snapshot.node.textualContent === 0 /* Yes */ || snapshot.node.textualContent === 3 /* DynamicText */) textYesCount++;
34676
+ if (snapshot.node.textualContent === 1 /* No */) textNoCount++;
34677
+ if (snapshot.node.textualContent === 2 /* Unknown */) textUnknownCount++;
34583
34678
  if (verticalAlign.value !== null) {
34584
34679
  verticalAlignMergedKind = mergeEvidenceKind(verticalAlignMergedKind, verticalAlign.kind);
34585
34680
  verticalAlignComparableCount++;
@@ -34599,24 +34694,24 @@ function buildCohortSignalIndex(metrics) {
34599
34694
  verticalAlign,
34600
34695
  alignSelf,
34601
34696
  placeSelf,
34602
- textualContent: snapshot.textualContent,
34697
+ textualContent: snapshot.node.textualContent,
34603
34698
  isControlOrReplaced
34604
34699
  });
34605
34700
  }
34606
34701
  return {
34607
34702
  byKey,
34608
34703
  verticalAlign: {
34609
- mergedKind: verticalAlignComparableCount === 0 ? "unknown" : verticalAlignMergedKind,
34704
+ mergedKind: verticalAlignComparableCount === 0 ? 3 /* Unknown */ : verticalAlignMergedKind,
34610
34705
  comparableCount: verticalAlignComparableCount,
34611
34706
  countsByValue: verticalAlignCounts
34612
34707
  },
34613
34708
  alignSelf: {
34614
- mergedKind: alignSelfComparableCount === 0 ? "unknown" : alignSelfMergedKind,
34709
+ mergedKind: alignSelfComparableCount === 0 ? 3 /* Unknown */ : alignSelfMergedKind,
34615
34710
  comparableCount: alignSelfComparableCount,
34616
34711
  countsByValue: alignSelfCounts
34617
34712
  },
34618
34713
  placeSelf: {
34619
- mergedKind: placeSelfComparableCount === 0 ? "unknown" : placeSelfMergedKind,
34714
+ mergedKind: placeSelfComparableCount === 0 ? 3 /* Unknown */ : placeSelfMergedKind,
34620
34715
  comparableCount: placeSelfComparableCount,
34621
34716
  countsByValue: placeSelfCounts
34622
34717
  },
@@ -34653,9 +34748,9 @@ function collectSubjectCohortSignals(index, subjectMetrics, context) {
34653
34748
  sawComparableVerticalAlign,
34654
34749
  sawVerticalAlignConflict
34655
34750
  );
34656
- const tableCellControlFallback = context.kind === "table-cell" && subject.isControlOrReplaced && verticalAlign.value === "unknown" && index.byKey.size > index.controlOrReplacedCount;
34751
+ const tableCellControlFallback = context.kind === "table-cell" && subject.isControlOrReplaced && verticalAlign.value === 2 /* Unknown */ && index.byKey.size > index.controlOrReplacedCount;
34657
34752
  const normalizedVerticalAlign = tableCellControlFallback ? {
34658
- value: "conflict",
34753
+ value: 0 /* Conflict */,
34659
34754
  kind: verticalAlignKind
34660
34755
  } : verticalAlign;
34661
34756
  const textContrastWithPeers = resolveIndexedTextContrastWithPeers(
@@ -34688,7 +34783,7 @@ function resolveComparableVerticalAlign(verticalAlign, isControlOrReplaced) {
34688
34783
  return {
34689
34784
  present: verticalAlign.present,
34690
34785
  value: "baseline",
34691
- kind: "exact"
34786
+ kind: 0 /* Exact */
34692
34787
  };
34693
34788
  }
34694
34789
  function hasComparablePeer(aggregate, subjectValue) {
@@ -34705,37 +34800,37 @@ function hasConflictPeer(aggregate, subjectValue) {
34705
34800
  function finalizeConflictEvidence(subjectValue, kind, sawComparablePeer, sawConflict) {
34706
34801
  if (subjectValue === null) {
34707
34802
  return {
34708
- value: "unknown",
34803
+ value: 2 /* Unknown */,
34709
34804
  kind
34710
34805
  };
34711
34806
  }
34712
34807
  if (!sawComparablePeer) {
34713
34808
  return {
34714
- value: "unknown",
34809
+ value: 2 /* Unknown */,
34715
34810
  kind
34716
34811
  };
34717
34812
  }
34718
34813
  return {
34719
- value: sawConflict ? "conflict" : "aligned",
34814
+ value: sawConflict ? 0 /* Conflict */ : 1 /* Aligned */,
34720
34815
  kind
34721
34816
  };
34722
34817
  }
34723
34818
  function resolveIndexedTextContrastWithPeers(index, subjectTextualContent, subjectIsControlOrReplaced, tableCellControlFallback) {
34724
- if (subjectTextualContent === "unknown") return "unknown";
34819
+ if (subjectTextualContent === 2 /* Unknown */) return 2 /* Unknown */;
34725
34820
  const unknownPeers = index.textUnknownCount;
34726
34821
  const cohortSize = index.byKey.size;
34727
- if (subjectTextualContent === "yes" || subjectTextualContent === "dynamic-text") {
34728
- if (index.textNoCount > 0) return "different";
34729
- if (unknownPeers > 0) return "unknown";
34730
- return "same";
34822
+ if (subjectTextualContent === 0 /* Yes */ || subjectTextualContent === 3 /* DynamicText */) {
34823
+ if (index.textNoCount > 0) return 0 /* Different */;
34824
+ if (unknownPeers > 0) return 2 /* Unknown */;
34825
+ return 1 /* Same */;
34731
34826
  }
34732
- if (index.textYesCount > 0) return "different";
34733
- if (tableCellControlFallback) return "different";
34827
+ if (index.textYesCount > 0) return 0 /* Different */;
34828
+ if (tableCellControlFallback) return 0 /* Different */;
34734
34829
  if (subjectIsControlOrReplaced && index.controlOrReplacedCount === 1 && cohortSize >= 3 && unknownPeers > 0) {
34735
- return "different";
34830
+ return 0 /* Different */;
34736
34831
  }
34737
- if (unknownPeers > 0) return "unknown";
34738
- return "same";
34832
+ if (unknownPeers > 0) return 2 /* Unknown */;
34833
+ return 1 /* Same */;
34739
34834
  }
34740
34835
  function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineProfile, clusterSummary, signalIndex, cohortKind, cohortSize) {
34741
34836
  const subjectClusterKey = toComparableClusterKey(subjectMetrics);
@@ -34751,7 +34846,7 @@ function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineP
34751
34846
  return {
34752
34847
  dominantShare: profile.dominantClusterShare,
34753
34848
  subjectExcludedDominantShare: subjectBaselineProfile.dominantClusterShare,
34754
- subjectMembership: "insufficient",
34849
+ subjectMembership: 3 /* Insufficient */,
34755
34850
  ambiguous: true,
34756
34851
  kind
34757
34852
  };
@@ -34760,7 +34855,7 @@ function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineP
34760
34855
  return {
34761
34856
  dominantShare: profile.dominantClusterShare,
34762
34857
  subjectExcludedDominantShare: subjectBaselineProfile.dominantClusterShare,
34763
- subjectMembership: "dominant",
34858
+ subjectMembership: 0 /* Dominant */,
34764
34859
  ambiguous: false,
34765
34860
  kind
34766
34861
  };
@@ -34769,7 +34864,7 @@ function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineP
34769
34864
  return {
34770
34865
  dominantShare: profile.dominantClusterShare,
34771
34866
  subjectExcludedDominantShare: subjectBaselineProfile.dominantClusterShare,
34772
- subjectMembership: "insufficient",
34867
+ subjectMembership: 3 /* Insufficient */,
34773
34868
  ambiguous: true,
34774
34869
  kind
34775
34870
  };
@@ -34779,7 +34874,7 @@ function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineP
34779
34874
  return {
34780
34875
  dominantShare: profile.dominantClusterShare,
34781
34876
  subjectExcludedDominantShare: subjectBaselineProfile.dominantClusterShare,
34782
- subjectMembership: "insufficient",
34877
+ subjectMembership: 3 /* Insufficient */,
34783
34878
  ambiguous: true,
34784
34879
  kind
34785
34880
  };
@@ -34789,7 +34884,7 @@ function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineP
34789
34884
  return {
34790
34885
  dominantShare: profile.dominantClusterShare,
34791
34886
  subjectExcludedDominantShare: subjectBaselineProfile.dominantClusterShare,
34792
- subjectMembership: "ambiguous",
34887
+ subjectMembership: 2 /* Ambiguous */,
34793
34888
  ambiguous: true,
34794
34889
  kind
34795
34890
  };
@@ -34798,7 +34893,7 @@ function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineP
34798
34893
  return {
34799
34894
  dominantShare: profile.dominantClusterShare,
34800
34895
  subjectExcludedDominantShare: subjectBaselineProfile.dominantClusterShare,
34801
- subjectMembership: "dominant",
34896
+ subjectMembership: 0 /* Dominant */,
34802
34897
  ambiguous: false,
34803
34898
  kind
34804
34899
  };
@@ -34806,13 +34901,13 @@ function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineP
34806
34901
  return {
34807
34902
  dominantShare: profile.dominantClusterShare,
34808
34903
  subjectExcludedDominantShare: subjectBaselineProfile.dominantClusterShare,
34809
- subjectMembership: "nondominant",
34904
+ subjectMembership: 1 /* Nondominant */,
34810
34905
  ambiguous: false,
34811
34906
  kind
34812
34907
  };
34813
34908
  }
34814
34909
  function resolveControlRoleIdentifiability(subjectMetrics, signalIndex, kind, cohortSize) {
34815
- const subjectIsControlOrReplaced = subjectMetrics.element.snapshot.isControl || subjectMetrics.element.snapshot.isReplaced;
34910
+ const subjectIsControlOrReplaced = subjectMetrics.element.snapshot.node.isControl || subjectMetrics.element.snapshot.node.isReplaced;
34816
34911
  const controlCount = signalIndex.controlOrReplacedCount;
34817
34912
  const nonControlCount = cohortSize - controlCount;
34818
34913
  if (controlCount <= 0 || nonControlCount <= 0) return null;
@@ -34827,12 +34922,12 @@ function resolveControlRoleIdentifiability(subjectMetrics, signalIndex, kind, co
34827
34922
  return {
34828
34923
  dominantShare,
34829
34924
  subjectExcludedDominantShare: excludedDominantShare,
34830
- subjectMembership: subjectMembership === "ambiguous" ? "dominant" : subjectMembership,
34925
+ subjectMembership: subjectMembership === 2 /* Ambiguous */ ? 0 /* Dominant */ : subjectMembership,
34831
34926
  ambiguous: false,
34832
34927
  kind
34833
34928
  };
34834
34929
  }
34835
- if (subjectMembership === "ambiguous") {
34930
+ if (subjectMembership === 2 /* Ambiguous */) {
34836
34931
  return {
34837
34932
  dominantShare,
34838
34933
  subjectExcludedDominantShare: excludedDominantShare,
@@ -34850,9 +34945,9 @@ function resolveControlRoleIdentifiability(subjectMetrics, signalIndex, kind, co
34850
34945
  };
34851
34946
  }
34852
34947
  function resolveRoleMembership(controlCount, nonControlCount, subjectIsControlOrReplaced) {
34853
- if (controlCount === nonControlCount) return "ambiguous";
34948
+ if (controlCount === nonControlCount) return 2 /* Ambiguous */;
34854
34949
  const dominantRoleIsControl = controlCount > nonControlCount;
34855
- return dominantRoleIsControl === subjectIsControlOrReplaced ? "dominant" : "nondominant";
34950
+ return dominantRoleIsControl === subjectIsControlOrReplaced ? 0 /* Dominant */ : 1 /* Nondominant */;
34856
34951
  }
34857
34952
  function resolveExcludedRoleDominantShare(controlCount, nonControlCount, subjectIsControlOrReplaced) {
34858
34953
  const controlAfterExclusion = controlCount - (subjectIsControlOrReplaced ? 1 : 0);
@@ -34890,8 +34985,8 @@ function collectCohortProvenanceFromSnapshots(snapshots) {
34890
34985
  const snapshot = snapshots[i];
34891
34986
  if (!snapshot) continue;
34892
34987
  for (const signal of snapshot.signals.values()) {
34893
- for (let j = 0; j < signal.guardProvenance.conditions.length; j++) {
34894
- const guard = signal.guardProvenance.conditions[j];
34988
+ for (let j = 0; j < signal.guard.conditions.length; j++) {
34989
+ const guard = signal.guard.conditions[j];
34895
34990
  if (!guard) continue;
34896
34991
  if (!byKey.has(guard.key)) byKey.set(guard.key, guard);
34897
34992
  }
@@ -34921,7 +35016,7 @@ function buildGuardKey(guards) {
34921
35016
  return keys.join("&");
34922
35017
  }
34923
35018
  function resolveCohortEvidenceKind(metrics) {
34924
- let kind = "exact";
35019
+ let kind = 0 /* Exact */;
34925
35020
  for (let i = 0; i < metrics.length; i++) {
34926
35021
  const metric = metrics[i];
34927
35022
  if (!metric) continue;
@@ -34938,9 +35033,9 @@ function incrementCount(counts, key) {
34938
35033
  counts.set(key, existing + 1);
34939
35034
  }
34940
35035
  function toEvidenceKind2(certainty) {
34941
- if (certainty === "resolved") return "exact";
34942
- if (certainty === "conditional") return "conditional";
34943
- return "unknown";
35036
+ if (certainty === 0 /* Resolved */) return 0 /* Exact */;
35037
+ if (certainty === 1 /* Conditional */) return 2 /* Conditional */;
35038
+ return 3 /* Unknown */;
34944
35039
  }
34945
35040
  function computeMedian(values) {
34946
35041
  if (values.length === 0) return null;
@@ -34960,66 +35055,6 @@ function computeMedianAbsoluteDeviation(values, median, scratch) {
34960
35055
  }
34961
35056
  return computeMedian(scratch);
34962
35057
  }
34963
- function selectKth(values, targetIndex) {
34964
- let left = 0;
34965
- let right = values.length - 1;
34966
- while (left <= right) {
34967
- if (left === right) {
34968
- const result = values[left];
34969
- if (result === void 0) return 0;
34970
- return result;
34971
- }
34972
- const pivotIndex = choosePivotIndex(values, left, right);
34973
- const partitionIndex = partitionAroundPivot(values, left, right, pivotIndex);
34974
- if (partitionIndex === targetIndex) {
34975
- const result = values[partitionIndex];
34976
- if (result === void 0) return 0;
34977
- return result;
34978
- }
34979
- if (partitionIndex < targetIndex) {
34980
- left = partitionIndex + 1;
34981
- continue;
34982
- }
34983
- right = partitionIndex - 1;
34984
- }
34985
- const fallback = values[targetIndex];
34986
- if (fallback === void 0) return 0;
34987
- return fallback;
34988
- }
34989
- function choosePivotIndex(values, left, right) {
34990
- const middle = Math.floor((left + right) / 2);
34991
- const leftValue = values[left] ?? 0;
34992
- const middleValue = values[middle] ?? 0;
34993
- const rightValue = values[right] ?? 0;
34994
- if (leftValue < middleValue) {
34995
- if (middleValue < rightValue) return middle;
34996
- if (leftValue < rightValue) return right;
34997
- return left;
34998
- }
34999
- if (leftValue < rightValue) return left;
35000
- if (middleValue < rightValue) return right;
35001
- return middle;
35002
- }
35003
- function partitionAroundPivot(values, left, right, pivotIndex) {
35004
- const pivotValue = values[pivotIndex] ?? 0;
35005
- swap(values, pivotIndex, right);
35006
- let storeIndex = left;
35007
- for (let i = left; i < right; i++) {
35008
- const current = values[i];
35009
- if (current === void 0 || current > pivotValue) continue;
35010
- swap(values, storeIndex, i);
35011
- storeIndex++;
35012
- }
35013
- swap(values, storeIndex, right);
35014
- return storeIndex;
35015
- }
35016
- function swap(values, left, right) {
35017
- if (left === right) return;
35018
- const leftValue = values[left] ?? 0;
35019
- const rightValue = values[right] ?? 0;
35020
- values[left] = rightValue;
35021
- values[right] = leftValue;
35022
- }
35023
35058
  function resolveVerticalAlignConsensus(aggregate) {
35024
35059
  if (aggregate.comparableCount === 0) return null;
35025
35060
  if (aggregate.countsByValue.size !== 1) return null;
@@ -35118,7 +35153,7 @@ function resolveMeasurementCandidates(root, childrenByParentNode, snapshotByElem
35118
35153
  if (firstControlOrReplacedDescendant === null && (child.isControl || child.isReplaced)) {
35119
35154
  firstControlOrReplacedDescendant = child;
35120
35155
  }
35121
- if (firstTextualDescendant === null && child.textualContent === "yes") {
35156
+ if (firstTextualDescendant === null && child.textualContent === 0 /* Yes */) {
35122
35157
  firstTextualDescendant = child;
35123
35158
  }
35124
35159
  if (firstControlOrReplacedDescendant !== null && firstTextualDescendant !== null) break;
@@ -35144,7 +35179,7 @@ function resolveMeasurementNode(root, candidates) {
35144
35179
  if (candidates.firstControlOrReplacedDescendant !== null) return candidates.firstControlOrReplacedDescendant;
35145
35180
  if (root.isControl || root.isReplaced) return root;
35146
35181
  if (candidates.firstTextualDescendant !== null) return candidates.firstTextualDescendant;
35147
- if (root.textualContent === "yes") return root;
35182
+ if (root.textualContent === 0 /* Yes */) return root;
35148
35183
  return root;
35149
35184
  }
35150
35185
 
@@ -35191,7 +35226,7 @@ function buildScopedSelectorIndexBySolidFile(cssScopeBySolidFile, css, selectorM
35191
35226
  seenSelectorIds.add(selector.id);
35192
35227
  const metadata = selectorMetadataById.get(selector.id);
35193
35228
  if (!metadata) continue;
35194
- if (metadata.guard.kind === "conditional") {
35229
+ if (metadata.guard.kind === 1 /* Conditional */) {
35195
35230
  if (!conditionalSelectorIds.has(selector.id)) {
35196
35231
  conditionalSelectorIds.add(selector.id);
35197
35232
  perf.selectorsGuardedConditional++;
@@ -35233,7 +35268,7 @@ function buildScopedSelectorIndexBySolidFile(cssScopeBySolidFile, css, selectorM
35233
35268
  }
35234
35269
  return out;
35235
35270
  }
35236
- function buildSelectorCandidatesByElementKey(elements, scopedSelectorsBySolidFile, perf) {
35271
+ function buildSelectorCandidatesByNode(elements, scopedSelectorsBySolidFile, perf) {
35237
35272
  const out = /* @__PURE__ */ new Map();
35238
35273
  for (let i = 0; i < elements.length; i++) {
35239
35274
  const node = elements[i];
@@ -35243,7 +35278,7 @@ function buildSelectorCandidatesByElementKey(elements, scopedSelectorsBySolidFil
35243
35278
  const byTag = node.tagName !== null ? collectSelectorCandidates(scoped.bySubjectTag.get(node.tagName), node.selectorDispatchKeys) : EMPTY_SELECTOR_LIST;
35244
35279
  const withoutTag = collectSelectorCandidates(scoped.withoutSubjectTag, node.selectorDispatchKeys);
35245
35280
  const merged = mergeSelectorCandidateIds(byTag, withoutTag);
35246
- out.set(node.key, merged);
35281
+ out.set(node, merged);
35247
35282
  perf.elementsScanned++;
35248
35283
  perf.selectorCandidatesChecked += merged.length;
35249
35284
  }
@@ -35702,12 +35737,6 @@ var EMPTY_EXPANSION_RESULT = [];
35702
35737
  function collectMonitoredDeclarations(selector, layerOrder, guard) {
35703
35738
  const out = [];
35704
35739
  const declarations = selector.rule.declarations;
35705
- const signalGuard = guard.kind === "conditional" ? "conditional" : "unconditional";
35706
- const guardProvenance = {
35707
- kind: signalGuard,
35708
- conditions: guard.conditions,
35709
- key: guard.key
35710
- };
35711
35740
  for (let i = 0; i < declarations.length; i++) {
35712
35741
  const declaration = declarations[i];
35713
35742
  if (!declaration) continue;
@@ -35718,8 +35747,7 @@ function collectMonitoredDeclarations(selector, layerOrder, guard) {
35718
35747
  out.push({
35719
35748
  property: monitored,
35720
35749
  value: declaration.value,
35721
- guard: signalGuard,
35722
- guardProvenance,
35750
+ guardProvenance: guard,
35723
35751
  position: {
35724
35752
  layer: declaration.cascadePosition.layer,
35725
35753
  layerOrder,
@@ -35741,6 +35769,7 @@ function toMonitoredSignalKey(property) {
35741
35769
  case "margin-block":
35742
35770
  case "padding-block":
35743
35771
  case "inset-block":
35772
+ case "flex-flow":
35744
35773
  return property;
35745
35774
  default:
35746
35775
  return null;
@@ -35764,30 +35793,27 @@ function expandMonitoredDeclarationForDelta(declaration) {
35764
35793
  if (signalName === void 0) return EMPTY_EXPANSION_RESULT;
35765
35794
  return [{ name: signalName, value: value2 }];
35766
35795
  }
35767
- function appendMatchingEdgesFromSelectorIds(selectorIds, node, selectorMetadataById, selectorsById, applies, appliesByElementNodeMutable, perf, rootElementsByFile, logger) {
35768
- const fileRoots = rootElementsByFile.get(node.solidFile) ?? null;
35796
+ function appendMatchingEdgesFromSelectorIds(ctx, selectorIds, node, applies, appliesByElementNodeMutable) {
35797
+ const fileRoots = ctx.rootElementsByFile.get(node.solidFile) ?? null;
35769
35798
  for (let i = 0; i < selectorIds.length; i++) {
35770
35799
  const selectorId = selectorIds[i];
35771
35800
  if (selectorId === void 0) continue;
35772
- const metadata = selectorMetadataById.get(selectorId);
35801
+ const metadata = ctx.selectorMetadataById.get(selectorId);
35773
35802
  if (!metadata || !metadata.matcher) {
35774
35803
  throw new Error(`missing compiled selector matcher for selector ${selectorId}`);
35775
35804
  }
35776
- const selector = selectorsById.get(selectorId);
35805
+ const selector = ctx.selectorsById.get(selectorId);
35777
35806
  if (!selector) {
35778
35807
  throw new Error(`missing selector ${selectorId}`);
35779
35808
  }
35780
- if (!selectorMatchesLayoutElement(metadata.matcher, node, perf, fileRoots, logger)) continue;
35809
+ if (!selectorMatchesLayoutElement(metadata.matcher, node, ctx.perf, fileRoots, ctx.logger)) continue;
35781
35810
  const edge = {
35782
- solidFile: node.solidFile,
35783
- elementId: node.elementId,
35784
- elementKey: node.key,
35785
35811
  selectorId: selector.id,
35786
35812
  specificityScore: selector.specificityScore,
35787
35813
  sourceOrder: selector.rule.sourceOrder
35788
35814
  };
35789
35815
  applies.push(edge);
35790
- perf.matchEdgesCreated++;
35816
+ ctx.perf.matchEdgesCreated++;
35791
35817
  const existing = appliesByElementNodeMutable.get(node);
35792
35818
  if (existing) {
35793
35819
  existing.push(edge);
@@ -35813,7 +35839,7 @@ function augmentCascadeWithTailwind(cascade, node, tailwind) {
35813
35839
  const classTokens = node.classTokens;
35814
35840
  if (classTokens.length === 0) return;
35815
35841
  const guardProvenance = {
35816
- kind: "unconditional",
35842
+ kind: 0 /* Unconditional */,
35817
35843
  conditions: [],
35818
35844
  key: "always"
35819
35845
  };
@@ -35830,8 +35856,7 @@ function augmentCascadeWithTailwind(cascade, node, tailwind) {
35830
35856
  if (cascade.has(property)) continue;
35831
35857
  cascade.set(property, {
35832
35858
  value: value2,
35833
- source: "selector",
35834
- guard: "unconditional",
35859
+ source: 0 /* Selector */,
35835
35860
  guardProvenance
35836
35861
  });
35837
35862
  }
@@ -35851,8 +35876,7 @@ function buildCascadeMapForElement(node, edges, monitoredDeclarationsBySelectorI
35851
35876
  const property = declaration.property;
35852
35877
  const newDeclaration = {
35853
35878
  value: declaration.value,
35854
- source: "selector",
35855
- guard: declaration.guard,
35879
+ source: 0 /* Selector */,
35856
35880
  guardProvenance: declaration.guardProvenance
35857
35881
  };
35858
35882
  const existingPosition = positions.get(property);
@@ -35871,33 +35895,26 @@ function buildCascadeMapForElement(node, edges, monitoredDeclarationsBySelectorI
35871
35895
  positions.set(property, declaration.position);
35872
35896
  }
35873
35897
  }
35874
- const inlinePosition = createInlineCascadePosition();
35875
- const inlineGuardProvenance = {
35876
- kind: "unconditional",
35877
- conditions: [],
35878
- key: "always"
35879
- };
35880
35898
  for (const [property, value2] of node.inlineStyleValues) {
35881
35899
  const newDeclaration = {
35882
35900
  value: value2,
35883
- source: "inline-style",
35884
- guard: "unconditional",
35885
- guardProvenance: inlineGuardProvenance
35901
+ source: 1 /* InlineStyle */,
35902
+ guardProvenance: INLINE_GUARD_PROVENANCE
35886
35903
  };
35887
35904
  const existingPosition = positions.get(property);
35888
35905
  if (existingPosition === void 0) {
35889
35906
  out.set(property, newDeclaration);
35890
- positions.set(property, inlinePosition);
35907
+ positions.set(property, INLINE_CASCADE_POSITION);
35891
35908
  continue;
35892
35909
  }
35893
35910
  const existingDeclaration = out.get(property);
35894
35911
  if (existingDeclaration === void 0) continue;
35895
35912
  if (!doesCandidateOverride(
35896
35913
  { declaration: existingDeclaration, position: existingPosition },
35897
- { declaration: newDeclaration, position: inlinePosition }
35914
+ { declaration: newDeclaration, position: INLINE_CASCADE_POSITION }
35898
35915
  )) continue;
35899
35916
  out.set(property, newDeclaration);
35900
- positions.set(property, inlinePosition);
35917
+ positions.set(property, INLINE_CASCADE_POSITION);
35901
35918
  }
35902
35919
  if (tailwind !== null) {
35903
35920
  augmentCascadeWithTailwind(out, node, tailwind);
@@ -35914,7 +35931,7 @@ function doesCandidateOverride(existing, incoming) {
35914
35931
  const existingSource = existing.declaration.source;
35915
35932
  const incomingSource = incoming.declaration.source;
35916
35933
  if (existingSource !== incomingSource) {
35917
- if (incomingSource === "inline-style") {
35934
+ if (incomingSource === 1 /* InlineStyle */) {
35918
35935
  if (existing.position.isImportant && !incoming.position.isImportant) return false;
35919
35936
  return true;
35920
35937
  }
@@ -35922,16 +35939,19 @@ function doesCandidateOverride(existing, incoming) {
35922
35939
  }
35923
35940
  return compareCascadePositions(incoming.position, existing.position) > 0;
35924
35941
  }
35925
- function createInlineCascadePosition() {
35926
- return {
35927
- layer: null,
35928
- layerOrder: Number.MAX_SAFE_INTEGER,
35929
- sourceOrder: Number.MAX_SAFE_INTEGER,
35930
- specificity: [1, 0, 0, 0],
35931
- specificityScore: Number.MAX_SAFE_INTEGER,
35932
- isImportant: false
35933
- };
35934
- }
35942
+ var INLINE_CASCADE_POSITION = Object.freeze({
35943
+ layer: null,
35944
+ layerOrder: Number.MAX_SAFE_INTEGER,
35945
+ sourceOrder: Number.MAX_SAFE_INTEGER,
35946
+ specificity: [1, 0, 0, 0],
35947
+ specificityScore: Number.MAX_SAFE_INTEGER,
35948
+ isImportant: false
35949
+ });
35950
+ var INLINE_GUARD_PROVENANCE = Object.freeze({
35951
+ kind: 0 /* Unconditional */,
35952
+ conditions: [],
35953
+ key: "always"
35954
+ });
35935
35955
  function resolveRuleLayerOrder(rule, css) {
35936
35956
  const layer = rule.containingLayer;
35937
35957
  if (!layer) return 0;
@@ -35939,14 +35959,14 @@ function resolveRuleLayerOrder(rule, css) {
35939
35959
  if (!name) return 0;
35940
35960
  return css.layerOrder.get(name) ?? 0;
35941
35961
  }
35942
- function buildConditionalDeltaIndex(elements, appliesByElementKey, monitoredDeclarationsBySelectorId) {
35943
- const conditionalSignalDeltaFactsByElementKey = /* @__PURE__ */ new Map();
35962
+ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclarationsBySelectorId) {
35963
+ const conditionalSignalDeltaFactsByNode = /* @__PURE__ */ new Map();
35944
35964
  const elementsWithConditionalDeltaBySignal = /* @__PURE__ */ new Map();
35945
- const baselineOffsetFactsByElementKey = /* @__PURE__ */ new Map();
35965
+ const baselineOffsetFactsByNode = /* @__PURE__ */ new Map();
35946
35966
  for (let i = 0; i < elements.length; i++) {
35947
35967
  const node = elements[i];
35948
35968
  if (!node) continue;
35949
- const edges = appliesByElementKey.get(node.key);
35969
+ const edges = appliesByNode.get(node);
35950
35970
  let factByProperty = null;
35951
35971
  if (edges !== void 0 && edges.length > 0) {
35952
35972
  const byProperty = /* @__PURE__ */ new Map();
@@ -35971,7 +35991,7 @@ function buildConditionalDeltaIndex(elements, appliesByElementKey, monitoredDecl
35971
35991
  };
35972
35992
  byProperty.set(property, bucket);
35973
35993
  }
35974
- if (declaration.guard === "conditional") {
35994
+ if (declaration.guardProvenance.kind === 1 /* Conditional */) {
35975
35995
  bucket.conditional.add(expandedEntry.value);
35976
35996
  continue;
35977
35997
  }
@@ -36011,7 +36031,7 @@ function buildConditionalDeltaIndex(elements, appliesByElementKey, monitoredDecl
36011
36031
  }
36012
36032
  if (facts.size > 0) {
36013
36033
  factByProperty = facts;
36014
- conditionalSignalDeltaFactsByElementKey.set(node.key, facts);
36034
+ conditionalSignalDeltaFactsByNode.set(node, facts);
36015
36035
  for (const [signal, fact] of facts) {
36016
36036
  if (!fact.hasConditional) continue;
36017
36037
  const existing = elementsWithConditionalDeltaBySignal.get(signal);
@@ -36048,13 +36068,13 @@ function buildConditionalDeltaIndex(elements, appliesByElementKey, monitoredDecl
36048
36068
  baselineBySignal.set(signal, [...values]);
36049
36069
  }
36050
36070
  if (baselineBySignal.size > 0) {
36051
- baselineOffsetFactsByElementKey.set(node.key, baselineBySignal);
36071
+ baselineOffsetFactsByNode.set(node, baselineBySignal);
36052
36072
  }
36053
36073
  }
36054
36074
  return {
36055
- conditionalSignalDeltaFactsByElementKey,
36075
+ conditionalSignalDeltaFactsByNode,
36056
36076
  elementsWithConditionalDeltaBySignal,
36057
- baselineOffsetFactsByElementKey
36077
+ baselineOffsetFactsByNode
36058
36078
  };
36059
36079
  }
36060
36080
  var EMPTY_NODE_LIST2 = [];
@@ -36181,8 +36201,8 @@ function getTextualContentState(element, memo, compositionMetaByElementId, logge
36181
36201
  if (child.kind === "expression") {
36182
36202
  if (isStructuralExpression(child.node)) {
36183
36203
  if (logger.enabled) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 unknown (structural expression child)`);
36184
- memo.set(element.id, "unknown");
36185
- return "unknown";
36204
+ memo.set(element.id, 2 /* Unknown */);
36205
+ return 2 /* Unknown */;
36186
36206
  }
36187
36207
  hasTextOnlyExpression = true;
36188
36208
  continue;
@@ -36190,8 +36210,8 @@ function getTextualContentState(element, memo, compositionMetaByElementId, logge
36190
36210
  if (child.kind !== "text") continue;
36191
36211
  if (child.node.type !== "JSXText") continue;
36192
36212
  if (isBlank(child.node.value)) continue;
36193
- memo.set(element.id, "yes");
36194
- return "yes";
36213
+ memo.set(element.id, 0 /* Yes */);
36214
+ return 0 /* Yes */;
36195
36215
  }
36196
36216
  let childHasUnknown = false;
36197
36217
  let childHasDynamicText = false;
@@ -36205,31 +36225,31 @@ function getTextualContentState(element, memo, compositionMetaByElementId, logge
36205
36225
  if (logger.enabled) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id}: non-DOM child ${child.tag}#${child.id} resolves to control tag=${childMeta.tagName}, skipping`);
36206
36226
  continue;
36207
36227
  }
36208
- if (childState !== "no") {
36228
+ if (childState !== 1 /* No */) {
36209
36229
  if (logger.enabled) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id}: non-DOM child ${child.tag ?? child.id}#${child.id} has state=${childState} \u2192 childHasUnknown`);
36210
36230
  childHasUnknown = true;
36211
36231
  }
36212
36232
  continue;
36213
36233
  }
36214
- if (childState === "yes") {
36215
- memo.set(element.id, "yes");
36216
- return "yes";
36234
+ if (childState === 0 /* Yes */) {
36235
+ memo.set(element.id, 0 /* Yes */);
36236
+ return 0 /* Yes */;
36217
36237
  }
36218
- if (childState === "unknown") childHasUnknown = true;
36219
- if (childState === "dynamic-text") childHasDynamicText = true;
36238
+ if (childState === 2 /* Unknown */) childHasUnknown = true;
36239
+ if (childState === 3 /* DynamicText */) childHasDynamicText = true;
36220
36240
  }
36221
36241
  if (childHasUnknown) {
36222
36242
  if (logger.enabled) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 unknown (child has unknown)`);
36223
- memo.set(element.id, "unknown");
36224
- return "unknown";
36243
+ memo.set(element.id, 2 /* Unknown */);
36244
+ return 2 /* Unknown */;
36225
36245
  }
36226
36246
  if (hasTextOnlyExpression || childHasDynamicText) {
36227
36247
  if (logger.enabled) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 dynamic-text`);
36228
- memo.set(element.id, "dynamic-text");
36229
- return "dynamic-text";
36248
+ memo.set(element.id, 3 /* DynamicText */);
36249
+ return 3 /* DynamicText */;
36230
36250
  }
36231
- memo.set(element.id, "no");
36232
- return "no";
36251
+ memo.set(element.id, 1 /* No */);
36252
+ return 1 /* No */;
36233
36253
  }
36234
36254
  function isStructuralExpression(node) {
36235
36255
  if (node.type !== "JSXExpressionContainer") return false;
@@ -36528,8 +36548,6 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36528
36548
  classTokens: record.classTokens,
36529
36549
  classTokenSet: record.classTokenSet,
36530
36550
  inlineStyleKeys: record.inlineStyleKeys,
36531
- parentElementId,
36532
- parentElementKey: parentNode ? parentNode.key : parentElementId === null ? null : toLayoutElementKey(solid.file, parentElementId),
36533
36551
  parentElementNode: parentNode,
36534
36552
  previousSiblingNode,
36535
36553
  siblingIndex,
@@ -36570,22 +36588,25 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36570
36588
  logger.debug(`[build] rootElementsByFile file=${file} count=${roots.length}: ${descs.join(", ")}`);
36571
36589
  }
36572
36590
  }
36573
- const selectorCandidatesByElementKey = buildSelectorCandidatesByElementKey(elements, scopedSelectorsBySolidFile, perf);
36591
+ const selectorCandidatesByNode = buildSelectorCandidatesByNode(elements, scopedSelectorsBySolidFile, perf);
36592
+ const selectorMatchCtx = {
36593
+ selectorMetadataById,
36594
+ selectorsById,
36595
+ rootElementsByFile,
36596
+ perf,
36597
+ logger
36598
+ };
36574
36599
  for (let i = 0; i < elements.length; i++) {
36575
36600
  const node = elements[i];
36576
36601
  if (!node) continue;
36577
- const selectorIds = selectorCandidatesByElementKey.get(node.key) ?? EMPTY_NUMBER_LIST2;
36602
+ const selectorIds = selectorCandidatesByNode.get(node) ?? EMPTY_NUMBER_LIST2;
36578
36603
  if (selectorIds.length === 0) continue;
36579
36604
  appendMatchingEdgesFromSelectorIds(
36605
+ selectorMatchCtx,
36580
36606
  selectorIds,
36581
36607
  node,
36582
- selectorMetadataById,
36583
- selectorsById,
36584
36608
  applies,
36585
- appliesByElementNodeMutable,
36586
- perf,
36587
- rootElementsByFile,
36588
- logger
36609
+ appliesByElementNodeMutable
36589
36610
  );
36590
36611
  }
36591
36612
  perf.selectorMatchMs = performance.now() - selectorMatchStartedAt;
@@ -36593,7 +36614,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36593
36614
  for (const edges of appliesByElementNodeMutable.values()) {
36594
36615
  edges.sort(compareLayoutEdge);
36595
36616
  }
36596
- const appliesByElementKey = /* @__PURE__ */ new Map();
36617
+ const appliesByNode = /* @__PURE__ */ new Map();
36597
36618
  const tailwind = css.tailwind;
36598
36619
  for (let i = 0; i < elements.length; i++) {
36599
36620
  const node = elements[i];
@@ -36601,7 +36622,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36601
36622
  const edges = appliesByElementNodeMutable.get(node) ?? [];
36602
36623
  const cascade = buildCascadeMapForElement(node, edges, monitoredDeclarationsBySelectorId, tailwind);
36603
36624
  cascadeByElementNode.set(node, cascade);
36604
- appliesByElementKey.set(node.key, edges);
36625
+ appliesByNode.set(node, edges);
36605
36626
  }
36606
36627
  perf.cascadeBuildMs = performance.now() - cascadeStartedAt;
36607
36628
  const snapshotByElementNode = buildSignalSnapshotIndex(elements, cascadeByElementNode, perf);
@@ -36609,7 +36630,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36609
36630
  const factIndex = buildElementFactIndex(elements, snapshotByElementNode);
36610
36631
  const conditionalDeltaIndex = buildConditionalDeltaIndex(
36611
36632
  elements,
36612
- appliesByElementKey,
36633
+ appliesByNode,
36613
36634
  monitoredDeclarationsBySelectorId
36614
36635
  );
36615
36636
  const elementsWithConditionalOverflowDelta = buildConditionalDeltaSignalGroupElements(
@@ -36627,7 +36648,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36627
36648
  contextByParentNode,
36628
36649
  measurementNodeByRootKey,
36629
36650
  snapshotByElementNode,
36630
- snapshotHotSignalsByElementKey: factIndex.snapshotHotSignalsByElementKey
36651
+ snapshotHotSignalsByNode: factIndex.snapshotHotSignalsByNode
36631
36652
  });
36632
36653
  finalizeTableCellBaselineRelevance(contextByParentNode, cohortIndex.verticalAlignConsensusByParent);
36633
36654
  perf.conditionalSignals = cohortIndex.conditionalSignals;
@@ -36643,11 +36664,11 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36643
36664
  childrenByParentNode: childrenByParentNodeMutable,
36644
36665
  elementBySolidFileAndId: elementBySolidFileAndIdMutable,
36645
36666
  elementRefsBySolidFileAndId: elementRefsBySolidFileAndIdMutable,
36646
- appliesByElementKey,
36647
- selectorCandidatesByElementKey,
36667
+ appliesByNode,
36668
+ selectorCandidatesByNode,
36648
36669
  selectorsById,
36649
36670
  measurementNodeByRootKey,
36650
- snapshotHotSignalsByElementKey: factIndex.snapshotHotSignalsByElementKey,
36671
+ snapshotHotSignalsByNode: factIndex.snapshotHotSignalsByNode,
36651
36672
  elementsByTagName: factIndex.elementsByTagName,
36652
36673
  elementsWithConditionalDeltaBySignal: conditionalDeltaIndex.elementsWithConditionalDeltaBySignal,
36653
36674
  elementsWithConditionalOverflowDelta,
@@ -36655,12 +36676,12 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36655
36676
  elementsByKnownSignalValue: factIndex.elementsByKnownSignalValue,
36656
36677
  dynamicSlotCandidateElements: factIndex.dynamicSlotCandidateElements,
36657
36678
  scrollContainerElements: factIndex.scrollContainerElements,
36658
- reservedSpaceFactsByElementKey: factIndex.reservedSpaceFactsByElementKey,
36659
- scrollContainerFactsByElementKey: factIndex.scrollContainerFactsByElementKey,
36660
- flowParticipationFactsByElementKey: factIndex.flowParticipationFactsByElementKey,
36661
- containingBlockFactsByElementKey: factIndex.containingBlockFactsByElementKey,
36662
- conditionalSignalDeltaFactsByElementKey: conditionalDeltaIndex.conditionalSignalDeltaFactsByElementKey,
36663
- baselineOffsetFactsByElementKey: conditionalDeltaIndex.baselineOffsetFactsByElementKey,
36679
+ reservedSpaceFactsByNode: factIndex.reservedSpaceFactsByNode,
36680
+ scrollContainerFactsByNode: factIndex.scrollContainerFactsByNode,
36681
+ flowParticipationFactsByNode: factIndex.flowParticipationFactsByNode,
36682
+ containingBlockFactsByNode: factIndex.containingBlockFactsByNode,
36683
+ conditionalSignalDeltaFactsByNode: conditionalDeltaIndex.conditionalSignalDeltaFactsByNode,
36684
+ baselineOffsetFactsByNode: conditionalDeltaIndex.baselineOffsetFactsByNode,
36664
36685
  statefulSelectorEntriesByRuleId: statefulRuleIndexes.selectorEntriesByRuleId,
36665
36686
  statefulNormalizedDeclarationsByRuleId: statefulRuleIndexes.normalizedDeclarationsByRuleId,
36666
36687
  statefulBaseValueIndex: statefulRuleIndexes.baseValueIndex,
@@ -36672,11 +36693,11 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36672
36693
  };
36673
36694
  }
36674
36695
  function buildElementFactIndex(elements, snapshotByElementNode) {
36675
- const reservedSpaceFactsByElementKey = /* @__PURE__ */ new Map();
36676
- const scrollContainerFactsByElementKey = /* @__PURE__ */ new Map();
36677
- const flowParticipationFactsByElementKey = /* @__PURE__ */ new Map();
36678
- const containingBlockFactsByElementKey = /* @__PURE__ */ new Map();
36679
- const snapshotHotSignalsByElementKey = /* @__PURE__ */ new Map();
36696
+ const reservedSpaceFactsByNode = /* @__PURE__ */ new Map();
36697
+ const scrollContainerFactsByNode = /* @__PURE__ */ new Map();
36698
+ const flowParticipationFactsByNode = /* @__PURE__ */ new Map();
36699
+ const containingBlockFactsByNode = /* @__PURE__ */ new Map();
36700
+ const snapshotHotSignalsByNode = /* @__PURE__ */ new Map();
36680
36701
  const elementsByTagName = /* @__PURE__ */ new Map();
36681
36702
  const elementsByKnownSignalValue = /* @__PURE__ */ new Map();
36682
36703
  const dynamicSlotCandidateElements = [];
@@ -36686,7 +36707,7 @@ function buildElementFactIndex(elements, snapshotByElementNode) {
36686
36707
  const node = elements[i];
36687
36708
  if (!node) continue;
36688
36709
  const snapshot = snapshotByElementNode.get(node);
36689
- if (node.textualContent === "unknown" && node.siblingCount >= 2) {
36710
+ if (node.textualContent === 2 /* Unknown */ && node.siblingCount >= 2) {
36690
36711
  dynamicSlotCandidateElements.push(node);
36691
36712
  }
36692
36713
  if (node.tagName) {
@@ -36707,18 +36728,18 @@ function buildElementFactIndex(elements, snapshotByElementNode) {
36707
36728
  nearestPositionedAncestorHasReservedSpace = parentPositioned.hasReservedSpace;
36708
36729
  }
36709
36730
  }
36710
- containingBlockFactsByElementKey.set(node.key, {
36731
+ containingBlockFactsByNode.set(node, {
36711
36732
  nearestPositionedAncestorKey,
36712
36733
  nearestPositionedAncestorHasReservedSpace
36713
36734
  });
36714
36735
  if (!snapshot) continue;
36715
36736
  const reservedSpaceFact = computeReservedSpaceFact(snapshot);
36716
- reservedSpaceFactsByElementKey.set(node.key, reservedSpaceFact);
36737
+ reservedSpaceFactsByNode.set(node, reservedSpaceFact);
36717
36738
  const scrollFact = computeScrollContainerFact(snapshot);
36718
- scrollContainerFactsByElementKey.set(node.key, scrollFact);
36739
+ scrollContainerFactsByNode.set(node, scrollFact);
36719
36740
  if (scrollFact.isScrollContainer) scrollContainerElements.push(node);
36720
- flowParticipationFactsByElementKey.set(node.key, computeFlowParticipationFact(snapshot));
36721
- snapshotHotSignalsByElementKey.set(node.key, computeHotSignals(snapshot));
36741
+ flowParticipationFactsByNode.set(node, computeFlowParticipationFact(snapshot));
36742
+ snapshotHotSignalsByNode.set(node, computeHotSignals(snapshot));
36722
36743
  const positionSignal = snapshot.signals.get("position");
36723
36744
  const isPositioned = positionSignal !== void 0 && positionSignal.kind === "known" && positionSignal.normalized !== "static";
36724
36745
  if (isPositioned) {
@@ -36749,49 +36770,163 @@ function buildElementFactIndex(elements, snapshotByElementNode) {
36749
36770
  }
36750
36771
  }
36751
36772
  return {
36752
- reservedSpaceFactsByElementKey,
36753
- scrollContainerFactsByElementKey,
36773
+ reservedSpaceFactsByNode,
36774
+ scrollContainerFactsByNode,
36754
36775
  scrollContainerElements,
36755
- flowParticipationFactsByElementKey,
36756
- containingBlockFactsByElementKey,
36757
- snapshotHotSignalsByElementKey,
36776
+ flowParticipationFactsByNode,
36777
+ containingBlockFactsByNode,
36778
+ snapshotHotSignalsByNode,
36758
36779
  elementsByTagName,
36759
36780
  elementsByKnownSignalValue,
36760
36781
  dynamicSlotCandidateElements
36761
36782
  };
36762
36783
  }
36763
- function computeHotSignals(snapshot) {
36784
+ var ABSENT_NUMERIC = Object.freeze({
36785
+ present: false,
36786
+ value: null,
36787
+ kind: 3 /* Unknown */
36788
+ });
36789
+ var ABSENT_NORMALIZED = Object.freeze({
36790
+ present: false,
36791
+ value: null,
36792
+ kind: 3 /* Unknown */
36793
+ });
36794
+ function toHotNumeric(signal) {
36795
+ if (signal.kind !== "known") {
36796
+ return {
36797
+ present: true,
36798
+ value: null,
36799
+ kind: signal.guard.kind === 1 /* Conditional */ ? 2 /* Conditional */ : 3 /* Unknown */
36800
+ };
36801
+ }
36764
36802
  return {
36765
- lineHeight: computeHotNumeric(snapshot, "line-height"),
36766
- verticalAlign: computeHotNormalized(snapshot, "vertical-align"),
36767
- alignSelf: computeHotNormalized(snapshot, "align-self"),
36768
- placeSelf: computeHotNormalized(snapshot, "place-self"),
36769
- writingMode: computeHotNormalized(snapshot, "writing-mode"),
36770
- direction: computeHotNormalized(snapshot, "direction"),
36771
- display: computeHotNormalized(snapshot, "display"),
36772
- alignItems: computeHotNormalized(snapshot, "align-items"),
36773
- placeItems: computeHotNormalized(snapshot, "place-items"),
36774
- position: computeHotNormalized(snapshot, "position"),
36775
- insetBlockStart: computeHotNumeric(snapshot, "inset-block-start"),
36776
- insetBlockEnd: computeHotNumeric(snapshot, "inset-block-end"),
36777
- transform: computeHotNumeric(snapshot, "transform"),
36778
- translate: computeHotNumeric(snapshot, "translate"),
36779
- top: computeHotNumeric(snapshot, "top"),
36780
- bottom: computeHotNumeric(snapshot, "bottom"),
36781
- marginTop: computeHotNumeric(snapshot, "margin-top"),
36782
- marginBottom: computeHotNumeric(snapshot, "margin-bottom")
36803
+ present: true,
36804
+ value: signal.px,
36805
+ kind: signal.guard.kind === 1 /* Conditional */ ? 2 /* Conditional */ : signal.quality === "estimated" ? 1 /* Interval */ : 0 /* Exact */
36783
36806
  };
36784
36807
  }
36785
- function computeHotNumeric(snapshot, name) {
36808
+ function toHotNormalized(signal) {
36809
+ if (signal.kind !== "known") {
36810
+ return {
36811
+ present: true,
36812
+ value: null,
36813
+ kind: signal.guard.kind === 1 /* Conditional */ ? 2 /* Conditional */ : 3 /* Unknown */
36814
+ };
36815
+ }
36786
36816
  return {
36787
- present: snapshot.signals.has(name),
36788
- ...readNumericSignalEvidence(snapshot, name)
36817
+ present: true,
36818
+ value: signal.normalized,
36819
+ kind: signal.guard.kind === 1 /* Conditional */ ? 2 /* Conditional */ : signal.quality === "estimated" ? 1 /* Interval */ : 0 /* Exact */
36789
36820
  };
36790
36821
  }
36791
- function computeHotNormalized(snapshot, name) {
36822
+ function computeHotSignals(snapshot) {
36823
+ let lineHeight = ABSENT_NUMERIC;
36824
+ let verticalAlign = ABSENT_NORMALIZED;
36825
+ let alignSelf = ABSENT_NORMALIZED;
36826
+ let placeSelf = ABSENT_NORMALIZED;
36827
+ let flexDirection = ABSENT_NORMALIZED;
36828
+ let gridAutoFlow = ABSENT_NORMALIZED;
36829
+ let writingMode = ABSENT_NORMALIZED;
36830
+ let direction = ABSENT_NORMALIZED;
36831
+ let display = ABSENT_NORMALIZED;
36832
+ let alignItems = ABSENT_NORMALIZED;
36833
+ let placeItems = ABSENT_NORMALIZED;
36834
+ let position = ABSENT_NORMALIZED;
36835
+ let insetBlockStart = ABSENT_NUMERIC;
36836
+ let insetBlockEnd = ABSENT_NUMERIC;
36837
+ let transform = ABSENT_NUMERIC;
36838
+ let translate = ABSENT_NUMERIC;
36839
+ let top = ABSENT_NUMERIC;
36840
+ let bottom = ABSENT_NUMERIC;
36841
+ let marginTop = ABSENT_NUMERIC;
36842
+ let marginBottom = ABSENT_NUMERIC;
36843
+ for (const [name, value2] of snapshot.signals) {
36844
+ switch (name) {
36845
+ case "line-height":
36846
+ lineHeight = toHotNumeric(value2);
36847
+ break;
36848
+ case "vertical-align":
36849
+ verticalAlign = toHotNormalized(value2);
36850
+ break;
36851
+ case "align-self":
36852
+ alignSelf = toHotNormalized(value2);
36853
+ break;
36854
+ case "place-self":
36855
+ placeSelf = toHotNormalized(value2);
36856
+ break;
36857
+ case "flex-direction":
36858
+ flexDirection = toHotNormalized(value2);
36859
+ break;
36860
+ case "grid-auto-flow":
36861
+ gridAutoFlow = toHotNormalized(value2);
36862
+ break;
36863
+ case "writing-mode":
36864
+ writingMode = toHotNormalized(value2);
36865
+ break;
36866
+ case "direction":
36867
+ direction = toHotNormalized(value2);
36868
+ break;
36869
+ case "display":
36870
+ display = toHotNormalized(value2);
36871
+ break;
36872
+ case "align-items":
36873
+ alignItems = toHotNormalized(value2);
36874
+ break;
36875
+ case "place-items":
36876
+ placeItems = toHotNormalized(value2);
36877
+ break;
36878
+ case "position":
36879
+ position = toHotNormalized(value2);
36880
+ break;
36881
+ case "inset-block-start":
36882
+ insetBlockStart = toHotNumeric(value2);
36883
+ break;
36884
+ case "inset-block-end":
36885
+ insetBlockEnd = toHotNumeric(value2);
36886
+ break;
36887
+ case "transform":
36888
+ transform = toHotNumeric(value2);
36889
+ break;
36890
+ case "translate":
36891
+ translate = toHotNumeric(value2);
36892
+ break;
36893
+ case "top":
36894
+ top = toHotNumeric(value2);
36895
+ break;
36896
+ case "bottom":
36897
+ bottom = toHotNumeric(value2);
36898
+ break;
36899
+ case "margin-top":
36900
+ marginTop = toHotNumeric(value2);
36901
+ break;
36902
+ case "margin-bottom":
36903
+ marginBottom = toHotNumeric(value2);
36904
+ break;
36905
+ default:
36906
+ break;
36907
+ }
36908
+ }
36792
36909
  return {
36793
- present: snapshot.signals.has(name),
36794
- ...readNormalizedSignalEvidence(snapshot, name)
36910
+ lineHeight,
36911
+ verticalAlign,
36912
+ alignSelf,
36913
+ placeSelf,
36914
+ flexDirection,
36915
+ gridAutoFlow,
36916
+ writingMode,
36917
+ direction,
36918
+ display,
36919
+ alignItems,
36920
+ placeItems,
36921
+ position,
36922
+ insetBlockStart,
36923
+ insetBlockEnd,
36924
+ transform,
36925
+ translate,
36926
+ top,
36927
+ bottom,
36928
+ marginTop,
36929
+ marginBottom
36795
36930
  };
36796
36931
  }
36797
36932
  function computeReservedSpaceFact(snapshot) {
@@ -36826,15 +36961,14 @@ function computeReservedSpaceFact(snapshot) {
36826
36961
  function hasPositiveOrDeclaredDimension(snapshot, property) {
36827
36962
  const signal = snapshot.signals.get(property);
36828
36963
  if (!signal) return false;
36829
- if (signal.guard !== "unconditional") return false;
36964
+ if (signal.guard.kind !== 0 /* Unconditional */) return false;
36830
36965
  let normalized = "";
36831
36966
  if (signal.kind === "known") {
36832
36967
  if (signal.px !== null) return signal.px > 0;
36833
36968
  normalized = signal.normalized.trim().toLowerCase();
36834
36969
  }
36835
36970
  if (signal.kind === "unknown") {
36836
- if (signal.raw === null) return false;
36837
- normalized = signal.raw.trim().toLowerCase();
36971
+ return signal.source !== null;
36838
36972
  }
36839
36973
  if (normalized.length === 0) return false;
36840
36974
  if (isNonReservingDimension(normalized)) return false;
@@ -36843,15 +36977,14 @@ function hasPositiveOrDeclaredDimension(snapshot, property) {
36843
36977
  function hasUsableAspectRatio(snapshot) {
36844
36978
  const signal = snapshot.signals.get("aspect-ratio");
36845
36979
  if (!signal) return false;
36846
- if (signal.guard !== "unconditional") return false;
36980
+ if (signal.guard.kind !== 0 /* Unconditional */) return false;
36981
+ if (signal.kind === "unknown") {
36982
+ return false;
36983
+ }
36847
36984
  let normalized = "";
36848
36985
  if (signal.kind === "known") {
36849
36986
  normalized = signal.normalized.trim().toLowerCase();
36850
36987
  }
36851
- if (signal.kind === "unknown") {
36852
- if (signal.raw === null) return false;
36853
- normalized = signal.raw.trim().toLowerCase();
36854
- }
36855
36988
  if (normalized.length === 0) return false;
36856
36989
  return normalized !== "auto";
36857
36990
  }
@@ -36869,8 +37002,8 @@ function computeScrollContainerFact(snapshot) {
36869
37002
  const yFromLonghand = parseSingleAxisScroll(overflowY);
36870
37003
  const xScroll = shorthandAxis.x;
36871
37004
  const yScroll = yFromLonghand === null ? shorthandAxis.y : yFromLonghand;
36872
- const hasConditionalScroll = overflowSignal?.guard === "conditional" && (shorthandAxis.x || shorthandAxis.y) || overflowYSignal?.guard === "conditional" && yFromLonghand === true;
36873
- const hasUnconditionalScroll = overflowSignal?.guard === "unconditional" && (shorthandAxis.x || shorthandAxis.y) || overflowYSignal?.guard === "unconditional" && yFromLonghand === true;
37005
+ const hasConditionalScroll = overflowSignal?.guard.kind === 1 /* Conditional */ && (shorthandAxis.x || shorthandAxis.y) || overflowYSignal?.guard.kind === 1 /* Conditional */ && yFromLonghand === true;
37006
+ const hasUnconditionalScroll = overflowSignal?.guard.kind === 0 /* Unconditional */ && (shorthandAxis.x || shorthandAxis.y) || overflowYSignal?.guard.kind === 0 /* Unconditional */ && yFromLonghand === true;
36874
37007
  return {
36875
37008
  isScrollContainer: xScroll || yScroll,
36876
37009
  axis: toScrollAxis(xScroll, yScroll),
@@ -36880,18 +37013,18 @@ function computeScrollContainerFact(snapshot) {
36880
37013
  hasUnconditionalScroll
36881
37014
  };
36882
37015
  }
37016
+ var NO_SCROLL = Object.freeze({ x: false, y: false });
37017
+ var BOTH_SCROLL = Object.freeze({ x: true, y: true });
36883
37018
  function parseOverflowShorthandAxis(value2) {
36884
- if (value2 === null) return { x: false, y: false };
36885
- const tokens = splitWhitespaceTokens(value2);
36886
- if (tokens.length === 0) return { x: false, y: false };
36887
- const first = tokens[0];
36888
- if (!first) return { x: false, y: false };
36889
- if (tokens.length === 1) {
36890
- const scroll = SCROLLABLE_VALUES.has(first);
36891
- return { x: scroll, y: scroll };
36892
- }
36893
- const second = tokens[1];
36894
- if (!second) return { x: SCROLLABLE_VALUES.has(first), y: false };
37019
+ if (value2 === null) return NO_SCROLL;
37020
+ const trimmed = value2.trim();
37021
+ const spaceIdx = trimmed.indexOf(" ");
37022
+ if (spaceIdx === -1) {
37023
+ const scroll = SCROLLABLE_VALUES.has(trimmed);
37024
+ return scroll ? BOTH_SCROLL : NO_SCROLL;
37025
+ }
37026
+ const first = trimmed.slice(0, spaceIdx);
37027
+ const second = trimmed.slice(spaceIdx + 1).trimStart();
36895
37028
  return {
36896
37029
  x: SCROLLABLE_VALUES.has(first),
36897
37030
  y: SCROLLABLE_VALUES.has(second)
@@ -36899,16 +37032,16 @@ function parseOverflowShorthandAxis(value2) {
36899
37032
  }
36900
37033
  function parseSingleAxisScroll(value2) {
36901
37034
  if (value2 === null) return null;
36902
- const tokens = splitWhitespaceTokens(value2);
36903
- const first = tokens[0];
36904
- if (!first) return null;
37035
+ const trimmed = value2.trim();
37036
+ const spaceIdx = trimmed.indexOf(" ");
37037
+ const first = spaceIdx === -1 ? trimmed : trimmed.slice(0, spaceIdx);
36905
37038
  return SCROLLABLE_VALUES.has(first);
36906
37039
  }
36907
37040
  function toScrollAxis(x, y) {
36908
- if (x && y) return "both";
36909
- if (x) return "x";
36910
- if (y) return "y";
36911
- return "none";
37041
+ if (x && y) return 3 /* Both */;
37042
+ if (x) return 1 /* X */;
37043
+ if (y) return 2 /* Y */;
37044
+ return 0 /* None */;
36912
37045
  }
36913
37046
  function computeFlowParticipationFact(snapshot) {
36914
37047
  const signal = snapshot.signals.get("position");
@@ -36925,8 +37058,8 @@ function computeFlowParticipationFact(snapshot) {
36925
37058
  return {
36926
37059
  inFlow: !outOfFlow,
36927
37060
  position,
36928
- hasConditionalOutOfFlow: signal.guard === "conditional" && outOfFlow,
36929
- hasUnconditionalOutOfFlow: signal.guard === "unconditional" && outOfFlow
37061
+ hasConditionalOutOfFlow: signal.guard.kind === 1 /* Conditional */ && outOfFlow,
37062
+ hasUnconditionalOutOfFlow: signal.guard.kind === 0 /* Unconditional */ && outOfFlow
36930
37063
  };
36931
37064
  }
36932
37065
  function buildContextIndex(childrenByParentNode, snapshotByElementNode, perf) {
@@ -37001,7 +37134,7 @@ function collectAlignmentCases(context) {
37001
37134
  subjectDeclaredOffsetDeviation,
37002
37135
  subjectEffectiveOffsetDeviation,
37003
37136
  subjectLineHeightDeviation,
37004
- subjectStats.element.snapshot.textualContent,
37137
+ subjectStats.element.snapshot.node.textualContent,
37005
37138
  subjectStats.element,
37006
37139
  subjectStats.contentComposition,
37007
37140
  cohortContentCompositions
@@ -37094,26 +37227,26 @@ function coverageFromNumeric(value2) {
37094
37227
  }
37095
37228
  function coverageFromConflict(value2) {
37096
37229
  const certainty = coverageFromKind(value2.kind);
37097
- if (value2.value === "unknown") return certainty * 0.4;
37230
+ if (value2.value === 2 /* Unknown */) return certainty * 0.4;
37098
37231
  return certainty;
37099
37232
  }
37100
37233
  function coverageFromTextContrast(value2) {
37101
- if (value2 === "unknown") return 0.35;
37234
+ if (value2 === 2 /* Unknown */) return 0.35;
37102
37235
  return 1;
37103
37236
  }
37104
37237
  function coverageFromSubjectText(subjectTextualContent) {
37105
- if (subjectTextualContent === "unknown") return 0.35;
37238
+ if (subjectTextualContent === 2 /* Unknown */) return 0.35;
37106
37239
  return 1;
37107
37240
  }
37108
37241
  function coverageFromContextCertainty(certainty) {
37109
- if (certainty === "resolved") return 1;
37110
- if (certainty === "conditional") return 0.55;
37242
+ if (certainty === 0 /* Resolved */) return 1;
37243
+ if (certainty === 1 /* Conditional */) return 0.55;
37111
37244
  return 0.25;
37112
37245
  }
37113
37246
  function coverageFromKind(kind) {
37114
- if (kind === "exact") return 1;
37115
- if (kind === "interval") return 0.78;
37116
- if (kind === "conditional") return 0.5;
37247
+ if (kind === 0 /* Exact */) return 1;
37248
+ if (kind === 1 /* Interval */) return 0.78;
37249
+ if (kind === 2 /* Conditional */) return 0.5;
37117
37250
  return 0.2;
37118
37251
  }
37119
37252
  function averageCoverage(...values) {
@@ -37146,24 +37279,7 @@ function resolveEffectiveAlignmentContext(parentContext, child, measurementNode,
37146
37279
  const childContext = contextByParentNode.get(child);
37147
37280
  if (!childContext) return parentContext;
37148
37281
  if (childContext.baselineRelevance !== "irrelevant") return parentContext;
37149
- return {
37150
- kind: parentContext.kind,
37151
- certainty: parentContext.certainty,
37152
- parentSolidFile: parentContext.parentSolidFile,
37153
- parentElementId: parentContext.parentElementId,
37154
- parentElementKey: parentContext.parentElementKey,
37155
- parentTag: parentContext.parentTag,
37156
- axis: parentContext.axis,
37157
- axisCertainty: parentContext.axisCertainty,
37158
- inlineDirection: parentContext.inlineDirection,
37159
- inlineDirectionCertainty: parentContext.inlineDirectionCertainty,
37160
- parentDisplay: parentContext.parentDisplay,
37161
- parentAlignItems: parentContext.parentAlignItems,
37162
- parentPlaceItems: parentContext.parentPlaceItems,
37163
- hasPositionedOffset: parentContext.hasPositionedOffset,
37164
- baselineRelevance: "irrelevant",
37165
- evidence: parentContext.evidence
37166
- };
37282
+ return deriveAlignmentContext(parentContext, { baselineRelevance: "irrelevant" });
37167
37283
  }
37168
37284
  function compareAlignmentCaseOrder(left, right) {
37169
37285
  if (left.subject.solidFile < right.subject.solidFile) return -1;
@@ -37182,12 +37298,12 @@ function buildConsistencyEvidence(input) {
37182
37298
  input.cohortProfile.medianLineHeightPx,
37183
37299
  input.cohortProfile.medianDeclaredOffsetPx
37184
37300
  );
37185
- const offset = normalizeDeviation(
37301
+ const offsetRaw = normalizeDeviation(
37186
37302
  input.subjectEffectiveOffsetDeviation,
37187
37303
  input.cohortProfile.effectiveOffsetDispersionPx,
37188
37304
  effectiveOffsetScaleReference
37189
37305
  );
37190
- const declaredOffset = normalizeDeviation(
37306
+ const declaredOffsetRaw = normalizeDeviation(
37191
37307
  input.subjectDeclaredOffsetDeviation,
37192
37308
  input.cohortProfile.declaredOffsetDispersionPx,
37193
37309
  declaredOffsetScaleReference
@@ -37198,10 +37314,15 @@ function buildConsistencyEvidence(input) {
37198
37314
  input.cohortProfile.medianLineHeightPx
37199
37315
  );
37200
37316
  const baselinesIrrelevant = input.context.baselineRelevance === "irrelevant";
37201
- const baselineStrength = baselinesIrrelevant ? ZERO_STRENGTH : resolveBaselineStrength(input, lineHeight);
37202
- const contextStrength = baselinesIrrelevant ? ZERO_STRENGTH : resolveContextStrength(input, lineHeight);
37203
- const replacedStrength = baselinesIrrelevant ? ZERO_STRENGTH : resolveReplacedControlStrength(input, lineHeight);
37204
- const compositionStrength = baselinesIrrelevant ? ZERO_STRENGTH : resolveContentCompositionStrength(input);
37317
+ const blockAxisIsMainAxis = !input.context.crossAxisIsBlockAxis;
37318
+ const suppressAll = blockAxisIsMainAxis;
37319
+ const offset = suppressAll ? ZERO_STRENGTH : offsetRaw;
37320
+ const declaredOffset = suppressAll ? ZERO_STRENGTH : declaredOffsetRaw;
37321
+ const baselineStrength = baselinesIrrelevant || suppressAll ? ZERO_STRENGTH : resolveBaselineStrength(input, lineHeight);
37322
+ const contextStrength = baselinesIrrelevant || suppressAll ? ZERO_STRENGTH : resolveContextStrength(input, lineHeight);
37323
+ const replacedStrength = baselinesIrrelevant || suppressAll ? ZERO_STRENGTH : resolveReplacedControlStrength(input, lineHeight);
37324
+ const compositionResult = baselinesIrrelevant || suppressAll ? null : resolveContentCompositionStrength(input);
37325
+ const compositionStrength = compositionResult ? compositionResult.evidence : ZERO_STRENGTH;
37205
37326
  const contextCertaintyPenalty = resolveContextCertaintyPenalty(input);
37206
37327
  const provenance = input.cohortProvenance;
37207
37328
  const atoms = buildEvidenceAtoms(
@@ -37222,6 +37343,7 @@ function buildConsistencyEvidence(input) {
37222
37343
  contextStrength: contextStrength.strength,
37223
37344
  replacedStrength: replacedStrength.strength,
37224
37345
  compositionStrength: compositionStrength.strength,
37346
+ majorityClassification: compositionResult ? compositionResult.divergence.majorityClassification : 5 /* Unknown */,
37225
37347
  identifiability: input.subjectIdentifiability,
37226
37348
  factSummary,
37227
37349
  atoms
@@ -37257,7 +37379,7 @@ function resolveOffsetScaleReference(medianLineHeightPx, fallbackMedianOffsetPx)
37257
37379
  }
37258
37380
  function resolveBaselineStrength(input, lineHeight) {
37259
37381
  const verticalAlign = input.cohortSignals.verticalAlign;
37260
- const hasConflict = verticalAlign.value === "conflict";
37382
+ const hasConflict = verticalAlign.value === 0 /* Conflict */;
37261
37383
  const conflict = hasConflict ? alignmentStrengthCalibration.baselineConflictBoost : 0;
37262
37384
  const kind = resolveBaselineEvidenceKind(lineHeight.kind, verticalAlign.kind, hasConflict);
37263
37385
  return {
@@ -37267,7 +37389,7 @@ function resolveBaselineStrength(input, lineHeight) {
37267
37389
  }
37268
37390
  function resolveBaselineEvidenceKind(lineHeightKind, verticalAlignKind, hasConflict) {
37269
37391
  if (!hasConflict) return mergeEvidenceKind(lineHeightKind, verticalAlignKind);
37270
- if (lineHeightKind === "unknown") return verticalAlignKind;
37392
+ if (lineHeightKind === 3 /* Unknown */) return verticalAlignKind;
37271
37393
  return mergeEvidenceKind(lineHeightKind, verticalAlignKind);
37272
37394
  }
37273
37395
  function resolveContextStrength(input, lineHeight) {
@@ -37295,7 +37417,7 @@ function resolveContextConflictEvidence(input) {
37295
37417
  const alignSelf = input.cohortSignals.alignSelf;
37296
37418
  const placeSelf = input.cohortSignals.placeSelf;
37297
37419
  const kind = mergeEvidenceKind(alignSelf.kind, placeSelf.kind);
37298
- const hasConflict = alignSelf.value === "conflict" || placeSelf.value === "conflict";
37420
+ const hasConflict = alignSelf.value === 0 /* Conflict */ || placeSelf.value === 0 /* Conflict */;
37299
37421
  if (!hasConflict) {
37300
37422
  return {
37301
37423
  strength: 0,
@@ -37309,23 +37431,23 @@ function resolveContextConflictEvidence(input) {
37309
37431
  }
37310
37432
  function resolveReplacedControlStrength(input, lineHeight) {
37311
37433
  const subject = input.subject.snapshot;
37312
- const hasReplacedPair = subject.isControl || subject.isReplaced || input.cohortSignals.hasControlOrReplacedPeer;
37434
+ const hasReplacedPair = subject.node.isControl || subject.node.isReplaced || input.cohortSignals.hasControlOrReplacedPeer;
37313
37435
  if (!hasReplacedPair) {
37314
37436
  return {
37315
37437
  strength: 0,
37316
37438
  kind: lineHeight.kind
37317
37439
  };
37318
37440
  }
37319
- if (input.cohortSignals.textContrastWithPeers === "different") {
37441
+ if (input.cohortSignals.textContrastWithPeers === 0 /* Different */) {
37320
37442
  return {
37321
37443
  strength: alignmentStrengthCalibration.replacedDifferentTextBoost,
37322
- kind: "exact"
37444
+ kind: 0 /* Exact */
37323
37445
  };
37324
37446
  }
37325
- if (input.cohortSignals.textContrastWithPeers === "unknown") {
37447
+ if (input.cohortSignals.textContrastWithPeers === 2 /* Unknown */) {
37326
37448
  return {
37327
37449
  strength: alignmentStrengthCalibration.replacedUnknownTextBoost,
37328
- kind: "conditional"
37450
+ kind: 2 /* Conditional */
37329
37451
  };
37330
37452
  }
37331
37453
  return {
@@ -37334,22 +37456,28 @@ function resolveReplacedControlStrength(input, lineHeight) {
37334
37456
  };
37335
37457
  }
37336
37458
  function resolveContentCompositionStrength(input) {
37337
- const divergenceStrength = resolveCompositionDivergenceStrength(
37459
+ const divergence = resolveCompositionDivergence(
37338
37460
  input.subjectContentComposition,
37339
37461
  input.cohortContentCompositions,
37340
37462
  input.context
37341
37463
  );
37342
- if (divergenceStrength <= 0) {
37464
+ if (divergence.strength <= 0) {
37343
37465
  return {
37344
- strength: 0,
37345
- kind: "exact"
37466
+ evidence: {
37467
+ strength: 0,
37468
+ kind: 0 /* Exact */
37469
+ },
37470
+ divergence
37346
37471
  };
37347
37472
  }
37348
37473
  const subjectClassification = input.subjectContentComposition.classification;
37349
- const kind = subjectClassification === "unknown" ? "conditional" : "exact";
37474
+ const kind = subjectClassification === 5 /* Unknown */ ? 2 /* Conditional */ : 0 /* Exact */;
37350
37475
  return {
37351
- strength: clamp(divergenceStrength, 0, 1),
37352
- kind
37476
+ evidence: {
37477
+ strength: clamp(divergence.strength, 0, 1),
37478
+ kind
37479
+ },
37480
+ divergence
37353
37481
  };
37354
37482
  }
37355
37483
  function resolveContextCertaintyPenalty(input) {
@@ -37421,9 +37549,9 @@ function buildEvidenceAtoms(input, offset, declaredOffset, baselineStrength, con
37421
37549
  return out;
37422
37550
  }
37423
37551
  function mapContextCertaintyToEvidenceKind(certainty) {
37424
- if (certainty === "resolved") return "exact";
37425
- if (certainty === "conditional") return "conditional";
37426
- return "unknown";
37552
+ if (certainty === 0 /* Resolved */) return 0 /* Exact */;
37553
+ if (certainty === 1 /* Conditional */) return 2 /* Conditional */;
37554
+ return 3 /* Unknown */;
37427
37555
  }
37428
37556
  function pushSupportAtom(out, factorId, valueKind, strength, coverage, provenance) {
37429
37557
  pushAtom(out, factorId, valueKind, strength, coverage, provenance, "support");
@@ -37449,19 +37577,19 @@ function pushAtom(out, factorId, valueKind, strength, coverage, provenance, expe
37449
37577
  }
37450
37578
  function toPositiveContribution(strength, maxWeight, valueKind) {
37451
37579
  const contribution = clamp(strength, 0, 2) * maxWeight;
37452
- if (valueKind === "exact") {
37580
+ if (valueKind === 0 /* Exact */) {
37453
37581
  return {
37454
37582
  min: contribution,
37455
37583
  max: contribution
37456
37584
  };
37457
37585
  }
37458
- if (valueKind === "interval") {
37586
+ if (valueKind === 1 /* Interval */) {
37459
37587
  return {
37460
37588
  min: contribution * evidenceContributionCalibration.supportIntervalLowerScale,
37461
37589
  max: contribution
37462
37590
  };
37463
37591
  }
37464
- if (valueKind === "conditional") {
37592
+ if (valueKind === 2 /* Conditional */) {
37465
37593
  return {
37466
37594
  min: 0,
37467
37595
  max: contribution * evidenceContributionCalibration.supportConditionalUpperScale
@@ -37474,19 +37602,19 @@ function toPositiveContribution(strength, maxWeight, valueKind) {
37474
37602
  }
37475
37603
  function toNegativeContribution(strength, maxPenalty, valueKind) {
37476
37604
  const penalty = clamp(strength, 0, 1) * maxPenalty;
37477
- if (valueKind === "exact") {
37605
+ if (valueKind === 0 /* Exact */) {
37478
37606
  return {
37479
37607
  min: -penalty,
37480
37608
  max: -penalty
37481
37609
  };
37482
37610
  }
37483
- if (valueKind === "interval") {
37611
+ if (valueKind === 1 /* Interval */) {
37484
37612
  return {
37485
37613
  min: -penalty,
37486
37614
  max: -penalty * evidenceContributionCalibration.penaltyIntervalUpperScale
37487
37615
  };
37488
37616
  }
37489
- if (valueKind === "conditional") {
37617
+ if (valueKind === 2 /* Conditional */) {
37490
37618
  return {
37491
37619
  min: -penalty,
37492
37620
  max: 0
@@ -37497,7 +37625,7 @@ function toNegativeContribution(strength, maxPenalty, valueKind) {
37497
37625
  max: 0
37498
37626
  };
37499
37627
  }
37500
- var ZERO_STRENGTH = { strength: 0, kind: "exact" };
37628
+ var ZERO_STRENGTH = { strength: 0, kind: 0 /* Exact */ };
37501
37629
 
37502
37630
  // src/cross-file/layout/consistency-policy.ts
37503
37631
  function applyConsistencyPolicy(input) {
@@ -37581,23 +37709,38 @@ function resolveConfidence(posterior, evidenceMass) {
37581
37709
  const confidence = posterior.lower * weightedMass * (1 - intervalWidth * alignmentPolicyCalibration.confidenceIntervalPenalty);
37582
37710
  return clamp(confidence, 0, 1);
37583
37711
  }
37712
+ var EMPTY_FACTOR_LIST = Object.freeze([]);
37584
37713
  function selectTopFactors(evidence) {
37585
- const sorted = [...evidence.atoms];
37586
- sorted.sort((left, right) => {
37587
- const leftMagnitude = Math.abs((left.contribution.min + left.contribution.max) / 2);
37588
- const rightMagnitude = Math.abs((right.contribution.min + right.contribution.max) / 2);
37589
- if (leftMagnitude !== rightMagnitude) return rightMagnitude - leftMagnitude;
37590
- if (left.factorId < right.factorId) return -1;
37591
- if (left.factorId > right.factorId) return 1;
37714
+ const atoms = evidence.atoms;
37715
+ if (atoms.length === 0) return EMPTY_FACTOR_LIST;
37716
+ const top = [];
37717
+ for (let i = 0; i < atoms.length; i++) {
37718
+ const atom = atoms[i];
37719
+ if (!atom) continue;
37720
+ const mag = Math.abs((atom.contribution.min + atom.contribution.max) / 2);
37721
+ if (mag <= 0) continue;
37722
+ if (top.length < 4) {
37723
+ top.push({ id: atom.factorId, mag });
37724
+ continue;
37725
+ }
37726
+ let minIdx = 0;
37727
+ for (let j = 1; j < top.length; j++) {
37728
+ const curr = top[j];
37729
+ const best = top[minIdx];
37730
+ if (curr && best && curr.mag < best.mag) minIdx = j;
37731
+ }
37732
+ const minEntry = top[minIdx];
37733
+ if (minEntry && mag > minEntry.mag) {
37734
+ top[minIdx] = { id: atom.factorId, mag };
37735
+ }
37736
+ }
37737
+ top.sort((a, b) => {
37738
+ if (a.mag !== b.mag) return b.mag - a.mag;
37739
+ if (a.id < b.id) return -1;
37740
+ if (a.id > b.id) return 1;
37592
37741
  return 0;
37593
37742
  });
37594
- const out = [];
37595
- for (let i = 0; i < sorted.length && i < 4; i++) {
37596
- const item = sorted[i];
37597
- if (!item) continue;
37598
- out.push(item.factorId);
37599
- }
37600
- return out;
37743
+ return top.map((t) => t.id);
37601
37744
  }
37602
37745
  function logistic(value2) {
37603
37746
  if (value2 > 30) return 1;
@@ -37618,7 +37761,7 @@ function evaluateAlignmentCase(input) {
37618
37761
  evidenceMass: policy.evidenceMass
37619
37762
  };
37620
37763
  }
37621
- const signalFindings = buildFindingsFromAtoms(evidence.atoms, input);
37764
+ const signalFindings = buildFindingsFromAtoms(evidence.atoms, input, evidence);
37622
37765
  return {
37623
37766
  kind: "accept",
37624
37767
  evaluation: {
@@ -37638,12 +37781,12 @@ function evaluateAlignmentCase(input) {
37638
37781
  }
37639
37782
  };
37640
37783
  }
37641
- function buildFindingsFromAtoms(atoms, input) {
37784
+ function buildFindingsFromAtoms(atoms, input, evidence) {
37642
37785
  const byKind = /* @__PURE__ */ new Map();
37643
37786
  for (let i = 0; i < atoms.length; i++) {
37644
37787
  const atom = atoms[i];
37645
37788
  if (!atom) continue;
37646
- const factor = toFindingFactor(atom.factorId, input);
37789
+ const factor = toFindingFactor(atom.factorId, input, evidence);
37647
37790
  if (factor === null) continue;
37648
37791
  const meanContribution = (atom.contribution.min + atom.contribution.max) / 2;
37649
37792
  if (meanContribution <= 0) continue;
@@ -37664,7 +37807,7 @@ function buildFindingsFromAtoms(atoms, input) {
37664
37807
  }
37665
37808
  return [...byKind.values()];
37666
37809
  }
37667
- function toFindingFactor(factorId, input) {
37810
+ function toFindingFactor(factorId, input, evidence) {
37668
37811
  switch (factorId) {
37669
37812
  case "offset-delta":
37670
37813
  return {
@@ -37694,17 +37837,15 @@ function toFindingFactor(factorId, input) {
37694
37837
  case "content-composition-conflict":
37695
37838
  return {
37696
37839
  kind: "content-composition-conflict",
37697
- message: formatContentCompositionFinding(input)
37840
+ message: formatContentCompositionFinding(input, evidence)
37698
37841
  };
37699
37842
  default:
37700
37843
  return null;
37701
37844
  }
37702
37845
  }
37703
- function formatContentCompositionFinding(input) {
37846
+ function formatContentCompositionFinding(input, evidence) {
37704
37847
  const subjectClassification = formatCompositionClassification(input.subjectContentComposition.classification);
37705
- const majorityClassification = formatCompositionClassification(
37706
- resolveMajorityClassification(input.cohortContentCompositions)
37707
- );
37848
+ const majorityClassification = formatCompositionClassification(evidence.majorityClassification);
37708
37849
  const fixSuggestion = formatCompositionFixSuggestion(input.subjectContentComposition);
37709
37850
  return `siblings have identical CSS but different content composition (subject: ${subjectClassification}, majority: ${majorityClassification}; fix: ${fixSuggestion})`;
37710
37851
  }
@@ -37763,7 +37904,7 @@ function recordPolicyMetrics(context, evidenceMass, posteriorLower, posteriorUpp
37763
37904
  context.layout.perf.factorCoverageSum += clamp(evidenceMass, 0, 1);
37764
37905
  context.layout.perf.factorCoverageCount++;
37765
37906
  const width = clamp(posteriorUpper - posteriorLower, 0, 1);
37766
- context.layout.perf.posteriorWidths.push(width);
37907
+ reservoirPush(context.layout.perf.posteriorWidths, width);
37767
37908
  if (width > 1e-3) context.layout.perf.uncertaintyEscalations++;
37768
37909
  }
37769
37910
 
@@ -37876,16 +38017,16 @@ function readNodeRefById(layout, solidFile, elementId) {
37876
38017
  }
37877
38018
  function isFlowRelevantBySiblingsOrText(node, textualContent) {
37878
38019
  if (node.siblingCount >= 2) return true;
37879
- return textualContent === "yes" || textualContent === "unknown" || textualContent === "dynamic-text";
38020
+ return textualContent === 0 /* Yes */ || textualContent === 2 /* Unknown */ || textualContent === 3 /* DynamicText */;
37880
38021
  }
37881
38022
  function isDeferredContainerLike(node, textualContent) {
37882
38023
  if (node.siblingCount >= 2) return true;
37883
- if (textualContent === "unknown") return true;
38024
+ if (textualContent === 2 /* Unknown */) return true;
37884
38025
  if (node.tagName !== null && SECTIONING_CONTAINER_TAGS.has(node.tagName)) return true;
37885
38026
  return false;
37886
38027
  }
37887
38028
  function isDynamicContainerLike(node) {
37888
- return node.textualContent === "unknown" && node.siblingCount >= 2;
38029
+ return node.textualContent === 2 /* Unknown */ && node.siblingCount >= 2;
37889
38030
  }
37890
38031
  function isLikelyViewportAffectingContainer(node) {
37891
38032
  if (node.siblingCount >= 2) return true;
@@ -39125,7 +39266,7 @@ var cssLayoutScrollbarGutterInstability = defineCrossRule({
39125
39266
  const snapshot = collectSignalSnapshot(context, node);
39126
39267
  const scroll = readScrollContainerFact(context.layout, node);
39127
39268
  if (!scroll.isScrollContainer) continue;
39128
- if (scroll.axis !== "y" && scroll.axis !== "both") continue;
39269
+ if (scroll.axis !== 2 /* Y */ && scroll.axis !== 3 /* Both */) continue;
39129
39270
  const scrollbarWidth = readKnownNormalized(snapshot, "scrollbar-width");
39130
39271
  if (scrollbarWidth === "none") continue;
39131
39272
  const gutter = readKnownNormalized(snapshot, "scrollbar-gutter");
@@ -39255,10 +39396,10 @@ var cssLayoutConditionalDisplayCollapse = defineCrossRule({
39255
39396
  const display = readKnownNormalizedWithGuard(snapshot, "display");
39256
39397
  if (!display || !COLLAPSING_DISPLAYS.has(display)) continue;
39257
39398
  const displaySignal = snapshot.signals.get("display");
39258
- if (!displaySignal || displaySignal.guard !== "conditional") continue;
39399
+ if (!displaySignal || displaySignal.guard.kind !== 1 /* Conditional */) continue;
39259
39400
  const flow = readFlowParticipationFact(context.layout, node);
39260
39401
  if (!flow.inFlow) continue;
39261
- if (!isFlowRelevantBySiblingsOrText(node, snapshot.textualContent)) continue;
39402
+ if (!isFlowRelevantBySiblingsOrText(node, snapshot.node.textualContent)) continue;
39262
39403
  const reservedSpace = readReservedSpaceFact(context.layout, node);
39263
39404
  if (reservedSpace.hasReservedSpace) continue;
39264
39405
  if (!emitLayoutDiagnostic(context.layout, node, emit, cssLayoutConditionalDisplayCollapse.id, "conditionalDisplayCollapse", messages152.conditionalDisplayCollapse, cssLayoutConditionalDisplayCollapse.severity, { display })) continue;
@@ -39294,10 +39435,10 @@ var cssLayoutConditionalWhiteSpaceWrapShift = defineCrossRule({
39294
39435
  if (!hasWrapShiftDelta(whiteSpaceDelta)) continue;
39295
39436
  if (!whiteSpace) continue;
39296
39437
  const whiteSpaceSignal = snapshot.signals.get("white-space");
39297
- if (!whiteSpaceSignal || whiteSpaceSignal.guard !== "conditional") continue;
39438
+ if (!whiteSpaceSignal || whiteSpaceSignal.guard.kind !== 1 /* Conditional */) continue;
39298
39439
  const flow = readFlowParticipationFact(context.layout, node);
39299
39440
  if (!flow.inFlow) continue;
39300
- if (!isFlowRelevantBySiblingsOrText(node, snapshot.textualContent)) continue;
39441
+ if (!isFlowRelevantBySiblingsOrText(node, snapshot.node.textualContent)) continue;
39301
39442
  if (hasStableTextShell(snapshot)) continue;
39302
39443
  if (!emitLayoutDiagnostic(context.layout, node, emit, cssLayoutConditionalWhiteSpaceWrapShift.id, "conditionalWhiteSpaceShift", messages153.conditionalWhiteSpaceShift, cssLayoutConditionalWhiteSpaceWrapShift.severity, { whiteSpace })) continue;
39303
39444
  }
@@ -39434,7 +39575,7 @@ var cssLayoutContentVisibilityNoIntrinsicSize = defineCrossRule({
39434
39575
  const node = candidates[i];
39435
39576
  if (!node) continue;
39436
39577
  const snapshot = collectSignalSnapshot(context, node);
39437
- if (!isDeferredContainerLike(node, snapshot.textualContent)) continue;
39578
+ if (!isDeferredContainerLike(node, snapshot.node.textualContent)) continue;
39438
39579
  const reservedSpace = readReservedSpaceFact(context.layout, node);
39439
39580
  if (reservedSpace.hasReservedSpace) continue;
39440
39581
  if (!emitLayoutDiagnostic(context.layout, node, emit, cssLayoutContentVisibilityNoIntrinsicSize.id, "missingIntrinsicSize", messages156.missingIntrinsicSize, cssLayoutContentVisibilityNoIntrinsicSize.severity)) continue;
@@ -39493,11 +39634,11 @@ function collectConditionalOffsets(layout, node, snapshot) {
39493
39634
  if (!delta.hasConditional || !delta.hasDelta) continue;
39494
39635
  const signal = snapshot.signals.get(name);
39495
39636
  if (!signal) continue;
39496
- if (signal.guard !== "conditional") continue;
39637
+ if (signal.guard.kind !== 1 /* Conditional */) continue;
39497
39638
  if (signal.kind !== "known") continue;
39498
39639
  if (signal.px === null) continue;
39499
39640
  if (Math.abs(signal.px) <= 0.25) continue;
39500
- out.push({ property: name, value: signal.px, guardKey: signal.guardProvenance.key });
39641
+ out.push({ property: name, value: signal.px, guardKey: signal.guard.key });
39501
39642
  }
39502
39643
  return out;
39503
39644
  }
@@ -39518,8 +39659,8 @@ function hasEffectivePositionForConditionalOffset(snapshot, guardKey) {
39518
39659
  const position = snapshot.signals.get("position");
39519
39660
  if (!position) return false;
39520
39661
  if (position.kind !== "known") return false;
39521
- if (position.guard !== "conditional") return false;
39522
- if (position.guardProvenance.key !== guardKey) return false;
39662
+ if (position.guard.kind !== 1 /* Conditional */) return false;
39663
+ if (position.guard.key !== guardKey) return false;
39523
39664
  return position.normalized !== "static";
39524
39665
  }
39525
39666
  function hasStableBaseline(baselineBySignal, property, expectedPx) {