@drskillissue/ganko 0.1.23 → 0.1.25

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.
@@ -2696,7 +2696,7 @@ function resolveMessage(template, data) {
2696
2696
  }
2697
2697
  return result;
2698
2698
  }
2699
- function createDiagnosticFromLoc(file, loc, rule, messageId, message, severity, fix) {
2699
+ function createDiagnosticFromLoc(file, loc, rule, messageId, message, severity, fix, suggest) {
2700
2700
  const result = {
2701
2701
  file,
2702
2702
  rule,
@@ -2706,13 +2706,14 @@ function createDiagnosticFromLoc(file, loc, rule, messageId, message, severity,
2706
2706
  loc: firstLine(loc)
2707
2707
  };
2708
2708
  if (fix !== void 0) result.fix = fix;
2709
+ if (suggest !== void 0 && suggest.length > 0) result.suggest = suggest;
2709
2710
  return result;
2710
2711
  }
2711
- function createDiagnosticFromComment(file, comment, rule, messageId, message, severity, fix) {
2712
- return createDiagnosticFromLoc(file, comment.loc, rule, messageId, message, severity, fix);
2712
+ function createDiagnosticFromComment(file, comment, rule, messageId, message, severity, fix, suggest) {
2713
+ return createDiagnosticFromLoc(file, comment.loc, rule, messageId, message, severity, fix, suggest);
2713
2714
  }
2714
- function createDiagnostic(file, node, rule, messageId, message, severity, fix) {
2715
- return createDiagnosticFromLoc(file, node.loc, rule, messageId, message, severity, fix);
2715
+ function createDiagnostic(file, node, rule, messageId, message, severity, fix, suggest) {
2716
+ return createDiagnosticFromLoc(file, node.loc, rule, messageId, message, severity, fix, suggest);
2716
2717
  }
2717
2718
 
2718
2719
  // src/solid/rule.ts
@@ -7565,9 +7566,9 @@ var CONDITIONAL_MOUNT_TAGS = /* @__PURE__ */ new Set([
7565
7566
  "TabPanel"
7566
7567
  ]);
7567
7568
  var messages16 = {
7568
- 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: ... })",
7569
- 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.",
7570
- 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."
7569
+ 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.",
7570
+ 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.",
7571
+ 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."
7571
7572
  };
7572
7573
  var options16 = {};
7573
7574
  function hasInitialValue(call) {
@@ -7653,7 +7654,8 @@ function analyzeComponentBoundaries(graph, componentName) {
7653
7654
  const result = {
7654
7655
  conditionalMountTag: null,
7655
7656
  suspenseDistance: 0,
7656
- lacksErrorBoundary: false
7657
+ lacksErrorBoundary: false,
7658
+ usagesLackingErrorBoundary: []
7657
7659
  };
7658
7660
  const usages = graph.jsxByTag.get(componentName) ?? [];
7659
7661
  if (usages.length === 0) return result;
@@ -7675,6 +7677,7 @@ function analyzeComponentBoundaries(graph, componentName) {
7675
7677
  foundSuspense = true;
7676
7678
  if (!foundErrorBoundary) {
7677
7679
  result.lacksErrorBoundary = true;
7680
+ result.usagesLackingErrorBoundary.push(usage);
7678
7681
  }
7679
7682
  if (conditionalTag !== null && componentLevels > 1) {
7680
7683
  result.conditionalMountTag = conditionalTag;
@@ -7689,6 +7692,7 @@ function analyzeComponentBoundaries(graph, componentName) {
7689
7692
  }
7690
7693
  if (!foundSuspense && !foundErrorBoundary) {
7691
7694
  result.lacksErrorBoundary = true;
7695
+ result.usagesLackingErrorBoundary.push(usage);
7692
7696
  if (conditionalTag !== null) {
7693
7697
  result.conditionalMountTag = conditionalTag;
7694
7698
  result.suspenseDistance = componentLevels;
@@ -7712,13 +7716,28 @@ function findResourceVariable(graph, name) {
7712
7716
  }
7713
7717
  return null;
7714
7718
  }
7719
+ function buildErrorBoundaryFix(usages, graph) {
7720
+ if (usages.length === 0) return null;
7721
+ const usage = usages[0];
7722
+ if (!usage) return null;
7723
+ const jsxNode = usage.node;
7724
+ const startPos = jsxNode.range[0];
7725
+ const endPos = jsxNode.range[1];
7726
+ const ops = [
7727
+ { range: [startPos, startPos], text: "<ErrorBoundary fallback={<div>Error</div>}>" },
7728
+ { range: [endPos, endPos], text: "</ErrorBoundary>" }
7729
+ ];
7730
+ const importFix = buildSolidImportFix(graph, "ErrorBoundary");
7731
+ if (importFix) ops.unshift(importFix);
7732
+ return ops;
7733
+ }
7715
7734
  var resourceImplicitSuspense = defineSolidRule({
7716
7735
  id: "resource-implicit-suspense",
7717
7736
  severity: "warn",
7718
7737
  messages: messages16,
7719
7738
  meta: {
7720
7739
  description: "Detect createResource that implicitly triggers or permanently breaks Suspense boundaries.",
7721
- fixable: false,
7740
+ fixable: true,
7722
7741
  category: "reactivity"
7723
7742
  },
7724
7743
  options: options16,
@@ -7773,6 +7792,10 @@ var resourceImplicitSuspense = defineSolidRule({
7773
7792
  if (analysis.lacksErrorBoundary) {
7774
7793
  const fetcherFn = resolveFetcherFunction(graph, call);
7775
7794
  if (fetcherFn && fetcherCanThrow(graph, fetcherFn, throwVisited)) {
7795
+ const errorBoundaryFix = buildErrorBoundaryFix(
7796
+ analysis.usagesLackingErrorBoundary,
7797
+ graph
7798
+ );
7776
7799
  emit(
7777
7800
  createDiagnostic(
7778
7801
  graph.file,
@@ -7780,7 +7803,8 @@ var resourceImplicitSuspense = defineSolidRule({
7780
7803
  "resource-implicit-suspense",
7781
7804
  "missingErrorBoundary",
7782
7805
  resolveMessage(messages16.missingErrorBoundary, { name: resourceName }),
7783
- "error"
7806
+ "error",
7807
+ errorBoundaryFix ?? void 0
7784
7808
  )
7785
7809
  );
7786
7810
  }
@@ -30281,7 +30305,168 @@ function collectTransitiveCSSScope(entryPath, resolver, cssFilesByNormalizedPath
30281
30305
  return out;
30282
30306
  }
30283
30307
 
30308
+ // src/cross-file/layout/signal-model.ts
30309
+ var layoutSignalNames = [
30310
+ "line-height",
30311
+ "font-size",
30312
+ "width",
30313
+ "inline-size",
30314
+ "height",
30315
+ "block-size",
30316
+ "min-width",
30317
+ "min-block-size",
30318
+ "min-height",
30319
+ "aspect-ratio",
30320
+ "vertical-align",
30321
+ "display",
30322
+ "white-space",
30323
+ "object-fit",
30324
+ "overflow",
30325
+ "overflow-y",
30326
+ "overflow-anchor",
30327
+ "scrollbar-gutter",
30328
+ "scrollbar-width",
30329
+ "contain-intrinsic-size",
30330
+ "content-visibility",
30331
+ "align-items",
30332
+ "align-self",
30333
+ "justify-items",
30334
+ "place-items",
30335
+ "place-self",
30336
+ "flex-direction",
30337
+ "grid-auto-flow",
30338
+ "appearance",
30339
+ "box-sizing",
30340
+ "padding-top",
30341
+ "padding-left",
30342
+ "padding-right",
30343
+ "padding-bottom",
30344
+ "border-top-width",
30345
+ "border-left-width",
30346
+ "border-right-width",
30347
+ "border-bottom-width",
30348
+ "position",
30349
+ "top",
30350
+ "bottom",
30351
+ "margin-top",
30352
+ "margin-bottom",
30353
+ "transform",
30354
+ "translate",
30355
+ "inset-block-start",
30356
+ "inset-block-end",
30357
+ "writing-mode",
30358
+ "direction"
30359
+ ];
30360
+
30361
+ // src/cross-file/layout/util.ts
30362
+ var CONTROL_ELEMENT_TAGS = /* @__PURE__ */ new Set([
30363
+ "input",
30364
+ "select",
30365
+ "textarea",
30366
+ "button"
30367
+ ]);
30368
+ var INTRINSIC_REPLACED_TAGS = /* @__PURE__ */ new Set([
30369
+ "img",
30370
+ "svg",
30371
+ "video",
30372
+ "canvas",
30373
+ "iframe",
30374
+ "object",
30375
+ "embed"
30376
+ ]);
30377
+ var WHITESPACE_RE3 = /\s+/;
30378
+ function clamp(value2, min, max) {
30379
+ if (value2 < min) return min;
30380
+ if (value2 > max) return max;
30381
+ return value2;
30382
+ }
30383
+ function mergeEvidenceKind(left, right) {
30384
+ return left > right ? left : right;
30385
+ }
30386
+ function selectKth(values, targetIndex) {
30387
+ let left = 0;
30388
+ let right = values.length - 1;
30389
+ while (left <= right) {
30390
+ if (left === right) {
30391
+ const result = values[left];
30392
+ if (result === void 0) return 0;
30393
+ return result;
30394
+ }
30395
+ const pivotIndex = choosePivotIndex(values, left, right);
30396
+ const partitionIndex = partitionAroundPivot(values, left, right, pivotIndex);
30397
+ if (partitionIndex === targetIndex) {
30398
+ const result = values[partitionIndex];
30399
+ if (result === void 0) return 0;
30400
+ return result;
30401
+ }
30402
+ if (partitionIndex < targetIndex) {
30403
+ left = partitionIndex + 1;
30404
+ continue;
30405
+ }
30406
+ right = partitionIndex - 1;
30407
+ }
30408
+ const fallback = values[targetIndex];
30409
+ if (fallback === void 0) return 0;
30410
+ return fallback;
30411
+ }
30412
+ function choosePivotIndex(values, left, right) {
30413
+ const middle = Math.floor((left + right) / 2);
30414
+ const leftValue = values[left] ?? 0;
30415
+ const middleValue = values[middle] ?? 0;
30416
+ const rightValue = values[right] ?? 0;
30417
+ if (leftValue < middleValue) {
30418
+ if (middleValue < rightValue) return middle;
30419
+ if (leftValue < rightValue) return right;
30420
+ return left;
30421
+ }
30422
+ if (leftValue < rightValue) return left;
30423
+ if (middleValue < rightValue) return right;
30424
+ return middle;
30425
+ }
30426
+ function partitionAroundPivot(values, left, right, pivotIndex) {
30427
+ const pivotValue = values[pivotIndex] ?? 0;
30428
+ swap(values, pivotIndex, right);
30429
+ let storeIndex = left;
30430
+ for (let i = left; i < right; i++) {
30431
+ const current = values[i];
30432
+ if (current === void 0 || current > pivotValue) continue;
30433
+ swap(values, storeIndex, i);
30434
+ storeIndex++;
30435
+ }
30436
+ swap(values, storeIndex, right);
30437
+ return storeIndex;
30438
+ }
30439
+ function swap(values, left, right) {
30440
+ if (left === right) return;
30441
+ const leftValue = values[left] ?? 0;
30442
+ const rightValue = values[right] ?? 0;
30443
+ values[left] = rightValue;
30444
+ values[right] = leftValue;
30445
+ }
30446
+ function toComparableExactValue(value2) {
30447
+ if (value2.value !== null) {
30448
+ if (value2.kind !== 0 /* Exact */) return null;
30449
+ return value2.value;
30450
+ }
30451
+ if (value2.kind === 0 /* Exact */) return 0;
30452
+ return null;
30453
+ }
30454
+
30284
30455
  // src/cross-file/layout/perf.ts
30456
+ function createReservoir(capacity) {
30457
+ return { buffer: [], count: 0, capacity };
30458
+ }
30459
+ function reservoirPush(r, value2) {
30460
+ r.count++;
30461
+ if (r.buffer.length < r.capacity) {
30462
+ r.buffer.push(value2);
30463
+ return;
30464
+ }
30465
+ const j = Math.floor(Math.random() * r.count);
30466
+ if (j < r.capacity) {
30467
+ r.buffer[j] = value2;
30468
+ }
30469
+ }
30285
30470
  var EMPTY_STATS = {
30286
30471
  elementsScanned: 0,
30287
30472
  selectorCandidatesChecked: 0,
@@ -30338,7 +30523,7 @@ function createLayoutPerfStats() {
30338
30523
  cohortUnimodalFalse: 0,
30339
30524
  factorCoverageSum: 0,
30340
30525
  factorCoverageCount: 0,
30341
- posteriorWidths: [],
30526
+ posteriorWidths: createReservoir(200),
30342
30527
  uncertaintyEscalations: 0,
30343
30528
  signalSnapshotsBuilt: 0,
30344
30529
  signalSnapshotCacheHits: 0,
@@ -30403,14 +30588,12 @@ function maybeLogLayoutPerf(stats, log) {
30403
30588
  `[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}`
30404
30589
  );
30405
30590
  }
30406
- function computeP95(values) {
30407
- if (values.length === 0) return 0;
30408
- const sorted = [...values];
30409
- sorted.sort((left, right) => left - right);
30410
- const index = Math.ceil(sorted.length * 0.95) - 1;
30411
- if (index <= 0) return sorted[0] ?? 0;
30412
- if (index >= sorted.length) return sorted[sorted.length - 1] ?? 0;
30413
- return sorted[index] ?? 0;
30591
+ function computeP95(sampler) {
30592
+ if (sampler.buffer.length === 0) return 0;
30593
+ const scratch = [...sampler.buffer];
30594
+ const index = Math.ceil(scratch.length * 0.95) - 1;
30595
+ const clamped = index <= 0 ? 0 : index >= scratch.length ? scratch.length - 1 : index;
30596
+ return selectKth(scratch, clamped);
30414
30597
  }
30415
30598
 
30416
30599
  // src/cross-file/layout/component-host.ts
@@ -31519,98 +31702,47 @@ function expandShorthand(property, value2) {
31519
31702
  { name: blockTarget[1], value: parsed.end }
31520
31703
  ];
31521
31704
  }
31705
+ if (property === "flex-flow") {
31706
+ return expandFlexFlow(value2);
31707
+ }
31522
31708
  return void 0;
31523
31709
  }
31710
+ var FLEX_DIRECTION_VALUES = /* @__PURE__ */ new Set(["row", "row-reverse", "column", "column-reverse"]);
31711
+ function expandFlexFlow(value2) {
31712
+ const tokens = splitWhitespaceTokens(value2.trim().toLowerCase());
31713
+ if (tokens.length === 0) return null;
31714
+ if (tokens.length > 2) return null;
31715
+ let direction = null;
31716
+ let wrap = null;
31717
+ for (let i = 0; i < tokens.length; i++) {
31718
+ const token = tokens[i];
31719
+ if (!token) continue;
31720
+ if (FLEX_DIRECTION_VALUES.has(token)) {
31721
+ if (direction !== null) return null;
31722
+ direction = token;
31723
+ } else {
31724
+ if (wrap !== null) return null;
31725
+ wrap = token;
31726
+ }
31727
+ }
31728
+ const out = [];
31729
+ if (direction !== null) {
31730
+ out.push({ name: "flex-direction", value: direction });
31731
+ }
31732
+ if (wrap !== null) {
31733
+ out.push({ name: "flex-wrap", value: wrap });
31734
+ }
31735
+ return out.length > 0 ? out : null;
31736
+ }
31524
31737
  function getShorthandLonghandNames(property) {
31525
31738
  const quad = QUAD_EXPANSIONS.get(property);
31526
31739
  if (quad !== void 0) return [...quad];
31527
31740
  const block = BLOCK_EXPANSIONS.get(property);
31528
31741
  if (block !== void 0) return [...block];
31742
+ if (property === "flex-flow") return ["flex-direction", "flex-wrap"];
31529
31743
  return null;
31530
31744
  }
31531
31745
 
31532
- // src/cross-file/layout/util.ts
31533
- var CONTROL_ELEMENT_TAGS = /* @__PURE__ */ new Set([
31534
- "input",
31535
- "select",
31536
- "textarea",
31537
- "button"
31538
- ]);
31539
- function clamp(value2, min, max) {
31540
- if (value2 < min) return min;
31541
- if (value2 > max) return max;
31542
- return value2;
31543
- }
31544
- function kindRank(kind) {
31545
- if (kind === "exact") return 0;
31546
- if (kind === "interval") return 1;
31547
- if (kind === "conditional") return 2;
31548
- return 3;
31549
- }
31550
- function mergeEvidenceKind(left, right) {
31551
- if (kindRank(left) >= kindRank(right)) return left;
31552
- return right;
31553
- }
31554
- function toComparableExactValue(value2) {
31555
- if (value2.value !== null) {
31556
- if (value2.kind !== "exact") return null;
31557
- return value2.value;
31558
- }
31559
- if (value2.kind === "exact") return 0;
31560
- return null;
31561
- }
31562
-
31563
- // src/cross-file/layout/signal-model.ts
31564
- var layoutSignalNames = [
31565
- "line-height",
31566
- "font-size",
31567
- "width",
31568
- "inline-size",
31569
- "height",
31570
- "block-size",
31571
- "min-width",
31572
- "min-block-size",
31573
- "min-height",
31574
- "aspect-ratio",
31575
- "vertical-align",
31576
- "display",
31577
- "white-space",
31578
- "object-fit",
31579
- "overflow",
31580
- "overflow-y",
31581
- "overflow-anchor",
31582
- "scrollbar-gutter",
31583
- "scrollbar-width",
31584
- "contain-intrinsic-size",
31585
- "content-visibility",
31586
- "align-items",
31587
- "align-self",
31588
- "justify-items",
31589
- "place-items",
31590
- "place-self",
31591
- "appearance",
31592
- "box-sizing",
31593
- "padding-top",
31594
- "padding-left",
31595
- "padding-right",
31596
- "padding-bottom",
31597
- "border-top-width",
31598
- "border-left-width",
31599
- "border-right-width",
31600
- "border-bottom-width",
31601
- "position",
31602
- "top",
31603
- "bottom",
31604
- "margin-top",
31605
- "margin-bottom",
31606
- "transform",
31607
- "translate",
31608
- "inset-block-start",
31609
- "inset-block-end",
31610
- "writing-mode",
31611
- "direction"
31612
- ];
31613
-
31614
31746
  // src/cross-file/layout/signal-normalization.ts
31615
31747
  var MONITORED_SIGNAL_SET = new Set(layoutSignalNames);
31616
31748
  var MONITORED_SIGNAL_NAME_MAP = new Map(
@@ -31621,7 +31753,8 @@ var MONITORED_SHORTHAND_SET = /* @__PURE__ */ new Set([
31621
31753
  "border-width",
31622
31754
  "margin-block",
31623
31755
  "padding-block",
31624
- "inset-block"
31756
+ "inset-block",
31757
+ "flex-flow"
31625
31758
  ]);
31626
31759
  var LENGTH_SIGNAL_SET = /* @__PURE__ */ new Set([
31627
31760
  "font-size",
@@ -31663,13 +31796,22 @@ var KEYWORD_SIGNAL_SET = /* @__PURE__ */ new Set([
31663
31796
  "justify-items",
31664
31797
  "place-items",
31665
31798
  "place-self",
31799
+ "flex-direction",
31800
+ "grid-auto-flow",
31666
31801
  "appearance",
31667
31802
  "box-sizing",
31668
31803
  "position",
31669
31804
  "writing-mode",
31670
31805
  "direction"
31671
31806
  ]);
31672
- var REPLACED_TAGS = /* @__PURE__ */ new Set(["input", "select", "textarea", "button", "img", "video", "canvas", "svg", "iframe"]);
31807
+ var REPLACED_ELEMENT_TAGS = /* @__PURE__ */ new Set([
31808
+ ...CONTROL_ELEMENT_TAGS,
31809
+ "img",
31810
+ "video",
31811
+ "canvas",
31812
+ "svg",
31813
+ "iframe"
31814
+ ]);
31673
31815
  function isMonitoredSignal(property) {
31674
31816
  if (MONITORED_SIGNAL_SET.has(property)) return true;
31675
31817
  return MONITORED_SHORTHAND_SET.has(property);
@@ -31680,7 +31822,7 @@ function isControlTag(tag) {
31680
31822
  }
31681
31823
  function isReplacedTag(tag) {
31682
31824
  if (tag === null) return false;
31683
- return REPLACED_TAGS.has(tag.toLowerCase());
31825
+ return REPLACED_ELEMENT_TAGS.has(tag.toLowerCase());
31684
31826
  }
31685
31827
  function normalizeSignalMapWithCounts(values) {
31686
31828
  const out = /* @__PURE__ */ new Map();
@@ -31691,12 +31833,11 @@ function normalizeSignalMapWithCounts(values) {
31691
31833
  "font-size",
31692
31834
  fontSizeEntry.value,
31693
31835
  fontSizeEntry.source,
31694
- fontSizeEntry.guard,
31695
31836
  fontSizeEntry.guardProvenance,
31696
31837
  null
31697
31838
  );
31698
31839
  out.set("font-size", parsedFontSize);
31699
- if (parsedFontSize.kind === "known" && parsedFontSize.guard === "unconditional") {
31840
+ if (parsedFontSize.kind === "known" && parsedFontSize.guard.kind === 0 /* Unconditional */) {
31700
31841
  fontSizePx = parsedFontSize.px;
31701
31842
  }
31702
31843
  }
@@ -31712,7 +31853,6 @@ function normalizeSignalMapWithCounts(values) {
31712
31853
  name,
31713
31854
  declaration.value,
31714
31855
  declaration.source,
31715
- declaration.guard,
31716
31856
  declaration.guardProvenance,
31717
31857
  fontSizePx
31718
31858
  );
@@ -31722,7 +31862,7 @@ function normalizeSignalMapWithCounts(values) {
31722
31862
  let unknownSignalCount = 0;
31723
31863
  let conditionalSignalCount = 0;
31724
31864
  for (const value2 of out.values()) {
31725
- if (value2.guard === "conditional") {
31865
+ if (value2.guard.kind === 1 /* Conditional */) {
31726
31866
  conditionalSignalCount++;
31727
31867
  continue;
31728
31868
  }
@@ -31750,7 +31890,7 @@ function applyExpandedShorthand(out, property, declaration, fontSizePx) {
31750
31890
  if (!longhand) continue;
31751
31891
  const name = MONITORED_SIGNAL_NAME_MAP.get(longhand);
31752
31892
  if (name === void 0) continue;
31753
- out.set(name, createUnknown(name, declaration.value, declaration.source, declaration.guard, declaration.guardProvenance, reason));
31893
+ out.set(name, createUnknown(name, declaration.source, declaration.guardProvenance, reason));
31754
31894
  }
31755
31895
  return;
31756
31896
  }
@@ -31760,127 +31900,139 @@ function applyExpandedShorthand(out, property, declaration, fontSizePx) {
31760
31900
  if (!entry) continue;
31761
31901
  const name = MONITORED_SIGNAL_NAME_MAP.get(entry.name);
31762
31902
  if (name === void 0) continue;
31763
- out.set(name, normalizeSignal(name, entry.value, declaration.source, declaration.guard, declaration.guardProvenance, fontSizePx));
31903
+ out.set(name, normalizeSignal(name, entry.value, declaration.source, declaration.guardProvenance, fontSizePx));
31764
31904
  }
31765
31905
  }
31766
31906
  function toMonitoredSignalName(property) {
31767
31907
  return MONITORED_SIGNAL_NAME_MAP.get(property) ?? null;
31768
31908
  }
31769
- function normalizeSignal(name, raw, source, guard, guardProvenance, fontSizePx) {
31909
+ function normalizeSignal(name, raw, source, guard, fontSizePx) {
31770
31910
  switch (name) {
31771
31911
  case "line-height":
31772
- return parseLineHeight(name, raw, source, guard, guardProvenance, fontSizePx);
31912
+ return parseLineHeight(name, raw, source, guard, fontSizePx);
31773
31913
  case "aspect-ratio":
31774
- return parseAspectRatio(name, raw, source, guard, guardProvenance);
31914
+ return parseAspectRatio(name, raw, source, guard);
31775
31915
  case "contain-intrinsic-size":
31776
- return parseContainIntrinsicSize(name, raw, source, guard, guardProvenance);
31916
+ return parseContainIntrinsicSize(name, raw, source, guard);
31777
31917
  case "transform":
31778
- return parseTransform(name, raw, source, guard, guardProvenance);
31918
+ return parseTransform(name, raw, source, guard);
31779
31919
  case "translate":
31780
- return parseTranslateProperty(name, raw, source, guard, guardProvenance);
31920
+ return parseTranslateProperty(name, raw, source, guard);
31781
31921
  default:
31782
31922
  break;
31783
31923
  }
31784
- if (LENGTH_SIGNAL_SET.has(name)) return parseLength(name, raw, source, guard, guardProvenance);
31785
- if (KEYWORD_SIGNAL_SET.has(name)) return parseKeyword(name, raw, source, guard, guardProvenance);
31786
- return createUnknown(name, raw, source, guard, guardProvenance, "unsupported signal");
31924
+ if (LENGTH_SIGNAL_SET.has(name)) return parseLength(name, raw, source, guard);
31925
+ if (KEYWORD_SIGNAL_SET.has(name)) return parseKeyword(name, raw, source, guard);
31926
+ return createUnknown(name, source, guard, "unsupported signal");
31787
31927
  }
31788
- function parseAspectRatio(name, raw, source, guard, guardProvenance) {
31928
+ function parseAspectRatio(name, raw, source, guard) {
31789
31929
  const trimmed = raw.trim().toLowerCase();
31790
31930
  if (trimmed.length === 0) {
31791
- return createUnknown(name, raw, source, guard, guardProvenance, "aspect-ratio value is empty");
31931
+ return createUnknown(name, source, guard, "aspect-ratio value is empty");
31792
31932
  }
31793
31933
  if (hasDynamicExpression(trimmed)) {
31794
- return createUnknown(name, raw, source, guard, guardProvenance, "aspect-ratio uses runtime-dependent function");
31934
+ return createUnknown(name, source, guard, "aspect-ratio uses runtime-dependent function");
31795
31935
  }
31796
31936
  if (trimmed === "auto") {
31797
- return createUnknown(name, raw, source, guard, guardProvenance, "aspect-ratio auto does not reserve ratio");
31937
+ return createUnknown(name, source, guard, "aspect-ratio auto does not reserve ratio");
31798
31938
  }
31799
31939
  const slash = trimmed.indexOf("/");
31800
31940
  if (slash !== -1) {
31801
31941
  const left = Number(trimmed.slice(0, slash).trim());
31802
31942
  const right = Number(trimmed.slice(slash + 1).trim());
31803
31943
  if (!Number.isFinite(left) || !Number.isFinite(right) || left <= 0 || right <= 0) {
31804
- return createUnknown(name, raw, source, guard, guardProvenance, "aspect-ratio ratio is invalid");
31944
+ return createUnknown(name, source, guard, "aspect-ratio ratio is invalid");
31805
31945
  }
31806
- return createKnown(name, raw, source, guard, guardProvenance, null, "unitless", "exact");
31946
+ return createKnown(name, raw, source, guard, null, 1 /* Unitless */, "exact");
31807
31947
  }
31808
31948
  const ratio = Number(trimmed);
31809
31949
  if (!Number.isFinite(ratio) || ratio <= 0) {
31810
- return createUnknown(name, raw, source, guard, guardProvenance, "aspect-ratio is not statically parseable");
31950
+ return createUnknown(name, source, guard, "aspect-ratio is not statically parseable");
31811
31951
  }
31812
- return createKnown(name, raw, source, guard, guardProvenance, null, "unitless", "exact");
31952
+ return createKnown(name, raw, source, guard, null, 1 /* Unitless */, "exact");
31813
31953
  }
31814
- function parseContainIntrinsicSize(name, raw, source, guard, guardProvenance) {
31954
+ function parseContainIntrinsicSize(name, raw, source, guard) {
31815
31955
  const trimmed = raw.trim().toLowerCase();
31816
31956
  if (trimmed.length === 0) {
31817
- return createUnknown(name, raw, source, guard, guardProvenance, "contain-intrinsic-size value is empty");
31957
+ return createUnknown(name, source, guard, "contain-intrinsic-size value is empty");
31818
31958
  }
31819
31959
  if (hasDynamicExpression(trimmed)) {
31820
- return createUnknown(name, raw, source, guard, guardProvenance, "contain-intrinsic-size uses runtime-dependent function");
31960
+ return createUnknown(name, source, guard, "contain-intrinsic-size uses runtime-dependent function");
31821
31961
  }
31822
31962
  if (trimmed === "none" || trimmed === "auto") {
31823
- return createUnknown(name, raw, source, guard, guardProvenance, "contain-intrinsic-size does not reserve space");
31963
+ return createUnknown(name, source, guard, "contain-intrinsic-size does not reserve space");
31824
31964
  }
31825
31965
  const parts = splitWhitespaceTokens(trimmed);
31826
31966
  for (let i = 0; i < parts.length; i++) {
31827
31967
  const part = parts[i];
31828
31968
  if (!part) continue;
31829
31969
  const px = parseSignedPxValue(part);
31830
- if (px !== null) return createKnown(name, raw, source, guard, guardProvenance, px, "px", "exact");
31970
+ if (px !== null) return createKnown(name, raw, source, guard, px, 0 /* Px */, "exact");
31831
31971
  }
31832
- return createUnknown(name, raw, source, guard, guardProvenance, "contain-intrinsic-size is not statically parseable in px");
31972
+ return createUnknown(name, source, guard, "contain-intrinsic-size is not statically parseable in px");
31833
31973
  }
31834
- function parseLineHeight(name, raw, source, guard, guardProvenance, fontSizePx) {
31974
+ function parseLineHeight(name, raw, source, guard, fontSizePx) {
31835
31975
  const unitless = parseUnitlessValue(raw);
31836
31976
  if (unitless !== null) {
31837
31977
  const base = fontSizePx === null ? 16 : fontSizePx;
31838
- return createKnown(name, raw, source, guard, guardProvenance, unitless * base, "unitless", "estimated");
31978
+ return createKnown(name, raw, source, guard, unitless * base, 1 /* Unitless */, "estimated");
31839
31979
  }
31840
31980
  const px = parseSignedPxValue(raw);
31841
- if (px !== null) return createKnown(name, raw, source, guard, guardProvenance, px, "px", "exact");
31842
- return createUnknown(name, raw, source, guard, guardProvenance, "line-height is not statically parseable");
31981
+ if (px !== null) return createKnown(name, raw, source, guard, px, 0 /* Px */, "exact");
31982
+ return createUnknown(name, source, guard, "line-height is not statically parseable");
31843
31983
  }
31844
- function parseLength(name, raw, source, guard, guardProvenance) {
31984
+ var DIMENSION_KEYWORD_SET = /* @__PURE__ */ new Set([
31985
+ "auto",
31986
+ "none",
31987
+ "fit-content",
31988
+ "min-content",
31989
+ "max-content",
31990
+ "stretch"
31991
+ ]);
31992
+ function parseLength(name, raw, source, guard) {
31845
31993
  const px = parseSignedPxValue(raw);
31846
- if (px === null) {
31847
- return createUnknown(name, raw, source, guard, guardProvenance, "length is not statically parseable in px");
31994
+ if (px !== null) {
31995
+ return createKnown(name, raw, source, guard, px, 0 /* Px */, "exact");
31848
31996
  }
31849
- return createKnown(name, raw, source, guard, guardProvenance, px, "px", "exact");
31997
+ const normalized = raw.trim().toLowerCase();
31998
+ if (DIMENSION_KEYWORD_SET.has(normalized) || normalized.startsWith("fit-content(")) {
31999
+ return createKnown(name, raw, source, guard, null, 2 /* Keyword */, "exact");
32000
+ }
32001
+ return createUnknown(name, source, guard, "length is not statically parseable in px");
31850
32002
  }
31851
- function parseKeyword(name, raw, source, guard, guardProvenance) {
32003
+ function parseKeyword(name, raw, source, guard) {
31852
32004
  const normalized = raw.trim().toLowerCase();
31853
32005
  if (normalized.length === 0) {
31854
- return createUnknown(name, raw, source, guard, guardProvenance, "keyword value is empty");
32006
+ return createUnknown(name, source, guard, "keyword value is empty");
31855
32007
  }
31856
32008
  if (hasDynamicExpression(normalized)) {
31857
- return createUnknown(name, raw, source, guard, guardProvenance, "keyword uses runtime-dependent function");
32009
+ return createUnknown(name, source, guard, "keyword uses runtime-dependent function");
31858
32010
  }
31859
- return createKnown(name, raw, source, guard, guardProvenance, null, "keyword", "exact");
32011
+ return createKnown(name, raw, source, guard, null, 2 /* Keyword */, "exact");
31860
32012
  }
31861
- function parseTransform(name, raw, source, guard, guardProvenance) {
32013
+ function parseTransform(name, raw, source, guard) {
31862
32014
  const normalized = raw.trim().toLowerCase();
31863
32015
  if (normalized.length === 0) {
31864
- return createUnknown(name, raw, source, guard, guardProvenance, "transform value is empty");
32016
+ return createUnknown(name, source, guard, "transform value is empty");
31865
32017
  }
31866
32018
  if (hasDynamicExpression(normalized)) {
31867
- return createUnknown(name, raw, source, guard, guardProvenance, "transform uses runtime-dependent function");
32019
+ return createUnknown(name, source, guard, "transform uses runtime-dependent function");
31868
32020
  }
31869
32021
  const y = extractTransformYPx(normalized);
31870
- if (y !== null) return createKnown(name, raw, source, guard, guardProvenance, y, "px", "exact");
31871
- return createUnknown(name, raw, source, guard, guardProvenance, "transform has non-translational or non-px functions");
32022
+ if (y !== null) return createKnown(name, raw, source, guard, y, 0 /* Px */, "exact");
32023
+ return createUnknown(name, source, guard, "transform has non-translational or non-px functions");
31872
32024
  }
31873
- function parseTranslateProperty(name, raw, source, guard, guardProvenance) {
32025
+ function parseTranslateProperty(name, raw, source, guard) {
31874
32026
  const trimmed = raw.trim().toLowerCase();
31875
32027
  if (trimmed.length === 0) {
31876
- return createUnknown(name, raw, source, guard, guardProvenance, "translate value is empty");
32028
+ return createUnknown(name, source, guard, "translate value is empty");
31877
32029
  }
31878
32030
  if (hasDynamicExpression(trimmed)) {
31879
- return createUnknown(name, raw, source, guard, guardProvenance, "translate uses runtime-dependent function");
32031
+ return createUnknown(name, source, guard, "translate uses runtime-dependent function");
31880
32032
  }
31881
32033
  const y = extractTranslatePropertyYPx(trimmed);
31882
- if (y !== null) return createKnown(name, raw, source, guard, guardProvenance, y, "px", "exact");
31883
- return createUnknown(name, raw, source, guard, guardProvenance, "translate property vertical component is not px");
32034
+ if (y !== null) return createKnown(name, raw, source, guard, y, 0 /* Px */, "exact");
32035
+ return createUnknown(name, source, guard, "translate property vertical component is not px");
31884
32036
  }
31885
32037
  function hasDynamicExpression(raw) {
31886
32038
  if (raw.includes("var(")) return true;
@@ -31892,28 +32044,24 @@ function hasDynamicExpression(raw) {
31892
32044
  if (raw.includes("clamp(")) return true;
31893
32045
  return false;
31894
32046
  }
31895
- function createKnown(name, raw, source, guard, guardProvenance, px, unit, quality) {
32047
+ function createKnown(name, raw, source, guard, px, unit, quality) {
31896
32048
  return {
31897
32049
  kind: "known",
31898
32050
  name,
31899
- raw,
31900
32051
  normalized: raw.trim().toLowerCase(),
31901
32052
  source,
31902
32053
  guard,
31903
- guardProvenance,
31904
32054
  unit,
31905
32055
  px,
31906
32056
  quality
31907
32057
  };
31908
32058
  }
31909
- function createUnknown(name, raw, source, guard, guardProvenance, reason) {
32059
+ function createUnknown(name, source, guard, reason) {
31910
32060
  return {
31911
32061
  kind: "unknown",
31912
32062
  name,
31913
- raw,
31914
32063
  source,
31915
32064
  guard,
31916
- guardProvenance,
31917
32065
  reason
31918
32066
  };
31919
32067
  }
@@ -32874,16 +33022,16 @@ function includesAttributeWord(value2, word) {
32874
33022
 
32875
33023
  // src/cross-file/layout/guard-model.ts
32876
33024
  var UNCONDITIONAL_GUARD = {
32877
- kind: "unconditional",
33025
+ kind: 0 /* Unconditional */,
32878
33026
  conditions: [],
32879
33027
  key: "always"
32880
33028
  };
32881
- var WHITESPACE_RE3 = /\s+/g;
33029
+ var WHITESPACE_RE_GLOBAL = /\s+/g;
32882
33030
  function resolveRuleGuard(rule) {
32883
33031
  const conditions = collectRuleConditions(rule);
32884
33032
  if (conditions.length === 0) return UNCONDITIONAL_GUARD;
32885
33033
  return {
32886
- kind: "conditional",
33034
+ kind: 1 /* Conditional */,
32887
33035
  conditions,
32888
33036
  key: conditions.map((condition) => condition.key).join("&")
32889
33037
  };
@@ -32937,7 +33085,7 @@ function buildCondition(kind, query) {
32937
33085
  }
32938
33086
  function normalizeQuery(query) {
32939
33087
  if (query === null) return null;
32940
- const normalized = query.trim().toLowerCase().replace(WHITESPACE_RE3, " ");
33088
+ const normalized = query.trim().toLowerCase().replace(WHITESPACE_RE_GLOBAL, " ");
32941
33089
  if (normalized.length === 0) return null;
32942
33090
  return normalized;
32943
33091
  }
@@ -32989,13 +33137,7 @@ function buildSnapshotForNode(node, cascadeByElementNode, snapshotByElementNode,
32989
33137
  const unknownSignalCount = normalized.unknownSignalCount + inherited.unknownDelta;
32990
33138
  const conditionalSignalCount = normalized.conditionalSignalCount + inherited.conditionalDelta;
32991
33139
  const snapshot = {
32992
- solidFile: node.solidFile,
32993
- elementId: node.elementId,
32994
- elementKey: node.key,
32995
- tag: node.tag,
32996
- textualContent: node.textualContent,
32997
- isControl: node.isControl,
32998
- isReplaced: node.isReplaced,
33140
+ node,
32999
33141
  signals: inherited.signals,
33000
33142
  knownSignalCount,
33001
33143
  unknownSignalCount,
@@ -33026,7 +33168,7 @@ function inheritSignalsFromParent(parentSnapshot, local) {
33026
33168
  if (!inheritedValue) continue;
33027
33169
  if (out === null) out = new Map(local);
33028
33170
  out.set(signal, inheritedValue);
33029
- if (inheritedValue.guard === "conditional") {
33171
+ if (inheritedValue.guard.kind === 1 /* Conditional */) {
33030
33172
  conditionalDelta++;
33031
33173
  continue;
33032
33174
  }
@@ -33052,6 +33194,11 @@ function inheritSignalsFromParent(parentSnapshot, local) {
33052
33194
  };
33053
33195
  }
33054
33196
 
33197
+ // src/cross-file/layout/context-model.ts
33198
+ function deriveAlignmentContext(base, overrides) {
33199
+ return { ...base, ...overrides };
33200
+ }
33201
+
33055
33202
  // src/cross-file/layout/signal-access.ts
33056
33203
  var EMPTY_STRING_LIST = Object.freeze([]);
33057
33204
  var EMPTY_LAYOUT_NODE_LIST = Object.freeze([]);
@@ -33070,7 +33217,7 @@ var EMPTY_LAYOUT_RESERVED_SPACE_FACT = Object.freeze({
33070
33217
  });
33071
33218
  var EMPTY_LAYOUT_SCROLL_CONTAINER_FACT = Object.freeze({
33072
33219
  isScrollContainer: false,
33073
- axis: "none",
33220
+ axis: 0 /* None */,
33074
33221
  overflow: null,
33075
33222
  overflowY: null,
33076
33223
  hasConditionalScroll: false,
@@ -33103,53 +33250,28 @@ function readKnownSignalWithGuard(snapshot, name) {
33103
33250
  return value2;
33104
33251
  }
33105
33252
  function toEvidenceKind(value2) {
33106
- if (value2.guard === "conditional") return "conditional";
33107
- if (value2.quality === "estimated") return "interval";
33108
- return "exact";
33109
- }
33110
- function readNumericSignalEvidence(snapshot, name) {
33111
- const value2 = snapshot.signals.get(name);
33112
- if (!value2) {
33113
- return {
33114
- value: null,
33115
- kind: "unknown"
33116
- };
33117
- }
33118
- if (value2.kind !== "known") {
33119
- if (value2.guard === "conditional") {
33120
- return {
33121
- value: null,
33122
- kind: "conditional"
33123
- };
33124
- }
33125
- return {
33126
- value: null,
33127
- kind: "unknown"
33128
- };
33129
- }
33130
- return {
33131
- value: value2.px,
33132
- kind: toEvidenceKind(value2)
33133
- };
33253
+ if (value2.guard.kind === 1 /* Conditional */) return 2 /* Conditional */;
33254
+ if (value2.quality === "estimated") return 1 /* Interval */;
33255
+ return 0 /* Exact */;
33134
33256
  }
33135
33257
  function readNormalizedSignalEvidence(snapshot, name) {
33136
33258
  const value2 = snapshot.signals.get(name);
33137
33259
  if (!value2) {
33138
33260
  return {
33139
33261
  value: null,
33140
- kind: "unknown"
33262
+ kind: 3 /* Unknown */
33141
33263
  };
33142
33264
  }
33143
33265
  if (value2.kind !== "known") {
33144
- if (value2.guard === "conditional") {
33266
+ if (value2.guard.kind === 1 /* Conditional */) {
33145
33267
  return {
33146
33268
  value: null,
33147
- kind: "conditional"
33269
+ kind: 2 /* Conditional */
33148
33270
  };
33149
33271
  }
33150
33272
  return {
33151
33273
  value: null,
33152
- kind: "unknown"
33274
+ kind: 3 /* Unknown */
33153
33275
  };
33154
33276
  }
33155
33277
  return {
@@ -33160,7 +33282,7 @@ function readNormalizedSignalEvidence(snapshot, name) {
33160
33282
  function readKnownSignal(snapshot, name) {
33161
33283
  const value2 = readKnownSignalWithGuard(snapshot, name);
33162
33284
  if (!value2) return null;
33163
- if (value2.guard !== "unconditional") return null;
33285
+ if (value2.guard.kind !== 0 /* Unconditional */) return null;
33164
33286
  return value2;
33165
33287
  }
33166
33288
  function readKnownPx(snapshot, name) {
@@ -33194,19 +33316,19 @@ function hasEffectivePosition(snapshot) {
33194
33316
  return position !== "static";
33195
33317
  }
33196
33318
  function readReservedSpaceFact(graph, node) {
33197
- return graph.reservedSpaceFactsByElementKey.get(node.key) ?? EMPTY_LAYOUT_RESERVED_SPACE_FACT;
33319
+ return graph.reservedSpaceFactsByNode.get(node) ?? EMPTY_LAYOUT_RESERVED_SPACE_FACT;
33198
33320
  }
33199
33321
  function readScrollContainerFact(graph, node) {
33200
- return graph.scrollContainerFactsByElementKey.get(node.key) ?? EMPTY_LAYOUT_SCROLL_CONTAINER_FACT;
33322
+ return graph.scrollContainerFactsByNode.get(node) ?? EMPTY_LAYOUT_SCROLL_CONTAINER_FACT;
33201
33323
  }
33202
33324
  function readFlowParticipationFact(graph, node) {
33203
- return graph.flowParticipationFactsByElementKey.get(node.key) ?? EMPTY_LAYOUT_FLOW_PARTICIPATION_FACT;
33325
+ return graph.flowParticipationFactsByNode.get(node) ?? EMPTY_LAYOUT_FLOW_PARTICIPATION_FACT;
33204
33326
  }
33205
33327
  function readContainingBlockFact(graph, node) {
33206
- return graph.containingBlockFactsByElementKey.get(node.key) ?? EMPTY_LAYOUT_CONTAINING_BLOCK_FACT;
33328
+ return graph.containingBlockFactsByNode.get(node) ?? EMPTY_LAYOUT_CONTAINING_BLOCK_FACT;
33207
33329
  }
33208
33330
  function readConditionalSignalDeltaFact(graph, node, name) {
33209
- const byProperty = graph.conditionalSignalDeltaFactsByElementKey.get(node.key);
33331
+ const byProperty = graph.conditionalSignalDeltaFactsByNode.get(node);
33210
33332
  if (!byProperty) return EMPTY_LAYOUT_CONDITIONAL_DELTA_FACT;
33211
33333
  return byProperty.get(name) ?? EMPTY_LAYOUT_CONDITIONAL_DELTA_FACT;
33212
33334
  }
@@ -33234,7 +33356,7 @@ function readScrollContainerElements(graph) {
33234
33356
  return graph.scrollContainerElements;
33235
33357
  }
33236
33358
  function readBaselineOffsetFacts(graph, node) {
33237
- return graph.baselineOffsetFactsByElementKey.get(node.key) ?? EMPTY_BASELINE_FACTS;
33359
+ return graph.baselineOffsetFactsByNode.get(node) ?? EMPTY_BASELINE_FACTS;
33238
33360
  }
33239
33361
  function readElementRef(graph, node) {
33240
33362
  return readElementRefById(graph, node.solidFile, node.elementId);
@@ -33256,7 +33378,6 @@ function readStatefulBaseValueIndex(graph) {
33256
33378
  }
33257
33379
 
33258
33380
  // src/cross-file/layout/context-classification.ts
33259
- var WHITESPACE_RE4 = /\s+/;
33260
33381
  var TABLE_SEMANTIC_TAGS = /* @__PURE__ */ new Set(["table", "thead", "tbody", "tfoot", "tr", "td", "th"]);
33261
33382
  var TABLE_DISPLAY_VALUES = /* @__PURE__ */ new Set([
33262
33383
  "table",
@@ -33273,7 +33394,6 @@ var TABLE_DISPLAY_VALUES = /* @__PURE__ */ new Set([
33273
33394
  var FLEX_DISPLAY_VALUES = /* @__PURE__ */ new Set(["flex", "inline-flex"]);
33274
33395
  var GRID_DISPLAY_VALUES = /* @__PURE__ */ new Set(["grid", "inline-grid"]);
33275
33396
  var INLINE_DISPLAY_VALUES = /* @__PURE__ */ new Set(["inline", "inline-block", "inline-list-item"]);
33276
- var DISPLAY_TOKEN_SPLIT_RE = /\s+/;
33277
33397
  function createAlignmentContextForParent(parent, snapshot) {
33278
33398
  const axis = resolveAxis(snapshot);
33279
33399
  const inlineDirection = resolveInlineDirection(snapshot);
@@ -33296,6 +33416,7 @@ function createAlignmentContextForParent(parent, snapshot) {
33296
33416
  const contextCertainty = combineCertainty(classified.certainty, axis.certainty);
33297
33417
  const certainty = combineCertainty(contextCertainty, inlineDirection.certainty);
33298
33418
  const baselineRelevance = computeBaselineRelevance(classified.kind, parentAlignItems, parentPlaceItems);
33419
+ const crossAxisInfo = resolveCrossAxisIsBlockAxis(classified.kind, snapshot, axis.value);
33299
33420
  const out = {
33300
33421
  kind: classified.kind,
33301
33422
  certainty,
@@ -33311,6 +33432,8 @@ function createAlignmentContextForParent(parent, snapshot) {
33311
33432
  parentAlignItems,
33312
33433
  parentPlaceItems,
33313
33434
  hasPositionedOffset: positionedOffset.hasPositionedOffset,
33435
+ crossAxisIsBlockAxis: crossAxisInfo.value,
33436
+ crossAxisIsBlockAxisCertainty: crossAxisInfo.certainty,
33314
33437
  baselineRelevance,
33315
33438
  evidence
33316
33439
  };
@@ -33320,7 +33443,7 @@ function classifyKind(evidence) {
33320
33443
  if (evidence.hasTableSemantics) {
33321
33444
  return {
33322
33445
  kind: "table-cell",
33323
- certainty: "resolved"
33446
+ certainty: 0 /* Resolved */
33324
33447
  };
33325
33448
  }
33326
33449
  if (evidence.containerKind === "table") {
@@ -33407,7 +33530,7 @@ function resolveContainerKind(parentDisplay, certainty) {
33407
33530
  certainty
33408
33531
  };
33409
33532
  }
33410
- const tokens = display.split(DISPLAY_TOKEN_SPLIT_RE);
33533
+ const tokens = display.split(WHITESPACE_RE3);
33411
33534
  if (tokens.length === 2) {
33412
33535
  const outside = tokens[0];
33413
33536
  const inside = tokens[1];
@@ -33457,7 +33580,7 @@ function resolveAxis(snapshot) {
33457
33580
  if (!snapshot.signals.has("writing-mode")) {
33458
33581
  return {
33459
33582
  value: "horizontal-tb",
33460
- certainty: "resolved"
33583
+ certainty: 0 /* Resolved */
33461
33584
  };
33462
33585
  }
33463
33586
  const writingMode = readNormalizedSignalEvidence(snapshot, "writing-mode");
@@ -33482,7 +33605,7 @@ function resolveInlineDirection(snapshot) {
33482
33605
  if (!snapshot.signals.has("direction")) {
33483
33606
  return {
33484
33607
  value: "ltr",
33485
- certainty: "resolved"
33608
+ certainty: 0 /* Resolved */
33486
33609
  };
33487
33610
  }
33488
33611
  const direction = readNormalizedSignalEvidence(snapshot, "direction");
@@ -33498,16 +33621,16 @@ function resolveInlineDirection(snapshot) {
33498
33621
  };
33499
33622
  }
33500
33623
  function toContextCertainty(kind) {
33501
- if (kind === "exact") return "resolved";
33502
- if (kind === "interval" || kind === "conditional") return "conditional";
33503
- return "unknown";
33624
+ if (kind === 0 /* Exact */) return 0 /* Resolved */;
33625
+ if (kind === 1 /* Interval */ || kind === 2 /* Conditional */) return 1 /* Conditional */;
33626
+ return 2 /* Unknown */;
33504
33627
  }
33505
33628
  function resolvePositionedOffset(snapshot) {
33506
33629
  const position = readKnownSignalWithGuard(snapshot, "position");
33507
33630
  if (!position) {
33508
33631
  return {
33509
33632
  hasPositionedOffset: false,
33510
- certainty: "unknown"
33633
+ certainty: 2 /* Unknown */
33511
33634
  };
33512
33635
  }
33513
33636
  const certainty = resolveSignalCertainty(position);
@@ -33522,15 +33645,33 @@ function resolvePositionedOffset(snapshot) {
33522
33645
  certainty
33523
33646
  };
33524
33647
  }
33648
+ var FLEX_ROW_VALUES = /* @__PURE__ */ new Set(["row", "row-reverse"]);
33649
+ function resolveCrossAxisIsBlockAxis(kind, snapshot, _axis) {
33650
+ if (kind !== "flex-cross-axis" && kind !== "grid-cross-axis") {
33651
+ return { value: true, certainty: 0 /* Resolved */ };
33652
+ }
33653
+ if (kind === "flex-cross-axis") {
33654
+ const signal2 = readKnownSignalWithGuard(snapshot, "flex-direction");
33655
+ if (!signal2) {
33656
+ return { value: true, certainty: 0 /* Resolved */ };
33657
+ }
33658
+ const certainty2 = resolveSignalCertainty(signal2);
33659
+ return { value: FLEX_ROW_VALUES.has(signal2.normalized), certainty: certainty2 };
33660
+ }
33661
+ const signal = readKnownSignalWithGuard(snapshot, "grid-auto-flow");
33662
+ if (!signal) {
33663
+ return { value: true, certainty: 0 /* Resolved */ };
33664
+ }
33665
+ const certainty = resolveSignalCertainty(signal);
33666
+ return { value: !signal.normalized.startsWith("column"), certainty };
33667
+ }
33525
33668
  function resolveSignalCertainty(value2) {
33526
- if (!value2) return "unknown";
33527
- if (value2.guard === "conditional") return "conditional";
33528
- return "resolved";
33669
+ if (!value2) return 2 /* Unknown */;
33670
+ if (value2.guard.kind === 1 /* Conditional */) return 1 /* Conditional */;
33671
+ return 0 /* Resolved */;
33529
33672
  }
33530
33673
  function combineCertainty(left, right) {
33531
- if (left === "unknown" || right === "unknown") return "unknown";
33532
- if (left === "conditional" || right === "conditional") return "conditional";
33533
- return "resolved";
33674
+ return left > right ? left : right;
33534
33675
  }
33535
33676
  var FLEX_GRID_GEOMETRIC_ALIGN_ITEMS = /* @__PURE__ */ new Set([
33536
33677
  "center",
@@ -33554,7 +33695,7 @@ function computeBaselineRelevance(kind, parentAlignItems, parentPlaceItems) {
33554
33695
  function resolveEffectiveAlignItems(alignItems, placeItems) {
33555
33696
  if (alignItems !== null) return alignItems;
33556
33697
  if (placeItems === null) return null;
33557
- const firstToken2 = placeItems.split(WHITESPACE_RE4)[0];
33698
+ const firstToken2 = placeItems.split(WHITESPACE_RE3)[0];
33558
33699
  return firstToken2 ?? null;
33559
33700
  }
33560
33701
  var TABLE_CELL_GEOMETRIC_VERTICAL_ALIGN = /* @__PURE__ */ new Set([
@@ -33569,24 +33710,7 @@ function finalizeTableCellBaselineRelevance(contextByParentNode, cohortVerticalA
33569
33710
  if (context.kind !== "table-cell") continue;
33570
33711
  if (consensusValue === null) continue;
33571
33712
  if (!TABLE_CELL_GEOMETRIC_VERTICAL_ALIGN.has(consensusValue)) continue;
33572
- contextByParentNode.set(parent, {
33573
- kind: context.kind,
33574
- certainty: context.certainty,
33575
- parentSolidFile: context.parentSolidFile,
33576
- parentElementId: context.parentElementId,
33577
- parentElementKey: context.parentElementKey,
33578
- parentTag: context.parentTag,
33579
- axis: context.axis,
33580
- axisCertainty: context.axisCertainty,
33581
- inlineDirection: context.inlineDirection,
33582
- inlineDirectionCertainty: context.inlineDirectionCertainty,
33583
- parentDisplay: context.parentDisplay,
33584
- parentAlignItems: context.parentAlignItems,
33585
- parentPlaceItems: context.parentPlaceItems,
33586
- hasPositionedOffset: context.hasPositionedOffset,
33587
- baselineRelevance: "irrelevant",
33588
- evidence: context.evidence
33589
- });
33713
+ contextByParentNode.set(parent, deriveAlignmentContext(context, { baselineRelevance: "irrelevant" }));
33590
33714
  }
33591
33715
  }
33592
33716
 
@@ -33650,7 +33774,7 @@ function summarizeSignalFacts(snapshots) {
33650
33774
  }
33651
33775
  function accumulateSnapshotFacts(snapshot, sink) {
33652
33776
  for (const value2 of snapshot.signals.values()) {
33653
- if (value2.guard === "conditional") {
33777
+ if (value2.guard.kind === 1 /* Conditional */) {
33654
33778
  sink.addConditional();
33655
33779
  continue;
33656
33780
  }
@@ -33844,15 +33968,6 @@ function assertUnitInterval(name, value2) {
33844
33968
  }
33845
33969
 
33846
33970
  // src/cross-file/layout/content-composition.ts
33847
- var INTRINSIC_REPLACED_TAGS = /* @__PURE__ */ new Set([
33848
- "img",
33849
- "svg",
33850
- "video",
33851
- "canvas",
33852
- "iframe",
33853
- "object",
33854
- "embed"
33855
- ]);
33856
33971
  var BLOCK_FORMATTING_CONTEXT_DISPLAYS = /* @__PURE__ */ new Set([
33857
33972
  "block",
33858
33973
  "flex",
@@ -33886,7 +34001,7 @@ var VERTICAL_ALIGN_MITIGATIONS = /* @__PURE__ */ new Set([
33886
34001
  "text-top",
33887
34002
  "text-bottom"
33888
34003
  ]);
33889
- function computeContentCompositionFingerprint(elementNode, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByElementKey) {
34004
+ function computeContentCompositionFingerprint(elementNode, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByNode) {
33890
34005
  const state = {
33891
34006
  hasTextContent: false,
33892
34007
  hasInlineReplaced: false,
@@ -33900,10 +34015,10 @@ function computeContentCompositionFingerprint(elementNode, childrenByParentNode,
33900
34015
  blockChildCount: 0,
33901
34016
  inlineChildCount: 0
33902
34017
  };
33903
- if (elementNode.textualContent === "yes" || elementNode.textualContent === "dynamic-text") {
34018
+ if (elementNode.textualContent === 0 /* Yes */ || elementNode.textualContent === 3 /* DynamicText */) {
33904
34019
  state.hasTextContent = true;
33905
34020
  }
33906
- const elementHotSignals = snapshotHotSignalsByElementKey.get(elementNode.key);
34021
+ const elementHotSignals = snapshotHotSignalsByNode.get(elementNode);
33907
34022
  const elementDisplay = elementHotSignals?.display.value ?? null;
33908
34023
  if (elementDisplay !== null && establishesFormattingContext(elementDisplay)) {
33909
34024
  return {
@@ -33914,7 +34029,7 @@ function computeContentCompositionFingerprint(elementNode, childrenByParentNode,
33914
34029
  wrappingContextMitigates: false,
33915
34030
  hasVerticalAlignMitigation: false,
33916
34031
  mixedContentDepth: 0,
33917
- classification: "block-segmented",
34032
+ classification: 4 /* BlockSegmented */,
33918
34033
  analyzableChildCount: 0,
33919
34034
  totalChildCount: 0,
33920
34035
  hasOnlyBlockChildren: false
@@ -33924,7 +34039,7 @@ function computeContentCompositionFingerprint(elementNode, childrenByParentNode,
33924
34039
  elementNode,
33925
34040
  childrenByParentNode,
33926
34041
  snapshotByElementNode,
33927
- snapshotHotSignalsByElementKey,
34042
+ snapshotHotSignalsByNode,
33928
34043
  state,
33929
34044
  0
33930
34045
  );
@@ -33944,7 +34059,7 @@ function computeContentCompositionFingerprint(elementNode, childrenByParentNode,
33944
34059
  hasOnlyBlockChildren
33945
34060
  };
33946
34061
  }
33947
- function walkInlineDescendants(node, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByElementKey, state, depth) {
34062
+ function walkInlineDescendants(node, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByNode, state, depth) {
33948
34063
  const children = childrenByParentNode.get(node);
33949
34064
  if (!children) return;
33950
34065
  for (let i = 0; i < children.length; i++) {
@@ -33955,7 +34070,7 @@ function walkInlineDescendants(node, childrenByParentNode, snapshotByElementNode
33955
34070
  if (!snapshot) continue;
33956
34071
  if (depth === 0) state.analyzableChildCount++;
33957
34072
  const childTag = child.tagName?.toLowerCase() ?? null;
33958
- const hotSignals = snapshotHotSignalsByElementKey.get(child.key);
34073
+ const hotSignals = snapshotHotSignalsByNode.get(child);
33959
34074
  const childDisplay = hotSignals?.display.value ?? null;
33960
34075
  if (childTag !== null && (isIntrinsicReplacedTag(childTag) || isControlReplacedTag(childTag))) {
33961
34076
  state.hasInlineReplaced = true;
@@ -33977,16 +34092,16 @@ function walkInlineDescendants(node, childrenByParentNode, snapshotByElementNode
33977
34092
  checkVerticalAlignMitigation(snapshot, state);
33978
34093
  updateMixedContentDepth(state, depth);
33979
34094
  if (depth === 0) state.inlineChildCount++;
33980
- const parentHotSignals = snapshotHotSignalsByElementKey.get(node.key);
34095
+ const parentHotSignals = snapshotHotSignalsByNode.get(node);
33981
34096
  const parentDisplay = parentHotSignals?.display.value ?? null;
33982
34097
  if (parentDisplay !== null && isAlignmentContextWithNonBaselineAlignment(parentDisplay, parentHotSignals)) {
33983
34098
  state.wrappingContextMitigates = true;
33984
- } else if (isAlignmentContextWithNonBaselineAlignment(childDisplay, hotSignals) && containsMixedContent(child, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByElementKey)) {
34099
+ } else if (isAlignmentContextWithNonBaselineAlignment(childDisplay, hotSignals) && containsMixedContent(child, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByNode)) {
33985
34100
  state.wrappingContextMitigates = true;
33986
34101
  }
33987
34102
  continue;
33988
34103
  }
33989
- if (child.textualContent === "yes" || child.textualContent === "dynamic-text") {
34104
+ if (child.textualContent === 0 /* Yes */ || child.textualContent === 3 /* DynamicText */) {
33990
34105
  state.hasTextContent = true;
33991
34106
  }
33992
34107
  checkHeightContributions(snapshot, state);
@@ -33996,7 +34111,7 @@ function walkInlineDescendants(node, childrenByParentNode, snapshotByElementNode
33996
34111
  child,
33997
34112
  childrenByParentNode,
33998
34113
  snapshotByElementNode,
33999
- snapshotHotSignalsByElementKey,
34114
+ snapshotHotSignalsByNode,
34000
34115
  state,
34001
34116
  depth + 1
34002
34117
  );
@@ -34031,19 +34146,19 @@ function isAlignmentContextWithNonBaselineAlignment(display, hotSignals) {
34031
34146
  if (alignItems === null) return false;
34032
34147
  return alignItems !== "baseline";
34033
34148
  }
34034
- function containsMixedContent(node, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByElementKey) {
34035
- const hasText = node.textualContent === "yes" || node.textualContent === "dynamic-text";
34149
+ function containsMixedContent(node, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByNode) {
34150
+ const hasText = node.textualContent === 0 /* Yes */ || node.textualContent === 3 /* DynamicText */;
34036
34151
  const hasReplaced = false;
34037
- return scanMixedContent(node, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByElementKey, { hasText, hasReplaced });
34152
+ return scanMixedContent(node, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByNode, { hasText, hasReplaced });
34038
34153
  }
34039
- function scanMixedContent(node, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByElementKey, found) {
34154
+ function scanMixedContent(node, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByNode, found) {
34040
34155
  const children = childrenByParentNode.get(node);
34041
34156
  if (!children) return false;
34042
34157
  for (let i = 0; i < children.length; i++) {
34043
34158
  const child = children[i];
34044
34159
  if (!child) continue;
34045
34160
  const childTag = child.tagName?.toLowerCase() ?? null;
34046
- const hotSignals = snapshotHotSignalsByElementKey.get(child.key);
34161
+ const hotSignals = snapshotHotSignalsByNode.get(child);
34047
34162
  const childDisplay = hotSignals?.display.value ?? null;
34048
34163
  if (childTag !== null && (isIntrinsicReplacedTag(childTag) || isControlReplacedTag(childTag))) {
34049
34164
  found.hasReplaced = true;
@@ -34058,12 +34173,12 @@ function scanMixedContent(node, childrenByParentNode, snapshotByElementNode, sna
34058
34173
  if (found.hasText) return true;
34059
34174
  continue;
34060
34175
  }
34061
- if (child.textualContent === "yes" || child.textualContent === "dynamic-text") {
34176
+ if (child.textualContent === 0 /* Yes */ || child.textualContent === 3 /* DynamicText */) {
34062
34177
  found.hasText = true;
34063
34178
  if (found.hasReplaced) return true;
34064
34179
  }
34065
34180
  if (childDisplay === null || isInlineContinuationDisplay(childDisplay)) {
34066
- if (scanMixedContent(child, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByElementKey, found)) {
34181
+ if (scanMixedContent(child, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByNode, found)) {
34067
34182
  return true;
34068
34183
  }
34069
34184
  }
@@ -34086,30 +34201,30 @@ function updateMixedContentDepth(state, depth) {
34086
34201
  }
34087
34202
  function classifyFromState(state, elementNode, hasOnlyBlockChildren) {
34088
34203
  if (hasOnlyBlockChildren) {
34089
- return "block-segmented";
34204
+ return 4 /* BlockSegmented */;
34090
34205
  }
34091
34206
  if (state.totalChildCount === 0 && !state.hasTextContent) {
34092
- if (elementNode.textualContent === "unknown") return "unknown";
34093
- if (elementNode.textualContent === "yes" || elementNode.textualContent === "dynamic-text") {
34094
- return "text-only";
34207
+ if (elementNode.textualContent === 2 /* Unknown */) return 5 /* Unknown */;
34208
+ if (elementNode.textualContent === 0 /* Yes */ || elementNode.textualContent === 3 /* DynamicText */) {
34209
+ return 0 /* TextOnly */;
34095
34210
  }
34096
- return "unknown";
34211
+ return 5 /* Unknown */;
34097
34212
  }
34098
34213
  if (state.analyzableChildCount === 0 && state.totalChildCount > 0) {
34099
- return "unknown";
34214
+ return 5 /* Unknown */;
34100
34215
  }
34101
34216
  if (state.hasTextContent && state.hasInlineReplaced) {
34102
- if (state.wrappingContextMitigates) return "mixed-mitigated";
34103
- if (state.hasVerticalAlignMitigation) return "mixed-mitigated";
34104
- return "mixed-unmitigated";
34217
+ if (state.wrappingContextMitigates) return 3 /* MixedMitigated */;
34218
+ if (state.hasVerticalAlignMitigation) return 3 /* MixedMitigated */;
34219
+ return 2 /* MixedUnmitigated */;
34105
34220
  }
34106
34221
  if (!state.hasTextContent && state.hasInlineReplaced) {
34107
- return "replaced-only";
34222
+ return 1 /* ReplacedOnly */;
34108
34223
  }
34109
34224
  if (state.hasTextContent && !state.hasInlineReplaced) {
34110
- return "text-only";
34225
+ return 0 /* TextOnly */;
34111
34226
  }
34112
- return "unknown";
34227
+ return 5 /* Unknown */;
34113
34228
  }
34114
34229
  function isIntrinsicReplacedTag(tag) {
34115
34230
  return INTRINSIC_REPLACED_TAGS.has(tag);
@@ -34129,10 +34244,14 @@ function isInlineReplacedDisplay(display) {
34129
34244
  function isInlineContinuationDisplay(display) {
34130
34245
  return INLINE_CONTINUATION_DISPLAYS.has(display);
34131
34246
  }
34132
- function resolveCompositionDivergenceStrength(subjectFingerprint, allFingerprints, parentContext) {
34133
- if (allFingerprints.length < 2) return 0;
34247
+ var NO_DIVERGENCE = Object.freeze({
34248
+ strength: 0,
34249
+ majorityClassification: 5 /* Unknown */
34250
+ });
34251
+ function resolveCompositionDivergence(subjectFingerprint, allFingerprints, parentContext) {
34252
+ if (allFingerprints.length < 2) return NO_DIVERGENCE;
34134
34253
  if (parentContext !== null && !hasSharedBaselineAlignment(parentContext)) {
34135
- return 0;
34254
+ return NO_DIVERGENCE;
34136
34255
  }
34137
34256
  const countByClassification = /* @__PURE__ */ new Map();
34138
34257
  for (let i = 0; i < allFingerprints.length; i++) {
@@ -34144,10 +34263,7 @@ function resolveCompositionDivergenceStrength(subjectFingerprint, allFingerprint
34144
34263
  }
34145
34264
  const subjectNormalized = normalizeClassificationForComparison(subjectFingerprint.classification);
34146
34265
  const subjectCount = countByClassification.get(subjectNormalized) ?? 0;
34147
- if (subjectCount === allFingerprints.length) {
34148
- return resolveInlineReplacedKindDivergence(subjectFingerprint, allFingerprints);
34149
- }
34150
- let majorityClassification = "unknown";
34266
+ let majorityClassification = 5 /* Unknown */;
34151
34267
  let majorityCount = 0;
34152
34268
  for (const [classification, count] of countByClassification) {
34153
34269
  if (count > majorityCount) {
@@ -34155,35 +34271,38 @@ function resolveCompositionDivergenceStrength(subjectFingerprint, allFingerprint
34155
34271
  majorityClassification = classification;
34156
34272
  }
34157
34273
  }
34274
+ if (subjectCount === allFingerprints.length) {
34275
+ return { strength: resolveInlineReplacedKindDivergence(subjectFingerprint, allFingerprints), majorityClassification };
34276
+ }
34158
34277
  if (subjectNormalized === majorityClassification) {
34159
- return resolveInlineReplacedKindDivergence(subjectFingerprint, allFingerprints);
34278
+ return { strength: resolveInlineReplacedKindDivergence(subjectFingerprint, allFingerprints), majorityClassification };
34160
34279
  }
34161
- if (subjectNormalized === "unknown") {
34162
- return 0;
34280
+ if (subjectNormalized === 5 /* Unknown */) {
34281
+ return { strength: 0, majorityClassification };
34163
34282
  }
34164
34283
  const cal = alignmentStrengthCalibration;
34165
- if (majorityClassification === "text-only" && subjectNormalized === "mixed-unmitigated") {
34166
- return cal.compositionMixedUnmitigatedOutlierStrength;
34284
+ if (majorityClassification === 0 /* TextOnly */ && subjectNormalized === 2 /* MixedUnmitigated */) {
34285
+ return { strength: cal.compositionMixedUnmitigatedOutlierStrength, majorityClassification };
34167
34286
  }
34168
- if (majorityClassification === "replaced-only" && subjectNormalized === "mixed-unmitigated") {
34169
- return cal.compositionMixedOutlierAmongReplacedStrength;
34287
+ if (majorityClassification === 1 /* ReplacedOnly */ && subjectNormalized === 2 /* MixedUnmitigated */) {
34288
+ return { strength: cal.compositionMixedOutlierAmongReplacedStrength, majorityClassification };
34170
34289
  }
34171
- if (majorityClassification === "mixed-unmitigated" && subjectNormalized === "text-only") {
34172
- return cal.compositionTextOutlierAmongMixedStrength;
34290
+ if (majorityClassification === 2 /* MixedUnmitigated */ && subjectNormalized === 0 /* TextOnly */) {
34291
+ return { strength: cal.compositionTextOutlierAmongMixedStrength, majorityClassification };
34173
34292
  }
34174
- if (majorityClassification === "mixed-unmitigated" && subjectNormalized === "replaced-only") {
34175
- return cal.compositionTextOutlierAmongMixedStrength;
34293
+ if (majorityClassification === 2 /* MixedUnmitigated */ && subjectNormalized === 1 /* ReplacedOnly */) {
34294
+ return { strength: cal.compositionTextOutlierAmongMixedStrength, majorityClassification };
34176
34295
  }
34177
- if (majorityClassification === "text-only" && subjectNormalized === "replaced-only") {
34178
- return cal.compositionMixedOutlierAmongReplacedStrength;
34296
+ if (majorityClassification === 0 /* TextOnly */ && subjectNormalized === 1 /* ReplacedOnly */) {
34297
+ return { strength: cal.compositionMixedOutlierAmongReplacedStrength, majorityClassification };
34179
34298
  }
34180
- if (majorityClassification === "replaced-only" && subjectNormalized === "text-only") {
34181
- return cal.compositionTextOutlierAmongMixedStrength;
34299
+ if (majorityClassification === 1 /* ReplacedOnly */ && subjectNormalized === 0 /* TextOnly */) {
34300
+ return { strength: cal.compositionTextOutlierAmongMixedStrength, majorityClassification };
34182
34301
  }
34183
- if (majorityClassification === "unknown") {
34184
- return 0;
34302
+ if (majorityClassification === 5 /* Unknown */) {
34303
+ return { strength: 0, majorityClassification };
34185
34304
  }
34186
- return cal.compositionUnknownPenalty;
34305
+ return { strength: cal.compositionUnknownPenalty, majorityClassification };
34187
34306
  }
34188
34307
  function resolveInlineReplacedKindDivergence(subjectFingerprint, allFingerprints) {
34189
34308
  if (subjectFingerprint.inlineReplacedKind === null) return 0;
@@ -34204,28 +34323,9 @@ function resolveInlineReplacedKindDivergence(subjectFingerprint, allFingerprints
34204
34323
  function hasSharedBaselineAlignment(context) {
34205
34324
  return context.baselineRelevance === "relevant";
34206
34325
  }
34207
- function resolveMajorityClassification(allFingerprints) {
34208
- const countByClassification = /* @__PURE__ */ new Map();
34209
- for (let i = 0; i < allFingerprints.length; i++) {
34210
- const fp = allFingerprints[i];
34211
- if (!fp) continue;
34212
- const normalized = normalizeClassificationForComparison(fp.classification);
34213
- const existing = countByClassification.get(normalized) ?? 0;
34214
- countByClassification.set(normalized, existing + 1);
34215
- }
34216
- let majorityClassification = "unknown";
34217
- let majorityCount = 0;
34218
- for (const [classification, count] of countByClassification) {
34219
- if (count > majorityCount) {
34220
- majorityCount = count;
34221
- majorityClassification = classification;
34222
- }
34223
- }
34224
- return majorityClassification;
34225
- }
34226
34326
  function normalizeClassificationForComparison(classification) {
34227
- if (classification === "mixed-mitigated") return "text-only";
34228
- if (classification === "block-segmented") return "text-only";
34327
+ if (classification === 3 /* MixedMitigated */) return 0 /* TextOnly */;
34328
+ if (classification === 4 /* BlockSegmented */) return 0 /* TextOnly */;
34229
34329
  return classification;
34230
34330
  }
34231
34331
  function resolveCompositionCoverage(subjectFingerprint, allFingerprints) {
@@ -34233,12 +34333,12 @@ function resolveCompositionCoverage(subjectFingerprint, allFingerprints) {
34233
34333
  let analyzableCount = 0;
34234
34334
  for (let i = 0; i < allFingerprints.length; i++) {
34235
34335
  const fp = allFingerprints[i];
34236
- if (fp && fp.classification !== "unknown") {
34336
+ if (fp && fp.classification !== 5 /* Unknown */) {
34237
34337
  analyzableCount++;
34238
34338
  }
34239
34339
  }
34240
34340
  const analyzableShare = analyzableCount / allFingerprints.length;
34241
- if (subjectFingerprint.classification === "unknown") {
34341
+ if (subjectFingerprint.classification === 5 /* Unknown */) {
34242
34342
  return analyzableShare * 0.3;
34243
34343
  }
34244
34344
  if (subjectFingerprint.totalChildCount > 0 && subjectFingerprint.analyzableChildCount === 0) {
@@ -34246,24 +34346,19 @@ function resolveCompositionCoverage(subjectFingerprint, allFingerprints) {
34246
34346
  }
34247
34347
  return analyzableShare;
34248
34348
  }
34349
+ var COMPOSITION_LABELS = {
34350
+ [0 /* TextOnly */]: "text-only",
34351
+ [1 /* ReplacedOnly */]: "inline-replaced-only",
34352
+ [2 /* MixedUnmitigated */]: "mixed text + inline-replaced",
34353
+ [3 /* MixedMitigated */]: "mixed (alignment mitigated)",
34354
+ [4 /* BlockSegmented */]: "block-segmented",
34355
+ [5 /* Unknown */]: "unknown"
34356
+ };
34249
34357
  function formatCompositionClassification(classification) {
34250
- switch (classification) {
34251
- case "text-only":
34252
- return "text-only";
34253
- case "replaced-only":
34254
- return "inline-replaced-only";
34255
- case "mixed-unmitigated":
34256
- return "mixed text + inline-replaced";
34257
- case "mixed-mitigated":
34258
- return "mixed (alignment mitigated)";
34259
- case "block-segmented":
34260
- return "block-segmented";
34261
- case "unknown":
34262
- return "unknown";
34263
- }
34358
+ return COMPOSITION_LABELS[classification];
34264
34359
  }
34265
34360
  function formatCompositionFixSuggestion(subjectFingerprint) {
34266
- if (subjectFingerprint.classification === "mixed-unmitigated") {
34361
+ if (subjectFingerprint.classification === 2 /* MixedUnmitigated */) {
34267
34362
  if (subjectFingerprint.hasVerticalAlignMitigation) {
34268
34363
  return "verify vertical-align resolves the baseline shift";
34269
34364
  }
@@ -34298,12 +34393,12 @@ function estimateBlockOffsetWithDeclaredFromHotSignals(hot, axis) {
34298
34393
  function estimateBlockOffsetWithDeclaredFromSources(axis, position, readNumeric) {
34299
34394
  let declaredTotal = 0;
34300
34395
  let declaredCount = 0;
34301
- let declaredKind = "exact";
34302
- let declaredMissingKind = "exact";
34396
+ let declaredKind = 0 /* Exact */;
34397
+ let declaredMissingKind = 0 /* Exact */;
34303
34398
  let effectiveTotal = 0;
34304
34399
  let effectiveCount = 0;
34305
- let effectiveKind = "exact";
34306
- let effectiveMissingKind = "exact";
34400
+ let effectiveKind = 0 /* Exact */;
34401
+ let effectiveMissingKind = 0 /* Exact */;
34307
34402
  const positioned = position.value !== null && position.value !== "static";
34308
34403
  const add = (name, sign, requiresPositioning) => {
34309
34404
  const v = readNumeric(name);
@@ -34374,7 +34469,7 @@ function buildCohortIndex(input) {
34374
34469
  axisCertainty: context.axisCertainty,
34375
34470
  measurementNodeByRootKey: input.measurementNodeByRootKey,
34376
34471
  snapshotByElementNode: input.snapshotByElementNode,
34377
- snapshotHotSignalsByElementKey: input.snapshotHotSignalsByElementKey
34472
+ snapshotHotSignalsByNode: input.snapshotHotSignalsByNode
34378
34473
  });
34379
34474
  measurementIndexHits += cohortMetricsResult.measurementHits;
34380
34475
  const metrics = cohortMetricsResult.metrics;
@@ -34408,7 +34503,7 @@ function buildCohortIndex(input) {
34408
34503
  subjectMetrics.rootNode,
34409
34504
  input.childrenByParentNode,
34410
34505
  input.snapshotByElementNode,
34411
- input.snapshotHotSignalsByElementKey
34506
+ input.snapshotHotSignalsByNode
34412
34507
  );
34413
34508
  subjectsByElementKey.set(subjectMetrics.key, {
34414
34509
  element: subjectMetrics.element,
@@ -34474,7 +34569,7 @@ function collectCohortMetrics(input) {
34474
34569
  if (!snapshot) {
34475
34570
  throw new Error(`missing snapshot for measurement node ${measurementNode.key}`);
34476
34571
  }
34477
- const hotSignals = input.snapshotHotSignalsByElementKey.get(measurementNode.key);
34572
+ const hotSignals = input.snapshotHotSignalsByNode.get(measurementNode);
34478
34573
  if (!hotSignals) {
34479
34574
  throw new Error(`missing hot signals for measurement node ${measurementNode.key}`);
34480
34575
  }
@@ -34799,9 +34894,9 @@ function buildCohortSignalIndex(metrics) {
34799
34894
  const verticalAlignCounts = /* @__PURE__ */ new Map();
34800
34895
  const alignSelfCounts = /* @__PURE__ */ new Map();
34801
34896
  const placeSelfCounts = /* @__PURE__ */ new Map();
34802
- let verticalAlignMergedKind = "exact";
34803
- let alignSelfMergedKind = "exact";
34804
- let placeSelfMergedKind = "exact";
34897
+ let verticalAlignMergedKind = 0 /* Exact */;
34898
+ let alignSelfMergedKind = 0 /* Exact */;
34899
+ let placeSelfMergedKind = 0 /* Exact */;
34805
34900
  let verticalAlignComparableCount = 0;
34806
34901
  let alignSelfComparableCount = 0;
34807
34902
  let placeSelfComparableCount = 0;
@@ -34815,12 +34910,12 @@ function buildCohortSignalIndex(metrics) {
34815
34910
  const snapshot = metric.element.snapshot;
34816
34911
  const alignSelf = metric.hotSignals.alignSelf;
34817
34912
  const placeSelf = metric.hotSignals.placeSelf;
34818
- const isControlOrReplaced = snapshot.isControl || snapshot.isReplaced;
34913
+ const isControlOrReplaced = snapshot.node.isControl || snapshot.node.isReplaced;
34819
34914
  const verticalAlign = resolveComparableVerticalAlign(metric.hotSignals.verticalAlign, isControlOrReplaced);
34820
34915
  if (isControlOrReplaced) controlOrReplacedCount++;
34821
- if (snapshot.textualContent === "yes" || snapshot.textualContent === "dynamic-text") textYesCount++;
34822
- if (snapshot.textualContent === "no") textNoCount++;
34823
- if (snapshot.textualContent === "unknown") textUnknownCount++;
34916
+ if (snapshot.node.textualContent === 0 /* Yes */ || snapshot.node.textualContent === 3 /* DynamicText */) textYesCount++;
34917
+ if (snapshot.node.textualContent === 1 /* No */) textNoCount++;
34918
+ if (snapshot.node.textualContent === 2 /* Unknown */) textUnknownCount++;
34824
34919
  if (verticalAlign.value !== null) {
34825
34920
  verticalAlignMergedKind = mergeEvidenceKind(verticalAlignMergedKind, verticalAlign.kind);
34826
34921
  verticalAlignComparableCount++;
@@ -34840,24 +34935,24 @@ function buildCohortSignalIndex(metrics) {
34840
34935
  verticalAlign,
34841
34936
  alignSelf,
34842
34937
  placeSelf,
34843
- textualContent: snapshot.textualContent,
34938
+ textualContent: snapshot.node.textualContent,
34844
34939
  isControlOrReplaced
34845
34940
  });
34846
34941
  }
34847
34942
  return {
34848
34943
  byKey,
34849
34944
  verticalAlign: {
34850
- mergedKind: verticalAlignComparableCount === 0 ? "unknown" : verticalAlignMergedKind,
34945
+ mergedKind: verticalAlignComparableCount === 0 ? 3 /* Unknown */ : verticalAlignMergedKind,
34851
34946
  comparableCount: verticalAlignComparableCount,
34852
34947
  countsByValue: verticalAlignCounts
34853
34948
  },
34854
34949
  alignSelf: {
34855
- mergedKind: alignSelfComparableCount === 0 ? "unknown" : alignSelfMergedKind,
34950
+ mergedKind: alignSelfComparableCount === 0 ? 3 /* Unknown */ : alignSelfMergedKind,
34856
34951
  comparableCount: alignSelfComparableCount,
34857
34952
  countsByValue: alignSelfCounts
34858
34953
  },
34859
34954
  placeSelf: {
34860
- mergedKind: placeSelfComparableCount === 0 ? "unknown" : placeSelfMergedKind,
34955
+ mergedKind: placeSelfComparableCount === 0 ? 3 /* Unknown */ : placeSelfMergedKind,
34861
34956
  comparableCount: placeSelfComparableCount,
34862
34957
  countsByValue: placeSelfCounts
34863
34958
  },
@@ -34894,9 +34989,9 @@ function collectSubjectCohortSignals(index, subjectMetrics, context) {
34894
34989
  sawComparableVerticalAlign,
34895
34990
  sawVerticalAlignConflict
34896
34991
  );
34897
- const tableCellControlFallback = context.kind === "table-cell" && subject.isControlOrReplaced && verticalAlign.value === "unknown" && index.byKey.size > index.controlOrReplacedCount;
34992
+ const tableCellControlFallback = context.kind === "table-cell" && subject.isControlOrReplaced && verticalAlign.value === 2 /* Unknown */ && index.byKey.size > index.controlOrReplacedCount;
34898
34993
  const normalizedVerticalAlign = tableCellControlFallback ? {
34899
- value: "conflict",
34994
+ value: 0 /* Conflict */,
34900
34995
  kind: verticalAlignKind
34901
34996
  } : verticalAlign;
34902
34997
  const textContrastWithPeers = resolveIndexedTextContrastWithPeers(
@@ -34929,7 +35024,7 @@ function resolveComparableVerticalAlign(verticalAlign, isControlOrReplaced) {
34929
35024
  return {
34930
35025
  present: verticalAlign.present,
34931
35026
  value: "baseline",
34932
- kind: "exact"
35027
+ kind: 0 /* Exact */
34933
35028
  };
34934
35029
  }
34935
35030
  function hasComparablePeer(aggregate, subjectValue) {
@@ -34946,37 +35041,37 @@ function hasConflictPeer(aggregate, subjectValue) {
34946
35041
  function finalizeConflictEvidence(subjectValue, kind, sawComparablePeer, sawConflict) {
34947
35042
  if (subjectValue === null) {
34948
35043
  return {
34949
- value: "unknown",
35044
+ value: 2 /* Unknown */,
34950
35045
  kind
34951
35046
  };
34952
35047
  }
34953
35048
  if (!sawComparablePeer) {
34954
35049
  return {
34955
- value: "unknown",
35050
+ value: 2 /* Unknown */,
34956
35051
  kind
34957
35052
  };
34958
35053
  }
34959
35054
  return {
34960
- value: sawConflict ? "conflict" : "aligned",
35055
+ value: sawConflict ? 0 /* Conflict */ : 1 /* Aligned */,
34961
35056
  kind
34962
35057
  };
34963
35058
  }
34964
35059
  function resolveIndexedTextContrastWithPeers(index, subjectTextualContent, subjectIsControlOrReplaced, tableCellControlFallback) {
34965
- if (subjectTextualContent === "unknown") return "unknown";
35060
+ if (subjectTextualContent === 2 /* Unknown */) return 2 /* Unknown */;
34966
35061
  const unknownPeers = index.textUnknownCount;
34967
35062
  const cohortSize = index.byKey.size;
34968
- if (subjectTextualContent === "yes" || subjectTextualContent === "dynamic-text") {
34969
- if (index.textNoCount > 0) return "different";
34970
- if (unknownPeers > 0) return "unknown";
34971
- return "same";
35063
+ if (subjectTextualContent === 0 /* Yes */ || subjectTextualContent === 3 /* DynamicText */) {
35064
+ if (index.textNoCount > 0) return 0 /* Different */;
35065
+ if (unknownPeers > 0) return 2 /* Unknown */;
35066
+ return 1 /* Same */;
34972
35067
  }
34973
- if (index.textYesCount > 0) return "different";
34974
- if (tableCellControlFallback) return "different";
35068
+ if (index.textYesCount > 0) return 0 /* Different */;
35069
+ if (tableCellControlFallback) return 0 /* Different */;
34975
35070
  if (subjectIsControlOrReplaced && index.controlOrReplacedCount === 1 && cohortSize >= 3 && unknownPeers > 0) {
34976
- return "different";
35071
+ return 0 /* Different */;
34977
35072
  }
34978
- if (unknownPeers > 0) return "unknown";
34979
- return "same";
35073
+ if (unknownPeers > 0) return 2 /* Unknown */;
35074
+ return 1 /* Same */;
34980
35075
  }
34981
35076
  function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineProfile, clusterSummary, signalIndex, cohortKind, cohortSize) {
34982
35077
  const subjectClusterKey = toComparableClusterKey(subjectMetrics);
@@ -34992,7 +35087,7 @@ function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineP
34992
35087
  return {
34993
35088
  dominantShare: profile.dominantClusterShare,
34994
35089
  subjectExcludedDominantShare: subjectBaselineProfile.dominantClusterShare,
34995
- subjectMembership: "insufficient",
35090
+ subjectMembership: 3 /* Insufficient */,
34996
35091
  ambiguous: true,
34997
35092
  kind
34998
35093
  };
@@ -35001,7 +35096,7 @@ function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineP
35001
35096
  return {
35002
35097
  dominantShare: profile.dominantClusterShare,
35003
35098
  subjectExcludedDominantShare: subjectBaselineProfile.dominantClusterShare,
35004
- subjectMembership: "dominant",
35099
+ subjectMembership: 0 /* Dominant */,
35005
35100
  ambiguous: false,
35006
35101
  kind
35007
35102
  };
@@ -35010,7 +35105,7 @@ function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineP
35010
35105
  return {
35011
35106
  dominantShare: profile.dominantClusterShare,
35012
35107
  subjectExcludedDominantShare: subjectBaselineProfile.dominantClusterShare,
35013
- subjectMembership: "insufficient",
35108
+ subjectMembership: 3 /* Insufficient */,
35014
35109
  ambiguous: true,
35015
35110
  kind
35016
35111
  };
@@ -35020,7 +35115,7 @@ function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineP
35020
35115
  return {
35021
35116
  dominantShare: profile.dominantClusterShare,
35022
35117
  subjectExcludedDominantShare: subjectBaselineProfile.dominantClusterShare,
35023
- subjectMembership: "insufficient",
35118
+ subjectMembership: 3 /* Insufficient */,
35024
35119
  ambiguous: true,
35025
35120
  kind
35026
35121
  };
@@ -35030,7 +35125,7 @@ function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineP
35030
35125
  return {
35031
35126
  dominantShare: profile.dominantClusterShare,
35032
35127
  subjectExcludedDominantShare: subjectBaselineProfile.dominantClusterShare,
35033
- subjectMembership: "ambiguous",
35128
+ subjectMembership: 2 /* Ambiguous */,
35034
35129
  ambiguous: true,
35035
35130
  kind
35036
35131
  };
@@ -35039,7 +35134,7 @@ function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineP
35039
35134
  return {
35040
35135
  dominantShare: profile.dominantClusterShare,
35041
35136
  subjectExcludedDominantShare: subjectBaselineProfile.dominantClusterShare,
35042
- subjectMembership: "dominant",
35137
+ subjectMembership: 0 /* Dominant */,
35043
35138
  ambiguous: false,
35044
35139
  kind
35045
35140
  };
@@ -35047,13 +35142,13 @@ function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineP
35047
35142
  return {
35048
35143
  dominantShare: profile.dominantClusterShare,
35049
35144
  subjectExcludedDominantShare: subjectBaselineProfile.dominantClusterShare,
35050
- subjectMembership: "nondominant",
35145
+ subjectMembership: 1 /* Nondominant */,
35051
35146
  ambiguous: false,
35052
35147
  kind
35053
35148
  };
35054
35149
  }
35055
35150
  function resolveControlRoleIdentifiability(subjectMetrics, signalIndex, kind, cohortSize) {
35056
- const subjectIsControlOrReplaced = subjectMetrics.element.snapshot.isControl || subjectMetrics.element.snapshot.isReplaced;
35151
+ const subjectIsControlOrReplaced = subjectMetrics.element.snapshot.node.isControl || subjectMetrics.element.snapshot.node.isReplaced;
35057
35152
  const controlCount = signalIndex.controlOrReplacedCount;
35058
35153
  const nonControlCount = cohortSize - controlCount;
35059
35154
  if (controlCount <= 0 || nonControlCount <= 0) return null;
@@ -35068,12 +35163,12 @@ function resolveControlRoleIdentifiability(subjectMetrics, signalIndex, kind, co
35068
35163
  return {
35069
35164
  dominantShare,
35070
35165
  subjectExcludedDominantShare: excludedDominantShare,
35071
- subjectMembership: subjectMembership === "ambiguous" ? "dominant" : subjectMembership,
35166
+ subjectMembership: subjectMembership === 2 /* Ambiguous */ ? 0 /* Dominant */ : subjectMembership,
35072
35167
  ambiguous: false,
35073
35168
  kind
35074
35169
  };
35075
35170
  }
35076
- if (subjectMembership === "ambiguous") {
35171
+ if (subjectMembership === 2 /* Ambiguous */) {
35077
35172
  return {
35078
35173
  dominantShare,
35079
35174
  subjectExcludedDominantShare: excludedDominantShare,
@@ -35091,9 +35186,9 @@ function resolveControlRoleIdentifiability(subjectMetrics, signalIndex, kind, co
35091
35186
  };
35092
35187
  }
35093
35188
  function resolveRoleMembership(controlCount, nonControlCount, subjectIsControlOrReplaced) {
35094
- if (controlCount === nonControlCount) return "ambiguous";
35189
+ if (controlCount === nonControlCount) return 2 /* Ambiguous */;
35095
35190
  const dominantRoleIsControl = controlCount > nonControlCount;
35096
- return dominantRoleIsControl === subjectIsControlOrReplaced ? "dominant" : "nondominant";
35191
+ return dominantRoleIsControl === subjectIsControlOrReplaced ? 0 /* Dominant */ : 1 /* Nondominant */;
35097
35192
  }
35098
35193
  function resolveExcludedRoleDominantShare(controlCount, nonControlCount, subjectIsControlOrReplaced) {
35099
35194
  const controlAfterExclusion = controlCount - (subjectIsControlOrReplaced ? 1 : 0);
@@ -35131,8 +35226,8 @@ function collectCohortProvenanceFromSnapshots(snapshots) {
35131
35226
  const snapshot = snapshots[i];
35132
35227
  if (!snapshot) continue;
35133
35228
  for (const signal of snapshot.signals.values()) {
35134
- for (let j = 0; j < signal.guardProvenance.conditions.length; j++) {
35135
- const guard = signal.guardProvenance.conditions[j];
35229
+ for (let j = 0; j < signal.guard.conditions.length; j++) {
35230
+ const guard = signal.guard.conditions[j];
35136
35231
  if (!guard) continue;
35137
35232
  if (!byKey.has(guard.key)) byKey.set(guard.key, guard);
35138
35233
  }
@@ -35162,7 +35257,7 @@ function buildGuardKey(guards) {
35162
35257
  return keys.join("&");
35163
35258
  }
35164
35259
  function resolveCohortEvidenceKind(metrics) {
35165
- let kind = "exact";
35260
+ let kind = 0 /* Exact */;
35166
35261
  for (let i = 0; i < metrics.length; i++) {
35167
35262
  const metric = metrics[i];
35168
35263
  if (!metric) continue;
@@ -35179,9 +35274,9 @@ function incrementCount(counts, key) {
35179
35274
  counts.set(key, existing + 1);
35180
35275
  }
35181
35276
  function toEvidenceKind2(certainty) {
35182
- if (certainty === "resolved") return "exact";
35183
- if (certainty === "conditional") return "conditional";
35184
- return "unknown";
35277
+ if (certainty === 0 /* Resolved */) return 0 /* Exact */;
35278
+ if (certainty === 1 /* Conditional */) return 2 /* Conditional */;
35279
+ return 3 /* Unknown */;
35185
35280
  }
35186
35281
  function computeMedian(values) {
35187
35282
  if (values.length === 0) return null;
@@ -35201,66 +35296,6 @@ function computeMedianAbsoluteDeviation(values, median, scratch) {
35201
35296
  }
35202
35297
  return computeMedian(scratch);
35203
35298
  }
35204
- function selectKth(values, targetIndex) {
35205
- let left = 0;
35206
- let right = values.length - 1;
35207
- while (left <= right) {
35208
- if (left === right) {
35209
- const result = values[left];
35210
- if (result === void 0) return 0;
35211
- return result;
35212
- }
35213
- const pivotIndex = choosePivotIndex(values, left, right);
35214
- const partitionIndex = partitionAroundPivot(values, left, right, pivotIndex);
35215
- if (partitionIndex === targetIndex) {
35216
- const result = values[partitionIndex];
35217
- if (result === void 0) return 0;
35218
- return result;
35219
- }
35220
- if (partitionIndex < targetIndex) {
35221
- left = partitionIndex + 1;
35222
- continue;
35223
- }
35224
- right = partitionIndex - 1;
35225
- }
35226
- const fallback = values[targetIndex];
35227
- if (fallback === void 0) return 0;
35228
- return fallback;
35229
- }
35230
- function choosePivotIndex(values, left, right) {
35231
- const middle = Math.floor((left + right) / 2);
35232
- const leftValue = values[left] ?? 0;
35233
- const middleValue = values[middle] ?? 0;
35234
- const rightValue = values[right] ?? 0;
35235
- if (leftValue < middleValue) {
35236
- if (middleValue < rightValue) return middle;
35237
- if (leftValue < rightValue) return right;
35238
- return left;
35239
- }
35240
- if (leftValue < rightValue) return left;
35241
- if (middleValue < rightValue) return right;
35242
- return middle;
35243
- }
35244
- function partitionAroundPivot(values, left, right, pivotIndex) {
35245
- const pivotValue = values[pivotIndex] ?? 0;
35246
- swap(values, pivotIndex, right);
35247
- let storeIndex = left;
35248
- for (let i = left; i < right; i++) {
35249
- const current = values[i];
35250
- if (current === void 0 || current > pivotValue) continue;
35251
- swap(values, storeIndex, i);
35252
- storeIndex++;
35253
- }
35254
- swap(values, storeIndex, right);
35255
- return storeIndex;
35256
- }
35257
- function swap(values, left, right) {
35258
- if (left === right) return;
35259
- const leftValue = values[left] ?? 0;
35260
- const rightValue = values[right] ?? 0;
35261
- values[left] = rightValue;
35262
- values[right] = leftValue;
35263
- }
35264
35299
  function resolveVerticalAlignConsensus(aggregate) {
35265
35300
  if (aggregate.comparableCount === 0) return null;
35266
35301
  if (aggregate.countsByValue.size !== 1) return null;
@@ -35359,7 +35394,7 @@ function resolveMeasurementCandidates(root, childrenByParentNode, snapshotByElem
35359
35394
  if (firstControlOrReplacedDescendant === null && (child.isControl || child.isReplaced)) {
35360
35395
  firstControlOrReplacedDescendant = child;
35361
35396
  }
35362
- if (firstTextualDescendant === null && child.textualContent === "yes") {
35397
+ if (firstTextualDescendant === null && child.textualContent === 0 /* Yes */) {
35363
35398
  firstTextualDescendant = child;
35364
35399
  }
35365
35400
  if (firstControlOrReplacedDescendant !== null && firstTextualDescendant !== null) break;
@@ -35385,7 +35420,7 @@ function resolveMeasurementNode(root, candidates) {
35385
35420
  if (candidates.firstControlOrReplacedDescendant !== null) return candidates.firstControlOrReplacedDescendant;
35386
35421
  if (root.isControl || root.isReplaced) return root;
35387
35422
  if (candidates.firstTextualDescendant !== null) return candidates.firstTextualDescendant;
35388
- if (root.textualContent === "yes") return root;
35423
+ if (root.textualContent === 0 /* Yes */) return root;
35389
35424
  return root;
35390
35425
  }
35391
35426
 
@@ -35432,7 +35467,7 @@ function buildScopedSelectorIndexBySolidFile(cssScopeBySolidFile, css, selectorM
35432
35467
  seenSelectorIds.add(selector.id);
35433
35468
  const metadata = selectorMetadataById.get(selector.id);
35434
35469
  if (!metadata) continue;
35435
- if (metadata.guard.kind === "conditional") {
35470
+ if (metadata.guard.kind === 1 /* Conditional */) {
35436
35471
  if (!conditionalSelectorIds.has(selector.id)) {
35437
35472
  conditionalSelectorIds.add(selector.id);
35438
35473
  perf.selectorsGuardedConditional++;
@@ -35474,7 +35509,7 @@ function buildScopedSelectorIndexBySolidFile(cssScopeBySolidFile, css, selectorM
35474
35509
  }
35475
35510
  return out;
35476
35511
  }
35477
- function buildSelectorCandidatesByElementKey(elements, scopedSelectorsBySolidFile, perf) {
35512
+ function buildSelectorCandidatesByNode(elements, scopedSelectorsBySolidFile, perf) {
35478
35513
  const out = /* @__PURE__ */ new Map();
35479
35514
  for (let i = 0; i < elements.length; i++) {
35480
35515
  const node = elements[i];
@@ -35484,7 +35519,7 @@ function buildSelectorCandidatesByElementKey(elements, scopedSelectorsBySolidFil
35484
35519
  const byTag = node.tagName !== null ? collectSelectorCandidates(scoped.bySubjectTag.get(node.tagName), node.selectorDispatchKeys) : EMPTY_SELECTOR_LIST;
35485
35520
  const withoutTag = collectSelectorCandidates(scoped.withoutSubjectTag, node.selectorDispatchKeys);
35486
35521
  const merged = mergeSelectorCandidateIds(byTag, withoutTag);
35487
- out.set(node.key, merged);
35522
+ out.set(node, merged);
35488
35523
  perf.elementsScanned++;
35489
35524
  perf.selectorCandidatesChecked += merged.length;
35490
35525
  }
@@ -35943,12 +35978,6 @@ var EMPTY_EXPANSION_RESULT = [];
35943
35978
  function collectMonitoredDeclarations(selector, layerOrder, guard) {
35944
35979
  const out = [];
35945
35980
  const declarations = selector.rule.declarations;
35946
- const signalGuard = guard.kind === "conditional" ? "conditional" : "unconditional";
35947
- const guardProvenance = {
35948
- kind: signalGuard,
35949
- conditions: guard.conditions,
35950
- key: guard.key
35951
- };
35952
35981
  for (let i = 0; i < declarations.length; i++) {
35953
35982
  const declaration = declarations[i];
35954
35983
  if (!declaration) continue;
@@ -35959,8 +35988,7 @@ function collectMonitoredDeclarations(selector, layerOrder, guard) {
35959
35988
  out.push({
35960
35989
  property: monitored,
35961
35990
  value: declaration.value,
35962
- guard: signalGuard,
35963
- guardProvenance,
35991
+ guardProvenance: guard,
35964
35992
  position: {
35965
35993
  layer: declaration.cascadePosition.layer,
35966
35994
  layerOrder,
@@ -35982,6 +36010,7 @@ function toMonitoredSignalKey(property) {
35982
36010
  case "margin-block":
35983
36011
  case "padding-block":
35984
36012
  case "inset-block":
36013
+ case "flex-flow":
35985
36014
  return property;
35986
36015
  default:
35987
36016
  return null;
@@ -36005,30 +36034,27 @@ function expandMonitoredDeclarationForDelta(declaration) {
36005
36034
  if (signalName === void 0) return EMPTY_EXPANSION_RESULT;
36006
36035
  return [{ name: signalName, value: value2 }];
36007
36036
  }
36008
- function appendMatchingEdgesFromSelectorIds(selectorIds, node, selectorMetadataById, selectorsById, applies, appliesByElementNodeMutable, perf, rootElementsByFile, logger) {
36009
- const fileRoots = rootElementsByFile.get(node.solidFile) ?? null;
36037
+ function appendMatchingEdgesFromSelectorIds(ctx, selectorIds, node, applies, appliesByElementNodeMutable) {
36038
+ const fileRoots = ctx.rootElementsByFile.get(node.solidFile) ?? null;
36010
36039
  for (let i = 0; i < selectorIds.length; i++) {
36011
36040
  const selectorId = selectorIds[i];
36012
36041
  if (selectorId === void 0) continue;
36013
- const metadata = selectorMetadataById.get(selectorId);
36042
+ const metadata = ctx.selectorMetadataById.get(selectorId);
36014
36043
  if (!metadata || !metadata.matcher) {
36015
36044
  throw new Error(`missing compiled selector matcher for selector ${selectorId}`);
36016
36045
  }
36017
- const selector = selectorsById.get(selectorId);
36046
+ const selector = ctx.selectorsById.get(selectorId);
36018
36047
  if (!selector) {
36019
36048
  throw new Error(`missing selector ${selectorId}`);
36020
36049
  }
36021
- if (!selectorMatchesLayoutElement(metadata.matcher, node, perf, fileRoots, logger)) continue;
36050
+ if (!selectorMatchesLayoutElement(metadata.matcher, node, ctx.perf, fileRoots, ctx.logger)) continue;
36022
36051
  const edge = {
36023
- solidFile: node.solidFile,
36024
- elementId: node.elementId,
36025
- elementKey: node.key,
36026
36052
  selectorId: selector.id,
36027
36053
  specificityScore: selector.specificityScore,
36028
36054
  sourceOrder: selector.rule.sourceOrder
36029
36055
  };
36030
36056
  applies.push(edge);
36031
- perf.matchEdgesCreated++;
36057
+ ctx.perf.matchEdgesCreated++;
36032
36058
  const existing = appliesByElementNodeMutable.get(node);
36033
36059
  if (existing) {
36034
36060
  existing.push(edge);
@@ -36054,7 +36080,7 @@ function augmentCascadeWithTailwind(cascade, node, tailwind) {
36054
36080
  const classTokens = node.classTokens;
36055
36081
  if (classTokens.length === 0) return;
36056
36082
  const guardProvenance = {
36057
- kind: "unconditional",
36083
+ kind: 0 /* Unconditional */,
36058
36084
  conditions: [],
36059
36085
  key: "always"
36060
36086
  };
@@ -36071,8 +36097,7 @@ function augmentCascadeWithTailwind(cascade, node, tailwind) {
36071
36097
  if (cascade.has(property)) continue;
36072
36098
  cascade.set(property, {
36073
36099
  value: value2,
36074
- source: "selector",
36075
- guard: "unconditional",
36100
+ source: 0 /* Selector */,
36076
36101
  guardProvenance
36077
36102
  });
36078
36103
  }
@@ -36092,8 +36117,7 @@ function buildCascadeMapForElement(node, edges, monitoredDeclarationsBySelectorI
36092
36117
  const property = declaration.property;
36093
36118
  const newDeclaration = {
36094
36119
  value: declaration.value,
36095
- source: "selector",
36096
- guard: declaration.guard,
36120
+ source: 0 /* Selector */,
36097
36121
  guardProvenance: declaration.guardProvenance
36098
36122
  };
36099
36123
  const existingPosition = positions.get(property);
@@ -36112,33 +36136,26 @@ function buildCascadeMapForElement(node, edges, monitoredDeclarationsBySelectorI
36112
36136
  positions.set(property, declaration.position);
36113
36137
  }
36114
36138
  }
36115
- const inlinePosition = createInlineCascadePosition();
36116
- const inlineGuardProvenance = {
36117
- kind: "unconditional",
36118
- conditions: [],
36119
- key: "always"
36120
- };
36121
36139
  for (const [property, value2] of node.inlineStyleValues) {
36122
36140
  const newDeclaration = {
36123
36141
  value: value2,
36124
- source: "inline-style",
36125
- guard: "unconditional",
36126
- guardProvenance: inlineGuardProvenance
36142
+ source: 1 /* InlineStyle */,
36143
+ guardProvenance: INLINE_GUARD_PROVENANCE
36127
36144
  };
36128
36145
  const existingPosition = positions.get(property);
36129
36146
  if (existingPosition === void 0) {
36130
36147
  out.set(property, newDeclaration);
36131
- positions.set(property, inlinePosition);
36148
+ positions.set(property, INLINE_CASCADE_POSITION);
36132
36149
  continue;
36133
36150
  }
36134
36151
  const existingDeclaration = out.get(property);
36135
36152
  if (existingDeclaration === void 0) continue;
36136
36153
  if (!doesCandidateOverride(
36137
36154
  { declaration: existingDeclaration, position: existingPosition },
36138
- { declaration: newDeclaration, position: inlinePosition }
36155
+ { declaration: newDeclaration, position: INLINE_CASCADE_POSITION }
36139
36156
  )) continue;
36140
36157
  out.set(property, newDeclaration);
36141
- positions.set(property, inlinePosition);
36158
+ positions.set(property, INLINE_CASCADE_POSITION);
36142
36159
  }
36143
36160
  if (tailwind !== null) {
36144
36161
  augmentCascadeWithTailwind(out, node, tailwind);
@@ -36155,7 +36172,7 @@ function doesCandidateOverride(existing, incoming) {
36155
36172
  const existingSource = existing.declaration.source;
36156
36173
  const incomingSource = incoming.declaration.source;
36157
36174
  if (existingSource !== incomingSource) {
36158
- if (incomingSource === "inline-style") {
36175
+ if (incomingSource === 1 /* InlineStyle */) {
36159
36176
  if (existing.position.isImportant && !incoming.position.isImportant) return false;
36160
36177
  return true;
36161
36178
  }
@@ -36163,16 +36180,19 @@ function doesCandidateOverride(existing, incoming) {
36163
36180
  }
36164
36181
  return compareCascadePositions(incoming.position, existing.position) > 0;
36165
36182
  }
36166
- function createInlineCascadePosition() {
36167
- return {
36168
- layer: null,
36169
- layerOrder: Number.MAX_SAFE_INTEGER,
36170
- sourceOrder: Number.MAX_SAFE_INTEGER,
36171
- specificity: [1, 0, 0, 0],
36172
- specificityScore: Number.MAX_SAFE_INTEGER,
36173
- isImportant: false
36174
- };
36175
- }
36183
+ var INLINE_CASCADE_POSITION = Object.freeze({
36184
+ layer: null,
36185
+ layerOrder: Number.MAX_SAFE_INTEGER,
36186
+ sourceOrder: Number.MAX_SAFE_INTEGER,
36187
+ specificity: [1, 0, 0, 0],
36188
+ specificityScore: Number.MAX_SAFE_INTEGER,
36189
+ isImportant: false
36190
+ });
36191
+ var INLINE_GUARD_PROVENANCE = Object.freeze({
36192
+ kind: 0 /* Unconditional */,
36193
+ conditions: [],
36194
+ key: "always"
36195
+ });
36176
36196
  function resolveRuleLayerOrder(rule, css) {
36177
36197
  const layer = rule.containingLayer;
36178
36198
  if (!layer) return 0;
@@ -36180,14 +36200,14 @@ function resolveRuleLayerOrder(rule, css) {
36180
36200
  if (!name) return 0;
36181
36201
  return css.layerOrder.get(name) ?? 0;
36182
36202
  }
36183
- function buildConditionalDeltaIndex(elements, appliesByElementKey, monitoredDeclarationsBySelectorId) {
36184
- const conditionalSignalDeltaFactsByElementKey = /* @__PURE__ */ new Map();
36203
+ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclarationsBySelectorId) {
36204
+ const conditionalSignalDeltaFactsByNode = /* @__PURE__ */ new Map();
36185
36205
  const elementsWithConditionalDeltaBySignal = /* @__PURE__ */ new Map();
36186
- const baselineOffsetFactsByElementKey = /* @__PURE__ */ new Map();
36206
+ const baselineOffsetFactsByNode = /* @__PURE__ */ new Map();
36187
36207
  for (let i = 0; i < elements.length; i++) {
36188
36208
  const node = elements[i];
36189
36209
  if (!node) continue;
36190
- const edges = appliesByElementKey.get(node.key);
36210
+ const edges = appliesByNode.get(node);
36191
36211
  let factByProperty = null;
36192
36212
  if (edges !== void 0 && edges.length > 0) {
36193
36213
  const byProperty = /* @__PURE__ */ new Map();
@@ -36212,7 +36232,7 @@ function buildConditionalDeltaIndex(elements, appliesByElementKey, monitoredDecl
36212
36232
  };
36213
36233
  byProperty.set(property, bucket);
36214
36234
  }
36215
- if (declaration.guard === "conditional") {
36235
+ if (declaration.guardProvenance.kind === 1 /* Conditional */) {
36216
36236
  bucket.conditional.add(expandedEntry.value);
36217
36237
  continue;
36218
36238
  }
@@ -36252,7 +36272,7 @@ function buildConditionalDeltaIndex(elements, appliesByElementKey, monitoredDecl
36252
36272
  }
36253
36273
  if (facts.size > 0) {
36254
36274
  factByProperty = facts;
36255
- conditionalSignalDeltaFactsByElementKey.set(node.key, facts);
36275
+ conditionalSignalDeltaFactsByNode.set(node, facts);
36256
36276
  for (const [signal, fact] of facts) {
36257
36277
  if (!fact.hasConditional) continue;
36258
36278
  const existing = elementsWithConditionalDeltaBySignal.get(signal);
@@ -36289,13 +36309,13 @@ function buildConditionalDeltaIndex(elements, appliesByElementKey, monitoredDecl
36289
36309
  baselineBySignal.set(signal, [...values]);
36290
36310
  }
36291
36311
  if (baselineBySignal.size > 0) {
36292
- baselineOffsetFactsByElementKey.set(node.key, baselineBySignal);
36312
+ baselineOffsetFactsByNode.set(node, baselineBySignal);
36293
36313
  }
36294
36314
  }
36295
36315
  return {
36296
- conditionalSignalDeltaFactsByElementKey,
36316
+ conditionalSignalDeltaFactsByNode,
36297
36317
  elementsWithConditionalDeltaBySignal,
36298
- baselineOffsetFactsByElementKey
36318
+ baselineOffsetFactsByNode
36299
36319
  };
36300
36320
  }
36301
36321
  var EMPTY_NODE_LIST2 = [];
@@ -36422,8 +36442,8 @@ function getTextualContentState(element, memo, compositionMetaByElementId, logge
36422
36442
  if (child.kind === "expression") {
36423
36443
  if (isStructuralExpression(child.node)) {
36424
36444
  if (logger.enabled) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 unknown (structural expression child)`);
36425
- memo.set(element.id, "unknown");
36426
- return "unknown";
36445
+ memo.set(element.id, 2 /* Unknown */);
36446
+ return 2 /* Unknown */;
36427
36447
  }
36428
36448
  hasTextOnlyExpression = true;
36429
36449
  continue;
@@ -36431,8 +36451,8 @@ function getTextualContentState(element, memo, compositionMetaByElementId, logge
36431
36451
  if (child.kind !== "text") continue;
36432
36452
  if (child.node.type !== "JSXText") continue;
36433
36453
  if (isBlank(child.node.value)) continue;
36434
- memo.set(element.id, "yes");
36435
- return "yes";
36454
+ memo.set(element.id, 0 /* Yes */);
36455
+ return 0 /* Yes */;
36436
36456
  }
36437
36457
  let childHasUnknown = false;
36438
36458
  let childHasDynamicText = false;
@@ -36446,31 +36466,31 @@ function getTextualContentState(element, memo, compositionMetaByElementId, logge
36446
36466
  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`);
36447
36467
  continue;
36448
36468
  }
36449
- if (childState !== "no") {
36469
+ if (childState !== 1 /* No */) {
36450
36470
  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`);
36451
36471
  childHasUnknown = true;
36452
36472
  }
36453
36473
  continue;
36454
36474
  }
36455
- if (childState === "yes") {
36456
- memo.set(element.id, "yes");
36457
- return "yes";
36475
+ if (childState === 0 /* Yes */) {
36476
+ memo.set(element.id, 0 /* Yes */);
36477
+ return 0 /* Yes */;
36458
36478
  }
36459
- if (childState === "unknown") childHasUnknown = true;
36460
- if (childState === "dynamic-text") childHasDynamicText = true;
36479
+ if (childState === 2 /* Unknown */) childHasUnknown = true;
36480
+ if (childState === 3 /* DynamicText */) childHasDynamicText = true;
36461
36481
  }
36462
36482
  if (childHasUnknown) {
36463
36483
  if (logger.enabled) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 unknown (child has unknown)`);
36464
- memo.set(element.id, "unknown");
36465
- return "unknown";
36484
+ memo.set(element.id, 2 /* Unknown */);
36485
+ return 2 /* Unknown */;
36466
36486
  }
36467
36487
  if (hasTextOnlyExpression || childHasDynamicText) {
36468
36488
  if (logger.enabled) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 dynamic-text`);
36469
- memo.set(element.id, "dynamic-text");
36470
- return "dynamic-text";
36489
+ memo.set(element.id, 3 /* DynamicText */);
36490
+ return 3 /* DynamicText */;
36471
36491
  }
36472
- memo.set(element.id, "no");
36473
- return "no";
36492
+ memo.set(element.id, 1 /* No */);
36493
+ return 1 /* No */;
36474
36494
  }
36475
36495
  function isStructuralExpression(node) {
36476
36496
  if (node.type !== "JSXExpressionContainer") return false;
@@ -36769,8 +36789,6 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36769
36789
  classTokens: record.classTokens,
36770
36790
  classTokenSet: record.classTokenSet,
36771
36791
  inlineStyleKeys: record.inlineStyleKeys,
36772
- parentElementId,
36773
- parentElementKey: parentNode ? parentNode.key : parentElementId === null ? null : toLayoutElementKey(solid.file, parentElementId),
36774
36792
  parentElementNode: parentNode,
36775
36793
  previousSiblingNode,
36776
36794
  siblingIndex,
@@ -36811,22 +36829,25 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36811
36829
  logger.debug(`[build] rootElementsByFile file=${file} count=${roots.length}: ${descs.join(", ")}`);
36812
36830
  }
36813
36831
  }
36814
- const selectorCandidatesByElementKey = buildSelectorCandidatesByElementKey(elements, scopedSelectorsBySolidFile, perf);
36832
+ const selectorCandidatesByNode = buildSelectorCandidatesByNode(elements, scopedSelectorsBySolidFile, perf);
36833
+ const selectorMatchCtx = {
36834
+ selectorMetadataById,
36835
+ selectorsById,
36836
+ rootElementsByFile,
36837
+ perf,
36838
+ logger
36839
+ };
36815
36840
  for (let i = 0; i < elements.length; i++) {
36816
36841
  const node = elements[i];
36817
36842
  if (!node) continue;
36818
- const selectorIds = selectorCandidatesByElementKey.get(node.key) ?? EMPTY_NUMBER_LIST2;
36843
+ const selectorIds = selectorCandidatesByNode.get(node) ?? EMPTY_NUMBER_LIST2;
36819
36844
  if (selectorIds.length === 0) continue;
36820
36845
  appendMatchingEdgesFromSelectorIds(
36846
+ selectorMatchCtx,
36821
36847
  selectorIds,
36822
36848
  node,
36823
- selectorMetadataById,
36824
- selectorsById,
36825
36849
  applies,
36826
- appliesByElementNodeMutable,
36827
- perf,
36828
- rootElementsByFile,
36829
- logger
36850
+ appliesByElementNodeMutable
36830
36851
  );
36831
36852
  }
36832
36853
  perf.selectorMatchMs = performance.now() - selectorMatchStartedAt;
@@ -36834,7 +36855,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36834
36855
  for (const edges of appliesByElementNodeMutable.values()) {
36835
36856
  edges.sort(compareLayoutEdge);
36836
36857
  }
36837
- const appliesByElementKey = /* @__PURE__ */ new Map();
36858
+ const appliesByNode = /* @__PURE__ */ new Map();
36838
36859
  const tailwind = css.tailwind;
36839
36860
  for (let i = 0; i < elements.length; i++) {
36840
36861
  const node = elements[i];
@@ -36842,7 +36863,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36842
36863
  const edges = appliesByElementNodeMutable.get(node) ?? [];
36843
36864
  const cascade = buildCascadeMapForElement(node, edges, monitoredDeclarationsBySelectorId, tailwind);
36844
36865
  cascadeByElementNode.set(node, cascade);
36845
- appliesByElementKey.set(node.key, edges);
36866
+ appliesByNode.set(node, edges);
36846
36867
  }
36847
36868
  perf.cascadeBuildMs = performance.now() - cascadeStartedAt;
36848
36869
  const snapshotByElementNode = buildSignalSnapshotIndex(elements, cascadeByElementNode, perf);
@@ -36850,7 +36871,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36850
36871
  const factIndex = buildElementFactIndex(elements, snapshotByElementNode);
36851
36872
  const conditionalDeltaIndex = buildConditionalDeltaIndex(
36852
36873
  elements,
36853
- appliesByElementKey,
36874
+ appliesByNode,
36854
36875
  monitoredDeclarationsBySelectorId
36855
36876
  );
36856
36877
  const elementsWithConditionalOverflowDelta = buildConditionalDeltaSignalGroupElements(
@@ -36868,7 +36889,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36868
36889
  contextByParentNode,
36869
36890
  measurementNodeByRootKey,
36870
36891
  snapshotByElementNode,
36871
- snapshotHotSignalsByElementKey: factIndex.snapshotHotSignalsByElementKey
36892
+ snapshotHotSignalsByNode: factIndex.snapshotHotSignalsByNode
36872
36893
  });
36873
36894
  finalizeTableCellBaselineRelevance(contextByParentNode, cohortIndex.verticalAlignConsensusByParent);
36874
36895
  perf.conditionalSignals = cohortIndex.conditionalSignals;
@@ -36884,11 +36905,11 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36884
36905
  childrenByParentNode: childrenByParentNodeMutable,
36885
36906
  elementBySolidFileAndId: elementBySolidFileAndIdMutable,
36886
36907
  elementRefsBySolidFileAndId: elementRefsBySolidFileAndIdMutable,
36887
- appliesByElementKey,
36888
- selectorCandidatesByElementKey,
36908
+ appliesByNode,
36909
+ selectorCandidatesByNode,
36889
36910
  selectorsById,
36890
36911
  measurementNodeByRootKey,
36891
- snapshotHotSignalsByElementKey: factIndex.snapshotHotSignalsByElementKey,
36912
+ snapshotHotSignalsByNode: factIndex.snapshotHotSignalsByNode,
36892
36913
  elementsByTagName: factIndex.elementsByTagName,
36893
36914
  elementsWithConditionalDeltaBySignal: conditionalDeltaIndex.elementsWithConditionalDeltaBySignal,
36894
36915
  elementsWithConditionalOverflowDelta,
@@ -36896,12 +36917,12 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36896
36917
  elementsByKnownSignalValue: factIndex.elementsByKnownSignalValue,
36897
36918
  dynamicSlotCandidateElements: factIndex.dynamicSlotCandidateElements,
36898
36919
  scrollContainerElements: factIndex.scrollContainerElements,
36899
- reservedSpaceFactsByElementKey: factIndex.reservedSpaceFactsByElementKey,
36900
- scrollContainerFactsByElementKey: factIndex.scrollContainerFactsByElementKey,
36901
- flowParticipationFactsByElementKey: factIndex.flowParticipationFactsByElementKey,
36902
- containingBlockFactsByElementKey: factIndex.containingBlockFactsByElementKey,
36903
- conditionalSignalDeltaFactsByElementKey: conditionalDeltaIndex.conditionalSignalDeltaFactsByElementKey,
36904
- baselineOffsetFactsByElementKey: conditionalDeltaIndex.baselineOffsetFactsByElementKey,
36920
+ reservedSpaceFactsByNode: factIndex.reservedSpaceFactsByNode,
36921
+ scrollContainerFactsByNode: factIndex.scrollContainerFactsByNode,
36922
+ flowParticipationFactsByNode: factIndex.flowParticipationFactsByNode,
36923
+ containingBlockFactsByNode: factIndex.containingBlockFactsByNode,
36924
+ conditionalSignalDeltaFactsByNode: conditionalDeltaIndex.conditionalSignalDeltaFactsByNode,
36925
+ baselineOffsetFactsByNode: conditionalDeltaIndex.baselineOffsetFactsByNode,
36905
36926
  statefulSelectorEntriesByRuleId: statefulRuleIndexes.selectorEntriesByRuleId,
36906
36927
  statefulNormalizedDeclarationsByRuleId: statefulRuleIndexes.normalizedDeclarationsByRuleId,
36907
36928
  statefulBaseValueIndex: statefulRuleIndexes.baseValueIndex,
@@ -36913,11 +36934,11 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36913
36934
  };
36914
36935
  }
36915
36936
  function buildElementFactIndex(elements, snapshotByElementNode) {
36916
- const reservedSpaceFactsByElementKey = /* @__PURE__ */ new Map();
36917
- const scrollContainerFactsByElementKey = /* @__PURE__ */ new Map();
36918
- const flowParticipationFactsByElementKey = /* @__PURE__ */ new Map();
36919
- const containingBlockFactsByElementKey = /* @__PURE__ */ new Map();
36920
- const snapshotHotSignalsByElementKey = /* @__PURE__ */ new Map();
36937
+ const reservedSpaceFactsByNode = /* @__PURE__ */ new Map();
36938
+ const scrollContainerFactsByNode = /* @__PURE__ */ new Map();
36939
+ const flowParticipationFactsByNode = /* @__PURE__ */ new Map();
36940
+ const containingBlockFactsByNode = /* @__PURE__ */ new Map();
36941
+ const snapshotHotSignalsByNode = /* @__PURE__ */ new Map();
36921
36942
  const elementsByTagName = /* @__PURE__ */ new Map();
36922
36943
  const elementsByKnownSignalValue = /* @__PURE__ */ new Map();
36923
36944
  const dynamicSlotCandidateElements = [];
@@ -36927,7 +36948,7 @@ function buildElementFactIndex(elements, snapshotByElementNode) {
36927
36948
  const node = elements[i];
36928
36949
  if (!node) continue;
36929
36950
  const snapshot = snapshotByElementNode.get(node);
36930
- if (node.textualContent === "unknown" && node.siblingCount >= 2) {
36951
+ if (node.textualContent === 2 /* Unknown */ && node.siblingCount >= 2) {
36931
36952
  dynamicSlotCandidateElements.push(node);
36932
36953
  }
36933
36954
  if (node.tagName) {
@@ -36948,18 +36969,18 @@ function buildElementFactIndex(elements, snapshotByElementNode) {
36948
36969
  nearestPositionedAncestorHasReservedSpace = parentPositioned.hasReservedSpace;
36949
36970
  }
36950
36971
  }
36951
- containingBlockFactsByElementKey.set(node.key, {
36972
+ containingBlockFactsByNode.set(node, {
36952
36973
  nearestPositionedAncestorKey,
36953
36974
  nearestPositionedAncestorHasReservedSpace
36954
36975
  });
36955
36976
  if (!snapshot) continue;
36956
36977
  const reservedSpaceFact = computeReservedSpaceFact(snapshot);
36957
- reservedSpaceFactsByElementKey.set(node.key, reservedSpaceFact);
36978
+ reservedSpaceFactsByNode.set(node, reservedSpaceFact);
36958
36979
  const scrollFact = computeScrollContainerFact(snapshot);
36959
- scrollContainerFactsByElementKey.set(node.key, scrollFact);
36980
+ scrollContainerFactsByNode.set(node, scrollFact);
36960
36981
  if (scrollFact.isScrollContainer) scrollContainerElements.push(node);
36961
- flowParticipationFactsByElementKey.set(node.key, computeFlowParticipationFact(snapshot));
36962
- snapshotHotSignalsByElementKey.set(node.key, computeHotSignals(snapshot));
36982
+ flowParticipationFactsByNode.set(node, computeFlowParticipationFact(snapshot));
36983
+ snapshotHotSignalsByNode.set(node, computeHotSignals(snapshot));
36963
36984
  const positionSignal = snapshot.signals.get("position");
36964
36985
  const isPositioned = positionSignal !== void 0 && positionSignal.kind === "known" && positionSignal.normalized !== "static";
36965
36986
  if (isPositioned) {
@@ -36990,49 +37011,163 @@ function buildElementFactIndex(elements, snapshotByElementNode) {
36990
37011
  }
36991
37012
  }
36992
37013
  return {
36993
- reservedSpaceFactsByElementKey,
36994
- scrollContainerFactsByElementKey,
37014
+ reservedSpaceFactsByNode,
37015
+ scrollContainerFactsByNode,
36995
37016
  scrollContainerElements,
36996
- flowParticipationFactsByElementKey,
36997
- containingBlockFactsByElementKey,
36998
- snapshotHotSignalsByElementKey,
37017
+ flowParticipationFactsByNode,
37018
+ containingBlockFactsByNode,
37019
+ snapshotHotSignalsByNode,
36999
37020
  elementsByTagName,
37000
37021
  elementsByKnownSignalValue,
37001
37022
  dynamicSlotCandidateElements
37002
37023
  };
37003
37024
  }
37004
- function computeHotSignals(snapshot) {
37025
+ var ABSENT_NUMERIC = Object.freeze({
37026
+ present: false,
37027
+ value: null,
37028
+ kind: 3 /* Unknown */
37029
+ });
37030
+ var ABSENT_NORMALIZED = Object.freeze({
37031
+ present: false,
37032
+ value: null,
37033
+ kind: 3 /* Unknown */
37034
+ });
37035
+ function toHotNumeric(signal) {
37036
+ if (signal.kind !== "known") {
37037
+ return {
37038
+ present: true,
37039
+ value: null,
37040
+ kind: signal.guard.kind === 1 /* Conditional */ ? 2 /* Conditional */ : 3 /* Unknown */
37041
+ };
37042
+ }
37005
37043
  return {
37006
- lineHeight: computeHotNumeric(snapshot, "line-height"),
37007
- verticalAlign: computeHotNormalized(snapshot, "vertical-align"),
37008
- alignSelf: computeHotNormalized(snapshot, "align-self"),
37009
- placeSelf: computeHotNormalized(snapshot, "place-self"),
37010
- writingMode: computeHotNormalized(snapshot, "writing-mode"),
37011
- direction: computeHotNormalized(snapshot, "direction"),
37012
- display: computeHotNormalized(snapshot, "display"),
37013
- alignItems: computeHotNormalized(snapshot, "align-items"),
37014
- placeItems: computeHotNormalized(snapshot, "place-items"),
37015
- position: computeHotNormalized(snapshot, "position"),
37016
- insetBlockStart: computeHotNumeric(snapshot, "inset-block-start"),
37017
- insetBlockEnd: computeHotNumeric(snapshot, "inset-block-end"),
37018
- transform: computeHotNumeric(snapshot, "transform"),
37019
- translate: computeHotNumeric(snapshot, "translate"),
37020
- top: computeHotNumeric(snapshot, "top"),
37021
- bottom: computeHotNumeric(snapshot, "bottom"),
37022
- marginTop: computeHotNumeric(snapshot, "margin-top"),
37023
- marginBottom: computeHotNumeric(snapshot, "margin-bottom")
37044
+ present: true,
37045
+ value: signal.px,
37046
+ kind: signal.guard.kind === 1 /* Conditional */ ? 2 /* Conditional */ : signal.quality === "estimated" ? 1 /* Interval */ : 0 /* Exact */
37024
37047
  };
37025
37048
  }
37026
- function computeHotNumeric(snapshot, name) {
37049
+ function toHotNormalized(signal) {
37050
+ if (signal.kind !== "known") {
37051
+ return {
37052
+ present: true,
37053
+ value: null,
37054
+ kind: signal.guard.kind === 1 /* Conditional */ ? 2 /* Conditional */ : 3 /* Unknown */
37055
+ };
37056
+ }
37027
37057
  return {
37028
- present: snapshot.signals.has(name),
37029
- ...readNumericSignalEvidence(snapshot, name)
37058
+ present: true,
37059
+ value: signal.normalized,
37060
+ kind: signal.guard.kind === 1 /* Conditional */ ? 2 /* Conditional */ : signal.quality === "estimated" ? 1 /* Interval */ : 0 /* Exact */
37030
37061
  };
37031
37062
  }
37032
- function computeHotNormalized(snapshot, name) {
37063
+ function computeHotSignals(snapshot) {
37064
+ let lineHeight = ABSENT_NUMERIC;
37065
+ let verticalAlign = ABSENT_NORMALIZED;
37066
+ let alignSelf = ABSENT_NORMALIZED;
37067
+ let placeSelf = ABSENT_NORMALIZED;
37068
+ let flexDirection = ABSENT_NORMALIZED;
37069
+ let gridAutoFlow = ABSENT_NORMALIZED;
37070
+ let writingMode = ABSENT_NORMALIZED;
37071
+ let direction = ABSENT_NORMALIZED;
37072
+ let display = ABSENT_NORMALIZED;
37073
+ let alignItems = ABSENT_NORMALIZED;
37074
+ let placeItems = ABSENT_NORMALIZED;
37075
+ let position = ABSENT_NORMALIZED;
37076
+ let insetBlockStart = ABSENT_NUMERIC;
37077
+ let insetBlockEnd = ABSENT_NUMERIC;
37078
+ let transform = ABSENT_NUMERIC;
37079
+ let translate = ABSENT_NUMERIC;
37080
+ let top = ABSENT_NUMERIC;
37081
+ let bottom = ABSENT_NUMERIC;
37082
+ let marginTop = ABSENT_NUMERIC;
37083
+ let marginBottom = ABSENT_NUMERIC;
37084
+ for (const [name, value2] of snapshot.signals) {
37085
+ switch (name) {
37086
+ case "line-height":
37087
+ lineHeight = toHotNumeric(value2);
37088
+ break;
37089
+ case "vertical-align":
37090
+ verticalAlign = toHotNormalized(value2);
37091
+ break;
37092
+ case "align-self":
37093
+ alignSelf = toHotNormalized(value2);
37094
+ break;
37095
+ case "place-self":
37096
+ placeSelf = toHotNormalized(value2);
37097
+ break;
37098
+ case "flex-direction":
37099
+ flexDirection = toHotNormalized(value2);
37100
+ break;
37101
+ case "grid-auto-flow":
37102
+ gridAutoFlow = toHotNormalized(value2);
37103
+ break;
37104
+ case "writing-mode":
37105
+ writingMode = toHotNormalized(value2);
37106
+ break;
37107
+ case "direction":
37108
+ direction = toHotNormalized(value2);
37109
+ break;
37110
+ case "display":
37111
+ display = toHotNormalized(value2);
37112
+ break;
37113
+ case "align-items":
37114
+ alignItems = toHotNormalized(value2);
37115
+ break;
37116
+ case "place-items":
37117
+ placeItems = toHotNormalized(value2);
37118
+ break;
37119
+ case "position":
37120
+ position = toHotNormalized(value2);
37121
+ break;
37122
+ case "inset-block-start":
37123
+ insetBlockStart = toHotNumeric(value2);
37124
+ break;
37125
+ case "inset-block-end":
37126
+ insetBlockEnd = toHotNumeric(value2);
37127
+ break;
37128
+ case "transform":
37129
+ transform = toHotNumeric(value2);
37130
+ break;
37131
+ case "translate":
37132
+ translate = toHotNumeric(value2);
37133
+ break;
37134
+ case "top":
37135
+ top = toHotNumeric(value2);
37136
+ break;
37137
+ case "bottom":
37138
+ bottom = toHotNumeric(value2);
37139
+ break;
37140
+ case "margin-top":
37141
+ marginTop = toHotNumeric(value2);
37142
+ break;
37143
+ case "margin-bottom":
37144
+ marginBottom = toHotNumeric(value2);
37145
+ break;
37146
+ default:
37147
+ break;
37148
+ }
37149
+ }
37033
37150
  return {
37034
- present: snapshot.signals.has(name),
37035
- ...readNormalizedSignalEvidence(snapshot, name)
37151
+ lineHeight,
37152
+ verticalAlign,
37153
+ alignSelf,
37154
+ placeSelf,
37155
+ flexDirection,
37156
+ gridAutoFlow,
37157
+ writingMode,
37158
+ direction,
37159
+ display,
37160
+ alignItems,
37161
+ placeItems,
37162
+ position,
37163
+ insetBlockStart,
37164
+ insetBlockEnd,
37165
+ transform,
37166
+ translate,
37167
+ top,
37168
+ bottom,
37169
+ marginTop,
37170
+ marginBottom
37036
37171
  };
37037
37172
  }
37038
37173
  function computeReservedSpaceFact(snapshot) {
@@ -37067,15 +37202,14 @@ function computeReservedSpaceFact(snapshot) {
37067
37202
  function hasPositiveOrDeclaredDimension(snapshot, property) {
37068
37203
  const signal = snapshot.signals.get(property);
37069
37204
  if (!signal) return false;
37070
- if (signal.guard !== "unconditional") return false;
37205
+ if (signal.guard.kind !== 0 /* Unconditional */) return false;
37071
37206
  let normalized = "";
37072
37207
  if (signal.kind === "known") {
37073
37208
  if (signal.px !== null) return signal.px > 0;
37074
37209
  normalized = signal.normalized.trim().toLowerCase();
37075
37210
  }
37076
37211
  if (signal.kind === "unknown") {
37077
- if (signal.raw === null) return false;
37078
- normalized = signal.raw.trim().toLowerCase();
37212
+ return signal.source !== null;
37079
37213
  }
37080
37214
  if (normalized.length === 0) return false;
37081
37215
  if (isNonReservingDimension(normalized)) return false;
@@ -37084,15 +37218,14 @@ function hasPositiveOrDeclaredDimension(snapshot, property) {
37084
37218
  function hasUsableAspectRatio(snapshot) {
37085
37219
  const signal = snapshot.signals.get("aspect-ratio");
37086
37220
  if (!signal) return false;
37087
- if (signal.guard !== "unconditional") return false;
37221
+ if (signal.guard.kind !== 0 /* Unconditional */) return false;
37222
+ if (signal.kind === "unknown") {
37223
+ return false;
37224
+ }
37088
37225
  let normalized = "";
37089
37226
  if (signal.kind === "known") {
37090
37227
  normalized = signal.normalized.trim().toLowerCase();
37091
37228
  }
37092
- if (signal.kind === "unknown") {
37093
- if (signal.raw === null) return false;
37094
- normalized = signal.raw.trim().toLowerCase();
37095
- }
37096
37229
  if (normalized.length === 0) return false;
37097
37230
  return normalized !== "auto";
37098
37231
  }
@@ -37110,8 +37243,8 @@ function computeScrollContainerFact(snapshot) {
37110
37243
  const yFromLonghand = parseSingleAxisScroll(overflowY);
37111
37244
  const xScroll = shorthandAxis.x;
37112
37245
  const yScroll = yFromLonghand === null ? shorthandAxis.y : yFromLonghand;
37113
- const hasConditionalScroll = overflowSignal?.guard === "conditional" && (shorthandAxis.x || shorthandAxis.y) || overflowYSignal?.guard === "conditional" && yFromLonghand === true;
37114
- const hasUnconditionalScroll = overflowSignal?.guard === "unconditional" && (shorthandAxis.x || shorthandAxis.y) || overflowYSignal?.guard === "unconditional" && yFromLonghand === true;
37246
+ const hasConditionalScroll = overflowSignal?.guard.kind === 1 /* Conditional */ && (shorthandAxis.x || shorthandAxis.y) || overflowYSignal?.guard.kind === 1 /* Conditional */ && yFromLonghand === true;
37247
+ const hasUnconditionalScroll = overflowSignal?.guard.kind === 0 /* Unconditional */ && (shorthandAxis.x || shorthandAxis.y) || overflowYSignal?.guard.kind === 0 /* Unconditional */ && yFromLonghand === true;
37115
37248
  return {
37116
37249
  isScrollContainer: xScroll || yScroll,
37117
37250
  axis: toScrollAxis(xScroll, yScroll),
@@ -37121,18 +37254,18 @@ function computeScrollContainerFact(snapshot) {
37121
37254
  hasUnconditionalScroll
37122
37255
  };
37123
37256
  }
37257
+ var NO_SCROLL = Object.freeze({ x: false, y: false });
37258
+ var BOTH_SCROLL = Object.freeze({ x: true, y: true });
37124
37259
  function parseOverflowShorthandAxis(value2) {
37125
- if (value2 === null) return { x: false, y: false };
37126
- const tokens = splitWhitespaceTokens(value2);
37127
- if (tokens.length === 0) return { x: false, y: false };
37128
- const first = tokens[0];
37129
- if (!first) return { x: false, y: false };
37130
- if (tokens.length === 1) {
37131
- const scroll = SCROLLABLE_VALUES.has(first);
37132
- return { x: scroll, y: scroll };
37133
- }
37134
- const second = tokens[1];
37135
- if (!second) return { x: SCROLLABLE_VALUES.has(first), y: false };
37260
+ if (value2 === null) return NO_SCROLL;
37261
+ const trimmed = value2.trim();
37262
+ const spaceIdx = trimmed.indexOf(" ");
37263
+ if (spaceIdx === -1) {
37264
+ const scroll = SCROLLABLE_VALUES.has(trimmed);
37265
+ return scroll ? BOTH_SCROLL : NO_SCROLL;
37266
+ }
37267
+ const first = trimmed.slice(0, spaceIdx);
37268
+ const second = trimmed.slice(spaceIdx + 1).trimStart();
37136
37269
  return {
37137
37270
  x: SCROLLABLE_VALUES.has(first),
37138
37271
  y: SCROLLABLE_VALUES.has(second)
@@ -37140,16 +37273,16 @@ function parseOverflowShorthandAxis(value2) {
37140
37273
  }
37141
37274
  function parseSingleAxisScroll(value2) {
37142
37275
  if (value2 === null) return null;
37143
- const tokens = splitWhitespaceTokens(value2);
37144
- const first = tokens[0];
37145
- if (!first) return null;
37276
+ const trimmed = value2.trim();
37277
+ const spaceIdx = trimmed.indexOf(" ");
37278
+ const first = spaceIdx === -1 ? trimmed : trimmed.slice(0, spaceIdx);
37146
37279
  return SCROLLABLE_VALUES.has(first);
37147
37280
  }
37148
37281
  function toScrollAxis(x, y) {
37149
- if (x && y) return "both";
37150
- if (x) return "x";
37151
- if (y) return "y";
37152
- return "none";
37282
+ if (x && y) return 3 /* Both */;
37283
+ if (x) return 1 /* X */;
37284
+ if (y) return 2 /* Y */;
37285
+ return 0 /* None */;
37153
37286
  }
37154
37287
  function computeFlowParticipationFact(snapshot) {
37155
37288
  const signal = snapshot.signals.get("position");
@@ -37166,8 +37299,8 @@ function computeFlowParticipationFact(snapshot) {
37166
37299
  return {
37167
37300
  inFlow: !outOfFlow,
37168
37301
  position,
37169
- hasConditionalOutOfFlow: signal.guard === "conditional" && outOfFlow,
37170
- hasUnconditionalOutOfFlow: signal.guard === "unconditional" && outOfFlow
37302
+ hasConditionalOutOfFlow: signal.guard.kind === 1 /* Conditional */ && outOfFlow,
37303
+ hasUnconditionalOutOfFlow: signal.guard.kind === 0 /* Unconditional */ && outOfFlow
37171
37304
  };
37172
37305
  }
37173
37306
  function buildContextIndex(childrenByParentNode, snapshotByElementNode, perf) {
@@ -37280,7 +37413,7 @@ function collectAlignmentCases(context) {
37280
37413
  subjectDeclaredOffsetDeviation,
37281
37414
  subjectEffectiveOffsetDeviation,
37282
37415
  subjectLineHeightDeviation,
37283
- subjectStats.element.snapshot.textualContent,
37416
+ subjectStats.element.snapshot.node.textualContent,
37284
37417
  subjectStats.element,
37285
37418
  subjectStats.contentComposition,
37286
37419
  cohortContentCompositions
@@ -37373,26 +37506,26 @@ function coverageFromNumeric(value2) {
37373
37506
  }
37374
37507
  function coverageFromConflict(value2) {
37375
37508
  const certainty = coverageFromKind(value2.kind);
37376
- if (value2.value === "unknown") return certainty * 0.4;
37509
+ if (value2.value === 2 /* Unknown */) return certainty * 0.4;
37377
37510
  return certainty;
37378
37511
  }
37379
37512
  function coverageFromTextContrast(value2) {
37380
- if (value2 === "unknown") return 0.35;
37513
+ if (value2 === 2 /* Unknown */) return 0.35;
37381
37514
  return 1;
37382
37515
  }
37383
37516
  function coverageFromSubjectText(subjectTextualContent) {
37384
- if (subjectTextualContent === "unknown") return 0.35;
37517
+ if (subjectTextualContent === 2 /* Unknown */) return 0.35;
37385
37518
  return 1;
37386
37519
  }
37387
37520
  function coverageFromContextCertainty(certainty) {
37388
- if (certainty === "resolved") return 1;
37389
- if (certainty === "conditional") return 0.55;
37521
+ if (certainty === 0 /* Resolved */) return 1;
37522
+ if (certainty === 1 /* Conditional */) return 0.55;
37390
37523
  return 0.25;
37391
37524
  }
37392
37525
  function coverageFromKind(kind) {
37393
- if (kind === "exact") return 1;
37394
- if (kind === "interval") return 0.78;
37395
- if (kind === "conditional") return 0.5;
37526
+ if (kind === 0 /* Exact */) return 1;
37527
+ if (kind === 1 /* Interval */) return 0.78;
37528
+ if (kind === 2 /* Conditional */) return 0.5;
37396
37529
  return 0.2;
37397
37530
  }
37398
37531
  function averageCoverage(...values) {
@@ -37425,24 +37558,7 @@ function resolveEffectiveAlignmentContext(parentContext, child, measurementNode,
37425
37558
  const childContext = contextByParentNode.get(child);
37426
37559
  if (!childContext) return parentContext;
37427
37560
  if (childContext.baselineRelevance !== "irrelevant") return parentContext;
37428
- return {
37429
- kind: parentContext.kind,
37430
- certainty: parentContext.certainty,
37431
- parentSolidFile: parentContext.parentSolidFile,
37432
- parentElementId: parentContext.parentElementId,
37433
- parentElementKey: parentContext.parentElementKey,
37434
- parentTag: parentContext.parentTag,
37435
- axis: parentContext.axis,
37436
- axisCertainty: parentContext.axisCertainty,
37437
- inlineDirection: parentContext.inlineDirection,
37438
- inlineDirectionCertainty: parentContext.inlineDirectionCertainty,
37439
- parentDisplay: parentContext.parentDisplay,
37440
- parentAlignItems: parentContext.parentAlignItems,
37441
- parentPlaceItems: parentContext.parentPlaceItems,
37442
- hasPositionedOffset: parentContext.hasPositionedOffset,
37443
- baselineRelevance: "irrelevant",
37444
- evidence: parentContext.evidence
37445
- };
37561
+ return deriveAlignmentContext(parentContext, { baselineRelevance: "irrelevant" });
37446
37562
  }
37447
37563
  function compareAlignmentCaseOrder(left, right) {
37448
37564
  if (left.subject.solidFile < right.subject.solidFile) return -1;
@@ -37461,12 +37577,12 @@ function buildConsistencyEvidence(input) {
37461
37577
  input.cohortProfile.medianLineHeightPx,
37462
37578
  input.cohortProfile.medianDeclaredOffsetPx
37463
37579
  );
37464
- const offset = normalizeDeviation(
37580
+ const offsetRaw = normalizeDeviation(
37465
37581
  input.subjectEffectiveOffsetDeviation,
37466
37582
  input.cohortProfile.effectiveOffsetDispersionPx,
37467
37583
  effectiveOffsetScaleReference
37468
37584
  );
37469
- const declaredOffset = normalizeDeviation(
37585
+ const declaredOffsetRaw = normalizeDeviation(
37470
37586
  input.subjectDeclaredOffsetDeviation,
37471
37587
  input.cohortProfile.declaredOffsetDispersionPx,
37472
37588
  declaredOffsetScaleReference
@@ -37477,10 +37593,15 @@ function buildConsistencyEvidence(input) {
37477
37593
  input.cohortProfile.medianLineHeightPx
37478
37594
  );
37479
37595
  const baselinesIrrelevant = input.context.baselineRelevance === "irrelevant";
37480
- const baselineStrength = baselinesIrrelevant ? ZERO_STRENGTH : resolveBaselineStrength(input, lineHeight);
37481
- const contextStrength = baselinesIrrelevant ? ZERO_STRENGTH : resolveContextStrength(input, lineHeight);
37482
- const replacedStrength = baselinesIrrelevant ? ZERO_STRENGTH : resolveReplacedControlStrength(input, lineHeight);
37483
- const compositionStrength = baselinesIrrelevant ? ZERO_STRENGTH : resolveContentCompositionStrength(input);
37596
+ const blockAxisIsMainAxis = !input.context.crossAxisIsBlockAxis;
37597
+ const suppressAll = blockAxisIsMainAxis;
37598
+ const offset = suppressAll ? ZERO_STRENGTH : offsetRaw;
37599
+ const declaredOffset = suppressAll ? ZERO_STRENGTH : declaredOffsetRaw;
37600
+ const baselineStrength = baselinesIrrelevant || suppressAll ? ZERO_STRENGTH : resolveBaselineStrength(input, lineHeight);
37601
+ const contextStrength = baselinesIrrelevant || suppressAll ? ZERO_STRENGTH : resolveContextStrength(input, lineHeight);
37602
+ const replacedStrength = baselinesIrrelevant || suppressAll ? ZERO_STRENGTH : resolveReplacedControlStrength(input, lineHeight);
37603
+ const compositionResult = baselinesIrrelevant || suppressAll ? null : resolveContentCompositionStrength(input);
37604
+ const compositionStrength = compositionResult ? compositionResult.evidence : ZERO_STRENGTH;
37484
37605
  const contextCertaintyPenalty = resolveContextCertaintyPenalty(input);
37485
37606
  const provenance = input.cohortProvenance;
37486
37607
  const atoms = buildEvidenceAtoms(
@@ -37501,6 +37622,7 @@ function buildConsistencyEvidence(input) {
37501
37622
  contextStrength: contextStrength.strength,
37502
37623
  replacedStrength: replacedStrength.strength,
37503
37624
  compositionStrength: compositionStrength.strength,
37625
+ majorityClassification: compositionResult ? compositionResult.divergence.majorityClassification : 5 /* Unknown */,
37504
37626
  identifiability: input.subjectIdentifiability,
37505
37627
  factSummary,
37506
37628
  atoms
@@ -37536,7 +37658,7 @@ function resolveOffsetScaleReference(medianLineHeightPx, fallbackMedianOffsetPx)
37536
37658
  }
37537
37659
  function resolveBaselineStrength(input, lineHeight) {
37538
37660
  const verticalAlign = input.cohortSignals.verticalAlign;
37539
- const hasConflict = verticalAlign.value === "conflict";
37661
+ const hasConflict = verticalAlign.value === 0 /* Conflict */;
37540
37662
  const conflict = hasConflict ? alignmentStrengthCalibration.baselineConflictBoost : 0;
37541
37663
  const kind = resolveBaselineEvidenceKind(lineHeight.kind, verticalAlign.kind, hasConflict);
37542
37664
  return {
@@ -37546,7 +37668,7 @@ function resolveBaselineStrength(input, lineHeight) {
37546
37668
  }
37547
37669
  function resolveBaselineEvidenceKind(lineHeightKind, verticalAlignKind, hasConflict) {
37548
37670
  if (!hasConflict) return mergeEvidenceKind(lineHeightKind, verticalAlignKind);
37549
- if (lineHeightKind === "unknown") return verticalAlignKind;
37671
+ if (lineHeightKind === 3 /* Unknown */) return verticalAlignKind;
37550
37672
  return mergeEvidenceKind(lineHeightKind, verticalAlignKind);
37551
37673
  }
37552
37674
  function resolveContextStrength(input, lineHeight) {
@@ -37574,7 +37696,7 @@ function resolveContextConflictEvidence(input) {
37574
37696
  const alignSelf = input.cohortSignals.alignSelf;
37575
37697
  const placeSelf = input.cohortSignals.placeSelf;
37576
37698
  const kind = mergeEvidenceKind(alignSelf.kind, placeSelf.kind);
37577
- const hasConflict = alignSelf.value === "conflict" || placeSelf.value === "conflict";
37699
+ const hasConflict = alignSelf.value === 0 /* Conflict */ || placeSelf.value === 0 /* Conflict */;
37578
37700
  if (!hasConflict) {
37579
37701
  return {
37580
37702
  strength: 0,
@@ -37588,23 +37710,23 @@ function resolveContextConflictEvidence(input) {
37588
37710
  }
37589
37711
  function resolveReplacedControlStrength(input, lineHeight) {
37590
37712
  const subject = input.subject.snapshot;
37591
- const hasReplacedPair = subject.isControl || subject.isReplaced || input.cohortSignals.hasControlOrReplacedPeer;
37713
+ const hasReplacedPair = subject.node.isControl || subject.node.isReplaced || input.cohortSignals.hasControlOrReplacedPeer;
37592
37714
  if (!hasReplacedPair) {
37593
37715
  return {
37594
37716
  strength: 0,
37595
37717
  kind: lineHeight.kind
37596
37718
  };
37597
37719
  }
37598
- if (input.cohortSignals.textContrastWithPeers === "different") {
37720
+ if (input.cohortSignals.textContrastWithPeers === 0 /* Different */) {
37599
37721
  return {
37600
37722
  strength: alignmentStrengthCalibration.replacedDifferentTextBoost,
37601
- kind: "exact"
37723
+ kind: 0 /* Exact */
37602
37724
  };
37603
37725
  }
37604
- if (input.cohortSignals.textContrastWithPeers === "unknown") {
37726
+ if (input.cohortSignals.textContrastWithPeers === 2 /* Unknown */) {
37605
37727
  return {
37606
37728
  strength: alignmentStrengthCalibration.replacedUnknownTextBoost,
37607
- kind: "conditional"
37729
+ kind: 2 /* Conditional */
37608
37730
  };
37609
37731
  }
37610
37732
  return {
@@ -37613,22 +37735,28 @@ function resolveReplacedControlStrength(input, lineHeight) {
37613
37735
  };
37614
37736
  }
37615
37737
  function resolveContentCompositionStrength(input) {
37616
- const divergenceStrength = resolveCompositionDivergenceStrength(
37738
+ const divergence = resolveCompositionDivergence(
37617
37739
  input.subjectContentComposition,
37618
37740
  input.cohortContentCompositions,
37619
37741
  input.context
37620
37742
  );
37621
- if (divergenceStrength <= 0) {
37743
+ if (divergence.strength <= 0) {
37622
37744
  return {
37623
- strength: 0,
37624
- kind: "exact"
37745
+ evidence: {
37746
+ strength: 0,
37747
+ kind: 0 /* Exact */
37748
+ },
37749
+ divergence
37625
37750
  };
37626
37751
  }
37627
37752
  const subjectClassification = input.subjectContentComposition.classification;
37628
- const kind = subjectClassification === "unknown" ? "conditional" : "exact";
37753
+ const kind = subjectClassification === 5 /* Unknown */ ? 2 /* Conditional */ : 0 /* Exact */;
37629
37754
  return {
37630
- strength: clamp(divergenceStrength, 0, 1),
37631
- kind
37755
+ evidence: {
37756
+ strength: clamp(divergence.strength, 0, 1),
37757
+ kind
37758
+ },
37759
+ divergence
37632
37760
  };
37633
37761
  }
37634
37762
  function resolveContextCertaintyPenalty(input) {
@@ -37700,9 +37828,9 @@ function buildEvidenceAtoms(input, offset, declaredOffset, baselineStrength, con
37700
37828
  return out;
37701
37829
  }
37702
37830
  function mapContextCertaintyToEvidenceKind(certainty) {
37703
- if (certainty === "resolved") return "exact";
37704
- if (certainty === "conditional") return "conditional";
37705
- return "unknown";
37831
+ if (certainty === 0 /* Resolved */) return 0 /* Exact */;
37832
+ if (certainty === 1 /* Conditional */) return 2 /* Conditional */;
37833
+ return 3 /* Unknown */;
37706
37834
  }
37707
37835
  function pushSupportAtom(out, factorId, valueKind, strength, coverage, provenance) {
37708
37836
  pushAtom(out, factorId, valueKind, strength, coverage, provenance, "support");
@@ -37728,19 +37856,19 @@ function pushAtom(out, factorId, valueKind, strength, coverage, provenance, expe
37728
37856
  }
37729
37857
  function toPositiveContribution(strength, maxWeight, valueKind) {
37730
37858
  const contribution = clamp(strength, 0, 2) * maxWeight;
37731
- if (valueKind === "exact") {
37859
+ if (valueKind === 0 /* Exact */) {
37732
37860
  return {
37733
37861
  min: contribution,
37734
37862
  max: contribution
37735
37863
  };
37736
37864
  }
37737
- if (valueKind === "interval") {
37865
+ if (valueKind === 1 /* Interval */) {
37738
37866
  return {
37739
37867
  min: contribution * evidenceContributionCalibration.supportIntervalLowerScale,
37740
37868
  max: contribution
37741
37869
  };
37742
37870
  }
37743
- if (valueKind === "conditional") {
37871
+ if (valueKind === 2 /* Conditional */) {
37744
37872
  return {
37745
37873
  min: 0,
37746
37874
  max: contribution * evidenceContributionCalibration.supportConditionalUpperScale
@@ -37753,19 +37881,19 @@ function toPositiveContribution(strength, maxWeight, valueKind) {
37753
37881
  }
37754
37882
  function toNegativeContribution(strength, maxPenalty, valueKind) {
37755
37883
  const penalty = clamp(strength, 0, 1) * maxPenalty;
37756
- if (valueKind === "exact") {
37884
+ if (valueKind === 0 /* Exact */) {
37757
37885
  return {
37758
37886
  min: -penalty,
37759
37887
  max: -penalty
37760
37888
  };
37761
37889
  }
37762
- if (valueKind === "interval") {
37890
+ if (valueKind === 1 /* Interval */) {
37763
37891
  return {
37764
37892
  min: -penalty,
37765
37893
  max: -penalty * evidenceContributionCalibration.penaltyIntervalUpperScale
37766
37894
  };
37767
37895
  }
37768
- if (valueKind === "conditional") {
37896
+ if (valueKind === 2 /* Conditional */) {
37769
37897
  return {
37770
37898
  min: -penalty,
37771
37899
  max: 0
@@ -37776,7 +37904,7 @@ function toNegativeContribution(strength, maxPenalty, valueKind) {
37776
37904
  max: 0
37777
37905
  };
37778
37906
  }
37779
- var ZERO_STRENGTH = { strength: 0, kind: "exact" };
37907
+ var ZERO_STRENGTH = { strength: 0, kind: 0 /* Exact */ };
37780
37908
 
37781
37909
  // src/cross-file/layout/consistency-policy.ts
37782
37910
  function applyConsistencyPolicy(input) {
@@ -37860,23 +37988,38 @@ function resolveConfidence(posterior, evidenceMass) {
37860
37988
  const confidence = posterior.lower * weightedMass * (1 - intervalWidth * alignmentPolicyCalibration.confidenceIntervalPenalty);
37861
37989
  return clamp(confidence, 0, 1);
37862
37990
  }
37991
+ var EMPTY_FACTOR_LIST = Object.freeze([]);
37863
37992
  function selectTopFactors(evidence) {
37864
- const sorted = [...evidence.atoms];
37865
- sorted.sort((left, right) => {
37866
- const leftMagnitude = Math.abs((left.contribution.min + left.contribution.max) / 2);
37867
- const rightMagnitude = Math.abs((right.contribution.min + right.contribution.max) / 2);
37868
- if (leftMagnitude !== rightMagnitude) return rightMagnitude - leftMagnitude;
37869
- if (left.factorId < right.factorId) return -1;
37870
- if (left.factorId > right.factorId) return 1;
37993
+ const atoms = evidence.atoms;
37994
+ if (atoms.length === 0) return EMPTY_FACTOR_LIST;
37995
+ const top = [];
37996
+ for (let i = 0; i < atoms.length; i++) {
37997
+ const atom = atoms[i];
37998
+ if (!atom) continue;
37999
+ const mag = Math.abs((atom.contribution.min + atom.contribution.max) / 2);
38000
+ if (mag <= 0) continue;
38001
+ if (top.length < 4) {
38002
+ top.push({ id: atom.factorId, mag });
38003
+ continue;
38004
+ }
38005
+ let minIdx = 0;
38006
+ for (let j = 1; j < top.length; j++) {
38007
+ const curr = top[j];
38008
+ const best = top[minIdx];
38009
+ if (curr && best && curr.mag < best.mag) minIdx = j;
38010
+ }
38011
+ const minEntry = top[minIdx];
38012
+ if (minEntry && mag > minEntry.mag) {
38013
+ top[minIdx] = { id: atom.factorId, mag };
38014
+ }
38015
+ }
38016
+ top.sort((a, b) => {
38017
+ if (a.mag !== b.mag) return b.mag - a.mag;
38018
+ if (a.id < b.id) return -1;
38019
+ if (a.id > b.id) return 1;
37871
38020
  return 0;
37872
38021
  });
37873
- const out = [];
37874
- for (let i = 0; i < sorted.length && i < 4; i++) {
37875
- const item = sorted[i];
37876
- if (!item) continue;
37877
- out.push(item.factorId);
37878
- }
37879
- return out;
38022
+ return top.map((t) => t.id);
37880
38023
  }
37881
38024
  function logistic(value2) {
37882
38025
  if (value2 > 30) return 1;
@@ -37897,7 +38040,7 @@ function evaluateAlignmentCase(input) {
37897
38040
  evidenceMass: policy.evidenceMass
37898
38041
  };
37899
38042
  }
37900
- const signalFindings = buildFindingsFromAtoms(evidence.atoms, input);
38043
+ const signalFindings = buildFindingsFromAtoms(evidence.atoms, input, evidence);
37901
38044
  return {
37902
38045
  kind: "accept",
37903
38046
  evaluation: {
@@ -37917,12 +38060,12 @@ function evaluateAlignmentCase(input) {
37917
38060
  }
37918
38061
  };
37919
38062
  }
37920
- function buildFindingsFromAtoms(atoms, input) {
38063
+ function buildFindingsFromAtoms(atoms, input, evidence) {
37921
38064
  const byKind = /* @__PURE__ */ new Map();
37922
38065
  for (let i = 0; i < atoms.length; i++) {
37923
38066
  const atom = atoms[i];
37924
38067
  if (!atom) continue;
37925
- const factor = toFindingFactor(atom.factorId, input);
38068
+ const factor = toFindingFactor(atom.factorId, input, evidence);
37926
38069
  if (factor === null) continue;
37927
38070
  const meanContribution = (atom.contribution.min + atom.contribution.max) / 2;
37928
38071
  if (meanContribution <= 0) continue;
@@ -37943,7 +38086,7 @@ function buildFindingsFromAtoms(atoms, input) {
37943
38086
  }
37944
38087
  return [...byKind.values()];
37945
38088
  }
37946
- function toFindingFactor(factorId, input) {
38089
+ function toFindingFactor(factorId, input, evidence) {
37947
38090
  switch (factorId) {
37948
38091
  case "offset-delta":
37949
38092
  return {
@@ -37973,17 +38116,15 @@ function toFindingFactor(factorId, input) {
37973
38116
  case "content-composition-conflict":
37974
38117
  return {
37975
38118
  kind: "content-composition-conflict",
37976
- message: formatContentCompositionFinding(input)
38119
+ message: formatContentCompositionFinding(input, evidence)
37977
38120
  };
37978
38121
  default:
37979
38122
  return null;
37980
38123
  }
37981
38124
  }
37982
- function formatContentCompositionFinding(input) {
38125
+ function formatContentCompositionFinding(input, evidence) {
37983
38126
  const subjectClassification = formatCompositionClassification(input.subjectContentComposition.classification);
37984
- const majorityClassification = formatCompositionClassification(
37985
- resolveMajorityClassification(input.cohortContentCompositions)
37986
- );
38127
+ const majorityClassification = formatCompositionClassification(evidence.majorityClassification);
37987
38128
  const fixSuggestion = formatCompositionFixSuggestion(input.subjectContentComposition);
37988
38129
  return `siblings have identical CSS but different content composition (subject: ${subjectClassification}, majority: ${majorityClassification}; fix: ${fixSuggestion})`;
37989
38130
  }
@@ -38042,7 +38183,7 @@ function recordPolicyMetrics(context, evidenceMass, posteriorLower, posteriorUpp
38042
38183
  context.layout.perf.factorCoverageSum += clamp(evidenceMass, 0, 1);
38043
38184
  context.layout.perf.factorCoverageCount++;
38044
38185
  const width = clamp(posteriorUpper - posteriorLower, 0, 1);
38045
- context.layout.perf.posteriorWidths.push(width);
38186
+ reservoirPush(context.layout.perf.posteriorWidths, width);
38046
38187
  if (width > 1e-3) context.layout.perf.uncertaintyEscalations++;
38047
38188
  }
38048
38189
 
@@ -38148,16 +38289,16 @@ function readNodeRefById(layout, solidFile, elementId) {
38148
38289
  }
38149
38290
  function isFlowRelevantBySiblingsOrText(node, textualContent) {
38150
38291
  if (node.siblingCount >= 2) return true;
38151
- return textualContent === "yes" || textualContent === "unknown" || textualContent === "dynamic-text";
38292
+ return textualContent === 0 /* Yes */ || textualContent === 2 /* Unknown */ || textualContent === 3 /* DynamicText */;
38152
38293
  }
38153
38294
  function isDeferredContainerLike(node, textualContent) {
38154
38295
  if (node.siblingCount >= 2) return true;
38155
- if (textualContent === "unknown") return true;
38296
+ if (textualContent === 2 /* Unknown */) return true;
38156
38297
  if (node.tagName !== null && SECTIONING_CONTAINER_TAGS.has(node.tagName)) return true;
38157
38298
  return false;
38158
38299
  }
38159
38300
  function isDynamicContainerLike(node) {
38160
- return node.textualContent === "unknown" && node.siblingCount >= 2;
38301
+ return node.textualContent === 2 /* Unknown */ && node.siblingCount >= 2;
38161
38302
  }
38162
38303
  function isLikelyViewportAffectingContainer(node) {
38163
38304
  if (node.siblingCount >= 2) return true;
@@ -39397,7 +39538,7 @@ var cssLayoutScrollbarGutterInstability = defineCrossRule({
39397
39538
  const snapshot = collectSignalSnapshot(context, node);
39398
39539
  const scroll = readScrollContainerFact(context.layout, node);
39399
39540
  if (!scroll.isScrollContainer) continue;
39400
- if (scroll.axis !== "y" && scroll.axis !== "both") continue;
39541
+ if (scroll.axis !== 2 /* Y */ && scroll.axis !== 3 /* Both */) continue;
39401
39542
  const scrollbarWidth = readKnownNormalized(snapshot, "scrollbar-width");
39402
39543
  if (scrollbarWidth === "none") continue;
39403
39544
  const gutter = readKnownNormalized(snapshot, "scrollbar-gutter");
@@ -39527,10 +39668,10 @@ var cssLayoutConditionalDisplayCollapse = defineCrossRule({
39527
39668
  const display = readKnownNormalizedWithGuard(snapshot, "display");
39528
39669
  if (!display || !COLLAPSING_DISPLAYS.has(display)) continue;
39529
39670
  const displaySignal = snapshot.signals.get("display");
39530
- if (!displaySignal || displaySignal.guard !== "conditional") continue;
39671
+ if (!displaySignal || displaySignal.guard.kind !== 1 /* Conditional */) continue;
39531
39672
  const flow = readFlowParticipationFact(context.layout, node);
39532
39673
  if (!flow.inFlow) continue;
39533
- if (!isFlowRelevantBySiblingsOrText(node, snapshot.textualContent)) continue;
39674
+ if (!isFlowRelevantBySiblingsOrText(node, snapshot.node.textualContent)) continue;
39534
39675
  const reservedSpace = readReservedSpaceFact(context.layout, node);
39535
39676
  if (reservedSpace.hasReservedSpace) continue;
39536
39677
  if (!emitLayoutDiagnostic(context.layout, node, emit, cssLayoutConditionalDisplayCollapse.id, "conditionalDisplayCollapse", messages152.conditionalDisplayCollapse, cssLayoutConditionalDisplayCollapse.severity, { display })) continue;
@@ -39566,10 +39707,10 @@ var cssLayoutConditionalWhiteSpaceWrapShift = defineCrossRule({
39566
39707
  if (!hasWrapShiftDelta(whiteSpaceDelta)) continue;
39567
39708
  if (!whiteSpace) continue;
39568
39709
  const whiteSpaceSignal = snapshot.signals.get("white-space");
39569
- if (!whiteSpaceSignal || whiteSpaceSignal.guard !== "conditional") continue;
39710
+ if (!whiteSpaceSignal || whiteSpaceSignal.guard.kind !== 1 /* Conditional */) continue;
39570
39711
  const flow = readFlowParticipationFact(context.layout, node);
39571
39712
  if (!flow.inFlow) continue;
39572
- if (!isFlowRelevantBySiblingsOrText(node, snapshot.textualContent)) continue;
39713
+ if (!isFlowRelevantBySiblingsOrText(node, snapshot.node.textualContent)) continue;
39573
39714
  if (hasStableTextShell(snapshot)) continue;
39574
39715
  if (!emitLayoutDiagnostic(context.layout, node, emit, cssLayoutConditionalWhiteSpaceWrapShift.id, "conditionalWhiteSpaceShift", messages153.conditionalWhiteSpaceShift, cssLayoutConditionalWhiteSpaceWrapShift.severity, { whiteSpace })) continue;
39575
39716
  }
@@ -39706,7 +39847,7 @@ var cssLayoutContentVisibilityNoIntrinsicSize = defineCrossRule({
39706
39847
  const node = candidates[i];
39707
39848
  if (!node) continue;
39708
39849
  const snapshot = collectSignalSnapshot(context, node);
39709
- if (!isDeferredContainerLike(node, snapshot.textualContent)) continue;
39850
+ if (!isDeferredContainerLike(node, snapshot.node.textualContent)) continue;
39710
39851
  const reservedSpace = readReservedSpaceFact(context.layout, node);
39711
39852
  if (reservedSpace.hasReservedSpace) continue;
39712
39853
  if (!emitLayoutDiagnostic(context.layout, node, emit, cssLayoutContentVisibilityNoIntrinsicSize.id, "missingIntrinsicSize", messages156.missingIntrinsicSize, cssLayoutContentVisibilityNoIntrinsicSize.severity)) continue;
@@ -39765,11 +39906,11 @@ function collectConditionalOffsets(layout, node, snapshot) {
39765
39906
  if (!delta.hasConditional || !delta.hasDelta) continue;
39766
39907
  const signal = snapshot.signals.get(name);
39767
39908
  if (!signal) continue;
39768
- if (signal.guard !== "conditional") continue;
39909
+ if (signal.guard.kind !== 1 /* Conditional */) continue;
39769
39910
  if (signal.kind !== "known") continue;
39770
39911
  if (signal.px === null) continue;
39771
39912
  if (Math.abs(signal.px) <= 0.25) continue;
39772
- out.push({ property: name, value: signal.px, guardKey: signal.guardProvenance.key });
39913
+ out.push({ property: name, value: signal.px, guardKey: signal.guard.key });
39773
39914
  }
39774
39915
  return out;
39775
39916
  }
@@ -39790,8 +39931,8 @@ function hasEffectivePositionForConditionalOffset(snapshot, guardKey) {
39790
39931
  const position = snapshot.signals.get("position");
39791
39932
  if (!position) return false;
39792
39933
  if (position.kind !== "known") return false;
39793
- if (position.guard !== "conditional") return false;
39794
- if (position.guardProvenance.key !== guardKey) return false;
39934
+ if (position.guard.kind !== 1 /* Conditional */) return false;
39935
+ if (position.guard.key !== guardKey) return false;
39795
39936
  return position.normalized !== "static";
39796
39937
  }
39797
39938
  function hasStableBaseline(baselineBySignal, property, expectedPx) {
@@ -40307,4 +40448,4 @@ export {
40307
40448
  rules3,
40308
40449
  runCrossFileRules
40309
40450
  };
40310
- //# sourceMappingURL=chunk-V6U7TQCD.js.map
40451
+ //# sourceMappingURL=chunk-64TMAKYI.js.map