@ohhwells/bridge 0.1.112 → 0.1.113-next.293

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
@@ -46,6 +46,7 @@ __export(index_exports, {
46
46
  DropdownMenuItem: () => DropdownMenuItem,
47
47
  DropdownMenuSeparator: () => DropdownMenuSeparator,
48
48
  DropdownMenuTrigger: () => DropdownMenuTrigger,
49
+ EmptySection: () => EmptySection,
49
50
  ItemActionToolbar: () => ItemActionToolbar,
50
51
  ItemInteractionLayer: () => ItemInteractionLayer,
51
52
  LinkEditorPanel: () => LinkEditorPanel,
@@ -352,16 +353,17 @@ var LEGACY_BRAND_VAR_NAMES = [
352
353
  "text-muted",
353
354
  "surface",
354
355
  "border",
355
- "on-primary",
356
- "navbar-background"
356
+ "on-primary"
357
357
  ].map((role) => `--brand-${role}`);
358
358
  var FONT_VARS = {
359
359
  heading: ["--font-heading", "--font-display", "--brand-font-heading"],
360
360
  body: ["--font-body", "--brand-font-body"]
361
361
  };
362
362
  var BRAND_FONT_LINK_ID = "ohw-brand-fonts";
363
- function brandColorVars(kit) {
364
- const { dark, primary, accent, light } = kit.palette;
363
+ var CUSTOM_FONT_STYLE_ID = "ohw-brand-custom-fonts";
364
+ var CUSTOM_FONT_FORMATS = /* @__PURE__ */ new Set(["woff2", "woff", "truetype", "opentype"]);
365
+ function brandColorVars(palette) {
366
+ const { dark, primary, accent, light } = palette;
365
367
  const mix = (a, aPct, b) => `color-mix(in srgb, ${a} ${aPct}%, ${b})`;
366
368
  const surface = mix(light, 95, dark);
367
369
  const border = mix(light, 85, dark);
@@ -384,22 +386,42 @@ function brandColorVars(kit) {
384
386
  "--brand-border": border,
385
387
  // Buttons/bands painted in the primary colour assume it's dark/saturated enough to need
386
388
  // light text on top — the same assumption LOGO_IMAGE's light-on-dark navbar mark makes.
387
- "--brand-on-primary": light,
388
- "--brand-navbar-background": dark
389
+ "--brand-on-primary": light
389
390
  };
390
391
  }
392
+ function parseCustomFontWeight(raw) {
393
+ if (typeof raw !== "object" || raw === null) return null;
394
+ const w = raw;
395
+ if (typeof w.weight !== "number" || !Number.isFinite(w.weight)) return null;
396
+ if (typeof w.url !== "string" || !w.url) return null;
397
+ if (typeof w.format !== "string" || !CUSTOM_FONT_FORMATS.has(w.format)) return null;
398
+ const weightEnd = typeof w.weightEnd === "number" && Number.isFinite(w.weightEnd) && w.weightEnd > w.weight ? w.weightEnd : void 0;
399
+ return { weight: w.weight, ...weightEnd !== void 0 ? { weightEnd } : {}, url: w.url, format: w.format };
400
+ }
401
+ function parseCustomFont(raw) {
402
+ if (typeof raw !== "object" || raw === null) return null;
403
+ const f = raw;
404
+ if (typeof f.family !== "string" || !f.family) return null;
405
+ if (typeof f.label !== "string" || !f.label) return null;
406
+ if (!Array.isArray(f.weights)) return null;
407
+ const weights = f.weights.map(parseCustomFontWeight).filter((w) => w !== null);
408
+ if (weights.length === 0) return null;
409
+ return { family: f.family, label: f.label, weights };
410
+ }
391
411
  function parseBrandKit(raw) {
392
412
  if (!raw) return null;
393
413
  try {
394
414
  const parsed = JSON.parse(raw);
395
415
  const p = parsed?.palette;
396
416
  const f = parsed?.fonts;
397
- if (!p || !f || typeof p.dark !== "string" || typeof p.primary !== "string" || typeof p.accent !== "string" || typeof p.light !== "string" || typeof f.heading !== "string" || typeof f.body !== "string") {
398
- return null;
399
- }
417
+ const palette = p && typeof p.dark === "string" && typeof p.primary === "string" && typeof p.accent === "string" && typeof p.light === "string" ? { dark: p.dark, primary: p.primary, accent: p.accent, light: p.light } : void 0;
418
+ const fonts = f && typeof f.heading === "string" && typeof f.body === "string" ? { heading: f.heading, body: f.body } : void 0;
419
+ const customFonts = Array.isArray(parsed?.customFonts) ? parsed.customFonts.map(parseCustomFont).filter((c) => c !== null) : void 0;
420
+ if (!palette && !fonts && !customFonts) return null;
400
421
  return {
401
- palette: { dark: p.dark, primary: p.primary, accent: p.accent, light: p.light },
402
- fonts: { heading: f.heading, body: f.body }
422
+ ...palette ? { palette } : {},
423
+ ...fonts ? { fonts } : {},
424
+ ...customFonts ? { customFonts } : {}
403
425
  };
404
426
  } catch {
405
427
  return null;
@@ -409,11 +431,16 @@ function familyOf(stack) {
409
431
  const first = stack.split(",")[0]?.trim() ?? "";
410
432
  return first.replace(/^['"]|['"]$/g, "");
411
433
  }
434
+ function quoteFamily(family) {
435
+ return `'${family.replace(/\\/g, "\\\\").replace(/'/g, "\\'")}'`;
436
+ }
437
+ var WEIGHT_SCALE = [100, 200, 300, 400, 500, 600, 700, 800, 900];
412
438
  function loadBrandFonts(families) {
413
439
  const unique = [...new Set(families.map((f) => f.trim()).filter(Boolean))];
414
440
  if (unique.length === 0) return;
415
- const spec = unique.map((f) => `${f.replace(/ /g, "+")}:400,500,600,700`).join("|");
416
- const href = `https://fonts.googleapis.com/css?family=${spec}&display=swap`;
441
+ const weights = WEIGHT_SCALE.join(";");
442
+ const spec = unique.map((f) => `family=${f.replace(/ /g, "+")}:wght@${weights}`).join("&");
443
+ const href = `https://fonts.googleapis.com/css2?${spec}&display=swap`;
417
444
  let link = document.getElementById(BRAND_FONT_LINK_ID);
418
445
  if (!link) {
419
446
  link = document.createElement("link");
@@ -423,18 +450,54 @@ function loadBrandFonts(families) {
423
450
  }
424
451
  if (link.href !== href) link.href = href;
425
452
  }
453
+ function escapeCssString(value) {
454
+ return value.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
455
+ }
456
+ function loadCustomFonts(fonts) {
457
+ const list = fonts ?? [];
458
+ let style = document.getElementById(CUSTOM_FONT_STYLE_ID);
459
+ if (list.length === 0) {
460
+ style?.remove();
461
+ return;
462
+ }
463
+ if (!style) {
464
+ style = document.createElement("style");
465
+ style.id = CUSTOM_FONT_STYLE_ID;
466
+ document.head.appendChild(style);
467
+ }
468
+ style.textContent = list.flatMap(
469
+ (font) => font.weights.map((w) => {
470
+ const weightDescriptor = w.weightEnd ? `${w.weight} ${w.weightEnd}` : `${w.weight}`;
471
+ return `@font-face { font-family: '${escapeCssString(font.family)}'; src: url('${escapeCssString(w.url)}') format('${w.format}'); font-weight: ${weightDescriptor}; font-display: swap; }`;
472
+ })
473
+ ).join("\n");
474
+ }
426
475
  function applyBrandToDom(kit) {
427
476
  const root = document.documentElement;
428
477
  if (!kit) {
429
478
  for (const name of [...BRAND_VAR_NAMES, ...LEGACY_BRAND_VAR_NAMES]) root.style.removeProperty(name);
430
479
  for (const name of [...FONT_VARS.heading, ...FONT_VARS.body]) root.style.removeProperty(name);
431
480
  document.getElementById(BRAND_FONT_LINK_ID)?.remove();
481
+ document.getElementById(CUSTOM_FONT_STYLE_ID)?.remove();
432
482
  return;
433
483
  }
434
- for (const [name, value] of Object.entries(brandColorVars(kit))) root.style.setProperty(name, value);
435
- for (const name of FONT_VARS.heading) root.style.setProperty(name, kit.fonts.heading);
436
- for (const name of FONT_VARS.body) root.style.setProperty(name, kit.fonts.body);
437
- loadBrandFonts([familyOf(kit.fonts.heading), familyOf(kit.fonts.body)]);
484
+ if (kit.palette) {
485
+ for (const [name, value] of Object.entries(brandColorVars(kit.palette))) root.style.setProperty(name, value);
486
+ }
487
+ if (kit.customFonts) {
488
+ loadCustomFonts(kit.customFonts);
489
+ }
490
+ if (kit.fonts) {
491
+ const heading = quoteFamily(kit.fonts.heading);
492
+ const body = quoteFamily(kit.fonts.body);
493
+ for (const name of FONT_VARS.heading) root.style.setProperty(name, heading);
494
+ for (const name of FONT_VARS.body) root.style.setProperty(name, body);
495
+ const customFamilies = new Set((kit.customFonts ?? []).map((f) => f.family));
496
+ const googleFamilies = [familyOf(kit.fonts.heading), familyOf(kit.fonts.body)].filter(
497
+ (f) => !customFamilies.has(f)
498
+ );
499
+ loadBrandFonts(googleFamilies);
500
+ }
438
501
  }
439
502
 
440
503
  // src/lib/section-styles.ts
@@ -459,6 +522,20 @@ var BG_VALUES = {
459
522
  accent: "var(--ohw-brand-primary, var(--color-primary, #0078E5))",
460
523
  "accent-soft": "color-mix(in srgb, var(--ohw-brand-primary, var(--color-primary, #0078E5)) 12%, var(--ohw-brand-light, var(--color-light, #FFFFFF)))"
461
524
  };
525
+ var NAVBAR_COLOR_TOKENS = ["dark", "primary", "accent", "light"];
526
+ function navbarColorVar(token) {
527
+ const fallback = {
528
+ dark: "#0C0A09",
529
+ primary: "#0078E5",
530
+ accent: "#0078E5",
531
+ light: "#FFFFFF"
532
+ };
533
+ return `var(--ohw-brand-${token}, var(--color-${token}, ${fallback[token]}))`;
534
+ }
535
+ function resolveNavbarValue(value) {
536
+ if (value === void 0) return void 0;
537
+ return NAVBAR_COLOR_TOKENS.includes(value) ? navbarColorVar(value) : value;
538
+ }
462
539
  var HEADLINE_SIZES = { md: 24, lg: 32, xl: 40, display: 56 };
463
540
  function styleSheetCss() {
464
541
  const rules = [];
@@ -628,8 +705,16 @@ function applyStylesToDom(store) {
628
705
  for (const [sectionId, override] of Object.entries(store.sections)) {
629
706
  const escaped = CSS.escape(sectionId);
630
707
  const byInstance = document.querySelectorAll(`[data-ohw-instance="${escaped}"]`);
631
- const sections = byInstance.length ? byInstance : document.querySelectorAll(`[data-ohw-section="${escaped}"]`);
708
+ const sections = Array.from(
709
+ byInstance.length ? byInstance : document.querySelectorAll(`[data-ohw-section="${escaped}"]`)
710
+ );
711
+ const isNavbar = sectionId === "navbar";
712
+ if (isNavbar) {
713
+ const drawer = document.querySelector("[data-ohw-nav-drawer]");
714
+ if (drawer && !sections.includes(drawer)) sections.push(drawer);
715
+ }
632
716
  for (const marker of Array.from(sections)) {
717
+ const isDrawerMarker = isNavbar && marker.hasAttribute("data-ohw-nav-drawer");
633
718
  const section = marker.querySelector(":scope > [data-ai-section]") ?? marker;
634
719
  for (const [prop, attr] of Object.entries(SECTION_ATTRS)) {
635
720
  const value = override[prop];
@@ -637,19 +722,23 @@ function applyStylesToDom(store) {
637
722
  if (prop === "sectionBackground" && override.sectionBackgroundColor !== void 0) continue;
638
723
  section.setAttribute(attr, String(value).replace(":", "-"));
639
724
  }
640
- if (override.sectionBackgroundColor !== void 0) {
725
+ const bgOverride = isDrawerMarker ? override.navbarMobileBackground : override.sectionBackgroundColor;
726
+ const textOverride = isDrawerMarker ? override.navbarMobileTextColor : override.textColor;
727
+ const bgValue = isNavbar ? resolveNavbarValue(bgOverride) : bgOverride;
728
+ const textValue = isNavbar ? resolveNavbarValue(textOverride) : textOverride;
729
+ if (bgValue !== void 0) {
641
730
  saveInline(section, "background");
642
- section.style.setProperty("background", override.sectionBackgroundColor, "important");
731
+ section.style.setProperty("background", bgValue, "important");
643
732
  section.setAttribute("data-ohw-style-bgcolor", "");
644
733
  }
645
- if (override.textColor !== void 0 || override.fontFamily !== void 0) {
734
+ if (textValue !== void 0 || override.fontFamily !== void 0) {
646
735
  const textEls = marker.querySelectorAll(
647
736
  '[data-ohw-editable="text"], [data-ohw-editable="plain"], [data-ohw-field-label]'
648
737
  );
649
738
  for (const el of Array.from(textEls)) {
650
- if (override.textColor !== void 0) {
739
+ if (textValue !== void 0) {
651
740
  saveInline(el, "color");
652
- el.style.setProperty("color", override.textColor, "important");
741
+ el.style.setProperty("color", textValue, "important");
653
742
  el.setAttribute(NODE_WROTE_ATTR, "");
654
743
  }
655
744
  if (override.fontFamily !== void 0) {
@@ -1355,6 +1444,22 @@ function accentBandContext(brand) {
1355
1444
  function textAttrs(ctx, path) {
1356
1445
  return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
1357
1446
  }
1447
+ var AI_RESPONSIVE_CSS = [
1448
+ "@media (max-width: 960px) {",
1449
+ " [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
1450
+ ' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
1451
+ "}",
1452
+ "@media (max-width: 640px) {",
1453
+ " [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
1454
+ " [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
1455
+ // Group containers flatten to a column on phones; span placements come along for free.
1456
+ " [data-ai-responsive] [data-ai-group] { display: flex !important; flex-direction: column !important; }",
1457
+ " [data-ai-responsive] [data-ai-group] > * { grid-column: auto !important; }",
1458
+ " [data-ai-responsive] [data-ai-section-inner] { padding-left: 20px !important; padding-right: 20px !important; }",
1459
+ " [data-ai-responsive] { overflow-x: hidden; }",
1460
+ " [data-ai-responsive] img { max-width: 100%; }",
1461
+ "}"
1462
+ ].join("\n");
1358
1463
  var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
1359
1464
  function MediaBox({
1360
1465
  refValue,
@@ -1367,13 +1472,17 @@ function MediaBox({
1367
1472
  const url = refValue ? ctx.resolveMedia(refValue) : null;
1368
1473
  const isIcon = /^(lucide|simple):/.test(refValue);
1369
1474
  const aspectRatio = aspect && /^\d+:\d+$/.test(aspect) ? aspect.replace(":", " / ") : void 0;
1370
- const editAttrs = ctx.keyFor && editPath && !isIcon ? { "data-ohw-key": ctx.keyFor(editPath), "data-ohw-editable": "image" } : {};
1475
+ const editAttrs = ctx.keyFor && editPath ? {
1476
+ "data-ohw-key": ctx.keyFor(editPath),
1477
+ "data-ohw-editable": isIcon ? "icon" : "image"
1478
+ } : {};
1371
1479
  if (isIcon) {
1372
1480
  const Icon = refValue.startsWith("lucide:") ? lucideByName(refValue.slice(7)) : null;
1373
1481
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1374
1482
  "span",
1375
1483
  {
1376
1484
  "data-ai-icon": refValue,
1485
+ ...editAttrs,
1377
1486
  style: {
1378
1487
  display: "inline-flex",
1379
1488
  width: 48,
@@ -2266,7 +2375,7 @@ function CollectionBlock({ node, ctx, path }) {
2266
2375
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2267
2376
  "div",
2268
2377
  {
2269
- "data-ai-grid": "",
2378
+ "data-ai-grid": String(itemsPerRow),
2270
2379
  style: {
2271
2380
  display: "grid",
2272
2381
  gridTemplateColumns: `repeat(${itemsPerRow}, 1fr)`,
@@ -2619,6 +2728,7 @@ function AiTreeRenderer({
2619
2728
  {
2620
2729
  "data-ai-section": tree.tag ?? "",
2621
2730
  ...bgAttrs,
2731
+ "data-ai-responsive": "",
2622
2732
  style: {
2623
2733
  position: "relative",
2624
2734
  padding: `${pad}px 0`,
@@ -2629,12 +2739,13 @@ function AiTreeRenderer({
2629
2739
  color: settings.sectionBackground === "accent" ? blockBrand.palette.dark : void 0
2630
2740
  },
2631
2741
  children: [
2632
- isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
2742
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_RESPONSIVE_CSS }),
2633
2743
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_MOBILE_CSS }),
2744
+ isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
2634
2745
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2635
2746
  "div",
2636
2747
  {
2637
- "data-ai-container": "",
2748
+ "data-ai-section-inner": "",
2638
2749
  style: {
2639
2750
  position: "relative",
2640
2751
  maxWidth: AI_TREE_TOKENS.sectionMaxWidth,
@@ -2645,7 +2756,7 @@ function AiTreeRenderer({
2645
2756
  children: tree.rows.map((row, r2) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
2646
2757
  "div",
2647
2758
  {
2648
- "data-ai-row": "",
2759
+ "data-ai-columns": "",
2649
2760
  style: {
2650
2761
  display: "grid",
2651
2762
  gridTemplateColumns: "repeat(12, 1fr)",
@@ -2695,14 +2806,52 @@ function readRootVar(name) {
2695
2806
  if (typeof document === "undefined") return "";
2696
2807
  return getComputedStyle(document.documentElement).getPropertyValue(name).trim();
2697
2808
  }
2809
+ function normalizeColorToHex(value) {
2810
+ if (!value || typeof document === "undefined") return value;
2811
+ const canvas = document.createElement("canvas");
2812
+ canvas.width = 1;
2813
+ canvas.height = 1;
2814
+ const ctx = canvas.getContext("2d");
2815
+ if (!ctx) return value;
2816
+ ctx.fillStyle = value;
2817
+ ctx.fillRect(0, 0, 1, 1);
2818
+ const [r2, g, b] = ctx.getImageData(0, 0, 1, 1).data;
2819
+ const toHex = (n) => n.toString(16).padStart(2, "0");
2820
+ return `#${toHex(r2)}${toHex(g)}${toHex(b)}`;
2821
+ }
2822
+ var GENERIC_FONT_KEYWORDS = /* @__PURE__ */ new Set([
2823
+ "serif",
2824
+ "sans-serif",
2825
+ "monospace",
2826
+ "cursive",
2827
+ "fantasy",
2828
+ "system-ui",
2829
+ "ui-serif",
2830
+ "ui-sans-serif",
2831
+ "ui-monospace",
2832
+ "ui-rounded",
2833
+ "math",
2834
+ "emoji",
2835
+ "fangsong"
2836
+ ]);
2837
+ function primaryFontFamily(stack) {
2838
+ const first = stack.split(",").map((part) => part.trim().replace(/^["']|["']$/g, "")).find((part) => part && !GENERIC_FONT_KEYWORDS.has(part.toLowerCase()));
2839
+ return first ?? "";
2840
+ }
2841
+ function humanizeFontFamily(name) {
2842
+ return name.replace(/^__/, "").replace(/_[0-9a-f]{6}$/i, "").replace(/_/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").trim().replace(/\s+/g, " ").replace(/(^|\s)([a-z])/g, (_, sep, c) => sep + c.toUpperCase());
2843
+ }
2844
+ function readFontVar(name) {
2845
+ return humanizeFontFamily(primaryFontFamily(readRootVar(name)));
2846
+ }
2698
2847
  function deriveBrandOverride() {
2699
2848
  const dark = readRootVar("--ohw-brand-dark");
2700
2849
  const primary = readRootVar("--ohw-brand-primary");
2701
2850
  const light = readRootVar("--ohw-brand-light");
2702
2851
  if (!dark || !primary || !light) return null;
2703
2852
  const accent = readRootVar("--ohw-brand-accent");
2704
- const heading = readRootVar("--font-heading") || readRootVar("--font-display");
2705
- const body = readRootVar("--font-body");
2853
+ const heading = readFontVar("--font-heading") || readFontVar("--font-display");
2854
+ const body = readFontVar("--font-body");
2706
2855
  return {
2707
2856
  palette: { dark, primary, accent: accent || dark, light },
2708
2857
  fonts: {
@@ -2711,22 +2860,55 @@ function deriveBrandOverride() {
2711
2860
  }
2712
2861
  };
2713
2862
  }
2714
- function deriveTemplateBrand() {
2863
+ function deriveTemplateBrandLive() {
2715
2864
  const primary = readRootVar("--brand-primary") || readRootVar("--color-primary");
2716
2865
  const dark = readRootVar("--brand-text") || readRootVar("--color-dark");
2717
2866
  const light = readRootVar("--brand-background") || readRootVar("--color-light");
2718
2867
  if (!dark || !primary || !light) return null;
2719
2868
  const accent = readRootVar("--brand-accent") || readRootVar("--color-accent");
2720
- const heading = readRootVar("--brand-font-heading") || readRootVar("--font-heading") || readRootVar("--font-display");
2721
- const body = readRootVar("--brand-font-body") || readRootVar("--font-body");
2869
+ const heading = readFontVar("--brand-font-heading") || readFontVar("--font-heading") || readFontVar("--font-display");
2870
+ const body = readFontVar("--brand-font-body") || readFontVar("--font-body");
2722
2871
  return {
2723
- palette: { dark, primary, accent: accent || dark, light },
2872
+ palette: {
2873
+ dark: normalizeColorToHex(dark),
2874
+ primary: normalizeColorToHex(primary),
2875
+ accent: normalizeColorToHex(accent || dark),
2876
+ light: normalizeColorToHex(light)
2877
+ },
2724
2878
  fonts: {
2725
2879
  heading: heading || AI_DEFAULT_BRAND.fonts.heading,
2726
2880
  body: body || AI_DEFAULT_BRAND.fonts.body
2727
2881
  }
2728
2882
  };
2729
2883
  }
2884
+ function deriveTemplateFontsLive() {
2885
+ const heading = readFontVar("--brand-font-heading") || readFontVar("--font-heading") || readFontVar("--font-display");
2886
+ const body = readFontVar("--brand-font-body") || readFontVar("--font-body");
2887
+ if (!heading && !body) return null;
2888
+ return {
2889
+ heading: heading || AI_DEFAULT_BRAND.fonts.heading,
2890
+ body: body || AI_DEFAULT_BRAND.fonts.body
2891
+ };
2892
+ }
2893
+ var OVERRIDE_VAR_NAMES = [...BRAND_VAR_NAMES, ...LEGACY_BRAND_VAR_NAMES, ...FONT_VARS.heading, ...FONT_VARS.body];
2894
+ function withOverrideStripped(read) {
2895
+ const root = document.documentElement;
2896
+ const restore = OVERRIDE_VAR_NAMES.map((name) => [name, root.style.getPropertyValue(name)]);
2897
+ for (const name of OVERRIDE_VAR_NAMES) root.style.removeProperty(name);
2898
+ try {
2899
+ return read();
2900
+ } finally {
2901
+ for (const [name, value] of restore) if (value) root.style.setProperty(name, value);
2902
+ }
2903
+ }
2904
+ var TEMPLATE_BRAND_SNAPSHOT = typeof document === "undefined" ? null : withOverrideStripped(deriveTemplateBrandLive);
2905
+ var TEMPLATE_FONTS_SNAPSHOT = typeof document === "undefined" ? null : withOverrideStripped(deriveTemplateFontsLive);
2906
+ function deriveTemplateBrand() {
2907
+ return TEMPLATE_BRAND_SNAPSHOT;
2908
+ }
2909
+ function deriveTemplateFonts() {
2910
+ return TEMPLATE_FONTS_SNAPSHOT;
2911
+ }
2730
2912
  function deriveTemplateButtonStyle() {
2731
2913
  if (typeof document === "undefined") return null;
2732
2914
  const candidates = Array.from(
@@ -7224,12 +7406,12 @@ var cva = (base, config) => (props) => {
7224
7406
  var import_radix_ui2 = require("radix-ui");
7225
7407
  var import_jsx_runtime5 = require("react/jsx-runtime");
7226
7408
  var toggleVariants = cva(
7227
- "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none hover:bg-muted hover:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
7409
+ "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none hover:bg-muted hover:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=on]:bg-bridge-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
7228
7410
  {
7229
7411
  variants: {
7230
7412
  variant: {
7231
7413
  default: "bg-transparent border-0",
7232
- outline: "border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"
7414
+ outline: "border border-input bg-transparent shadow-xs hover:bg-bridge-accent hover:text-accent-foreground"
7233
7415
  },
7234
7416
  size: {
7235
7417
  default: "px-2 py-1",
@@ -7322,10 +7504,10 @@ var DragHandle = React4.forwardRef(
7322
7504
  type,
7323
7505
  "data-slot": "drag-handle",
7324
7506
  className: cn(
7325
- "inline-flex h-7 w-4 shrink-0 items-center justify-center rounded-md transition-all duration-200 max-h-[30px]",
7507
+ "inline-flex h-7 w-4 shrink-0 items-center justify-center rounded-md transition-all duration-200 max-h-7.5",
7326
7508
  "bg-white border border-transparent text-stone-500 shadow-md cursor-grab",
7327
7509
  "enabled:hover:border enabled:hover:border-stone-200 enabled:hover:text-stone-950",
7328
- "enabled:active:border enabled:active:border-primary enabled:active:bg-primary-50 enabled:active:text-stone-950 enabled:active:shadow enabled:active:cursor-grabbing",
7510
+ "enabled:active:border enabled:active:border-bridge-primary enabled:active:bg-primary-50 enabled:active:text-stone-950 enabled:active:shadow enabled:active:cursor-grabbing",
7329
7511
  "disabled:cursor-not-allowed disabled:opacity-40 disabled:text-stone-950 disabled:pointer-events-none",
7330
7512
  className
7331
7513
  ),
@@ -7347,7 +7529,7 @@ var CustomToolbar = React5.forwardRef(({ className, onMouseDown, ...props }, ref
7347
7529
  "data-ohw-toolbar": "",
7348
7530
  className: cn(
7349
7531
  // Figma: bg background, radius 8, gap-1, p-0.5, shadow-md — no border
7350
- "inline-flex h-8 items-center gap-1 rounded-[var(--radius,0.5rem)] bg-background p-0.5 font-sans whitespace-nowrap shadow-md",
7532
+ "inline-flex h-8 items-center gap-1 rounded-(--radius,0.5rem) bg-background p-0.5 font-sans whitespace-nowrap shadow-md",
7351
7533
  className
7352
7534
  ),
7353
7535
  onMouseDown: (e) => {
@@ -7376,7 +7558,7 @@ var CustomToolbarButton = React5.forwardRef(
7376
7558
  type,
7377
7559
  className: cn(
7378
7560
  "inline-flex size-7 shrink-0 items-center justify-center rounded-[calc(var(--radius,0.5rem)-2px)] text-foreground transition-colors",
7379
- active ? "bg-primary text-primary-foreground" : "bg-transparent hover:bg-muted disabled:cursor-not-allowed disabled:text-muted-foreground disabled:opacity-60",
7561
+ active ? "bg-bridge-primary text-primary-foreground" : "bg-transparent hover:bg-muted disabled:cursor-not-allowed disabled:text-muted-foreground disabled:opacity-60",
7380
7562
  className
7381
7563
  ),
7382
7564
  ...props
@@ -8640,13 +8822,13 @@ function FormFieldToolbar({
8640
8822
  ]
8641
8823
  }
8642
8824
  ) }),
8643
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DropdownMenuContent, { align: "start", sideOffset: 8, className: "min-w-[190px] p-1", children: FIELD_TYPES.map((entry) => {
8825
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DropdownMenuContent, { align: "start", sideOffset: 8, className: "min-w-47.5 p-1", children: FIELD_TYPES.map((entry) => {
8644
8826
  const Icon = TYPE_ICONS[entry.type];
8645
8827
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
8646
8828
  DropdownMenuItem,
8647
8829
  {
8648
8830
  onSelect: () => onTypeChange(entry.type),
8649
- className: "rounded-md py-2 text-[13px] " + (entry.type === type ? "bg-primary/10" : ""),
8831
+ className: "rounded-md py-2 text-[13px] " + (entry.type === type ? "bg-bridge-primary/10" : ""),
8650
8832
  children: [
8651
8833
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon, { size: 14, strokeWidth: 1.75, className: "shrink-0", "aria-hidden": true }),
8652
8834
  entry.label
@@ -8663,7 +8845,7 @@ function FormFieldToolbar({
8663
8845
  type: "button",
8664
8846
  "aria-pressed": required,
8665
8847
  onClick: onRequiredToggle,
8666
- className: "flex h-7 items-center gap-1.5 whitespace-nowrap rounded-md px-2 text-[13px] font-medium transition-colors " + (required ? "bg-primary/10 text-primary" : "text-foreground hover:bg-muted/70"),
8848
+ className: "flex h-7 items-center gap-1.5 whitespace-nowrap rounded-md px-2 text-[13px] font-medium transition-colors " + (required ? "bg-bridge-primary/10 text-bridge-primary" : "text-foreground hover:bg-muted/70"),
8667
8849
  "data-ohw-field-required-toggle": "",
8668
8850
  children: [
8669
8851
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react4.Asterisk, { size: 14, strokeWidth: 2, "aria-hidden": true }),
@@ -8683,7 +8865,7 @@ function FormFieldToolbar({
8683
8865
  children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react4.MoreHorizontal, { size: 15, "aria-hidden": true })
8684
8866
  }
8685
8867
  ) }),
8686
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(DropdownMenuContent, { align: "start", sideOffset: 8, className: "min-w-[170px] p-1", children: [
8868
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(DropdownMenuContent, { align: "start", sideOffset: 8, className: "min-w-42.5 p-1", children: [
8687
8869
  /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(DropdownMenuItem, { onSelect: onDuplicate, className: "rounded-md py-2 text-[13px]", children: [
8688
8870
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react4.Copy, { size: 14, strokeWidth: 1.75, className: "shrink-0", "aria-hidden": true }),
8689
8871
  "Duplicate"
@@ -8711,7 +8893,7 @@ function FieldTypePicker({ onPick }) {
8711
8893
  {
8712
8894
  type: "button",
8713
8895
  onClick: () => onPick(entry.type),
8714
- className: "flex h-[76px] flex-col items-center justify-center gap-2 rounded-xl border border-border text-[15px] font-medium text-foreground transition-colors hover:border-primary hover:bg-primary/5",
8896
+ className: "flex h-[76px] flex-col items-center justify-center gap-2 rounded-xl border border-border text-[15px] font-medium text-foreground transition-colors hover:border-bridge-primary hover:bg-bridge-primary/5",
8715
8897
  children: [
8716
8898
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon, { size: 26, strokeWidth: 1.5, "aria-hidden": true }),
8717
8899
  entry.label
@@ -8737,7 +8919,7 @@ var buttonVariants = cva(
8737
8919
  {
8738
8920
  variants: {
8739
8921
  variant: {
8740
- default: "bg-primary text-primary-foreground hover:opacity-90",
8922
+ default: "bg-bridge-primary text-primary-foreground hover:opacity-90",
8741
8923
  outline: "border border-border bg-background text-foreground shadow-sm hover:bg-muted/80",
8742
8924
  ghost: "min-w-0 px-3 py-2 text-foreground hover:bg-muted/50"
8743
8925
  },
@@ -8832,6 +9014,7 @@ function MediaOverlay({
8832
9014
  (prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
8833
9015
  );
8834
9016
  }, [isVideo]);
9017
+ const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
8835
9018
  const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
8836
9019
  const box = {
8837
9020
  position: "fixed",
@@ -8937,8 +9120,8 @@ function MediaOverlay({
8937
9120
  pointerEvents: hover.hasTextOverlap ? "none" : "auto",
8938
9121
  // Selected: a firm component ring with no wash, so the image reads as chosen rather
8939
9122
  // than hovered. Hover keeps the existing tinted preview.
8940
- boxShadow: selected ? "inset 0 0 0 2px var(--color-primary)" : "inset 0 0 0 1.5px var(--color-primary)",
8941
- background: selected ? "transparent" : "color-mix(in srgb, var(--color-primary) 20%, transparent)"
9123
+ boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
9124
+ background: selected ? "transparent" : "color-mix(in srgb, var(--color-bridge-primary) 20%, transparent)"
8942
9125
  },
8943
9126
  onClick: () => onSelect && !selected ? onSelect(hover.key) : onReplace(hover.key),
8944
9127
  children: [
@@ -8961,17 +9144,17 @@ function MediaOverlay({
8961
9144
  },
8962
9145
  children: [
8963
9146
  isVideo ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react5.Film, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react5.ImageIcon, { size: 14 }),
8964
- isVideo ? "Replace video" : "Replace image"
9147
+ replaceLabel
8965
9148
  ]
8966
9149
  }
8967
9150
  ),
8968
- replaceMode === "none" ? null : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
9151
+ showChrome && replaceMode !== "none" && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
8969
9152
  Button,
8970
9153
  {
8971
9154
  "data-ohw-media-overlay": "",
8972
9155
  variant: "outline",
8973
9156
  size: "sm",
8974
- "aria-label": isVideo ? "Replace video" : "Replace image",
9157
+ "aria-label": replaceLabel,
8975
9158
  className: "gap-1.5 cursor-pointer hover:bg-background",
8976
9159
  style: {
8977
9160
  ...OVERLAY_BUTTON_STYLE,
@@ -8994,7 +9177,7 @@ function MediaOverlay({
8994
9177
  },
8995
9178
  children: [
8996
9179
  isVideo ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react5.Film, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react5.ImageIcon, { size: 14 }),
8997
- replaceMode === "full" ? isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image" : null
9180
+ replaceMode === "full" ? replaceLabel : null
8998
9181
  ]
8999
9182
  }
9000
9183
  )
@@ -9032,8 +9215,8 @@ function CarouselOverlay({
9032
9215
  height: rect.height,
9033
9216
  zIndex: 2147483646,
9034
9217
  pointerEvents: "auto",
9035
- boxShadow: "inset 0 0 0 1.5px var(--color-primary)",
9036
- background: "color-mix(in srgb, var(--color-primary) 20%, transparent)"
9218
+ boxShadow: "inset 0 0 0 1.5px var(--color-bridge-primary)",
9219
+ background: "color-mix(in srgb, var(--color-bridge-primary) 20%, transparent)"
9037
9220
  },
9038
9221
  onClick: () => onEdit(hover.key),
9039
9222
  children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
@@ -9101,6 +9284,57 @@ function useLiveSectionRect(sectionId) {
9101
9284
  }, [sectionId]);
9102
9285
  return rect;
9103
9286
  }
9287
+ var NAV_TOGGLE_LABEL_RE = /^(toggle menu|open menu|close menu)$/i;
9288
+ function readNavToggleRect() {
9289
+ const el = Array.from(document.querySelectorAll("button[aria-label]")).find(
9290
+ (e) => NAV_TOGGLE_LABEL_RE.test(e.getAttribute("aria-label") ?? "")
9291
+ );
9292
+ if (!el) return null;
9293
+ const r2 = el.getBoundingClientRect();
9294
+ if (r2.width <= 0 || r2.height <= 0) return null;
9295
+ return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
9296
+ }
9297
+ function useLiveNavToggleHole(active) {
9298
+ const [rect, setRect] = (0, import_react8.useState)(null);
9299
+ (0, import_react8.useEffect)(() => {
9300
+ if (!active) {
9301
+ setRect(null);
9302
+ return;
9303
+ }
9304
+ const update = () => {
9305
+ const next = readNavToggleRect();
9306
+ setRect(
9307
+ (prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
9308
+ );
9309
+ };
9310
+ update();
9311
+ const opts = { capture: true, passive: true };
9312
+ window.addEventListener("scroll", update, opts);
9313
+ window.addEventListener("resize", update);
9314
+ const interval = setInterval(update, 500);
9315
+ return () => {
9316
+ window.removeEventListener("scroll", update, opts);
9317
+ window.removeEventListener("resize", update);
9318
+ clearInterval(interval);
9319
+ };
9320
+ }, [active]);
9321
+ return rect;
9322
+ }
9323
+ function subtractRect(outer, hole) {
9324
+ if (!hole) return [outer];
9325
+ const l = Math.max(outer.left, hole.left);
9326
+ const t = Math.max(outer.top, hole.top);
9327
+ const r2 = Math.min(outer.left + outer.width, hole.left + hole.width);
9328
+ const b = Math.min(outer.top + outer.height, hole.top + hole.height);
9329
+ if (l >= r2 || t >= b) return [outer];
9330
+ const rects = [];
9331
+ if (t > outer.top) rects.push({ left: outer.left, top: outer.top, width: outer.width, height: t - outer.top });
9332
+ const midHeight = b - t;
9333
+ if (l > outer.left) rects.push({ left: outer.left, top: t, width: l - outer.left, height: midHeight });
9334
+ if (r2 < outer.left + outer.width) rects.push({ left: r2, top: t, width: outer.left + outer.width - r2, height: midHeight });
9335
+ if (b < outer.top + outer.height) rects.push({ left: outer.left, top: b, width: outer.width, height: outer.top + outer.height - b });
9336
+ return rects;
9337
+ }
9104
9338
  function computeSectionBoundaryFlags(instanceId) {
9105
9339
  const topLevel = topLevelSections();
9106
9340
  const index = topLevel.findIndex((el) => instanceIdOf(el) === instanceId);
@@ -9316,6 +9550,7 @@ function AiSectionOverlay({
9316
9550
  const activeSelectionId = reviewId ? null : selectedId;
9317
9551
  const selectionRect = useLiveSectionRect(activeSelectionId);
9318
9552
  const reviewRect = useLiveSectionRect(reviewId);
9553
+ const navToggleHole = useLiveNavToggleHole(Boolean(reviewId));
9319
9554
  const hoverRect = useLiveSectionRect(reviewId || hoveredId === selectedId ? null : hoveredId);
9320
9555
  const showSelectionBorder = Boolean(selectionRect) && !navDropdownForceOpen;
9321
9556
  (0, import_react8.useEffect)(() => {
@@ -9375,48 +9610,65 @@ function AiSectionOverlay({
9375
9610
  }
9376
9611
  }
9377
9612
  ),
9378
- reviewRect && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
9379
- "div",
9380
- {
9381
- "data-ohw-ai-review": "",
9382
- style: {
9383
- position: "fixed",
9384
- top: reviewRect.top,
9385
- left: reviewRect.left,
9386
- width: reviewRect.width,
9387
- height: reviewRect.height,
9388
- border: `2px solid ${PRIMARY2}`,
9389
- borderRadius: edgeAwareRadius(reviewRect),
9390
- zIndex: 2147483200,
9391
- // The veil itself: swallows clicks so the section stays locked until decided. This
9392
- // stopPropagation only guards the bubble phase; the bridge's capture-phase click
9393
- // handlers additionally bail on `[data-ohw-ai-review]`, without which a click on
9394
- // Accept/Discard resolves to the media beneath and opens the file picker.
9395
- background: "rgba(8, 133, 254, 0.04)",
9396
- pointerEvents: "auto",
9397
- cursor: "default"
9613
+ reviewRect && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
9614
+ subtractRect(reviewRect, navToggleHole).map((r2, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
9615
+ "div",
9616
+ {
9617
+ "data-ohw-ai-review": "",
9618
+ "aria-hidden": true,
9619
+ style: {
9620
+ position: "fixed",
9621
+ top: r2.top,
9622
+ left: r2.left,
9623
+ width: r2.width,
9624
+ height: r2.height,
9625
+ background: "rgba(8, 133, 254, 0.04)",
9626
+ pointerEvents: "auto",
9627
+ cursor: "default",
9628
+ zIndex: 2147483200
9629
+ },
9630
+ onClick: (e) => e.stopPropagation()
9398
9631
  },
9399
- onClick: (e) => e.stopPropagation(),
9400
- children: !reviewButtonsHidden && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
9401
- "div",
9402
- {
9403
- style: {
9404
- position: "sticky",
9405
- top: 12,
9406
- display: "flex",
9407
- gap: 8,
9408
- justifyContent: "flex-end",
9409
- paddingRight: 12,
9410
- paddingTop: 12
9411
- },
9412
- children: [
9413
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ReviewButton, { label: "Accept", onClick: () => decide("accept"), background: PRIMARY2, color: "#ffffff", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.Check, { size: 16, strokeWidth: 2.5, "aria-hidden": true }) }),
9414
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ReviewButton, { label: "Discard", onClick: () => decide("discard"), background: "#EFF6FF", color: "#0c0a09", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.X, { size: 16, strokeWidth: 2, "aria-hidden": true }) })
9415
- ]
9632
+ i
9633
+ )),
9634
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
9635
+ "div",
9636
+ {
9637
+ "aria-hidden": true,
9638
+ style: {
9639
+ position: "fixed",
9640
+ top: reviewRect.top,
9641
+ left: reviewRect.left,
9642
+ width: reviewRect.width,
9643
+ height: reviewRect.height,
9644
+ border: `2px solid ${PRIMARY2}`,
9645
+ borderRadius: edgeAwareRadius(reviewRect),
9646
+ pointerEvents: "none",
9647
+ zIndex: 2147483200
9416
9648
  }
9417
- )
9418
- }
9419
- )
9649
+ }
9650
+ ),
9651
+ !reviewButtonsHidden && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
9652
+ "div",
9653
+ {
9654
+ style: {
9655
+ position: "fixed",
9656
+ top: reviewRect.top + 12,
9657
+ left: reviewRect.left,
9658
+ width: reviewRect.width,
9659
+ display: "flex",
9660
+ gap: 8,
9661
+ justifyContent: "flex-end",
9662
+ paddingRight: 12,
9663
+ zIndex: 2147483201
9664
+ },
9665
+ children: [
9666
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ReviewButton, { label: "Accept", onClick: () => decide("accept"), background: PRIMARY2, color: "#ffffff", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.Check, { size: 16, strokeWidth: 2.5, "aria-hidden": true }) }),
9667
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ReviewButton, { label: "Discard", onClick: () => decide("discard"), background: "#EFF6FF", color: "#0c0a09", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.X, { size: 16, strokeWidth: 2, "aria-hidden": true }) })
9668
+ ]
9669
+ }
9670
+ )
9671
+ ] })
9420
9672
  ] });
9421
9673
  }
9422
9674
 
@@ -9886,7 +10138,7 @@ function SectionTreeItem({
9886
10138
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
9887
10139
  "div",
9888
10140
  {
9889
- className: "mr-[-1px] h-9 w-2 shrink-0 rounded-bl-sm border-b border-l border-border mb-4",
10141
+ className: "-mr-px h-9 w-2 shrink-0 rounded-bl-sm border-b border-l border-border mb-4",
9890
10142
  "aria-hidden": true
9891
10143
  }
9892
10144
  ),
@@ -9905,7 +10157,7 @@ function SectionTreeItem({
9905
10157
  className: cn(
9906
10158
  "flex h-9 min-w-0 flex-1 items-center gap-2 rounded-md border border-border bg-background p-3",
9907
10159
  interactive && "cursor-pointer hover:bg-muted/30",
9908
- interactive && selected && "border-primary"
10160
+ interactive && selected && "border-bridge-primary"
9909
10161
  ),
9910
10162
  children: [
9911
10163
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
@@ -10035,7 +10287,7 @@ function UrlOrPageInput({
10035
10287
  };
10036
10288
  const fieldClassName = cn(
10037
10289
  "data-ohw-link-field flex h-[36px] w-full items-center overflow-hidden rounded-md border bg-background pl-3 pr-3 py-2 outline-none transition-[border-color,box-shadow]",
10038
- urlError ? "border-destructive shadow-[0_0_0_1px_var(--ohw-destructive)]" : isFocused ? "border-primary shadow-[0_0_0_1px_var(--ohw-primary)]" : "border-input"
10290
+ urlError ? "border-destructive shadow-[0_0_0_1px_var(--ohw-destructive)]" : isFocused ? "border-bridge-primary shadow-[0_0_0_1px_var(--ohw-primary)]" : "border-input"
10039
10291
  );
10040
10292
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex w-full flex-col gap-2 p-0", children: [
10041
10293
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Label, { htmlFor: inputId, className: cn(urlError && "text-destructive"), children: "Destination" }),
@@ -11079,6 +11331,15 @@ function getNavbarDesktopContainer() {
11079
11331
  function getNavbarDrawerContainer() {
11080
11332
  return document.querySelector("[data-ohw-nav-drawer]");
11081
11333
  }
11334
+ function isNavDrawerOpen() {
11335
+ return document.querySelector('[data-ohw-nav-drawer][data-ohw-section="navbar"]') !== null;
11336
+ }
11337
+ function isPointOutsideOpenDrawer(clientX, clientY) {
11338
+ const drawer = document.querySelector('[data-ohw-nav-drawer][data-ohw-section="navbar"]');
11339
+ if (!drawer) return false;
11340
+ const r2 = drawer.getBoundingClientRect();
11341
+ return clientX < r2.left || clientX > r2.right || clientY < r2.top || clientY > r2.bottom;
11342
+ }
11082
11343
  function isNavbarListContainerVisible(el) {
11083
11344
  if (el.hasAttribute("hidden")) return false;
11084
11345
  if (el.closest("[hidden]")) return false;
@@ -13942,6 +14203,7 @@ function readLogoSizeState(content, placement) {
13942
14203
  function getLogoElement(el) {
13943
14204
  const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
13944
14205
  if (marked) return marked;
14206
+ if (el.closest('[data-ohw-editable="icon"]')) return null;
13945
14207
  const root = el.closest("nav, [data-ohw-nav-root], footer");
13946
14208
  if (!root) return null;
13947
14209
  const anchor = el.closest("a");
@@ -14229,7 +14491,7 @@ function DisplaySwitch({
14229
14491
  onClick: () => onChange(!checked),
14230
14492
  className: cn(
14231
14493
  "relative h-5 w-9 shrink-0 rounded-full transition-colors",
14232
- checked ? "bg-primary" : "bg-primary-50",
14494
+ checked ? "bg-bridge-primary" : "bg-primary-50",
14233
14495
  disabled ? "cursor-default opacity-50" : "cursor-pointer"
14234
14496
  ),
14235
14497
  children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
@@ -14237,7 +14499,7 @@ function DisplaySwitch({
14237
14499
  {
14238
14500
  className: cn(
14239
14501
  "absolute top-0.5 h-4 w-4 rounded-full bg-white transition-all",
14240
- checked ? "left-[1.125rem]" : "left-0.5"
14502
+ checked ? "left-4.5" : "left-0.5"
14241
14503
  )
14242
14504
  }
14243
14505
  )
@@ -15872,7 +16134,7 @@ var badgeVariants = cva(
15872
16134
  {
15873
16135
  variants: {
15874
16136
  variant: {
15875
- default: "border-transparent bg-primary text-primary-foreground",
16137
+ default: "border-transparent bg-bridge-primary text-primary-foreground",
15876
16138
  secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
15877
16139
  destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
15878
16140
  outline: "text-foreground"
@@ -16054,21 +16316,10 @@ function parseSchedulingInsertAfter(insertAfter) {
16054
16316
  insertBefore: insertAfter.slice(idx + INSERT_BEFORE_MARKER.length)
16055
16317
  };
16056
16318
  }
16057
- function resolveSchedulingInsert(insertAfter, explicitInsertBefore) {
16058
- const parsed = parseSchedulingInsertAfter(insertAfter);
16059
- const insertBefore = explicitInsertBefore ?? parsed.insertBefore;
16060
- const effectiveInsertAfter = insertBefore && parsed.insertBefore === null ? `${insertAfter}${INSERT_BEFORE_MARKER}${insertBefore}` : insertAfter;
16061
- return { effectiveInsertAfter, insertBefore };
16062
- }
16063
- function getSchedulingMountPoint(insertAfter) {
16064
- const { anchor } = parseSchedulingInsertAfter(insertAfter);
16065
- let anchorEl = document.querySelector(`[data-ohw-section="${anchor}"]`);
16066
- if (!anchorEl && anchor === "scheduling") {
16067
- const widgets = Array.from(document.querySelectorAll('[data-ohw-section^="scheduling-"]'));
16068
- anchorEl = widgets.at(-1) ?? null;
16069
- }
16070
- if (!anchorEl) return null;
16071
- return anchorEl.closest('[data-ohw-section-container="scheduling"]') ?? anchorEl;
16319
+ function resolveEntryAnchor(entry) {
16320
+ if (entry.anchorId !== void 0) return { anchorId: entry.anchorId, beforeId: entry.beforeId ?? null };
16321
+ const parsed = parseSchedulingInsertAfter(entry.insertAfter);
16322
+ return { anchorId: parsed.anchor, beforeId: parsed.insertBefore };
16072
16323
  }
16073
16324
  function schedulingMountDepth(insertAfter) {
16074
16325
  if (!insertAfter.includes(INSERT_BEFORE_MARKER)) return 0;
@@ -16085,8 +16336,7 @@ function getPageSchedulingEntries(raw) {
16085
16336
  }
16086
16337
  }
16087
16338
  function isSchedulingWidgetMissing(entry) {
16088
- const { effectiveInsertAfter } = resolveSchedulingInsert(entry.insertAfter);
16089
- return !document.querySelector(`[data-ohw-section="${schedulingSectionId(effectiveInsertAfter)}"]`);
16339
+ return !document.querySelector(`[data-ohw-section="${schedulingSectionId(entry.insertAfter)}"]`);
16090
16340
  }
16091
16341
  function hasMissingSchedulingWidgets(entries) {
16092
16342
  return entries.some(isSchedulingWidgetMissing);
@@ -16124,17 +16374,18 @@ function initSectionsFromContent(content, removeExisting = false, currentPath =
16124
16374
  } catch {
16125
16375
  }
16126
16376
  }
16127
- function mountSchedulingWidget(insertAfter, notifyOnConnect = false, scheduleId, explicitInsertBefore) {
16128
- const { effectiveInsertAfter, insertBefore } = resolveSchedulingInsert(insertAfter, explicitInsertBefore);
16129
- const sectionId = schedulingSectionId(effectiveInsertAfter);
16377
+ function mountSchedulingWidget(anchorId, notifyOnConnect = false, scheduleId, beforeId, existingWidgetId) {
16378
+ const widgetId = existingWidgetId ?? (beforeId ? `${anchorId}${INSERT_BEFORE_MARKER}${beforeId}` : anchorId);
16379
+ const sectionId = schedulingSectionId(widgetId);
16130
16380
  if (document.querySelector(`[data-ohw-section="${sectionId}"]`)) return false;
16131
- const mountPoint = getSchedulingMountPoint(effectiveInsertAfter);
16132
- if (!mountPoint) return false;
16381
+ const anchorEl = document.querySelector(`[data-ohw-section="${anchorId}"]`);
16382
+ if (!anchorEl) return false;
16383
+ const mountPoint = anchorEl.closest('[data-ohw-section-container="scheduling"]') ?? anchorEl;
16133
16384
  const container = document.createElement("div");
16134
16385
  container.dataset.ohwSectionContainer = "scheduling";
16135
16386
  container.dataset.ohwInstance = sectionId;
16136
- if (insertBefore) {
16137
- const beforeAnchor = document.querySelector(`[data-ohw-section="${insertBefore}"]`);
16387
+ if (beforeId) {
16388
+ const beforeAnchor = document.querySelector(`[data-ohw-section="${beforeId}"]`);
16138
16389
  const beforePoint = beforeAnchor?.closest('[data-ohw-section-container="scheduling"]') ?? beforeAnchor;
16139
16390
  if (!beforePoint) return false;
16140
16391
  beforePoint.insertAdjacentElement("beforebegin", container);
@@ -16145,20 +16396,26 @@ function mountSchedulingWidget(insertAfter, notifyOnConnect = false, scheduleId,
16145
16396
  }
16146
16397
  tail.insertAdjacentElement("afterend", container);
16147
16398
  }
16148
- const root = (0, import_client2.createRoot)(container);
16149
- schedulingRoots.set(container, root);
16150
- (0, import_react_dom4.flushSync)(() => {
16151
- root.render(
16152
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
16153
- SchedulingWidget,
16154
- {
16155
- notifyOnConnect,
16156
- initialScheduleId: scheduleId,
16157
- insertAfter: effectiveInsertAfter
16158
- }
16159
- )
16160
- );
16161
- });
16399
+ try {
16400
+ const root = (0, import_client2.createRoot)(container);
16401
+ schedulingRoots.set(container, root);
16402
+ (0, import_react_dom4.flushSync)(() => {
16403
+ root.render(
16404
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
16405
+ SchedulingWidget,
16406
+ {
16407
+ notifyOnConnect,
16408
+ initialScheduleId: scheduleId,
16409
+ insertAfter: widgetId
16410
+ }
16411
+ )
16412
+ );
16413
+ });
16414
+ } catch (err) {
16415
+ console.error("[ow:scheduling] render threw", err);
16416
+ container.remove();
16417
+ return false;
16418
+ }
16162
16419
  const tracker = getSectionsTracker();
16163
16420
  let sections = [];
16164
16421
  try {
@@ -16166,10 +16423,12 @@ function mountSchedulingWidget(insertAfter, notifyOnConnect = false, scheduleId,
16166
16423
  } catch {
16167
16424
  }
16168
16425
  const inEditor = typeof window !== "undefined" && window.self !== window.top;
16169
- if (inEditor && !sections.find((s) => s.type === "scheduling" && s.insertAfter === effectiveInsertAfter)) {
16426
+ if (inEditor && !sections.find((s) => s.type === "scheduling" && s.insertAfter === widgetId)) {
16170
16427
  sections.push({
16171
16428
  type: "scheduling",
16172
- insertAfter: effectiveInsertAfter,
16429
+ insertAfter: widgetId,
16430
+ anchorId,
16431
+ beforeId: beforeId ?? null,
16173
16432
  pagePath: window.location.pathname,
16174
16433
  ...scheduleId ? { scheduleId } : {}
16175
16434
  });
@@ -16183,7 +16442,8 @@ function mountSchedulingEntries(entries, notifyOnConnect = false) {
16183
16442
  for (let i = pending.length - 1; i >= 0; i--) {
16184
16443
  const entry = pending[i];
16185
16444
  const shouldNotify = typeof notifyOnConnect === "function" ? notifyOnConnect(entry) : notifyOnConnect;
16186
- if (mountSchedulingWidget(entry.insertAfter, shouldNotify, entry.scheduleId ?? null)) {
16445
+ const { anchorId, beforeId } = resolveEntryAnchor(entry);
16446
+ if (mountSchedulingWidget(anchorId, shouldNotify, entry.scheduleId ?? null, beforeId, entry.insertAfter)) {
16187
16447
  pending.splice(i, 1);
16188
16448
  }
16189
16449
  }
@@ -16347,6 +16607,11 @@ function applyLinkByKey(key, val) {
16347
16607
  hrefAnchors.forEach((el) => applyLinkHref(el, val));
16348
16608
  }
16349
16609
  }
16610
+ function isInsideLinkEditor(target) {
16611
+ return Boolean(
16612
+ target.closest("[data-ohw-link-popover-root]") || target.closest("[data-ohw-link-modal-root]") || target.closest("[data-ohw-link-page-dropdown]") || target.closest("[data-ohw-section-picker]") || target.closest("[data-ohw-navbar-container-chrome]") || target.closest("[data-ohw-navbar-add-button]") || target.closest("[data-ohw-footer-container-chrome]") || target.closest("[data-ohw-footer-add-button]") || target.closest("[data-ohw-more-menu]") || target.closest('[data-slot="dropdown-menu-content"]') || target.closest('[data-slot="popover-content"]') || target.closest('[data-slot="dialog-content"]') || target.closest('[data-slot="dialog-overlay"]')
16613
+ );
16614
+ }
16350
16615
  function isInsideFloatingPanel(target) {
16351
16616
  return Boolean(target.closest("[data-ohw-floating-panel]"));
16352
16617
  }
@@ -16354,11 +16619,6 @@ function isPointOverFloatingPanel(clientX, clientY) {
16354
16619
  const el = document.elementFromPoint(clientX, clientY);
16355
16620
  return Boolean(el instanceof Element && el.closest("[data-ohw-floating-panel]"));
16356
16621
  }
16357
- function isInsideLinkEditor(target) {
16358
- return Boolean(
16359
- target.closest("[data-ohw-link-popover-root]") || target.closest("[data-ohw-link-modal-root]") || target.closest("[data-ohw-link-page-dropdown]") || target.closest("[data-ohw-section-picker]") || target.closest("[data-ohw-navbar-container-chrome]") || target.closest("[data-ohw-navbar-add-button]") || target.closest("[data-ohw-footer-container-chrome]") || target.closest("[data-ohw-footer-add-button]") || target.closest("[data-ohw-more-menu]") || target.closest('[data-slot="dropdown-menu-content"]') || target.closest('[data-slot="popover-content"]') || target.closest('[data-slot="dialog-content"]') || target.closest('[data-slot="dialog-overlay"]')
16360
- );
16361
- }
16362
16622
  function getHrefKeyFromElement(el) {
16363
16623
  if (!el) return null;
16364
16624
  const anchor = el.closest("[data-ohw-href-key]");
@@ -16518,6 +16778,7 @@ function isFooterAddItemDisabled(selected) {
16518
16778
  }
16519
16779
  function resolveFooterColumnSelectionTarget(target, clientX, clientY) {
16520
16780
  if (getNavigationItemAnchor(target)) return null;
16781
+ if (target.closest("[data-ohw-editable]")) return null;
16521
16782
  const column = getFooterColumn(target);
16522
16783
  if (!column) return null;
16523
16784
  if (isPointOverNavItem(column, clientX, clientY)) return null;
@@ -16627,7 +16888,7 @@ function getNavigationSelectionParent(el) {
16627
16888
  if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
16628
16889
  return getFooterLinksContainer();
16629
16890
  }
16630
- if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
16891
+ if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isFooterLinksContainer(el) || isInferredFooterGroup2(el)) {
16631
16892
  return getNavigationRoot(el);
16632
16893
  }
16633
16894
  return null;
@@ -16659,6 +16920,12 @@ function collectNavigationItemSiblingHintRects(selected) {
16659
16920
  return [];
16660
16921
  }).filter((el) => isNavigationItem2(el) && el !== selected).map((el) => el.getBoundingClientRect());
16661
16922
  }
16923
+ if (selected.closest('footer, [data-ohw-section="footer"]')) {
16924
+ const group = findFooterItemGroup2(selected);
16925
+ if (group) {
16926
+ return Array.from(group.querySelectorAll("[data-ohw-href-key]")).filter((el) => isNavigationItem2(el) && el !== selected).map((el) => el.getBoundingClientRect());
16927
+ }
16928
+ }
16662
16929
  return listNavigationItems().filter((el) => el !== selected && !el.closest("[data-ohw-nav-children]")).map((el) => el.getBoundingClientRect());
16663
16930
  }
16664
16931
  function placeCaretAtPoint(el, x, y) {
@@ -16843,7 +17110,6 @@ var ICONS = {
16843
17110
  insertUnorderedList: '<line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/>',
16844
17111
  insertOrderedList: '<line x1="10" y1="6" x2="21" y2="6"/><line x1="10" y1="12" x2="21" y2="12"/><line x1="10" y1="18" x2="21" y2="18"/><path d="M4 6h1v4"/><path d="M4 10h2"/><path d="M6 18H4c0-1 2-2 2-3s-1-1.5-2-1"/>'
16845
17112
  };
16846
- var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
16847
17113
  var SELECTION_CHROME_GAP2 = 4;
16848
17114
  var TOOLBAR_STROKE_GAP2 = 4;
16849
17115
  var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
@@ -17227,6 +17493,7 @@ function StateToggle({
17227
17493
  );
17228
17494
  }
17229
17495
  var contentCache = /* @__PURE__ */ new Map();
17496
+ var fetchedContentPaths = /* @__PURE__ */ new Set();
17230
17497
  var brandingCache = /* @__PURE__ */ new Map();
17231
17498
  var OHW_LOADER_STYLE = {
17232
17499
  position: "fixed",
@@ -17348,19 +17615,37 @@ function MadeWithOhhWells() {
17348
17615
  }
17349
17616
  );
17350
17617
  }
17351
- var OHW_LOADER_PREHYDRATE_SCRIPT = `(function(){try{var p=location.hostname.split(".");var fromHost=p.length>=3&&p[0]!=="www"?p[0]:"";var fromQuery=new URLSearchParams(location.search).get("subdomain")||"";if(!fromHost&&!fromQuery)return;var e=document.getElementById("ohw-loader");if(e)e.style.display="flex"}catch(e){}})();`;
17618
+ var OHW_LOADER_PREHYDRATE_SCRIPT = `(function(){try{var fromGlobal=typeof window!=="undefined"&&window.__OHW_SUBDOMAIN__?String(window.__OHW_SUBDOMAIN__):"";var p=location.hostname.split(".");var fromHost=location.hostname.endsWith(".ohhwells.site")&&p[0]&&p[0]!=="www"?p[0]:"";var fromQuery=new URLSearchParams(location.search).get("subdomain")||"";var fromCookie=(document.cookie.match(/(?:^|; )ohw-subdomain=([^;]*)/)||[])[1];fromCookie=fromCookie?decodeURIComponent(fromCookie):"";if(!fromGlobal&&!fromHost&&!fromQuery&&!fromCookie)return;var e=document.getElementById("ohw-loader");if(e)e.style.display="flex"}catch(e){}})();`;
17619
+ function subdomainFromCookie() {
17620
+ if (typeof document === "undefined") return "";
17621
+ const match = document.cookie.match(/(?:^|; )ohw-subdomain=([^;]*)/);
17622
+ return match ? decodeURIComponent(match[1]) : "";
17623
+ }
17352
17624
  function resolveSubdomain(subdomainFromQuery) {
17625
+ if (typeof window !== "undefined") {
17626
+ const fromGlobal = window.__OHW_SUBDOMAIN__;
17627
+ if (fromGlobal) return fromGlobal;
17628
+ }
17353
17629
  if (subdomainFromQuery) return subdomainFromQuery;
17354
17630
  if (typeof window !== "undefined") {
17355
- const parts = window.location.hostname.split(".");
17356
- if (parts.length >= 3 && parts[0] !== "www") return parts[0];
17631
+ const host = window.location.hostname.toLowerCase();
17632
+ if (host.endsWith(".ohhwells.site")) {
17633
+ const label = host.slice(0, -".ohhwells.site".length).split(".").pop();
17634
+ if (label && label !== "www") return label;
17635
+ }
17636
+ const fromCookie = subdomainFromCookie();
17637
+ if (fromCookie) return fromCookie;
17638
+ const isPlatformHost = host.endsWith(".ohhwells.site") || host === "localhost" || host.endsWith(".localhost") || host.endsWith(".vercel.app");
17639
+ if (!isPlatformHost) return "";
17357
17640
  }
17358
17641
  const siteUrl = process.env.NEXT_PUBLIC_SITE_URL;
17359
17642
  if (siteUrl) {
17360
17643
  try {
17361
17644
  const host = new URL(siteUrl).hostname;
17362
- const siteParts = host.split(".");
17363
- if (siteParts.length >= 3 && siteParts[0] !== "www") return siteParts[0];
17645
+ if (host.endsWith(".ohhwells.site")) {
17646
+ const label = host.slice(0, -".ohhwells.site".length).split(".").pop();
17647
+ if (label && label !== "www") return label;
17648
+ }
17364
17649
  } catch {
17365
17650
  }
17366
17651
  }
@@ -17398,7 +17683,26 @@ function OhhwellsBridge() {
17398
17683
  };
17399
17684
  }, []);
17400
17685
  const subdomainFromQuery = searchParams.get("subdomain");
17401
- const subdomain = resolveSubdomain(subdomainFromQuery);
17686
+ const [subdomain, setSubdomain] = (0, import_react17.useState)(() => resolveSubdomain(subdomainFromQuery));
17687
+ (0, import_react17.useLayoutEffect)(() => {
17688
+ const next = resolveSubdomain(subdomainFromQuery);
17689
+ if (next !== subdomain) setSubdomain(next);
17690
+ if (next) return;
17691
+ const host = window.location.hostname.toLowerCase();
17692
+ if (host.endsWith(".ohhwells.site")) return;
17693
+ const t = window.setTimeout(() => {
17694
+ const retry = resolveSubdomain(subdomainFromQuery);
17695
+ if (retry) setSubdomain(retry);
17696
+ }, 0);
17697
+ return () => window.clearTimeout(t);
17698
+ }, [subdomainFromQuery, subdomain]);
17699
+ (0, import_react17.useEffect)(() => {
17700
+ if (!subdomainFromQuery || typeof window === "undefined") return;
17701
+ const url = new URL(window.location.href);
17702
+ if (!url.searchParams.has("subdomain")) return;
17703
+ url.searchParams.delete("subdomain");
17704
+ window.history.replaceState(null, "", url.pathname + url.search + url.hash);
17705
+ }, [subdomainFromQuery]);
17402
17706
  useLinkHrefGuardian(pathname, subdomain, isEditMode);
17403
17707
  useSavedLinkNavigation(isEditMode);
17404
17708
  const postToParent2 = (0, import_react17.useCallback)((data) => {
@@ -17775,13 +18079,6 @@ function OhhwellsBridge() {
17775
18079
  const [isItemDragging, setIsItemDragging] = (0, import_react17.useState)(false);
17776
18080
  const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react17.useState)(false);
17777
18081
  isFooterFrameSelectionRef.current = isFooterFrameSelection;
17778
- const [floatingPanel, setFloatingPanel] = (0, import_react17.useState)(null);
17779
- const floatingPanelOpenRef = (0, import_react17.useRef)(false);
17780
- floatingPanelOpenRef.current = floatingPanel !== null;
17781
- const [floatingPanelPos, setFloatingPanelPos] = (0, import_react17.useState)(null);
17782
- const [logoSizeDraft, setLogoSizeDraft] = (0, import_react17.useState)(null);
17783
- const [editorViewport, setEditorViewport] = (0, import_react17.useState)("desktop");
17784
- const [parentScrollSnap, setParentScrollSnap] = (0, import_react17.useState)(null);
17785
18082
  const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react17.useState)(null);
17786
18083
  const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react17.useState)(null);
17787
18084
  const footerDragRef = (0, import_react17.useRef)(null);
@@ -17798,7 +18095,15 @@ function OhhwellsBridge() {
17798
18095
  const aiSectionsRef = (0, import_react17.useRef)("");
17799
18096
  const brandKitRef = (0, import_react17.useRef)("");
17800
18097
  const stylesRef = (0, import_react17.useRef)("");
18098
+ const appliedDrawerRef = (0, import_react17.useRef)(null);
17801
18099
  const pendingDeleteUndoRef = (0, import_react17.useRef)(null);
18100
+ const [floatingPanel, setFloatingPanel] = (0, import_react17.useState)(null);
18101
+ const floatingPanelOpenRef = (0, import_react17.useRef)(false);
18102
+ const setFloatingPanelRef = (0, import_react17.useRef)(setFloatingPanel);
18103
+ const [floatingPanelPos, setFloatingPanelPos] = (0, import_react17.useState)(null);
18104
+ const [logoSizeDraft, setLogoSizeDraft] = (0, import_react17.useState)(null);
18105
+ const [editorViewport, setEditorViewport] = (0, import_react17.useState)("desktop");
18106
+ const [parentScrollSnap, setParentScrollSnap] = (0, import_react17.useState)(null);
17802
18107
  const [sitePages, setSitePages] = (0, import_react17.useState)([]);
17803
18108
  const [sectionsByPath, setSectionsByPath] = (0, import_react17.useState)({});
17804
18109
  const sectionsPrefetchGenRef = (0, import_react17.useRef)(0);
@@ -17807,7 +18112,18 @@ function OhhwellsBridge() {
17807
18112
  const linkPopoverOpenRef = (0, import_react17.useRef)(false);
17808
18113
  const linkPopoverGraceUntilRef = (0, import_react17.useRef)(0);
17809
18114
  setLinkPopoverRef.current = setLinkPopover;
18115
+ setFloatingPanelRef.current = setFloatingPanel;
17810
18116
  linkPopoverSessionRef.current = linkPopover;
18117
+ floatingPanelOpenRef.current = Boolean(floatingPanel);
18118
+ (0, import_react17.useEffect)(() => {
18119
+ const syncViewport = () => {
18120
+ const next = window.innerWidth <= 480 ? "mobile" : "desktop";
18121
+ setEditorViewport((prev) => prev === next ? prev : next);
18122
+ };
18123
+ syncViewport();
18124
+ window.addEventListener("resize", syncViewport);
18125
+ return () => window.removeEventListener("resize", syncViewport);
18126
+ }, []);
17811
18127
  const {
17812
18128
  navDragRef,
17813
18129
  navPointerDragRef,
@@ -19143,6 +19459,7 @@ function OhhwellsBridge() {
19143
19459
  }
19144
19460
  if (typeof content[STYLE_STORE_KEY] === "string") {
19145
19461
  stylesRef.current = content[STYLE_STORE_KEY];
19462
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
19146
19463
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
19147
19464
  }
19148
19465
  applyBrandChrome(content);
@@ -19150,11 +19467,11 @@ function OhhwellsBridge() {
19150
19467
  for (const [key, val] of Object.entries(content)) {
19151
19468
  if (key === "__ohw_sections") continue;
19152
19469
  if (key === AI_SECTIONS_KEY) continue;
19470
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
19471
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
19153
19472
  if (key === BRAND_KIT_KEY) continue;
19154
19473
  if (key === STYLE_STORE_KEY) continue;
19155
19474
  if (BRAND_CHROME_KEYS.has(key)) continue;
19156
- if (key === LOGO_PLACEHOLDER_KEY) continue;
19157
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
19158
19475
  if (applyVideoSettingNode(key, val)) continue;
19159
19476
  if (applyCarouselNode(key, val)) continue;
19160
19477
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -19225,7 +19542,9 @@ function OhhwellsBridge() {
19225
19542
  let cancelled = false;
19226
19543
  setFetchState("loading");
19227
19544
  const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
19228
- fetch(`${apiUrl}/api/public/sites/${subdomain}/content`, { cache: "no-store" }).then((r2) => r2.ok ? r2.json() : null).then((data) => {
19545
+ const initialPath = pathname;
19546
+ fetchedContentPaths.add(`${subdomain}::${initialPath}`);
19547
+ fetch(`${apiUrl}/api/public/sites/${subdomain}/content?path=${encodeURIComponent(initialPath)}`, { cache: "no-store" }).then((r2) => r2.ok ? r2.json() : null).then((data) => {
19229
19548
  if (cancelled) return;
19230
19549
  const content = data?.content ?? {};
19231
19550
  const branding = Boolean(data?.showBranding);
@@ -19334,7 +19653,9 @@ function OhhwellsBridge() {
19334
19653
  }, [isEditMode]);
19335
19654
  (0, import_react17.useEffect)(() => {
19336
19655
  if (isEditMode || fetchState !== "done") return;
19656
+ console.log("env", process.env.NEXT_PUBLIC_FLOWOPS_API_URL);
19337
19657
  const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
19658
+ console.log({ apiUrl, subdomain });
19338
19659
  bindPublishedForms(apiUrl, subdomain, contentCache.get(subdomain) ?? {});
19339
19660
  }, [isEditMode, fetchState, subdomain]);
19340
19661
  (0, import_react17.useEffect)(() => {
@@ -19359,16 +19680,17 @@ function OhhwellsBridge() {
19359
19680
  applyAiSectionsToDom(parseAiSectionsState(content[AI_SECTIONS_KEY]));
19360
19681
  }
19361
19682
  if (typeof content[STYLE_STORE_KEY] === "string") {
19683
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
19362
19684
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
19363
19685
  }
19364
19686
  for (const [key, val] of Object.entries(content)) {
19365
19687
  if (key === "__ohw_sections") continue;
19366
19688
  if (key === AI_SECTIONS_KEY) continue;
19689
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
19690
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
19367
19691
  if (key === BRAND_KIT_KEY) continue;
19368
19692
  if (key === STYLE_STORE_KEY) continue;
19369
19693
  if (BRAND_CHROME_KEYS.has(key)) continue;
19370
- if (key === LOGO_PLACEHOLDER_KEY) continue;
19371
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
19372
19694
  if (applyVideoSettingNode(key, val)) continue;
19373
19695
  if (applyCarouselNode(key, val)) continue;
19374
19696
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -19419,6 +19741,17 @@ function OhhwellsBridge() {
19419
19741
  debounceTimer = setTimeout(applyFromCache, 150);
19420
19742
  };
19421
19743
  applyFromCache();
19744
+ const pathCacheKey = `${subdomain}::${pathname}`;
19745
+ if (!fetchedContentPaths.has(pathCacheKey)) {
19746
+ fetchedContentPaths.add(pathCacheKey);
19747
+ const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
19748
+ fetch(`${apiUrl}/api/public/sites/${subdomain}/content?path=${encodeURIComponent(pathname)}`, { cache: "no-store" }).then((r2) => r2.ok ? r2.json() : null).then((data) => {
19749
+ if (!data?.content) return;
19750
+ contentCache.set(subdomain, data.content);
19751
+ applyFromCache();
19752
+ }).catch(() => {
19753
+ });
19754
+ }
19422
19755
  observer = new MutationObserver(scheduleApply);
19423
19756
  observer.observe(document.body, { childList: true, subtree: true });
19424
19757
  return () => {
@@ -19463,6 +19796,17 @@ function OhhwellsBridge() {
19463
19796
  if (!isEditMode) return;
19464
19797
  initSectionInstancesFromContent(editContentRef.current, pathname);
19465
19798
  }, [pathname, isEditMode]);
19799
+ (0, import_react17.useEffect)(() => {
19800
+ if (!isEditMode) return;
19801
+ const observer = new MutationObserver(() => {
19802
+ const drawer = document.querySelector("[data-ohw-nav-drawer]");
19803
+ if (!drawer || drawer === appliedDrawerRef.current) return;
19804
+ appliedDrawerRef.current = drawer;
19805
+ applyStylesToDom(parseStyleStore(stylesRef.current));
19806
+ });
19807
+ observer.observe(document.body, { childList: true, subtree: true });
19808
+ return () => observer.disconnect();
19809
+ }, [isEditMode, pathname]);
19466
19810
  (0, import_react17.useEffect)(() => {
19467
19811
  const contentForNav = () => {
19468
19812
  if (isEditMode) return editContentRef.current;
@@ -19554,26 +19898,11 @@ function OhhwellsBridge() {
19554
19898
  const t2 = setTimeout(measure, 500);
19555
19899
  const ro = new ResizeObserver(schedule);
19556
19900
  ro.observe(document.body);
19557
- let lastWidth = window.innerWidth;
19558
- let resizeTimers = [];
19559
- const clearResizeTimers = () => {
19560
- resizeTimers.forEach(clearTimeout);
19561
- resizeTimers = [];
19562
- };
19563
- const handleResize = () => {
19564
- if (window.innerWidth === lastWidth) return;
19565
- lastWidth = window.innerWidth;
19566
- clearResizeTimers();
19567
- resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
19568
- };
19569
- window.addEventListener("resize", handleResize);
19570
19901
  return () => {
19571
19902
  clearTimeout(t1);
19572
19903
  clearTimeout(t2);
19573
19904
  if (raf != null) cancelAnimationFrame(raf);
19574
19905
  ro.disconnect();
19575
- clearResizeTimers();
19576
- window.removeEventListener("resize", handleResize);
19577
19906
  };
19578
19907
  }, [pathname, isEditMode, postToParent2]);
19579
19908
  (0, import_react17.useEffect)(() => {
@@ -19868,9 +20197,6 @@ function OhhwellsBridge() {
19868
20197
  if (target.closest("[data-ohw-state-toggle]")) return;
19869
20198
  if (target.closest("[data-ohw-max-badge]")) return;
19870
20199
  if (isInsideLinkEditor(target)) return;
19871
- if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
19872
- clearMediaSelectionRef.current();
19873
- }
19874
20200
  if (isInsideFloatingPanel(target)) return;
19875
20201
  if (target.closest("[data-ohw-form-toolbar]")) return;
19876
20202
  if (target.closest(
@@ -19878,6 +20204,9 @@ function OhhwellsBridge() {
19878
20204
  )) {
19879
20205
  return;
19880
20206
  }
20207
+ if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
20208
+ clearMediaSelectionRef.current();
20209
+ }
19881
20210
  {
19882
20211
  const formEl = getFormElement(target);
19883
20212
  const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
@@ -20041,14 +20370,6 @@ function OhhwellsBridge() {
20041
20370
  }
20042
20371
  const clickedButton = findClosestButtonLike(target);
20043
20372
  const buttonOnMedia = Boolean(clickedButton && isMediaEditable(editable) && editable.contains(clickedButton));
20044
- console.log("[click-debug]", {
20045
- editableType: editable.dataset.ohwEditable,
20046
- editableTag: editable.tagName,
20047
- targetTag: target.tagName,
20048
- clickedButtonTag: clickedButton?.tagName ?? null,
20049
- buttonOnMedia,
20050
- isMediaEditableEditable: isMediaEditable(editable)
20051
- });
20052
20373
  if (isMediaEditable(editable) && !buttonOnMedia) {
20053
20374
  e.preventDefault();
20054
20375
  e.stopPropagation();
@@ -20075,11 +20396,6 @@ function OhhwellsBridge() {
20075
20396
  const hrefLookupTarget = buttonOnMedia ? clickedButton : editable;
20076
20397
  const hrefCtx = getHrefKeyFromElement(hrefLookupTarget);
20077
20398
  const navAnchor = hrefCtx ? getNavigationItemAnchor(hrefCtx.anchor) : null;
20078
- console.log("[click-debug 2]", {
20079
- hrefLookupTargetTag: hrefLookupTarget.tagName,
20080
- hrefCtx: hrefCtx ? { key: hrefCtx.key } : null,
20081
- navAnchorTag: navAnchor?.tagName ?? null
20082
- });
20083
20399
  if (navAnchor) {
20084
20400
  e.preventDefault();
20085
20401
  e.stopPropagation();
@@ -20121,7 +20437,7 @@ function OhhwellsBridge() {
20121
20437
  return;
20122
20438
  }
20123
20439
  const footerColClick = target.closest("[data-ohw-footer-col]");
20124
- if (footerColClick) {
20440
+ if (footerColClick && !target.closest("[data-ohw-editable]")) {
20125
20441
  e.preventDefault();
20126
20442
  e.stopPropagation();
20127
20443
  selectFrameRef.current(footerColClick);
@@ -20224,6 +20540,19 @@ function OhhwellsBridge() {
20224
20540
  const handleMouseOver = (e) => {
20225
20541
  if (document.documentElement.hasAttribute("data-ohw-section-picking")) return;
20226
20542
  const target = e.target;
20543
+ if (isNavDrawerOpen() && isPointOutsideOpenDrawer(e.clientX, e.clientY)) {
20544
+ document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
20545
+ hoveredItemElRef.current = null;
20546
+ setHoveredItemRect(null);
20547
+ hoveredNavContainerRef.current = null;
20548
+ setHoveredNavContainerRect(null);
20549
+ formHoverElRef.current = null;
20550
+ setFormHoverRect(null);
20551
+ siblingHintElRef.current = null;
20552
+ setSiblingHintRect(null);
20553
+ setSiblingHintRects([]);
20554
+ return;
20555
+ }
20227
20556
  if (linkPopoverOpenRef.current) {
20228
20557
  hoveredItemElRef.current = null;
20229
20558
  setHoveredItemRect(null);
@@ -20249,6 +20578,9 @@ function OhhwellsBridge() {
20249
20578
  setHoveredItemRect(null);
20250
20579
  hoveredNavContainerRef.current = null;
20251
20580
  setHoveredNavContainerRect(null);
20581
+ siblingHintElRef.current = null;
20582
+ setSiblingHintRect(null);
20583
+ setSiblingHintRects([]);
20252
20584
  return;
20253
20585
  }
20254
20586
  {
@@ -20280,7 +20612,7 @@ function OhhwellsBridge() {
20280
20612
  const navContainer = target.closest("[data-ohw-nav-container]");
20281
20613
  if (!navContainer) {
20282
20614
  const footerLinks = target.closest("[data-ohw-footer-links], .rb-footer-links") ?? null;
20283
- if (footerLinks && selected2 !== footerLinks && !getNavigationItemAnchor(target) && !target.closest("[data-ohw-footer-col], [data-ohw-footer-column]")) {
20615
+ if (footerLinks && selected2 !== footerLinks && !getNavigationItemAnchor(target) && !target.closest("[data-ohw-footer-col], [data-ohw-footer-column]") && !target.closest("[data-ohw-editable]")) {
20284
20616
  hoveredNavContainerRef.current = footerLinks;
20285
20617
  setHoveredNavContainerRect(footerLinks.getBoundingClientRect());
20286
20618
  hoveredItemElRef.current = null;
@@ -20318,7 +20650,7 @@ function OhhwellsBridge() {
20318
20650
  return;
20319
20651
  }
20320
20652
  const footerCol = target.closest("[data-ohw-footer-col]") ?? target.closest("[data-ohw-footer-column]");
20321
- if (footerCol) {
20653
+ if (footerCol && !target.closest("[data-ohw-editable]")) {
20322
20654
  hoveredNavContainerRef.current = null;
20323
20655
  setHoveredNavContainerRect(null);
20324
20656
  if (selectedElRef.current === footerCol) return;
@@ -20369,7 +20701,6 @@ function OhhwellsBridge() {
20369
20701
  hoveredNavContainerRef.current = null;
20370
20702
  setHoveredNavContainerRect(null);
20371
20703
  hoveredItemElRef.current = editable;
20372
- setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
20373
20704
  }
20374
20705
  }
20375
20706
  }
@@ -20666,7 +20997,7 @@ function OhhwellsBridge() {
20666
20997
  }
20667
20998
  };
20668
20999
  const probeImageAt = (clientX, clientY, isDragOver = false, fromParentViewport = false) => {
20669
- if (linkPopoverOpenRef.current) {
21000
+ if (linkPopoverOpenRef.current || floatingPanelOpenRef.current && isPointOverFloatingPanel(clientX, clientY)) {
20670
21001
  if (hoveredImageRef.current) {
20671
21002
  hoveredImageRef.current = null;
20672
21003
  hoveredImageHasTextOverlapRef.current = false;
@@ -21039,7 +21370,31 @@ function OhhwellsBridge() {
21039
21370
  };
21040
21371
  const handleMouseMove = (e) => {
21041
21372
  const { clientX, clientY } = e;
21042
- if (pointOwnedByFloatingPanel(clientX, clientY)) return;
21373
+ if (pointOwnedByFloatingPanel(clientX, clientY)) {
21374
+ dismissImageHover();
21375
+ clearImageHover();
21376
+ return;
21377
+ }
21378
+ if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
21379
+ document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
21380
+ formHoverElRef.current = null;
21381
+ setFormHoverRect(null);
21382
+ hoveredItemElRef.current = null;
21383
+ setHoveredItemRect(null);
21384
+ hoveredNavContainerRef.current = null;
21385
+ setHoveredNavContainerRect(null);
21386
+ dismissImageHover();
21387
+ if (hoveredGapRef.current) {
21388
+ hoveredGapRef.current = null;
21389
+ setSectionGap(null);
21390
+ }
21391
+ if (activeStateElRef.current) {
21392
+ activeStateElRef.current.removeAttribute("data-ohw-state-hovered");
21393
+ activeStateElRef.current = null;
21394
+ setToggleState(null);
21395
+ }
21396
+ return;
21397
+ }
21043
21398
  if (isOverEditorChrome(clientX, clientY)) {
21044
21399
  document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
21045
21400
  formHoverElRef.current = null;
@@ -21048,7 +21403,12 @@ function OhhwellsBridge() {
21048
21403
  setHoveredItemRect(null);
21049
21404
  hoveredNavContainerRef.current = null;
21050
21405
  setHoveredNavContainerRect(null);
21406
+ siblingHintElRef.current = null;
21407
+ setSiblingHintRect(null);
21408
+ setSiblingHintRects([]);
21051
21409
  dismissImageHover();
21410
+ clearImageHover();
21411
+ setSectionGap(null);
21052
21412
  return;
21053
21413
  }
21054
21414
  if (probeSocialsRowAt(clientX, clientY)) return;
@@ -21060,7 +21420,12 @@ function OhhwellsBridge() {
21060
21420
  if (e.data?.type !== "ow:pointer-sync") return;
21061
21421
  const { clientX, clientY } = e.data;
21062
21422
  if (typeof clientX !== "number" || typeof clientY !== "number") return;
21063
- if (pointOwnedByFloatingPanel(clientX, clientY)) return;
21423
+ if (pointOwnedByFloatingPanel(clientX, clientY)) {
21424
+ dismissImageHover();
21425
+ clearImageHover();
21426
+ return;
21427
+ }
21428
+ if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
21064
21429
  if (probeSocialsRowAt(clientX, clientY)) return;
21065
21430
  probeSectionGapAt(clientX, clientY);
21066
21431
  probeImageAt(clientX, clientY);
@@ -21399,6 +21764,7 @@ function OhhwellsBridge() {
21399
21764
  }
21400
21765
  if (typeof content[STYLE_STORE_KEY] === "string") {
21401
21766
  stylesRef.current = content[STYLE_STORE_KEY];
21767
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
21402
21768
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
21403
21769
  }
21404
21770
  applyBrandChrome(content);
@@ -21410,11 +21776,11 @@ function OhhwellsBridge() {
21410
21776
  continue;
21411
21777
  }
21412
21778
  if (key === AI_SECTIONS_KEY) continue;
21779
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
21780
+ if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
21413
21781
  if (key === BRAND_KIT_KEY) continue;
21414
21782
  if (key === STYLE_STORE_KEY) continue;
21415
21783
  if (BRAND_CHROME_KEYS.has(key)) continue;
21416
- if (key === LOGO_PLACEHOLDER_KEY) continue;
21417
- if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
21418
21784
  if (applyVideoSettingNode(key, val)) continue;
21419
21785
  if (applyCarouselNode(key, val)) continue;
21420
21786
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -21639,10 +22005,26 @@ function OhhwellsBridge() {
21639
22005
  const handleGetBrand = (e) => {
21640
22006
  if (e.data?.type !== "ow:get-brand") return;
21641
22007
  const template = deriveTemplateBrand();
21642
- const value = brandKitRef.current || (template ? JSON.stringify(template) : "");
22008
+ const fallback = template ?? (() => {
22009
+ const fonts = deriveTemplateFonts();
22010
+ return fonts ? { palette: AI_DEFAULT_BRAND.palette, fonts } : null;
22011
+ })();
22012
+ const value = brandKitRef.current || (fallback ? JSON.stringify(fallback) : "");
21643
22013
  postToParentRef.current({ type: "ow:brand-value", value });
21644
22014
  };
21645
22015
  window.addEventListener("message", handleGetBrand);
22016
+ const handleGetTemplateFonts = (e) => {
22017
+ if (e.data?.type !== "ow:get-template-fonts") return;
22018
+ const fonts = deriveTemplateFonts();
22019
+ postToParentRef.current({ type: "ow:template-fonts-value", value: fonts ? JSON.stringify(fonts) : "" });
22020
+ };
22021
+ window.addEventListener("message", handleGetTemplateFonts);
22022
+ const handleGetTemplateBrand = (e) => {
22023
+ if (e.data?.type !== "ow:get-template-brand") return;
22024
+ const brand = deriveTemplateBrand();
22025
+ postToParentRef.current({ type: "ow:template-brand-value", value: brand ? JSON.stringify(brand) : "" });
22026
+ };
22027
+ window.addEventListener("message", handleGetTemplateBrand);
21646
22028
  const handleMoveSection = (e) => {
21647
22029
  if (e.data?.type !== "ow:move-section") return;
21648
22030
  const instanceId = typeof e.data.instanceId === "string" ? e.data.instanceId : "";
@@ -21835,6 +22217,12 @@ function OhhwellsBridge() {
21835
22217
  closeLinkPopoverRef.current();
21836
22218
  return;
21837
22219
  }
22220
+ if (floatingPanelOpenRef.current) {
22221
+ setFloatingPanelRef.current(null);
22222
+ deselectRef.current();
22223
+ deactivateRef.current();
22224
+ return;
22225
+ }
21838
22226
  deselectRef.current();
21839
22227
  deactivateRef.current();
21840
22228
  clearMediaSelectionRef.current();
@@ -22123,8 +22511,12 @@ function OhhwellsBridge() {
22123
22511
  if (inserted) {
22124
22512
  const tracker = getSectionsTracker();
22125
22513
  postToParentRef.current({ type: "ow:change", nodes: [{ key: "__ohw_sections", text: tracker.textContent ?? "[]" }] });
22126
- const h = document.body.scrollHeight;
22127
- if (h > 50) postToParentRef.current({ type: "ow:height", height: h });
22514
+ const reportHeight = () => {
22515
+ const h = document.body.scrollHeight;
22516
+ if (h > 50) postToParentRef.current({ type: "ow:height", height: h });
22517
+ };
22518
+ reportHeight();
22519
+ setTimeout(reportHeight, 500);
22128
22520
  }
22129
22521
  };
22130
22522
  const handleSwitchSchedule = (e) => {
@@ -22545,15 +22937,17 @@ function OhhwellsBridge() {
22545
22937
  window.removeEventListener("message", handleAiSetBrand);
22546
22938
  window.removeEventListener("message", handleAiSetStyles);
22547
22939
  window.removeEventListener("message", handleGetBrand);
22940
+ window.removeEventListener("message", handleGetTemplateFonts);
22941
+ window.removeEventListener("message", handleGetTemplateBrand);
22548
22942
  window.removeEventListener("message", handleMoveSection);
22549
22943
  window.removeEventListener("message", handlePanelDragging);
22550
22944
  window.removeEventListener("message", handleDeleteSection);
22551
22945
  window.removeEventListener("message", handleDuplicateSection);
22552
22946
  window.removeEventListener("message", handleDeactivate);
22553
- document.documentElement.removeAttribute("data-ohw-panel-dragging");
22554
22947
  window.removeEventListener("message", handleToastAction);
22555
22948
  window.removeEventListener("message", handleFormCount);
22556
22949
  window.removeEventListener("message", handleUiEscape);
22950
+ document.documentElement.removeAttribute("data-ohw-panel-dragging");
22557
22951
  autoSaveTimers.current.forEach(clearTimeout);
22558
22952
  autoSaveTimers.current.clear();
22559
22953
  if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
@@ -22756,7 +23150,7 @@ function OhhwellsBridge() {
22756
23150
  postToParent2({
22757
23151
  type: "ow:ready",
22758
23152
  version: "1",
22759
- bridgeVersion: "0.1.111",
23153
+ bridgeVersion: "0.1.113",
22760
23154
  path: pathname,
22761
23155
  nodes: collectEditableNodes(editContentRef.current),
22762
23156
  sections
@@ -23372,7 +23766,7 @@ function OhhwellsBridge() {
23372
23766
  "span",
23373
23767
  {
23374
23768
  "data-ohw-form-count": "",
23375
- className: "ml-0.5 inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-primary px-1.5 text-[11px] font-semibold text-primary-foreground",
23769
+ className: "ml-0.5 inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-bridge-primary px-1.5 text-[11px] font-semibold text-primary-foreground",
23376
23770
  children: formPickCount
23377
23771
  }
23378
23772
  )
@@ -23610,11 +24004,11 @@ function OhhwellsBridge() {
23610
24004
  className: "fixed left-0 w-full z-2147483646 flex items-center pointer-events-none",
23611
24005
  style: { top: sectionGap.y, transform: "translateY(-50%)" },
23612
24006
  children: [
23613
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex-1 bg-primary", style: { height: 3 } }),
24007
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex-1 bg-bridge-primary", style: { height: 3 } }),
23614
24008
  /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
23615
24009
  Badge,
23616
24010
  {
23617
- className: "px-8 py-1 bg-primary hover:bg-primary text-primary-foreground text-xs font-medium shrink-0 rounded-full cursor-pointer pointer-events-auto",
24011
+ className: "px-8 py-1 bg-bridge-primary hover:bg-bridge-primary text-primary-foreground text-xs font-medium shrink-0 rounded-full cursor-pointer pointer-events-auto",
23618
24012
  onClick: () => {
23619
24013
  window.parent.postMessage(
23620
24014
  {
@@ -23628,7 +24022,7 @@ function OhhwellsBridge() {
23628
24022
  children: "Add Section"
23629
24023
  }
23630
24024
  ),
23631
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex-1 bg-primary", style: { height: 3 } })
24025
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex-1 bg-bridge-primary", style: { height: 3 } })
23632
24026
  ]
23633
24027
  }
23634
24028
  ),
@@ -23676,6 +24070,59 @@ function OhhwellsBridge() {
23676
24070
  ) : null
23677
24071
  ] });
23678
24072
  }
24073
+
24074
+ // src/ui/EmptySection.tsx
24075
+ var import_link = __toESM(require("next/link"), 1);
24076
+ var import_jsx_runtime34 = require("react/jsx-runtime");
24077
+ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey }) {
24078
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
24079
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
24080
+ "p",
24081
+ {
24082
+ style: {
24083
+ fontFamily: "var(--brand-font-body)",
24084
+ fontSize: "0.75rem",
24085
+ fontWeight: 500,
24086
+ letterSpacing: "0.15em",
24087
+ textTransform: "uppercase",
24088
+ color: "var(--brand-accent)",
24089
+ marginBottom: "1.5rem"
24090
+ },
24091
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_link.default, { href: homeHref, style: { color: "inherit" }, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { ...eyebrowKey ? { "data-ohw-editable": "text", "data-ohw-key": eyebrowKey } : {}, children: "Home" }) })
24092
+ }
24093
+ ),
24094
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
24095
+ "h1",
24096
+ {
24097
+ style: {
24098
+ fontFamily: "var(--brand-font-heading)",
24099
+ fontSize: "clamp(2rem, 3.5vw, 2.75rem)",
24100
+ lineHeight: 1.1,
24101
+ letterSpacing: "-0.025em",
24102
+ color: "var(--brand-text)",
24103
+ marginBottom: "1rem"
24104
+ },
24105
+ ...titleKey ? { "data-ohw-editable": "text", "data-ohw-key": titleKey, "data-ohw-max-length": 80 } : {},
24106
+ children: title
24107
+ }
24108
+ ),
24109
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
24110
+ "p",
24111
+ {
24112
+ style: {
24113
+ fontFamily: "var(--brand-font-body)",
24114
+ fontSize: "1rem",
24115
+ lineHeight: 1.7,
24116
+ fontWeight: 300,
24117
+ color: "var(--brand-text-muted)",
24118
+ maxWidth: "340px"
24119
+ },
24120
+ ...subtitleKey ? { "data-ohw-editable": "text", "data-ohw-key": subtitleKey, "data-ohw-max-length": 160 } : {},
24121
+ children: "This page doesn't have any content yet."
24122
+ }
24123
+ )
24124
+ ] });
24125
+ }
23679
24126
  // Annotate the CommonJS export names for ESM import in node:
23680
24127
  0 && (module.exports = {
23681
24128
  AI_DEFAULT_BRAND,
@@ -23693,6 +24140,7 @@ function OhhwellsBridge() {
23693
24140
  DropdownMenuItem,
23694
24141
  DropdownMenuSeparator,
23695
24142
  DropdownMenuTrigger,
24143
+ EmptySection,
23696
24144
  ItemActionToolbar,
23697
24145
  ItemInteractionLayer,
23698
24146
  LinkEditorPanel,