@ohhwells/bridge 0.1.173 → 0.1.174

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -66,6 +66,10 @@ __export(index_exports, {
66
66
  SITE_OG_IMAGE_KEY: () => SITE_OG_IMAGE_KEY,
67
67
  SchedulingWidget: () => SchedulingWidget,
68
68
  TEMPLATE_LOGO_ATTR: () => TEMPLATE_LOGO_ATTR,
69
+ TONE_ATTR: () => TONE_ATTR,
70
+ TONE_CHANGE_EVENT: () => TONE_CHANGE_EVENT,
71
+ TONE_FIX_ATTR: () => TONE_FIX_ATTR,
72
+ TONE_THRESHOLD: () => TONE_THRESHOLD,
69
73
  Toggle: () => Toggle,
70
74
  ToggleGroup: () => ToggleGroup,
71
75
  ToggleGroupItem: () => ToggleGroupItem,
@@ -84,11 +88,16 @@ __export(index_exports, {
84
88
  canRemoveAiBlock: () => canRemoveAiBlock,
85
89
  canRemoveAiTextBlock: () => canRemoveAiTextBlock,
86
90
  canSoftHideEditable: () => canSoftHideEditable,
91
+ compositeColor: () => compositeColor,
92
+ compositeGradient: () => compositeGradient,
93
+ computeBackgroundTones: () => computeBackgroundTones,
94
+ contrastRatioOf: () => contrastRatioOf,
87
95
  dropIndicatorVariants: () => dropIndicatorVariants,
88
96
  ensureFooterTree: () => ensureFooterTree,
89
97
  filterAvailablePages: () => filterAvailablePages,
90
98
  foldAlignIntoTrees: () => foldAlignIntoTrees,
91
99
  getEditModeInitialState: () => getEditModeInitialState,
100
+ gradientStopColors: () => gradientStopColors,
92
101
  hasMountedContentNodes: () => hasMountedContentNodes,
93
102
  indexCollectionItems: () => indexCollectionItems,
94
103
  insertFooterHours: () => insertFooterHours,
@@ -100,16 +109,21 @@ __export(index_exports, {
100
109
  isRenderableTree: () => isRenderableTree,
101
110
  isStickySearchParam: () => isStickySearchParam,
102
111
  isValidUrl: () => isValidUrl,
112
+ linearGradientColourAt: () => linearGradientColourAt,
113
+ mapRegionToImage: () => mapRegionToImage,
103
114
  matchCollectionItemClick: () => matchCollectionItemClick,
115
+ mountBackgroundTone: () => mountBackgroundTone,
104
116
  nextViableSlide: () => nextViableSlide,
105
117
  parseAiFooterState: () => parseAiFooterState,
106
118
  parseAiSectionsState: () => parseAiSectionsState,
119
+ parseCssColor: () => parseCssColor,
107
120
  parseTarget: () => parseTarget,
108
121
  planAiBlockRemoval: () => planAiBlockRemoval,
109
122
  planAiTextBlockRemoval: () => planAiTextBlockRemoval,
110
123
  planBuildPageSync: () => planBuildPageSync,
111
124
  readHiddenEditables: () => readHiddenEditables,
112
125
  recordOverriddenPaths: () => recordOverriddenPaths,
126
+ relativeLuminanceOf: () => relativeLuminanceOf,
113
127
  releaseTemplateLogoIfReplaced: () => releaseTemplateLogoIfReplaced,
114
128
  removeBlockAtPath: () => removeBlockAtPath,
115
129
  removeFooterBlock: () => removeFooterBlock,
@@ -121,11 +135,15 @@ __export(index_exports, {
121
135
  shouldFetchContentForPath: () => shouldFetchContentForPath,
122
136
  softHideEditableInDom: () => softHideEditableInDom,
123
137
  softUnhideEditableInDom: () => softUnhideEditableInDom,
138
+ splitTopLevel: () => splitTopLevel,
124
139
  stepViableSlide: () => stepViableSlide,
125
140
  stripPlaceholderText: () => stripPlaceholderText,
126
141
  stripPlaceholders: () => stripPlaceholders,
127
142
  stripTextAlignCss: () => stripTextAlignCss,
128
143
  toggleVariants: () => toggleVariants,
144
+ toneFor: () => toneFor,
145
+ toneOfColor: () => toneOfColor,
146
+ toneOfLuminance: () => toneOfLuminance,
129
147
  useOhwCarousel: () => useOhwCarousel,
130
148
  validateUrlInput: () => validateUrlInput,
131
149
  viableSlides: () => viableSlides,
@@ -135,7 +153,7 @@ __export(index_exports, {
135
153
  module.exports = __toCommonJS(index_exports);
136
154
 
137
155
  // src/OhhwellsBridge.tsx
138
- var import_react25 = __toESM(require("react"), 1);
156
+ var import_react26 = __toESM(require("react"), 1);
139
157
  var import_client3 = require("react-dom/client");
140
158
  var import_react_dom5 = require("react-dom");
141
159
 
@@ -614,10 +632,10 @@ function logoTextElement(root) {
614
632
  if (root.matches(SELECTOR)) return root;
615
633
  const marked = root.querySelector(SELECTOR);
616
634
  if (marked) return marked;
617
- const hasOwnText = Array.from(root.childNodes).some(
635
+ const hasOwnText2 = Array.from(root.childNodes).some(
618
636
  (node) => node.nodeType === Node.TEXT_NODE && node.textContent?.trim()
619
637
  );
620
- return hasOwnText ? root : null;
638
+ return hasOwnText2 ? root : null;
621
639
  }
622
640
  var TEMPLATE_LOGO_ATTR = "data-ohw-template-logo";
623
641
  function releaseTemplateLogoIfReplaced(img, url) {
@@ -6221,8 +6239,11 @@ function styleSheetCss() {
6221
6239
  for (const [tone, value] of Object.entries(BG_VALUES)) {
6222
6240
  rules.push(`[data-ohw-style-bg="${tone}"] { background: ${value} !important; }`);
6223
6241
  }
6242
+ const lightText = "var(--ohw-brand-light, var(--color-light, #FFFFFF))";
6243
+ const darkText = "var(--ohw-brand-dark, var(--color-dark, #0C0A09))";
6224
6244
  rules.push(
6225
- `[data-ohw-style-bg="accent"] { color: var(--ohw-brand-light, var(--color-light, #FFFFFF)) !important; }`
6245
+ `:is([data-ohw-style-bg], [data-ohw-style-bgcolor])[data-ohw-tone="dark"], [data-ohw-tone-fix="dark"] { color: ${lightText} !important; }`,
6246
+ `:is([data-ohw-style-bg], [data-ohw-style-bgcolor])[data-ohw-tone="light"], [data-ohw-tone-fix="light"] { color: ${darkText} !important; }`
6226
6247
  );
6227
6248
  rules.push(
6228
6249
  `[data-ohw-style-distribution="space-between"] { display: flex !important; flex-direction: column; justify-content: space-between; }`,
@@ -12710,9 +12731,1035 @@ function useNavDropdownToggle(isEditMode) {
12710
12731
  }, [pathname, isEditMode]);
12711
12732
  }
12712
12733
 
12713
- // src/useHashLinkScroll.ts
12734
+ // src/useBackgroundTone.ts
12714
12735
  var import_react6 = require("react");
12715
12736
 
12737
+ // src/lib/background-tone.ts
12738
+ var TONE_THRESHOLD = 0.5;
12739
+ var TONE_ATTR = "data-ohw-tone";
12740
+ var TONE_FIX_ATTR = "data-ohw-tone-fix";
12741
+ var TONE_CHANGE_EVENT = "ohw:tone-change";
12742
+ var IMAGE_COVER_RATIO = 0.8;
12743
+ var SURFACE_MIN_PX = 24;
12744
+ var OPAQUE_ALPHA = 0.9;
12745
+ var VISIBLE_ALPHA = 0.05;
12746
+ var SAMPLE_SIZE = 32;
12747
+ var SAMPLE_TIMEOUT_MS = 3e3;
12748
+ var WHITE = { r: 255, g: 255, b: 255, a: 1 };
12749
+ var SECTION_SELECTOR = "[data-ohw-section]";
12750
+ var TEXT_SELECTOR = '[data-ohw-editable="text"], [data-ohw-editable="plain"], [data-ohw-field-label]';
12751
+ var BUTTON_SELECTOR = CTA_BUTTON_SELECTOR;
12752
+ var PICKED_BUTTON_TEXT_VARS = ["--brand-button-primary-text", "--brand-button-secondary-text"];
12753
+ var MEASURING_ATTR = "data-ohw-tone-measuring";
12754
+ var TONE_FIX_LINE_ATTR = "data-ohw-tone-fix-line";
12755
+ var INK_FIX_STYLE_ID = "ohw-tone-ink-fix";
12756
+ var INK_MIN_CONTRAST = 3;
12757
+ var IMAGE_TEXT_MIN_CONTRAST = 3;
12758
+ var NEVER_SURFACE = /* @__PURE__ */ new Set(["IMG", "SVG", "VIDEO", "CANVAS", "IFRAME", "PICTURE", "PATH", "SCRIPT", "STYLE"]);
12759
+ var clamp01 = (n) => Math.min(1, Math.max(0, n));
12760
+ function num(raw, percentOf = 1) {
12761
+ if (!raw || raw === "none") return 0;
12762
+ return raw.endsWith("%") ? parseFloat(raw) / 100 * percentOf : parseFloat(raw);
12763
+ }
12764
+ function alphaOf(raw) {
12765
+ return raw == null ? 1 : clamp01(num(raw, 1));
12766
+ }
12767
+ function linearToSrgb255(v) {
12768
+ const c = clamp01(v);
12769
+ return 255 * (c <= 31308e-7 ? 12.92 * c : 1.055 * c ** (1 / 2.4) - 0.055);
12770
+ }
12771
+ function oklabToRgba(L, A, B, a) {
12772
+ const l = (L + 0.3963377774 * A + 0.2158037573 * B) ** 3;
12773
+ const m = (L - 0.1055613458 * A - 0.0638541728 * B) ** 3;
12774
+ const s = (L - 0.0894841775 * A - 1.291485548 * B) ** 3;
12775
+ return {
12776
+ r: linearToSrgb255(4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s),
12777
+ g: linearToSrgb255(-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s),
12778
+ b: linearToSrgb255(-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s),
12779
+ a
12780
+ };
12781
+ }
12782
+ function parseCssColor(input) {
12783
+ if (!input) return null;
12784
+ const value = input.trim().toLowerCase();
12785
+ if (value === "transparent") return { r: 0, g: 0, b: 0, a: 0 };
12786
+ const hex = value.match(/^#([0-9a-f]{3,8})$/);
12787
+ if (hex) {
12788
+ const raw = hex[1];
12789
+ const short = raw.length <= 4;
12790
+ const part = (i) => parseInt(short ? raw[i] + raw[i] : raw.slice(i * 2, i * 2 + 2), 16);
12791
+ if (![3, 4, 6, 8].includes(raw.length)) return null;
12792
+ return { r: part(0), g: part(1), b: part(2), a: raw.length === 4 || raw.length === 8 ? part(3) / 255 : 1 };
12793
+ }
12794
+ const fn = value.match(/^([a-z]+)\((.*)\)$/);
12795
+ if (!fn) return null;
12796
+ const [, name, body] = fn;
12797
+ const [channelsRaw, slashAlpha] = body.split("/").map((s) => s.trim());
12798
+ const parts = channelsRaw.split(/[\s,]+/).filter(Boolean);
12799
+ if (name === "rgb" || name === "rgba") {
12800
+ if (parts.length < 3) return null;
12801
+ const alpha = slashAlpha ?? parts[3];
12802
+ return { r: num(parts[0], 255), g: num(parts[1], 255), b: num(parts[2], 255), a: alphaOf(alpha) };
12803
+ }
12804
+ if (name === "color") {
12805
+ const [space, r2, g, b] = parts;
12806
+ if (space !== "srgb" || b == null) return null;
12807
+ return { r: num(r2) * 255, g: num(g) * 255, b: num(b) * 255, a: alphaOf(slashAlpha) };
12808
+ }
12809
+ if (name === "oklch") {
12810
+ if (parts.length < 3) return null;
12811
+ const L = num(parts[0]);
12812
+ const C = num(parts[1], 0.4);
12813
+ const h = num(parts[2].replace("deg", "")) * Math.PI / 180;
12814
+ return oklabToRgba(L, C * Math.cos(h), C * Math.sin(h), alphaOf(slashAlpha));
12815
+ }
12816
+ if (name === "oklab") {
12817
+ if (parts.length < 3) return null;
12818
+ return oklabToRgba(num(parts[0]), num(parts[1], 0.4), num(parts[2], 0.4), alphaOf(slashAlpha));
12819
+ }
12820
+ return null;
12821
+ }
12822
+ function compositeColor(fg, bg) {
12823
+ const a = fg.a + bg.a * (1 - fg.a);
12824
+ if (a < 1e-3) return { r: bg.r, g: bg.g, b: bg.b, a: 0 };
12825
+ const mix = (f, b) => (f * fg.a + b * bg.a * (1 - fg.a)) / a;
12826
+ return { r: mix(fg.r, bg.r), g: mix(fg.g, bg.g), b: mix(fg.b, bg.b), a };
12827
+ }
12828
+ function relativeLuminanceOf(color) {
12829
+ const channel = (value) => {
12830
+ const s = clamp01(value / 255);
12831
+ return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
12832
+ };
12833
+ return 0.2126 * channel(color.r) + 0.7152 * channel(color.g) + 0.0722 * channel(color.b);
12834
+ }
12835
+ function toneOfLuminance(luminance) {
12836
+ return luminance >= TONE_THRESHOLD ? "light" : "dark";
12837
+ }
12838
+ function toneOfColor(color) {
12839
+ return toneOfLuminance(relativeLuminanceOf(color));
12840
+ }
12841
+ function contrastRatioOf(a, b) {
12842
+ const la = relativeLuminanceOf(a);
12843
+ const lb = relativeLuminanceOf(b);
12844
+ return (Math.max(la, lb) + 0.05) / (Math.min(la, lb) + 0.05);
12845
+ }
12846
+ function splitTopLevel(value) {
12847
+ const out = [];
12848
+ let depth = 0;
12849
+ let start = 0;
12850
+ for (let i = 0; i < value.length; i++) {
12851
+ const ch = value[i];
12852
+ if (ch === "(") depth++;
12853
+ else if (ch === ")") depth--;
12854
+ else if (ch === "," && depth === 0) {
12855
+ out.push(value.slice(start, i).trim());
12856
+ start = i + 1;
12857
+ }
12858
+ }
12859
+ const last = value.slice(start).trim();
12860
+ if (last) out.push(last);
12861
+ return out;
12862
+ }
12863
+ var COLOR_TOKEN = /(?:rgba?|color|oklch|oklab)\([^()]*\)|#[0-9a-f]{3,8}\b|\btransparent\b/gi;
12864
+ function gradientStopColors(layer) {
12865
+ if (!/gradient\(/i.test(layer)) return [];
12866
+ return (layer.match(COLOR_TOKEN) ?? []).map(parseCssColor).filter((c) => c !== null);
12867
+ }
12868
+ function compositeGradient(stops, behind) {
12869
+ if (stops.length === 0) return behind;
12870
+ const sum = { r: 0, g: 0, b: 0, a: 0 };
12871
+ for (const stop of stops) {
12872
+ const c = compositeColor(stop, behind);
12873
+ sum.r += c.r;
12874
+ sum.g += c.g;
12875
+ sum.b += c.b;
12876
+ sum.a += c.a;
12877
+ }
12878
+ const n = stops.length;
12879
+ return { r: sum.r / n, g: sum.g / n, b: sum.b / n, a: sum.a / n };
12880
+ }
12881
+ function stopPosition(token, length) {
12882
+ const n = parseFloat(token);
12883
+ if (!Number.isFinite(n)) return null;
12884
+ if (token.trim().endsWith("%")) return n / 100;
12885
+ return length > 0 ? n / length : null;
12886
+ }
12887
+ function gradientDirection(arg, w, h) {
12888
+ const a = arg.trim().toLowerCase();
12889
+ const deg = a.match(/^(-?[\d.]+)(deg|turn|rad|grad)$/);
12890
+ if (deg) {
12891
+ const v2 = parseFloat(deg[1]);
12892
+ const rad = deg[2] === "turn" ? v2 * 2 * Math.PI : deg[2] === "rad" ? v2 : deg[2] === "grad" ? v2 * Math.PI / 200 : v2 * Math.PI / 180;
12893
+ return { dx: Math.sin(rad), dy: -Math.cos(rad) };
12894
+ }
12895
+ if (!a.startsWith("to ")) return null;
12896
+ const sx = a.includes("right") ? 1 : a.includes("left") ? -1 : 0;
12897
+ const sy = a.includes("bottom") ? 1 : a.includes("top") ? -1 : 0;
12898
+ const v = sx !== 0 && sy !== 0 ? { dx: sx * h, dy: sy * w } : { dx: sx, dy: sy };
12899
+ const len = Math.hypot(v.dx, v.dy);
12900
+ return len > 0 ? { dx: v.dx / len, dy: v.dy / len } : null;
12901
+ }
12902
+ function linearGradientColourAt(layer, px2, py, w, h) {
12903
+ const m = layer.trim().match(/^linear-gradient\((.*)\)$/i);
12904
+ if (!m) return null;
12905
+ const args = splitTopLevel(m[1]);
12906
+ let dir = { dx: 0, dy: 1 };
12907
+ if (args.length > 0 && !parseCssColor((args[0].match(COLOR_TOKEN) ?? [""])[0])) {
12908
+ const parsed = gradientDirection(args[0], w, h);
12909
+ if (!parsed) return null;
12910
+ dir = parsed;
12911
+ args.shift();
12912
+ }
12913
+ const length = Math.abs(w * dir.dx) + Math.abs(h * dir.dy);
12914
+ const stops = [];
12915
+ for (const arg of args) {
12916
+ const colourToken = (arg.match(COLOR_TOKEN) ?? [])[0];
12917
+ const color = colourToken ? parseCssColor(colourToken) : null;
12918
+ if (!color) continue;
12919
+ const rest = arg.replace(colourToken, "").trim().split(/\s+/).filter(Boolean);
12920
+ if (rest.length === 0) stops.push({ color, at: null });
12921
+ for (const token of rest.slice(0, 2)) stops.push({ color, at: stopPosition(token, length) });
12922
+ }
12923
+ if (stops.length === 0) return null;
12924
+ if (stops[0].at === null) stops[0].at = 0;
12925
+ if (stops[stops.length - 1].at === null) stops[stops.length - 1].at = 1;
12926
+ for (let i = 1; i < stops.length; i++) {
12927
+ if (stops[i].at !== null) {
12928
+ stops[i].at = Math.max(stops[i].at, stops[i - 1].at);
12929
+ continue;
12930
+ }
12931
+ let j = i;
12932
+ while (stops[j].at === null) j++;
12933
+ const from = stops[i - 1].at;
12934
+ const span = j - (i - 1);
12935
+ for (let k = i; k < j; k++) stops[k].at = from + (stops[j].at - from) * (k - (i - 1)) / span;
12936
+ }
12937
+ const t = length > 0 ? ((px2 - w / 2) * dir.dx + (py - h / 2) * dir.dy) / length + 0.5 : 0.5;
12938
+ if (t <= stops[0].at) return stops[0].color;
12939
+ const last = stops[stops.length - 1];
12940
+ if (t >= last.at) return last.color;
12941
+ for (let i = 1; i < stops.length; i++) {
12942
+ const a = stops[i - 1];
12943
+ const b = stops[i];
12944
+ if (t > b.at) continue;
12945
+ const f = b.at > a.at ? (t - a.at) / (b.at - a.at) : 1;
12946
+ const alpha = a.color.a + (b.color.a - a.color.a) * f;
12947
+ const mix = (x, y) => (x * a.color.a + (y * b.color.a - x * a.color.a) * f) / (alpha || 1);
12948
+ return { r: mix(a.color.r, b.color.r), g: mix(a.color.g, b.color.g), b: mix(a.color.b, b.color.b), a: alpha };
12949
+ }
12950
+ return last.color;
12951
+ }
12952
+ function positionOffset(token, free) {
12953
+ if (!token) return free / 2;
12954
+ if (token === "left" || token === "top") return 0;
12955
+ if (token === "right" || token === "bottom") return free;
12956
+ if (token === "center") return free / 2;
12957
+ if (token.endsWith("%")) return parseFloat(token) / 100 * free;
12958
+ if (token.endsWith("px")) return parseFloat(token);
12959
+ return free / 2;
12960
+ }
12961
+ function mapRegionToImage(region, element, image, fit, position) {
12962
+ const { width: w, height: h } = element;
12963
+ const { width: iw, height: ih } = image;
12964
+ if (w <= 0 || h <= 0 || iw <= 0 || ih <= 0) return null;
12965
+ let dw = iw;
12966
+ let dh = ih;
12967
+ const f = fit.trim().toLowerCase();
12968
+ if (f === "cover" || f === "contain" || f === "scale-down") {
12969
+ let s = f === "cover" ? Math.max(w / iw, h / ih) : Math.min(w / iw, h / ih);
12970
+ if (f === "scale-down") s = Math.min(1, s);
12971
+ dw = iw * s;
12972
+ dh = ih * s;
12973
+ } else if (f === "fill") {
12974
+ dw = w;
12975
+ dh = h;
12976
+ } else if (f !== "none" && f !== "auto" && f !== "auto auto") {
12977
+ const [sw, sh] = f.split(/\s+/);
12978
+ const size = (token, full, natural, other) => {
12979
+ if (!token || token === "auto") return other ?? natural;
12980
+ return token.endsWith("%") ? parseFloat(token) / 100 * full : parseFloat(token);
12981
+ };
12982
+ dw = size(sw, w, iw, null);
12983
+ dh = sh && sh !== "auto" ? size(sh, h, ih, null) : dw / iw * ih;
12984
+ }
12985
+ const [px2, py] = position.trim().toLowerCase().split(/\s+/);
12986
+ const ox = positionOffset(px2, w - dw);
12987
+ const oy = positionOffset(py, h - dh);
12988
+ const sx = Math.max(0, (region.x - ox) / dw * iw);
12989
+ const sy = Math.max(0, (region.y - oy) / dh * ih);
12990
+ const ex = Math.min(iw, (region.x + region.width - ox) / dw * iw);
12991
+ const ey = Math.min(ih, (region.y + region.height - oy) / dh * ih);
12992
+ if (ex - sx < 1 || ey - sy < 1) return null;
12993
+ return { x: sx, y: sy, width: ex - sx, height: ey - sy };
12994
+ }
12995
+ var imageCache = /* @__PURE__ */ new Map();
12996
+ function loadImage(url, onSettled) {
12997
+ const cached = imageCache.get(url);
12998
+ if (cached) {
12999
+ if (cached.state === "loading") cached.waiters.add(onSettled);
13000
+ return cached;
13001
+ }
13002
+ const entry = { state: "loading", waiters: /* @__PURE__ */ new Set([onSettled]) };
13003
+ imageCache.set(url, entry);
13004
+ const img = new Image();
13005
+ img.crossOrigin = "anonymous";
13006
+ img.decoding = "async";
13007
+ let done = false;
13008
+ const settle = (ok) => {
13009
+ if (done) return;
13010
+ done = true;
13011
+ clearTimeout(timer);
13012
+ if (!ok) console.debug?.("[ohw-tone] image sampling unavailable, reading as Light", url);
13013
+ imageCache.set(url, ok ? { state: "ok", img } : { state: "fail" });
13014
+ for (const waiter of entry.waiters) waiter();
13015
+ };
13016
+ const timer = setTimeout(() => settle(false), SAMPLE_TIMEOUT_MS);
13017
+ img.onload = () => settle(img.naturalWidth > 0);
13018
+ img.onerror = () => settle(false);
13019
+ img.src = url;
13020
+ return entry;
13021
+ }
13022
+ var sampleCanvas = null;
13023
+ function sampleImage(img, region) {
13024
+ try {
13025
+ sampleCanvas ?? (sampleCanvas = document.createElement("canvas"));
13026
+ sampleCanvas.width = SAMPLE_SIZE;
13027
+ sampleCanvas.height = SAMPLE_SIZE;
13028
+ const ctx = sampleCanvas.getContext("2d", { willReadFrequently: true });
13029
+ if (!ctx) return null;
13030
+ ctx.clearRect(0, 0, SAMPLE_SIZE, SAMPLE_SIZE);
13031
+ const r2 = region ?? { x: 0, y: 0, width: img.naturalWidth, height: img.naturalHeight };
13032
+ ctx.drawImage(img, r2.x, r2.y, r2.width, r2.height, 0, 0, SAMPLE_SIZE, SAMPLE_SIZE);
13033
+ const data = ctx.getImageData(0, 0, SAMPLE_SIZE, SAMPLE_SIZE).data;
13034
+ let r0 = 0;
13035
+ let g0 = 0;
13036
+ let b0 = 0;
13037
+ let weight = 0;
13038
+ for (let i = 0; i < data.length; i += 4) {
13039
+ const a = data[i + 3] / 255;
13040
+ r0 += data[i] * a;
13041
+ g0 += data[i + 1] * a;
13042
+ b0 += data[i + 2] * a;
13043
+ weight += a;
13044
+ }
13045
+ const pixels = data.length / 4;
13046
+ if (weight === 0) return { r: 0, g: 0, b: 0, a: 0 };
13047
+ return { r: r0 / weight, g: g0 / weight, b: b0 / weight, a: weight / pixels };
13048
+ } catch {
13049
+ return null;
13050
+ }
13051
+ }
13052
+ function browserDeps() {
13053
+ return {
13054
+ style: (el) => getComputedStyle(el),
13055
+ rect: (el) => {
13056
+ const r2 = el.getBoundingClientRect();
13057
+ return { x: r2.left, y: r2.top, width: r2.width, height: r2.height };
13058
+ },
13059
+ sample: (url, region, onReady) => {
13060
+ const entry = loadImage(url, onReady);
13061
+ if (entry.state === "loading") return "loading";
13062
+ if (entry.state === "fail") return null;
13063
+ const natural = { width: entry.img.naturalWidth, height: entry.img.naturalHeight };
13064
+ return sampleImage(entry.img, region(natural));
13065
+ },
13066
+ pseudo: (el, which) => getComputedStyle(el, which)
13067
+ };
13068
+ }
13069
+ function bgLayers(style) {
13070
+ const value = style.backgroundImage;
13071
+ return value && value !== "none" ? splitTopLevel(value) : [];
13072
+ }
13073
+ function urlOf(layer) {
13074
+ const m = layer.match(/^url\(\s*(['"]?)(.*?)\1\s*\)$/i);
13075
+ return m ? m[2] : null;
13076
+ }
13077
+ function paintOver(style, behind, at) {
13078
+ let color = behind;
13079
+ let painted = false;
13080
+ let opaque = false;
13081
+ const own = parseCssColor(style.backgroundColor);
13082
+ if (own && own.a > VISIBLE_ALPHA) {
13083
+ color = compositeColor(own, color);
13084
+ painted = true;
13085
+ opaque = own.a >= OPAQUE_ALPHA;
13086
+ }
13087
+ for (const layer of bgLayers(style).reverse()) {
13088
+ const stops = gradientStopColors(layer);
13089
+ if (stops.length === 0) continue;
13090
+ const point = at ? linearGradientColourAt(layer, at.x, at.y, at.width, at.height) : null;
13091
+ color = point ? compositeColor(point, color) : compositeGradient(stops, color);
13092
+ painted = true;
13093
+ if (stops.every((s) => s.a >= OPAQUE_ALPHA)) opaque = true;
13094
+ }
13095
+ return { color, opaque, painted };
13096
+ }
13097
+ function area(b) {
13098
+ return Math.max(0, b.width) * Math.max(0, b.height);
13099
+ }
13100
+ function intersect(a, b) {
13101
+ const x = Math.max(a.x, b.x);
13102
+ const y = Math.max(a.y, b.y);
13103
+ return { x, y, width: Math.min(a.x + a.width, b.x + b.width) - x, height: Math.min(a.y + a.height, b.y + b.height) - y };
13104
+ }
13105
+ function union(a, b) {
13106
+ if (!a) return b;
13107
+ const x = Math.min(a.x, b.x);
13108
+ const y = Math.min(a.y, b.y);
13109
+ return { x, y, width: Math.max(a.x + a.width, b.x + b.width) - x, height: Math.max(a.y + a.height, b.y + b.height) - y };
13110
+ }
13111
+ function covers(deps, el, section) {
13112
+ const sectionArea = area(section);
13113
+ return sectionArea > 0 && area(intersect(deps.rect(el), section)) >= IMAGE_COVER_RATIO * sectionArea;
13114
+ }
13115
+ function colourBehind(deps, el) {
13116
+ const chain = [];
13117
+ for (let p = el.parentElement; p; p = p.parentElement) chain.push(p);
13118
+ let color = WHITE;
13119
+ for (const ancestor of chain.reverse()) color = paintOver(deps.style(ancestor), color).color;
13120
+ return color;
13121
+ }
13122
+ function findImages(deps, section) {
13123
+ const out = [];
13124
+ const candidates = [section, ...Array.from(section.querySelectorAll("*"))];
13125
+ for (const el of candidates) {
13126
+ if (el !== section && el.closest(SECTION_SELECTOR) !== section) continue;
13127
+ const style = deps.style(el);
13128
+ if (style.display === "none" || style.visibility === "hidden") continue;
13129
+ if (el.tagName === "IMG") {
13130
+ const img = el;
13131
+ const url = img.currentSrc || img.src;
13132
+ if (url && style.objectFit === "cover") out.push({ el, url, urlLayer: -1 });
13133
+ continue;
13134
+ }
13135
+ const layers = bgLayers(style);
13136
+ const urlLayer = layers.findIndex((l) => urlOf(l) !== null);
13137
+ if (urlLayer >= 0) out.push({ el, url: urlOf(layers[urlLayer]), urlLayer });
13138
+ }
13139
+ return out;
13140
+ }
13141
+ function findImageHosts(deps, section, images, sectionImage, onReady) {
13142
+ const out = /* @__PURE__ */ new Map();
13143
+ for (const image of images) {
13144
+ if (image.el === sectionImage?.el) continue;
13145
+ let host = null;
13146
+ for (let p = image.urlLayer < 0 ? image.el.parentElement : image.el; p && p !== section; p = p.parentElement) {
13147
+ if (!covers(deps, image.el, deps.rect(p))) break;
13148
+ host = p;
13149
+ }
13150
+ if (!host || out.has(host)) continue;
13151
+ const box = deps.rect(host);
13152
+ if (box.width < SURFACE_MIN_PX || box.height < SURFACE_MIN_PX) continue;
13153
+ if (!textRegion(deps, host, deps.rect(image.el))) continue;
13154
+ out.set(host, imageSectionColour(deps, host, box, image, onReady));
13155
+ }
13156
+ return out;
13157
+ }
13158
+ function findOverlays(deps, section, image, box) {
13159
+ const out = [];
13160
+ for (const el of Array.from(section.querySelectorAll("*"))) {
13161
+ if (el === image || el.contains(image)) continue;
13162
+ const after = image.contains(el) || Boolean(
13163
+ image.compareDocumentPosition(el) & 4
13164
+ /* DOCUMENT_POSITION_FOLLOWING */
13165
+ );
13166
+ if (!after) continue;
13167
+ const style = deps.style(el);
13168
+ const paint3 = paintOver(style, { r: 0, g: 0, b: 0, a: 0 });
13169
+ if (paint3.painted && covers(deps, el, box)) out.push(el);
13170
+ }
13171
+ return out;
13172
+ }
13173
+ function findPseudoOverlays(deps, section, image, overlays, box) {
13174
+ if (!deps.pseudo) return [];
13175
+ const out = [];
13176
+ const read = (host, which) => {
13177
+ let style;
13178
+ try {
13179
+ style = deps.pseudo(host, which);
13180
+ } catch {
13181
+ return;
13182
+ }
13183
+ if (!style || !style.content || style.content === "none" || style.content === "normal") return;
13184
+ if (style.display === "none" || style.position !== "absolute" && style.position !== "fixed") return;
13185
+ if (!paintOver(style, { r: 0, g: 0, b: 0, a: 0 }).painted) return;
13186
+ const hostBox = deps.rect(host);
13187
+ const px2 = (v) => /^-?[\d.]+px$/.test(v) ? parseFloat(v) : NaN;
13188
+ let pseudoBox;
13189
+ const w = px2(style.width);
13190
+ const h = px2(style.height);
13191
+ if (Number.isFinite(w) && Number.isFinite(h)) {
13192
+ pseudoBox = { x: hostBox.x + (px2(style.left) || 0), y: hostBox.y + (px2(style.top) || 0), width: w, height: h };
13193
+ } else if ([style.top, style.left, style.right, style.bottom].every((v) => px2(v) === 0)) {
13194
+ pseudoBox = hostBox;
13195
+ } else {
13196
+ return;
13197
+ }
13198
+ const sectionArea = area(box);
13199
+ if (sectionArea > 0 && area(intersect(pseudoBox, box)) >= IMAGE_COVER_RATIO * sectionArea) out.push({ style, box: pseudoBox });
13200
+ };
13201
+ if (image.tagName !== "IMG") {
13202
+ read(image, "::before");
13203
+ read(image, "::after");
13204
+ }
13205
+ for (let p = image.parentElement; p && section.contains(p); p = p.parentElement) {
13206
+ read(p, "::after");
13207
+ if (p === section) break;
13208
+ }
13209
+ for (const overlay of overlays) {
13210
+ read(overlay, "::before");
13211
+ read(overlay, "::after");
13212
+ }
13213
+ return out;
13214
+ }
13215
+ function textRegion(deps, section, imageBox) {
13216
+ let region = null;
13217
+ for (const el of Array.from(section.querySelectorAll(TEXT_SELECTOR))) {
13218
+ const box = intersect(deps.rect(el), imageBox);
13219
+ if (box.width > 0 && box.height > 0) region = union(region, box);
13220
+ }
13221
+ return region ? { ...region, x: region.x - imageBox.x, y: region.y - imageBox.y } : null;
13222
+ }
13223
+ function opacityOf(style) {
13224
+ const n = parseFloat(style.opacity);
13225
+ return Number.isFinite(n) ? clamp01(n) : 1;
13226
+ }
13227
+ function imageSectionColour(deps, section, box, image, onReady) {
13228
+ const imageStyle = deps.style(image.el);
13229
+ const imageBox = deps.rect(image.el);
13230
+ const isImg = image.urlLayer < 0;
13231
+ const fit = isImg ? imageStyle.objectFit : splitTopLevel(imageStyle.backgroundSize)[image.urlLayer] ?? "auto";
13232
+ const position = isImg ? imageStyle.objectPosition : splitTopLevel(imageStyle.backgroundPosition)[image.urlLayer] ?? "0% 0%";
13233
+ const visible = intersect(imageBox, box);
13234
+ const fallback = { x: visible.x - imageBox.x, y: visible.y - imageBox.y, width: visible.width, height: visible.height };
13235
+ const region = textRegion(deps, section, imageBox) ?? fallback;
13236
+ const overlays = findOverlays(deps, section, image.el, box);
13237
+ const skip = /* @__PURE__ */ new Set([image.el, ...overlays]);
13238
+ for (let p = image.el.parentElement; p && p !== section && section.contains(p); p = p.parentElement) skip.add(p);
13239
+ const behind = colourBehind(deps, image.el);
13240
+ const above = isImg ? "" : bgLayers(imageStyle).slice(0, image.urlLayer).join(", ");
13241
+ const overlayParts = [
13242
+ ...findPseudoOverlays(deps, section, image.el, overlays, box),
13243
+ ...overlays.map((el) => ({ style: deps.style(el), box: deps.rect(el) }))
13244
+ ];
13245
+ const compose = (area2, point) => {
13246
+ const sampled = deps.sample(image.url, (natural) => mapRegionToImage(area2, imageBox, natural, fit, position), onReady);
13247
+ if (sampled === "loading" || sampled === null) return sampled;
13248
+ const atIn = (b) => point ? { x: point.x - b.x, y: point.y - b.y, width: b.width, height: b.height } : void 0;
13249
+ let color2 = behind;
13250
+ if (!isImg) color2 = paintOver({ backgroundColor: imageStyle.backgroundColor, backgroundImage: "none" }, color2).color;
13251
+ color2 = compositeColor({ ...sampled, a: sampled.a * opacityOf(imageStyle) }, color2);
13252
+ if (above) color2 = paintOver({ backgroundColor: "transparent", backgroundImage: above }, color2, atIn(imageBox)).color;
13253
+ for (const overlay of overlayParts) {
13254
+ const layer = paintOver(overlay.style, { r: 0, g: 0, b: 0, a: 0 }, atIn(overlay.box)).color;
13255
+ color2 = compositeColor({ ...layer, a: layer.a * opacityOf(overlay.style) }, color2);
13256
+ }
13257
+ return color2;
13258
+ };
13259
+ const color = compose(region);
13260
+ if (color === "loading" || color === null) return { color, skip };
13261
+ const at = (box2) => {
13262
+ const local = intersect(box2, imageBox);
13263
+ if (local.width <= 0 || local.height <= 0) return null;
13264
+ const result = compose(
13265
+ { x: local.x - imageBox.x, y: local.y - imageBox.y, width: local.width, height: local.height },
13266
+ { x: local.x + local.width / 2, y: local.y + local.height / 2 }
13267
+ );
13268
+ return result === "loading" ? null : result;
13269
+ };
13270
+ return { color, skip, at };
13271
+ }
13272
+ function writeTone(el, tone) {
13273
+ const previous = el.getAttribute(TONE_ATTR);
13274
+ if (previous === tone) return;
13275
+ el.setAttribute(TONE_ATTR, tone);
13276
+ const Event2 = el.ownerDocument?.defaultView?.CustomEvent ?? CustomEvent;
13277
+ el.dispatchEvent(new Event2(TONE_CHANGE_EVENT, { bubbles: true, detail: { tone, previous } }));
13278
+ }
13279
+ function isEditorBackground(el) {
13280
+ return el.hasAttribute("data-ohw-style-bg") || el.hasAttribute("data-ohw-style-bgcolor");
13281
+ }
13282
+ function hasPickedColour(el, context) {
13283
+ for (let node = el; node && node !== context; node = node.parentElement) {
13284
+ const style = node.style;
13285
+ if (style?.color && style.getPropertyPriority("color") === "important") return true;
13286
+ }
13287
+ return false;
13288
+ }
13289
+ var TEXT_SPOTS = [
13290
+ [1 / 6, 1 / 4],
13291
+ [1 / 2, 1 / 4],
13292
+ [5 / 6, 1 / 4],
13293
+ [1 / 6, 3 / 4],
13294
+ [1 / 2, 3 / 4],
13295
+ [5 / 6, 3 / 4]
13296
+ ];
13297
+ function fixInks(doc) {
13298
+ const view = doc?.defaultView;
13299
+ const root = doc?.documentElement;
13300
+ const read = (names, fallback) => {
13301
+ if (!view || !root) return fallback;
13302
+ let style;
13303
+ try {
13304
+ style = view.getComputedStyle(root);
13305
+ } catch {
13306
+ return fallback;
13307
+ }
13308
+ for (const name of names) {
13309
+ const parsed = parseCssColor(style.getPropertyValue(name).trim());
13310
+ if (parsed) return parsed;
13311
+ }
13312
+ return fallback;
13313
+ };
13314
+ return {
13315
+ dark: read(["--ohw-brand-dark", "--color-dark"], { r: 12, g: 10, b: 9, a: 1 }),
13316
+ light: read(["--ohw-brand-light", "--color-light"], WHITE)
13317
+ };
13318
+ }
13319
+ function glyphBox(el) {
13320
+ try {
13321
+ const range = el.ownerDocument?.createRange?.();
13322
+ if (!range) return null;
13323
+ range.selectNodeContents(el);
13324
+ const r2 = range.getBoundingClientRect?.();
13325
+ range.detach?.();
13326
+ return r2 && r2.width > 0 && r2.height > 0 ? { x: r2.left, y: r2.top, width: r2.width, height: r2.height } : null;
13327
+ } catch {
13328
+ return null;
13329
+ }
13330
+ }
13331
+ function worstContrast(ink, spots) {
13332
+ let worst = Infinity;
13333
+ for (const bg of spots) worst = Math.min(worst, contrastRatioOf(compositeColor(ink, bg), bg));
13334
+ return worst;
13335
+ }
13336
+ function spotsOf(box, at) {
13337
+ const spots = [];
13338
+ if (box.width <= 0 || box.height <= 0) return spots;
13339
+ const w = box.width / 3;
13340
+ const h = box.height / 2;
13341
+ for (const [fx, fy] of TEXT_SPOTS) {
13342
+ const bg = at({ x: box.x + fx * box.width - w / 2, y: box.y + fy * box.height - h / 2, width: w, height: h });
13343
+ if (bg) spots.push(bg);
13344
+ }
13345
+ return spots;
13346
+ }
13347
+ function fixTextOnImage(el, text, box, at, inks) {
13348
+ if (!text) return;
13349
+ const spots = spotsOf(box, at);
13350
+ if (spots.length === 0 || worstContrast(text, spots) >= IMAGE_TEXT_MIN_CONTRAST) return;
13351
+ const darkWorks = worstContrast(inks.dark, spots) >= IMAGE_TEXT_MIN_CONTRAST;
13352
+ const lightWorks = worstContrast(inks.light, spots) >= IMAGE_TEXT_MIN_CONTRAST;
13353
+ if (darkWorks && (!lightWorks || worstContrast(inks.dark, spots) >= worstContrast(inks.light, spots))) {
13354
+ el.setAttribute(TONE_FIX_ATTR, "light");
13355
+ } else if (lightWorks) {
13356
+ el.setAttribute(TONE_FIX_ATTR, "dark");
13357
+ }
13358
+ }
13359
+ var KEYED_TEXT_SELECTOR = "[data-ohw-key]:not([data-ohw-editable])";
13360
+ function hasOwnText(el) {
13361
+ for (const node of Array.from(el.childNodes)) if (node.nodeType === 3 && node.textContent?.trim()) return true;
13362
+ return false;
13363
+ }
13364
+ function hiddenWithin(deps, el, stop) {
13365
+ for (let node = el; node && node !== stop; node = node.parentElement) {
13366
+ const style = deps.style(node);
13367
+ if (style.visibility === "hidden" || opacityOf(style) < VISIBLE_ALPHA) return true;
13368
+ }
13369
+ return false;
13370
+ }
13371
+ function fixTextContrast(deps, section, resolved, imageContexts, pending) {
13372
+ let inks = null;
13373
+ const texts = new Set(Array.from(section.querySelectorAll(TEXT_SELECTOR)));
13374
+ const keyed = /* @__PURE__ */ new Set();
13375
+ for (const el of Array.from(section.querySelectorAll(KEYED_TEXT_SELECTOR))) {
13376
+ if (!texts.has(el) && hasOwnText(el)) keyed.add(el);
13377
+ }
13378
+ for (const el of [...texts, ...keyed]) {
13379
+ const overlayRoot = el.closest(OVERLAY_ROOT_SELECTOR);
13380
+ if (overlayRoot && !onOwnSurface(deps, el, overlayRoot)) continue;
13381
+ const context = el.closest(`[${TONE_ATTR}]`);
13382
+ if (context && pending.has(context)) continue;
13383
+ const bg = context ? resolved.get(context) : void 0;
13384
+ const imageAt = context ? imageContexts.get(context) : void 0;
13385
+ const onImage = !!imageAt;
13386
+ if (!context || !bg || !isEditorBackground(context) && !onImage || keyed.has(el) && !onImage) {
13387
+ el.removeAttribute(TONE_FIX_ATTR);
13388
+ continue;
13389
+ }
13390
+ if (imageAt && !isEditorBackground(context) && hiddenWithin(deps, el, context)) continue;
13391
+ const had = el.getAttribute(TONE_FIX_ATTR);
13392
+ if (had) el.removeAttribute(TONE_FIX_ATTR);
13393
+ if (imageAt && !isEditorBackground(context)) {
13394
+ if (!hasPickedColour(el, context)) {
13395
+ inks ?? (inks = fixInks(section.ownerDocument));
13396
+ fixTextOnImage(el, parseCssColor(deps.style(el).color), glyphBox(el) ?? deps.rect(el), imageAt, inks);
13397
+ }
13398
+ continue;
13399
+ }
13400
+ const text = parseCssColor(deps.style(el).color);
13401
+ const bgTone = toneOfColor(bg);
13402
+ const needsFix = text !== null && toneOfColor(compositeColor(text, bg)) === bgTone;
13403
+ if (needsFix) el.setAttribute(TONE_FIX_ATTR, bgTone);
13404
+ }
13405
+ }
13406
+ function pickedButtonInks(doc) {
13407
+ const root = doc?.documentElement;
13408
+ const inks = [];
13409
+ for (const name of PICKED_BUTTON_TEXT_VARS) {
13410
+ const raw = root?.style?.getPropertyValue(name).trim();
13411
+ if (!raw) continue;
13412
+ const ink = parseCssColor(raw);
13413
+ if (!ink) return "any";
13414
+ inks.push(ink);
13415
+ }
13416
+ return inks;
13417
+ }
13418
+ function sameColour(a, b) {
13419
+ return Math.abs(a.r - b.r) < 2 && Math.abs(a.g - b.g) < 2 && Math.abs(a.b - b.b) < 2;
13420
+ }
13421
+ function unreadableOn(ink, bg) {
13422
+ if (!ink) return false;
13423
+ const seen = compositeColor(ink, bg);
13424
+ return toneOfColor(seen) === toneOfColor(bg) && contrastRatioOf(seen, bg) < INK_MIN_CONTRAST;
13425
+ }
13426
+ function fixButtonInk(deps, section, painted) {
13427
+ const buttons = Array.from(section.querySelectorAll(BUTTON_SELECTOR));
13428
+ if (buttons.length === 0) return;
13429
+ const picked = pickedButtonInks(section.ownerDocument);
13430
+ for (const button of buttons) {
13431
+ const icons = Array.from(button.querySelectorAll("svg"));
13432
+ const chips = [];
13433
+ for (const icon of icons) if (icon.parentElement && icon.parentElement !== button) chips.push(icon.parentElement);
13434
+ const targets = [button, ...chips, ...icons];
13435
+ for (const el of targets) {
13436
+ el.setAttribute(MEASURING_ATTR, "");
13437
+ if (!chips.includes(el)) el.removeAttribute(TONE_FIX_ATTR);
13438
+ }
13439
+ try {
13440
+ const own = button;
13441
+ if (picked === "any" || button.hasAttribute("data-ohw-btn-variant") || own.style?.color) continue;
13442
+ const fresh = (el) => {
13443
+ const behind = el?.parentElement ? painted.get(el.parentElement) : void 0;
13444
+ return el && behind && painted.has(el) ? paintOver(deps.style(el), behind).color : void 0;
13445
+ };
13446
+ const fill = fresh(button);
13447
+ if (!fill) continue;
13448
+ const ink = parseCssColor(deps.style(button).color);
13449
+ if (ink && picked.some((p) => sameColour(p, ink))) continue;
13450
+ if (unreadableOn(ink, fill)) button.setAttribute(TONE_FIX_ATTR, toneOfColor(fill));
13451
+ for (const icon of icons) {
13452
+ const behind = fresh(icon.parentElement);
13453
+ if (behind && unreadableOn(parseCssColor(deps.style(icon).color), behind)) {
13454
+ icon.setAttribute(TONE_FIX_ATTR, toneOfColor(behind));
13455
+ }
13456
+ }
13457
+ } finally {
13458
+ void deps.style(button).color;
13459
+ for (const el of targets) el.removeAttribute(MEASURING_ATTR);
13460
+ }
13461
+ }
13462
+ }
13463
+ var INK_FIX_CSS = `[${MEASURING_ATTR}] { transition: none !important; }
13464
+ [${TONE_FIX_ATTR}="dark"] { color: var(--ohw-brand-light, var(--color-light, #FFFFFF)) !important; }
13465
+ [${TONE_FIX_ATTR}="light"] { color: var(--ohw-brand-dark, var(--color-dark, #0C0A09)) !important; }
13466
+ [${TONE_FIX_LINE_ATTR}="dark"] { border-bottom-color: var(--ohw-brand-light, var(--color-light, #FFFFFF)) !important; }
13467
+ [${TONE_FIX_LINE_ATTR}="light"] { border-bottom-color: var(--ohw-brand-dark, var(--color-dark, #0C0A09)) !important; }`;
13468
+ function ensureInkFixStyles(doc) {
13469
+ if (doc.getElementById(INK_FIX_STYLE_ID)) return;
13470
+ const style = doc.createElement("style");
13471
+ style.id = INK_FIX_STYLE_ID;
13472
+ style.textContent = INK_FIX_CSS;
13473
+ doc.head?.appendChild(style);
13474
+ }
13475
+ var sectionPhotos = /* @__PURE__ */ new WeakMap();
13476
+ var OVERLAY_ROOT_SELECTOR = "[data-ohw-nav-root]";
13477
+ function onOwnSurface(deps, el, root) {
13478
+ for (let node = el; node; node = node.parentElement) {
13479
+ if (paintOver(deps.style(node), { r: 0, g: 0, b: 0, a: 0 }).painted) return true;
13480
+ if (node === root) break;
13481
+ }
13482
+ return false;
13483
+ }
13484
+ function contains(box, x, y) {
13485
+ return x >= box.x && x <= box.x + box.width && y >= box.y && y <= box.y + box.height;
13486
+ }
13487
+ function fixOverlayText(deps, doc) {
13488
+ const roots = Array.from(doc.querySelectorAll(OVERLAY_ROOT_SELECTOR));
13489
+ if (roots.length === 0) return;
13490
+ const photoSections = topSections(doc).filter((s) => sectionPhotos.has(s));
13491
+ const boxes = new Map(photoSections.map((s) => [s, deps.rect(s)]));
13492
+ let inks = null;
13493
+ for (const root of roots) {
13494
+ const items = [];
13495
+ for (const el of Array.from(root.querySelectorAll(TEXT_SELECTOR))) {
13496
+ if (onOwnSurface(deps, el, root)) continue;
13497
+ const box = glyphBox(el) ?? deps.rect(el);
13498
+ const cx2 = box.x + box.width / 2;
13499
+ const cy = box.y + box.height / 2;
13500
+ const under = photoSections.find((s) => contains(boxes.get(s), cx2, cy));
13501
+ const photo = under ? sectionPhotos.get(under) : void 0;
13502
+ if (photo === "loading") continue;
13503
+ el.removeAttribute(TONE_FIX_ATTR);
13504
+ for (let node = el; node; node = node.parentElement) {
13505
+ node.removeAttribute(TONE_FIX_LINE_ATTR);
13506
+ if (node === root) break;
13507
+ }
13508
+ if (!photo || el.closest(BUTTON_SELECTOR)) continue;
13509
+ if (hasPickedColour(el, doc.documentElement) || hiddenWithin(deps, el, null)) continue;
13510
+ const text = parseCssColor(deps.style(el).color);
13511
+ const spots = spotsOf(box, photo);
13512
+ if (text && spots.length > 0) items.push({ el, text, spots, line: underlineOf(deps, el, root) });
13513
+ }
13514
+ inks ?? (inks = fixInks(doc));
13515
+ fixBarInk(items, inks);
13516
+ for (const item of items) {
13517
+ const fix = item.el.getAttribute(TONE_FIX_ATTR);
13518
+ if (fix) item.line?.setAttribute(TONE_FIX_LINE_ATTR, fix);
13519
+ }
13520
+ }
13521
+ }
13522
+ function underlineOf(deps, el, root) {
13523
+ const text = parseCssColor(deps.style(el).color);
13524
+ if (!text) return null;
13525
+ for (let node = el; node; node = node.parentElement) {
13526
+ const style = deps.style(node);
13527
+ const line = parseCssColor(style.borderBottomColor);
13528
+ if (line && line.a > VISIBLE_ALPHA && parseFloat(style.borderBottomWidth ?? "0") > 0 && style.borderBottomStyle !== "none" && sameColour(line, text)) {
13529
+ return node;
13530
+ }
13531
+ if (node === root) break;
13532
+ }
13533
+ return null;
13534
+ }
13535
+ function fixBarInk(items, inks) {
13536
+ if (!items.some((item) => worstContrast(item.text, item.spots) < IMAGE_TEXT_MIN_CONTRAST)) return;
13537
+ const score = (ink) => {
13538
+ let readable = 0;
13539
+ let worst = Infinity;
13540
+ for (const item of items) {
13541
+ const c = worstContrast(ink, item.spots);
13542
+ if (c >= IMAGE_TEXT_MIN_CONTRAST) readable++;
13543
+ worst = Math.min(worst, c);
13544
+ }
13545
+ return { readable, worst };
13546
+ };
13547
+ const dark = score(inks.dark);
13548
+ const light = score(inks.light);
13549
+ if (dark.readable === 0 && light.readable === 0) return;
13550
+ const useDark = dark.readable > light.readable || dark.readable === light.readable && dark.worst >= light.worst;
13551
+ const fix = useDark ? "light" : "dark";
13552
+ for (const item of items) {
13553
+ if (toneOfColor(item.text) === (useDark ? "dark" : "light")) continue;
13554
+ item.el.setAttribute(TONE_FIX_ATTR, fix);
13555
+ }
13556
+ }
13557
+ function computeSection(deps, section, onReady) {
13558
+ const box = deps.rect(section);
13559
+ const resolved = /* @__PURE__ */ new Map();
13560
+ const painted = /* @__PURE__ */ new Map();
13561
+ const written = /* @__PURE__ */ new Set();
13562
+ const imageContexts = /* @__PURE__ */ new Map();
13563
+ const pending = /* @__PURE__ */ new Set();
13564
+ let base;
13565
+ let skip = /* @__PURE__ */ new Set();
13566
+ const images = box.width > 0 && box.height > 0 ? findImages(deps, section) : [];
13567
+ const image = images.find((candidate) => covers(deps, candidate.el, box)) ?? null;
13568
+ if (image) {
13569
+ const result = imageSectionColour(deps, section, box, image, onReady);
13570
+ if (result.color === "loading") {
13571
+ sectionPhotos.set(section, "loading");
13572
+ return;
13573
+ }
13574
+ skip = result.skip;
13575
+ base = result.color ?? WHITE;
13576
+ writeTone(section, result.color ? toneOfColor(base) : "light");
13577
+ if (result.color && result.at) {
13578
+ imageContexts.set(section, result.at);
13579
+ sectionPhotos.set(section, result.at);
13580
+ } else {
13581
+ sectionPhotos.delete(section);
13582
+ }
13583
+ } else {
13584
+ sectionPhotos.delete(section);
13585
+ base = paintOver(deps.style(section), colourBehind(deps, section)).color;
13586
+ writeTone(section, toneOfColor(base));
13587
+ }
13588
+ resolved.set(section, base);
13589
+ painted.set(section, base);
13590
+ written.add(section);
13591
+ const hosts = findImageHosts(deps, section, images, image, onReady);
13592
+ for (const hosted of hosts.values()) for (const el of hosted.skip) skip.add(el);
13593
+ const visit = (parent, behind, context) => {
13594
+ for (const child of Array.from(parent.children)) {
13595
+ if (NEVER_SURFACE.has(child.tagName.toUpperCase())) continue;
13596
+ const hosted = hosts.get(child);
13597
+ if (hosted) {
13598
+ written.add(child);
13599
+ if (hosted.color === "loading") {
13600
+ pending.add(child);
13601
+ painted.set(child, behind);
13602
+ visit(child, behind, context);
13603
+ continue;
13604
+ }
13605
+ const color = hosted.color ?? WHITE;
13606
+ writeTone(child, hosted.color ? toneOfColor(color) : "light");
13607
+ if (hosted.color && hosted.at) imageContexts.set(child, hosted.at);
13608
+ resolved.set(child, color);
13609
+ painted.set(child, color);
13610
+ visit(child, color, color);
13611
+ continue;
13612
+ }
13613
+ if (skip.has(child)) {
13614
+ painted.set(child, behind);
13615
+ visit(child, behind, context);
13616
+ continue;
13617
+ }
13618
+ const style = deps.style(child);
13619
+ if (style.display === "none") continue;
13620
+ const paint3 = paintOver(style, behind);
13621
+ painted.set(child, paint3.color);
13622
+ let nextContext = context;
13623
+ const forced = isEditorBackground(child) || child.matches(SECTION_SELECTOR);
13624
+ if (forced || paint3.painted && paint3.opaque) {
13625
+ const rect = deps.rect(child);
13626
+ const bigEnough = rect.width >= SURFACE_MIN_PX && rect.height >= SURFACE_MIN_PX;
13627
+ const differs = Math.abs(relativeLuminanceOf(paint3.color) - relativeLuminanceOf(context)) > 0.01 || toneOfColor(paint3.color) !== toneOfColor(context);
13628
+ if (forced || bigEnough && differs) {
13629
+ writeTone(child, toneOfColor(paint3.color));
13630
+ resolved.set(child, paint3.color);
13631
+ written.add(child);
13632
+ nextContext = paint3.color;
13633
+ }
13634
+ }
13635
+ visit(child, paint3.color, nextContext);
13636
+ }
13637
+ };
13638
+ visit(section, base, base);
13639
+ for (const stale of Array.from(section.querySelectorAll(`[${TONE_ATTR}]`))) {
13640
+ if (!written.has(stale)) stale.removeAttribute(TONE_ATTR);
13641
+ }
13642
+ fixTextContrast(deps, section, resolved, imageContexts, pending);
13643
+ fixButtonInk(deps, section, painted);
13644
+ }
13645
+ function topSections(root) {
13646
+ return Array.from(root.querySelectorAll(SECTION_SELECTOR)).filter((el) => !el.parentElement?.closest(SECTION_SELECTOR));
13647
+ }
13648
+ function computeBackgroundTones(doc, options = {}) {
13649
+ const deps = options.deps ?? browserDeps();
13650
+ const sections = options.only ? Array.from(options.only) : topSections(doc);
13651
+ for (const section of sections) {
13652
+ if (!section.isConnected) continue;
13653
+ computeSection(deps, section, () => options.onImageReady?.(section));
13654
+ }
13655
+ fixOverlayText(deps, doc);
13656
+ }
13657
+ function toneFor(el) {
13658
+ const value = el?.closest(`[${TONE_ATTR}]`)?.getAttribute(TONE_ATTR);
13659
+ return value === "dark" ? "dark" : "light";
13660
+ }
13661
+ var WATCHED_ATTRS = [
13662
+ "style",
13663
+ "class",
13664
+ "src",
13665
+ "srcset",
13666
+ "data-ohw-style-bg",
13667
+ "data-ohw-style-bgcolor",
13668
+ "data-ohw-style-cardbg",
13669
+ // The editor's Default / Hover toggle forces :hover rules through this attribute.
13670
+ "data-ohw-active-state"
13671
+ ];
13672
+ var VISIBILITY_TRANSITIONS = /* @__PURE__ */ new Set(["opacity", "visibility"]);
13673
+ function outermostSection(node) {
13674
+ let el = node instanceof Element ? node : node?.parentElement ?? null;
13675
+ let top = null;
13676
+ while (el) {
13677
+ const section = el.closest(SECTION_SELECTOR);
13678
+ if (!section) break;
13679
+ top = section;
13680
+ el = section.parentElement;
13681
+ }
13682
+ return top;
13683
+ }
13684
+ function mountBackgroundTone(doc = document) {
13685
+ const win = doc.defaultView;
13686
+ if (!win) return () => void 0;
13687
+ const dirty = /* @__PURE__ */ new Set();
13688
+ let all = true;
13689
+ let frame = 0;
13690
+ const run = () => {
13691
+ frame = 0;
13692
+ const only = all ? void 0 : Array.from(dirty);
13693
+ all = false;
13694
+ dirty.clear();
13695
+ computeBackgroundTones(doc, { only, onImageReady: (section) => schedule(section) });
13696
+ };
13697
+ function schedule(section) {
13698
+ if (section) dirty.add(section);
13699
+ else all = true;
13700
+ if (!frame) frame = win.requestAnimationFrame(run);
13701
+ }
13702
+ ensureInkFixStyles(doc);
13703
+ const observer = new MutationObserver((records) => {
13704
+ for (const record of records) {
13705
+ const target = record.target;
13706
+ if (target === doc.documentElement || doc.head?.contains(target)) {
13707
+ schedule();
13708
+ continue;
13709
+ }
13710
+ const section = outermostSection(target);
13711
+ if (section) {
13712
+ schedule(section);
13713
+ continue;
13714
+ }
13715
+ const targetEl = target instanceof Element ? target : target.parentElement;
13716
+ if (targetEl?.closest(OVERLAY_ROOT_SELECTOR)) {
13717
+ if (!frame) frame = win.requestAnimationFrame(run);
13718
+ continue;
13719
+ }
13720
+ for (const added of Array.from(record.addedNodes)) {
13721
+ if (added instanceof Element && (added.matches(SECTION_SELECTOR) || added.querySelector(SECTION_SELECTOR))) {
13722
+ schedule();
13723
+ break;
13724
+ }
13725
+ }
13726
+ }
13727
+ });
13728
+ observer.observe(doc.documentElement, {
13729
+ subtree: true,
13730
+ childList: true,
13731
+ characterData: true,
13732
+ attributes: true,
13733
+ attributeFilter: WATCHED_ATTRS
13734
+ });
13735
+ const onResize = () => schedule();
13736
+ const onTransitionEnd = (event) => {
13737
+ if (!VISIBILITY_TRANSITIONS.has(event.propertyName)) return;
13738
+ const section = outermostSection(event.target);
13739
+ if (section) schedule(section);
13740
+ };
13741
+ win.addEventListener("resize", onResize);
13742
+ win.addEventListener("load", onResize);
13743
+ doc.addEventListener("transitionend", onTransitionEnd, true);
13744
+ doc.fonts?.ready.then(() => schedule()).catch(() => void 0);
13745
+ schedule();
13746
+ return () => {
13747
+ observer.disconnect();
13748
+ win.removeEventListener("resize", onResize);
13749
+ win.removeEventListener("load", onResize);
13750
+ doc.removeEventListener("transitionend", onTransitionEnd, true);
13751
+ if (frame) win.cancelAnimationFrame(frame);
13752
+ };
13753
+ }
13754
+
13755
+ // src/useBackgroundTone.ts
13756
+ function useBackgroundTone() {
13757
+ (0, import_react6.useEffect)(() => mountBackgroundTone(), []);
13758
+ }
13759
+
13760
+ // src/useHashLinkScroll.ts
13761
+ var import_react7 = require("react");
13762
+
12716
13763
  // src/lib/scroll-to-section.ts
12717
13764
  var MAX_ATTEMPTS = 12;
12718
13765
  var RETRY_MS = 100;
@@ -12765,7 +13812,7 @@ function samePageSectionId(anchor) {
12765
13812
  return id || null;
12766
13813
  }
12767
13814
  function useHashLinkScroll(isEditMode) {
12768
- (0, import_react6.useEffect)(() => {
13815
+ (0, import_react7.useEffect)(() => {
12769
13816
  if (isEditMode) return;
12770
13817
  const onClick = (e) => {
12771
13818
  if (e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
@@ -12780,7 +13827,7 @@ function useHashLinkScroll(isEditMode) {
12780
13827
  }
12781
13828
 
12782
13829
  // src/usePublishedPlaceholderStrip.ts
12783
- var import_react7 = require("react");
13830
+ var import_react8 = require("react");
12784
13831
 
12785
13832
  // src/lib/strip-placeholders.ts
12786
13833
  var PLACEHOLDER_RE = /\[[A-Za-z][A-Za-z0-9 _/&#'.-]{0,30}\]-?/g;
@@ -12867,7 +13914,7 @@ function stripTextNode(node) {
12867
13914
 
12868
13915
  // src/usePublishedPlaceholderStrip.ts
12869
13916
  function usePublishedPlaceholderStrip(isEditMode) {
12870
- (0, import_react7.useEffect)(() => {
13917
+ (0, import_react8.useEffect)(() => {
12871
13918
  if (isEditMode) return;
12872
13919
  stripPlaceholders(document.body);
12873
13920
  const observer = new MutationObserver((records) => {
@@ -12888,10 +13935,10 @@ function usePublishedPlaceholderStrip(isEditMode) {
12888
13935
  }
12889
13936
 
12890
13937
  // src/ui/SchedulingWidget.tsx
12891
- var import_react9 = require("react");
13938
+ var import_react10 = require("react");
12892
13939
 
12893
13940
  // src/ui/EmailCaptureModal.tsx
12894
- var import_react8 = require("react");
13941
+ var import_react9 = require("react");
12895
13942
  var import_radix_ui = require("radix-ui");
12896
13943
  var import_jsx_runtime4 = require("react/jsx-runtime");
12897
13944
  var isValidEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
@@ -12921,11 +13968,11 @@ function Spinner() {
12921
13968
  );
12922
13969
  }
12923
13970
  function EmailCaptureModal({ title, subtitle, onSubmit, onClose }) {
12924
- const [email, setEmail] = (0, import_react8.useState)("");
12925
- const [submittedEmail, setSubmittedEmail] = (0, import_react8.useState)("");
12926
- const [loading, setLoading] = (0, import_react8.useState)(false);
12927
- const [success, setSuccess] = (0, import_react8.useState)(false);
12928
- const [error, setError] = (0, import_react8.useState)(null);
13971
+ const [email, setEmail] = (0, import_react9.useState)("");
13972
+ const [submittedEmail, setSubmittedEmail] = (0, import_react9.useState)("");
13973
+ const [loading, setLoading] = (0, import_react9.useState)(false);
13974
+ const [success, setSuccess] = (0, import_react9.useState)(false);
13975
+ const [error, setError] = (0, import_react9.useState)(null);
12929
13976
  const isBook = title === "Confirm your spot";
12930
13977
  const handleSubmit = async () => {
12931
13978
  const trimmed = email.trim();
@@ -13192,21 +14239,21 @@ function LoadingSkeleton() {
13192
14239
  ] });
13193
14240
  }
13194
14241
  function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal }) {
13195
- const todayMs = (0, import_react9.useMemo)(() => {
14242
+ const todayMs = (0, import_react10.useMemo)(() => {
13196
14243
  const d = /* @__PURE__ */ new Date();
13197
14244
  d.setHours(0, 0, 0, 0);
13198
14245
  return d.getTime();
13199
14246
  }, []);
13200
- const scrollRef = (0, import_react9.useRef)(null);
13201
- const [canScrollLeft, setCanScrollLeft] = (0, import_react9.useState)(false);
13202
- const [canScrollRight, setCanScrollRight] = (0, import_react9.useState)(false);
14247
+ const scrollRef = (0, import_react10.useRef)(null);
14248
+ const [canScrollLeft, setCanScrollLeft] = (0, import_react10.useState)(false);
14249
+ const [canScrollRight, setCanScrollRight] = (0, import_react10.useState)(false);
13203
14250
  const updateScrollState = () => {
13204
14251
  const el = scrollRef.current;
13205
14252
  if (!el) return;
13206
14253
  setCanScrollLeft(el.scrollLeft > 0);
13207
14254
  setCanScrollRight(el.scrollLeft + el.clientWidth < el.scrollWidth - 1);
13208
14255
  };
13209
- (0, import_react9.useEffect)(() => {
14256
+ (0, import_react10.useEffect)(() => {
13210
14257
  const el = scrollRef.current;
13211
14258
  if (!el) return;
13212
14259
  updateScrollState();
@@ -13221,9 +14268,9 @@ function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal
13221
14268
  const scroll = (dir) => {
13222
14269
  scrollRef.current?.scrollBy({ left: dir === "left" ? -216 : 216, behavior: "smooth" });
13223
14270
  };
13224
- const isDragging = (0, import_react9.useRef)(false);
13225
- const dragStartX = (0, import_react9.useRef)(0);
13226
- const dragStartScrollLeft = (0, import_react9.useRef)(0);
14271
+ const isDragging = (0, import_react10.useRef)(false);
14272
+ const dragStartX = (0, import_react10.useRef)(0);
14273
+ const dragStartScrollLeft = (0, import_react10.useRef)(0);
13227
14274
  const onDragStart = (e) => {
13228
14275
  if (!scrollRef.current) return;
13229
14276
  isDragging.current = true;
@@ -13243,14 +14290,14 @@ function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal
13243
14290
  scrollRef.current.style.cursor = "grab";
13244
14291
  scrollRef.current.style.userSelect = "";
13245
14292
  };
13246
- const datesWithClasses = (0, import_react9.useMemo)(
14293
+ const datesWithClasses = (0, import_react10.useMemo)(
13247
14294
  () => new Set(dates.map(
13248
14295
  (d, i) => schedule.classes?.some((c) => classRunsOnDate(c, d, schedule.type)) ? i : -1
13249
14296
  ).filter((i) => i >= 0)),
13250
14297
  [dates, schedule]
13251
14298
  );
13252
14299
  const selectedDate = dates[selectedIdx];
13253
- const selectedClasses = (0, import_react9.useMemo)(
14300
+ const selectedClasses = (0, import_react10.useMemo)(
13254
14301
  () => (schedule.classes ?? []).filter((c) => selectedDate && classRunsOnDate(c, selectedDate, schedule.type)),
13255
14302
  [schedule, selectedDate]
13256
14303
  );
@@ -13435,16 +14482,16 @@ function CalendarFoldIcon() {
13435
14482
  );
13436
14483
  }
13437
14484
  function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAfter: insertAfterProp }) {
13438
- const autoId = (0, import_react9.useId)();
14485
+ const autoId = (0, import_react10.useId)();
13439
14486
  const insertAfter = insertAfterProp ?? autoId;
13440
- const [schedule, setSchedule] = (0, import_react9.useState)(null);
13441
- const [loading, setLoading] = (0, import_react9.useState)(initialScheduleId !== null);
13442
- const [inEditor, setInEditor] = (0, import_react9.useState)(false);
13443
- const [isHovered, setIsHovered] = (0, import_react9.useState)(false);
13444
- const [modalState, setModalState] = (0, import_react9.useState)(null);
13445
- const switchScheduleIdRef = (0, import_react9.useRef)(null);
13446
- const liveScheduleIdRef = (0, import_react9.useRef)(null);
13447
- const refetchLiveSchedule = (0, import_react9.useCallback)(async () => {
14487
+ const [schedule, setSchedule] = (0, import_react10.useState)(null);
14488
+ const [loading, setLoading] = (0, import_react10.useState)(initialScheduleId !== null);
14489
+ const [inEditor, setInEditor] = (0, import_react10.useState)(false);
14490
+ const [isHovered, setIsHovered] = (0, import_react10.useState)(false);
14491
+ const [modalState, setModalState] = (0, import_react10.useState)(null);
14492
+ const switchScheduleIdRef = (0, import_react10.useRef)(null);
14493
+ const liveScheduleIdRef = (0, import_react10.useRef)(null);
14494
+ const refetchLiveSchedule = (0, import_react10.useCallback)(async () => {
13448
14495
  const id = liveScheduleIdRef.current;
13449
14496
  if (!id) return;
13450
14497
  try {
@@ -13454,7 +14501,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
13454
14501
  } catch {
13455
14502
  }
13456
14503
  }, []);
13457
- const dates = (0, import_react9.useMemo)(() => {
14504
+ const dates = (0, import_react10.useMemo)(() => {
13458
14505
  const today = /* @__PURE__ */ new Date();
13459
14506
  today.setHours(0, 0, 0, 0);
13460
14507
  return Array.from({ length: 14 }, (_, i) => {
@@ -13463,8 +14510,8 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
13463
14510
  return d;
13464
14511
  });
13465
14512
  }, []);
13466
- const [selectedIdx, setSelectedIdx] = (0, import_react9.useState)(0);
13467
- (0, import_react9.useEffect)(() => {
14513
+ const [selectedIdx, setSelectedIdx] = (0, import_react10.useState)(0);
14514
+ (0, import_react10.useEffect)(() => {
13468
14515
  if (!schedule?.classes) return;
13469
14516
  for (let i = 0; i < dates.length; i++) {
13470
14517
  if (schedule.classes.some((c) => classRunsOnDate(c, dates[i], schedule.type))) {
@@ -13473,7 +14520,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
13473
14520
  }
13474
14521
  }
13475
14522
  }, [schedule, dates]);
13476
- (0, import_react9.useEffect)(() => {
14523
+ (0, import_react10.useEffect)(() => {
13477
14524
  if (typeof window === "undefined") return;
13478
14525
  const onVisible = () => {
13479
14526
  if (!document.hidden) void refetchLiveSchedule();
@@ -13485,7 +14532,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
13485
14532
  document.removeEventListener("visibilitychange", onVisible);
13486
14533
  };
13487
14534
  }, [refetchLiveSchedule]);
13488
- (0, import_react9.useEffect)(() => {
14535
+ (0, import_react10.useEffect)(() => {
13489
14536
  if (typeof window === "undefined") return;
13490
14537
  const isInEditor = window.self !== window.top;
13491
14538
  setInEditor(isInEditor);
@@ -17240,7 +18287,7 @@ var CustomToolbarButton = React5.forwardRef(
17240
18287
  CustomToolbarButton.displayName = "CustomToolbarButton";
17241
18288
 
17242
18289
  // src/ui/item-action-toolbar.tsx
17243
- var import_react10 = require("react");
18290
+ var import_react11 = require("react");
17244
18291
  var import_lucide_react3 = require("lucide-react");
17245
18292
 
17246
18293
  // src/ui/dropdown-menu.tsx
@@ -17425,7 +18472,7 @@ function ItemActionToolbar({
17425
18472
  headingVisible = null,
17426
18473
  onHeadingVisibleChange
17427
18474
  }) {
17428
- const [moreOpen, setMoreOpen] = (0, import_react10.useState)(false);
18475
+ const [moreOpen, setMoreOpen] = (0, import_react11.useState)(false);
17429
18476
  const showDropdownToggle = dropdownOpen !== null && dropdownOpen !== void 0;
17430
18477
  const showHeadingToggle = headingVisible !== null && headingVisible !== void 0;
17431
18478
  const headingTooltip = headingVisible ? "Hide heading" : "Show heading";
@@ -17633,7 +18680,7 @@ function ItemActionToolbar({
17633
18680
  }
17634
18681
 
17635
18682
  // src/ui/item-interaction-layer.tsx
17636
- var import_react11 = require("react");
18683
+ var import_react12 = require("react");
17637
18684
  var import_react_dom3 = require("react-dom");
17638
18685
  var import_jsx_runtime14 = require("react/jsx-runtime");
17639
18686
  var PRIMARY = "var(--ohw-primary, #0885FE)";
@@ -17690,8 +18737,8 @@ function ClampedToolbarSlot({
17690
18737
  align = "center",
17691
18738
  children
17692
18739
  }) {
17693
- const slotRef = (0, import_react11.useRef)(null);
17694
- (0, import_react11.useLayoutEffect)(() => {
18740
+ const slotRef = (0, import_react12.useRef)(null);
18741
+ (0, import_react12.useLayoutEffect)(() => {
17695
18742
  const slot = slotRef.current;
17696
18743
  if (!slot) return;
17697
18744
  const clamp = () => {
@@ -17754,15 +18801,15 @@ function DetachedBelowToolbarSlot({
17754
18801
  belowEl,
17755
18802
  children
17756
18803
  }) {
17757
- const slotRef = (0, import_react11.useRef)(null);
17758
- const [anchorBottom, setAnchorBottom] = (0, import_react11.useState)(belowRect.bottom);
17759
- const [portalTarget] = (0, import_react11.useState)(
18804
+ const slotRef = (0, import_react12.useRef)(null);
18805
+ const [anchorBottom, setAnchorBottom] = (0, import_react12.useState)(belowRect.bottom);
18806
+ const [portalTarget] = (0, import_react12.useState)(
17760
18807
  () => typeof document === "undefined" ? null : document.querySelector("[data-ohw-bridge-root]") ?? document.body
17761
18808
  );
17762
- (0, import_react11.useLayoutEffect)(() => {
18809
+ (0, import_react12.useLayoutEffect)(() => {
17763
18810
  setAnchorBottom(belowRect.bottom);
17764
18811
  }, [belowRect.bottom, belowRect.height, belowRect.top]);
17765
- (0, import_react11.useLayoutEffect)(() => {
18812
+ (0, import_react12.useLayoutEffect)(() => {
17766
18813
  const slot = slotRef.current;
17767
18814
  if (!slot) return;
17768
18815
  const sync = () => {
@@ -17843,8 +18890,8 @@ function ItemInteractionLayer({
17843
18890
  hidden = false,
17844
18891
  className
17845
18892
  }) {
17846
- const localRef = (0, import_react11.useRef)(null);
17847
- (0, import_react11.useLayoutEffect)(() => {
18893
+ const localRef = (0, import_react12.useRef)(null);
18894
+ (0, import_react12.useLayoutEffect)(() => {
17848
18895
  const node = localRef.current;
17849
18896
  if (!node) return;
17850
18897
  node.style.display = hidden ? "none" : "block";
@@ -18119,7 +19166,7 @@ function apiBase() {
18119
19166
  function bridgeVersion() {
18120
19167
  try {
18121
19168
  if (true) {
18122
- return "0.1.173";
19169
+ return "0.1.174";
18123
19170
  }
18124
19171
  } catch {
18125
19172
  }
@@ -18133,7 +19180,7 @@ function stampBridgeVersionOnDocument() {
18133
19180
  return;
18134
19181
  }
18135
19182
  try {
18136
- const v = true ? "0.1.173" : "";
19183
+ const v = true ? "0.1.174" : "";
18137
19184
  if (v) {
18138
19185
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
18139
19186
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -19074,7 +20121,7 @@ function CarouselOverlay({
19074
20121
  }
19075
20122
 
19076
20123
  // src/ui/ai-section/AiSectionOverlay.tsx
19077
- var import_react12 = require("react");
20124
+ var import_react13 = require("react");
19078
20125
  var import_lucide_react7 = require("lucide-react");
19079
20126
 
19080
20127
  // src/lib/ai-change-highlight.ts
@@ -19206,8 +20253,8 @@ function readRect(instanceId) {
19206
20253
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
19207
20254
  }
19208
20255
  function useLiveSectionRect(sectionId) {
19209
- const [rect, setRect] = (0, import_react12.useState)(null);
19210
- (0, import_react12.useEffect)(() => {
20256
+ const [rect, setRect] = (0, import_react13.useState)(null);
20257
+ (0, import_react13.useEffect)(() => {
19211
20258
  if (!sectionId) {
19212
20259
  setRect(null);
19213
20260
  return;
@@ -19246,8 +20293,8 @@ function readNavToggleRect() {
19246
20293
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
19247
20294
  }
19248
20295
  function useLiveNavToggleHole(active) {
19249
- const [rect, setRect] = (0, import_react12.useState)(null);
19250
- (0, import_react12.useEffect)(() => {
20296
+ const [rect, setRect] = (0, import_react13.useState)(null);
20297
+ (0, import_react13.useEffect)(() => {
19251
20298
  if (!active) {
19252
20299
  setRect(null);
19253
20300
  return;
@@ -19309,7 +20356,7 @@ function ReviewButton({
19309
20356
  background,
19310
20357
  color
19311
20358
  }) {
19312
- const [hover, setHover] = (0, import_react12.useState)(false);
20359
+ const [hover, setHover] = (0, import_react13.useState)(false);
19313
20360
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { style: { position: "relative" }, children: [
19314
20361
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
19315
20362
  "button",
@@ -19364,17 +20411,17 @@ function AiSectionOverlay({
19364
20411
  apiRef,
19365
20412
  onSelectionChange
19366
20413
  }) {
19367
- const [selectedId, setSelectedId] = (0, import_react12.useState)(null);
19368
- const [reviewId, setReviewId] = (0, import_react12.useState)(null);
19369
- const [reviewButtonsHidden, setReviewButtonsHidden] = (0, import_react12.useState)(false);
19370
- const reviewIdRef = (0, import_react12.useRef)(null);
20414
+ const [selectedId, setSelectedId] = (0, import_react13.useState)(null);
20415
+ const [reviewId, setReviewId] = (0, import_react13.useState)(null);
20416
+ const [reviewButtonsHidden, setReviewButtonsHidden] = (0, import_react13.useState)(false);
20417
+ const reviewIdRef = (0, import_react13.useRef)(null);
19371
20418
  reviewIdRef.current = reviewId;
19372
- const selectedIdRef = (0, import_react12.useRef)(null);
20419
+ const selectedIdRef = (0, import_react13.useRef)(null);
19373
20420
  selectedIdRef.current = selectedId;
19374
- (0, import_react12.useEffect)(() => {
20421
+ (0, import_react13.useEffect)(() => {
19375
20422
  onSelectionChange?.(selectedId);
19376
20423
  }, [selectedId, onSelectionChange]);
19377
- const report = (0, import_react12.useCallback)(
20424
+ const report = (0, import_react13.useCallback)(
19378
20425
  (el) => {
19379
20426
  const labelSrc = el ? sectionElementOf(el) : null;
19380
20427
  postToParent2({
@@ -19385,7 +20432,7 @@ function AiSectionOverlay({
19385
20432
  },
19386
20433
  [postToParent2]
19387
20434
  );
19388
- const selectFromElement = (0, import_react12.useCallback)(
20435
+ const selectFromElement = (0, import_react13.useCallback)(
19389
20436
  (el, options) => {
19390
20437
  const inner = el?.closest("[data-ohw-section]") ?? null;
19391
20438
  const sectionEl2 = inner ? movableUnit(inner) : null;
@@ -19397,7 +20444,7 @@ function AiSectionOverlay({
19397
20444
  },
19398
20445
  [report]
19399
20446
  );
19400
- (0, import_react12.useEffect)(() => {
20447
+ (0, import_react13.useEffect)(() => {
19401
20448
  apiRef.current = {
19402
20449
  selectFromElement,
19403
20450
  handleBackgroundClick: (target, clientX, clientY) => {
@@ -19422,7 +20469,7 @@ function AiSectionOverlay({
19422
20469
  apiRef.current = null;
19423
20470
  };
19424
20471
  }, [apiRef, selectFromElement, report]);
19425
- (0, import_react12.useEffect)(() => {
20472
+ (0, import_react13.useEffect)(() => {
19426
20473
  const onMessage = (e) => {
19427
20474
  if (e.data?.type === "ow:ai-select" && e.data.sectionId === null) {
19428
20475
  selectedIdRef.current = null;
@@ -19447,10 +20494,10 @@ function AiSectionOverlay({
19447
20494
  window.addEventListener("message", onMessage);
19448
20495
  return () => window.removeEventListener("message", onMessage);
19449
20496
  }, [postToParent2]);
19450
- (0, import_react12.useEffect)(() => installAiChangeHighlight((el) => selectFromElement(el)), [selectFromElement]);
19451
- (0, import_react12.useEffect)(() => installHistoryKeyRelay(), []);
19452
- const [hoveredId, setHoveredId] = (0, import_react12.useState)(null);
19453
- (0, import_react12.useEffect)(() => {
20497
+ (0, import_react13.useEffect)(() => installAiChangeHighlight((el) => selectFromElement(el)), [selectFromElement]);
20498
+ (0, import_react13.useEffect)(() => installHistoryKeyRelay(), []);
20499
+ const [hoveredId, setHoveredId] = (0, import_react13.useState)(null);
20500
+ (0, import_react13.useEffect)(() => {
19454
20501
  const onMove = (e) => {
19455
20502
  const t = e.target;
19456
20503
  if (!(t instanceof Element)) return;
@@ -19475,7 +20522,7 @@ function AiSectionOverlay({
19475
20522
  document.documentElement.removeEventListener("mouseleave", onLeave);
19476
20523
  };
19477
20524
  }, []);
19478
- (0, import_react12.useEffect)(() => {
20525
+ (0, import_react13.useEffect)(() => {
19479
20526
  const onKeyDown = (e) => {
19480
20527
  if (e.key !== "Escape") return;
19481
20528
  if (reviewIdRef.current) return;
@@ -19489,7 +20536,7 @@ function AiSectionOverlay({
19489
20536
  document.addEventListener("keydown", onKeyDown);
19490
20537
  return () => document.removeEventListener("keydown", onKeyDown);
19491
20538
  }, [report]);
19492
- const decide = (0, import_react12.useCallback)(
20539
+ const decide = (0, import_react13.useCallback)(
19493
20540
  (decision) => {
19494
20541
  const sectionId = reviewIdRef.current;
19495
20542
  if (!sectionId) return;
@@ -19498,8 +20545,8 @@ function AiSectionOverlay({
19498
20545
  },
19499
20546
  [postToParent2]
19500
20547
  );
19501
- const [navDropdownForceOpen, setNavDropdownForceOpen] = (0, import_react12.useState)(false);
19502
- (0, import_react12.useEffect)(() => {
20548
+ const [navDropdownForceOpen, setNavDropdownForceOpen] = (0, import_react13.useState)(false);
20549
+ (0, import_react13.useEffect)(() => {
19503
20550
  const update = () => {
19504
20551
  setNavDropdownForceOpen(Boolean(document.querySelector("[data-ohw-nav-force-open]")));
19505
20552
  };
@@ -19518,7 +20565,7 @@ function AiSectionOverlay({
19518
20565
  const navToggleHole = useLiveNavToggleHole(Boolean(reviewId));
19519
20566
  const hoverRect = useLiveSectionRect(reviewId || hoveredId === selectedId ? null : hoveredId);
19520
20567
  const showSelectionBorder = Boolean(selectionRect) && !navDropdownForceOpen;
19521
- (0, import_react12.useEffect)(() => {
20568
+ (0, import_react13.useEffect)(() => {
19522
20569
  const selectedEl = activeSelectionId ? findSectionElement(activeSelectionId) : null;
19523
20570
  if (!activeSelectionId || !selectionRect || selectedEl && isChromeSection(selectedEl)) {
19524
20571
  postToParent2({ type: "ow:section-rect", instanceId: null, rect: null });
@@ -19638,7 +20685,7 @@ function AiSectionOverlay({
19638
20685
  }
19639
20686
 
19640
20687
  // src/ui/ai-section/AiMediaStripOverlay.tsx
19641
- var import_react13 = require("react");
20688
+ var import_react14 = require("react");
19642
20689
  var import_lucide_react8 = require("lucide-react");
19643
20690
 
19644
20691
  // src/lib/ai-media-strip-tree.ts
@@ -19800,8 +20847,8 @@ function readRect2(ref) {
19800
20847
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
19801
20848
  }
19802
20849
  function useLiveItemRect(ref) {
19803
- const [rect, setRect] = (0, import_react13.useState)(null);
19804
- (0, import_react13.useEffect)(() => {
20850
+ const [rect, setRect] = (0, import_react14.useState)(null);
20851
+ (0, import_react14.useEffect)(() => {
19805
20852
  if (!ref) {
19806
20853
  setRect(null);
19807
20854
  return;
@@ -19896,8 +20943,8 @@ function Pill({
19896
20943
  );
19897
20944
  }
19898
20945
  function AltInput({ value, onCommit }) {
19899
- const [draft, setDraft] = (0, import_react13.useState)(value);
19900
- (0, import_react13.useEffect)(() => setDraft(value), [value]);
20946
+ const [draft, setDraft] = (0, import_react14.useState)(value);
20947
+ (0, import_react14.useEffect)(() => setDraft(value), [value]);
19901
20948
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
19902
20949
  "div",
19903
20950
  {
@@ -19984,9 +21031,9 @@ var TREATMENTS = [
19984
21031
  ];
19985
21032
  var HTTP_URL_RE = /^https?:\/\/\S+$/i;
19986
21033
  function LinkInput({ value, onCommit }) {
19987
- const [draft, setDraft] = (0, import_react13.useState)(value);
19988
- const [invalid, setInvalid] = (0, import_react13.useState)(false);
19989
- (0, import_react13.useEffect)(() => {
21034
+ const [draft, setDraft] = (0, import_react14.useState)(value);
21035
+ const [invalid, setInvalid] = (0, import_react14.useState)(false);
21036
+ (0, import_react14.useEffect)(() => {
19990
21037
  setDraft(value);
19991
21038
  setInvalid(false);
19992
21039
  }, [value]);
@@ -20175,13 +21222,13 @@ function AiMediaStripOverlay({
20175
21222
  applyTreeLocalRef,
20176
21223
  clearInteractionChromeRef
20177
21224
  }) {
20178
- const [hover, setHover] = (0, import_react13.useState)(null);
20179
- const [active, setActive] = (0, import_react13.useState)(null);
20180
- const [pending, setPending] = (0, import_react13.useState)(false);
20181
- const [error, setError] = (0, import_react13.useState)(null);
20182
- const activeRef = (0, import_react13.useRef)(null);
21225
+ const [hover, setHover] = (0, import_react14.useState)(null);
21226
+ const [active, setActive] = (0, import_react14.useState)(null);
21227
+ const [pending, setPending] = (0, import_react14.useState)(false);
21228
+ const [error, setError] = (0, import_react14.useState)(null);
21229
+ const activeRef = (0, import_react14.useRef)(null);
20183
21230
  activeRef.current = active;
20184
- (0, import_react13.useEffect)(() => {
21231
+ (0, import_react14.useEffect)(() => {
20185
21232
  const onMove = (e) => {
20186
21233
  const t = e.target;
20187
21234
  if (!(t instanceof HTMLElement)) return;
@@ -20211,7 +21258,7 @@ function AiMediaStripOverlay({
20211
21258
  document.documentElement.removeEventListener("mouseleave", onLeave);
20212
21259
  };
20213
21260
  }, []);
20214
- (0, import_react13.useEffect)(() => {
21261
+ (0, import_react14.useEffect)(() => {
20215
21262
  const onClick = (e) => {
20216
21263
  const current = activeRef.current;
20217
21264
  if (!current) return;
@@ -20226,7 +21273,7 @@ function AiMediaStripOverlay({
20226
21273
  document.addEventListener("click", onClick, true);
20227
21274
  return () => document.removeEventListener("click", onClick, true);
20228
21275
  }, []);
20229
- (0, import_react13.useEffect)(() => {
21276
+ (0, import_react14.useEffect)(() => {
20230
21277
  const onBlur = () => {
20231
21278
  if (!activeRef.current) return;
20232
21279
  setActive(null);
@@ -20235,7 +21282,7 @@ function AiMediaStripOverlay({
20235
21282
  window.addEventListener("blur", onBlur);
20236
21283
  return () => window.removeEventListener("blur", onBlur);
20237
21284
  }, []);
20238
- (0, import_react13.useEffect)(() => {
21285
+ (0, import_react14.useEffect)(() => {
20239
21286
  const onKeyDown = (e) => {
20240
21287
  if (e.key !== "Escape") return;
20241
21288
  if (!activeRef.current) return;
@@ -20245,14 +21292,14 @@ function AiMediaStripOverlay({
20245
21292
  document.addEventListener("keydown", onKeyDown);
20246
21293
  return () => document.removeEventListener("keydown", onKeyDown);
20247
21294
  }, []);
20248
- const findEntry = (0, import_react13.useCallback)(
21295
+ const findEntry = (0, import_react14.useCallback)(
20249
21296
  (sectionId) => {
20250
21297
  const state = parseAiSectionsState(aiSectionsRef.current);
20251
21298
  return state.sections.find((s) => s.id === sectionId) ?? null;
20252
21299
  },
20253
21300
  [aiSectionsRef]
20254
21301
  );
20255
- const runMutation = (0, import_react13.useCallback)(
21302
+ const runMutation = (0, import_react14.useCallback)(
20256
21303
  async (sectionId, mutate, extraMedia) => {
20257
21304
  const entry = findEntry(sectionId);
20258
21305
  if (!entry) return false;
@@ -20399,7 +21446,7 @@ function AiMediaStripOverlay({
20399
21446
  }
20400
21447
 
20401
21448
  // src/ui/ai-section/AiPricingCardOverlay.tsx
20402
- var import_react14 = require("react");
21449
+ var import_react15 = require("react");
20403
21450
  var import_lucide_react9 = require("lucide-react");
20404
21451
  var import_jsx_runtime21 = require("react/jsx-runtime");
20405
21452
  var PRIMARY4 = "var(--ohw-primary, #0885FE)";
@@ -20442,8 +21489,8 @@ function readGridRect(ref) {
20442
21489
  return rectOf(card?.closest("[data-ohw-pricing-collection]") ?? card);
20443
21490
  }
20444
21491
  function useLiveCardRect(ref, grid = false) {
20445
- const [rect, setRect] = (0, import_react14.useState)(null);
20446
- (0, import_react14.useEffect)(() => {
21492
+ const [rect, setRect] = (0, import_react15.useState)(null);
21493
+ (0, import_react15.useEffect)(() => {
20447
21494
  if (!ref) {
20448
21495
  setRect(null);
20449
21496
  return;
@@ -20471,10 +21518,10 @@ var TOOLBAR_GRID_GAP = 52;
20471
21518
  var TOOLBAR_GRID_GAP_MOBILE = 42;
20472
21519
  var TOOLBAR_EDGE_MARGIN2 = 4;
20473
21520
  function GridToolbarSlot({ gridRect, children }) {
20474
- const slotRef = (0, import_react14.useRef)(null);
20475
- const [shift, setShift] = (0, import_react14.useState)(0);
21521
+ const slotRef = (0, import_react15.useRef)(null);
21522
+ const [shift, setShift] = (0, import_react15.useState)(0);
20476
21523
  const centerX = gridRect.left + gridRect.width / 2;
20477
- (0, import_react14.useLayoutEffect)(() => {
21524
+ (0, import_react15.useLayoutEffect)(() => {
20478
21525
  const slot = slotRef.current;
20479
21526
  if (!slot) return;
20480
21527
  const clamp = () => {
@@ -20731,13 +21778,13 @@ function AiPricingCardOverlay({
20731
21778
  aiSectionsRef,
20732
21779
  applyTreeLocalRef
20733
21780
  }) {
20734
- const [hover, setHover] = (0, import_react14.useState)(null);
20735
- const [active, setActive] = (0, import_react14.useState)(null);
20736
- const [pending, setPending] = (0, import_react14.useState)(false);
20737
- const [error, setError] = (0, import_react14.useState)(null);
20738
- const activeRef = (0, import_react14.useRef)(null);
21781
+ const [hover, setHover] = (0, import_react15.useState)(null);
21782
+ const [active, setActive] = (0, import_react15.useState)(null);
21783
+ const [pending, setPending] = (0, import_react15.useState)(false);
21784
+ const [error, setError] = (0, import_react15.useState)(null);
21785
+ const activeRef = (0, import_react15.useRef)(null);
20739
21786
  activeRef.current = active;
20740
- (0, import_react14.useEffect)(() => {
21787
+ (0, import_react15.useEffect)(() => {
20741
21788
  const onMove = (e) => {
20742
21789
  const ref = cardRefFromTarget(e.target);
20743
21790
  const t = e.target;
@@ -20755,7 +21802,7 @@ function AiPricingCardOverlay({
20755
21802
  document.documentElement.removeEventListener("mouseleave", onLeave);
20756
21803
  };
20757
21804
  }, []);
20758
- (0, import_react14.useEffect)(() => {
21805
+ (0, import_react15.useEffect)(() => {
20759
21806
  const onClick = (e) => {
20760
21807
  const t = e.target;
20761
21808
  if (!(t instanceof Element)) return;
@@ -20767,7 +21814,7 @@ function AiPricingCardOverlay({
20767
21814
  document.addEventListener("click", onClick, true);
20768
21815
  return () => document.removeEventListener("click", onClick, true);
20769
21816
  }, []);
20770
- (0, import_react14.useEffect)(() => {
21817
+ (0, import_react15.useEffect)(() => {
20771
21818
  const onBlur = () => {
20772
21819
  if (!activeRef.current) return;
20773
21820
  setActive(null);
@@ -20776,7 +21823,7 @@ function AiPricingCardOverlay({
20776
21823
  window.addEventListener("blur", onBlur);
20777
21824
  return () => window.removeEventListener("blur", onBlur);
20778
21825
  }, []);
20779
- (0, import_react14.useEffect)(() => {
21826
+ (0, import_react15.useEffect)(() => {
20780
21827
  const onKeyDown = (e) => {
20781
21828
  if (e.key !== "Escape") return;
20782
21829
  if (!activeRef.current) return;
@@ -20787,14 +21834,14 @@ function AiPricingCardOverlay({
20787
21834
  document.addEventListener("keydown", onKeyDown);
20788
21835
  return () => document.removeEventListener("keydown", onKeyDown);
20789
21836
  }, []);
20790
- const findEntry = (0, import_react14.useCallback)(
21837
+ const findEntry = (0, import_react15.useCallback)(
20791
21838
  (sectionId) => {
20792
21839
  const state = parseAiSectionsState(aiSectionsRef.current);
20793
21840
  return state.sections.find((s) => s.id === sectionId) ?? null;
20794
21841
  },
20795
21842
  [aiSectionsRef]
20796
21843
  );
20797
- const runMutation = (0, import_react14.useCallback)(
21844
+ const runMutation = (0, import_react15.useCallback)(
20798
21845
  async (sectionId, mutate) => {
20799
21846
  const entry = findEntry(sectionId);
20800
21847
  if (!entry) return false;
@@ -20881,7 +21928,7 @@ function AiPricingCardOverlay({
20881
21928
  }
20882
21929
 
20883
21930
  // src/ui/ai-section/AiVideoOverlay.tsx
20884
- var import_react15 = require("react");
21931
+ var import_react16 = require("react");
20885
21932
  var import_lucide_react10 = require("lucide-react");
20886
21933
 
20887
21934
  // src/lib/ai-video-tree.ts
@@ -20946,8 +21993,8 @@ function readRect4(ref) {
20946
21993
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
20947
21994
  }
20948
21995
  function useLiveBlockRect(ref) {
20949
- const [rect, setRect] = (0, import_react15.useState)(null);
20950
- (0, import_react15.useEffect)(() => {
21996
+ const [rect, setRect] = (0, import_react16.useState)(null);
21997
+ (0, import_react16.useEffect)(() => {
20951
21998
  if (!ref) {
20952
21999
  setRect(null);
20953
22000
  return;
@@ -21025,9 +22072,9 @@ function watchUrl(id) {
21025
22072
  return `https://www.youtube.com/watch?v=${id}`;
21026
22073
  }
21027
22074
  function VideoUrlInput({ value, onCommit }) {
21028
- const [draft, setDraft] = (0, import_react15.useState)(value ? watchUrl(value) : "");
21029
- const [invalid, setInvalid] = (0, import_react15.useState)(false);
21030
- (0, import_react15.useEffect)(() => {
22075
+ const [draft, setDraft] = (0, import_react16.useState)(value ? watchUrl(value) : "");
22076
+ const [invalid, setInvalid] = (0, import_react16.useState)(false);
22077
+ (0, import_react16.useEffect)(() => {
21031
22078
  setDraft(value ? watchUrl(value) : "");
21032
22079
  setInvalid(false);
21033
22080
  }, [value]);
@@ -21164,13 +22211,13 @@ function AiVideoOverlay({
21164
22211
  applyTreeLocalRef,
21165
22212
  clearInteractionChromeRef
21166
22213
  }) {
21167
- const [hover, setHover] = (0, import_react15.useState)(null);
21168
- const [active, setActive] = (0, import_react15.useState)(null);
21169
- const [pending, setPending] = (0, import_react15.useState)(false);
21170
- const [error, setError] = (0, import_react15.useState)(null);
21171
- const activeRef = (0, import_react15.useRef)(null);
22214
+ const [hover, setHover] = (0, import_react16.useState)(null);
22215
+ const [active, setActive] = (0, import_react16.useState)(null);
22216
+ const [pending, setPending] = (0, import_react16.useState)(false);
22217
+ const [error, setError] = (0, import_react16.useState)(null);
22218
+ const activeRef = (0, import_react16.useRef)(null);
21172
22219
  activeRef.current = active;
21173
- (0, import_react15.useEffect)(() => {
22220
+ (0, import_react16.useEffect)(() => {
21174
22221
  const onMove = (e) => {
21175
22222
  const t = e.target;
21176
22223
  if (!(t instanceof HTMLElement)) return;
@@ -21200,7 +22247,7 @@ function AiVideoOverlay({
21200
22247
  document.documentElement.removeEventListener("mouseleave", onLeave);
21201
22248
  };
21202
22249
  }, []);
21203
- (0, import_react15.useEffect)(() => {
22250
+ (0, import_react16.useEffect)(() => {
21204
22251
  const onClick = (e) => {
21205
22252
  const current = activeRef.current;
21206
22253
  if (!current) return;
@@ -21215,7 +22262,7 @@ function AiVideoOverlay({
21215
22262
  document.addEventListener("click", onClick, true);
21216
22263
  return () => document.removeEventListener("click", onClick, true);
21217
22264
  }, []);
21218
- (0, import_react15.useEffect)(() => {
22265
+ (0, import_react16.useEffect)(() => {
21219
22266
  const onBlur = () => {
21220
22267
  if (!activeRef.current) return;
21221
22268
  setActive(null);
@@ -21224,7 +22271,7 @@ function AiVideoOverlay({
21224
22271
  window.addEventListener("blur", onBlur);
21225
22272
  return () => window.removeEventListener("blur", onBlur);
21226
22273
  }, []);
21227
- (0, import_react15.useEffect)(() => {
22274
+ (0, import_react16.useEffect)(() => {
21228
22275
  const onKeyDown = (e) => {
21229
22276
  if (e.key !== "Escape") return;
21230
22277
  if (!activeRef.current) return;
@@ -21234,14 +22281,14 @@ function AiVideoOverlay({
21234
22281
  document.addEventListener("keydown", onKeyDown);
21235
22282
  return () => document.removeEventListener("keydown", onKeyDown);
21236
22283
  }, []);
21237
- const findEntry = (0, import_react15.useCallback)(
22284
+ const findEntry = (0, import_react16.useCallback)(
21238
22285
  (sectionId) => {
21239
22286
  const state = parseAiSectionsState(aiSectionsRef.current);
21240
22287
  return state.sections.find((s) => s.id === sectionId) ?? null;
21241
22288
  },
21242
22289
  [aiSectionsRef]
21243
22290
  );
21244
- const runMutation = (0, import_react15.useCallback)(
22291
+ const runMutation = (0, import_react16.useCallback)(
21245
22292
  async (sectionId, mutate) => {
21246
22293
  const entry = findEntry(sectionId);
21247
22294
  if (!entry) return false;
@@ -21333,7 +22380,7 @@ function AiVideoOverlay({
21333
22380
  }
21334
22381
 
21335
22382
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
21336
- var import_react16 = require("react");
22383
+ var import_react17 = require("react");
21337
22384
  var import_lucide_react11 = require("lucide-react");
21338
22385
 
21339
22386
  // src/lib/ai-carousel-tree.ts
@@ -21406,8 +22453,8 @@ function readRect5(ref) {
21406
22453
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
21407
22454
  }
21408
22455
  function useLiveItemRect2(ref) {
21409
- const [rect, setRect] = (0, import_react16.useState)(null);
21410
- (0, import_react16.useEffect)(() => {
22456
+ const [rect, setRect] = (0, import_react17.useState)(null);
22457
+ (0, import_react17.useEffect)(() => {
21411
22458
  if (!ref) {
21412
22459
  setRect(null);
21413
22460
  return;
@@ -21614,19 +22661,19 @@ function AiFadeCarouselOverlay({
21614
22661
  applyTreeLocalRef,
21615
22662
  clearInteractionChromeRef
21616
22663
  }) {
21617
- const [hover, setHover] = (0, import_react16.useState)(null);
21618
- const [active, setActive] = (0, import_react16.useState)(null);
21619
- const [pending, setPending] = (0, import_react16.useState)(false);
21620
- const [error, setError] = (0, import_react16.useState)(null);
21621
- const [autoplayOverride, setAutoplayOverride] = (0, import_react16.useState)(null);
21622
- const [swapping, setSwapping] = (0, import_react16.useState)(null);
21623
- const skeletonRef = (0, import_react16.useRef)(null);
21624
- const activeRef = (0, import_react16.useRef)(null);
22664
+ const [hover, setHover] = (0, import_react17.useState)(null);
22665
+ const [active, setActive] = (0, import_react17.useState)(null);
22666
+ const [pending, setPending] = (0, import_react17.useState)(false);
22667
+ const [error, setError] = (0, import_react17.useState)(null);
22668
+ const [autoplayOverride, setAutoplayOverride] = (0, import_react17.useState)(null);
22669
+ const [swapping, setSwapping] = (0, import_react17.useState)(null);
22670
+ const skeletonRef = (0, import_react17.useRef)(null);
22671
+ const activeRef = (0, import_react17.useRef)(null);
21625
22672
  activeRef.current = active;
21626
- (0, import_react16.useEffect)(() => {
22673
+ (0, import_react17.useEffect)(() => {
21627
22674
  setAutoplayOverride(null);
21628
22675
  }, [active?.sectionId, active?.index]);
21629
- (0, import_react16.useEffect)(() => {
22676
+ (0, import_react17.useEffect)(() => {
21630
22677
  if (!swapping?.fadingOut || !skeletonRef.current) return;
21631
22678
  const anim = skeletonRef.current.animate([{ opacity: 1 }, { opacity: 0 }], {
21632
22679
  duration: MEDIA_UPLOAD_FADE_MS,
@@ -21636,7 +22683,7 @@ function AiFadeCarouselOverlay({
21636
22683
  anim.finished.then(() => setSwapping(null)).catch(() => setSwapping(null));
21637
22684
  return () => anim.cancel();
21638
22685
  }, [swapping?.fadingOut]);
21639
- (0, import_react16.useEffect)(() => {
22686
+ (0, import_react17.useEffect)(() => {
21640
22687
  const onMove = (e) => {
21641
22688
  const t = e.target;
21642
22689
  if (!(t instanceof Element)) return;
@@ -21670,7 +22717,7 @@ function AiFadeCarouselOverlay({
21670
22717
  document.documentElement.removeEventListener("mouseleave", onLeave);
21671
22718
  };
21672
22719
  }, []);
21673
- (0, import_react16.useEffect)(() => {
22720
+ (0, import_react17.useEffect)(() => {
21674
22721
  const onClick = (e) => {
21675
22722
  const current = activeRef.current;
21676
22723
  if (!current) return;
@@ -21685,7 +22732,7 @@ function AiFadeCarouselOverlay({
21685
22732
  document.addEventListener("click", onClick, true);
21686
22733
  return () => document.removeEventListener("click", onClick, true);
21687
22734
  }, []);
21688
- (0, import_react16.useEffect)(() => {
22735
+ (0, import_react17.useEffect)(() => {
21689
22736
  const onBlur = () => {
21690
22737
  if (!activeRef.current) return;
21691
22738
  setActive(null);
@@ -21694,7 +22741,7 @@ function AiFadeCarouselOverlay({
21694
22741
  window.addEventListener("blur", onBlur);
21695
22742
  return () => window.removeEventListener("blur", onBlur);
21696
22743
  }, []);
21697
- (0, import_react16.useEffect)(() => {
22744
+ (0, import_react17.useEffect)(() => {
21698
22745
  const onKeyDown = (e) => {
21699
22746
  if (e.key !== "Escape") return;
21700
22747
  if (!activeRef.current) return;
@@ -21704,14 +22751,14 @@ function AiFadeCarouselOverlay({
21704
22751
  document.addEventListener("keydown", onKeyDown);
21705
22752
  return () => document.removeEventListener("keydown", onKeyDown);
21706
22753
  }, []);
21707
- const findEntry = (0, import_react16.useCallback)(
22754
+ const findEntry = (0, import_react17.useCallback)(
21708
22755
  (sectionId) => {
21709
22756
  const state = parseAiSectionsState(aiSectionsRef.current);
21710
22757
  return state.sections.find((s) => s.id === sectionId) ?? null;
21711
22758
  },
21712
22759
  [aiSectionsRef]
21713
22760
  );
21714
- const runMutation = (0, import_react16.useCallback)(
22761
+ const runMutation = (0, import_react17.useCallback)(
21715
22762
  async (sectionId, mutate, extraMedia) => {
21716
22763
  const entry = findEntry(sectionId);
21717
22764
  if (!entry) return false;
@@ -21850,6 +22897,51 @@ function AiFadeCarouselOverlay({
21850
22897
  var import_react_dom6 = require("react-dom");
21851
22898
  var import_navigation4 = require("next/navigation");
21852
22899
 
22900
+ // src/lib/seeable.ts
22901
+ var MIN_SEEN_OPACITY = 0.05;
22902
+ function isSeeable(el) {
22903
+ const view = el.ownerDocument?.defaultView;
22904
+ if (!view) return true;
22905
+ for (let node = el; node && node !== el.ownerDocument.documentElement; node = node.parentElement) {
22906
+ const style = view.getComputedStyle(node);
22907
+ if (style.display === "none" || style.visibility === "hidden") return false;
22908
+ const opacity = parseFloat(style.opacity);
22909
+ if (Number.isFinite(opacity) && opacity < MIN_SEEN_OPACITY) return false;
22910
+ }
22911
+ return true;
22912
+ }
22913
+ function shownAs(el) {
22914
+ if (isSeeable(el)) return el;
22915
+ const key = el.getAttribute("data-ohw-key");
22916
+ if (!key) return null;
22917
+ const twin = Array.from(el.ownerDocument.querySelectorAll("[data-ohw-key]")).find(
22918
+ (other) => other !== el && other.getAttribute("data-ohw-key") === key && isSeeable(other)
22919
+ );
22920
+ return twin ?? null;
22921
+ }
22922
+ function hitsShown(el, x, y) {
22923
+ const shown = shownAs(el);
22924
+ if (!shown) return false;
22925
+ const r2 = shown.getBoundingClientRect();
22926
+ return x >= r2.left && x <= r2.right && y >= r2.top && y <= r2.bottom;
22927
+ }
22928
+ function findHiddenTwinAt(selector, x, y) {
22929
+ return Array.from(document.querySelectorAll(selector)).find(
22930
+ (el) => !isSeeable(el) && hitsShown(el, x, y)
22931
+ ) ?? null;
22932
+ }
22933
+ function stateCardFor(el, x, y) {
22934
+ const own = el.closest("[data-ohw-editable-state]");
22935
+ if (own) return own;
22936
+ return Array.from(document.querySelectorAll("[data-ohw-editable-state]")).find((card) => {
22937
+ const r2 = card.getBoundingClientRect();
22938
+ return x >= r2.left && x <= r2.right && y >= r2.top && y <= r2.bottom;
22939
+ }) ?? null;
22940
+ }
22941
+ function hoverFrame(el) {
22942
+ return shownAs(el) ?? el;
22943
+ }
22944
+
21853
22945
  // src/lib/media-overlay-guards.ts
21854
22946
  var BRIDGE_CHROME_SELECTOR = [
21855
22947
  "[data-ohw-toolbar]",
@@ -21890,7 +22982,9 @@ function findButtonAtPoint(x, y, media) {
21890
22982
  // markup, so the bbox sweep that makes real CTAs win over a full-bleed hero image
21891
22983
  // (OHH-798) claimed them too and drew the editable-item hover frame around a control
21892
22984
  // that isn't content. They move the slideshow; there is nothing there to edit.
21893
- !el.closest("[data-ohw-carousel-control]")
22985
+ !el.closest("[data-ohw-carousel-control]") && // Faded out but still laid out: rebound's instructor card keeps BOOK NOW in an opacity-0
22986
+ // hover panel, so the Default view framed (and clicked) a button nobody can see.
22987
+ isSeeable(el)
21894
22988
  );
21895
22989
  if (hits.length === 0) return null;
21896
22990
  return hits.reduce((best, el) => best.contains(el) ? el : best);
@@ -21991,7 +23085,7 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
21991
23085
  }
21992
23086
 
21993
23087
  // src/ui/link-modal/LinkPopover.tsx
21994
- var import_react20 = require("react");
23088
+ var import_react21 = require("react");
21995
23089
 
21996
23090
  // src/ui/dialog.tsx
21997
23091
  var React9 = __toESM(require("react"), 1);
@@ -22191,7 +23285,7 @@ function SectionTreeItem({
22191
23285
  }
22192
23286
 
22193
23287
  // src/ui/link-modal/UrlOrPageInput.tsx
22194
- var import_react17 = require("react");
23288
+ var import_react18 = require("react");
22195
23289
 
22196
23290
  // src/ui/input.tsx
22197
23291
  var React10 = __toESM(require("react"), 1);
@@ -22259,11 +23353,11 @@ function UrlOrPageInput({
22259
23353
  readOnly = false,
22260
23354
  urlError
22261
23355
  }) {
22262
- const inputId = (0, import_react17.useId)();
22263
- const inputRef = (0, import_react17.useRef)(null);
22264
- const rootRef = (0, import_react17.useRef)(null);
22265
- const [isFocused, setIsFocused] = (0, import_react17.useState)(false);
22266
- (0, import_react17.useEffect)(() => {
23356
+ const inputId = (0, import_react18.useId)();
23357
+ const inputRef = (0, import_react18.useRef)(null);
23358
+ const rootRef = (0, import_react18.useRef)(null);
23359
+ const [isFocused, setIsFocused] = (0, import_react18.useState)(false);
23360
+ (0, import_react18.useEffect)(() => {
22267
23361
  if (!dropdownOpen) return;
22268
23362
  const isOutside = (e) => {
22269
23363
  const root = rootRef.current;
@@ -22471,7 +23565,7 @@ function LinkEditorPanel({ state, onClose }) {
22471
23565
  }
22472
23566
 
22473
23567
  // src/ui/link-modal/SectionPickerOverlay.tsx
22474
- var import_react18 = require("react");
23568
+ var import_react19 = require("react");
22475
23569
  var import_react_dom4 = require("react-dom");
22476
23570
  var import_lucide_react17 = require("lucide-react");
22477
23571
  var import_navigation3 = require("next/navigation");
@@ -22528,12 +23622,12 @@ function hitTestSectionId(x, y, sectionIds, rects) {
22528
23622
  return null;
22529
23623
  }
22530
23624
  function useSectionRects(sectionIdsKey, enabled) {
22531
- const [rects, setRects] = (0, import_react18.useState)(/* @__PURE__ */ new Map());
22532
- const sectionIds = (0, import_react18.useMemo)(
23625
+ const [rects, setRects] = (0, import_react19.useState)(/* @__PURE__ */ new Map());
23626
+ const sectionIds = (0, import_react19.useMemo)(
22533
23627
  () => sectionIdsKey ? sectionIdsKey.split("\0") : [],
22534
23628
  [sectionIdsKey]
22535
23629
  );
22536
- (0, import_react18.useEffect)(() => {
23630
+ (0, import_react19.useEffect)(() => {
22537
23631
  if (!enabled || sectionIds.length === 0) {
22538
23632
  setRects((prev) => prev.size === 0 ? prev : /* @__PURE__ */ new Map());
22539
23633
  return;
@@ -22574,13 +23668,13 @@ function SectionPickerOverlay({
22574
23668
  }) {
22575
23669
  const router = (0, import_navigation3.useRouter)();
22576
23670
  const pathname = (0, import_navigation3.usePathname)();
22577
- const [selectedId, setSelectedId] = (0, import_react18.useState)(null);
22578
- const [hoveredId, setHoveredId] = (0, import_react18.useState)(null);
22579
- const pointerRef = (0, import_react18.useRef)(null);
22580
- const pointerScreenRef = (0, import_react18.useRef)(null);
22581
- const iframeOffsetTopRef = (0, import_react18.useRef)(null);
22582
- const sectionIdsRef = (0, import_react18.useRef)([]);
22583
- const [chromeClip, setChromeClip] = (0, import_react18.useState)(
23671
+ const [selectedId, setSelectedId] = (0, import_react19.useState)(null);
23672
+ const [hoveredId, setHoveredId] = (0, import_react19.useState)(null);
23673
+ const pointerRef = (0, import_react19.useRef)(null);
23674
+ const pointerScreenRef = (0, import_react19.useRef)(null);
23675
+ const iframeOffsetTopRef = (0, import_react19.useRef)(null);
23676
+ const sectionIdsRef = (0, import_react19.useRef)([]);
23677
+ const [chromeClip, setChromeClip] = (0, import_react19.useState)(
22584
23678
  () => ({
22585
23679
  top: 0,
22586
23680
  bottom: typeof window !== "undefined" ? window.innerHeight : 0
@@ -22588,12 +23682,12 @@ function SectionPickerOverlay({
22588
23682
  );
22589
23683
  const normalizedTarget = normalizePath(pagePath);
22590
23684
  const isOnTargetPage = normalizePath(pathname) === normalizedTarget;
22591
- (0, import_react18.useEffect)(() => {
23685
+ (0, import_react19.useEffect)(() => {
22592
23686
  if (isOnTargetPage) return;
22593
23687
  const search = readPreservedSearch();
22594
23688
  router.push(`${normalizedTarget}${search}`);
22595
23689
  }, [isOnTargetPage, normalizedTarget, router]);
22596
- (0, import_react18.useEffect)(() => {
23690
+ (0, import_react19.useEffect)(() => {
22597
23691
  document.documentElement.setAttribute("data-ohw-section-picking", "");
22598
23692
  document.querySelectorAll("[data-ohw-hovered]").forEach((el) => {
22599
23693
  el.removeAttribute("data-ohw-hovered");
@@ -22605,24 +23699,24 @@ function SectionPickerOverlay({
22605
23699
  document.documentElement.removeAttribute("data-ohw-section-picking");
22606
23700
  };
22607
23701
  }, []);
22608
- const liveSections = (0, import_react18.useMemo)(() => {
23702
+ const liveSections = (0, import_react19.useMemo)(() => {
22609
23703
  if (!isOnTargetPage) return sections;
22610
23704
  const live = collectSectionsFromDom();
22611
23705
  if (live.length === 0) return sections;
22612
23706
  const labels = new Map(sections.map((s) => [s.id, s.label]));
22613
23707
  return live.map((s) => ({ id: s.id, label: labels.get(s.id) ?? s.label }));
22614
23708
  }, [isOnTargetPage, sections, pathname]);
22615
- const sectionIdsKey = (0, import_react18.useMemo)(
23709
+ const sectionIdsKey = (0, import_react19.useMemo)(
22616
23710
  () => liveSections.map((s) => s.id).join("\0"),
22617
23711
  [liveSections]
22618
23712
  );
22619
- const sectionIds = (0, import_react18.useMemo)(
23713
+ const sectionIds = (0, import_react19.useMemo)(
22620
23714
  () => liveSections.map((s) => s.id),
22621
23715
  [liveSections]
22622
23716
  );
22623
23717
  sectionIdsRef.current = sectionIds;
22624
23718
  const rects = useSectionRects(sectionIdsKey, isOnTargetPage);
22625
- const applyHoverAt = (0, import_react18.useCallback)(
23719
+ const applyHoverAt = (0, import_react19.useCallback)(
22626
23720
  (x, y, liveRects) => {
22627
23721
  const ids = sectionIdsRef.current;
22628
23722
  const map = liveRects ?? readSectionRects(ids);
@@ -22631,7 +23725,7 @@ function SectionPickerOverlay({
22631
23725
  },
22632
23726
  []
22633
23727
  );
22634
- (0, import_react18.useEffect)(() => {
23728
+ (0, import_react19.useEffect)(() => {
22635
23729
  const applyClip = (iframeOffsetTop, visibleCanvasTop, canvasH, promptBarH = 0) => {
22636
23730
  const next = getIframeVisibleClip({
22637
23731
  iframeOffsetTop,
@@ -22675,12 +23769,12 @@ function SectionPickerOverlay({
22675
23769
  window.removeEventListener("resize", onResize);
22676
23770
  };
22677
23771
  }, [applyHoverAt]);
22678
- (0, import_react18.useEffect)(() => {
23772
+ (0, import_react19.useEffect)(() => {
22679
23773
  const ptr = pointerRef.current;
22680
23774
  if (!ptr) return;
22681
23775
  applyHoverAt(ptr.x, ptr.y, rects);
22682
23776
  }, [rects, applyHoverAt]);
22683
- (0, import_react18.useEffect)(() => {
23777
+ (0, import_react19.useEffect)(() => {
22684
23778
  const rememberPointer = (clientX, clientY) => {
22685
23779
  pointerRef.current = { x: clientX, y: clientY };
22686
23780
  const top = iframeOffsetTopRef.current;
@@ -22704,7 +23798,7 @@ function SectionPickerOverlay({
22704
23798
  window.removeEventListener("message", onPointerSync);
22705
23799
  };
22706
23800
  }, [rects, applyHoverAt]);
22707
- const handleSelect = (0, import_react18.useCallback)(
23801
+ const handleSelect = (0, import_react19.useCallback)(
22708
23802
  (section) => {
22709
23803
  if (selectedId) return;
22710
23804
  setSelectedId(section.id);
@@ -22712,7 +23806,7 @@ function SectionPickerOverlay({
22712
23806
  },
22713
23807
  [selectedId, onSelect]
22714
23808
  );
22715
- (0, import_react18.useEffect)(() => {
23809
+ (0, import_react19.useEffect)(() => {
22716
23810
  const onKeyDown = (e) => {
22717
23811
  if (e.key === "Escape") {
22718
23812
  e.preventDefault();
@@ -22835,7 +23929,7 @@ function SectionPickerOverlay({
22835
23929
  }
22836
23930
 
22837
23931
  // src/ui/link-modal/useLinkModalState.ts
22838
- var import_react19 = require("react");
23932
+ var import_react20 = require("react");
22839
23933
  function useLinkModalState({
22840
23934
  open,
22841
23935
  mode,
@@ -22847,14 +23941,14 @@ function useLinkModalState({
22847
23941
  onClose,
22848
23942
  onSubmit
22849
23943
  }) {
22850
- const availablePages = (0, import_react19.useMemo)(() => pages, [pages]);
22851
- const [searchValue, setSearchValue] = (0, import_react19.useState)("");
22852
- const [selectedPage, setSelectedPage] = (0, import_react19.useState)(null);
22853
- const [selectedSection, setSelectedSection] = (0, import_react19.useState)(null);
22854
- const [step, setStep] = (0, import_react19.useState)("input");
22855
- const [dropdownOpen, setDropdownOpen] = (0, import_react19.useState)(false);
22856
- const [urlError, setUrlError] = (0, import_react19.useState)("");
22857
- const reset = (0, import_react19.useCallback)(() => {
23944
+ const availablePages = (0, import_react20.useMemo)(() => pages, [pages]);
23945
+ const [searchValue, setSearchValue] = (0, import_react20.useState)("");
23946
+ const [selectedPage, setSelectedPage] = (0, import_react20.useState)(null);
23947
+ const [selectedSection, setSelectedSection] = (0, import_react20.useState)(null);
23948
+ const [step, setStep] = (0, import_react20.useState)("input");
23949
+ const [dropdownOpen, setDropdownOpen] = (0, import_react20.useState)(false);
23950
+ const [urlError, setUrlError] = (0, import_react20.useState)("");
23951
+ const reset = (0, import_react20.useCallback)(() => {
22858
23952
  setSearchValue("");
22859
23953
  setSelectedPage(null);
22860
23954
  setSelectedSection(null);
@@ -22862,7 +23956,7 @@ function useLinkModalState({
22862
23956
  setDropdownOpen(false);
22863
23957
  setUrlError("");
22864
23958
  }, []);
22865
- (0, import_react19.useEffect)(() => {
23959
+ (0, import_react20.useEffect)(() => {
22866
23960
  if (!open) return;
22867
23961
  if (mode === "edit" && initialTarget) {
22868
23962
  const { pageRoute } = parseTarget(initialTarget);
@@ -22878,11 +23972,11 @@ function useLinkModalState({
22878
23972
  setDropdownOpen(false);
22879
23973
  setUrlError("");
22880
23974
  }, [open, mode, initialTarget, reset]);
22881
- const filteredPages = (0, import_react19.useMemo)(() => {
23975
+ const filteredPages = (0, import_react20.useMemo)(() => {
22882
23976
  if (!searchValue.trim()) return availablePages;
22883
23977
  return availablePages.filter((p) => p.title.toLowerCase().startsWith(searchValue.toLowerCase()));
22884
23978
  }, [availablePages, searchValue]);
22885
- const activeSections = (0, import_react19.useMemo)(() => {
23979
+ const activeSections = (0, import_react20.useMemo)(() => {
22886
23980
  if (!selectedPage) return [];
22887
23981
  return getSectionsForPath(sectionsByPath, selectedPage.path);
22888
23982
  }, [selectedPage, sectionsByPath]);
@@ -22931,7 +24025,7 @@ function useLinkModalState({
22931
24025
  reset();
22932
24026
  onClose();
22933
24027
  };
22934
- const isValid = (0, import_react19.useMemo)(() => {
24028
+ const isValid = (0, import_react20.useMemo)(() => {
22935
24029
  if (urlError) return false;
22936
24030
  if (showBreadcrumb) return true;
22937
24031
  if (selectedPage) return true;
@@ -23028,7 +24122,7 @@ function LinkPopover({
23028
24122
  onSubmit
23029
24123
  });
23030
24124
  const sectionPickerActive = state.showSectionPicker && Boolean(state.selectedPage);
23031
- (0, import_react20.useEffect)(() => {
24125
+ (0, import_react21.useEffect)(() => {
23032
24126
  if (!open) return;
23033
24127
  if (sectionPickerActive) {
23034
24128
  postToParent({ type: "ui:unlock" });
@@ -23269,7 +24363,7 @@ function addFooterColumnWithPersist({
23269
24363
  }
23270
24364
 
23271
24365
  // src/ui/FloatingPanel.tsx
23272
- var import_react21 = require("react");
24366
+ var import_react22 = require("react");
23273
24367
  var import_lucide_react18 = require("lucide-react");
23274
24368
  var import_jsx_runtime33 = require("react/jsx-runtime");
23275
24369
  var PANEL_WIDTH = 256;
@@ -23331,10 +24425,10 @@ function FloatingPanel({
23331
24425
  className,
23332
24426
  bodyClassName
23333
24427
  }) {
23334
- const panelRef = (0, import_react21.useRef)(null);
23335
- const [measured, setMeasured] = (0, import_react21.useState)({ w: PANEL_WIDTH, h: 280 });
23336
- const dragRef = (0, import_react21.useRef)(null);
23337
- const homeRef = (0, import_react21.useRef)(null);
24428
+ const panelRef = (0, import_react22.useRef)(null);
24429
+ const [measured, setMeasured] = (0, import_react22.useState)({ w: PANEL_WIDTH, h: 280 });
24430
+ const dragRef = (0, import_react22.useRef)(null);
24431
+ const homeRef = (0, import_react22.useRef)(null);
23338
24432
  if (!open) {
23339
24433
  homeRef.current = null;
23340
24434
  } else if (position) {
@@ -23342,17 +24436,17 @@ function FloatingPanel({
23342
24436
  } else if (homeRef.current == null) {
23343
24437
  homeRef.current = defaultFloatingPanelPosition(parentScroll);
23344
24438
  }
23345
- const [liveScroll, setLiveScroll] = (0, import_react21.useState)(parentScroll);
24439
+ const [liveScroll, setLiveScroll] = (0, import_react22.useState)(parentScroll);
23346
24440
  const home = position ?? homeRef.current ?? defaultFloatingPanelPosition(parentScroll);
23347
24441
  const { y: fittedY, maxHeight } = fitPanelInClip(home.y, liveScroll, measured.h);
23348
24442
  const clamped = {
23349
24443
  x: clampX(home.x, measured.w),
23350
24444
  y: fittedY
23351
24445
  };
23352
- (0, import_react21.useEffect)(() => {
24446
+ (0, import_react22.useEffect)(() => {
23353
24447
  setLiveScroll(parentScroll);
23354
24448
  }, [parentScroll]);
23355
- (0, import_react21.useEffect)(() => {
24449
+ (0, import_react22.useEffect)(() => {
23356
24450
  if (!open) return;
23357
24451
  const onParentScroll = (e) => {
23358
24452
  if (e.data?.type !== "ow:parent-scroll") return;
@@ -23362,8 +24456,8 @@ function FloatingPanel({
23362
24456
  window.addEventListener("message", onParentScroll);
23363
24457
  return () => window.removeEventListener("message", onParentScroll);
23364
24458
  }, [open]);
23365
- const positionRef = (0, import_react21.useRef)(position);
23366
- (0, import_react21.useLayoutEffect)(() => {
24459
+ const positionRef = (0, import_react22.useRef)(position);
24460
+ (0, import_react22.useLayoutEffect)(() => {
23367
24461
  if (!open) {
23368
24462
  positionRef.current = position;
23369
24463
  return;
@@ -23373,7 +24467,7 @@ function FloatingPanel({
23373
24467
  }
23374
24468
  positionRef.current = position;
23375
24469
  }, [open, position, liveScroll, parentScroll]);
23376
- (0, import_react21.useLayoutEffect)(() => {
24470
+ (0, import_react22.useLayoutEffect)(() => {
23377
24471
  if (!open || !panelRef.current) return;
23378
24472
  const el = panelRef.current;
23379
24473
  const header = el.querySelector("[data-ohw-floating-panel-header]");
@@ -23382,7 +24476,7 @@ function FloatingPanel({
23382
24476
  const next = { w: el.offsetWidth || PANEL_WIDTH, h: contentH };
23383
24477
  setMeasured((prev) => prev.w === next.w && prev.h === next.h ? prev : next);
23384
24478
  }, [open, children, title, context]);
23385
- const onHeaderPointerDown = (0, import_react21.useCallback)(
24479
+ const onHeaderPointerDown = (0, import_react22.useCallback)(
23386
24480
  (e) => {
23387
24481
  if (e.button !== 0) return;
23388
24482
  if (e.target.closest("[data-ohw-floating-panel-close]")) return;
@@ -23401,7 +24495,7 @@ function FloatingPanel({
23401
24495
  },
23402
24496
  [clamped.x, clamped.y]
23403
24497
  );
23404
- const onHeaderPointerMove = (0, import_react21.useCallback)(
24498
+ const onHeaderPointerMove = (0, import_react22.useCallback)(
23405
24499
  (e) => {
23406
24500
  const drag = dragRef.current;
23407
24501
  if (!drag || drag.pointerId !== e.pointerId) return;
@@ -23427,7 +24521,7 @@ function FloatingPanel({
23427
24521
  },
23428
24522
  [measured.w, onPositionChange, liveScroll]
23429
24523
  );
23430
- const endDrag = (0, import_react21.useCallback)((e) => {
24524
+ const endDrag = (0, import_react22.useCallback)((e) => {
23431
24525
  const drag = dragRef.current;
23432
24526
  if (!drag || drag.pointerId !== e.pointerId) return;
23433
24527
  dragRef.current = null;
@@ -23437,11 +24531,11 @@ function FloatingPanel({
23437
24531
  } catch {
23438
24532
  }
23439
24533
  }, []);
23440
- (0, import_react21.useEffect)(() => {
24534
+ (0, import_react22.useEffect)(() => {
23441
24535
  if (open) return;
23442
24536
  document.documentElement.removeAttribute("data-ohw-panel-dragging");
23443
24537
  }, [open]);
23444
- (0, import_react21.useEffect)(() => () => document.documentElement.removeAttribute("data-ohw-panel-dragging"), []);
24538
+ (0, import_react22.useEffect)(() => () => document.documentElement.removeAttribute("data-ohw-panel-dragging"), []);
23445
24539
  if (!open) return null;
23446
24540
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
23447
24541
  "div",
@@ -23961,7 +25055,7 @@ function hitTestNavDropSlot(clientX, clientY, draggedHrefKey, draggedEl) {
23961
25055
  }
23962
25056
 
23963
25057
  // src/useNavItemDrag.ts
23964
- var import_react22 = require("react");
25058
+ var import_react23 = require("react");
23965
25059
  function useNavItemDrag({
23966
25060
  isEditMode,
23967
25061
  editContentRef,
@@ -23985,11 +25079,11 @@ function useNavItemDrag({
23985
25079
  getNavigationItemAnchor: getNavigationItemAnchor2,
23986
25080
  isDragHandleDisabled: isDragHandleDisabled2
23987
25081
  }) {
23988
- const navDragRef = (0, import_react22.useRef)(null);
23989
- const [navDropSlots, setNavDropSlots] = (0, import_react22.useState)([]);
23990
- const [activeNavDropIndex, setActiveNavDropIndex] = (0, import_react22.useState)(null);
23991
- const navPointerDragRef = (0, import_react22.useRef)(null);
23992
- const clearNavDragVisuals = (0, import_react22.useCallback)(() => {
25082
+ const navDragRef = (0, import_react23.useRef)(null);
25083
+ const [navDropSlots, setNavDropSlots] = (0, import_react23.useState)([]);
25084
+ const [activeNavDropIndex, setActiveNavDropIndex] = (0, import_react23.useState)(null);
25085
+ const navPointerDragRef = (0, import_react23.useRef)(null);
25086
+ const clearNavDragVisuals = (0, import_react23.useCallback)(() => {
23993
25087
  const session = navDragRef.current;
23994
25088
  const nestedHrefKey = session?.draggedEl?.closest("[data-ohw-nav-children]") != null ? session.hrefKey : null;
23995
25089
  navDragRef.current = null;
@@ -24022,7 +25116,7 @@ function useNavItemDrag({
24022
25116
  document.documentElement.removeAttribute("data-ohw-nav-dragging-root");
24023
25117
  unlockItemDragInteraction();
24024
25118
  }, [setDraggedItemRect, setIsItemDragging, setSiblingHintRects]);
24025
- const refreshNavDragVisuals = (0, import_react22.useCallback)(
25119
+ const refreshNavDragVisuals = (0, import_react23.useCallback)(
24026
25120
  (session, activeSlot, clientX, clientY) => {
24027
25121
  setDraggedItemRect(session.draggedEl.getBoundingClientRect());
24028
25122
  if (typeof clientX === "number" && typeof clientY === "number") {
@@ -24040,13 +25134,13 @@ function useNavItemDrag({
24040
25134
  },
24041
25135
  [setDraggedItemRect, setSiblingHintRects]
24042
25136
  );
24043
- const refreshNavDragVisualsRef = (0, import_react22.useRef)(refreshNavDragVisuals);
25137
+ const refreshNavDragVisualsRef = (0, import_react23.useRef)(refreshNavDragVisuals);
24044
25138
  refreshNavDragVisualsRef.current = refreshNavDragVisuals;
24045
- const commitNavDragRef = (0, import_react22.useRef)(() => {
25139
+ const commitNavDragRef = (0, import_react23.useRef)(() => {
24046
25140
  });
24047
- const beginNavDragRef = (0, import_react22.useRef)(() => {
25141
+ const beginNavDragRef = (0, import_react23.useRef)(() => {
24048
25142
  });
24049
- const beginNavDrag = (0, import_react22.useCallback)(
25143
+ const beginNavDrag = (0, import_react23.useCallback)(
24050
25144
  (session) => {
24051
25145
  const rect = session.draggedEl.getBoundingClientRect();
24052
25146
  session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
@@ -24085,7 +25179,7 @@ function useNavItemDrag({
24085
25179
  ]
24086
25180
  );
24087
25181
  beginNavDragRef.current = beginNavDrag;
24088
- const commitNavDrag = (0, import_react22.useCallback)(
25182
+ const commitNavDrag = (0, import_react23.useCallback)(
24089
25183
  (clientX, clientY) => {
24090
25184
  const session = navDragRef.current;
24091
25185
  if (!session) {
@@ -24164,7 +25258,7 @@ function useNavItemDrag({
24164
25258
  [clearNavDragVisuals, deselectRef, editContentRef, postToParentRef, selectRef]
24165
25259
  );
24166
25260
  commitNavDragRef.current = commitNavDrag;
24167
- const startNavLinkDrag = (0, import_react22.useCallback)(
25261
+ const startNavLinkDrag = (0, import_react23.useCallback)(
24168
25262
  (anchor, clientX, clientY, wasSelected) => {
24169
25263
  if (footerDragRef.current) return false;
24170
25264
  const hrefKey = anchor.getAttribute("data-ohw-href-key");
@@ -24182,7 +25276,7 @@ function useNavItemDrag({
24182
25276
  },
24183
25277
  [beginNavDrag, footerDragRef, isDragHandleDisabled2, isCtaButton]
24184
25278
  );
24185
- const onNavDragOver = (0, import_react22.useCallback)(
25279
+ const onNavDragOver = (0, import_react23.useCallback)(
24186
25280
  (e) => {
24187
25281
  const session = navDragRef.current;
24188
25282
  if (!session) return false;
@@ -24194,7 +25288,7 @@ function useNavItemDrag({
24194
25288
  },
24195
25289
  []
24196
25290
  );
24197
- (0, import_react22.useEffect)(() => {
25291
+ (0, import_react23.useEffect)(() => {
24198
25292
  if (!isEditMode) return;
24199
25293
  const THRESHOLD = 10;
24200
25294
  const resolveWasSelected = (el) => {
@@ -24321,7 +25415,7 @@ function useNavItemDrag({
24321
25415
  setLinkPopover,
24322
25416
  suppressNextClickRef
24323
25417
  ]);
24324
- const armNavPressFromChrome = (0, import_react22.useCallback)(
25418
+ const armNavPressFromChrome = (0, import_react23.useCallback)(
24325
25419
  (selected, clientX, clientY, pointerId) => {
24326
25420
  const hrefKey = selected.getAttribute("data-ohw-href-key");
24327
25421
  if (!hrefKey || !isNavbarHrefKey(hrefKey)) return false;
@@ -24353,7 +25447,7 @@ function useNavItemDrag({
24353
25447
  }
24354
25448
 
24355
25449
  // src/useSectionDrag.ts
24356
- var import_react23 = require("react");
25450
+ var import_react24 = require("react");
24357
25451
 
24358
25452
  // src/lib/section-dnd.ts
24359
25453
  function isFooterSection(el) {
@@ -24446,21 +25540,21 @@ function useSectionDrag({
24446
25540
  suppressNextClickRef,
24447
25541
  suppressClickUntilRef
24448
25542
  }) {
24449
- const sectionDragRef = (0, import_react23.useRef)(null);
24450
- const [sectionDropSlots, setSectionDropSlots] = (0, import_react23.useState)([]);
24451
- const [activeSectionDropIndex, setActiveSectionDropIndex] = (0, import_react23.useState)(null);
24452
- const [isSectionDragging, setIsSectionDragging] = (0, import_react23.useState)(false);
24453
- const sectionPointerDragRef = (0, import_react23.useRef)(null);
24454
- const autoScrollRafRef = (0, import_react23.useRef)(null);
24455
- const autoScrollDeltaRef = (0, import_react23.useRef)(0);
24456
- const stopAutoScroll = (0, import_react23.useCallback)(() => {
25543
+ const sectionDragRef = (0, import_react24.useRef)(null);
25544
+ const [sectionDropSlots, setSectionDropSlots] = (0, import_react24.useState)([]);
25545
+ const [activeSectionDropIndex, setActiveSectionDropIndex] = (0, import_react24.useState)(null);
25546
+ const [isSectionDragging, setIsSectionDragging] = (0, import_react24.useState)(false);
25547
+ const sectionPointerDragRef = (0, import_react24.useRef)(null);
25548
+ const autoScrollRafRef = (0, import_react24.useRef)(null);
25549
+ const autoScrollDeltaRef = (0, import_react24.useRef)(0);
25550
+ const stopAutoScroll = (0, import_react24.useCallback)(() => {
24457
25551
  if (autoScrollRafRef.current != null) {
24458
25552
  cancelAnimationFrame(autoScrollRafRef.current);
24459
25553
  autoScrollRafRef.current = null;
24460
25554
  }
24461
25555
  autoScrollDeltaRef.current = 0;
24462
25556
  }, []);
24463
- const tickAutoScroll = (0, import_react23.useCallback)(() => {
25557
+ const tickAutoScroll = (0, import_react24.useCallback)(() => {
24464
25558
  if (!sectionDragRef.current) {
24465
25559
  stopAutoScroll();
24466
25560
  return;
@@ -24470,7 +25564,7 @@ function useSectionDrag({
24470
25564
  }
24471
25565
  autoScrollRafRef.current = requestAnimationFrame(tickAutoScroll);
24472
25566
  }, [postToParentRef, stopAutoScroll]);
24473
- const updateAutoScroll = (0, import_react23.useCallback)(
25567
+ const updateAutoScroll = (0, import_react24.useCallback)(
24474
25568
  (clientY) => {
24475
25569
  const clip = getIframeChromeClip(parentScrollRef.current);
24476
25570
  let delta = 0;
@@ -24492,7 +25586,7 @@ function useSectionDrag({
24492
25586
  },
24493
25587
  [parentScrollRef, stopAutoScroll, tickAutoScroll]
24494
25588
  );
24495
- const clearSectionDragVisuals = (0, import_react23.useCallback)(() => {
25589
+ const clearSectionDragVisuals = (0, import_react24.useCallback)(() => {
24496
25590
  sectionDragRef.current?.draggedEl.removeAttribute("data-ohw-section-dragging");
24497
25591
  sectionDragRef.current = null;
24498
25592
  setSectionDropSlots([]);
@@ -24502,7 +25596,7 @@ function useSectionDrag({
24502
25596
  document.documentElement.removeAttribute("data-ohw-section-dragging-root");
24503
25597
  unlockItemDragInteraction();
24504
25598
  }, [stopAutoScroll]);
24505
- const refreshSectionDragVisuals = (0, import_react23.useCallback)(
25599
+ const refreshSectionDragVisuals = (0, import_react24.useCallback)(
24506
25600
  (session, clientX, clientY) => {
24507
25601
  session.lastClientX = clientX;
24508
25602
  session.lastClientY = clientY;
@@ -24516,7 +25610,7 @@ function useSectionDrag({
24516
25610
  },
24517
25611
  [updateAutoScroll]
24518
25612
  );
24519
- const beginSectionDrag = (0, import_react23.useCallback)(
25613
+ const beginSectionDrag = (0, import_react24.useCallback)(
24520
25614
  (session) => {
24521
25615
  sectionDragRef.current = session;
24522
25616
  setIsSectionDragging(true);
@@ -24527,7 +25621,7 @@ function useSectionDrag({
24527
25621
  },
24528
25622
  [refreshSectionDragVisuals]
24529
25623
  );
24530
- const commitSectionDrag = (0, import_react23.useCallback)(() => {
25624
+ const commitSectionDrag = (0, import_react24.useCallback)(() => {
24531
25625
  const session = sectionDragRef.current;
24532
25626
  if (!session) {
24533
25627
  clearSectionDragVisuals();
@@ -24563,7 +25657,7 @@ function useSectionDrag({
24563
25657
  });
24564
25658
  });
24565
25659
  }, [clearSectionDragVisuals, editContentRef, postToParentRef]);
24566
- const startSectionPressDrag = (0, import_react23.useCallback)(
25660
+ const startSectionPressDrag = (0, import_react24.useCallback)(
24567
25661
  (el, clientX, clientY, pointerId) => {
24568
25662
  if (navDragRef.current || footerDragRef.current || sectionDragRef.current) return false;
24569
25663
  const instanceId = instanceIdOf(el);
@@ -24580,7 +25674,7 @@ function useSectionDrag({
24580
25674
  },
24581
25675
  [footerDragRef, navDragRef]
24582
25676
  );
24583
- (0, import_react23.useEffect)(() => {
25677
+ (0, import_react24.useEffect)(() => {
24584
25678
  if (!isEditMode) return;
24585
25679
  const onPointerDown = (e) => {
24586
25680
  if (e.button !== 0) return;
@@ -24905,7 +25999,7 @@ function deleteSelectedNavFooterItem(deps) {
24905
25999
  }
24906
26000
 
24907
26001
  // src/lib/build-page-sync.ts
24908
- var import_react24 = require("react");
26002
+ var import_react25 = require("react");
24909
26003
  var CHROME_KEY_RE = /^(nav|footer|header|navbar)[-_]/u;
24910
26004
  function normalisePath(path) {
24911
26005
  const trimmed = path.trim().replace(/[?#].*$/u, "");
@@ -24970,12 +26064,12 @@ function collectLinks() {
24970
26064
  document.querySelectorAll("[data-ohw-href-key]").forEach((el) => {
24971
26065
  const hrefKey = el.getAttribute("data-ohw-href-key") ?? "";
24972
26066
  if (seen.has(hrefKey)) return;
24973
- const area = isNavbarHrefKey(hrefKey) ? "nav" : isFooterHrefKey(hrefKey) ? "footer" : CHROME_KEY_RE.test(hrefKey) ? "chrome" : null;
24974
- if (!area) return;
26067
+ const area2 = isNavbarHrefKey(hrefKey) ? "nav" : isFooterHrefKey(hrefKey) ? "footer" : CHROME_KEY_RE.test(hrefKey) ? "chrome" : null;
26068
+ if (!area2) return;
24975
26069
  const label = labelEl(el);
24976
- if (!label && area !== "chrome") return;
26070
+ if (!label && area2 !== "chrome") return;
24977
26071
  seen.add(hrefKey);
24978
- links.push({ hrefKey, href: linkHref(el), label: label?.textContent ?? el.textContent ?? "", area });
26072
+ links.push({ hrefKey, href: linkHref(el), label: label?.textContent ?? el.textContent ?? "", area: area2 });
24979
26073
  });
24980
26074
  return links;
24981
26075
  }
@@ -25018,7 +26112,7 @@ function applyBuildPageSync(msg, deps) {
25018
26112
  return plan.remove.length + plan.relabel.length + plan.retarget.length;
25019
26113
  }
25020
26114
  function useBuildPageSync(isEditMode, editContentRef, postToParent2) {
25021
- (0, import_react24.useEffect)(() => {
26115
+ (0, import_react25.useEffect)(() => {
25022
26116
  if (!isEditMode) return;
25023
26117
  const onMessage = (e) => {
25024
26118
  if (e.source !== window.parent || e.data?.type !== "ow:pages-sync") return;
@@ -26494,9 +27588,9 @@ function FloatingToolbar({
26494
27588
  onDelete,
26495
27589
  deleteDisabled
26496
27590
  }) {
26497
- const localRef = import_react25.default.useRef(null);
26498
- const [measuredW, setMeasuredW] = import_react25.default.useState(330);
26499
- const setRefs = import_react25.default.useCallback(
27591
+ const localRef = import_react26.default.useRef(null);
27592
+ const [measuredW, setMeasuredW] = import_react26.default.useState(330);
27593
+ const setRefs = import_react26.default.useCallback(
26500
27594
  (node) => {
26501
27595
  localRef.current = node;
26502
27596
  if (typeof elRef === "function") elRef(node);
@@ -26508,7 +27602,7 @@ function FloatingToolbar({
26508
27602
  },
26509
27603
  [elRef]
26510
27604
  );
26511
- import_react25.default.useLayoutEffect(() => {
27605
+ import_react26.default.useLayoutEffect(() => {
26512
27606
  const node = localRef.current;
26513
27607
  if (!node) return;
26514
27608
  const update = () => {
@@ -26534,7 +27628,7 @@ function FloatingToolbar({
26534
27628
  pointerEvents: "auto"
26535
27629
  },
26536
27630
  children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(CustomToolbar, { children: [
26537
- TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react25.default.Fragment, { children: [
27631
+ TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react26.default.Fragment, { children: [
26538
27632
  gi > 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CustomToolbarDivider, {}),
26539
27633
  btns.map((btn) => {
26540
27634
  const isActive = activeCommands.has(btn.cmd);
@@ -26764,8 +27858,8 @@ function OhhwellsBridge() {
26764
27858
  const router = (0, import_navigation4.useRouter)();
26765
27859
  const searchParams = (0, import_navigation4.useSearchParams)();
26766
27860
  const isEditMode = isEditSessionActive();
26767
- const [bridgeRoot, setBridgeRoot] = (0, import_react25.useState)(null);
26768
- (0, import_react25.useEffect)(() => {
27861
+ const [bridgeRoot, setBridgeRoot] = (0, import_react26.useState)(null);
27862
+ (0, import_react26.useEffect)(() => {
26769
27863
  const figtreeFontId = "ohw-figtree-font";
26770
27864
  if (!document.getElementById(figtreeFontId)) {
26771
27865
  const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
@@ -26791,8 +27885,8 @@ function OhhwellsBridge() {
26791
27885
  };
26792
27886
  }, []);
26793
27887
  const subdomainFromQuery = searchParams.get("subdomain");
26794
- const [subdomain, setSubdomain] = (0, import_react25.useState)(() => resolveSubdomain(subdomainFromQuery));
26795
- (0, import_react25.useLayoutEffect)(() => {
27888
+ const [subdomain, setSubdomain] = (0, import_react26.useState)(() => resolveSubdomain(subdomainFromQuery));
27889
+ (0, import_react26.useLayoutEffect)(() => {
26796
27890
  const next = resolveSubdomain(subdomainFromQuery);
26797
27891
  if (next !== subdomain) setSubdomain(next);
26798
27892
  if (next) return;
@@ -26804,7 +27898,7 @@ function OhhwellsBridge() {
26804
27898
  }, 0);
26805
27899
  return () => window.clearTimeout(t);
26806
27900
  }, [subdomainFromQuery, subdomain]);
26807
- (0, import_react25.useEffect)(() => {
27901
+ (0, import_react26.useEffect)(() => {
26808
27902
  if (!subdomainFromQuery || typeof window === "undefined") return;
26809
27903
  const url = new URL(window.location.href);
26810
27904
  if (!url.searchParams.has("subdomain")) return;
@@ -26815,24 +27909,25 @@ function OhhwellsBridge() {
26815
27909
  useLinkHrefGuardian(pathname, subdomain, isEditMode);
26816
27910
  useSavedLinkNavigation(isEditMode);
26817
27911
  useNavDropdownToggle(isEditMode);
27912
+ useBackgroundTone();
26818
27913
  useHashLinkScroll(isEditMode);
26819
27914
  usePublishedPlaceholderStrip(isEditMode);
26820
- const postToParent2 = (0, import_react25.useCallback)((data) => {
27915
+ const postToParent2 = (0, import_react26.useCallback)((data) => {
26821
27916
  if (typeof window !== "undefined" && window.parent !== window) {
26822
27917
  window.parent.postMessage(data, "*");
26823
27918
  }
26824
27919
  }, []);
26825
- const [fetchState, setFetchState] = (0, import_react25.useState)("idle");
26826
- const [showBranding, setShowBranding] = (0, import_react25.useState)(false);
26827
- const autoSaveTimers = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
26828
- (0, import_react25.useEffect)(() => {
27920
+ const [fetchState, setFetchState] = (0, import_react26.useState)("idle");
27921
+ const [showBranding, setShowBranding] = (0, import_react26.useState)(false);
27922
+ const autoSaveTimers = (0, import_react26.useRef)(/* @__PURE__ */ new Map());
27923
+ (0, import_react26.useEffect)(() => {
26829
27924
  stampBridgeVersionOnDocument();
26830
27925
  }, []);
26831
- (0, import_react25.useEffect)(() => {
27926
+ (0, import_react26.useEffect)(() => {
26832
27927
  if (isEditMode) return;
26833
27928
  return armLoaderHangBeacon(subdomain, fetchState);
26834
27929
  }, [isEditMode, subdomain, fetchState]);
26835
- (0, import_react25.useEffect)(() => {
27930
+ (0, import_react26.useEffect)(() => {
26836
27931
  if (isEditMode || !subdomain) return;
26837
27932
  const onError = (event) => {
26838
27933
  reportOutageBeacon({
@@ -26853,40 +27948,40 @@ function OhhwellsBridge() {
26853
27948
  window.removeEventListener("unhandledrejection", onRejection);
26854
27949
  };
26855
27950
  }, [isEditMode, subdomain]);
26856
- const activeElRef = (0, import_react25.useRef)(null);
26857
- const pointerHeldRef = (0, import_react25.useRef)(false);
26858
- const selectedElRef = (0, import_react25.useRef)(null);
26859
- const selectedHrefKeyRef = (0, import_react25.useRef)(null);
26860
- const selectedFooterColAttrRef = (0, import_react25.useRef)(null);
26861
- const footerHeadingTitleCacheRef = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
26862
- const originalContentRef = (0, import_react25.useRef)(null);
26863
- const activeStateElRef = (0, import_react25.useRef)(null);
26864
- const parentScrollRef = (0, import_react25.useRef)(null);
26865
- const visibleViewportRef = (0, import_react25.useRef)(null);
26866
- const [dialogPortalContainer, setDialogPortalContainer] = (0, import_react25.useState)(null);
26867
- const attachVisibleViewport = (0, import_react25.useCallback)((node) => {
27951
+ const activeElRef = (0, import_react26.useRef)(null);
27952
+ const pointerHeldRef = (0, import_react26.useRef)(false);
27953
+ const selectedElRef = (0, import_react26.useRef)(null);
27954
+ const selectedHrefKeyRef = (0, import_react26.useRef)(null);
27955
+ const selectedFooterColAttrRef = (0, import_react26.useRef)(null);
27956
+ const footerHeadingTitleCacheRef = (0, import_react26.useRef)(/* @__PURE__ */ new Map());
27957
+ const originalContentRef = (0, import_react26.useRef)(null);
27958
+ const activeStateElRef = (0, import_react26.useRef)(null);
27959
+ const parentScrollRef = (0, import_react26.useRef)(null);
27960
+ const visibleViewportRef = (0, import_react26.useRef)(null);
27961
+ const [dialogPortalContainer, setDialogPortalContainer] = (0, import_react26.useState)(null);
27962
+ const attachVisibleViewport = (0, import_react26.useCallback)((node) => {
26868
27963
  visibleViewportRef.current = node;
26869
27964
  setDialogPortalContainer(node);
26870
27965
  if (node) applyVisibleViewport(node, parentScrollRef.current);
26871
27966
  }, []);
26872
- const toolbarElRef = (0, import_react25.useRef)(null);
26873
- const glowElRef = (0, import_react25.useRef)(null);
26874
- const hoveredImageRef = (0, import_react25.useRef)(null);
26875
- const hoveredImageHasTextOverlapRef = (0, import_react25.useRef)(false);
26876
- const dragOverElRef = (0, import_react25.useRef)(null);
26877
- const [mediaHover, setMediaHover] = (0, import_react25.useState)(null);
26878
- const [selectedAiSectionId, setSelectedAiSectionId] = (0, import_react25.useState)(null);
26879
- const selectedAiSectionIdRef = (0, import_react25.useRef)(null);
26880
- const handleAiSectionSelectionChange = (0, import_react25.useCallback)((id) => {
27967
+ const toolbarElRef = (0, import_react26.useRef)(null);
27968
+ const glowElRef = (0, import_react26.useRef)(null);
27969
+ const hoveredImageRef = (0, import_react26.useRef)(null);
27970
+ const hoveredImageHasTextOverlapRef = (0, import_react26.useRef)(false);
27971
+ const dragOverElRef = (0, import_react26.useRef)(null);
27972
+ const [mediaHover, setMediaHover] = (0, import_react26.useState)(null);
27973
+ const [selectedAiSectionId, setSelectedAiSectionId] = (0, import_react26.useState)(null);
27974
+ const selectedAiSectionIdRef = (0, import_react26.useRef)(null);
27975
+ const handleAiSectionSelectionChange = (0, import_react26.useCallback)((id) => {
26881
27976
  selectedAiSectionIdRef.current = id;
26882
27977
  setSelectedAiSectionId(id);
26883
27978
  }, []);
26884
- const [selectedMedia, setSelectedMedia] = (0, import_react25.useState)(null);
26885
- const selectedMediaElRef = (0, import_react25.useRef)(null);
26886
- const mediaKeyDropTokenRef = (0, import_react25.useRef)(0);
26887
- const selectedIconElRef = (0, import_react25.useRef)(null);
26888
- const selectedSocialElRef = (0, import_react25.useRef)(null);
26889
- const queueSectionKeyDrop = (0, import_react25.useCallback)((prev) => {
27979
+ const [selectedMedia, setSelectedMedia] = (0, import_react26.useState)(null);
27980
+ const selectedMediaElRef = (0, import_react26.useRef)(null);
27981
+ const mediaKeyDropTokenRef = (0, import_react26.useRef)(0);
27982
+ const selectedIconElRef = (0, import_react26.useRef)(null);
27983
+ const selectedSocialElRef = (0, import_react26.useRef)(null);
27984
+ const queueSectionKeyDrop = (0, import_react26.useCallback)((prev) => {
26890
27985
  const sectionEl2 = prev?.closest("[data-ohw-section]") ?? null;
26891
27986
  if (!sectionEl2) return;
26892
27987
  const sectionInstanceId = instanceIdOf(movableUnit(sectionEl2)) || null;
@@ -26907,31 +28002,31 @@ function OhhwellsBridge() {
26907
28002
  window.addEventListener("message", onQueueDrained);
26908
28003
  window.postMessage({ type: "ow:media-key-drop", token }, "*");
26909
28004
  }, []);
26910
- const clearMediaSelection = (0, import_react25.useCallback)(() => {
28005
+ const clearMediaSelection = (0, import_react26.useCallback)(() => {
26911
28006
  const prev = selectedMediaElRef.current;
26912
28007
  selectedMediaElRef.current = null;
26913
28008
  setSelectedMedia(null);
26914
28009
  queueSectionKeyDrop(prev);
26915
28010
  }, [queueSectionKeyDrop]);
26916
- const clearMediaSelectionRef = (0, import_react25.useRef)(clearMediaSelection);
28011
+ const clearMediaSelectionRef = (0, import_react26.useRef)(clearMediaSelection);
26917
28012
  clearMediaSelectionRef.current = clearMediaSelection;
26918
- const clearIconSelection = (0, import_react25.useCallback)(() => {
28013
+ const clearIconSelection = (0, import_react26.useCallback)(() => {
26919
28014
  const prev = selectedIconElRef.current;
26920
28015
  if (!prev) return;
26921
28016
  selectedIconElRef.current = null;
26922
28017
  queueSectionKeyDrop(prev);
26923
28018
  }, [queueSectionKeyDrop]);
26924
- const clearIconSelectionRef = (0, import_react25.useRef)(clearIconSelection);
28019
+ const clearIconSelectionRef = (0, import_react26.useRef)(clearIconSelection);
26925
28020
  clearIconSelectionRef.current = clearIconSelection;
26926
- const clearSocialSelection = (0, import_react25.useCallback)(() => {
28021
+ const clearSocialSelection = (0, import_react26.useCallback)(() => {
26927
28022
  const prev = selectedSocialElRef.current;
26928
28023
  if (!prev) return;
26929
28024
  selectedSocialElRef.current = null;
26930
28025
  queueSectionKeyDrop(prev);
26931
28026
  }, [queueSectionKeyDrop]);
26932
- const clearSocialSelectionRef = (0, import_react25.useRef)(clearSocialSelection);
28027
+ const clearSocialSelectionRef = (0, import_react26.useRef)(clearSocialSelection);
26933
28028
  clearSocialSelectionRef.current = clearSocialSelection;
26934
- const selectIconElement = (0, import_react25.useCallback)((el) => {
28029
+ const selectIconElement = (0, import_react26.useCallback)((el) => {
26935
28030
  if (selectedMediaElRef.current) clearMediaSelectionRef.current();
26936
28031
  selectedIconElRef.current = el;
26937
28032
  const sectionEl2 = el.closest("[data-ohw-section]");
@@ -26944,9 +28039,9 @@ function OhhwellsBridge() {
26944
28039
  keyLabel: "Icon"
26945
28040
  });
26946
28041
  }, []);
26947
- const selectIconElementRef = (0, import_react25.useRef)(selectIconElement);
28042
+ const selectIconElementRef = (0, import_react26.useRef)(selectIconElement);
26948
28043
  selectIconElementRef.current = selectIconElement;
26949
- const selectMediaElement = (0, import_react25.useCallback)((el) => {
28044
+ const selectMediaElement = (0, import_react26.useCallback)((el) => {
26950
28045
  const r2 = el.getBoundingClientRect();
26951
28046
  const video = el.dataset.ohwEditable === "video" ? el.querySelector("video") : null;
26952
28047
  selectedIconElRef.current = null;
@@ -26971,9 +28066,9 @@ function OhhwellsBridge() {
26971
28066
  keyLabel: el.dataset.ohwEditable === "video" ? "Video" : el.dataset.ohwEditable === "bg-image" ? "Background" : "Image"
26972
28067
  });
26973
28068
  }, []);
26974
- const selectMediaElementRef = (0, import_react25.useRef)(selectMediaElement);
28069
+ const selectMediaElementRef = (0, import_react26.useRef)(selectMediaElement);
26975
28070
  selectMediaElementRef.current = selectMediaElement;
26976
- (0, import_react25.useEffect)(() => {
28071
+ (0, import_react26.useEffect)(() => {
26977
28072
  if (!selectedMedia) return;
26978
28073
  const update = () => {
26979
28074
  const el = selectedMediaElRef.current;
@@ -26993,54 +28088,56 @@ function OhhwellsBridge() {
26993
28088
  window.removeEventListener("resize", update);
26994
28089
  };
26995
28090
  }, [selectedMedia !== null]);
26996
- const [carouselHover, setCarouselHover] = (0, import_react25.useState)(null);
26997
- const [uploadingRects, setUploadingRects] = (0, import_react25.useState)({});
26998
- const hoveredGapRef = (0, import_react25.useRef)(null);
26999
- const imageUnhoverTimerRef = (0, import_react25.useRef)(null);
27000
- const imageShowTimerRef = (0, import_react25.useRef)(null);
27001
- const editStylesRef = (0, import_react25.useRef)(null);
27002
- const activateRef = (0, import_react25.useRef)(() => {
28091
+ const [carouselHover, setCarouselHover] = (0, import_react26.useState)(null);
28092
+ const [uploadingRects, setUploadingRects] = (0, import_react26.useState)({});
28093
+ const hoveredGapRef = (0, import_react26.useRef)(null);
28094
+ const imageUnhoverTimerRef = (0, import_react26.useRef)(null);
28095
+ const imageShowTimerRef = (0, import_react26.useRef)(null);
28096
+ const editStylesRef = (0, import_react26.useRef)(null);
28097
+ const activateRef = (0, import_react26.useRef)(() => {
28098
+ });
28099
+ const stateChangeRef = (0, import_react26.useRef)(() => {
27003
28100
  });
27004
- const deactivateRef = (0, import_react25.useRef)(() => {
28101
+ const deactivateRef = (0, import_react26.useRef)(() => {
27005
28102
  });
27006
- const selectRef = (0, import_react25.useRef)(() => {
28103
+ const selectRef = (0, import_react26.useRef)(() => {
27007
28104
  });
27008
- const selectFrameRef = (0, import_react25.useRef)(() => {
28105
+ const selectFrameRef = (0, import_react26.useRef)(() => {
27009
28106
  });
27010
- const selectLogoRef = (0, import_react25.useRef)(() => {
28107
+ const selectLogoRef = (0, import_react26.useRef)(() => {
27011
28108
  });
27012
- const openLogoSizePanelRef = (0, import_react25.useRef)(() => {
28109
+ const openLogoSizePanelRef = (0, import_react26.useRef)(() => {
27013
28110
  });
27014
- const deselectRef = (0, import_react25.useRef)(() => {
28111
+ const deselectRef = (0, import_react26.useRef)(() => {
27015
28112
  });
27016
- const closeFloatingPanelOnlyRef = (0, import_react25.useRef)(() => {
28113
+ const closeFloatingPanelOnlyRef = (0, import_react26.useRef)(() => {
27017
28114
  });
27018
- const reselectNavigationItemRef = (0, import_react25.useRef)(() => {
28115
+ const reselectNavigationItemRef = (0, import_react26.useRef)(() => {
27019
28116
  });
27020
- const commitNavigationTextEditRef = (0, import_react25.useRef)(() => {
28117
+ const commitNavigationTextEditRef = (0, import_react26.useRef)(() => {
27021
28118
  });
27022
- const handleDeleteSelectedRef = (0, import_react25.useRef)(() => false);
27023
- const runPendingDeleteUndoRef = (0, import_react25.useRef)(() => false);
27024
- const isFooterFrameSelectionRef = (0, import_react25.useRef)(false);
27025
- const refreshActiveCommandsRef = (0, import_react25.useRef)(() => {
28119
+ const handleDeleteSelectedRef = (0, import_react26.useRef)(() => false);
28120
+ const runPendingDeleteUndoRef = (0, import_react26.useRef)(() => false);
28121
+ const isFooterFrameSelectionRef = (0, import_react26.useRef)(false);
28122
+ const refreshActiveCommandsRef = (0, import_react26.useRef)(() => {
27026
28123
  });
27027
- const postToParentRef = (0, import_react25.useRef)(postToParent2);
28124
+ const postToParentRef = (0, import_react26.useRef)(postToParent2);
27028
28125
  postToParentRef.current = postToParent2;
27029
- const aiSectionApiRef = (0, import_react25.useRef)(null);
27030
- const sectionsLoadedRef = (0, import_react25.useRef)(false);
27031
- const pendingScheduleConfigRequests = (0, import_react25.useRef)([]);
27032
- const [toolbarRect, setToolbarRect] = (0, import_react25.useState)(null);
27033
- const [formPickRect, setFormPickRect] = (0, import_react25.useState)(null);
27034
- const formPickElRef = (0, import_react25.useRef)(null);
27035
- const [formViewState, setFormViewStateUi] = (0, import_react25.useState)("default");
27036
- const [formPickCount, setFormPickCount] = (0, import_react25.useState)(null);
27037
- const [formHoverRect, setFormHoverRect] = (0, import_react25.useState)(null);
27038
- const formHoverElRef = (0, import_react25.useRef)(null);
27039
- const [fieldPickRect, setFieldPickRect] = (0, import_react25.useState)(null);
27040
- const fieldPickElRef = (0, import_react25.useRef)(null);
27041
- const [fieldPickState, setFieldPickState] = (0, import_react25.useState)(null);
27042
- const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0, import_react25.useState)(false);
27043
- const clearFormPick = (0, import_react25.useCallback)(() => {
28126
+ const aiSectionApiRef = (0, import_react26.useRef)(null);
28127
+ const sectionsLoadedRef = (0, import_react26.useRef)(false);
28128
+ const pendingScheduleConfigRequests = (0, import_react26.useRef)([]);
28129
+ const [toolbarRect, setToolbarRect] = (0, import_react26.useState)(null);
28130
+ const [formPickRect, setFormPickRect] = (0, import_react26.useState)(null);
28131
+ const formPickElRef = (0, import_react26.useRef)(null);
28132
+ const [formViewState, setFormViewStateUi] = (0, import_react26.useState)("default");
28133
+ const [formPickCount, setFormPickCount] = (0, import_react26.useState)(null);
28134
+ const [formHoverRect, setFormHoverRect] = (0, import_react26.useState)(null);
28135
+ const formHoverElRef = (0, import_react26.useRef)(null);
28136
+ const [fieldPickRect, setFieldPickRect] = (0, import_react26.useState)(null);
28137
+ const fieldPickElRef = (0, import_react26.useRef)(null);
28138
+ const [fieldPickState, setFieldPickState] = (0, import_react26.useState)(null);
28139
+ const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0, import_react26.useState)(false);
28140
+ const clearFormPick = (0, import_react26.useCallback)(() => {
27044
28141
  const form = formPickElRef.current;
27045
28142
  const editing = fieldPickElRef.current;
27046
28143
  if (commitPlaceholderEdit(editing) && editing) {
@@ -27060,7 +28157,7 @@ function OhhwellsBridge() {
27060
28157
  formPickElRef.current = null;
27061
28158
  setFormPickRect(null);
27062
28159
  }, []);
27063
- const clearFieldPick = (0, import_react25.useCallback)(() => {
28160
+ const clearFieldPick = (0, import_react26.useCallback)(() => {
27064
28161
  const wrapper = fieldPickElRef.current;
27065
28162
  if (commitPlaceholderEdit(wrapper) && wrapper) {
27066
28163
  const form = wrapper.closest('[data-ohw-editable="form"]');
@@ -27070,9 +28167,9 @@ function OhhwellsBridge() {
27070
28167
  setFieldPickRect(null);
27071
28168
  setFieldPickState(null);
27072
28169
  }, []);
27073
- const persistFieldsRef = (0, import_react25.useRef)(() => {
28170
+ const persistFieldsRef = (0, import_react26.useRef)(() => {
27074
28171
  });
27075
- const persistFields = (0, import_react25.useCallback)(
28172
+ const persistFields = (0, import_react26.useCallback)(
27076
28173
  (form) => {
27077
28174
  const key = formKeyOf(form);
27078
28175
  if (!key) return;
@@ -27083,7 +28180,7 @@ function OhhwellsBridge() {
27083
28180
  []
27084
28181
  );
27085
28182
  persistFieldsRef.current = persistFields;
27086
- const selectField = (0, import_react25.useCallback)((wrapper) => {
28183
+ const selectField = (0, import_react26.useCallback)((wrapper) => {
27087
28184
  if (fieldPickElRef.current && fieldPickElRef.current !== wrapper) {
27088
28185
  commitPlaceholderEdit(fieldPickElRef.current);
27089
28186
  }
@@ -27096,7 +28193,7 @@ function OhhwellsBridge() {
27096
28193
  setFieldPickState({ type: fieldTypeOf(wrapper), required: isFieldRequired(wrapper) });
27097
28194
  setFieldTypePickerOpen(false);
27098
28195
  }, []);
27099
- const withSelectedField = (0, import_react25.useCallback)(
28196
+ const withSelectedField = (0, import_react26.useCallback)(
27100
28197
  (run) => {
27101
28198
  const wrapper = fieldPickElRef.current;
27102
28199
  const form = formPickElRef.current;
@@ -27109,28 +28206,28 @@ function OhhwellsBridge() {
27109
28206
  },
27110
28207
  [persistFields]
27111
28208
  );
27112
- const handleFieldTypeChange = (0, import_react25.useCallback)(
28209
+ const handleFieldTypeChange = (0, import_react26.useCallback)(
27113
28210
  (type) => withSelectedField((_form, wrapper) => {
27114
28211
  applyFieldType(wrapper, type);
27115
28212
  selectField(wrapper);
27116
28213
  }),
27117
28214
  [selectField, withSelectedField]
27118
28215
  );
27119
- const handleFieldRequiredToggle = (0, import_react25.useCallback)(
28216
+ const handleFieldRequiredToggle = (0, import_react26.useCallback)(
27120
28217
  () => withSelectedField((_form, wrapper) => {
27121
28218
  setFieldRequired(wrapper, !isFieldRequired(wrapper));
27122
28219
  selectField(wrapper);
27123
28220
  }),
27124
28221
  [selectField, withSelectedField]
27125
28222
  );
27126
- const handleFieldDuplicate = (0, import_react25.useCallback)(
28223
+ const handleFieldDuplicate = (0, import_react26.useCallback)(
27127
28224
  () => withSelectedField((form, wrapper) => {
27128
28225
  const copy = duplicateField(form, wrapper);
27129
28226
  selectField(copy);
27130
28227
  }),
27131
28228
  [selectField, withSelectedField]
27132
28229
  );
27133
- const handleFieldDelete = (0, import_react25.useCallback)(
28230
+ const handleFieldDelete = (0, import_react26.useCallback)(
27134
28231
  () => withSelectedField((_form, wrapper) => {
27135
28232
  removeField(wrapper);
27136
28233
  clearFieldPick();
@@ -27138,7 +28235,7 @@ function OhhwellsBridge() {
27138
28235
  }),
27139
28236
  [clearFieldPick, withSelectedField]
27140
28237
  );
27141
- const handleAddField = (0, import_react25.useCallback)(
28238
+ const handleAddField = (0, import_react26.useCallback)(
27142
28239
  (type) => {
27143
28240
  const form = formPickElRef.current;
27144
28241
  if (!form) return;
@@ -27154,8 +28251,8 @@ function OhhwellsBridge() {
27154
28251
  },
27155
28252
  [persistFields, selectField]
27156
28253
  );
27157
- const fieldDragRef = (0, import_react25.useRef)(null);
27158
- const buildFieldDropSlots = (0, import_react25.useCallback)((form, draggedKey) => {
28254
+ const fieldDragRef = (0, import_react26.useRef)(null);
28255
+ const buildFieldDropSlots = (0, import_react26.useCallback)((form, draggedKey) => {
27159
28256
  const others = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== draggedKey);
27160
28257
  const slots = others.map((el) => {
27161
28258
  const rect = el.getBoundingClientRect();
@@ -27168,7 +28265,7 @@ function OhhwellsBridge() {
27168
28265
  }
27169
28266
  return slots;
27170
28267
  }, []);
27171
- const handleFieldDragStart = (0, import_react25.useCallback)(() => {
28268
+ const handleFieldDragStart = (0, import_react26.useCallback)(() => {
27172
28269
  const wrapper = fieldPickElRef.current;
27173
28270
  const form = formPickElRef.current;
27174
28271
  if (!wrapper || !form) return;
@@ -27177,18 +28274,18 @@ function OhhwellsBridge() {
27177
28274
  setFieldDragging(true);
27178
28275
  setFieldDropSlots(buildFieldDropSlots(form, key));
27179
28276
  }, [buildFieldDropSlots]);
27180
- const handleFieldDragEnd = (0, import_react25.useCallback)(() => {
28277
+ const handleFieldDragEnd = (0, import_react26.useCallback)(() => {
27181
28278
  fieldDragRef.current = null;
27182
28279
  setFieldDropIndex(null);
27183
28280
  setFieldDropSlots([]);
27184
28281
  setFieldDragging(false);
27185
28282
  }, []);
27186
- const [fieldDropIndex, setFieldDropIndex] = (0, import_react25.useState)(null);
27187
- const [fieldDropSlots, setFieldDropSlots] = (0, import_react25.useState)([]);
27188
- const [fieldDragging, setFieldDragging] = (0, import_react25.useState)(false);
27189
- const clearFormPickRef = (0, import_react25.useRef)(clearFormPick);
28283
+ const [fieldDropIndex, setFieldDropIndex] = (0, import_react26.useState)(null);
28284
+ const [fieldDropSlots, setFieldDropSlots] = (0, import_react26.useState)([]);
28285
+ const [fieldDragging, setFieldDragging] = (0, import_react26.useState)(false);
28286
+ const clearFormPickRef = (0, import_react26.useRef)(clearFormPick);
27190
28287
  clearFormPickRef.current = clearFormPick;
27191
- (0, import_react25.useEffect)(() => {
28288
+ (0, import_react26.useEffect)(() => {
27192
28289
  const el = fieldPickElRef.current;
27193
28290
  if (!el || fieldPickRect === null) return;
27194
28291
  const observer = new ResizeObserver(() => {
@@ -27197,7 +28294,7 @@ function OhhwellsBridge() {
27197
28294
  observer.observe(el);
27198
28295
  return () => observer.disconnect();
27199
28296
  }, [fieldPickRect !== null, fieldPickState]);
27200
- (0, import_react25.useEffect)(() => {
28297
+ (0, import_react26.useEffect)(() => {
27201
28298
  const el = formPickElRef.current;
27202
28299
  if (!el || formPickRect === null) return;
27203
28300
  const observer = new ResizeObserver(() => {
@@ -27206,27 +28303,27 @@ function OhhwellsBridge() {
27206
28303
  observer.observe(el);
27207
28304
  return () => observer.disconnect();
27208
28305
  }, [formPickRect !== null, formViewState]);
27209
- const [toolbarVariant, setToolbarVariant] = (0, import_react25.useState)("none");
27210
- const toolbarVariantRef = (0, import_react25.useRef)("none");
28306
+ const [toolbarVariant, setToolbarVariant] = (0, import_react26.useState)("none");
28307
+ const toolbarVariantRef = (0, import_react26.useRef)("none");
27211
28308
  toolbarVariantRef.current = toolbarVariant;
27212
- const [selectedIsCta, setSelectedIsCta] = (0, import_react25.useState)(false);
27213
- const [selectedIsSocial, setSelectedIsSocial] = (0, import_react25.useState)(false);
27214
- const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0, import_react25.useState)(false);
27215
- const [reorderHrefKey, setReorderHrefKey] = (0, import_react25.useState)(null);
27216
- const [reorderDragDisabled, setReorderDragDisabled] = (0, import_react25.useState)(false);
27217
- const [toggleState, setToggleState] = (0, import_react25.useState)(null);
27218
- const [maxBadge, setMaxBadge] = (0, import_react25.useState)(null);
27219
- const [activeCommands, setActiveCommands] = (0, import_react25.useState)(/* @__PURE__ */ new Set());
27220
- const [sectionGap, setSectionGap] = (0, import_react25.useState)(null);
27221
- const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react25.useState)(false);
27222
- const [toolbarShowAiBlockDelete, setToolbarShowAiBlockDelete] = (0, import_react25.useState)(false);
27223
- const deletingAiBlockRef = (0, import_react25.useRef)(false);
27224
- const hoveredNavContainerRef = (0, import_react25.useRef)(null);
27225
- const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react25.useState)(null);
27226
- const hoveredItemElRef = (0, import_react25.useRef)(null);
27227
- const [hoveredItemRect, setHoveredItemRect] = (0, import_react25.useState)(null);
27228
- const [hoveredTextRect, setHoveredTextRect] = (0, import_react25.useState)(null);
27229
- (0, import_react25.useEffect)(() => {
28309
+ const [selectedIsCta, setSelectedIsCta] = (0, import_react26.useState)(false);
28310
+ const [selectedIsSocial, setSelectedIsSocial] = (0, import_react26.useState)(false);
28311
+ const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0, import_react26.useState)(false);
28312
+ const [reorderHrefKey, setReorderHrefKey] = (0, import_react26.useState)(null);
28313
+ const [reorderDragDisabled, setReorderDragDisabled] = (0, import_react26.useState)(false);
28314
+ const [toggleState, setToggleState] = (0, import_react26.useState)(null);
28315
+ const [maxBadge, setMaxBadge] = (0, import_react26.useState)(null);
28316
+ const [activeCommands, setActiveCommands] = (0, import_react26.useState)(/* @__PURE__ */ new Set());
28317
+ const [sectionGap, setSectionGap] = (0, import_react26.useState)(null);
28318
+ const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react26.useState)(false);
28319
+ const [toolbarShowAiBlockDelete, setToolbarShowAiBlockDelete] = (0, import_react26.useState)(false);
28320
+ const deletingAiBlockRef = (0, import_react26.useRef)(false);
28321
+ const hoveredNavContainerRef = (0, import_react26.useRef)(null);
28322
+ const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react26.useState)(null);
28323
+ const hoveredItemElRef = (0, import_react26.useRef)(null);
28324
+ const [hoveredItemRect, setHoveredItemRect] = (0, import_react26.useState)(null);
28325
+ const [hoveredTextRect, setHoveredTextRect] = (0, import_react26.useState)(null);
28326
+ (0, import_react26.useEffect)(() => {
27230
28327
  const sync = () => {
27231
28328
  const el = document.querySelector(
27232
28329
  '[data-ohw-hovered]:not([contenteditable]):not([data-ohw-href-key]):not([data-ohw-editable="form"] *)'
@@ -27270,64 +28367,64 @@ function OhhwellsBridge() {
27270
28367
  });
27271
28368
  return () => observer.disconnect();
27272
28369
  }, []);
27273
- const siblingHintElRef = (0, import_react25.useRef)(null);
27274
- const [siblingHintRect, setSiblingHintRect] = (0, import_react25.useState)(null);
27275
- const [siblingHintRects, setSiblingHintRects] = (0, import_react25.useState)([]);
27276
- const [isItemDragging, setIsItemDragging] = (0, import_react25.useState)(false);
27277
- const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react25.useState)(false);
28370
+ const siblingHintElRef = (0, import_react26.useRef)(null);
28371
+ const [siblingHintRect, setSiblingHintRect] = (0, import_react26.useState)(null);
28372
+ const [siblingHintRects, setSiblingHintRects] = (0, import_react26.useState)([]);
28373
+ const [isItemDragging, setIsItemDragging] = (0, import_react26.useState)(false);
28374
+ const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react26.useState)(false);
27278
28375
  isFooterFrameSelectionRef.current = isFooterFrameSelection;
27279
- const [floatingPanel, setFloatingPanel] = (0, import_react25.useState)(null);
27280
- const floatingPanelOpenRef = (0, import_react25.useRef)(false);
28376
+ const [floatingPanel, setFloatingPanel] = (0, import_react26.useState)(null);
28377
+ const floatingPanelOpenRef = (0, import_react26.useRef)(false);
27281
28378
  floatingPanelOpenRef.current = floatingPanel !== null;
27282
- const floatingPanelRef = (0, import_react25.useRef)(null);
28379
+ const floatingPanelRef = (0, import_react26.useRef)(null);
27283
28380
  floatingPanelRef.current = floatingPanel;
27284
- const [floatingPanelPos, setFloatingPanelPos] = (0, import_react25.useState)(null);
27285
- const buttonCollectionDragRef = (0, import_react25.useRef)(null);
27286
- const buttonDropInsertIndexRef = (0, import_react25.useRef)(null);
27287
- const [buttonDropSlots, setButtonDropSlots] = (0, import_react25.useState)([]);
27288
- const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react25.useState)(null);
27289
- const buttonPointerDragRef = (0, import_react25.useRef)(null);
27290
- const [buttonStyleTick, setButtonStyleTick] = (0, import_react25.useState)(0);
27291
- const [logoSizeDraft, setLogoSizeDraft] = (0, import_react25.useState)(null);
27292
- const [editorViewport, setEditorViewport] = (0, import_react25.useState)("desktop");
27293
- const [parentScrollSnap, setParentScrollSnap] = (0, import_react25.useState)(null);
27294
- const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react25.useState)(null);
27295
- const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react25.useState)(null);
27296
- const footerDragRef = (0, import_react25.useRef)(null);
27297
- const [footerDropSlots, setFooterDropSlots] = (0, import_react25.useState)([]);
27298
- const [activeFooterDropIndex, setActiveFooterDropIndex] = (0, import_react25.useState)(null);
27299
- const [draggedItemRect, setDraggedItemRect] = (0, import_react25.useState)(null);
27300
- const footerPointerDragRef = (0, import_react25.useRef)(null);
27301
- const suppressNextClickRef = (0, import_react25.useRef)(false);
27302
- const suppressClickUntilRef = (0, import_react25.useRef)(0);
27303
- const [linkPopover, setLinkPopover] = (0, import_react25.useState)(null);
27304
- const linkPopoverSessionRef = (0, import_react25.useRef)(null);
27305
- const addNavAfterAnchorRef = (0, import_react25.useRef)(null);
27306
- const editContentRef = (0, import_react25.useRef)({});
28381
+ const [floatingPanelPos, setFloatingPanelPos] = (0, import_react26.useState)(null);
28382
+ const buttonCollectionDragRef = (0, import_react26.useRef)(null);
28383
+ const buttonDropInsertIndexRef = (0, import_react26.useRef)(null);
28384
+ const [buttonDropSlots, setButtonDropSlots] = (0, import_react26.useState)([]);
28385
+ const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react26.useState)(null);
28386
+ const buttonPointerDragRef = (0, import_react26.useRef)(null);
28387
+ const [buttonStyleTick, setButtonStyleTick] = (0, import_react26.useState)(0);
28388
+ const [logoSizeDraft, setLogoSizeDraft] = (0, import_react26.useState)(null);
28389
+ const [editorViewport, setEditorViewport] = (0, import_react26.useState)("desktop");
28390
+ const [parentScrollSnap, setParentScrollSnap] = (0, import_react26.useState)(null);
28391
+ const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react26.useState)(null);
28392
+ const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react26.useState)(null);
28393
+ const footerDragRef = (0, import_react26.useRef)(null);
28394
+ const [footerDropSlots, setFooterDropSlots] = (0, import_react26.useState)([]);
28395
+ const [activeFooterDropIndex, setActiveFooterDropIndex] = (0, import_react26.useState)(null);
28396
+ const [draggedItemRect, setDraggedItemRect] = (0, import_react26.useState)(null);
28397
+ const footerPointerDragRef = (0, import_react26.useRef)(null);
28398
+ const suppressNextClickRef = (0, import_react26.useRef)(false);
28399
+ const suppressClickUntilRef = (0, import_react26.useRef)(0);
28400
+ const [linkPopover, setLinkPopover] = (0, import_react26.useState)(null);
28401
+ const linkPopoverSessionRef = (0, import_react26.useRef)(null);
28402
+ const addNavAfterAnchorRef = (0, import_react26.useRef)(null);
28403
+ const editContentRef = (0, import_react26.useRef)({});
27307
28404
  useBuildPageSync(isEditMode, editContentRef, postToParent2);
27308
- const aiSectionsRef = (0, import_react25.useRef)("");
27309
- const aiFooterRef = (0, import_react25.useRef)("");
27310
- const applyTreeLocalRef = (0, import_react25.useRef)(
28405
+ const aiSectionsRef = (0, import_react26.useRef)("");
28406
+ const aiFooterRef = (0, import_react26.useRef)("");
28407
+ const applyTreeLocalRef = (0, import_react26.useRef)(
27311
28408
  null
27312
28409
  );
27313
- const applyFooterTreeLocalRef = (0, import_react25.useRef)(null);
27314
- const clearInteractionChromeRef = (0, import_react25.useRef)(() => {
28410
+ const applyFooterTreeLocalRef = (0, import_react26.useRef)(null);
28411
+ const clearInteractionChromeRef = (0, import_react26.useRef)(() => {
27315
28412
  });
27316
- const brandKitRef = (0, import_react25.useRef)("");
27317
- const stylesRef = (0, import_react25.useRef)("");
27318
- const appliedDrawerRef = (0, import_react25.useRef)(null);
27319
- const pendingDeleteUndoRef = (0, import_react25.useRef)(null);
27320
- const [sitePages, setSitePages] = (0, import_react25.useState)([]);
27321
- const collectionItemsRef = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
27322
- const [sectionsByPath, setSectionsByPath] = (0, import_react25.useState)({});
27323
- const sectionsPrefetchGenRef = (0, import_react25.useRef)(0);
27324
- const setLinkPopoverRef = (0, import_react25.useRef)(setLinkPopover);
27325
- const linkPopoverPanelRef = (0, import_react25.useRef)(null);
27326
- const linkPopoverOpenRef = (0, import_react25.useRef)(false);
27327
- const linkPopoverGraceUntilRef = (0, import_react25.useRef)(0);
28413
+ const brandKitRef = (0, import_react26.useRef)("");
28414
+ const stylesRef = (0, import_react26.useRef)("");
28415
+ const appliedDrawerRef = (0, import_react26.useRef)(null);
28416
+ const pendingDeleteUndoRef = (0, import_react26.useRef)(null);
28417
+ const [sitePages, setSitePages] = (0, import_react26.useState)([]);
28418
+ const collectionItemsRef = (0, import_react26.useRef)(/* @__PURE__ */ new Map());
28419
+ const [sectionsByPath, setSectionsByPath] = (0, import_react26.useState)({});
28420
+ const sectionsPrefetchGenRef = (0, import_react26.useRef)(0);
28421
+ const setLinkPopoverRef = (0, import_react26.useRef)(setLinkPopover);
28422
+ const linkPopoverPanelRef = (0, import_react26.useRef)(null);
28423
+ const linkPopoverOpenRef = (0, import_react26.useRef)(false);
28424
+ const linkPopoverGraceUntilRef = (0, import_react26.useRef)(0);
27328
28425
  setLinkPopoverRef.current = setLinkPopover;
27329
28426
  linkPopoverSessionRef.current = linkPopover;
27330
- (0, import_react25.useEffect)(() => {
28427
+ (0, import_react26.useEffect)(() => {
27331
28428
  setSectionOrderPersistHandler((entries) => {
27332
28429
  const currentPath = window.location.pathname;
27333
28430
  const merged = mergePageSectionOrder(editContentRef.current[SECTION_ORDER_KEY], currentPath, entries);
@@ -27337,7 +28434,7 @@ function OhhwellsBridge() {
27337
28434
  });
27338
28435
  return () => setSectionOrderPersistHandler(null);
27339
28436
  }, []);
27340
- (0, import_react25.useEffect)(() => {
28437
+ (0, import_react26.useEffect)(() => {
27341
28438
  setAiFooterMountOptions({
27342
28439
  resolvePageHref: (pageOrAnchorId) => {
27343
28440
  const [pageId, anchor] = pageOrAnchorId.split("#");
@@ -27400,7 +28497,7 @@ function OhhwellsBridge() {
27400
28497
  const bumpLinkPopoverGrace = () => {
27401
28498
  linkPopoverGraceUntilRef.current = Date.now() + 350;
27402
28499
  };
27403
- const runSectionsPrefetch = (0, import_react25.useCallback)((pages) => {
28500
+ const runSectionsPrefetch = (0, import_react26.useCallback)((pages) => {
27404
28501
  if (!isEditMode || shouldUseDevFixtures() || pages.length === 0) return;
27405
28502
  const gen = ++sectionsPrefetchGenRef.current;
27406
28503
  const paths = pages.map((p) => p.path);
@@ -27419,9 +28516,9 @@ function OhhwellsBridge() {
27419
28516
  );
27420
28517
  });
27421
28518
  }, [isEditMode, pathname]);
27422
- const runSectionsPrefetchRef = (0, import_react25.useRef)(runSectionsPrefetch);
28519
+ const runSectionsPrefetchRef = (0, import_react26.useRef)(runSectionsPrefetch);
27423
28520
  runSectionsPrefetchRef.current = runSectionsPrefetch;
27424
- (0, import_react25.useEffect)(() => {
28521
+ (0, import_react26.useEffect)(() => {
27425
28522
  if (!linkPopover) {
27426
28523
  document.documentElement.removeAttribute("data-ohw-link-popover-open");
27427
28524
  return;
@@ -27449,7 +28546,7 @@ function OhhwellsBridge() {
27449
28546
  document.documentElement.removeAttribute("data-ohw-link-popover-open");
27450
28547
  };
27451
28548
  }, [linkPopover, postToParent2]);
27452
- (0, import_react25.useEffect)(() => {
28549
+ (0, import_react26.useEffect)(() => {
27453
28550
  if (!isEditMode) return;
27454
28551
  const useFixtures = shouldUseDevFixtures();
27455
28552
  if (useFixtures) {
@@ -27475,7 +28572,7 @@ function OhhwellsBridge() {
27475
28572
  if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
27476
28573
  return () => window.removeEventListener("message", onSitePages);
27477
28574
  }, [isEditMode, postToParent2]);
27478
- (0, import_react25.useEffect)(() => {
28575
+ (0, import_react26.useEffect)(() => {
27479
28576
  if (!isEditMode) return;
27480
28577
  const deps = {
27481
28578
  getEditContent: () => editContentRef.current,
@@ -27512,14 +28609,14 @@ function OhhwellsBridge() {
27512
28609
  window.addEventListener("message", onPageMessage);
27513
28610
  return () => window.removeEventListener("message", onPageMessage);
27514
28611
  }, [isEditMode, postToParent2]);
27515
- (0, import_react25.useEffect)(() => {
28612
+ (0, import_react26.useEffect)(() => {
27516
28613
  if (!isEditMode || shouldUseDevFixtures()) return;
27517
28614
  void loadAllSectionsManifest().then((manifest) => {
27518
28615
  if (Object.keys(manifest).length === 0) return;
27519
28616
  setSectionsByPath((prev) => ({ ...manifest, ...prev }));
27520
28617
  });
27521
28618
  }, [isEditMode]);
27522
- (0, import_react25.useEffect)(() => {
28619
+ (0, import_react26.useEffect)(() => {
27523
28620
  const update = () => {
27524
28621
  const el = activeElRef.current ?? selectedElRef.current;
27525
28622
  if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
@@ -27543,10 +28640,10 @@ function OhhwellsBridge() {
27543
28640
  vvp.removeEventListener("resize", update);
27544
28641
  };
27545
28642
  }, []);
27546
- const refreshStateRules = (0, import_react25.useCallback)(() => {
28643
+ const refreshStateRules = (0, import_react26.useCallback)(() => {
27547
28644
  editStylesRef.current?.forceHover && (editStylesRef.current.forceHover.textContent = collectStateRules());
27548
28645
  }, []);
27549
- const processConfigRequest = (0, import_react25.useCallback)((insertAfterVal) => {
28646
+ const processConfigRequest = (0, import_react26.useCallback)((insertAfterVal) => {
27550
28647
  const tracker = getSectionsTracker();
27551
28648
  let entries = [];
27552
28649
  try {
@@ -27569,7 +28666,7 @@ function OhhwellsBridge() {
27569
28666
  }
27570
28667
  window.postMessage({ type: "ow:schedule-config", insertAfter: insertAfterVal, scheduleId: null }, "*");
27571
28668
  }, [isEditMode]);
27572
- const deactivate = (0, import_react25.useCallback)(() => {
28669
+ const deactivate = (0, import_react26.useCallback)(() => {
27573
28670
  const el = activeElRef.current;
27574
28671
  if (!el) return;
27575
28672
  const isFormBlock = el.dataset.ohwEditable === "form";
@@ -27636,12 +28733,12 @@ function OhhwellsBridge() {
27636
28733
  setToolbarShowAiBlockDelete(false);
27637
28734
  postToParent2({ type: "ow:exit-edit" });
27638
28735
  }, [postToParent2]);
27639
- const clearSelectedAttr = (0, import_react25.useCallback)(() => {
28736
+ const clearSelectedAttr = (0, import_react26.useCallback)(() => {
27640
28737
  document.querySelectorAll("[data-ohw-selected]").forEach((el) => {
27641
28738
  el.removeAttribute("data-ohw-selected");
27642
28739
  });
27643
28740
  }, []);
27644
- const deselect = (0, import_react25.useCallback)(() => {
28741
+ const deselect = (0, import_react26.useCallback)(() => {
27645
28742
  const nestedGroup = selectedElRef.current?.closest("[data-ohw-nav-children]") != null ? selectedElRef.current.closest("[data-ohw-nav-group]") : null;
27646
28743
  clearSelectedAttr();
27647
28744
  selectedElRef.current = null;
@@ -27677,20 +28774,20 @@ function OhhwellsBridge() {
27677
28774
  setToolbarVariant("none");
27678
28775
  }
27679
28776
  }, [clearSelectedAttr]);
27680
- const markSelected = (0, import_react25.useCallback)((el) => {
28777
+ const markSelected = (0, import_react26.useCallback)((el) => {
27681
28778
  clearSelectedAttr();
27682
28779
  el.removeAttribute("data-ohw-hovered");
27683
28780
  el.setAttribute("data-ohw-selected", "");
27684
28781
  }, [clearSelectedAttr]);
27685
- const isSelectedForHover = (0, import_react25.useCallback)((el) => {
28782
+ const isSelectedForHover = (0, import_react26.useCallback)((el) => {
27686
28783
  if (!el) return false;
27687
28784
  return [selectedElRef.current, activeElRef.current].some(
27688
28785
  (busy) => busy && (el === busy || busy.contains(el) || el.contains(busy))
27689
28786
  );
27690
28787
  }, []);
27691
- const isSelectedForHoverRef = (0, import_react25.useRef)(isSelectedForHover);
28788
+ const isSelectedForHoverRef = (0, import_react26.useRef)(isSelectedForHover);
27692
28789
  isSelectedForHoverRef.current = isSelectedForHover;
27693
- const resolveHrefKeyElement = (0, import_react25.useCallback)((hrefKey) => {
28790
+ const resolveHrefKeyElement = (0, import_react26.useCallback)((hrefKey) => {
27694
28791
  if (isFooterHrefKey(hrefKey)) {
27695
28792
  return document.querySelector(
27696
28793
  `footer [data-ohw-href-key="${CSS.escape(hrefKey)}"]`
@@ -27705,7 +28802,7 @@ function OhhwellsBridge() {
27705
28802
  `[data-ohw-href-key="${CSS.escape(hrefKey)}"]`
27706
28803
  );
27707
28804
  }, []);
27708
- const resyncSelectedNavigationItem = (0, import_react25.useCallback)(() => {
28805
+ const resyncSelectedNavigationItem = (0, import_react26.useCallback)(() => {
27709
28806
  const hrefKey = selectedHrefKeyRef.current;
27710
28807
  if (hrefKey) {
27711
28808
  const link = resolveHrefKeyElement(hrefKey);
@@ -27743,7 +28840,7 @@ function OhhwellsBridge() {
27743
28840
  );
27744
28841
  }
27745
28842
  }, [resolveHrefKeyElement]);
27746
- const reselectNavigationItem = (0, import_react25.useCallback)((navAnchor) => {
28843
+ const reselectNavigationItem = (0, import_react26.useCallback)((navAnchor) => {
27747
28844
  selectedElRef.current = navAnchor;
27748
28845
  selectedHrefKeyRef.current = navAnchor.getAttribute("data-ohw-href-key");
27749
28846
  selectedFooterColAttrRef.current = null;
@@ -27774,7 +28871,7 @@ function OhhwellsBridge() {
27774
28871
  setToolbarShowEditLink(false);
27775
28872
  setActiveCommands(/* @__PURE__ */ new Set());
27776
28873
  }, [markSelected]);
27777
- const commitNavigationTextEdit = (0, import_react25.useCallback)((navAnchor) => {
28874
+ const commitNavigationTextEdit = (0, import_react26.useCallback)((navAnchor) => {
27778
28875
  const el = activeElRef.current;
27779
28876
  if (!el) return;
27780
28877
  const key = el.dataset.ohwKey;
@@ -27808,7 +28905,7 @@ function OhhwellsBridge() {
27808
28905
  postToParent2({ type: "ow:exit-edit" });
27809
28906
  reselectNavigationItem(navAnchor);
27810
28907
  }, [postToParent2, reselectNavigationItem]);
27811
- const handleAddTopLevelNavItem = (0, import_react25.useCallback)(() => {
28908
+ const handleAddTopLevelNavItem = (0, import_react26.useCallback)(() => {
27812
28909
  const items = listNavbarRootItems();
27813
28910
  addNavAfterAnchorRef.current = items[items.length - 1] ?? null;
27814
28911
  deselectRef.current();
@@ -27820,7 +28917,7 @@ function OhhwellsBridge() {
27820
28917
  intent: "add-nav"
27821
28918
  });
27822
28919
  }, []);
27823
- const maybeWarnNavLinkDropdownConflict = (0, import_react25.useCallback)(
28920
+ const maybeWarnNavLinkDropdownConflict = (0, import_react26.useCallback)(
27824
28921
  (anchor) => {
27825
28922
  if (!isNavbarHrefKey(anchor.getAttribute("data-ohw-href-key"))) return;
27826
28923
  if (!navDropdownsOpenOnClick()) return;
@@ -27833,7 +28930,7 @@ function OhhwellsBridge() {
27833
28930
  },
27834
28931
  [postToParent2]
27835
28932
  );
27836
- const handleNavDropdownOpenChange = (0, import_react25.useCallback)((open) => {
28933
+ const handleNavDropdownOpenChange = (0, import_react26.useCallback)((open) => {
27837
28934
  const selected = selectedElRef.current;
27838
28935
  if (!selected || !isNavigationItem2(selected)) return;
27839
28936
  if (isNestedNavChild(selected)) return;
@@ -27849,7 +28946,7 @@ function OhhwellsBridge() {
27849
28946
  }
27850
28947
  });
27851
28948
  }, []);
27852
- const handleFooterHeadingVisibleChange = (0, import_react25.useCallback)(
28949
+ const handleFooterHeadingVisibleChange = (0, import_react26.useCallback)(
27853
28950
  (visible) => {
27854
28951
  const selected = selectedElRef.current;
27855
28952
  if (!selected || !isFooterFrameSelectionRef.current) return;
@@ -27902,7 +28999,7 @@ function OhhwellsBridge() {
27902
28999
  },
27903
29000
  [postToParent2]
27904
29001
  );
27905
- const enterEditOnNewItem = (0, import_react25.useCallback)((anchor) => {
29002
+ const enterEditOnNewItem = (0, import_react26.useCallback)((anchor) => {
27906
29003
  const label = anchor.querySelector('[data-ohw-editable="text"]');
27907
29004
  if (!label) {
27908
29005
  selectRef.current(anchor);
@@ -27911,8 +29008,8 @@ function OhhwellsBridge() {
27911
29008
  setNavGroupForceOpen(anchor, true);
27912
29009
  activateRef.current(label);
27913
29010
  }, []);
27914
- const pendingSocialAddRef = (0, import_react25.useRef)(null);
27915
- const handleAddChildItem = (0, import_react25.useCallback)(() => {
29011
+ const pendingSocialAddRef = (0, import_react26.useRef)(null);
29012
+ const handleAddChildItem = (0, import_react26.useCallback)(() => {
27916
29013
  const selected = selectedElRef.current;
27917
29014
  if (!selected) return;
27918
29015
  const socialsRow = isSocialsRow(selected) ? selected : findSocialsRow(selected);
@@ -28039,7 +29136,7 @@ function OhhwellsBridge() {
28039
29136
  });
28040
29137
  });
28041
29138
  }, [enterEditOnNewItem, isFooterFrameSelection, maybeWarnNavLinkDropdownConflict, postToParent2]);
28042
- const handleAddFooterColumn = (0, import_react25.useCallback)(() => {
29139
+ const handleAddFooterColumn = (0, import_react26.useCallback)(() => {
28043
29140
  if (document.querySelector("[data-ai-footer]")) {
28044
29141
  const state = parseAiFooterState(aiFooterRef.current);
28045
29142
  if (!state?.tree) return;
@@ -28095,7 +29192,7 @@ function OhhwellsBridge() {
28095
29192
  selectRef.current(result.firstLink);
28096
29193
  });
28097
29194
  }, [postToParent2]);
28098
- const clearFooterDragVisuals = (0, import_react25.useCallback)(() => {
29195
+ const clearFooterDragVisuals = (0, import_react26.useCallback)(() => {
28099
29196
  footerDragRef.current = null;
28100
29197
  setSiblingHintRects([]);
28101
29198
  setFooterDropSlots([]);
@@ -28104,7 +29201,7 @@ function OhhwellsBridge() {
28104
29201
  setIsItemDragging(false);
28105
29202
  unlockFooterDragInteraction();
28106
29203
  }, []);
28107
- const refreshFooterDragVisuals = (0, import_react25.useCallback)((session, activeSlot, clientX, clientY) => {
29204
+ const refreshFooterDragVisuals = (0, import_react26.useCallback)((session, activeSlot, clientX, clientY) => {
28108
29205
  const dragged = session.draggedEl;
28109
29206
  setDraggedItemRect(dragged.getBoundingClientRect());
28110
29207
  if (typeof clientX === "number" && typeof clientY === "number") {
@@ -28136,13 +29233,13 @@ function OhhwellsBridge() {
28136
29233
  const activeIdx = activeSlot ? slots.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
28137
29234
  setActiveFooterDropIndex(activeIdx >= 0 ? activeIdx : null);
28138
29235
  }, []);
28139
- const refreshFooterDragVisualsRef = (0, import_react25.useRef)(refreshFooterDragVisuals);
29236
+ const refreshFooterDragVisualsRef = (0, import_react26.useRef)(refreshFooterDragVisuals);
28140
29237
  refreshFooterDragVisualsRef.current = refreshFooterDragVisuals;
28141
- const commitFooterDragRef = (0, import_react25.useRef)(() => {
29238
+ const commitFooterDragRef = (0, import_react26.useRef)(() => {
28142
29239
  });
28143
- const beginFooterDragRef = (0, import_react25.useRef)(() => {
29240
+ const beginFooterDragRef = (0, import_react26.useRef)(() => {
28144
29241
  });
28145
- const beginFooterDrag = (0, import_react25.useCallback)(
29242
+ const beginFooterDrag = (0, import_react26.useCallback)(
28146
29243
  (session) => {
28147
29244
  const rect = session.draggedEl.getBoundingClientRect();
28148
29245
  session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
@@ -28162,7 +29259,7 @@ function OhhwellsBridge() {
28162
29259
  [refreshFooterDragVisuals]
28163
29260
  );
28164
29261
  beginFooterDragRef.current = beginFooterDrag;
28165
- const commitFooterDrag = (0, import_react25.useCallback)(
29262
+ const commitFooterDrag = (0, import_react26.useCallback)(
28166
29263
  (clientX, clientY) => {
28167
29264
  const session = footerDragRef.current;
28168
29265
  if (!session) {
@@ -28334,7 +29431,7 @@ function OhhwellsBridge() {
28334
29431
  [clearFooterDragVisuals, resolveHrefKeyElement, resyncSelectedNavigationItem]
28335
29432
  );
28336
29433
  commitFooterDragRef.current = commitFooterDrag;
28337
- const startFooterLinkDrag = (0, import_react25.useCallback)(
29434
+ const startFooterLinkDrag = (0, import_react26.useCallback)(
28338
29435
  (anchor, clientX, clientY, wasSelected) => {
28339
29436
  const hrefKey = anchor.getAttribute("data-ohw-href-key");
28340
29437
  if (!hrefKey) return false;
@@ -28370,7 +29467,7 @@ function OhhwellsBridge() {
28370
29467
  },
28371
29468
  [beginFooterDrag]
28372
29469
  );
28373
- const startFooterColumnDrag = (0, import_react25.useCallback)(
29470
+ const startFooterColumnDrag = (0, import_react26.useCallback)(
28374
29471
  (columnEl, clientX, clientY, wasSelected) => {
28375
29472
  const columns = listFooterColumns(columnEl);
28376
29473
  const idx = columns.indexOf(columnEl);
@@ -28390,7 +29487,7 @@ function OhhwellsBridge() {
28390
29487
  },
28391
29488
  [beginFooterDrag]
28392
29489
  );
28393
- const persistButtonCollectionDrag = (0, import_react25.useCallback)(
29490
+ const persistButtonCollectionDrag = (0, import_react26.useCallback)(
28394
29491
  (button, clientX) => {
28395
29492
  const insertIndex = buttonDropInsertIndexRef.current;
28396
29493
  if (insertIndex != null) insertButtonAtCollectionIndex(button, insertIndex);
@@ -28414,7 +29511,7 @@ function OhhwellsBridge() {
28414
29511
  },
28415
29512
  [postToParent2]
28416
29513
  );
28417
- const refreshButtonDragVisuals = (0, import_react25.useCallback)((button, clientX, clientY) => {
29514
+ const refreshButtonDragVisuals = (0, import_react26.useCallback)((button, clientX, clientY) => {
28418
29515
  const collection = buttonCollectionOf(button);
28419
29516
  if (!collection) {
28420
29517
  setButtonDropSlots([]);
@@ -28431,7 +29528,7 @@ function OhhwellsBridge() {
28431
29528
  setDraggedItemRect(button.getBoundingClientRect());
28432
29529
  if (selectedElRef.current === button) setToolbarRect(button.getBoundingClientRect());
28433
29530
  }, []);
28434
- const handleItemDragStart = (0, import_react25.useCallback)(
29531
+ const handleItemDragStart = (0, import_react26.useCallback)(
28435
29532
  (e) => {
28436
29533
  const selected = selectedElRef.current;
28437
29534
  if (!selected) {
@@ -28462,7 +29559,7 @@ function OhhwellsBridge() {
28462
29559
  },
28463
29560
  [startFooterColumnDrag, startFooterLinkDrag, startNavLinkDrag, refreshButtonDragVisuals]
28464
29561
  );
28465
- const handleItemDragEnd = (0, import_react25.useCallback)(
29562
+ const handleItemDragEnd = (0, import_react26.useCallback)(
28466
29563
  (e) => {
28467
29564
  const collectionButton = buttonCollectionDragRef.current;
28468
29565
  if (collectionButton) {
@@ -28493,7 +29590,7 @@ function OhhwellsBridge() {
28493
29590
  },
28494
29591
  [commitFooterDrag, commitNavDrag, navDragRef, persistButtonCollectionDrag]
28495
29592
  );
28496
- const handleItemChromePointerDown = (0, import_react25.useCallback)((e) => {
29593
+ const handleItemChromePointerDown = (0, import_react26.useCallback)((e) => {
28497
29594
  if (e.button !== 0) return;
28498
29595
  const selected = selectedElRef.current;
28499
29596
  if (!selected) return;
@@ -28534,7 +29631,7 @@ function OhhwellsBridge() {
28534
29631
  }
28535
29632
  if (armNavPressFromChrome(selected, e.clientX, e.clientY, e.pointerId)) return;
28536
29633
  }, [armNavPressFromChrome]);
28537
- const handleItemChromeClick = (0, import_react25.useCallback)((clientX, clientY) => {
29634
+ const handleItemChromeClick = (0, import_react26.useCallback)((clientX, clientY) => {
28538
29635
  if (suppressNextClickRef.current || Date.now() < suppressClickUntilRef.current) {
28539
29636
  suppressNextClickRef.current = false;
28540
29637
  return;
@@ -28547,7 +29644,7 @@ function OhhwellsBridge() {
28547
29644
  }, []);
28548
29645
  reselectNavigationItemRef.current = reselectNavigationItem;
28549
29646
  commitNavigationTextEditRef.current = commitNavigationTextEdit;
28550
- const select = (0, import_react25.useCallback)((anchor) => {
29647
+ const select = (0, import_react26.useCallback)((anchor) => {
28551
29648
  if (!isNavigationItem2(anchor)) return;
28552
29649
  if (activeElRef.current) deactivate();
28553
29650
  clearSocialSelectionRef.current();
@@ -28624,7 +29721,7 @@ function OhhwellsBridge() {
28624
29721
  setLogoSizeDraft(null);
28625
29722
  }
28626
29723
  }, [deactivate, markSelected]);
28627
- const selectFrame = (0, import_react25.useCallback)((el) => {
29724
+ const selectFrame = (0, import_react26.useCallback)((el) => {
28628
29725
  if (!isNavigationContainer(el)) return;
28629
29726
  if (activeElRef.current) deactivate();
28630
29727
  aiSectionApiRef.current?.selectFromElement(el);
@@ -28665,7 +29762,7 @@ function OhhwellsBridge() {
28665
29762
  setFloatingPanelPos(null);
28666
29763
  setLogoSizeDraft(null);
28667
29764
  }, [deactivate, markSelected, postToParent2]);
28668
- const selectLogo = (0, import_react25.useCallback)(
29765
+ const selectLogo = (0, import_react26.useCallback)(
28669
29766
  (logoEl) => {
28670
29767
  if (activeElRef.current) deactivate();
28671
29768
  selectedElRef.current = logoEl;
@@ -28694,7 +29791,7 @@ function OhhwellsBridge() {
28694
29791
  },
28695
29792
  [deactivate, markSelected]
28696
29793
  );
28697
- const openLogoSizePanel = (0, import_react25.useCallback)((logoEl) => {
29794
+ const openLogoSizePanel = (0, import_react26.useCallback)((logoEl) => {
28698
29795
  const placement = getLogoPlacement(logoEl);
28699
29796
  const draft = readLogoSizeState(editContentRef.current, placement);
28700
29797
  setLogoSizeDraft(draft);
@@ -28707,7 +29804,7 @@ function OhhwellsBridge() {
28707
29804
  placement
28708
29805
  });
28709
29806
  }, []);
28710
- const openSocialsDisplayPanel = (0, import_react25.useCallback)((row) => {
29807
+ const openSocialsDisplayPanel = (0, import_react26.useCallback)((row) => {
28711
29808
  setFloatingPanelPos(null);
28712
29809
  setParentScrollSnap(parentScrollRef.current);
28713
29810
  setFloatingPanel({
@@ -28718,7 +29815,7 @@ function OhhwellsBridge() {
28718
29815
  row
28719
29816
  });
28720
29817
  }, []);
28721
- const rememberButtonTokens = (0, import_react25.useCallback)(
29818
+ const rememberButtonTokens = (0, import_react26.useCallback)(
28722
29819
  (content, tokens, nodes) => {
28723
29820
  if (nodes.length === 0) return content;
28724
29821
  const next = { ...content };
@@ -28729,7 +29826,7 @@ function OhhwellsBridge() {
28729
29826
  },
28730
29827
  [postToParent2]
28731
29828
  );
28732
- const tokensForButton = (0, import_react25.useCallback)(
29829
+ const tokensForButton = (0, import_react26.useCallback)(
28733
29830
  (el, persistFallback = false) => {
28734
29831
  const stored = readStoredStyleTokens(editContentRef.current);
28735
29832
  if (stored) return stored;
@@ -28744,7 +29841,7 @@ function OhhwellsBridge() {
28744
29841
  },
28745
29842
  [rememberButtonTokens]
28746
29843
  );
28747
- const openButtonStylePanel = (0, import_react25.useCallback)(
29844
+ const openButtonStylePanel = (0, import_react26.useCallback)(
28748
29845
  (anchor) => {
28749
29846
  const id = buttonId(anchor);
28750
29847
  if (!id) return;
@@ -28762,7 +29859,7 @@ function OhhwellsBridge() {
28762
29859
  },
28763
29860
  [tokensForButton]
28764
29861
  );
28765
- const applySelectedButtonStyle = (0, import_react25.useCallback)(
29862
+ const applySelectedButtonStyle = (0, import_react26.useCallback)(
28766
29863
  (patch) => {
28767
29864
  const panel = floatingPanelRef.current;
28768
29865
  const id = panel?.kind === "button-style" ? panel.buttonId : null;
@@ -28780,7 +29877,7 @@ function OhhwellsBridge() {
28780
29877
  },
28781
29878
  [postToParent2]
28782
29879
  );
28783
- (0, import_react25.useEffect)(() => {
29880
+ (0, import_react26.useEffect)(() => {
28784
29881
  const onDragOver = (e) => {
28785
29882
  const dragged = buttonCollectionDragRef.current;
28786
29883
  if (!dragged) return;
@@ -28799,11 +29896,11 @@ function OhhwellsBridge() {
28799
29896
  document.removeEventListener("drop", onDrop);
28800
29897
  };
28801
29898
  }, [refreshButtonDragVisuals]);
28802
- const isEditModeRef = (0, import_react25.useRef)(false);
28803
- const requestMissingSocialIconsRef = (0, import_react25.useRef)(() => {
29899
+ const isEditModeRef = (0, import_react26.useRef)(false);
29900
+ const requestMissingSocialIconsRef = (0, import_react26.useRef)(() => {
28804
29901
  });
28805
- const askedSocialIconsRef = (0, import_react25.useRef)(/* @__PURE__ */ new Set());
28806
- const requestMissingSocialIcons = (0, import_react25.useCallback)(() => {
29902
+ const askedSocialIconsRef = (0, import_react26.useRef)(/* @__PURE__ */ new Set());
29903
+ const requestMissingSocialIcons = (0, import_react26.useCallback)(() => {
28807
29904
  const items = Array.from(document.querySelectorAll(`[${SOCIALS_ROW_ATTR}]`)).filter((row) => socialsDisplayFor(row, editContentRef.current).icon).flatMap((row) => {
28808
29905
  const missing = socialsMissingIcons(row);
28809
29906
  listSocialItems(row).forEach((item) => ensureIconSlot(item));
@@ -28815,7 +29912,7 @@ function OhhwellsBridge() {
28815
29912
  }, []);
28816
29913
  requestMissingSocialIconsRef.current = requestMissingSocialIcons;
28817
29914
  isEditModeRef.current = isEditMode;
28818
- const changeSocialsDisplay = (0, import_react25.useCallback)(
29915
+ const changeSocialsDisplay = (0, import_react26.useCallback)(
28819
29916
  (row, next) => {
28820
29917
  if (next.icon) {
28821
29918
  const missing = socialsMissingIcons(row);
@@ -28839,19 +29936,19 @@ function OhhwellsBridge() {
28839
29936
  },
28840
29937
  []
28841
29938
  );
28842
- const closeFloatingPanelOnly = (0, import_react25.useCallback)(() => {
29939
+ const closeFloatingPanelOnly = (0, import_react26.useCallback)(() => {
28843
29940
  setFloatingPanel(null);
28844
29941
  setFloatingPanelPos(null);
28845
29942
  setLogoSizeDraft(null);
28846
29943
  }, []);
28847
29944
  closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
28848
- const closeFloatingPanelAndDeselect = (0, import_react25.useCallback)(() => {
29945
+ const closeFloatingPanelAndDeselect = (0, import_react26.useCallback)(() => {
28849
29946
  setFloatingPanel(null);
28850
29947
  setFloatingPanelPos(null);
28851
29948
  setLogoSizeDraft(null);
28852
29949
  deselectRef.current();
28853
29950
  }, []);
28854
- (0, import_react25.useEffect)(() => {
29951
+ (0, import_react26.useEffect)(() => {
28855
29952
  const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
28856
29953
  if (!session || !logoSizeDraft) {
28857
29954
  postToParentRef.current({ type: "ow:logo-size-panel", open: false });
@@ -28870,7 +29967,7 @@ function OhhwellsBridge() {
28870
29967
  max: LOGO_SIZE_MAX
28871
29968
  });
28872
29969
  }, [floatingPanel, logoSizeDraft, editorViewport]);
28873
- const persistLogoSizeDraft = (0, import_react25.useCallback)(
29970
+ const persistLogoSizeDraft = (0, import_react26.useCallback)(
28874
29971
  (placement, draft) => {
28875
29972
  const desktopKey = LOGO_SIZE_DESKTOP_KEYS[placement];
28876
29973
  const mobileKey = LOGO_SIZE_MOBILE_KEYS[placement];
@@ -28910,7 +30007,7 @@ function OhhwellsBridge() {
28910
30007
  },
28911
30008
  [postToParent2]
28912
30009
  );
28913
- const activate = (0, import_react25.useCallback)((el, options) => {
30010
+ const activate = (0, import_react26.useCallback)((el, options) => {
28914
30011
  if (activeElRef.current === el) return;
28915
30012
  document.querySelectorAll("[data-ohw-hovered]").forEach((hovered) => {
28916
30013
  hovered.removeAttribute("data-ohw-hovered");
@@ -29015,8 +30112,8 @@ function OhhwellsBridge() {
29015
30112
  openLogoSizePanelRef.current = openLogoSizePanel;
29016
30113
  deselectRef.current = deselect;
29017
30114
  closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
29018
- const lastSiteWideScopeRef = (0, import_react25.useRef)(null);
29019
- (0, import_react25.useEffect)(() => {
30115
+ const lastSiteWideScopeRef = (0, import_react26.useRef)(null);
30116
+ (0, import_react26.useEffect)(() => {
29020
30117
  if (!isEditMode) {
29021
30118
  if (lastSiteWideScopeRef.current !== false) {
29022
30119
  lastSiteWideScopeRef.current = false;
@@ -29042,7 +30139,7 @@ function OhhwellsBridge() {
29042
30139
  isFooterFrameSelection,
29043
30140
  postToParent2
29044
30141
  ]);
29045
- (0, import_react25.useLayoutEffect)(() => {
30142
+ (0, import_react26.useLayoutEffect)(() => {
29046
30143
  if (!subdomain || isEditMode) {
29047
30144
  setFetchState("done");
29048
30145
  return;
@@ -29197,7 +30294,7 @@ function OhhwellsBridge() {
29197
30294
  cancelled = true;
29198
30295
  };
29199
30296
  }, [subdomain, isEditMode]);
29200
- (0, import_react25.useEffect)(() => {
30297
+ (0, import_react26.useEffect)(() => {
29201
30298
  if (!isEditMode) return;
29202
30299
  const resolveIndex = (form, clientY) => {
29203
30300
  const wrappers = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== fieldDragRef.current?.key);
@@ -29238,7 +30335,7 @@ function OhhwellsBridge() {
29238
30335
  window.removeEventListener("drop", onDrop, true);
29239
30336
  };
29240
30337
  }, [buildFieldDropSlots, isEditMode, persistFields, selectField]);
29241
- (0, import_react25.useEffect)(() => {
30338
+ (0, import_react26.useEffect)(() => {
29242
30339
  if (!isEditMode) return;
29243
30340
  const mark = () => document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
29244
30341
  markFormFields(form);
@@ -29250,7 +30347,7 @@ function OhhwellsBridge() {
29250
30347
  });
29251
30348
  return () => observer.disconnect();
29252
30349
  }, [isEditMode, fetchState, pathname]);
29253
- (0, import_react25.useEffect)(() => {
30350
+ (0, import_react26.useEffect)(() => {
29254
30351
  if (!isEditMode) return;
29255
30352
  let saveTimer = null;
29256
30353
  const onInput = (e) => {
@@ -29272,14 +30369,14 @@ function OhhwellsBridge() {
29272
30369
  document.addEventListener("input", onInput, true);
29273
30370
  return () => document.removeEventListener("input", onInput, true);
29274
30371
  }, [isEditMode, persistFields]);
29275
- (0, import_react25.useEffect)(() => {
30372
+ (0, import_react26.useEffect)(() => {
29276
30373
  if (isEditMode || fetchState !== "done") return;
29277
30374
  const content = contentCache.get(subdomain) ?? {};
29278
30375
  document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
29279
30376
  reconcileFieldsFromContent(form, content);
29280
30377
  });
29281
30378
  }, [isEditMode, fetchState, subdomain]);
29282
- (0, import_react25.useEffect)(() => {
30379
+ (0, import_react26.useEffect)(() => {
29283
30380
  if (!isEditMode) return;
29284
30381
  const swallow = (e) => {
29285
30382
  const target = e.target;
@@ -29288,14 +30385,14 @@ function OhhwellsBridge() {
29288
30385
  document.addEventListener("submit", swallow, true);
29289
30386
  return () => document.removeEventListener("submit", swallow, true);
29290
30387
  }, [isEditMode]);
29291
- (0, import_react25.useEffect)(() => {
30388
+ (0, import_react26.useEffect)(() => {
29292
30389
  if (isEditMode || fetchState !== "done") return;
29293
30390
  console.log("env", process.env.NEXT_PUBLIC_FLOWOPS_API_URL);
29294
30391
  const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
29295
30392
  console.log({ apiUrl, subdomain });
29296
30393
  bindPublishedForms(apiUrl, subdomain, contentCache.get(subdomain) ?? {});
29297
30394
  }, [isEditMode, fetchState, subdomain]);
29298
- (0, import_react25.useEffect)(() => {
30395
+ (0, import_react26.useEffect)(() => {
29299
30396
  if (!subdomain || isEditMode) return;
29300
30397
  let debounceTimer = null;
29301
30398
  let observer = null;
@@ -29416,16 +30513,16 @@ function OhhwellsBridge() {
29416
30513
  if (debounceTimer) clearTimeout(debounceTimer);
29417
30514
  };
29418
30515
  }, [subdomain, isEditMode, pathname]);
29419
- (0, import_react25.useLayoutEffect)(() => {
30516
+ (0, import_react26.useLayoutEffect)(() => {
29420
30517
  const el = document.getElementById("ohw-loader");
29421
30518
  if (!el) return;
29422
30519
  const visible = Boolean(subdomain) && fetchState !== "done";
29423
30520
  el.style.display = visible ? "flex" : "none";
29424
30521
  }, [subdomain, fetchState]);
29425
- (0, import_react25.useEffect)(() => {
30522
+ (0, import_react26.useEffect)(() => {
29426
30523
  postToParent2({ type: "ow:navigation", path: pathname });
29427
30524
  }, [pathname, postToParent2]);
29428
- (0, import_react25.useEffect)(() => {
30525
+ (0, import_react26.useEffect)(() => {
29429
30526
  if (!subdomain || isEditMode) return;
29430
30527
  const content = contentCache.get(subdomain);
29431
30528
  if (!content) return;
@@ -29443,7 +30540,7 @@ function OhhwellsBridge() {
29443
30540
  }
29444
30541
  applyAiFooterFromContent(content);
29445
30542
  }, [pathname, subdomain, isEditMode]);
29446
- (0, import_react25.useEffect)(() => {
30543
+ (0, import_react26.useEffect)(() => {
29447
30544
  if (!isEditMode) return;
29448
30545
  if (linkPopoverSessionRef.current?.intent === "add-nav") return;
29449
30546
  if (document.querySelector("[data-ohw-section-picker]")) return;
@@ -29451,12 +30548,12 @@ function OhhwellsBridge() {
29451
30548
  deselectRef.current();
29452
30549
  deactivateRef.current();
29453
30550
  }, [pathname, isEditMode]);
29454
- (0, import_react25.useEffect)(() => {
30551
+ (0, import_react26.useEffect)(() => {
29455
30552
  if (!isEditMode) return;
29456
30553
  initSectionInstancesFromContent(editContentRef.current, pathname);
29457
30554
  initItemInstancesFromContent(editContentRef.current);
29458
30555
  }, [pathname, isEditMode]);
29459
- (0, import_react25.useEffect)(() => {
30556
+ (0, import_react26.useEffect)(() => {
29460
30557
  if (!isEditMode) return;
29461
30558
  const observer = new MutationObserver(() => {
29462
30559
  const drawer = document.querySelector("[data-ohw-nav-drawer]");
@@ -29467,7 +30564,7 @@ function OhhwellsBridge() {
29467
30564
  observer.observe(document.body, { childList: true, subtree: true });
29468
30565
  return () => observer.disconnect();
29469
30566
  }, [isEditMode, pathname]);
29470
- (0, import_react25.useEffect)(() => {
30567
+ (0, import_react26.useEffect)(() => {
29471
30568
  const contentForNav = () => {
29472
30569
  if (isEditMode) return editContentRef.current;
29473
30570
  if (!subdomain) return {};
@@ -29541,7 +30638,7 @@ function OhhwellsBridge() {
29541
30638
  observer?.disconnect();
29542
30639
  };
29543
30640
  }, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
29544
- (0, import_react25.useEffect)(() => {
30641
+ (0, import_react26.useEffect)(() => {
29545
30642
  if (!isEditMode) return;
29546
30643
  let applying = false;
29547
30644
  let rafId = null;
@@ -29579,7 +30676,7 @@ function OhhwellsBridge() {
29579
30676
  observer.disconnect();
29580
30677
  };
29581
30678
  }, [isEditMode, pathname]);
29582
- (0, import_react25.useEffect)(() => {
30679
+ (0, import_react26.useEffect)(() => {
29583
30680
  if (!isEditMode) return;
29584
30681
  let lastPosted = 0;
29585
30682
  const measure = () => {
@@ -29623,7 +30720,7 @@ function OhhwellsBridge() {
29623
30720
  window.removeEventListener("resize", handleResize);
29624
30721
  };
29625
30722
  }, [pathname, isEditMode, postToParent2]);
29626
- (0, import_react25.useEffect)(() => {
30723
+ (0, import_react26.useEffect)(() => {
29627
30724
  if (isEditMode) return;
29628
30725
  const handleClick = (e) => {
29629
30726
  if (!isPlainLeftClick(e)) return;
@@ -29637,7 +30734,7 @@ function OhhwellsBridge() {
29637
30734
  document.addEventListener("click", handleClick, true);
29638
30735
  return () => document.removeEventListener("click", handleClick, true);
29639
30736
  }, [isEditMode, router, pathname]);
29640
- (0, import_react25.useEffect)(() => {
30737
+ (0, import_react26.useEffect)(() => {
29641
30738
  if (!isEditMode) {
29642
30739
  editStylesRef.current?.base.remove();
29643
30740
  editStylesRef.current?.forceHover.remove();
@@ -30085,6 +31182,16 @@ function OhhwellsBridge() {
30085
31182
  const inner = target.closest("svg")?.querySelectorAll("[data-ohw-editable]");
30086
31183
  if (inner && inner.length === 1) editable = inner[0];
30087
31184
  }
31185
+ const hiddenTwin = !editable || isMediaEditable(editable) ? findHiddenTwinAt(NON_MEDIA_SELECTOR, e.clientX, e.clientY) : null;
31186
+ if (hiddenTwin) {
31187
+ editable = hiddenTwin;
31188
+ const card = stateCardFor(hiddenTwin, e.clientX, e.clientY);
31189
+ const hoverState = card && !card.hasAttribute("data-ohw-active-state") ? deriveStates(card.dataset.ohwEditableState ?? "")[1] : void 0;
31190
+ if (card && hoverState) {
31191
+ activeStateElRef.current = card;
31192
+ stateChangeRef.current(hoverState);
31193
+ }
31194
+ }
30088
31195
  if (editable && !(editable instanceof HTMLElement)) {
30089
31196
  e.preventDefault();
30090
31197
  e.stopPropagation();
@@ -30442,6 +31549,8 @@ function OhhwellsBridge() {
30442
31549
  if (!editable) return;
30443
31550
  const editableRect = editable.getBoundingClientRect();
30444
31551
  if (editableRect.width <= 0 || editableRect.height <= 0) return;
31552
+ const shownEditable = shownAs(editable);
31553
+ if (!shownEditable || shownEditable !== editable && !hitsShown(editable, e.clientX, e.clientY)) return;
30445
31554
  const selected = selectedElRef.current;
30446
31555
  if (selected && (selected === editable || selected.contains(editable))) return;
30447
31556
  if (!isMediaEditable(editable) && !editable.hasAttribute("contenteditable")) {
@@ -30456,7 +31565,7 @@ function OhhwellsBridge() {
30456
31565
  hoveredItemElRef.current = hoverTarget;
30457
31566
  setHoveredItemRect(hoverTarget.getBoundingClientRect());
30458
31567
  } else if (!isInsideNavigationItem(editable) && !isSelectedForHoverRef.current(hoverTarget)) {
30459
- hoverTarget.setAttribute("data-ohw-hovered", "");
31568
+ hoverFrame(hoverTarget).setAttribute("data-ohw-hovered", "");
30460
31569
  if (editable.closest("footer") || editable.closest('[data-ohw-section="footer"]')) {
30461
31570
  hoveredNavContainerRef.current = null;
30462
31571
  setHoveredNavContainerRect(null);
@@ -30918,8 +32027,7 @@ function OhhwellsBridge() {
30918
32027
  document.querySelectorAll(NON_MEDIA_SELECTOR)
30919
32028
  ).find((el) => {
30920
32029
  if (el.closest("[data-ohw-nav-children]") && !getNavigationItemAnchor(el)) return false;
30921
- const er = el.getBoundingClientRect();
30922
- return x2 >= er.left && x2 <= er.right && y2 >= er.top && y2 <= er.bottom;
32030
+ return hitsShown(el, x2, y2);
30923
32031
  });
30924
32032
  if (imageUnhoverTimerRef.current) {
30925
32033
  clearTimeout(imageUnhoverTimerRef.current);
@@ -30965,7 +32073,7 @@ function OhhwellsBridge() {
30965
32073
  }
30966
32074
  document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
30967
32075
  if (textEditable && !textEditable.closest("[data-ohw-href-key]") && !isSelectedForHoverRef.current(textEditable)) {
30968
- textEditable.setAttribute("data-ohw-hovered", "");
32076
+ hoverFrame(textEditable).setAttribute("data-ohw-hovered", "");
30969
32077
  }
30970
32078
  return;
30971
32079
  }
@@ -30977,7 +32085,7 @@ function OhhwellsBridge() {
30977
32085
  }
30978
32086
  document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
30979
32087
  if (textEditable && !textEditable.closest("[data-ohw-href-key]") && !isSelectedForHoverRef.current(textEditable)) {
30980
- textEditable.setAttribute("data-ohw-hovered", "");
32088
+ hoverFrame(textEditable).setAttribute("data-ohw-hovered", "");
30981
32089
  }
30982
32090
  return;
30983
32091
  }
@@ -31021,8 +32129,7 @@ function OhhwellsBridge() {
31021
32129
  ).find((el) => {
31022
32130
  if (!isNavigationItem2(el) || isCtaButton(el)) return false;
31023
32131
  if (!isNavItemPointerTarget(el)) return false;
31024
- const er = el.getBoundingClientRect();
31025
- return x2 >= er.left && x2 <= er.right && y2 >= er.top && y2 <= er.bottom;
32132
+ return hitsShown(el, x2, y2);
31026
32133
  });
31027
32134
  if (navLinkHit) {
31028
32135
  document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
@@ -31038,8 +32145,7 @@ function OhhwellsBridge() {
31038
32145
  document.querySelectorAll(NON_MEDIA_SELECTOR)
31039
32146
  ).find((el) => {
31040
32147
  if (el.closest("[data-ohw-nav-children]") && !getNavigationItemAnchor(el)) return false;
31041
- const er = el.getBoundingClientRect();
31042
- return x2 >= er.left && x2 <= er.right && y2 >= er.top && y2 <= er.bottom;
32148
+ return hitsShown(el, x2, y2);
31043
32149
  });
31044
32150
  document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
31045
32151
  if (textEl && !textEl.hasAttribute("contenteditable")) {
@@ -31054,7 +32160,7 @@ function OhhwellsBridge() {
31054
32160
  } else if (!textEl.closest("[data-ohw-href-key]") && !isSelectedForHoverRef.current(textEl)) {
31055
32161
  hoveredItemElRef.current = null;
31056
32162
  setHoveredItemRect(null);
31057
- textEl.setAttribute("data-ohw-hovered", "");
32163
+ hoverFrame(textEl).setAttribute("data-ohw-hovered", "");
31058
32164
  } else {
31059
32165
  hoveredItemElRef.current = null;
31060
32166
  setHoveredItemRect(null);
@@ -32935,8 +34041,7 @@ function OhhwellsBridge() {
32935
34041
  const textEditable = Array.from(
32936
34042
  document.querySelectorAll(NON_MEDIA_SELECTOR)
32937
34043
  ).find((el) => {
32938
- const r2 = el.getBoundingClientRect();
32939
- return clientX >= r2.left && clientX <= r2.right && clientY >= r2.top && clientY <= r2.bottom;
34044
+ return hitsShown(el, clientX, clientY);
32940
34045
  });
32941
34046
  if (textEditable) {
32942
34047
  const hrefCtx = getHrefKeyFromElement(textEditable);
@@ -33123,7 +34228,7 @@ function OhhwellsBridge() {
33123
34228
  if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
33124
34229
  };
33125
34230
  }, [isEditMode, refreshStateRules]);
33126
- (0, import_react25.useEffect)(() => {
34231
+ (0, import_react26.useEffect)(() => {
33127
34232
  if (!isEditMode) return;
33128
34233
  const THRESHOLD = 10;
33129
34234
  const resolveWasSelected = (el) => {
@@ -33279,7 +34384,7 @@ function OhhwellsBridge() {
33279
34384
  unlockFooterDragInteraction();
33280
34385
  };
33281
34386
  }, [isEditMode]);
33282
- (0, import_react25.useEffect)(() => {
34387
+ (0, import_react26.useEffect)(() => {
33283
34388
  if (!isEditMode) return;
33284
34389
  const THRESHOLD = 10;
33285
34390
  const onPointerDown = (e) => {
@@ -33370,7 +34475,7 @@ function OhhwellsBridge() {
33370
34475
  document.removeEventListener("selectstart", blockSelectStart, true);
33371
34476
  };
33372
34477
  }, [isEditMode, persistButtonCollectionDrag, refreshButtonDragVisuals]);
33373
- (0, import_react25.useEffect)(() => {
34478
+ (0, import_react26.useEffect)(() => {
33374
34479
  const handler = (e) => {
33375
34480
  if (e.data?.type !== "ow:request-schedule-config") return;
33376
34481
  const insertAfterVal = e.data.insertAfter;
@@ -33386,7 +34491,7 @@ function OhhwellsBridge() {
33386
34491
  window.addEventListener("message", handler);
33387
34492
  return () => window.removeEventListener("message", handler);
33388
34493
  }, [processConfigRequest]);
33389
- (0, import_react25.useEffect)(() => {
34494
+ (0, import_react26.useEffect)(() => {
33390
34495
  if (!isEditMode) return;
33391
34496
  document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
33392
34497
  el.removeAttribute("data-ohw-active-state");
@@ -33410,7 +34515,7 @@ function OhhwellsBridge() {
33410
34515
  postToParent2({
33411
34516
  type: "ow:ready",
33412
34517
  version: "1",
33413
- bridgeVersion: "0.1.173",
34518
+ bridgeVersion: "0.1.174",
33414
34519
  path: pathname,
33415
34520
  nodes: collectEditableNodes(editContentRef.current),
33416
34521
  sections
@@ -33422,13 +34527,13 @@ function OhhwellsBridge() {
33422
34527
  clearTimeout(timer);
33423
34528
  };
33424
34529
  }, [pathname, isEditMode, refreshStateRules, postToParent2]);
33425
- (0, import_react25.useEffect)(() => {
34530
+ (0, import_react26.useEffect)(() => {
33426
34531
  scrollToHashSectionWhenReady();
33427
34532
  const onHashChange = () => scrollToHashSectionWhenReady();
33428
34533
  window.addEventListener("hashchange", onHashChange);
33429
34534
  return () => window.removeEventListener("hashchange", onHashChange);
33430
34535
  }, [pathname]);
33431
- const handleCommand = (0, import_react25.useCallback)((cmd) => {
34536
+ const handleCommand = (0, import_react26.useCallback)((cmd) => {
33432
34537
  const el = activeElRef.current;
33433
34538
  const selBefore = window.getSelection();
33434
34539
  let savedOffsets = null;
@@ -33464,7 +34569,7 @@ function OhhwellsBridge() {
33464
34569
  if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
33465
34570
  refreshActiveCommandsRef.current();
33466
34571
  }, []);
33467
- (0, import_react25.useEffect)(() => {
34572
+ (0, import_react26.useEffect)(() => {
33468
34573
  const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
33469
34574
  if (!session || !logoSizeDraft) return;
33470
34575
  const onPanelAction = (e) => {
@@ -33502,7 +34607,7 @@ function OhhwellsBridge() {
33502
34607
  window.addEventListener("message", onPanelAction);
33503
34608
  return () => window.removeEventListener("message", onPanelAction);
33504
34609
  }, [floatingPanel, logoSizeDraft, editorViewport, persistLogoSizeDraft, closeFloatingPanelAndDeselect]);
33505
- const handleStateChange = (0, import_react25.useCallback)((state) => {
34610
+ const handleStateChange = (0, import_react26.useCallback)((state) => {
33506
34611
  if (!activeStateElRef.current) return;
33507
34612
  const el = activeStateElRef.current;
33508
34613
  if (state === "Default") {
@@ -33515,7 +34620,8 @@ function OhhwellsBridge() {
33515
34620
  }
33516
34621
  setToggleState((prev) => prev ? { ...prev, activeState: state } : null);
33517
34622
  }, [deactivate]);
33518
- const reselectAfterLinkPopover = (0, import_react25.useCallback)(
34623
+ stateChangeRef.current = handleStateChange;
34624
+ const reselectAfterLinkPopover = (0, import_react26.useCallback)(
33519
34625
  (hrefKey) => {
33520
34626
  requestAnimationFrame(() => {
33521
34627
  const el = resolveHrefKeyElement(hrefKey);
@@ -33524,7 +34630,7 @@ function OhhwellsBridge() {
33524
34630
  },
33525
34631
  [resolveHrefKeyElement]
33526
34632
  );
33527
- const closeLinkPopover = (0, import_react25.useCallback)(() => {
34633
+ const closeLinkPopover = (0, import_react26.useCallback)(() => {
33528
34634
  const session = linkPopoverSessionRef.current;
33529
34635
  addNavAfterAnchorRef.current = null;
33530
34636
  setLinkPopover(null);
@@ -33532,9 +34638,9 @@ function OhhwellsBridge() {
33532
34638
  reselectAfterLinkPopover(session.key);
33533
34639
  }
33534
34640
  }, [reselectAfterLinkPopover]);
33535
- const closeLinkPopoverRef = (0, import_react25.useRef)(closeLinkPopover);
34641
+ const closeLinkPopoverRef = (0, import_react26.useRef)(closeLinkPopover);
33536
34642
  closeLinkPopoverRef.current = closeLinkPopover;
33537
- const openLinkPopoverForActive = (0, import_react25.useCallback)(() => {
34643
+ const openLinkPopoverForActive = (0, import_react26.useCallback)(() => {
33538
34644
  const hrefCtx = getHrefKeyFromElement(activeElRef.current);
33539
34645
  if (!hrefCtx) return;
33540
34646
  bumpLinkPopoverGrace();
@@ -33545,7 +34651,7 @@ function OhhwellsBridge() {
33545
34651
  });
33546
34652
  deactivate();
33547
34653
  }, [deactivate]);
33548
- const openLinkPopoverForSelected = (0, import_react25.useCallback)(() => {
34654
+ const openLinkPopoverForSelected = (0, import_react26.useCallback)(() => {
33549
34655
  const anchor = selectedElRef.current;
33550
34656
  if (!anchor) return;
33551
34657
  const key = anchor.getAttribute("data-ohw-href-key");
@@ -33562,7 +34668,7 @@ function OhhwellsBridge() {
33562
34668
  });
33563
34669
  deselect();
33564
34670
  }, [deselect]);
33565
- const handleSelectParent = (0, import_react25.useCallback)(() => {
34671
+ const handleSelectParent = (0, import_react26.useCallback)(() => {
33566
34672
  const selected = selectedElRef.current;
33567
34673
  if (!selected) return;
33568
34674
  if (toolbarVariantRef.current === "select-frame") {
@@ -33589,7 +34695,7 @@ function OhhwellsBridge() {
33589
34695
  }
33590
34696
  deselectRef.current();
33591
34697
  }, []);
33592
- const handleDuplicateSelected = (0, import_react25.useCallback)(() => {
34698
+ const handleDuplicateSelected = (0, import_react26.useCallback)(() => {
33593
34699
  const selected = selectedElRef.current;
33594
34700
  if (!selected || !isNavigationItem2(selected)) return;
33595
34701
  if (isCtaButton(selected)) {
@@ -33759,7 +34865,7 @@ function OhhwellsBridge() {
33759
34865
  });
33760
34866
  }
33761
34867
  }, [postToParent2, tokensForButton]);
33762
- const runPendingDeleteUndo = (0, import_react25.useCallback)(() => {
34868
+ const runPendingDeleteUndo = (0, import_react26.useCallback)(() => {
33763
34869
  const pending = pendingDeleteUndoRef.current;
33764
34870
  if (!pending) return false;
33765
34871
  pendingDeleteUndoRef.current = null;
@@ -33767,7 +34873,7 @@ function OhhwellsBridge() {
33767
34873
  enforceLinkHrefs();
33768
34874
  return true;
33769
34875
  }, []);
33770
- const deleteAiBlock = (0, import_react25.useCallback)(
34876
+ const deleteAiBlock = (0, import_react26.useCallback)(
33771
34877
  (editKey, opts) => {
33772
34878
  if (!opts?.fromToolbar && activeElRef.current) return false;
33773
34879
  if (deletingAiBlockRef.current) return false;
@@ -33836,7 +34942,7 @@ function OhhwellsBridge() {
33836
34942
  },
33837
34943
  [postToParent2]
33838
34944
  );
33839
- const softHideTemplateEditable = (0, import_react25.useCallback)(
34945
+ const softHideTemplateEditable = (0, import_react26.useCallback)(
33840
34946
  (el, opts) => {
33841
34947
  if (!opts?.fromToolbar && activeElRef.current) return false;
33842
34948
  if (!canSoftHideEditable(el, {
@@ -33881,7 +34987,7 @@ function OhhwellsBridge() {
33881
34987
  },
33882
34988
  [postToParent2]
33883
34989
  );
33884
- const deleteFromToolbar = (0, import_react25.useCallback)(
34990
+ const deleteFromToolbar = (0, import_react26.useCallback)(
33885
34991
  (editKey, el) => {
33886
34992
  if (!editKey && !el) return false;
33887
34993
  if (editKey && canRemoveAiBlock(aiSectionsRef.current, editKey)) {
@@ -33893,7 +34999,7 @@ function OhhwellsBridge() {
33893
34999
  },
33894
35000
  [deleteAiBlock, softHideTemplateEditable]
33895
35001
  );
33896
- const resolveSelectedAiBlockKey = (0, import_react25.useCallback)(() => {
35002
+ const resolveSelectedAiBlockKey = (0, import_react26.useCallback)(() => {
33897
35003
  const candidates = [
33898
35004
  activeElRef.current?.dataset.ohwKey,
33899
35005
  selectedMediaElRef.current?.dataset.ohwKey,
@@ -33908,7 +35014,7 @@ function OhhwellsBridge() {
33908
35014
  }
33909
35015
  return null;
33910
35016
  }, [selectedMedia]);
33911
- const handleDeleteSelected = (0, import_react25.useCallback)(() => {
35017
+ const handleDeleteSelected = (0, import_react26.useCallback)(() => {
33912
35018
  if (!activeElRef.current) {
33913
35019
  const aiKey = resolveSelectedAiBlockKey();
33914
35020
  if (aiKey && deleteAiBlock(aiKey)) return true;
@@ -33976,7 +35082,7 @@ function OhhwellsBridge() {
33976
35082
  }, [postToParent2, deleteAiBlock, softHideTemplateEditable, resolveSelectedAiBlockKey]);
33977
35083
  handleDeleteSelectedRef.current = handleDeleteSelected;
33978
35084
  runPendingDeleteUndoRef.current = runPendingDeleteUndo;
33979
- const handleLinkPopoverSubmit = (0, import_react25.useCallback)(
35085
+ const handleLinkPopoverSubmit = (0, import_react26.useCallback)(
33980
35086
  (target) => {
33981
35087
  const session = linkPopoverSessionRef.current;
33982
35088
  if (!session) return;
@@ -34042,14 +35148,14 @@ function OhhwellsBridge() {
34042
35148
  const showEditLink = toolbarShowEditLink;
34043
35149
  const currentSections = sectionsByPath[pathname] ?? [];
34044
35150
  linkPopoverOpenRef.current = linkPopover !== null;
34045
- const handleMediaSelect = (0, import_react25.useCallback)((key) => {
35151
+ const handleMediaSelect = (0, import_react26.useCallback)((key) => {
34046
35152
  const el = hoveredImageRef.current?.dataset.ohwKey === key ? hoveredImageRef.current : Array.from(document.querySelectorAll(MEDIA_SELECTOR)).find(
34047
35153
  (m) => (m.dataset.ohwKey ?? "") === key
34048
35154
  ) ?? null;
34049
35155
  if (!el) return;
34050
35156
  selectMediaElementRef.current(el);
34051
35157
  }, []);
34052
- const handleMediaReplace = (0, import_react25.useCallback)(
35158
+ const handleMediaReplace = (0, import_react26.useCallback)(
34053
35159
  (key) => {
34054
35160
  postToParent2({
34055
35161
  type: "ow:image-pick",
@@ -34059,13 +35165,13 @@ function OhhwellsBridge() {
34059
35165
  },
34060
35166
  [postToParent2, mediaHover?.elementType, selectedMedia?.elementType]
34061
35167
  );
34062
- const handleEditCarousel = (0, import_react25.useCallback)(
35168
+ const handleEditCarousel = (0, import_react26.useCallback)(
34063
35169
  (key) => {
34064
35170
  postToParent2({ type: "ow:carousel-open", key, images: readCarouselValue(key) });
34065
35171
  },
34066
35172
  [postToParent2]
34067
35173
  );
34068
- const handleMediaFadeOutComplete = (0, import_react25.useCallback)((key) => {
35174
+ const handleMediaFadeOutComplete = (0, import_react26.useCallback)((key) => {
34069
35175
  setUploadingRects((prev) => {
34070
35176
  if (!(key in prev)) return prev;
34071
35177
  const next = { ...prev };
@@ -34073,7 +35179,7 @@ function OhhwellsBridge() {
34073
35179
  return next;
34074
35180
  });
34075
35181
  }, []);
34076
- const handleVideoSettingsChange = (0, import_react25.useCallback)(
35182
+ const handleVideoSettingsChange = (0, import_react26.useCallback)(
34077
35183
  (key, settings) => {
34078
35184
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
34079
35185
  const video = getVideoEl2(el);
@@ -34799,6 +35905,10 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
34799
35905
  SITE_OG_IMAGE_KEY,
34800
35906
  SchedulingWidget,
34801
35907
  TEMPLATE_LOGO_ATTR,
35908
+ TONE_ATTR,
35909
+ TONE_CHANGE_EVENT,
35910
+ TONE_FIX_ATTR,
35911
+ TONE_THRESHOLD,
34802
35912
  Toggle,
34803
35913
  ToggleGroup,
34804
35914
  ToggleGroupItem,
@@ -34817,11 +35927,16 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
34817
35927
  canRemoveAiBlock,
34818
35928
  canRemoveAiTextBlock,
34819
35929
  canSoftHideEditable,
35930
+ compositeColor,
35931
+ compositeGradient,
35932
+ computeBackgroundTones,
35933
+ contrastRatioOf,
34820
35934
  dropIndicatorVariants,
34821
35935
  ensureFooterTree,
34822
35936
  filterAvailablePages,
34823
35937
  foldAlignIntoTrees,
34824
35938
  getEditModeInitialState,
35939
+ gradientStopColors,
34825
35940
  hasMountedContentNodes,
34826
35941
  indexCollectionItems,
34827
35942
  insertFooterHours,
@@ -34833,16 +35948,21 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
34833
35948
  isRenderableTree,
34834
35949
  isStickySearchParam,
34835
35950
  isValidUrl,
35951
+ linearGradientColourAt,
35952
+ mapRegionToImage,
34836
35953
  matchCollectionItemClick,
35954
+ mountBackgroundTone,
34837
35955
  nextViableSlide,
34838
35956
  parseAiFooterState,
34839
35957
  parseAiSectionsState,
35958
+ parseCssColor,
34840
35959
  parseTarget,
34841
35960
  planAiBlockRemoval,
34842
35961
  planAiTextBlockRemoval,
34843
35962
  planBuildPageSync,
34844
35963
  readHiddenEditables,
34845
35964
  recordOverriddenPaths,
35965
+ relativeLuminanceOf,
34846
35966
  releaseTemplateLogoIfReplaced,
34847
35967
  removeBlockAtPath,
34848
35968
  removeFooterBlock,
@@ -34854,11 +35974,15 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
34854
35974
  shouldFetchContentForPath,
34855
35975
  softHideEditableInDom,
34856
35976
  softUnhideEditableInDom,
35977
+ splitTopLevel,
34857
35978
  stepViableSlide,
34858
35979
  stripPlaceholderText,
34859
35980
  stripPlaceholders,
34860
35981
  stripTextAlignCss,
34861
35982
  toggleVariants,
35983
+ toneFor,
35984
+ toneOfColor,
35985
+ toneOfLuminance,
34862
35986
  useOhwCarousel,
34863
35987
  validateUrlInput,
34864
35988
  viableSlides,