@ohhwells/bridge 0.1.166-next.442 → 0.1.167

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.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  // src/OhhwellsBridge.tsx
4
- import React12, { useCallback as useCallback12, useEffect as useEffect21, useLayoutEffect as useLayoutEffect7, useRef as useRef14, useState as useState18 } from "react";
4
+ import React12, { useCallback as useCallback12, useEffect as useEffect21, useLayoutEffect as useLayoutEffect6, useRef as useRef14, useState as useState18 } from "react";
5
5
  import { createRoot as createRoot3 } from "react-dom/client";
6
6
  import { flushSync as flushSync3 } from "react-dom";
7
7
 
@@ -1098,21 +1098,21 @@ function chromeFrom(sample) {
1098
1098
  };
1099
1099
  }
1100
1100
  function filledPrimary(seed) {
1101
- const paint2 = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
1102
- const luminance = relativeLuminance(paint2);
1101
+ const paint = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
1102
+ const luminance = relativeLuminance(paint);
1103
1103
  return {
1104
- background: toCss({ ...paint2, a: 1 }),
1104
+ background: toCss({ ...paint, a: 1 }),
1105
1105
  color: luminance > 0.55 ? "rgb(15, 15, 15)" : "rgb(255, 255, 255)",
1106
1106
  borderColor: TRANSPARENT,
1107
1107
  borderWidth: "0px"
1108
1108
  };
1109
1109
  }
1110
1110
  function generatedSecondary(primary) {
1111
- const paint2 = accentColor(primary);
1111
+ const paint = accentColor(primary);
1112
1112
  return {
1113
1113
  background: TRANSPARENT,
1114
- color: paint2,
1115
- borderColor: paint2,
1114
+ color: paint,
1115
+ borderColor: paint,
1116
1116
  borderWidth: "1px"
1117
1117
  };
1118
1118
  }
@@ -1125,9 +1125,9 @@ function generatedGhost(primary) {
1125
1125
  };
1126
1126
  }
1127
1127
  function normalizeOutlineChrome(outline, primary) {
1128
- const paint2 = accentColor(primary);
1128
+ const paint = accentColor(primary);
1129
1129
  const text = parseColor(outline.color);
1130
- const paintRgb = parseColor(paint2);
1130
+ const paintRgb = parseColor(paint);
1131
1131
  const primaryLabel = parseColor(primary.color);
1132
1132
  const matchesOnPrimary = Boolean(text && primaryLabel) && colorKey(outline.color) === colorKey(primary.color);
1133
1133
  const textTooLight = text ? relativeLuminance(text) > 0.7 : false;
@@ -1136,8 +1136,8 @@ function normalizeOutlineChrome(outline, primary) {
1136
1136
  const hasBorder = parseFloat(outline.borderWidth) > 0;
1137
1137
  return {
1138
1138
  ...outline,
1139
- color: paint2,
1140
- borderColor: hasBorder ? paint2 : outline.borderColor
1139
+ color: paint,
1140
+ borderColor: hasBorder ? paint : outline.borderColor
1141
1141
  };
1142
1142
  }
1143
1143
  function generateButtonVariants(samples) {
@@ -6678,21 +6678,6 @@ function pricingCardFeatureCount(tree, index) {
6678
6678
  const target = findPricingCollection(tree)?.children?.[index];
6679
6679
  return target ? pricingFeatureList(target).length : 0;
6680
6680
  }
6681
- function prevailingFeatureIcon(features) {
6682
- const counts = /* @__PURE__ */ new Map();
6683
- for (const row of features) {
6684
- const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
6685
- const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
6686
- entry.count += 1;
6687
- counts.set(key, entry);
6688
- }
6689
- let best = null;
6690
- for (const entry of counts.values()) {
6691
- if (!best || entry.count > best.count) best = entry;
6692
- }
6693
- if (!best) return {};
6694
- return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
6695
- }
6696
6681
  function addPricingCardFeature(tree, index, text) {
6697
6682
  return withPricingCollection(tree, (collection) => {
6698
6683
  const children = collection.children;
@@ -6701,7 +6686,7 @@ function addPricingCardFeature(tree, index, text) {
6701
6686
  const features = pricingFeatureList(target);
6702
6687
  if (features.length >= PRICING_FEATURES_MAX) return false;
6703
6688
  target.slots = target.slots ?? {};
6704
- target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
6689
+ target.slots.features = [...features, { text }];
6705
6690
  return true;
6706
6691
  });
6707
6692
  }
@@ -7345,120 +7330,6 @@ function findSelectableNavContainer(doc = document) {
7345
7330
  );
7346
7331
  }
7347
7332
 
7348
- // src/lib/youtube.ts
7349
- var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
7350
- function extractYouTubeId(input) {
7351
- const trimmed = input.trim();
7352
- if (!trimmed) return null;
7353
- if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
7354
- let url;
7355
- try {
7356
- url = new URL(trimmed);
7357
- } catch {
7358
- return null;
7359
- }
7360
- const host = url.hostname.replace(/^www\./, "");
7361
- if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
7362
- return null;
7363
- }
7364
- let candidate = null;
7365
- if (host === "youtu.be") {
7366
- candidate = url.pathname.slice(1).split("/")[0] ?? null;
7367
- } else if (url.pathname === "/watch") {
7368
- candidate = url.searchParams.get("v");
7369
- } else {
7370
- const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
7371
- candidate = match ? match[1] : null;
7372
- }
7373
- return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
7374
- }
7375
-
7376
- // src/lib/section-embed.ts
7377
- var SECTION_EMBED_SUFFIX = "__ohw_embed";
7378
- function readStoredEmbed(value) {
7379
- if (value.startsWith("start\n")) {
7380
- return { raw: value.slice("start\n".length), at: "start" };
7381
- }
7382
- return { raw: value, at: "end" };
7383
- }
7384
- function embedFrameSrc(value) {
7385
- const videoId = extractYouTubeId(value);
7386
- if (videoId) {
7387
- return { src: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0`, title: "YouTube video" };
7388
- }
7389
- let url;
7390
- try {
7391
- url = new URL(value);
7392
- } catch {
7393
- return null;
7394
- }
7395
- const host = url.hostname.replace(/^www\./, "").toLowerCase();
7396
- if (host === "google.com" && url.pathname.startsWith("/maps") || host === "maps.google.com") {
7397
- const query = url.searchParams.get("q") || url.searchParams.get("query") || "";
7398
- const src = query ? `https://maps.google.com/maps?q=${encodeURIComponent(query)}&output=embed` : `https://maps.google.com/maps?output=embed`;
7399
- return { src, title: "Map" };
7400
- }
7401
- if (host === "maps.app.goo.gl") {
7402
- return { src: value, title: "Map" };
7403
- }
7404
- if (host === "calendly.com" || host.endsWith(".calendly.com") || host === "calendar.google.com") {
7405
- return { src: value, title: "Calendar" };
7406
- }
7407
- if (host === "docs.google.com" && url.pathname.includes("/forms/")) {
7408
- return { src: value.replace(/\/edit(?:\?.*)?$/i, "/viewform"), title: "Form" };
7409
- }
7410
- if (host === "forms.gle") {
7411
- return { src: value, title: "Form" };
7412
- }
7413
- return null;
7414
- }
7415
- function place(section, box, at) {
7416
- if (at === "start") {
7417
- section.insertBefore(box, section.firstChild);
7418
- return;
7419
- }
7420
- section.appendChild(box);
7421
- }
7422
- function paint(section, key, src, title, at) {
7423
- const existing = section.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`);
7424
- const frame = existing?.querySelector("iframe");
7425
- if (existing && frame) {
7426
- if (frame.getAttribute("src") !== src) frame.setAttribute("src", src);
7427
- frame.title = title;
7428
- place(section, existing, at);
7429
- return;
7430
- }
7431
- existing?.remove();
7432
- const box = document.createElement("div");
7433
- box.setAttribute("data-ohw-section-embed", key);
7434
- box.style.cssText = at === "start" ? "width:100%;max-width:960px;margin:0 auto 32px;padding:32px 24px 0;box-sizing:border-box;" : "width:100%;max-width:960px;margin:32px auto 0;padding:0 24px 32px;box-sizing:border-box;";
7435
- const frameWrap = document.createElement("div");
7436
- frameWrap.style.cssText = "position:relative;width:100%;aspect-ratio:16/9;min-height:250px;border-radius:12px;overflow:hidden;background:#0f172a;";
7437
- const iframe = document.createElement("iframe");
7438
- iframe.src = src;
7439
- iframe.title = title;
7440
- iframe.style.cssText = "position:absolute;inset:0;width:100%;height:100%;border:0;";
7441
- iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture";
7442
- iframe.setAttribute("allowfullscreen", "");
7443
- frameWrap.appendChild(iframe);
7444
- box.appendChild(frameWrap);
7445
- place(section, box, at);
7446
- }
7447
- function applySectionEmbeds(content) {
7448
- for (const [key, val] of Object.entries(content)) {
7449
- if (!key.endsWith(SECTION_EMBED_SUFFIX)) continue;
7450
- const sectionId = key.slice(0, -SECTION_EMBED_SUFFIX.length);
7451
- const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
7452
- const stored = typeof val === "string" ? readStoredEmbed(val) : null;
7453
- const frame = stored ? embedFrameSrc(stored.raw) : null;
7454
- if (!section || !stored || !frame) {
7455
- section?.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`)?.remove();
7456
- continue;
7457
- }
7458
- paint(section, key, frame.src, frame.title, stored.at);
7459
- }
7460
- }
7461
-
7462
7333
  // src/ui/ai-tree/aiSectionsManager.tsx
7463
7334
  import { flushSync } from "react-dom";
7464
7335
  import { createRoot } from "react-dom/client";
@@ -8032,7 +7903,7 @@ var AI_MOBILE_CSS = [
8032
7903
  // page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
8033
7904
  // template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
8034
7905
  // an exact figure from (no live measurement exists), so this is a safe approximation, not a
8035
- // pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
7906
+ // pixel-exact fit. Horizontal spacing already comes from `data-ai-container`.
8036
7907
  '[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
8037
7908
  // A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
8038
7909
  // window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
@@ -8048,10 +7919,8 @@ var AI_MOBILE_CSS = [
8048
7919
  "[data-ai-section]{overflow-x:hidden}",
8049
7920
  // `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
8050
7921
  // full-bleed section's container sets, so a carousel/media hero that is edge-to-edge on desktop
8051
- // still got a 20px band of section background down both sides on a phone. The footer's own
8052
- // container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
8053
- "[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
8054
- "[data-ai-container]{padding:0 20px !important}",
7922
+ // still got a 20px band of section background down both sides on a phone.
7923
+ "[data-ai-container]:not([data-ai-full-bleed]){padding:0 20px !important}",
8055
7924
  "[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
8056
7925
  "[data-ai-cell]{width:100%;min-width:0}",
8057
7926
  // The rule above turns every row into a COLUMN flex container on phones, which silently breaks
@@ -8256,31 +8125,6 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
8256
8125
  function textAttrs(ctx, path) {
8257
8126
  return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
8258
8127
  }
8259
- var AI_RESPONSIVE_CSS = [
8260
- "@media (max-width: 960px) {",
8261
- " [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
8262
- ' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
8263
- "}",
8264
- "@media (max-width: 640px) {",
8265
- " [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
8266
- " [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
8267
- // Group containers flatten to a column on phones; span placements come along for free.
8268
- // `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
8269
- // the comment there. This sheet's copy is the narrower selector, so without the exemption it
8270
- // flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
8271
- // viewport with the heading/CTA in flow *under* the image, 219px of section background where the
8272
- // layered text used to be.
8273
- ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
8274
- ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
8275
- // `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
8276
- // is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
8277
- // a full-bleed hero gets its 20px side band back below 640px only — the one width where the
8278
- // other rule had already been taught to stand down.
8279
- " [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
8280
- " [data-ai-responsive] { overflow-x: hidden; }",
8281
- " [data-ai-responsive] img { max-width: 100%; }",
8282
- "}"
8283
- ].join("\n");
8284
8128
  var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
8285
8129
  function MediaBox({
8286
8130
  refValue,
@@ -8335,7 +8179,7 @@ function MediaBox({
8335
8179
  position: fill ? "absolute" : void 0,
8336
8180
  inset: fill ? 0 : void 0,
8337
8181
  width: fill ? "100%" : fixedSize ? "auto" : "100%",
8338
- height: fill ? "100%" : fixedSize ? height : void 0,
8182
+ height: fill ? "100%" : void 0,
8339
8183
  aspectRatio: fill ? void 0 : aspectRatio,
8340
8184
  minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
8341
8185
  borderRadius: radius,
@@ -9831,7 +9675,7 @@ function CollectionBlock({ node, ctx, path }) {
9831
9675
  return /* @__PURE__ */ jsx(
9832
9676
  "div",
9833
9677
  {
9834
- "data-ai-grid": String(itemsPerRow),
9678
+ "data-ai-grid": "",
9835
9679
  "data-ohw-pricing-collection": isPricing ? "" : void 0,
9836
9680
  style: {
9837
9681
  display: "grid",
@@ -10133,7 +9977,7 @@ function renderNode(node, ctx, path, ambientAlign) {
10133
9977
  },
10134
9978
  children: [
10135
9979
  i > 0 && ctx.heroOverlapFullBleed ? (
10136
- // The section's `data-ai-section-inner` gave up its max-width/gutter so the base
9980
+ // The section's `data-ai-container` gave up its max-width/gutter so the base
10137
9981
  // layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
10138
9982
  // scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
10139
9983
  // the full section width instead of reading at the usual content width.
@@ -10552,7 +10396,6 @@ function AiTreeRenderer({
10552
10396
  ...fillHeight ? { "data-ai-fill-height": "" } : {},
10553
10397
  ...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
10554
10398
  ...bgAttrs,
10555
- "data-ai-responsive": "",
10556
10399
  style: {
10557
10400
  position: "relative",
10558
10401
  padding: `${padCss} 0`,
@@ -10566,13 +10409,12 @@ function AiTreeRenderer({
10566
10409
  ...fillHeight ? { display: "grid" } : {}
10567
10410
  },
10568
10411
  children: [
10569
- /* @__PURE__ */ jsx("style", { children: AI_RESPONSIVE_CSS }),
10570
- /* @__PURE__ */ jsx("style", { children: AI_MOBILE_CSS }),
10571
10412
  isOverlay && backgroundUrl && /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
10413
+ /* @__PURE__ */ jsx("style", { children: AI_MOBILE_CSS }),
10572
10414
  /* @__PURE__ */ jsx(
10573
10415
  "div",
10574
10416
  {
10575
- "data-ai-section-inner": "",
10417
+ "data-ai-container": "",
10576
10418
  ...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
10577
10419
  style: {
10578
10420
  position: "relative",
@@ -10589,7 +10431,7 @@ function AiTreeRenderer({
10589
10431
  children: tree.rows.map((row, r2) => /* @__PURE__ */ jsx(
10590
10432
  "div",
10591
10433
  {
10592
- "data-ai-columns": "",
10434
+ "data-ai-row": "",
10593
10435
  style: {
10594
10436
  display: "grid",
10595
10437
  gridTemplateColumns: "repeat(12, 1fr)",
@@ -11251,10 +11093,9 @@ function applyAiSectionsToDom(state, options) {
11251
11093
  if (existing && existing.serialized === serialized && existing.container.isConnected) {
11252
11094
  continue;
11253
11095
  }
11096
+ const isNewMount = !existing || !existing.container.isConnected;
11254
11097
  let container = existing?.container;
11255
- let isNewMount = false;
11256
11098
  if (!container || !container.isConnected) {
11257
- isNewMount = true;
11258
11099
  existing?.root.unmount();
11259
11100
  container?.remove();
11260
11101
  container = document.createElement("div");
@@ -11592,34 +11433,6 @@ function minSpanForFooterBlock(type) {
11592
11433
  return 3;
11593
11434
  }
11594
11435
  }
11595
- function readLiveSocialItems() {
11596
- const root = getFooterRoot();
11597
- const row = root?.querySelector("[data-ohw-socials-row]");
11598
- if (!row) return [];
11599
- const items = [];
11600
- for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
11601
- const href = anchor.getAttribute("href")?.trim() ?? "";
11602
- const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
11603
- const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
11604
- if (!platform || !/^https?:\/\//i.test(href)) continue;
11605
- items.push({ platform, href });
11606
- }
11607
- return items;
11608
- }
11609
- function syncSocialRowsFromDom(tree) {
11610
- const root = getFooterRoot();
11611
- if (!root) return;
11612
- const row = root.querySelector("[data-ohw-socials-row]");
11613
- const live = readLiveSocialItems();
11614
- if (row && live.length === 0) return;
11615
- for (const col of tree.columns) {
11616
- col.blocks = col.blocks.flatMap((block) => {
11617
- if (block.type !== "social-row") return [block];
11618
- if (!row) return [];
11619
- return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
11620
- });
11621
- }
11622
- }
11623
11436
  function collectBrandBlocks(tree) {
11624
11437
  const brand = [];
11625
11438
  for (const col of tree.columns) {
@@ -11865,7 +11678,6 @@ function textOf2(el) {
11865
11678
  }
11866
11679
  function syncFooterTreeLinksFromDom(tree) {
11867
11680
  const next = cloneTree(tree);
11868
- syncSocialRowsFromDom(next);
11869
11681
  const domCols = listFooterColumns().map((col) => {
11870
11682
  const heading = getFooterColumnHeadingEl(col);
11871
11683
  const title = heading ? textOf2(heading) : void 0;
@@ -17678,7 +17490,7 @@ function apiBase() {
17678
17490
  function bridgeVersion() {
17679
17491
  try {
17680
17492
  if (true) {
17681
- return "0.1.166-next.442";
17493
+ return "0.1.167";
17682
17494
  }
17683
17495
  } catch {
17684
17496
  }
@@ -17692,7 +17504,7 @@ function stampBridgeVersionOnDocument() {
17692
17504
  return;
17693
17505
  }
17694
17506
  try {
17695
- const v = true ? "0.1.166-next.442" : "";
17507
+ const v = true ? "0.1.167" : "";
17696
17508
  if (v) {
17697
17509
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
17698
17510
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -18370,7 +18182,6 @@ function MediaOverlay({
18370
18182
  (prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
18371
18183
  );
18372
18184
  }, [isVideo]);
18373
- const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
18374
18185
  const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
18375
18186
  const box = {
18376
18187
  position: "fixed",
@@ -18469,10 +18280,11 @@ function MediaOverlay({
18469
18280
  className: "flex items-center justify-center cursor-pointer",
18470
18281
  style: {
18471
18282
  ...box,
18472
- // Visual only. `pointer-events: auto` on this full-bleed rect covered the navbar
18473
- // (hero bg includes the absolute TopNav) and swallowed CTA press-drag. Text overlay
18474
- // and cueOnly also need clicks to fall through — Replace / video controls opt back in.
18475
- pointerEvents: "none",
18283
+ // When text overlays this media, let clicks fall THROUGH to the text underneath. In the
18284
+ // parent this needed a whole `ow:click-at` round-trip to re-hit-test inside the iframe;
18285
+ // in-document, pointer-events does it natively. The button below opts back in, so
18286
+ // Replace still works.
18287
+ pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
18476
18288
  // Selected: a firm component ring with no wash, so the image reads as chosen rather
18477
18289
  // than hovered. Hover keeps the existing tinted preview.
18478
18290
  boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
@@ -18499,17 +18311,17 @@ function MediaOverlay({
18499
18311
  },
18500
18312
  children: [
18501
18313
  isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
18502
- replaceLabel
18314
+ isVideo ? "Replace video" : "Replace image"
18503
18315
  ]
18504
18316
  }
18505
18317
  ),
18506
- showChrome && replaceMode !== "none" && /* @__PURE__ */ jsxs8(
18318
+ replaceMode === "none" || cueOnly ? null : /* @__PURE__ */ jsxs8(
18507
18319
  Button,
18508
18320
  {
18509
18321
  "data-ohw-media-overlay": "",
18510
18322
  variant: "outline",
18511
18323
  size: "sm",
18512
- "aria-label": replaceLabel,
18324
+ "aria-label": isVideo ? "Replace video" : "Replace image",
18513
18325
  className: "gap-1.5 cursor-pointer hover:bg-background",
18514
18326
  style: {
18515
18327
  ...OVERLAY_BUTTON_STYLE,
@@ -18532,7 +18344,7 @@ function MediaOverlay({
18532
18344
  },
18533
18345
  children: [
18534
18346
  isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
18535
- replaceMode === "full" ? replaceLabel : null
18347
+ replaceMode === "full" ? isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image" : null
18536
18348
  ]
18537
18349
  }
18538
18350
  )
@@ -19125,24 +18937,8 @@ function AiSectionOverlay({
19125
18937
  }
19126
18938
 
19127
18939
  // src/ui/ai-section/AiMediaStripOverlay.tsx
19128
- import { useCallback as useCallback3, useEffect as useEffect9, useLayoutEffect as useLayoutEffect4, useRef as useRef5, useState as useState8 } from "react";
19129
- import {
19130
- AlignCenter,
19131
- AlignLeft,
19132
- AlignRight,
19133
- ArrowLeft as ArrowLeft2,
19134
- ArrowRight as ArrowRight2,
19135
- Check as Check2,
19136
- ChevronDown as ChevronDown3,
19137
- Image as ImageIcon2,
19138
- ImageMinus,
19139
- ImagePlus,
19140
- Link as LinkIcon,
19141
- Minus,
19142
- Palette,
19143
- Plus as Plus2,
19144
- Star
19145
- } from "lucide-react";
18940
+ import { useCallback as useCallback3, useEffect as useEffect9, useRef as useRef5, useState as useState8 } from "react";
18941
+ import { Star } from "lucide-react";
19146
18942
 
19147
18943
  // src/lib/ai-media-strip-tree.ts
19148
18944
  var MEDIA_STRIP_ITEM_MIN = 1;
@@ -19256,6 +19052,14 @@ function setMediaStripItemAsset(tree, index, assetId) {
19256
19052
  return true;
19257
19053
  });
19258
19054
  }
19055
+ function setMediaStripItemAlt(tree, index, alt) {
19056
+ return withMediaStrip(tree, (block) => {
19057
+ const items = block.items;
19058
+ if (index < 0 || index >= items.length) return false;
19059
+ items[index] = { ...items[index], alt };
19060
+ return true;
19061
+ });
19062
+ }
19259
19063
  function setMediaStripItemLink(tree, index, link) {
19260
19064
  return withMediaStrip(tree, (block) => {
19261
19065
  const items = block.items;
@@ -19273,117 +19077,11 @@ function setMediaStripItemLink(tree, index, link) {
19273
19077
  });
19274
19078
  }
19275
19079
 
19276
- // src/ui/dialog.tsx
19277
- import * as React9 from "react";
19278
- import { Dialog as DialogPrimitive } from "radix-ui";
19279
- import { X as X2 } from "lucide-react";
19280
- import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
19281
- function Dialog2({
19282
- ...props
19283
- }) {
19284
- return /* @__PURE__ */ jsx20(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
19285
- }
19286
- function DialogPortal({
19287
- ...props
19288
- }) {
19289
- return /* @__PURE__ */ jsx20(DialogPrimitive.Portal, { ...props });
19290
- }
19291
- function DialogOverlay({
19292
- className,
19293
- ...props
19294
- }) {
19295
- return /* @__PURE__ */ jsx20(
19296
- DialogPrimitive.Overlay,
19297
- {
19298
- "data-slot": "dialog-overlay",
19299
- "data-ohw-link-modal-root": "",
19300
- className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
19301
- ...props
19302
- }
19303
- );
19304
- }
19305
- var DialogContent = React9.forwardRef(
19306
- ({ className, children, showCloseButton = true, container, ...props }, ref) => {
19307
- const positionMode = container ? "absolute" : "fixed";
19308
- return /* @__PURE__ */ jsxs11(DialogPortal, { container: container ?? void 0, children: [
19309
- /* @__PURE__ */ jsx20(DialogOverlay, { className: cn(positionMode, "inset-0") }),
19310
- /* @__PURE__ */ jsxs11(
19311
- DialogPrimitive.Content,
19312
- {
19313
- ref,
19314
- "data-slot": "dialog-content",
19315
- className: cn(
19316
- positionMode,
19317
- "left-1/2 top-1/2 z-[2147483647] flex w-full max-w-[448px] -translate-x-1/2 -translate-y-1/2 flex-col overflow-visible",
19318
- "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
19319
- container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
19320
- className
19321
- ),
19322
- onMouseDown: (e) => e.stopPropagation(),
19323
- ...props,
19324
- children: [
19325
- children,
19326
- showCloseButton ? /* @__PURE__ */ jsx20(
19327
- DialogPrimitive.Close,
19328
- {
19329
- type: "button",
19330
- className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
19331
- "aria-label": "Close",
19332
- children: /* @__PURE__ */ jsx20(X2, { size: 16, "aria-hidden": true })
19333
- }
19334
- ) : null
19335
- ]
19336
- }
19337
- )
19338
- ] });
19339
- }
19340
- );
19341
- DialogContent.displayName = DialogPrimitive.Content.displayName;
19342
- function DialogHeader({
19343
- className,
19344
- ...props
19345
- }) {
19346
- return /* @__PURE__ */ jsx20("div", { className: cn("flex flex-col gap-1.5", className), ...props });
19347
- }
19348
- function DialogFooter({
19349
- className,
19350
- ...props
19351
- }) {
19352
- return /* @__PURE__ */ jsx20(
19353
- "div",
19354
- {
19355
- className: cn("flex items-center justify-end gap-2", className),
19356
- ...props
19357
- }
19358
- );
19359
- }
19360
- var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
19361
- DialogPrimitive.Title,
19362
- {
19363
- ref,
19364
- className: cn(
19365
- "text-lg font-semibold leading-none tracking-tight text-card-foreground",
19366
- className
19367
- ),
19368
- ...props
19369
- }
19370
- ));
19371
- DialogTitle.displayName = DialogPrimitive.Title.displayName;
19372
- var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
19373
- DialogPrimitive.Description,
19374
- {
19375
- ref,
19376
- className: cn("text-sm text-muted-foreground", className),
19377
- ...props
19378
- }
19379
- ));
19380
- DialogDescription.displayName = DialogPrimitive.Description.displayName;
19381
- var DialogClose = DialogPrimitive.Close;
19382
-
19383
19080
  // src/ui/ai-section/AiMediaStripOverlay.tsx
19384
- import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
19385
- var PRIMARY3 = "var(--ohw-primary, #0885FE)";
19386
- var CHROME_SELECTOR = "[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review], [data-ohw-more-menu]";
19081
+ import { Fragment as Fragment7, jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
19082
+ var PRIMARY3 = "#0885FE";
19083
+ var OHW_BLUE = `var(--ohw-primary, ${PRIMARY3})`;
19084
+ var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
19387
19085
  function findMediaStripItemElement(sectionId, index) {
19388
19086
  const sectionEl = findByInstanceId(sectionId);
19389
19087
  if (!sectionEl) return null;
@@ -19393,35 +19091,14 @@ function findMediaStripItemElement(sectionId, index) {
19393
19091
  }
19394
19092
  return null;
19395
19093
  }
19396
- function itemRefFromTarget(target) {
19397
- if (!(target instanceof Element)) return null;
19398
- if (target.closest(CHROME_SELECTOR)) return null;
19399
- const itemEl = target.closest("[data-ohw-media-strip-item]");
19400
- if (!itemEl) return null;
19401
- const sectionEl = itemEl.closest("[data-ohw-section]");
19402
- const unit = sectionEl ? movableUnit(sectionEl) : null;
19403
- const sectionId = unit ? instanceIdOf(unit) || null : null;
19404
- const index = Number(itemEl.dataset.ohwMediaStripIndex);
19405
- if (!sectionId || Number.isNaN(index)) return null;
19406
- return { sectionId, index };
19407
- }
19408
- function sameRef(a, b) {
19409
- return a?.sectionId === b?.sectionId && a?.index === b?.index;
19410
- }
19411
- function rectOf(el) {
19094
+ function readRect2(ref) {
19095
+ const el = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19412
19096
  if (!el) return null;
19413
19097
  const r2 = el.getBoundingClientRect();
19414
19098
  if (r2.width <= 0 || r2.height <= 0) return null;
19415
19099
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
19416
19100
  }
19417
- function readRect2(ref) {
19418
- return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
19419
- }
19420
- function readStripRect(ref) {
19421
- const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19422
- return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
19423
- }
19424
- function useLiveItemRect(ref, strip = false) {
19101
+ function useLiveItemRect(ref) {
19425
19102
  const [rect, setRect] = useState8(null);
19426
19103
  useEffect9(() => {
19427
19104
  if (!ref) {
@@ -19429,7 +19106,7 @@ function useLiveItemRect(ref, strip = false) {
19429
19106
  return;
19430
19107
  }
19431
19108
  const update = () => {
19432
- const next = strip ? readStripRect(ref) : readRect2(ref);
19109
+ const next = readRect2(ref);
19433
19110
  setRect(
19434
19111
  (prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
19435
19112
  );
@@ -19444,49 +19121,9 @@ function useLiveItemRect(ref, strip = false) {
19444
19121
  window.removeEventListener("resize", update);
19445
19122
  clearInterval(interval);
19446
19123
  };
19447
- }, [ref?.sectionId, ref?.index, strip]);
19124
+ }, [ref?.sectionId, ref?.index]);
19448
19125
  return rect;
19449
19126
  }
19450
- var TOOLBAR_STRIP_GAP = 52;
19451
- var TOOLBAR_STRIP_GAP_MOBILE = 42;
19452
- var TOOLBAR_EDGE_MARGIN2 = 4;
19453
- function StripToolbarSlot({ stripRect, children }) {
19454
- const slotRef = useRef5(null);
19455
- const [shift, setShift] = useState8(0);
19456
- const centerX = stripRect.left + stripRect.width / 2;
19457
- useLayoutEffect4(() => {
19458
- const slot = slotRef.current;
19459
- if (!slot) return;
19460
- const clamp = () => {
19461
- const w = slot.offsetWidth;
19462
- if (w <= 0) return;
19463
- const half = w / 2;
19464
- const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
19465
- setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
19466
- };
19467
- clamp();
19468
- const ro = new ResizeObserver(clamp);
19469
- ro.observe(slot);
19470
- return () => ro.disconnect();
19471
- }, [centerX, children]);
19472
- const mobile = window.innerWidth <= 480;
19473
- return /* @__PURE__ */ jsx21(
19474
- "div",
19475
- {
19476
- ref: slotRef,
19477
- "data-ohw-bridge": "",
19478
- "data-ohw-item-interaction": "",
19479
- className: "pointer-events-auto fixed",
19480
- style: {
19481
- top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
19482
- left: centerX + shift,
19483
- transform: "translate(-50%, -100%)",
19484
- zIndex: 2147483645
19485
- },
19486
- children
19487
- }
19488
- );
19489
- }
19490
19127
  function requestValidateTree(postToParent2, tree) {
19491
19128
  return new Promise((resolve) => {
19492
19129
  const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
@@ -19523,72 +19160,116 @@ function requestAssetPick(postToParent2) {
19523
19160
  postToParent2({ type: "ow:asset-pick", id });
19524
19161
  });
19525
19162
  }
19526
- function ToolbarAction({
19163
+ function Pill({
19527
19164
  label,
19528
19165
  onClick,
19529
- disabled = false,
19530
- active = false,
19531
- children
19166
+ disabled,
19167
+ active
19532
19168
  }) {
19533
- const button = /* @__PURE__ */ jsx21(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
19534
- return /* @__PURE__ */ jsxs12(Tooltip, { children: [
19535
- /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: button }) : button }),
19536
- /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
19537
- ] });
19538
- }
19539
- function ToolbarSeparator() {
19540
- return /* @__PURE__ */ jsx21("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
19169
+ return /* @__PURE__ */ jsx20(
19170
+ "button",
19171
+ {
19172
+ type: "button",
19173
+ onClick,
19174
+ disabled,
19175
+ style: {
19176
+ height: 28,
19177
+ padding: "0 10px",
19178
+ display: "inline-flex",
19179
+ alignItems: "center",
19180
+ gap: 4,
19181
+ borderRadius: 999,
19182
+ border: "none",
19183
+ cursor: disabled ? "default" : "pointer",
19184
+ background: active ? OHW_BLUE_DARK : "#ffffff",
19185
+ color: active ? "#ffffff" : OHW_BLUE_DARK,
19186
+ opacity: disabled ? 0.4 : 1,
19187
+ fontSize: 12,
19188
+ lineHeight: "16px",
19189
+ fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19190
+ whiteSpace: "nowrap",
19191
+ flex: "0 0 auto"
19192
+ },
19193
+ children: label
19194
+ }
19195
+ );
19541
19196
  }
19542
- function OptionMenu({
19543
- label,
19544
- value,
19545
- options,
19546
- onChange
19547
- }) {
19548
- const current = options.find((o) => o.value === value) ?? options[0];
19549
- return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
19550
- /* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground", children: label }),
19551
- /* @__PURE__ */ jsxs12(DropdownMenu, { modal: false, children: [
19552
- /* @__PURE__ */ jsx21(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs12(
19553
- "button",
19554
- {
19555
- type: "button",
19556
- "aria-label": label,
19557
- className: "inline-flex h-8 min-w-[76px] items-center gap-[7px] rounded-[6px] bg-transparent px-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted data-[state=open]:bg-muted",
19558
- children: [
19559
- /* @__PURE__ */ jsx21("span", { className: "flex-1 text-left", children: current.label }),
19560
- /* @__PURE__ */ jsx21(ChevronDown3, { size: 16, style: { pointerEvents: "none" } })
19561
- ]
19562
- }
19563
- ) }),
19564
- /* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
19565
- const selected = option.value === value;
19566
- return /* @__PURE__ */ jsxs12(
19567
- DropdownMenuItem,
19197
+ function AltInput({ value, onCommit }) {
19198
+ const [draft, setDraft] = useState8(value);
19199
+ useEffect9(() => setDraft(value), [value]);
19200
+ return /* @__PURE__ */ jsxs11(
19201
+ "div",
19202
+ {
19203
+ style: {
19204
+ display: "flex",
19205
+ alignItems: "center",
19206
+ gap: 6,
19207
+ height: 28,
19208
+ padding: "0 12px",
19209
+ borderRadius: 999,
19210
+ background: "#ffffff",
19211
+ width: "100%",
19212
+ maxWidth: 260,
19213
+ boxSizing: "border-box"
19214
+ },
19215
+ children: [
19216
+ /* @__PURE__ */ jsx20(
19217
+ "span",
19568
19218
  {
19569
- role: "menuitemradio",
19570
- "aria-checked": selected,
19571
- onSelect: () => onChange(option.value),
19572
- className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
19573
- children: [
19574
- /* @__PURE__ */ jsx21("span", { children: option.label }),
19575
- selected && /* @__PURE__ */ jsx21(Check2, { size: 16, className: "text-bridge-primary" })
19576
- ]
19577
- },
19578
- option.value
19579
- );
19580
- }) })
19581
- ] })
19582
- ] });
19219
+ style: {
19220
+ flex: "0 0 auto",
19221
+ color: OHW_BLUE_DARK,
19222
+ fontSize: 10,
19223
+ fontWeight: 700,
19224
+ textTransform: "uppercase",
19225
+ letterSpacing: 0.4
19226
+ },
19227
+ children: "Alt"
19228
+ }
19229
+ ),
19230
+ /* @__PURE__ */ jsx20(
19231
+ "input",
19232
+ {
19233
+ type: "text",
19234
+ value: draft,
19235
+ onChange: (e) => setDraft(e.target.value),
19236
+ onBlur: () => {
19237
+ if (draft !== value) onCommit(draft);
19238
+ },
19239
+ onKeyDown: (e) => {
19240
+ if (e.key === "Enter") e.currentTarget.blur();
19241
+ if (e.key === "Escape") {
19242
+ setDraft(value);
19243
+ e.currentTarget.blur();
19244
+ }
19245
+ },
19246
+ placeholder: "Describe this image",
19247
+ "aria-label": "Image alt text",
19248
+ style: {
19249
+ flex: 1,
19250
+ minWidth: 0,
19251
+ border: "none",
19252
+ outline: "none",
19253
+ background: "transparent",
19254
+ fontSize: 12,
19255
+ lineHeight: "16px",
19256
+ fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19257
+ color: "#1f2937"
19258
+ }
19259
+ }
19260
+ )
19261
+ ]
19262
+ }
19263
+ );
19583
19264
  }
19584
19265
  var VARIANTS = [
19585
19266
  { value: "logos", label: "Logos" },
19586
19267
  { value: "reel", label: "Reel" }
19587
19268
  ];
19588
19269
  var ALIGNS = [
19589
- { value: "left", label: "Align left", Icon: AlignLeft },
19590
- { value: "center", label: "Align center", Icon: AlignCenter },
19591
- { value: "right", label: "Align right", Icon: AlignRight }
19270
+ { value: "left", label: "Left" },
19271
+ { value: "center", label: "Center" },
19272
+ { value: "right", label: "Right" }
19592
19273
  ];
19593
19274
  var HOVERS = [
19594
19275
  { value: "none", label: "None" },
@@ -19596,104 +19277,104 @@ var HOVERS = [
19596
19277
  { value: "zoom", label: "Zoom" },
19597
19278
  { value: "fade", label: "Fade" }
19598
19279
  ];
19280
+ var TREATMENTS = [
19281
+ { value: "color", label: "Color" },
19282
+ { value: "grayscale", label: "Grayscale" }
19283
+ ];
19599
19284
  var HTTP_URL_RE = /^https?:\/\/\S+$/i;
19600
- function LinkModal({
19601
- href,
19602
- linkTarget,
19603
- onClose,
19604
- onSave
19605
- }) {
19606
- const [draft, setDraft] = useState8(href);
19607
- const [newTab, setNewTab] = useState8(linkTarget !== "same-tab");
19285
+ function LinkInput({ value, onCommit }) {
19286
+ const [draft, setDraft] = useState8(value);
19608
19287
  const [invalid, setInvalid] = useState8(false);
19609
- const save = () => {
19288
+ useEffect9(() => {
19289
+ setDraft(value);
19290
+ setInvalid(false);
19291
+ }, [value]);
19292
+ const commit2 = () => {
19610
19293
  const next = draft.trim();
19611
- if (next && !HTTP_URL_RE.test(next)) {
19612
- setInvalid(true);
19613
- return;
19614
- }
19615
- onSave(next, newTab ? "new-tab" : "same-tab");
19616
- onClose();
19294
+ if (next === value) return setInvalid(false);
19295
+ if (next && !HTTP_URL_RE.test(next)) return setInvalid(true);
19296
+ setInvalid(false);
19297
+ onCommit(next);
19617
19298
  };
19618
- return /* @__PURE__ */ jsx21(Dialog2, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs12(DialogContent, { "data-ohw-link-modal-root": "", className: "max-w-[400px] gap-4 p-5", children: [
19619
- /* @__PURE__ */ jsx21(DialogHeader, { children: /* @__PURE__ */ jsx21(DialogTitle, { className: "text-base", children: "Image link" }) }),
19620
- /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-3", children: [
19621
- /* @__PURE__ */ jsx21(
19622
- "input",
19623
- {
19624
- autoFocus: true,
19625
- type: "text",
19626
- inputMode: "url",
19627
- value: draft,
19628
- onChange: (e) => {
19629
- setDraft(e.target.value);
19630
- setInvalid(false);
19631
- },
19632
- onKeyDown: (e) => {
19633
- if (e.key === "Enter") save();
19634
- },
19635
- placeholder: "https://example.com",
19636
- "aria-label": "Image link URL",
19637
- "aria-invalid": invalid,
19638
- className: cn(
19639
- "h-9 w-full rounded-[6px] border border-border bg-background px-3 text-[13px] text-foreground outline-none placeholder:text-muted-foreground/70 focus:border-bridge-primary",
19640
- invalid && "border-destructive focus:border-destructive"
19641
- )
19642
- }
19643
- ),
19644
- invalid && /* @__PURE__ */ jsx21("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
19645
- /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
19646
- /* @__PURE__ */ jsx21("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
19647
- "Open in new tab"
19648
- ] })
19649
- ] }),
19650
- /* @__PURE__ */ jsxs12(DialogFooter, { children: [
19651
- href && /* @__PURE__ */ jsx21(
19652
- "button",
19653
- {
19654
- type: "button",
19655
- onClick: () => {
19656
- onSave("", "new-tab");
19657
- onClose();
19658
- },
19659
- className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
19660
- children: "Remove link"
19661
- }
19662
- ),
19663
- /* @__PURE__ */ jsx21(
19664
- "button",
19665
- {
19666
- type: "button",
19667
- onClick: onClose,
19668
- className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
19669
- children: "Cancel"
19670
- }
19671
- ),
19672
- /* @__PURE__ */ jsx21(
19673
- "button",
19674
- {
19675
- type: "button",
19676
- onClick: save,
19677
- className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
19678
- children: "Save"
19679
- }
19680
- )
19681
- ] })
19682
- ] }) });
19299
+ return /* @__PURE__ */ jsxs11(
19300
+ "div",
19301
+ {
19302
+ style: {
19303
+ display: "flex",
19304
+ alignItems: "center",
19305
+ gap: 6,
19306
+ height: 28,
19307
+ padding: "0 12px",
19308
+ borderRadius: 999,
19309
+ background: "#ffffff",
19310
+ width: "100%",
19311
+ maxWidth: 260,
19312
+ boxSizing: "border-box",
19313
+ boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
19314
+ },
19315
+ children: [
19316
+ /* @__PURE__ */ jsx20(
19317
+ "span",
19318
+ {
19319
+ style: {
19320
+ flex: "0 0 auto",
19321
+ color: OHW_BLUE_DARK,
19322
+ fontSize: 10,
19323
+ fontWeight: 700,
19324
+ textTransform: "uppercase",
19325
+ letterSpacing: 0.4
19326
+ },
19327
+ children: "Link"
19328
+ }
19329
+ ),
19330
+ /* @__PURE__ */ jsx20(
19331
+ "input",
19332
+ {
19333
+ type: "text",
19334
+ inputMode: "url",
19335
+ value: draft,
19336
+ onChange: (e) => setDraft(e.target.value),
19337
+ onBlur: commit2,
19338
+ onKeyDown: (e) => {
19339
+ if (e.key === "Enter") e.currentTarget.blur();
19340
+ if (e.key === "Escape") {
19341
+ setDraft(value);
19342
+ setInvalid(false);
19343
+ e.currentTarget.blur();
19344
+ }
19345
+ },
19346
+ placeholder: "https://example.com",
19347
+ "aria-label": "Image link URL",
19348
+ "aria-invalid": invalid,
19349
+ style: {
19350
+ flex: 1,
19351
+ minWidth: 0,
19352
+ border: "none",
19353
+ outline: "none",
19354
+ background: "transparent",
19355
+ fontSize: 12,
19356
+ lineHeight: "16px",
19357
+ fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19358
+ color: "#1f2937"
19359
+ }
19360
+ }
19361
+ )
19362
+ ]
19363
+ }
19364
+ );
19683
19365
  }
19684
19366
  function MediaStripToolbar({
19685
19367
  entry,
19686
19368
  index,
19687
19369
  pending,
19688
19370
  error,
19689
- itemEditOn,
19690
- onToggleItemEdit,
19691
19371
  onSetVariant,
19692
19372
  onSetAlign,
19693
19373
  onSetHover,
19694
19374
  onSetTreatment,
19695
19375
  onResize,
19696
- onOpenLink,
19376
+ onSetAlt,
19377
+ onSetLink,
19697
19378
  onAddItem,
19698
19379
  onRemoveItem,
19699
19380
  onChangeImage,
@@ -19702,102 +19383,81 @@ function MediaStripToolbar({
19702
19383
  }) {
19703
19384
  const items = mediaStripItems(entry.tree);
19704
19385
  const itemCount = items.length;
19386
+ const currentAlt = items[index]?.alt ?? "";
19387
+ const currentHref2 = items[index]?.href ?? "";
19388
+ const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
19705
19389
  const slots = findMediaStripSlots(entry.tree);
19706
19390
  const variant = slots?.variant === "reel" ? "reel" : "logos";
19707
19391
  const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
19708
19392
  const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
19709
19393
  const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
19710
19394
  const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19711
- const mobile = window.innerWidth <= 480;
19712
- const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
19713
- return /* @__PURE__ */ jsx21(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs12(
19395
+ const isMobile = window.innerWidth <= 480;
19396
+ const rowStyle = isMobile ? {
19397
+ display: "flex",
19398
+ gap: 6,
19399
+ flexWrap: "nowrap",
19400
+ justifyContent: "center",
19401
+ overflowX: "auto",
19402
+ WebkitOverflowScrolling: "touch",
19403
+ width: "100%",
19404
+ scrollbarWidth: "none"
19405
+ } : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
19406
+ return /* @__PURE__ */ jsxs11(
19714
19407
  "div",
19715
19408
  {
19716
19409
  "data-ohw-bridge": "",
19717
19410
  "data-ohw-toolbar": "",
19718
19411
  onMouseDown: (e) => e.stopPropagation(),
19719
- className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
19720
- style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
19412
+ style: {
19413
+ display: "flex",
19414
+ flexDirection: "column",
19415
+ gap: 6,
19416
+ alignItems: "center",
19417
+ background: OHW_BLUE,
19418
+ padding: 8,
19419
+ borderRadius: 12,
19420
+ boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
19421
+ pointerEvents: pending ? "none" : "auto",
19422
+ opacity: pending ? 0.6 : 1,
19423
+ maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
19424
+ },
19721
19425
  children: [
19722
- /* @__PURE__ */ jsxs12(
19723
- "div",
19724
- {
19725
- className: cn(
19726
- "flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
19727
- "shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
19728
- mobile ? "flex-wrap justify-center" : "flex-nowrap"
19729
- ),
19730
- children: [
19731
- /* @__PURE__ */ jsxs12(Tooltip, { children: [
19732
- /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
19733
- CustomToolbarButton,
19734
- {
19735
- type: "button",
19736
- "aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
19737
- "aria-pressed": itemEditOn,
19738
- onClick: onToggleItemEdit,
19739
- className: "group size-8",
19740
- children: /* @__PURE__ */ jsx21(
19741
- Star,
19742
- {
19743
- size: 16,
19744
- fill: "currentColor",
19745
- strokeWidth: 0,
19746
- className: cn(
19747
- "transition-colors",
19748
- itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
19749
- ),
19750
- style: { pointerEvents: "none" }
19751
- }
19752
- )
19753
- }
19754
- ) }),
19755
- /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
19756
- ] }),
19757
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19758
- /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(ImageIcon2, { size: 16, style: { pointerEvents: "none" } }) }),
19759
- /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(LinkIcon, { size: 16, style: { pointerEvents: "none" } }) }),
19760
- /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ jsx21(ArrowLeft2, { size: 16, style: { pointerEvents: "none" } }) }),
19761
- /* @__PURE__ */ jsx21(
19762
- ToolbarAction,
19763
- {
19764
- label: gatedLabel("Move right"),
19765
- onClick: onMoveRight,
19766
- disabled: !itemEditOn || index >= itemCount - 1,
19767
- children: /* @__PURE__ */ jsx21(ArrowRight2, { size: 16, style: { pointerEvents: "none" } })
19768
- }
19769
- ),
19770
- /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ jsx21(ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
19771
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19772
- /* @__PURE__ */ jsx21(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
19773
- /* @__PURE__ */ jsx21(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
19774
- /* @__PURE__ */ jsx21(
19775
- ToolbarAction,
19776
- {
19777
- label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
19778
- active: treatment === "grayscale",
19779
- onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
19780
- children: /* @__PURE__ */ jsx21(Palette, { size: 16, style: { pointerEvents: "none" } })
19781
- }
19782
- ),
19783
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19784
- ALIGNS.map(({ value, label, Icon }) => /* @__PURE__ */ jsx21(ToolbarAction, { label, active: align === value, onClick: () => onSetAlign(value), children: /* @__PURE__ */ jsx21(Icon, { size: 16, style: { pointerEvents: "none" } }) }, value)),
19785
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19786
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ jsx21(Minus, { size: 16, style: { pointerEvents: "none" } }) }),
19787
- /* @__PURE__ */ jsxs12("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
19788
- sizeValue,
19789
- "px"
19790
- ] }),
19791
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ jsx21(Plus2, { size: 16, style: { pointerEvents: "none" } }) }),
19792
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19793
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ jsx21(ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
19794
- ]
19795
- }
19796
- ),
19797
- error && /* @__PURE__ */ jsx21("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
19426
+ /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19427
+ VARIANTS.map((v) => /* @__PURE__ */ jsx20(Pill, { label: v.label, active: variant === v.value, onClick: () => onSetVariant(v.value) }, v.value)),
19428
+ ALIGNS.map((a) => /* @__PURE__ */ jsx20(Pill, { label: a.label, active: align === a.value, onClick: () => onSetAlign(a.value) }, a.value))
19429
+ ] }),
19430
+ /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19431
+ HOVERS.map((h) => /* @__PURE__ */ jsx20(Pill, { label: h.label, active: hover === h.value, onClick: () => onSetHover(h.value) }, h.value)),
19432
+ TREATMENTS.map((t) => /* @__PURE__ */ jsx20(Pill, { label: t.label, active: treatment === t.value, onClick: () => onSetTreatment(t.value) }, t.value))
19433
+ ] }),
19434
+ /* @__PURE__ */ jsxs11("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
19435
+ /* @__PURE__ */ jsx20(Pill, { label: "\u2212", onClick: () => onResize(-8) }),
19436
+ /* @__PURE__ */ jsxs11("span", { style: { color: "#ffffff", fontSize: 12, minWidth: 34, textAlign: "center" }, children: [
19437
+ sizeValue,
19438
+ "px"
19439
+ ] }),
19440
+ /* @__PURE__ */ jsx20(Pill, { label: "+", onClick: () => onResize(8) })
19441
+ ] }),
19442
+ /* @__PURE__ */ jsx20("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ jsx20(AltInput, { value: currentAlt, onCommit: onSetAlt }) }),
19443
+ /* @__PURE__ */ jsx20("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ jsx20(LinkInput, { value: currentHref2, onCommit: (href) => onSetLink(href, currentTarget) }) }),
19444
+ currentHref2 && /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19445
+ /* @__PURE__ */ jsx20(Pill, { label: "New tab", active: currentTarget === "new-tab", onClick: () => onSetLink(currentHref2, "new-tab") }),
19446
+ /* @__PURE__ */ jsx20(Pill, { label: "Same tab", active: currentTarget === "same-tab", onClick: () => onSetLink(currentHref2, "same-tab") })
19447
+ ] }),
19448
+ /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19449
+ /* @__PURE__ */ jsx20(Pill, { label: "Change Image", onClick: onChangeImage }),
19450
+ /* @__PURE__ */ jsx20(Pill, { label: "+ Item", onClick: onAddItem }),
19451
+ /* @__PURE__ */ jsx20(Pill, { label: "\u2212 Item", onClick: onRemoveItem, disabled: itemCount <= 1 })
19452
+ ] }),
19453
+ /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19454
+ /* @__PURE__ */ jsx20(Pill, { label: "\u2190 Move", onClick: onMoveLeft, disabled: index <= 0 }),
19455
+ /* @__PURE__ */ jsx20(Pill, { label: "\u2192 Move", onClick: onMoveRight, disabled: index >= itemCount - 1 })
19456
+ ] }),
19457
+ error && /* @__PURE__ */ jsx20("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
19798
19458
  ]
19799
19459
  }
19800
- ) });
19460
+ );
19801
19461
  }
19802
19462
  function findMediaStripSlots(tree) {
19803
19463
  const stack = tree.rows.flatMap((row) => row.blocks);
@@ -19816,23 +19476,31 @@ function AiMediaStripOverlay({
19816
19476
  }) {
19817
19477
  const [hover, setHover] = useState8(null);
19818
19478
  const [active, setActive] = useState8(null);
19819
- const [itemEditOn, setItemEditOn] = useState8(false);
19820
- const [linkOpen, setLinkOpen] = useState8(false);
19821
19479
  const [pending, setPending] = useState8(false);
19822
19480
  const [error, setError] = useState8(null);
19823
19481
  const activeRef = useRef5(null);
19824
19482
  activeRef.current = active;
19825
- const linkOpenRef = useRef5(false);
19826
- linkOpenRef.current = linkOpen;
19827
19483
  useEffect9(() => {
19828
19484
  const onMove = (e) => {
19829
- const ref = itemRefFromTarget(e.target);
19830
19485
  const t = e.target;
19831
- const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
19832
- setHover((prev) => {
19833
- const next = ref && !overEditable ? ref : null;
19834
- return sameRef(prev, next) ? prev : next;
19835
- });
19486
+ if (!(t instanceof HTMLElement)) return;
19487
+ if (t.closest("[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review]")) {
19488
+ return;
19489
+ }
19490
+ const itemEl = t.closest("[data-ohw-media-strip-item]");
19491
+ if (!itemEl) {
19492
+ setHover(null);
19493
+ return;
19494
+ }
19495
+ const sectionEl = itemEl.closest("[data-ohw-section]");
19496
+ const unit = sectionEl ? movableUnit(sectionEl) : null;
19497
+ const sectionId = unit ? instanceIdOf(unit) || null : null;
19498
+ const index = Number(itemEl.dataset.ohwMediaStripIndex);
19499
+ if (!sectionId || Number.isNaN(index)) {
19500
+ setHover(null);
19501
+ return;
19502
+ }
19503
+ setHover({ sectionId, index });
19836
19504
  };
19837
19505
  const onLeave = () => setHover(null);
19838
19506
  document.addEventListener("mousemove", onMove, { passive: true });
@@ -19844,25 +19512,23 @@ function AiMediaStripOverlay({
19844
19512
  }, []);
19845
19513
  useEffect9(() => {
19846
19514
  const onClick = (e) => {
19515
+ const current = activeRef.current;
19516
+ if (!current) return;
19847
19517
  const t = e.target;
19848
- if (!(t instanceof Element)) return;
19849
- if (t.closest(CHROME_SELECTOR)) return;
19850
- const ref = itemRefFromTarget(t);
19851
- if (sameRef(activeRef.current, ref)) return;
19852
- if (ref) clearInteractionChromeRef.current();
19853
- setItemEditOn(false);
19518
+ if (!(t instanceof HTMLElement)) return;
19519
+ if (t.closest("[data-ohw-item-interaction]")) return;
19520
+ const itemEl = findMediaStripItemElement(current.sectionId, current.index);
19521
+ if (itemEl && itemEl.contains(t)) return;
19522
+ setActive(null);
19854
19523
  setError(null);
19855
- setActive(ref);
19856
19524
  };
19857
19525
  document.addEventListener("click", onClick, true);
19858
19526
  return () => document.removeEventListener("click", onClick, true);
19859
- }, [clearInteractionChromeRef]);
19527
+ }, []);
19860
19528
  useEffect9(() => {
19861
19529
  const onBlur = () => {
19862
19530
  if (!activeRef.current) return;
19863
19531
  setActive(null);
19864
- setItemEditOn(false);
19865
- setLinkOpen(false);
19866
19532
  setError(null);
19867
19533
  };
19868
19534
  window.addEventListener("blur", onBlur);
@@ -19872,10 +19538,7 @@ function AiMediaStripOverlay({
19872
19538
  const onKeyDown = (e) => {
19873
19539
  if (e.key !== "Escape") return;
19874
19540
  if (!activeRef.current) return;
19875
- if (linkOpenRef.current) return;
19876
- if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
19877
19541
  setActive(null);
19878
- setItemEditOn(false);
19879
19542
  setError(null);
19880
19543
  };
19881
19544
  document.addEventListener("keydown", onKeyDown);
@@ -19909,133 +19572,137 @@ function AiMediaStripOverlay({
19909
19572
  tree: nextTree,
19910
19573
  label: entry.label,
19911
19574
  media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
19912
- ...entry.brand ? { brand: entry.brand } : {},
19913
- // The user is already looking at the strip they just edited — recentering the viewport
19914
- // on every edit reads as the section jumping around.
19915
- skipScrollIntoView: true
19575
+ ...entry.brand ? { brand: entry.brand } : {}
19916
19576
  });
19917
19577
  return true;
19918
19578
  },
19919
19579
  [findEntry, postToParent2, applyTreeLocalRef]
19920
19580
  );
19921
19581
  const activeEntry = active ? findEntry(active.sectionId) : null;
19582
+ const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
19922
19583
  const activeItemRect = useLiveItemRect(active);
19923
- const activeStripRect = useLiveItemRect(active, true);
19924
- const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
19925
- const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
19926
- const activeItem = active ? activeItems[active.index] : void 0;
19927
- const activeHref = activeItem?.href ?? "";
19928
- const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
19929
- return /* @__PURE__ */ jsxs12(Fragment7, { children: [
19930
- hoverRect && /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
19931
- activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ jsxs12(Fragment7, { children: [
19932
- /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
19933
- /* @__PURE__ */ jsx21(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ jsx21(
19934
- MediaStripToolbar,
19935
- {
19936
- entry: activeEntry,
19937
- index: active.index,
19938
- pending,
19939
- error,
19940
- itemEditOn,
19941
- onToggleItemEdit: () => setItemEditOn((on) => !on),
19942
- onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
19943
- onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
19944
- onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
19945
- onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
19946
- onResize: (delta) => {
19947
- const slots = findMediaStripSlots(activeEntry.tree);
19948
- const variant = slots?.variant === "reel" ? "reel" : "logos";
19949
- const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19950
- void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
19951
- },
19952
- onOpenLink: () => setLinkOpen(true),
19953
- onAddItem: () => {
19954
- void requestAssetPick(postToParent2).then((picked) => {
19955
- if (!picked) return;
19956
- const item = { assetId: picked.assetId, alt: "Logo" };
19584
+ const TOOLBAR_APPROX_H = 170;
19585
+ const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
19586
+ return /* @__PURE__ */ jsxs11(Fragment7, { children: [
19587
+ hoverHandleRect && hover && /* @__PURE__ */ jsx20(
19588
+ "button",
19589
+ {
19590
+ type: "button",
19591
+ "data-ohw-toolbar": "",
19592
+ onClick: () => {
19593
+ clearInteractionChromeRef.current();
19594
+ setActive(hover);
19595
+ },
19596
+ "aria-label": "Configure media item",
19597
+ style: {
19598
+ position: "fixed",
19599
+ top: hoverHandleRect.top + 8,
19600
+ left: hoverHandleRect.left + hoverHandleRect.width - 36,
19601
+ width: 28,
19602
+ height: 28,
19603
+ borderRadius: 8,
19604
+ border: `1.5px dashed ${PRIMARY3}`,
19605
+ background: "#ffffff",
19606
+ color: PRIMARY3,
19607
+ display: "flex",
19608
+ alignItems: "center",
19609
+ justifyContent: "center",
19610
+ cursor: "pointer",
19611
+ zIndex: 2147483643,
19612
+ fontSize: 14,
19613
+ fontWeight: 700
19614
+ },
19615
+ children: /* @__PURE__ */ jsx20(Star, { size: 14, style: { pointerEvents: "none" } })
19616
+ }
19617
+ ),
19618
+ activeItemRect && active && activeEntry && /* @__PURE__ */ jsx20(
19619
+ ItemInteractionLayer,
19620
+ {
19621
+ rect: activeItemRect,
19622
+ state: toolbarState,
19623
+ toolbar: /* @__PURE__ */ jsx20(
19624
+ MediaStripToolbar,
19625
+ {
19626
+ entry: activeEntry,
19627
+ index: active.index,
19628
+ pending,
19629
+ error,
19630
+ onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
19631
+ onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
19632
+ onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
19633
+ onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
19634
+ onResize: (delta) => {
19635
+ const slots = findMediaStripSlots(activeEntry.tree);
19636
+ const variant = slots?.variant === "reel" ? "reel" : "logos";
19637
+ const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19638
+ void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
19639
+ },
19640
+ onSetAlt: (alt) => {
19641
+ void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
19642
+ },
19643
+ onSetLink: (href, linkTarget) => {
19957
19644
  void runMutation(
19958
19645
  active.sectionId,
19959
- (tree) => addMediaStripItem(tree, item, active.index),
19960
- { [picked.assetId]: picked.url }
19961
- ).then((applied) => {
19962
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19646
+ (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
19647
+ );
19648
+ },
19649
+ onAddItem: () => {
19650
+ void requestAssetPick(postToParent2).then((picked) => {
19651
+ if (!picked) return;
19652
+ const item = { assetId: picked.assetId, alt: "Logo" };
19653
+ void runMutation(
19654
+ active.sectionId,
19655
+ (tree) => addMediaStripItem(tree, item, active.index),
19656
+ { [picked.assetId]: picked.url }
19657
+ ).then((applied) => {
19658
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19659
+ });
19963
19660
  });
19964
- });
19965
- },
19966
- onChangeImage: () => {
19967
- void requestAssetPick(postToParent2).then((picked) => {
19968
- if (!picked) return;
19969
- void runMutation(
19970
- active.sectionId,
19971
- (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
19972
- { [picked.assetId]: picked.url }
19661
+ },
19662
+ onChangeImage: () => {
19663
+ void requestAssetPick(postToParent2).then((picked) => {
19664
+ if (!picked) return;
19665
+ void runMutation(
19666
+ active.sectionId,
19667
+ (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
19668
+ { [picked.assetId]: picked.url }
19669
+ );
19670
+ });
19671
+ },
19672
+ onRemoveItem: () => {
19673
+ void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
19674
+ (applied) => {
19675
+ if (applied) setActive(null);
19676
+ }
19973
19677
  );
19974
- });
19975
- },
19976
- onRemoveItem: () => {
19977
- void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
19978
- (applied) => {
19979
- if (applied) setActive(null);
19980
- }
19981
- );
19982
- },
19983
- onMoveLeft: () => {
19984
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
19985
- (applied) => {
19986
- if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
19987
- }
19988
- );
19989
- },
19990
- onMoveRight: () => {
19991
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
19992
- (applied) => {
19993
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19994
- }
19995
- );
19996
- }
19997
- }
19998
- ) }),
19999
- /* @__PURE__ */ jsx21(
20000
- "div",
20001
- {
20002
- "data-ohw-bridge": "",
20003
- "data-ohw-item-interaction": "",
20004
- "aria-hidden": true,
20005
- className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
20006
- style: {
20007
- top: activeItemRect.top + activeItemRect.height + 10,
20008
- left: activeItemRect.left - 5,
20009
- background: PRIMARY3,
20010
- zIndex: 2147483644
20011
- },
20012
- children: "Media item"
20013
- }
20014
- ),
20015
- linkOpen && /* @__PURE__ */ jsx21(
20016
- LinkModal,
20017
- {
20018
- href: activeHref,
20019
- linkTarget: activeTarget,
20020
- onClose: () => setLinkOpen(false),
20021
- onSave: (href, linkTarget) => {
20022
- void runMutation(
20023
- active.sectionId,
20024
- (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
20025
- );
19678
+ },
19679
+ onMoveLeft: () => {
19680
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
19681
+ (applied) => {
19682
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
19683
+ }
19684
+ );
19685
+ },
19686
+ onMoveRight: () => {
19687
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
19688
+ (applied) => {
19689
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19690
+ }
19691
+ );
19692
+ }
20026
19693
  }
20027
- }
20028
- )
20029
- ] })
19694
+ )
19695
+ }
19696
+ )
20030
19697
  ] });
20031
19698
  }
20032
19699
 
20033
19700
  // src/ui/ai-section/AiPricingCardOverlay.tsx
20034
- import { useCallback as useCallback4, useEffect as useEffect10, useLayoutEffect as useLayoutEffect5, useRef as useRef6, useState as useState9 } from "react";
20035
- import { Check as Check3, ChevronDown as ChevronDown4, Minus as Minus2, Plus as Plus3, Star as Star2 } from "lucide-react";
20036
- import { Fragment as Fragment8, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
19701
+ import { useCallback as useCallback4, useEffect as useEffect10, useLayoutEffect as useLayoutEffect4, useRef as useRef6, useState as useState9 } from "react";
19702
+ import { Check as Check2, ChevronDown as ChevronDown3, Minus, Plus as Plus2, Star as Star2 } from "lucide-react";
19703
+ import { Fragment as Fragment8, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
20037
19704
  var PRIMARY4 = "var(--ohw-primary, #0885FE)";
20038
- var CHROME_SELECTOR2 = "[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review], [data-ohw-more-menu]";
19705
+ var CHROME_SELECTOR = "[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review], [data-ohw-more-menu]";
20039
19706
  function findPricingCardElement(sectionId, index) {
20040
19707
  const sectionEl = findByInstanceId(sectionId);
20041
19708
  if (!sectionEl) return null;
@@ -20047,7 +19714,7 @@ function findPricingCardElement(sectionId, index) {
20047
19714
  }
20048
19715
  function cardRefFromTarget(target) {
20049
19716
  if (!(target instanceof Element)) return null;
20050
- if (target.closest(CHROME_SELECTOR2)) return null;
19717
+ if (target.closest(CHROME_SELECTOR)) return null;
20051
19718
  const cardEl = target.closest("[data-ohw-pricing-card]");
20052
19719
  if (!cardEl) return null;
20053
19720
  const sectionEl = cardEl.closest("[data-ohw-section]");
@@ -20057,21 +19724,21 @@ function cardRefFromTarget(target) {
20057
19724
  if (!sectionId || Number.isNaN(index)) return null;
20058
19725
  return { sectionId, index };
20059
19726
  }
20060
- function sameRef2(a, b) {
19727
+ function sameRef(a, b) {
20061
19728
  return a?.sectionId === b?.sectionId && a?.index === b?.index;
20062
19729
  }
20063
- function rectOf2(el) {
19730
+ function rectOf(el) {
20064
19731
  if (!el) return null;
20065
19732
  const r2 = el.getBoundingClientRect();
20066
19733
  if (r2.width <= 0 || r2.height <= 0) return null;
20067
19734
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
20068
19735
  }
20069
19736
  function readRect3(ref) {
20070
- return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
19737
+ return rectOf(ref && findPricingCardElement(ref.sectionId, ref.index));
20071
19738
  }
20072
19739
  function readGridRect(ref) {
20073
19740
  const card = ref && findPricingCardElement(ref.sectionId, ref.index);
20074
- return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
19741
+ return rectOf(card?.closest("[data-ohw-pricing-collection]") ?? card);
20075
19742
  }
20076
19743
  function useLiveCardRect(ref, grid = false) {
20077
19744
  const [rect, setRect] = useState9(null);
@@ -20101,19 +19768,19 @@ function useLiveCardRect(ref, grid = false) {
20101
19768
  }
20102
19769
  var TOOLBAR_GRID_GAP = 52;
20103
19770
  var TOOLBAR_GRID_GAP_MOBILE = 42;
20104
- var TOOLBAR_EDGE_MARGIN3 = 4;
19771
+ var TOOLBAR_EDGE_MARGIN2 = 4;
20105
19772
  function GridToolbarSlot({ gridRect, children }) {
20106
19773
  const slotRef = useRef6(null);
20107
19774
  const [shift, setShift] = useState9(0);
20108
19775
  const centerX = gridRect.left + gridRect.width / 2;
20109
- useLayoutEffect5(() => {
19776
+ useLayoutEffect4(() => {
20110
19777
  const slot = slotRef.current;
20111
19778
  if (!slot) return;
20112
19779
  const clamp = () => {
20113
19780
  const w = slot.offsetWidth;
20114
19781
  if (w <= 0) return;
20115
19782
  const half = w / 2;
20116
- const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
19783
+ const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
20117
19784
  setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
20118
19785
  };
20119
19786
  clamp();
@@ -20122,7 +19789,7 @@ function GridToolbarSlot({ gridRect, children }) {
20122
19789
  return () => ro.disconnect();
20123
19790
  }, [centerX, children]);
20124
19791
  const mobile = window.innerWidth <= 480;
20125
- return /* @__PURE__ */ jsx22(
19792
+ return /* @__PURE__ */ jsx21(
20126
19793
  "div",
20127
19794
  {
20128
19795
  ref: slotRef,
@@ -20157,7 +19824,7 @@ function requestValidateTree2(postToParent2, tree) {
20157
19824
  });
20158
19825
  }
20159
19826
  function StyleSwatch({ style }) {
20160
- return /* @__PURE__ */ jsx22(
19827
+ return /* @__PURE__ */ jsx21(
20161
19828
  "span",
20162
19829
  {
20163
19830
  "aria-hidden": true,
@@ -20171,35 +19838,35 @@ function StyleSwatch({ style }) {
20171
19838
  );
20172
19839
  }
20173
19840
  function ButtonGlyph() {
20174
- return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20175
- /* @__PURE__ */ jsx22("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
20176
- /* @__PURE__ */ jsx22("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
19841
+ return /* @__PURE__ */ jsxs12("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
19842
+ /* @__PURE__ */ jsx21("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
19843
+ /* @__PURE__ */ jsx21("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
20177
19844
  ] });
20178
19845
  }
20179
19846
  function FeatureGlyph({ mode }) {
20180
- return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20181
- /* @__PURE__ */ jsx22("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
20182
- /* @__PURE__ */ jsx22("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
20183
- /* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
20184
- /* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
20185
- /* @__PURE__ */ jsx22("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
20186
- mode === "add" && /* @__PURE__ */ jsx22("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
19847
+ return /* @__PURE__ */ jsxs12("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
19848
+ /* @__PURE__ */ jsx21("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
19849
+ /* @__PURE__ */ jsx21("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
19850
+ /* @__PURE__ */ jsx21("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
19851
+ /* @__PURE__ */ jsx21("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
19852
+ /* @__PURE__ */ jsx21("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
19853
+ mode === "add" && /* @__PURE__ */ jsx21("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
20187
19854
  ] });
20188
19855
  }
20189
- function ToolbarAction2({
19856
+ function ToolbarAction({
20190
19857
  label,
20191
19858
  onClick,
20192
19859
  disabled = false,
20193
19860
  children
20194
19861
  }) {
20195
- const button = /* @__PURE__ */ jsx22(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
20196
- return /* @__PURE__ */ jsxs13(Tooltip, { children: [
20197
- /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: button }) : button }),
20198
- /* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
19862
+ const button = /* @__PURE__ */ jsx21(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
19863
+ return /* @__PURE__ */ jsxs12(Tooltip, { children: [
19864
+ /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: button }) : button }),
19865
+ /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
20199
19866
  ] });
20200
19867
  }
20201
- function ToolbarSeparator2() {
20202
- return /* @__PURE__ */ jsx22("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
19868
+ function ToolbarSeparator() {
19869
+ return /* @__PURE__ */ jsx21("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
20203
19870
  }
20204
19871
  function CardStyleMenu({
20205
19872
  value,
@@ -20207,7 +19874,7 @@ function CardStyleMenu({
20207
19874
  disabled = false
20208
19875
  }) {
20209
19876
  const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
20210
- const trigger = /* @__PURE__ */ jsxs13(
19877
+ const trigger = /* @__PURE__ */ jsxs12(
20211
19878
  "button",
20212
19879
  {
20213
19880
  type: "button",
@@ -20218,28 +19885,28 @@ function CardStyleMenu({
20218
19885
  disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
20219
19886
  ),
20220
19887
  children: [
20221
- /* @__PURE__ */ jsx22(StyleSwatch, { style: current.value }),
20222
- /* @__PURE__ */ jsx22("span", { className: "flex-1 text-left", children: current.label }),
20223
- /* @__PURE__ */ jsx22(ChevronDown4, { size: 16, style: { pointerEvents: "none" } })
19888
+ /* @__PURE__ */ jsx21(StyleSwatch, { style: current.value }),
19889
+ /* @__PURE__ */ jsx21("span", { className: "flex-1 text-left", children: current.label }),
19890
+ /* @__PURE__ */ jsx21(ChevronDown3, { size: 16, style: { pointerEvents: "none" } })
20224
19891
  ]
20225
19892
  }
20226
19893
  );
20227
19894
  if (disabled) {
20228
- return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20229
- /* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
20230
- /* @__PURE__ */ jsxs13(Tooltip, { children: [
20231
- /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: trigger }) }),
20232
- /* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
19895
+ return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
19896
+ /* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
19897
+ /* @__PURE__ */ jsxs12(Tooltip, { children: [
19898
+ /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: trigger }) }),
19899
+ /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
20233
19900
  ] })
20234
19901
  ] });
20235
19902
  }
20236
- return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20237
- /* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
20238
- /* @__PURE__ */ jsxs13(DropdownMenu, { modal: false, children: [
20239
- /* @__PURE__ */ jsx22(DropdownMenuTrigger, { asChild: true, children: trigger }),
20240
- /* @__PURE__ */ jsx22(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
19903
+ return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
19904
+ /* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
19905
+ /* @__PURE__ */ jsxs12(DropdownMenu, { modal: false, children: [
19906
+ /* @__PURE__ */ jsx21(DropdownMenuTrigger, { asChild: true, children: trigger }),
19907
+ /* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
20241
19908
  const selected = style.value === value;
20242
- return /* @__PURE__ */ jsxs13(
19909
+ return /* @__PURE__ */ jsxs12(
20243
19910
  DropdownMenuItem,
20244
19911
  {
20245
19912
  role: "menuitemradio",
@@ -20247,9 +19914,9 @@ function CardStyleMenu({
20247
19914
  onSelect: () => onChange(style.value),
20248
19915
  className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
20249
19916
  children: [
20250
- /* @__PURE__ */ jsx22(StyleSwatch, { style: style.value }),
20251
- /* @__PURE__ */ jsx22("span", { children: style.label }),
20252
- selected && /* @__PURE__ */ jsx22(Check3, { size: 16, className: "text-bridge-primary" })
19917
+ /* @__PURE__ */ jsx21(StyleSwatch, { style: style.value }),
19918
+ /* @__PURE__ */ jsx21("span", { children: style.label }),
19919
+ selected && /* @__PURE__ */ jsx21(Check2, { size: 16, className: "text-bridge-primary" })
20253
19920
  ]
20254
19921
  },
20255
19922
  style.value
@@ -20279,7 +19946,7 @@ function PricingCardToolbar({
20279
19946
  const style = pricingCardStyle(entry.tree, index);
20280
19947
  const featuredTag = pricingCardFeaturedTag(entry.tree, index);
20281
19948
  const mobile = window.innerWidth <= 480;
20282
- return /* @__PURE__ */ jsx22(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs13(
19949
+ return /* @__PURE__ */ jsx21(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs12(
20283
19950
  "div",
20284
19951
  {
20285
19952
  "data-ohw-bridge": "",
@@ -20291,7 +19958,7 @@ function PricingCardToolbar({
20291
19958
  ),
20292
19959
  style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
20293
19960
  children: [
20294
- /* @__PURE__ */ jsxs13(
19961
+ /* @__PURE__ */ jsxs12(
20295
19962
  "div",
20296
19963
  {
20297
19964
  className: cn(
@@ -20300,8 +19967,8 @@ function PricingCardToolbar({
20300
19967
  mobile ? "flex-wrap justify-center" : "flex-nowrap"
20301
19968
  ),
20302
19969
  children: [
20303
- /* @__PURE__ */ jsxs13(Tooltip, { children: [
20304
- /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22(
19970
+ /* @__PURE__ */ jsxs12(Tooltip, { children: [
19971
+ /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
20305
19972
  CustomToolbarButton,
20306
19973
  {
20307
19974
  type: "button",
@@ -20309,7 +19976,7 @@ function PricingCardToolbar({
20309
19976
  "aria-pressed": featuredTag,
20310
19977
  onClick: () => onSetFeaturedTag(!featuredTag),
20311
19978
  className: "group size-8",
20312
- children: /* @__PURE__ */ jsx22(
19979
+ children: /* @__PURE__ */ jsx21(
20313
19980
  Star2,
20314
19981
  {
20315
19982
  size: 16,
@@ -20324,25 +19991,25 @@ function PricingCardToolbar({
20324
19991
  )
20325
19992
  }
20326
19993
  ) }),
20327
- /* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
19994
+ /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
20328
19995
  ] }),
20329
- /* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
20330
- /* @__PURE__ */ jsx22(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
20331
- /* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
20332
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ jsx22(ButtonGlyph, {}) }),
20333
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ jsxs13("span", { className: "relative inline-flex", children: [
20334
- /* @__PURE__ */ jsx22(ButtonGlyph, {}),
20335
- /* @__PURE__ */ jsx22(Minus2, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
19996
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19997
+ /* @__PURE__ */ jsx21(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
19998
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19999
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ jsx21(ButtonGlyph, {}) }),
20000
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ jsxs12("span", { className: "relative inline-flex", children: [
20001
+ /* @__PURE__ */ jsx21(ButtonGlyph, {}),
20002
+ /* @__PURE__ */ jsx21(Minus, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
20336
20003
  ] }) }),
20337
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "add" }) }),
20338
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "remove" }) }),
20339
- /* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
20340
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ jsx22(Plus3, { size: 16, style: { pointerEvents: "none" } }) }),
20341
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ jsx22(Minus2, { size: 16, style: { pointerEvents: "none" } }) })
20004
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ jsx21(FeatureGlyph, { mode: "add" }) }),
20005
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ jsx21(FeatureGlyph, { mode: "remove" }) }),
20006
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
20007
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ jsx21(Plus2, { size: 16, style: { pointerEvents: "none" } }) }),
20008
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ jsx21(Minus, { size: 16, style: { pointerEvents: "none" } }) })
20342
20009
  ]
20343
20010
  }
20344
20011
  ),
20345
- error && /* @__PURE__ */ jsx22("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
20012
+ error && /* @__PURE__ */ jsx21("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
20346
20013
  ]
20347
20014
  }
20348
20015
  ) });
@@ -20376,7 +20043,7 @@ function AiPricingCardOverlay({
20376
20043
  const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
20377
20044
  setHover((prev) => {
20378
20045
  const next = ref && !overEditable ? ref : null;
20379
- return sameRef2(prev, next) ? prev : next;
20046
+ return sameRef(prev, next) ? prev : next;
20380
20047
  });
20381
20048
  };
20382
20049
  const onLeave = () => setHover(null);
@@ -20391,10 +20058,10 @@ function AiPricingCardOverlay({
20391
20058
  const onClick = (e) => {
20392
20059
  const t = e.target;
20393
20060
  if (!(t instanceof Element)) return;
20394
- if (t.closest(CHROME_SELECTOR2)) return;
20061
+ if (t.closest(CHROME_SELECTOR)) return;
20395
20062
  const ref = cardRefFromTarget(t);
20396
- setActive((prev) => sameRef2(prev, ref) ? prev : ref);
20397
- if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
20063
+ setActive((prev) => sameRef(prev, ref) ? prev : ref);
20064
+ if (!ref || !sameRef(activeRef.current, ref)) setError(null);
20398
20065
  };
20399
20066
  document.addEventListener("click", onClick, true);
20400
20067
  return () => document.removeEventListener("click", onClick, true);
@@ -20459,12 +20126,12 @@ function AiPricingCardOverlay({
20459
20126
  const activeEntry = active ? findEntry(active.sectionId) : null;
20460
20127
  const activeCardRect = useLiveCardRect(active);
20461
20128
  const activeGridRect = useLiveCardRect(active, true);
20462
- const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
20463
- return /* @__PURE__ */ jsxs13(Fragment8, { children: [
20464
- hoverRect && /* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20465
- activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ jsxs13(Fragment8, { children: [
20466
- /* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
20467
- /* @__PURE__ */ jsx22(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ jsx22(
20129
+ const hoverRect = useLiveCardRect(hover && !sameRef(hover, active) ? hover : null);
20130
+ return /* @__PURE__ */ jsxs12(Fragment8, { children: [
20131
+ hoverRect && /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20132
+ activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ jsxs12(Fragment8, { children: [
20133
+ /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
20134
+ /* @__PURE__ */ jsx21(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ jsx21(
20468
20135
  PricingCardToolbar,
20469
20136
  {
20470
20137
  entry: activeEntry,
@@ -20492,7 +20159,7 @@ function AiPricingCardOverlay({
20492
20159
  onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
20493
20160
  }
20494
20161
  ) }),
20495
- /* @__PURE__ */ jsx22(
20162
+ /* @__PURE__ */ jsx21(
20496
20163
  "div",
20497
20164
  {
20498
20165
  "data-ohw-bridge": "",
@@ -20556,11 +20223,39 @@ function clearVideo(tree, path) {
20556
20223
  });
20557
20224
  }
20558
20225
 
20226
+ // src/lib/youtube.ts
20227
+ var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
20228
+ function extractYouTubeId(input) {
20229
+ const trimmed = input.trim();
20230
+ if (!trimmed) return null;
20231
+ if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
20232
+ let url;
20233
+ try {
20234
+ url = new URL(trimmed);
20235
+ } catch {
20236
+ return null;
20237
+ }
20238
+ const host = url.hostname.replace(/^www\./, "");
20239
+ if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
20240
+ return null;
20241
+ }
20242
+ let candidate = null;
20243
+ if (host === "youtu.be") {
20244
+ candidate = url.pathname.slice(1).split("/")[0] ?? null;
20245
+ } else if (url.pathname === "/watch") {
20246
+ candidate = url.searchParams.get("v");
20247
+ } else {
20248
+ const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
20249
+ candidate = match ? match[1] : null;
20250
+ }
20251
+ return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
20252
+ }
20253
+
20559
20254
  // src/ui/ai-section/AiVideoOverlay.tsx
20560
- import { Fragment as Fragment9, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
20255
+ import { Fragment as Fragment9, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
20561
20256
  var PRIMARY5 = "#0885FE";
20562
- var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
20563
- var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20257
+ var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY5})`;
20258
+ var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20564
20259
  function findVideoBlockElement(sectionId, path) {
20565
20260
  const sectionEl = findByInstanceId(sectionId);
20566
20261
  if (!sectionEl) return null;
@@ -20620,12 +20315,12 @@ function requestValidateTree3(postToParent2, tree) {
20620
20315
  postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
20621
20316
  });
20622
20317
  }
20623
- function Pill({
20318
+ function Pill2({
20624
20319
  label,
20625
20320
  onClick,
20626
20321
  disabled
20627
20322
  }) {
20628
- return /* @__PURE__ */ jsx23(
20323
+ return /* @__PURE__ */ jsx22(
20629
20324
  "button",
20630
20325
  {
20631
20326
  type: "button",
@@ -20641,7 +20336,7 @@ function Pill({
20641
20336
  border: "none",
20642
20337
  cursor: disabled ? "default" : "pointer",
20643
20338
  background: "#ffffff",
20644
- color: OHW_BLUE_DARK,
20339
+ color: OHW_BLUE_DARK2,
20645
20340
  opacity: disabled ? 0.4 : 1,
20646
20341
  fontSize: 12,
20647
20342
  lineHeight: "16px",
@@ -20684,8 +20379,8 @@ function VideoUrlInput({ value, onCommit }) {
20684
20379
  onCommit(id);
20685
20380
  }
20686
20381
  };
20687
- return /* @__PURE__ */ jsxs14("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
20688
- /* @__PURE__ */ jsxs14(
20382
+ return /* @__PURE__ */ jsxs13("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
20383
+ /* @__PURE__ */ jsxs13(
20689
20384
  "div",
20690
20385
  {
20691
20386
  style: {
@@ -20701,12 +20396,12 @@ function VideoUrlInput({ value, onCommit }) {
20701
20396
  boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
20702
20397
  },
20703
20398
  children: [
20704
- /* @__PURE__ */ jsx23(
20399
+ /* @__PURE__ */ jsx22(
20705
20400
  "span",
20706
20401
  {
20707
20402
  style: {
20708
20403
  flex: "0 0 auto",
20709
- color: OHW_BLUE_DARK,
20404
+ color: OHW_BLUE_DARK2,
20710
20405
  fontSize: 10,
20711
20406
  lineHeight: "16px",
20712
20407
  fontWeight: 700,
@@ -20716,7 +20411,7 @@ function VideoUrlInput({ value, onCommit }) {
20716
20411
  children: "Video"
20717
20412
  }
20718
20413
  ),
20719
- /* @__PURE__ */ jsx23(
20414
+ /* @__PURE__ */ jsx22(
20720
20415
  "input",
20721
20416
  {
20722
20417
  type: "text",
@@ -20753,7 +20448,7 @@ function VideoUrlInput({ value, onCommit }) {
20753
20448
  ]
20754
20449
  }
20755
20450
  ),
20756
- invalid && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
20451
+ invalid && /* @__PURE__ */ jsx22("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
20757
20452
  ] });
20758
20453
  }
20759
20454
  function VideoToolbar({
@@ -20763,7 +20458,7 @@ function VideoToolbar({
20763
20458
  onSetVideoId,
20764
20459
  onRemove
20765
20460
  }) {
20766
- return /* @__PURE__ */ jsxs14(
20461
+ return /* @__PURE__ */ jsxs13(
20767
20462
  "div",
20768
20463
  {
20769
20464
  "data-ohw-bridge": "",
@@ -20775,7 +20470,7 @@ function VideoToolbar({
20775
20470
  gap: 6,
20776
20471
  alignItems: "center",
20777
20472
  width: 280,
20778
- background: OHW_BLUE,
20473
+ background: OHW_BLUE2,
20779
20474
  padding: 8,
20780
20475
  borderRadius: 12,
20781
20476
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -20783,9 +20478,9 @@ function VideoToolbar({
20783
20478
  opacity: pending ? 0.6 : 1
20784
20479
  },
20785
20480
  children: [
20786
- /* @__PURE__ */ jsx23(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
20787
- /* @__PURE__ */ jsx23(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
20788
- error && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20481
+ /* @__PURE__ */ jsx22(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
20482
+ /* @__PURE__ */ jsx22(Pill2, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
20483
+ error && /* @__PURE__ */ jsx22("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20789
20484
  ]
20790
20485
  }
20791
20486
  );
@@ -20905,8 +20600,8 @@ function AiVideoOverlay({
20905
20600
  const activeBlockRect = useLiveBlockRect(active);
20906
20601
  const TOOLBAR_APPROX_H = 90;
20907
20602
  const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
20908
- return /* @__PURE__ */ jsxs14(Fragment9, { children: [
20909
- hoverHandleRect && hover && /* @__PURE__ */ jsx23(
20603
+ return /* @__PURE__ */ jsxs13(Fragment9, { children: [
20604
+ hoverHandleRect && hover && /* @__PURE__ */ jsx22(
20910
20605
  "button",
20911
20606
  {
20912
20607
  type: "button",
@@ -20934,15 +20629,15 @@ function AiVideoOverlay({
20934
20629
  fontSize: 14,
20935
20630
  fontWeight: 700
20936
20631
  },
20937
- children: /* @__PURE__ */ jsx23(Star3, { size: 14, style: { pointerEvents: "none" } })
20632
+ children: /* @__PURE__ */ jsx22(Star3, { size: 14, style: { pointerEvents: "none" } })
20938
20633
  }
20939
20634
  ),
20940
- activeBlockRect && active && activeEntry && /* @__PURE__ */ jsx23(
20635
+ activeBlockRect && active && activeEntry && /* @__PURE__ */ jsx22(
20941
20636
  ItemInteractionLayer,
20942
20637
  {
20943
20638
  rect: activeBlockRect,
20944
20639
  state: toolbarState,
20945
- toolbar: /* @__PURE__ */ jsx23(
20640
+ toolbar: /* @__PURE__ */ jsx22(
20946
20641
  VideoToolbar,
20947
20642
  {
20948
20643
  videoId: videoIdAt(activeEntry.tree, active.path),
@@ -21017,10 +20712,10 @@ function setCarouselAutoplay(tree, on) {
21017
20712
  }
21018
20713
 
21019
20714
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
21020
- import { Fragment as Fragment10, jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
20715
+ import { Fragment as Fragment10, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
21021
20716
  var PRIMARY6 = "#0885FE";
21022
- var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
21023
- var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
20717
+ var OHW_BLUE3 = `var(--ohw-primary, ${PRIMARY6})`;
20718
+ var OHW_BLUE_DARK3 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
21024
20719
  function findCarouselItemElement(sectionId, index) {
21025
20720
  const sectionEl = findByInstanceId(sectionId);
21026
20721
  if (!sectionEl) return null;
@@ -21099,8 +20794,8 @@ function requestAssetPick2(postToParent2) {
21099
20794
  postToParent2({ type: "ow:asset-pick", id });
21100
20795
  });
21101
20796
  }
21102
- function Pill2({ label, onClick, disabled }) {
21103
- return /* @__PURE__ */ jsx24(
20797
+ function Pill3({ label, onClick, disabled }) {
20798
+ return /* @__PURE__ */ jsx23(
21104
20799
  "button",
21105
20800
  {
21106
20801
  type: "button",
@@ -21116,7 +20811,7 @@ function Pill2({ label, onClick, disabled }) {
21116
20811
  border: "none",
21117
20812
  cursor: disabled ? "default" : "pointer",
21118
20813
  background: "#ffffff",
21119
- color: OHW_BLUE_DARK2,
20814
+ color: OHW_BLUE_DARK3,
21120
20815
  opacity: disabled ? 0.4 : 1,
21121
20816
  fontSize: 12,
21122
20817
  lineHeight: "16px",
@@ -21134,7 +20829,7 @@ function TogglePill({
21134
20829
  onToggle,
21135
20830
  disabled
21136
20831
  }) {
21137
- return /* @__PURE__ */ jsxs15(
20832
+ return /* @__PURE__ */ jsxs14(
21138
20833
  "button",
21139
20834
  {
21140
20835
  type: "button",
@@ -21153,7 +20848,7 @@ function TogglePill({
21153
20848
  border: "none",
21154
20849
  cursor: disabled ? "default" : "pointer",
21155
20850
  background: "#ffffff",
21156
- color: OHW_BLUE_DARK2,
20851
+ color: OHW_BLUE_DARK3,
21157
20852
  opacity: disabled ? 0.4 : 1,
21158
20853
  fontSize: 12,
21159
20854
  lineHeight: "16px",
@@ -21163,7 +20858,7 @@ function TogglePill({
21163
20858
  },
21164
20859
  children: [
21165
20860
  label,
21166
- /* @__PURE__ */ jsx24(
20861
+ /* @__PURE__ */ jsx23(
21167
20862
  "span",
21168
20863
  {
21169
20864
  "aria-hidden": true,
@@ -21176,10 +20871,10 @@ function TogglePill({
21176
20871
  // Off is a grey track, not a washed-out blue: the pill's own white background already
21177
20872
  // carries the brand colour in the text, and a pale blue track next to it read as
21178
20873
  // "disabled control" rather than "switch that is off".
21179
- background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
20874
+ background: on ? OHW_BLUE_DARK3 : "#CBD5E1",
21180
20875
  transition: "background 120ms ease"
21181
20876
  },
21182
- children: /* @__PURE__ */ jsx24(
20877
+ children: /* @__PURE__ */ jsx23(
21183
20878
  "span",
21184
20879
  {
21185
20880
  style: {
@@ -21208,7 +20903,7 @@ function CarouselSlideToolbar({
21208
20903
  onChangeImage,
21209
20904
  onToggleAutoplay
21210
20905
  }) {
21211
- return /* @__PURE__ */ jsxs15(
20906
+ return /* @__PURE__ */ jsxs14(
21212
20907
  "div",
21213
20908
  {
21214
20909
  "data-ohw-bridge": "",
@@ -21219,7 +20914,7 @@ function CarouselSlideToolbar({
21219
20914
  flexDirection: "column",
21220
20915
  gap: 6,
21221
20916
  alignItems: "center",
21222
- background: OHW_BLUE2,
20917
+ background: OHW_BLUE3,
21223
20918
  padding: 8,
21224
20919
  borderRadius: 12,
21225
20920
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -21231,11 +20926,11 @@ function CarouselSlideToolbar({
21231
20926
  pointerEvents: pending ? "none" : "auto"
21232
20927
  },
21233
20928
  children: [
21234
- /* @__PURE__ */ jsxs15("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
21235
- /* @__PURE__ */ jsx24(Pill2, { label: "Change Image", onClick: onChangeImage }),
21236
- /* @__PURE__ */ jsx24(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
20929
+ /* @__PURE__ */ jsxs14("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
20930
+ /* @__PURE__ */ jsx23(Pill3, { label: "Change Image", onClick: onChangeImage }),
20931
+ /* @__PURE__ */ jsx23(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
21237
20932
  ] }),
21238
- error && /* @__PURE__ */ jsx24("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20933
+ error && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
21239
20934
  ]
21240
20935
  }
21241
20936
  );
@@ -21375,8 +21070,8 @@ function AiFadeCarouselOverlay({
21375
21070
  const activeItemRect = useLiveItemRect2(active);
21376
21071
  const TOOLBAR_APPROX_H = 90;
21377
21072
  const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
21378
- return /* @__PURE__ */ jsxs15(Fragment10, { children: [
21379
- hoverHandleRect && hover && /* @__PURE__ */ jsx24(
21073
+ return /* @__PURE__ */ jsxs14(Fragment10, { children: [
21074
+ hoverHandleRect && hover && /* @__PURE__ */ jsx23(
21380
21075
  "button",
21381
21076
  {
21382
21077
  type: "button",
@@ -21405,10 +21100,10 @@ function AiFadeCarouselOverlay({
21405
21100
  fontSize: 14,
21406
21101
  fontWeight: 700
21407
21102
  },
21408
- children: /* @__PURE__ */ jsx24(Star4, { size: 14, style: { pointerEvents: "none" } })
21103
+ children: /* @__PURE__ */ jsx23(Star4, { size: 14, style: { pointerEvents: "none" } })
21409
21104
  }
21410
21105
  ),
21411
- swapping && /* @__PURE__ */ jsx24(
21106
+ swapping && /* @__PURE__ */ jsx23(
21412
21107
  "div",
21413
21108
  {
21414
21109
  ref: skeletonRef,
@@ -21426,15 +21121,15 @@ function AiFadeCarouselOverlay({
21426
21121
  zIndex: 2147483646,
21427
21122
  pointerEvents: "none"
21428
21123
  },
21429
- children: /* @__PURE__ */ jsx24("style", { children: MEDIA_SKELETON_CSS })
21124
+ children: /* @__PURE__ */ jsx23("style", { children: MEDIA_SKELETON_CSS })
21430
21125
  }
21431
21126
  ),
21432
- activeItemRect && active && activeEntry && /* @__PURE__ */ jsx24(
21127
+ activeItemRect && active && activeEntry && /* @__PURE__ */ jsx23(
21433
21128
  ItemInteractionLayer,
21434
21129
  {
21435
21130
  rect: activeItemRect,
21436
21131
  state: toolbarState,
21437
- toolbar: /* @__PURE__ */ jsx24(
21132
+ toolbar: /* @__PURE__ */ jsx23(
21438
21133
  CarouselSlideToolbar,
21439
21134
  {
21440
21135
  pending,
@@ -21625,11 +21320,118 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
21625
21320
  // src/ui/link-modal/LinkPopover.tsx
21626
21321
  import { useEffect as useEffect16 } from "react";
21627
21322
 
21323
+ // src/ui/dialog.tsx
21324
+ import * as React9 from "react";
21325
+ import { Dialog as DialogPrimitive } from "radix-ui";
21326
+ import { X as X2 } from "lucide-react";
21327
+ import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
21328
+ function Dialog2({
21329
+ ...props
21330
+ }) {
21331
+ return /* @__PURE__ */ jsx24(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
21332
+ }
21333
+ function DialogPortal({
21334
+ ...props
21335
+ }) {
21336
+ return /* @__PURE__ */ jsx24(DialogPrimitive.Portal, { ...props });
21337
+ }
21338
+ function DialogOverlay({
21339
+ className,
21340
+ ...props
21341
+ }) {
21342
+ return /* @__PURE__ */ jsx24(
21343
+ DialogPrimitive.Overlay,
21344
+ {
21345
+ "data-slot": "dialog-overlay",
21346
+ "data-ohw-link-modal-root": "",
21347
+ className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
21348
+ ...props
21349
+ }
21350
+ );
21351
+ }
21352
+ var DialogContent = React9.forwardRef(
21353
+ ({ className, children, showCloseButton = true, container, ...props }, ref) => {
21354
+ const positionMode = container ? "absolute" : "fixed";
21355
+ return /* @__PURE__ */ jsxs15(DialogPortal, { container: container ?? void 0, children: [
21356
+ /* @__PURE__ */ jsx24(DialogOverlay, { className: cn(positionMode, "inset-0") }),
21357
+ /* @__PURE__ */ jsxs15(
21358
+ DialogPrimitive.Content,
21359
+ {
21360
+ ref,
21361
+ "data-slot": "dialog-content",
21362
+ className: cn(
21363
+ positionMode,
21364
+ "left-1/2 top-1/2 z-[2147483647] flex w-full max-w-[448px] -translate-x-1/2 -translate-y-1/2 flex-col overflow-visible",
21365
+ "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
21366
+ container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
21367
+ className
21368
+ ),
21369
+ onMouseDown: (e) => e.stopPropagation(),
21370
+ ...props,
21371
+ children: [
21372
+ children,
21373
+ showCloseButton ? /* @__PURE__ */ jsx24(
21374
+ DialogPrimitive.Close,
21375
+ {
21376
+ type: "button",
21377
+ className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
21378
+ "aria-label": "Close",
21379
+ children: /* @__PURE__ */ jsx24(X2, { size: 16, "aria-hidden": true })
21380
+ }
21381
+ ) : null
21382
+ ]
21383
+ }
21384
+ )
21385
+ ] });
21386
+ }
21387
+ );
21388
+ DialogContent.displayName = DialogPrimitive.Content.displayName;
21389
+ function DialogHeader({
21390
+ className,
21391
+ ...props
21392
+ }) {
21393
+ return /* @__PURE__ */ jsx24("div", { className: cn("flex flex-col gap-1.5", className), ...props });
21394
+ }
21395
+ function DialogFooter({
21396
+ className,
21397
+ ...props
21398
+ }) {
21399
+ return /* @__PURE__ */ jsx24(
21400
+ "div",
21401
+ {
21402
+ className: cn("flex items-center justify-end gap-2", className),
21403
+ ...props
21404
+ }
21405
+ );
21406
+ }
21407
+ var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
21408
+ DialogPrimitive.Title,
21409
+ {
21410
+ ref,
21411
+ className: cn(
21412
+ "text-lg font-semibold leading-none tracking-tight text-card-foreground",
21413
+ className
21414
+ ),
21415
+ ...props
21416
+ }
21417
+ ));
21418
+ DialogTitle.displayName = DialogPrimitive.Title.displayName;
21419
+ var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
21420
+ DialogPrimitive.Description,
21421
+ {
21422
+ ref,
21423
+ className: cn("text-sm text-muted-foreground", className),
21424
+ ...props
21425
+ }
21426
+ ));
21427
+ DialogDescription.displayName = DialogPrimitive.Description.displayName;
21428
+ var DialogClose = DialogPrimitive.Close;
21429
+
21628
21430
  // src/ui/link-modal/LinkEditorPanel.tsx
21629
21431
  import { Info, X as X4 } from "lucide-react";
21630
21432
 
21631
21433
  // src/ui/link-modal/DestinationBreadcrumb.tsx
21632
- import { ArrowRight as ArrowRight3, File, GalleryVertical } from "lucide-react";
21434
+ import { ArrowRight as ArrowRight2, File, GalleryVertical } from "lucide-react";
21633
21435
  import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
21634
21436
  function DestinationBreadcrumb({
21635
21437
  pageTitle,
@@ -21643,7 +21445,7 @@ function DestinationBreadcrumb({
21643
21445
  /* @__PURE__ */ jsx25("span", { className: "text-sm font-medium leading-none text-foreground!", children: pageTitle })
21644
21446
  ] }),
21645
21447
  /* @__PURE__ */ jsx25(
21646
- ArrowRight3,
21448
+ ArrowRight2,
21647
21449
  {
21648
21450
  size: 16,
21649
21451
  className: "shrink-0 text-muted-foreground",
@@ -21755,7 +21557,7 @@ function Label({ className, ...props }) {
21755
21557
  }
21756
21558
 
21757
21559
  // src/ui/link-modal/UrlOrPageInput.tsx
21758
- import { ChevronDown as ChevronDown5, File as File2, X as X3 } from "lucide-react";
21560
+ import { ChevronDown as ChevronDown4, File as File2, X as X3 } from "lucide-react";
21759
21561
  import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
21760
21562
  function FieldChevron({
21761
21563
  onClick
@@ -21768,7 +21570,7 @@ function FieldChevron({
21768
21570
  onClick,
21769
21571
  "aria-label": "Open page list",
21770
21572
  tabIndex: -1,
21771
- children: /* @__PURE__ */ jsx29(ChevronDown5, { size: 16 })
21573
+ children: /* @__PURE__ */ jsx29(ChevronDown4, { size: 16 })
21772
21574
  }
21773
21575
  );
21774
21576
  }
@@ -21998,7 +21800,7 @@ function LinkEditorPanel({ state, onClose }) {
21998
21800
  // src/ui/link-modal/SectionPickerOverlay.tsx
21999
21801
  import { useCallback as useCallback7, useEffect as useEffect14, useMemo as useMemo2, useRef as useRef10, useState as useState13 } from "react";
22000
21802
  import { createPortal as createPortal2 } from "react-dom";
22001
- import { ArrowLeft as ArrowLeft3, Check as Check4 } from "lucide-react";
21803
+ import { ArrowLeft as ArrowLeft2, Check as Check3 } from "lucide-react";
22002
21804
  import { usePathname as usePathname2, useRouter as useRouter2 } from "next/navigation";
22003
21805
 
22004
21806
  // src/lib/parent-scroll.ts
@@ -22275,7 +22077,7 @@ function SectionPickerOverlay({
22275
22077
  className: "h-8 min-w-0 gap-1 border-border bg-background px-2 py-1.5 shadow-sm hover:bg-muted cursor-pointer",
22276
22078
  onClick: onBack,
22277
22079
  children: [
22278
- /* @__PURE__ */ jsx31(ArrowLeft3, { className: "size-4 shrink-0", "aria-hidden": true }),
22080
+ /* @__PURE__ */ jsx31(ArrowLeft2, { className: "size-4 shrink-0", "aria-hidden": true }),
22279
22081
  "Back"
22280
22082
  ]
22281
22083
  }
@@ -22344,7 +22146,7 @@ function SectionPickerOverlay({
22344
22146
  className: "absolute right-3 top-3 flex size-8 items-center justify-center rounded-full text-white",
22345
22147
  style: { backgroundColor: "var(--ohw-primary, #0885fe)" },
22346
22148
  "aria-hidden": true,
22347
- children: /* @__PURE__ */ jsx31(Check4, { className: "size-5" })
22149
+ children: /* @__PURE__ */ jsx31(Check3, { className: "size-5" })
22348
22150
  }
22349
22151
  ) : null
22350
22152
  ]
@@ -22728,7 +22530,6 @@ function shouldUseDevFixtures() {
22728
22530
  function getLogoElement(el) {
22729
22531
  const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
22730
22532
  if (marked) return marked;
22731
- if (el.closest('[data-ohw-editable="icon"]')) return null;
22732
22533
  const root = el.closest("nav, [data-ohw-nav-root], footer");
22733
22534
  if (!root) return null;
22734
22535
  const anchor = el.closest("a");
@@ -22798,7 +22599,7 @@ function addFooterColumnWithPersist({
22798
22599
  import {
22799
22600
  useCallback as useCallback9,
22800
22601
  useEffect as useEffect17,
22801
- useLayoutEffect as useLayoutEffect6,
22602
+ useLayoutEffect as useLayoutEffect5,
22802
22603
  useRef as useRef11,
22803
22604
  useState as useState15
22804
22605
  } from "react";
@@ -22895,7 +22696,7 @@ function FloatingPanel({
22895
22696
  return () => window.removeEventListener("message", onParentScroll);
22896
22697
  }, [open]);
22897
22698
  const positionRef = useRef11(position);
22898
- useLayoutEffect6(() => {
22699
+ useLayoutEffect5(() => {
22899
22700
  if (!open) {
22900
22701
  positionRef.current = position;
22901
22702
  return;
@@ -22905,7 +22706,7 @@ function FloatingPanel({
22905
22706
  }
22906
22707
  positionRef.current = position;
22907
22708
  }, [open, position, liveScroll, parentScroll]);
22908
- useLayoutEffect6(() => {
22709
+ useLayoutEffect5(() => {
22909
22710
  if (!open || !panelRef.current) return;
22910
22711
  const el = panelRef.current;
22911
22712
  const header = el.querySelector("[data-ohw-floating-panel-header]");
@@ -23114,7 +22915,7 @@ function SocialsDisplayPanel({ display, onChange, className }) {
23114
22915
  }
23115
22916
 
23116
22917
  // src/ui/button-style-panel.tsx
23117
- import { Check as Check5 } from "lucide-react";
22918
+ import { Check as Check4 } from "lucide-react";
23118
22919
  import { jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
23119
22920
  var SIZE_LABEL = { s: "S", m: "M", l: "L" };
23120
22921
  function ButtonStylePanel({
@@ -23185,7 +22986,7 @@ function ButtonStylePanel({
23185
22986
  {
23186
22987
  className: "absolute right-0.5 top-0.5 flex size-5 items-center justify-center rounded-full bg-primary text-primary-foreground",
23187
22988
  "aria-hidden": true,
23188
- children: /* @__PURE__ */ jsx35(Check5, { className: "size-3", strokeWidth: 3 })
22989
+ children: /* @__PURE__ */ jsx35(Check4, { className: "size-3", strokeWidth: 3 })
23189
22990
  }
23190
22991
  ) : null
23191
22992
  ]
@@ -24210,7 +24011,7 @@ function useSectionDrag({
24210
24011
  }
24211
24012
 
24212
24013
  // src/ui/footer-container-chrome.tsx
24213
- import { Plus as Plus4 } from "lucide-react";
24014
+ import { Plus as Plus3 } from "lucide-react";
24214
24015
  import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
24215
24016
  function FooterContainerChrome({
24216
24017
  rect,
@@ -24251,7 +24052,7 @@ function FooterContainerChrome({
24251
24052
  if (addDisabled) return;
24252
24053
  onAdd();
24253
24054
  },
24254
- children: /* @__PURE__ */ jsx36(Plus4, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24055
+ children: /* @__PURE__ */ jsx36(Plus3, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24255
24056
  }
24256
24057
  ) }),
24257
24058
  /* @__PURE__ */ jsx36(TooltipContent, { side: "bottom", sideOffset: 9, children: addDisabled ? "Maximum columns reached" : "Add item" })
@@ -24658,7 +24459,7 @@ function retargetPageLinks(change, deps) {
24658
24459
  }
24659
24460
 
24660
24461
  // src/ui/navbar-container-chrome.tsx
24661
- import { Plus as Plus5 } from "lucide-react";
24462
+ import { Plus as Plus4 } from "lucide-react";
24662
24463
  import { jsx as jsx37 } from "react/jsx-runtime";
24663
24464
  function NavbarContainerChrome({
24664
24465
  rect,
@@ -24694,7 +24495,7 @@ function NavbarContainerChrome({
24694
24495
  e.stopPropagation();
24695
24496
  onAdd();
24696
24497
  },
24697
- children: /* @__PURE__ */ jsx37(Plus5, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24498
+ children: /* @__PURE__ */ jsx37(Plus4, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24698
24499
  }
24699
24500
  )
24700
24501
  }
@@ -24766,7 +24567,7 @@ function Badge({ className, variant, ...props }) {
24766
24567
  }
24767
24568
 
24768
24569
  // src/OhhwellsBridge.tsx
24769
- import { Brush as Brush2, Link as Link2, Plus as Plus6, Settings } from "lucide-react";
24570
+ import { Brush as Brush2, Link as Link2, Plus as Plus5, Settings } from "lucide-react";
24770
24571
  import { Fragment as Fragment13, jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
24771
24572
  var PRIMARY7 = "#0885FE";
24772
24573
  var IMAGE_FADE_MS = 300;
@@ -25544,7 +25345,7 @@ function getNavigationSelectionParent(el) {
25544
25345
  if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
25545
25346
  return resolveFooterLinksContainerFrom(el);
25546
25347
  }
25547
- 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)) {
25348
+ if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
25548
25349
  return getNavigationRoot(el);
25549
25350
  }
25550
25351
  return null;
@@ -25766,6 +25567,7 @@ var ICONS = {
25766
25567
  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"/>',
25767
25568
  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"/>'
25768
25569
  };
25570
+ var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
25769
25571
  var SELECTION_CHROME_GAP2 = 4;
25770
25572
  var TOOLBAR_STROKE_GAP2 = 4;
25771
25573
  var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
@@ -25863,7 +25665,7 @@ function applyVisibleViewport(el, parentScroll) {
25863
25665
  el.style.top = `${top}px`;
25864
25666
  el.style.height = `${height}px`;
25865
25667
  }
25866
- var TOOLBAR_EDGE_MARGIN4 = 4;
25668
+ var TOOLBAR_EDGE_MARGIN3 = 4;
25867
25669
  function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
25868
25670
  const isAbove = transform.includes("translateY(-100%)");
25869
25671
  let visualTop = isAbove ? top - approxH : top;
@@ -25890,8 +25692,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
25890
25692
  function clampToolbarLeft(centerX, toolbarWidth) {
25891
25693
  const half = toolbarWidth / 2;
25892
25694
  return Math.max(
25893
- TOOLBAR_EDGE_MARGIN4 + half,
25894
- Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
25695
+ TOOLBAR_EDGE_MARGIN3 + half,
25696
+ Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half)
25895
25697
  );
25896
25698
  }
25897
25699
  function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
@@ -26292,7 +26094,7 @@ function OhhwellsBridge() {
26292
26094
  }, []);
26293
26095
  const subdomainFromQuery = searchParams.get("subdomain");
26294
26096
  const [subdomain, setSubdomain] = useState18(() => resolveSubdomain(subdomainFromQuery));
26295
- useLayoutEffect7(() => {
26097
+ useLayoutEffect6(() => {
26296
26098
  const next = resolveSubdomain(subdomainFromQuery);
26297
26099
  if (next !== subdomain) setSubdomain(next);
26298
26100
  if (next) return;
@@ -26774,6 +26576,21 @@ function OhhwellsBridge() {
26774
26576
  const [isItemDragging, setIsItemDragging] = useState18(false);
26775
26577
  const [isFooterFrameSelection, setIsFooterFrameSelection] = useState18(false);
26776
26578
  isFooterFrameSelectionRef.current = isFooterFrameSelection;
26579
+ const [floatingPanel, setFloatingPanel] = useState18(null);
26580
+ const floatingPanelOpenRef = useRef14(false);
26581
+ floatingPanelOpenRef.current = floatingPanel !== null;
26582
+ const floatingPanelRef = useRef14(null);
26583
+ floatingPanelRef.current = floatingPanel;
26584
+ const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
26585
+ const buttonCollectionDragRef = useRef14(null);
26586
+ const buttonDropInsertIndexRef = useRef14(null);
26587
+ const [buttonDropSlots, setButtonDropSlots] = useState18([]);
26588
+ const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
26589
+ const buttonPointerDragRef = useRef14(null);
26590
+ const [buttonStyleTick, setButtonStyleTick] = useState18(0);
26591
+ const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
26592
+ const [editorViewport, setEditorViewport] = useState18("desktop");
26593
+ const [parentScrollSnap, setParentScrollSnap] = useState18(null);
26777
26594
  const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = useState18(null);
26778
26595
  const [footerHeadingVisible, setFooterHeadingVisible] = useState18(null);
26779
26596
  const footerDragRef = useRef14(null);
@@ -26800,21 +26617,6 @@ function OhhwellsBridge() {
26800
26617
  const stylesRef = useRef14("");
26801
26618
  const appliedDrawerRef = useRef14(null);
26802
26619
  const pendingDeleteUndoRef = useRef14(null);
26803
- const [floatingPanel, setFloatingPanel] = useState18(null);
26804
- const floatingPanelOpenRef = useRef14(false);
26805
- const floatingPanelRef = useRef14(null);
26806
- floatingPanelRef.current = floatingPanel;
26807
- const setFloatingPanelRef = useRef14(setFloatingPanel);
26808
- const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
26809
- const buttonCollectionDragRef = useRef14(null);
26810
- const buttonDropInsertIndexRef = useRef14(null);
26811
- const [buttonDropSlots, setButtonDropSlots] = useState18([]);
26812
- const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
26813
- const buttonPointerDragRef = useRef14(null);
26814
- const [buttonStyleTick, setButtonStyleTick] = useState18(0);
26815
- const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
26816
- const [editorViewport, setEditorViewport] = useState18("desktop");
26817
- const [parentScrollSnap, setParentScrollSnap] = useState18(null);
26818
26620
  const [sitePages, setSitePages] = useState18([]);
26819
26621
  const collectionItemsRef = useRef14(/* @__PURE__ */ new Map());
26820
26622
  const [sectionsByPath, setSectionsByPath] = useState18({});
@@ -26824,18 +26626,7 @@ function OhhwellsBridge() {
26824
26626
  const linkPopoverOpenRef = useRef14(false);
26825
26627
  const linkPopoverGraceUntilRef = useRef14(0);
26826
26628
  setLinkPopoverRef.current = setLinkPopover;
26827
- setFloatingPanelRef.current = setFloatingPanel;
26828
26629
  linkPopoverSessionRef.current = linkPopover;
26829
- floatingPanelOpenRef.current = Boolean(floatingPanel);
26830
- useEffect21(() => {
26831
- const syncViewport = () => {
26832
- const next = window.innerWidth <= 480 ? "mobile" : "desktop";
26833
- setEditorViewport((prev) => prev === next ? prev : next);
26834
- };
26835
- syncViewport();
26836
- window.addEventListener("resize", syncViewport);
26837
- return () => window.removeEventListener("resize", syncViewport);
26838
- }, []);
26839
26630
  useEffect21(() => {
26840
26631
  setSectionOrderPersistHandler((entries) => {
26841
26632
  const currentPath = window.location.pathname;
@@ -28542,7 +28333,7 @@ function OhhwellsBridge() {
28542
28333
  isFooterFrameSelection,
28543
28334
  postToParent2
28544
28335
  ]);
28545
- useLayoutEffect7(() => {
28336
+ useLayoutEffect6(() => {
28546
28337
  if (!subdomain || isEditMode) {
28547
28338
  setFetchState("done");
28548
28339
  return;
@@ -28569,7 +28360,6 @@ function OhhwellsBridge() {
28569
28360
  applyAiFooterFromContent(content);
28570
28361
  if (typeof content[STYLE_STORE_KEY] === "string") {
28571
28362
  stylesRef.current = content[STYLE_STORE_KEY];
28572
- document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28573
28363
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28574
28364
  }
28575
28365
  applyBrandChrome(content);
@@ -28580,16 +28370,15 @@ function OhhwellsBridge() {
28580
28370
  if (key === "__ohw_sections") continue;
28581
28371
  if (key === AI_SECTIONS_KEY) continue;
28582
28372
  if (key === AI_FOOTER_KEY) continue;
28583
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28584
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28585
28373
  if (key === BRAND_KIT_KEY) continue;
28586
28374
  if (key === STYLE_STORE_KEY) continue;
28587
28375
  if (BRAND_CHROME_KEYS.has(key)) continue;
28376
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
28588
28377
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
28378
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28589
28379
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28590
28380
  continue;
28591
28381
  }
28592
- if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28593
28382
  if (applyVideoSettingNode(key, val)) continue;
28594
28383
  if (applyCarouselNode(key, val)) continue;
28595
28384
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28629,7 +28418,6 @@ function OhhwellsBridge() {
28629
28418
  });
28630
28419
  applyLinkByKey(key, val);
28631
28420
  }
28632
- applySectionEmbeds(content);
28633
28421
  applyLogoFromContent(content);
28634
28422
  applyLogoSizes(content);
28635
28423
  reconcileNavbarItemsFromContent(content);
@@ -28818,22 +28606,20 @@ function OhhwellsBridge() {
28818
28606
  }
28819
28607
  applyAiFooterFromContent(content);
28820
28608
  if (typeof content[STYLE_STORE_KEY] === "string") {
28821
- document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28822
28609
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28823
28610
  }
28824
28611
  for (const [key, val] of Object.entries(content)) {
28825
28612
  if (key === "__ohw_sections") continue;
28826
28613
  if (key === AI_SECTIONS_KEY) continue;
28827
28614
  if (key === AI_FOOTER_KEY) continue;
28828
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28829
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28830
28615
  if (key === BRAND_KIT_KEY) continue;
28831
28616
  if (key === STYLE_STORE_KEY) continue;
28832
28617
  if (BRAND_CHROME_KEYS.has(key)) continue;
28618
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
28619
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28833
28620
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28834
28621
  continue;
28835
28622
  }
28836
- if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28837
28623
  if (applyVideoSettingNode(key, val)) continue;
28838
28624
  if (applyCarouselNode(key, val)) continue;
28839
28625
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28858,7 +28644,6 @@ function OhhwellsBridge() {
28858
28644
  });
28859
28645
  applyLinkByKey(key, val);
28860
28646
  }
28861
- applySectionEmbeds(content);
28862
28647
  applyLogoFromContent(content);
28863
28648
  reconcileNavbarItemsFromContent(content);
28864
28649
  reconcileFooterOrderFromContent(content);
@@ -28914,7 +28699,7 @@ function OhhwellsBridge() {
28914
28699
  if (debounceTimer) clearTimeout(debounceTimer);
28915
28700
  };
28916
28701
  }, [subdomain, isEditMode, pathname]);
28917
- useLayoutEffect7(() => {
28702
+ useLayoutEffect6(() => {
28918
28703
  const el = document.getElementById("ohw-loader");
28919
28704
  if (!el) return;
28920
28705
  const visible = Boolean(subdomain) && fetchState !== "done";
@@ -29098,11 +28883,26 @@ function OhhwellsBridge() {
29098
28883
  const t2 = setTimeout(measure, 500);
29099
28884
  const ro = new ResizeObserver(schedule);
29100
28885
  ro.observe(document.body);
28886
+ let lastWidth = window.innerWidth;
28887
+ let resizeTimers = [];
28888
+ const clearResizeTimers = () => {
28889
+ resizeTimers.forEach(clearTimeout);
28890
+ resizeTimers = [];
28891
+ };
28892
+ const handleResize = () => {
28893
+ if (window.innerWidth === lastWidth) return;
28894
+ lastWidth = window.innerWidth;
28895
+ clearResizeTimers();
28896
+ resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
28897
+ };
28898
+ window.addEventListener("resize", handleResize);
29101
28899
  return () => {
29102
28900
  clearTimeout(t1);
29103
28901
  clearTimeout(t2);
29104
28902
  if (raf != null) cancelAnimationFrame(raf);
29105
28903
  ro.disconnect();
28904
+ clearResizeTimers();
28905
+ window.removeEventListener("resize", handleResize);
29106
28906
  };
29107
28907
  }, [pathname, isEditMode, postToParent2]);
29108
28908
  useEffect21(() => {
@@ -29399,13 +29199,6 @@ function OhhwellsBridge() {
29399
29199
  if (target.closest("[data-ohw-state-toggle]")) return;
29400
29200
  if (target.closest("[data-ohw-max-badge]")) return;
29401
29201
  if (isInsideLinkEditor(target)) return;
29402
- if (isInsideFloatingPanel(target)) return;
29403
- if (target.closest("[data-ohw-form-toolbar]")) return;
29404
- if (target.closest(
29405
- '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
29406
- )) {
29407
- return;
29408
- }
29409
29202
  if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
29410
29203
  clearMediaSelectionRef.current();
29411
29204
  }
@@ -29429,6 +29222,8 @@ function OhhwellsBridge() {
29429
29222
  return;
29430
29223
  }
29431
29224
  }
29225
+ if (isInsideFloatingPanel(target)) return;
29226
+ if (target.closest("[data-ohw-form-toolbar]")) return;
29432
29227
  const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
29433
29228
  if (collectionItem) {
29434
29229
  e.preventDefault();
@@ -29440,6 +29235,11 @@ function OhhwellsBridge() {
29440
29235
  });
29441
29236
  return;
29442
29237
  }
29238
+ if (target.closest(
29239
+ '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
29240
+ )) {
29241
+ return;
29242
+ }
29443
29243
  {
29444
29244
  const formEl = getFormElement(target);
29445
29245
  const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
@@ -29593,13 +29393,9 @@ function OhhwellsBridge() {
29593
29393
  if (isIconEditable(editable) && !getSocialItem(editable)) {
29594
29394
  e.preventDefault();
29595
29395
  e.stopPropagation();
29396
+ selectIconElementRef.current(editable);
29596
29397
  const aiIcon = editable.hasAttribute("data-ai-icon");
29597
29398
  const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
29598
- if (aiIcon) {
29599
- aiSectionApiRef.current?.selectFromElement(editable);
29600
- } else {
29601
- selectIconElementRef.current(editable);
29602
- }
29603
29399
  postToParentRef.current({
29604
29400
  type: "ow:icon-pick",
29605
29401
  key: editable.dataset.ohwKey ?? "",
@@ -29827,9 +29623,6 @@ function OhhwellsBridge() {
29827
29623
  setHoveredItemRect(null);
29828
29624
  hoveredNavContainerRef.current = null;
29829
29625
  setHoveredNavContainerRect(null);
29830
- siblingHintElRef.current = null;
29831
- setSiblingHintRect(null);
29832
- setSiblingHintRects([]);
29833
29626
  return;
29834
29627
  }
29835
29628
  {
@@ -29950,6 +29743,7 @@ function OhhwellsBridge() {
29950
29743
  hoveredNavContainerRef.current = null;
29951
29744
  setHoveredNavContainerRect(null);
29952
29745
  hoveredItemElRef.current = editable;
29746
+ setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
29953
29747
  }
29954
29748
  }
29955
29749
  }
@@ -30659,11 +30453,7 @@ function OhhwellsBridge() {
30659
30453
  };
30660
30454
  const handleMouseMove = (e) => {
30661
30455
  const { clientX, clientY } = e;
30662
- if (pointOwnedByFloatingPanel(clientX, clientY)) {
30663
- dismissImageHover();
30664
- clearImageHover();
30665
- return;
30666
- }
30456
+ if (pointOwnedByFloatingPanel(clientX, clientY)) return;
30667
30457
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
30668
30458
  document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
30669
30459
  formHoverElRef.current = null;
@@ -30692,12 +30482,7 @@ function OhhwellsBridge() {
30692
30482
  setHoveredItemRect(null);
30693
30483
  hoveredNavContainerRef.current = null;
30694
30484
  setHoveredNavContainerRect(null);
30695
- siblingHintElRef.current = null;
30696
- setSiblingHintRect(null);
30697
- setSiblingHintRects([]);
30698
30485
  dismissImageHover();
30699
- clearImageHover();
30700
- setSectionGap(null);
30701
30486
  return;
30702
30487
  }
30703
30488
  if (probeSocialsRowAt(clientX, clientY)) return;
@@ -30709,11 +30494,7 @@ function OhhwellsBridge() {
30709
30494
  if (e.data?.type !== "ow:pointer-sync") return;
30710
30495
  const { clientX, clientY } = e.data;
30711
30496
  if (typeof clientX !== "number" || typeof clientY !== "number") return;
30712
- if (pointOwnedByFloatingPanel(clientX, clientY)) {
30713
- dismissImageHover();
30714
- clearImageHover();
30715
- return;
30716
- }
30497
+ if (pointOwnedByFloatingPanel(clientX, clientY)) return;
30717
30498
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
30718
30499
  if (probeSocialsRowAt(clientX, clientY)) return;
30719
30500
  probeSectionGapAt(clientX, clientY);
@@ -31093,7 +30874,6 @@ function OhhwellsBridge() {
31093
30874
  applyAiFooterFromContent(content);
31094
30875
  if (typeof content[STYLE_STORE_KEY] === "string") {
31095
30876
  stylesRef.current = content[STYLE_STORE_KEY];
31096
- document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
31097
30877
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
31098
30878
  }
31099
30879
  applyBrandChrome(content);
@@ -31108,16 +30888,15 @@ function OhhwellsBridge() {
31108
30888
  }
31109
30889
  if (key === AI_SECTIONS_KEY) continue;
31110
30890
  if (key === AI_FOOTER_KEY) continue;
31111
- if (key === LOGO_PLACEHOLDER_KEY) continue;
31112
- if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
31113
30891
  if (key === BRAND_KIT_KEY) continue;
31114
30892
  if (key === STYLE_STORE_KEY) continue;
31115
30893
  if (BRAND_CHROME_KEYS.has(key)) continue;
30894
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
31116
30895
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
30896
+ if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
31117
30897
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
31118
30898
  continue;
31119
30899
  }
31120
- if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
31121
30900
  if (applyVideoSettingNode(key, val)) continue;
31122
30901
  if (applyCarouselNode(key, val)) continue;
31123
30902
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -31143,7 +30922,6 @@ function OhhwellsBridge() {
31143
30922
  });
31144
30923
  applyLinkByKey(key, val);
31145
30924
  }
31146
- applySectionEmbeds(content);
31147
30925
  applyLogoFromContent(content);
31148
30926
  applyLogoSizes(content);
31149
30927
  document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
@@ -31776,12 +31554,6 @@ function OhhwellsBridge() {
31776
31554
  closeLinkPopoverRef.current();
31777
31555
  return;
31778
31556
  }
31779
- if (floatingPanelOpenRef.current) {
31780
- setFloatingPanelRef.current(null);
31781
- deselectRef.current();
31782
- deactivateRef.current();
31783
- return;
31784
- }
31785
31557
  deselectRef.current();
31786
31558
  deactivateRef.current();
31787
31559
  clearMediaSelectionRef.current();
@@ -32618,10 +32390,10 @@ function OhhwellsBridge() {
32618
32390
  window.removeEventListener("message", handleDuplicateSection);
32619
32391
  window.removeEventListener("message", handleDeactivate);
32620
32392
  window.removeEventListener("message", handleSelectNav);
32393
+ document.documentElement.removeAttribute("data-ohw-panel-dragging");
32621
32394
  window.removeEventListener("message", handleToastAction);
32622
32395
  window.removeEventListener("message", handleFormCount);
32623
32396
  window.removeEventListener("message", handleUiEscape);
32624
- document.documentElement.removeAttribute("data-ohw-panel-dragging");
32625
32397
  autoSaveTimers.current.forEach(clearTimeout);
32626
32398
  autoSaveTimers.current.clear();
32627
32399
  if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
@@ -32915,7 +32687,7 @@ function OhhwellsBridge() {
32915
32687
  postToParent2({
32916
32688
  type: "ow:ready",
32917
32689
  version: "1",
32918
- bridgeVersion: "0.1.166-next.442",
32690
+ bridgeVersion: "0.1.167",
32919
32691
  path: pathname,
32920
32692
  nodes: collectEditableNodes(editContentRef.current),
32921
32693
  sections
@@ -33650,7 +33422,7 @@ function OhhwellsBridge() {
33650
33422
  className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/80",
33651
33423
  onClick: () => setFieldTypePickerOpen((open) => !open),
33652
33424
  "data-ohw-add-field": "",
33653
- children: /* @__PURE__ */ jsx40(Plus6, { size: 15, "aria-hidden": true })
33425
+ children: /* @__PURE__ */ jsx40(Plus5, { size: 15, "aria-hidden": true })
33654
33426
  }
33655
33427
  ),
33656
33428
  /* @__PURE__ */ jsx40("div", { className: "mx-0.5 h-5 w-px bg-border" }),