@ohhwells/bridge 0.1.167-next.444 → 0.1.168

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.167-next.444";
17493
+ return "0.1.168";
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.167-next.444" : "";
17507
+ const v = true ? "0.1.168" : "";
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
  )
@@ -19131,24 +18943,8 @@ function AiSectionOverlay({
19131
18943
  }
19132
18944
 
19133
18945
  // src/ui/ai-section/AiMediaStripOverlay.tsx
19134
- import { useCallback as useCallback3, useEffect as useEffect9, useLayoutEffect as useLayoutEffect4, useRef as useRef5, useState as useState8 } from "react";
19135
- import {
19136
- AlignCenter,
19137
- AlignLeft,
19138
- AlignRight,
19139
- ArrowLeft as ArrowLeft2,
19140
- ArrowRight as ArrowRight2,
19141
- Check as Check2,
19142
- ChevronDown as ChevronDown3,
19143
- Image as ImageIcon2,
19144
- ImageMinus,
19145
- ImagePlus,
19146
- Link as LinkIcon,
19147
- Minus,
19148
- Palette,
19149
- Plus as Plus2,
19150
- Star
19151
- } from "lucide-react";
18946
+ import { useCallback as useCallback3, useEffect as useEffect9, useRef as useRef5, useState as useState8 } from "react";
18947
+ import { Star } from "lucide-react";
19152
18948
 
19153
18949
  // src/lib/ai-media-strip-tree.ts
19154
18950
  var MEDIA_STRIP_ITEM_MIN = 1;
@@ -19262,6 +19058,14 @@ function setMediaStripItemAsset(tree, index, assetId) {
19262
19058
  return true;
19263
19059
  });
19264
19060
  }
19061
+ function setMediaStripItemAlt(tree, index, alt) {
19062
+ return withMediaStrip(tree, (block) => {
19063
+ const items = block.items;
19064
+ if (index < 0 || index >= items.length) return false;
19065
+ items[index] = { ...items[index], alt };
19066
+ return true;
19067
+ });
19068
+ }
19265
19069
  function setMediaStripItemLink(tree, index, link) {
19266
19070
  return withMediaStrip(tree, (block) => {
19267
19071
  const items = block.items;
@@ -19279,117 +19083,11 @@ function setMediaStripItemLink(tree, index, link) {
19279
19083
  });
19280
19084
  }
19281
19085
 
19282
- // src/ui/dialog.tsx
19283
- import * as React9 from "react";
19284
- import { Dialog as DialogPrimitive } from "radix-ui";
19285
- import { X as X2 } from "lucide-react";
19286
- import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
19287
- function Dialog2({
19288
- ...props
19289
- }) {
19290
- return /* @__PURE__ */ jsx20(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
19291
- }
19292
- function DialogPortal({
19293
- ...props
19294
- }) {
19295
- return /* @__PURE__ */ jsx20(DialogPrimitive.Portal, { ...props });
19296
- }
19297
- function DialogOverlay({
19298
- className,
19299
- ...props
19300
- }) {
19301
- return /* @__PURE__ */ jsx20(
19302
- DialogPrimitive.Overlay,
19303
- {
19304
- "data-slot": "dialog-overlay",
19305
- "data-ohw-link-modal-root": "",
19306
- className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
19307
- ...props
19308
- }
19309
- );
19310
- }
19311
- var DialogContent = React9.forwardRef(
19312
- ({ className, children, showCloseButton = true, container, ...props }, ref) => {
19313
- const positionMode = container ? "absolute" : "fixed";
19314
- return /* @__PURE__ */ jsxs11(DialogPortal, { container: container ?? void 0, children: [
19315
- /* @__PURE__ */ jsx20(DialogOverlay, { className: cn(positionMode, "inset-0") }),
19316
- /* @__PURE__ */ jsxs11(
19317
- DialogPrimitive.Content,
19318
- {
19319
- ref,
19320
- "data-slot": "dialog-content",
19321
- className: cn(
19322
- positionMode,
19323
- "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",
19324
- "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
19325
- container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
19326
- className
19327
- ),
19328
- onMouseDown: (e) => e.stopPropagation(),
19329
- ...props,
19330
- children: [
19331
- children,
19332
- showCloseButton ? /* @__PURE__ */ jsx20(
19333
- DialogPrimitive.Close,
19334
- {
19335
- type: "button",
19336
- className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
19337
- "aria-label": "Close",
19338
- children: /* @__PURE__ */ jsx20(X2, { size: 16, "aria-hidden": true })
19339
- }
19340
- ) : null
19341
- ]
19342
- }
19343
- )
19344
- ] });
19345
- }
19346
- );
19347
- DialogContent.displayName = DialogPrimitive.Content.displayName;
19348
- function DialogHeader({
19349
- className,
19350
- ...props
19351
- }) {
19352
- return /* @__PURE__ */ jsx20("div", { className: cn("flex flex-col gap-1.5", className), ...props });
19353
- }
19354
- function DialogFooter({
19355
- className,
19356
- ...props
19357
- }) {
19358
- return /* @__PURE__ */ jsx20(
19359
- "div",
19360
- {
19361
- className: cn("flex items-center justify-end gap-2", className),
19362
- ...props
19363
- }
19364
- );
19365
- }
19366
- var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
19367
- DialogPrimitive.Title,
19368
- {
19369
- ref,
19370
- className: cn(
19371
- "text-lg font-semibold leading-none tracking-tight text-card-foreground",
19372
- className
19373
- ),
19374
- ...props
19375
- }
19376
- ));
19377
- DialogTitle.displayName = DialogPrimitive.Title.displayName;
19378
- var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
19379
- DialogPrimitive.Description,
19380
- {
19381
- ref,
19382
- className: cn("text-sm text-muted-foreground", className),
19383
- ...props
19384
- }
19385
- ));
19386
- DialogDescription.displayName = DialogPrimitive.Description.displayName;
19387
- var DialogClose = DialogPrimitive.Close;
19388
-
19389
19086
  // src/ui/ai-section/AiMediaStripOverlay.tsx
19390
- import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
19391
- var PRIMARY3 = "var(--ohw-primary, #0885FE)";
19392
- 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]";
19087
+ import { Fragment as Fragment7, jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
19088
+ var PRIMARY3 = "#0885FE";
19089
+ var OHW_BLUE = `var(--ohw-primary, ${PRIMARY3})`;
19090
+ var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
19393
19091
  function findMediaStripItemElement(sectionId, index) {
19394
19092
  const sectionEl2 = findByInstanceId(sectionId);
19395
19093
  if (!sectionEl2) return null;
@@ -19399,35 +19097,14 @@ function findMediaStripItemElement(sectionId, index) {
19399
19097
  }
19400
19098
  return null;
19401
19099
  }
19402
- function itemRefFromTarget(target) {
19403
- if (!(target instanceof Element)) return null;
19404
- if (target.closest(CHROME_SELECTOR)) return null;
19405
- const itemEl = target.closest("[data-ohw-media-strip-item]");
19406
- if (!itemEl) return null;
19407
- const sectionEl2 = itemEl.closest("[data-ohw-section]");
19408
- const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
19409
- const sectionId = unit ? instanceIdOf(unit) || null : null;
19410
- const index = Number(itemEl.dataset.ohwMediaStripIndex);
19411
- if (!sectionId || Number.isNaN(index)) return null;
19412
- return { sectionId, index };
19413
- }
19414
- function sameRef(a, b) {
19415
- return a?.sectionId === b?.sectionId && a?.index === b?.index;
19416
- }
19417
- function rectOf(el) {
19100
+ function readRect2(ref) {
19101
+ const el = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19418
19102
  if (!el) return null;
19419
19103
  const r2 = el.getBoundingClientRect();
19420
19104
  if (r2.width <= 0 || r2.height <= 0) return null;
19421
19105
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
19422
19106
  }
19423
- function readRect2(ref) {
19424
- return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
19425
- }
19426
- function readStripRect(ref) {
19427
- const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19428
- return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
19429
- }
19430
- function useLiveItemRect(ref, strip = false) {
19107
+ function useLiveItemRect(ref) {
19431
19108
  const [rect, setRect] = useState8(null);
19432
19109
  useEffect9(() => {
19433
19110
  if (!ref) {
@@ -19435,7 +19112,7 @@ function useLiveItemRect(ref, strip = false) {
19435
19112
  return;
19436
19113
  }
19437
19114
  const update = () => {
19438
- const next = strip ? readStripRect(ref) : readRect2(ref);
19115
+ const next = readRect2(ref);
19439
19116
  setRect(
19440
19117
  (prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
19441
19118
  );
@@ -19450,49 +19127,9 @@ function useLiveItemRect(ref, strip = false) {
19450
19127
  window.removeEventListener("resize", update);
19451
19128
  clearInterval(interval);
19452
19129
  };
19453
- }, [ref?.sectionId, ref?.index, strip]);
19130
+ }, [ref?.sectionId, ref?.index]);
19454
19131
  return rect;
19455
19132
  }
19456
- var TOOLBAR_STRIP_GAP = 52;
19457
- var TOOLBAR_STRIP_GAP_MOBILE = 42;
19458
- var TOOLBAR_EDGE_MARGIN2 = 4;
19459
- function StripToolbarSlot({ stripRect, children }) {
19460
- const slotRef = useRef5(null);
19461
- const [shift, setShift] = useState8(0);
19462
- const centerX = stripRect.left + stripRect.width / 2;
19463
- useLayoutEffect4(() => {
19464
- const slot = slotRef.current;
19465
- if (!slot) return;
19466
- const clamp = () => {
19467
- const w = slot.offsetWidth;
19468
- if (w <= 0) return;
19469
- const half = w / 2;
19470
- const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
19471
- setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
19472
- };
19473
- clamp();
19474
- const ro = new ResizeObserver(clamp);
19475
- ro.observe(slot);
19476
- return () => ro.disconnect();
19477
- }, [centerX, children]);
19478
- const mobile = window.innerWidth <= 480;
19479
- return /* @__PURE__ */ jsx21(
19480
- "div",
19481
- {
19482
- ref: slotRef,
19483
- "data-ohw-bridge": "",
19484
- "data-ohw-item-interaction": "",
19485
- className: "pointer-events-auto fixed",
19486
- style: {
19487
- top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
19488
- left: centerX + shift,
19489
- transform: "translate(-50%, -100%)",
19490
- zIndex: 2147483645
19491
- },
19492
- children
19493
- }
19494
- );
19495
- }
19496
19133
  function requestValidateTree(postToParent2, tree) {
19497
19134
  return new Promise((resolve) => {
19498
19135
  const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
@@ -19529,72 +19166,116 @@ function requestAssetPick(postToParent2) {
19529
19166
  postToParent2({ type: "ow:asset-pick", id });
19530
19167
  });
19531
19168
  }
19532
- function ToolbarAction({
19169
+ function Pill({
19533
19170
  label,
19534
19171
  onClick,
19535
- disabled = false,
19536
- active = false,
19537
- children
19172
+ disabled,
19173
+ active
19538
19174
  }) {
19539
- const button = /* @__PURE__ */ jsx21(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
19540
- return /* @__PURE__ */ jsxs12(Tooltip, { children: [
19541
- /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: button }) : button }),
19542
- /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
19543
- ] });
19544
- }
19545
- function ToolbarSeparator() {
19546
- return /* @__PURE__ */ jsx21("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
19175
+ return /* @__PURE__ */ jsx20(
19176
+ "button",
19177
+ {
19178
+ type: "button",
19179
+ onClick,
19180
+ disabled,
19181
+ style: {
19182
+ height: 28,
19183
+ padding: "0 10px",
19184
+ display: "inline-flex",
19185
+ alignItems: "center",
19186
+ gap: 4,
19187
+ borderRadius: 999,
19188
+ border: "none",
19189
+ cursor: disabled ? "default" : "pointer",
19190
+ background: active ? OHW_BLUE_DARK : "#ffffff",
19191
+ color: active ? "#ffffff" : OHW_BLUE_DARK,
19192
+ opacity: disabled ? 0.4 : 1,
19193
+ fontSize: 12,
19194
+ lineHeight: "16px",
19195
+ fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19196
+ whiteSpace: "nowrap",
19197
+ flex: "0 0 auto"
19198
+ },
19199
+ children: label
19200
+ }
19201
+ );
19547
19202
  }
19548
- function OptionMenu({
19549
- label,
19550
- value,
19551
- options,
19552
- onChange
19553
- }) {
19554
- const current = options.find((o) => o.value === value) ?? options[0];
19555
- return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
19556
- /* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground", children: label }),
19557
- /* @__PURE__ */ jsxs12(DropdownMenu, { modal: false, children: [
19558
- /* @__PURE__ */ jsx21(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs12(
19559
- "button",
19560
- {
19561
- type: "button",
19562
- "aria-label": label,
19563
- 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",
19564
- children: [
19565
- /* @__PURE__ */ jsx21("span", { className: "flex-1 text-left", children: current.label }),
19566
- /* @__PURE__ */ jsx21(ChevronDown3, { size: 16, style: { pointerEvents: "none" } })
19567
- ]
19568
- }
19569
- ) }),
19570
- /* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
19571
- const selected = option.value === value;
19572
- return /* @__PURE__ */ jsxs12(
19573
- DropdownMenuItem,
19203
+ function AltInput({ value, onCommit }) {
19204
+ const [draft, setDraft] = useState8(value);
19205
+ useEffect9(() => setDraft(value), [value]);
19206
+ return /* @__PURE__ */ jsxs11(
19207
+ "div",
19208
+ {
19209
+ style: {
19210
+ display: "flex",
19211
+ alignItems: "center",
19212
+ gap: 6,
19213
+ height: 28,
19214
+ padding: "0 12px",
19215
+ borderRadius: 999,
19216
+ background: "#ffffff",
19217
+ width: "100%",
19218
+ maxWidth: 260,
19219
+ boxSizing: "border-box"
19220
+ },
19221
+ children: [
19222
+ /* @__PURE__ */ jsx20(
19223
+ "span",
19574
19224
  {
19575
- role: "menuitemradio",
19576
- "aria-checked": selected,
19577
- onSelect: () => onChange(option.value),
19578
- className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
19579
- children: [
19580
- /* @__PURE__ */ jsx21("span", { children: option.label }),
19581
- selected && /* @__PURE__ */ jsx21(Check2, { size: 16, className: "text-bridge-primary" })
19582
- ]
19583
- },
19584
- option.value
19585
- );
19586
- }) })
19587
- ] })
19588
- ] });
19225
+ style: {
19226
+ flex: "0 0 auto",
19227
+ color: OHW_BLUE_DARK,
19228
+ fontSize: 10,
19229
+ fontWeight: 700,
19230
+ textTransform: "uppercase",
19231
+ letterSpacing: 0.4
19232
+ },
19233
+ children: "Alt"
19234
+ }
19235
+ ),
19236
+ /* @__PURE__ */ jsx20(
19237
+ "input",
19238
+ {
19239
+ type: "text",
19240
+ value: draft,
19241
+ onChange: (e) => setDraft(e.target.value),
19242
+ onBlur: () => {
19243
+ if (draft !== value) onCommit(draft);
19244
+ },
19245
+ onKeyDown: (e) => {
19246
+ if (e.key === "Enter") e.currentTarget.blur();
19247
+ if (e.key === "Escape") {
19248
+ setDraft(value);
19249
+ e.currentTarget.blur();
19250
+ }
19251
+ },
19252
+ placeholder: "Describe this image",
19253
+ "aria-label": "Image alt text",
19254
+ style: {
19255
+ flex: 1,
19256
+ minWidth: 0,
19257
+ border: "none",
19258
+ outline: "none",
19259
+ background: "transparent",
19260
+ fontSize: 12,
19261
+ lineHeight: "16px",
19262
+ fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19263
+ color: "#1f2937"
19264
+ }
19265
+ }
19266
+ )
19267
+ ]
19268
+ }
19269
+ );
19589
19270
  }
19590
19271
  var VARIANTS = [
19591
19272
  { value: "logos", label: "Logos" },
19592
19273
  { value: "reel", label: "Reel" }
19593
19274
  ];
19594
19275
  var ALIGNS = [
19595
- { value: "left", label: "Align left", Icon: AlignLeft },
19596
- { value: "center", label: "Align center", Icon: AlignCenter },
19597
- { value: "right", label: "Align right", Icon: AlignRight }
19276
+ { value: "left", label: "Left" },
19277
+ { value: "center", label: "Center" },
19278
+ { value: "right", label: "Right" }
19598
19279
  ];
19599
19280
  var HOVERS = [
19600
19281
  { value: "none", label: "None" },
@@ -19602,104 +19283,104 @@ var HOVERS = [
19602
19283
  { value: "zoom", label: "Zoom" },
19603
19284
  { value: "fade", label: "Fade" }
19604
19285
  ];
19286
+ var TREATMENTS = [
19287
+ { value: "color", label: "Color" },
19288
+ { value: "grayscale", label: "Grayscale" }
19289
+ ];
19605
19290
  var HTTP_URL_RE = /^https?:\/\/\S+$/i;
19606
- function LinkModal({
19607
- href,
19608
- linkTarget,
19609
- onClose,
19610
- onSave
19611
- }) {
19612
- const [draft, setDraft] = useState8(href);
19613
- const [newTab, setNewTab] = useState8(linkTarget !== "same-tab");
19291
+ function LinkInput({ value, onCommit }) {
19292
+ const [draft, setDraft] = useState8(value);
19614
19293
  const [invalid, setInvalid] = useState8(false);
19615
- const save = () => {
19294
+ useEffect9(() => {
19295
+ setDraft(value);
19296
+ setInvalid(false);
19297
+ }, [value]);
19298
+ const commit2 = () => {
19616
19299
  const next = draft.trim();
19617
- if (next && !HTTP_URL_RE.test(next)) {
19618
- setInvalid(true);
19619
- return;
19620
- }
19621
- onSave(next, newTab ? "new-tab" : "same-tab");
19622
- onClose();
19300
+ if (next === value) return setInvalid(false);
19301
+ if (next && !HTTP_URL_RE.test(next)) return setInvalid(true);
19302
+ setInvalid(false);
19303
+ onCommit(next);
19623
19304
  };
19624
- 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: [
19625
- /* @__PURE__ */ jsx21(DialogHeader, { children: /* @__PURE__ */ jsx21(DialogTitle, { className: "text-base", children: "Image link" }) }),
19626
- /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-3", children: [
19627
- /* @__PURE__ */ jsx21(
19628
- "input",
19629
- {
19630
- autoFocus: true,
19631
- type: "text",
19632
- inputMode: "url",
19633
- value: draft,
19634
- onChange: (e) => {
19635
- setDraft(e.target.value);
19636
- setInvalid(false);
19637
- },
19638
- onKeyDown: (e) => {
19639
- if (e.key === "Enter") save();
19640
- },
19641
- placeholder: "https://example.com",
19642
- "aria-label": "Image link URL",
19643
- "aria-invalid": invalid,
19644
- className: cn(
19645
- "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",
19646
- invalid && "border-destructive focus:border-destructive"
19647
- )
19648
- }
19649
- ),
19650
- invalid && /* @__PURE__ */ jsx21("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
19651
- /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
19652
- /* @__PURE__ */ jsx21("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
19653
- "Open in new tab"
19654
- ] })
19655
- ] }),
19656
- /* @__PURE__ */ jsxs12(DialogFooter, { children: [
19657
- href && /* @__PURE__ */ jsx21(
19658
- "button",
19659
- {
19660
- type: "button",
19661
- onClick: () => {
19662
- onSave("", "new-tab");
19663
- onClose();
19664
- },
19665
- className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
19666
- children: "Remove link"
19667
- }
19668
- ),
19669
- /* @__PURE__ */ jsx21(
19670
- "button",
19671
- {
19672
- type: "button",
19673
- onClick: onClose,
19674
- className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
19675
- children: "Cancel"
19676
- }
19677
- ),
19678
- /* @__PURE__ */ jsx21(
19679
- "button",
19680
- {
19681
- type: "button",
19682
- onClick: save,
19683
- className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
19684
- children: "Save"
19685
- }
19686
- )
19687
- ] })
19688
- ] }) });
19305
+ return /* @__PURE__ */ jsxs11(
19306
+ "div",
19307
+ {
19308
+ style: {
19309
+ display: "flex",
19310
+ alignItems: "center",
19311
+ gap: 6,
19312
+ height: 28,
19313
+ padding: "0 12px",
19314
+ borderRadius: 999,
19315
+ background: "#ffffff",
19316
+ width: "100%",
19317
+ maxWidth: 260,
19318
+ boxSizing: "border-box",
19319
+ boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
19320
+ },
19321
+ children: [
19322
+ /* @__PURE__ */ jsx20(
19323
+ "span",
19324
+ {
19325
+ style: {
19326
+ flex: "0 0 auto",
19327
+ color: OHW_BLUE_DARK,
19328
+ fontSize: 10,
19329
+ fontWeight: 700,
19330
+ textTransform: "uppercase",
19331
+ letterSpacing: 0.4
19332
+ },
19333
+ children: "Link"
19334
+ }
19335
+ ),
19336
+ /* @__PURE__ */ jsx20(
19337
+ "input",
19338
+ {
19339
+ type: "text",
19340
+ inputMode: "url",
19341
+ value: draft,
19342
+ onChange: (e) => setDraft(e.target.value),
19343
+ onBlur: commit2,
19344
+ onKeyDown: (e) => {
19345
+ if (e.key === "Enter") e.currentTarget.blur();
19346
+ if (e.key === "Escape") {
19347
+ setDraft(value);
19348
+ setInvalid(false);
19349
+ e.currentTarget.blur();
19350
+ }
19351
+ },
19352
+ placeholder: "https://example.com",
19353
+ "aria-label": "Image link URL",
19354
+ "aria-invalid": invalid,
19355
+ style: {
19356
+ flex: 1,
19357
+ minWidth: 0,
19358
+ border: "none",
19359
+ outline: "none",
19360
+ background: "transparent",
19361
+ fontSize: 12,
19362
+ lineHeight: "16px",
19363
+ fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19364
+ color: "#1f2937"
19365
+ }
19366
+ }
19367
+ )
19368
+ ]
19369
+ }
19370
+ );
19689
19371
  }
19690
19372
  function MediaStripToolbar({
19691
19373
  entry,
19692
19374
  index,
19693
19375
  pending,
19694
19376
  error,
19695
- itemEditOn,
19696
- onToggleItemEdit,
19697
19377
  onSetVariant,
19698
19378
  onSetAlign,
19699
19379
  onSetHover,
19700
19380
  onSetTreatment,
19701
19381
  onResize,
19702
- onOpenLink,
19382
+ onSetAlt,
19383
+ onSetLink,
19703
19384
  onAddItem,
19704
19385
  onRemoveItem,
19705
19386
  onChangeImage,
@@ -19708,102 +19389,81 @@ function MediaStripToolbar({
19708
19389
  }) {
19709
19390
  const items = mediaStripItems(entry.tree);
19710
19391
  const itemCount = items.length;
19392
+ const currentAlt = items[index]?.alt ?? "";
19393
+ const currentHref2 = items[index]?.href ?? "";
19394
+ const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
19711
19395
  const slots = findMediaStripSlots(entry.tree);
19712
19396
  const variant = slots?.variant === "reel" ? "reel" : "logos";
19713
19397
  const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
19714
19398
  const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
19715
19399
  const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
19716
19400
  const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19717
- const mobile = window.innerWidth <= 480;
19718
- const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
19719
- return /* @__PURE__ */ jsx21(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs12(
19401
+ const isMobile = window.innerWidth <= 480;
19402
+ const rowStyle = isMobile ? {
19403
+ display: "flex",
19404
+ gap: 6,
19405
+ flexWrap: "nowrap",
19406
+ justifyContent: "center",
19407
+ overflowX: "auto",
19408
+ WebkitOverflowScrolling: "touch",
19409
+ width: "100%",
19410
+ scrollbarWidth: "none"
19411
+ } : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
19412
+ return /* @__PURE__ */ jsxs11(
19720
19413
  "div",
19721
19414
  {
19722
19415
  "data-ohw-bridge": "",
19723
19416
  "data-ohw-toolbar": "",
19724
19417
  onMouseDown: (e) => e.stopPropagation(),
19725
- className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
19726
- style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
19418
+ style: {
19419
+ display: "flex",
19420
+ flexDirection: "column",
19421
+ gap: 6,
19422
+ alignItems: "center",
19423
+ background: OHW_BLUE,
19424
+ padding: 8,
19425
+ borderRadius: 12,
19426
+ boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
19427
+ pointerEvents: pending ? "none" : "auto",
19428
+ opacity: pending ? 0.6 : 1,
19429
+ maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
19430
+ },
19727
19431
  children: [
19728
- /* @__PURE__ */ jsxs12(
19729
- "div",
19730
- {
19731
- className: cn(
19732
- "flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
19733
- "shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
19734
- mobile ? "flex-wrap justify-center" : "flex-nowrap"
19735
- ),
19736
- children: [
19737
- /* @__PURE__ */ jsxs12(Tooltip, { children: [
19738
- /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
19739
- CustomToolbarButton,
19740
- {
19741
- type: "button",
19742
- "aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
19743
- "aria-pressed": itemEditOn,
19744
- onClick: onToggleItemEdit,
19745
- className: "group size-8",
19746
- children: /* @__PURE__ */ jsx21(
19747
- Star,
19748
- {
19749
- size: 16,
19750
- fill: "currentColor",
19751
- strokeWidth: 0,
19752
- className: cn(
19753
- "transition-colors",
19754
- itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
19755
- ),
19756
- style: { pointerEvents: "none" }
19757
- }
19758
- )
19759
- }
19760
- ) }),
19761
- /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
19762
- ] }),
19763
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19764
- /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(ImageIcon2, { size: 16, style: { pointerEvents: "none" } }) }),
19765
- /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(LinkIcon, { size: 16, style: { pointerEvents: "none" } }) }),
19766
- /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ jsx21(ArrowLeft2, { size: 16, style: { pointerEvents: "none" } }) }),
19767
- /* @__PURE__ */ jsx21(
19768
- ToolbarAction,
19769
- {
19770
- label: gatedLabel("Move right"),
19771
- onClick: onMoveRight,
19772
- disabled: !itemEditOn || index >= itemCount - 1,
19773
- children: /* @__PURE__ */ jsx21(ArrowRight2, { size: 16, style: { pointerEvents: "none" } })
19774
- }
19775
- ),
19776
- /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ jsx21(ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
19777
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19778
- /* @__PURE__ */ jsx21(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
19779
- /* @__PURE__ */ jsx21(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
19780
- /* @__PURE__ */ jsx21(
19781
- ToolbarAction,
19782
- {
19783
- label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
19784
- active: treatment === "grayscale",
19785
- onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
19786
- children: /* @__PURE__ */ jsx21(Palette, { size: 16, style: { pointerEvents: "none" } })
19787
- }
19788
- ),
19789
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19790
- 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)),
19791
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19792
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ jsx21(Minus, { size: 16, style: { pointerEvents: "none" } }) }),
19793
- /* @__PURE__ */ jsxs12("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
19794
- sizeValue,
19795
- "px"
19796
- ] }),
19797
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ jsx21(Plus2, { size: 16, style: { pointerEvents: "none" } }) }),
19798
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19799
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ jsx21(ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
19800
- ]
19801
- }
19802
- ),
19803
- 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 })
19432
+ /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19433
+ VARIANTS.map((v) => /* @__PURE__ */ jsx20(Pill, { label: v.label, active: variant === v.value, onClick: () => onSetVariant(v.value) }, v.value)),
19434
+ ALIGNS.map((a) => /* @__PURE__ */ jsx20(Pill, { label: a.label, active: align === a.value, onClick: () => onSetAlign(a.value) }, a.value))
19435
+ ] }),
19436
+ /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19437
+ HOVERS.map((h) => /* @__PURE__ */ jsx20(Pill, { label: h.label, active: hover === h.value, onClick: () => onSetHover(h.value) }, h.value)),
19438
+ TREATMENTS.map((t) => /* @__PURE__ */ jsx20(Pill, { label: t.label, active: treatment === t.value, onClick: () => onSetTreatment(t.value) }, t.value))
19439
+ ] }),
19440
+ /* @__PURE__ */ jsxs11("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
19441
+ /* @__PURE__ */ jsx20(Pill, { label: "\u2212", onClick: () => onResize(-8) }),
19442
+ /* @__PURE__ */ jsxs11("span", { style: { color: "#ffffff", fontSize: 12, minWidth: 34, textAlign: "center" }, children: [
19443
+ sizeValue,
19444
+ "px"
19445
+ ] }),
19446
+ /* @__PURE__ */ jsx20(Pill, { label: "+", onClick: () => onResize(8) })
19447
+ ] }),
19448
+ /* @__PURE__ */ jsx20("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ jsx20(AltInput, { value: currentAlt, onCommit: onSetAlt }) }),
19449
+ /* @__PURE__ */ jsx20("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ jsx20(LinkInput, { value: currentHref2, onCommit: (href) => onSetLink(href, currentTarget) }) }),
19450
+ currentHref2 && /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19451
+ /* @__PURE__ */ jsx20(Pill, { label: "New tab", active: currentTarget === "new-tab", onClick: () => onSetLink(currentHref2, "new-tab") }),
19452
+ /* @__PURE__ */ jsx20(Pill, { label: "Same tab", active: currentTarget === "same-tab", onClick: () => onSetLink(currentHref2, "same-tab") })
19453
+ ] }),
19454
+ /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19455
+ /* @__PURE__ */ jsx20(Pill, { label: "Change Image", onClick: onChangeImage }),
19456
+ /* @__PURE__ */ jsx20(Pill, { label: "+ Item", onClick: onAddItem }),
19457
+ /* @__PURE__ */ jsx20(Pill, { label: "\u2212 Item", onClick: onRemoveItem, disabled: itemCount <= 1 })
19458
+ ] }),
19459
+ /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19460
+ /* @__PURE__ */ jsx20(Pill, { label: "\u2190 Move", onClick: onMoveLeft, disabled: index <= 0 }),
19461
+ /* @__PURE__ */ jsx20(Pill, { label: "\u2192 Move", onClick: onMoveRight, disabled: index >= itemCount - 1 })
19462
+ ] }),
19463
+ error && /* @__PURE__ */ jsx20("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
19804
19464
  ]
19805
19465
  }
19806
- ) });
19466
+ );
19807
19467
  }
19808
19468
  function findMediaStripSlots(tree) {
19809
19469
  const stack = tree.rows.flatMap((row) => row.blocks);
@@ -19822,23 +19482,31 @@ function AiMediaStripOverlay({
19822
19482
  }) {
19823
19483
  const [hover, setHover] = useState8(null);
19824
19484
  const [active, setActive] = useState8(null);
19825
- const [itemEditOn, setItemEditOn] = useState8(false);
19826
- const [linkOpen, setLinkOpen] = useState8(false);
19827
19485
  const [pending, setPending] = useState8(false);
19828
19486
  const [error, setError] = useState8(null);
19829
19487
  const activeRef = useRef5(null);
19830
19488
  activeRef.current = active;
19831
- const linkOpenRef = useRef5(false);
19832
- linkOpenRef.current = linkOpen;
19833
19489
  useEffect9(() => {
19834
19490
  const onMove = (e) => {
19835
- const ref = itemRefFromTarget(e.target);
19836
19491
  const t = e.target;
19837
- const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
19838
- setHover((prev) => {
19839
- const next = ref && !overEditable ? ref : null;
19840
- return sameRef(prev, next) ? prev : next;
19841
- });
19492
+ if (!(t instanceof HTMLElement)) return;
19493
+ 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]")) {
19494
+ return;
19495
+ }
19496
+ const itemEl = t.closest("[data-ohw-media-strip-item]");
19497
+ if (!itemEl) {
19498
+ setHover(null);
19499
+ return;
19500
+ }
19501
+ const sectionEl2 = itemEl.closest("[data-ohw-section]");
19502
+ const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
19503
+ const sectionId = unit ? instanceIdOf(unit) || null : null;
19504
+ const index = Number(itemEl.dataset.ohwMediaStripIndex);
19505
+ if (!sectionId || Number.isNaN(index)) {
19506
+ setHover(null);
19507
+ return;
19508
+ }
19509
+ setHover({ sectionId, index });
19842
19510
  };
19843
19511
  const onLeave = () => setHover(null);
19844
19512
  document.addEventListener("mousemove", onMove, { passive: true });
@@ -19850,25 +19518,23 @@ function AiMediaStripOverlay({
19850
19518
  }, []);
19851
19519
  useEffect9(() => {
19852
19520
  const onClick = (e) => {
19521
+ const current = activeRef.current;
19522
+ if (!current) return;
19853
19523
  const t = e.target;
19854
- if (!(t instanceof Element)) return;
19855
- if (t.closest(CHROME_SELECTOR)) return;
19856
- const ref = itemRefFromTarget(t);
19857
- if (sameRef(activeRef.current, ref)) return;
19858
- if (ref) clearInteractionChromeRef.current();
19859
- setItemEditOn(false);
19524
+ if (!(t instanceof HTMLElement)) return;
19525
+ if (t.closest("[data-ohw-item-interaction]")) return;
19526
+ const itemEl = findMediaStripItemElement(current.sectionId, current.index);
19527
+ if (itemEl && itemEl.contains(t)) return;
19528
+ setActive(null);
19860
19529
  setError(null);
19861
- setActive(ref);
19862
19530
  };
19863
19531
  document.addEventListener("click", onClick, true);
19864
19532
  return () => document.removeEventListener("click", onClick, true);
19865
- }, [clearInteractionChromeRef]);
19533
+ }, []);
19866
19534
  useEffect9(() => {
19867
19535
  const onBlur = () => {
19868
19536
  if (!activeRef.current) return;
19869
19537
  setActive(null);
19870
- setItemEditOn(false);
19871
- setLinkOpen(false);
19872
19538
  setError(null);
19873
19539
  };
19874
19540
  window.addEventListener("blur", onBlur);
@@ -19878,10 +19544,7 @@ function AiMediaStripOverlay({
19878
19544
  const onKeyDown = (e) => {
19879
19545
  if (e.key !== "Escape") return;
19880
19546
  if (!activeRef.current) return;
19881
- if (linkOpenRef.current) return;
19882
- if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
19883
19547
  setActive(null);
19884
- setItemEditOn(false);
19885
19548
  setError(null);
19886
19549
  };
19887
19550
  document.addEventListener("keydown", onKeyDown);
@@ -19915,133 +19578,137 @@ function AiMediaStripOverlay({
19915
19578
  tree: nextTree,
19916
19579
  label: entry.label,
19917
19580
  media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
19918
- ...entry.brand ? { brand: entry.brand } : {},
19919
- // The user is already looking at the strip they just edited — recentering the viewport
19920
- // on every edit reads as the section jumping around.
19921
- skipScrollIntoView: true
19581
+ ...entry.brand ? { brand: entry.brand } : {}
19922
19582
  });
19923
19583
  return true;
19924
19584
  },
19925
19585
  [findEntry, postToParent2, applyTreeLocalRef]
19926
19586
  );
19927
19587
  const activeEntry = active ? findEntry(active.sectionId) : null;
19588
+ const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
19928
19589
  const activeItemRect = useLiveItemRect(active);
19929
- const activeStripRect = useLiveItemRect(active, true);
19930
- const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
19931
- const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
19932
- const activeItem = active ? activeItems[active.index] : void 0;
19933
- const activeHref = activeItem?.href ?? "";
19934
- const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
19935
- return /* @__PURE__ */ jsxs12(Fragment7, { children: [
19936
- hoverRect && /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
19937
- activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ jsxs12(Fragment7, { children: [
19938
- /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
19939
- /* @__PURE__ */ jsx21(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ jsx21(
19940
- MediaStripToolbar,
19941
- {
19942
- entry: activeEntry,
19943
- index: active.index,
19944
- pending,
19945
- error,
19946
- itemEditOn,
19947
- onToggleItemEdit: () => setItemEditOn((on) => !on),
19948
- onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
19949
- onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
19950
- onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
19951
- onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
19952
- onResize: (delta) => {
19953
- const slots = findMediaStripSlots(activeEntry.tree);
19954
- const variant = slots?.variant === "reel" ? "reel" : "logos";
19955
- const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19956
- void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
19957
- },
19958
- onOpenLink: () => setLinkOpen(true),
19959
- onAddItem: () => {
19960
- void requestAssetPick(postToParent2).then((picked) => {
19961
- if (!picked) return;
19962
- const item = { assetId: picked.assetId, alt: "Logo" };
19590
+ const TOOLBAR_APPROX_H = 170;
19591
+ const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
19592
+ return /* @__PURE__ */ jsxs11(Fragment7, { children: [
19593
+ hoverHandleRect && hover && /* @__PURE__ */ jsx20(
19594
+ "button",
19595
+ {
19596
+ type: "button",
19597
+ "data-ohw-toolbar": "",
19598
+ onClick: () => {
19599
+ clearInteractionChromeRef.current();
19600
+ setActive(hover);
19601
+ },
19602
+ "aria-label": "Configure media item",
19603
+ style: {
19604
+ position: "fixed",
19605
+ top: hoverHandleRect.top + 8,
19606
+ left: hoverHandleRect.left + hoverHandleRect.width - 36,
19607
+ width: 28,
19608
+ height: 28,
19609
+ borderRadius: 8,
19610
+ border: `1.5px dashed ${PRIMARY3}`,
19611
+ background: "#ffffff",
19612
+ color: PRIMARY3,
19613
+ display: "flex",
19614
+ alignItems: "center",
19615
+ justifyContent: "center",
19616
+ cursor: "pointer",
19617
+ zIndex: 2147483643,
19618
+ fontSize: 14,
19619
+ fontWeight: 700
19620
+ },
19621
+ children: /* @__PURE__ */ jsx20(Star, { size: 14, style: { pointerEvents: "none" } })
19622
+ }
19623
+ ),
19624
+ activeItemRect && active && activeEntry && /* @__PURE__ */ jsx20(
19625
+ ItemInteractionLayer,
19626
+ {
19627
+ rect: activeItemRect,
19628
+ state: toolbarState,
19629
+ toolbar: /* @__PURE__ */ jsx20(
19630
+ MediaStripToolbar,
19631
+ {
19632
+ entry: activeEntry,
19633
+ index: active.index,
19634
+ pending,
19635
+ error,
19636
+ onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
19637
+ onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
19638
+ onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
19639
+ onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
19640
+ onResize: (delta) => {
19641
+ const slots = findMediaStripSlots(activeEntry.tree);
19642
+ const variant = slots?.variant === "reel" ? "reel" : "logos";
19643
+ const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19644
+ void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
19645
+ },
19646
+ onSetAlt: (alt) => {
19647
+ void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
19648
+ },
19649
+ onSetLink: (href, linkTarget) => {
19963
19650
  void runMutation(
19964
19651
  active.sectionId,
19965
- (tree) => addMediaStripItem(tree, item, active.index),
19966
- { [picked.assetId]: picked.url }
19967
- ).then((applied) => {
19968
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19652
+ (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
19653
+ );
19654
+ },
19655
+ onAddItem: () => {
19656
+ void requestAssetPick(postToParent2).then((picked) => {
19657
+ if (!picked) return;
19658
+ const item = { assetId: picked.assetId, alt: "Logo" };
19659
+ void runMutation(
19660
+ active.sectionId,
19661
+ (tree) => addMediaStripItem(tree, item, active.index),
19662
+ { [picked.assetId]: picked.url }
19663
+ ).then((applied) => {
19664
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19665
+ });
19969
19666
  });
19970
- });
19971
- },
19972
- onChangeImage: () => {
19973
- void requestAssetPick(postToParent2).then((picked) => {
19974
- if (!picked) return;
19975
- void runMutation(
19976
- active.sectionId,
19977
- (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
19978
- { [picked.assetId]: picked.url }
19667
+ },
19668
+ onChangeImage: () => {
19669
+ void requestAssetPick(postToParent2).then((picked) => {
19670
+ if (!picked) return;
19671
+ void runMutation(
19672
+ active.sectionId,
19673
+ (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
19674
+ { [picked.assetId]: picked.url }
19675
+ );
19676
+ });
19677
+ },
19678
+ onRemoveItem: () => {
19679
+ void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
19680
+ (applied) => {
19681
+ if (applied) setActive(null);
19682
+ }
19979
19683
  );
19980
- });
19981
- },
19982
- onRemoveItem: () => {
19983
- void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
19984
- (applied) => {
19985
- if (applied) setActive(null);
19986
- }
19987
- );
19988
- },
19989
- onMoveLeft: () => {
19990
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
19991
- (applied) => {
19992
- if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
19993
- }
19994
- );
19995
- },
19996
- onMoveRight: () => {
19997
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
19998
- (applied) => {
19999
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
20000
- }
20001
- );
20002
- }
20003
- }
20004
- ) }),
20005
- /* @__PURE__ */ jsx21(
20006
- "div",
20007
- {
20008
- "data-ohw-bridge": "",
20009
- "data-ohw-item-interaction": "",
20010
- "aria-hidden": true,
20011
- className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
20012
- style: {
20013
- top: activeItemRect.top + activeItemRect.height + 10,
20014
- left: activeItemRect.left - 5,
20015
- background: PRIMARY3,
20016
- zIndex: 2147483644
20017
- },
20018
- children: "Media item"
20019
- }
20020
- ),
20021
- linkOpen && /* @__PURE__ */ jsx21(
20022
- LinkModal,
20023
- {
20024
- href: activeHref,
20025
- linkTarget: activeTarget,
20026
- onClose: () => setLinkOpen(false),
20027
- onSave: (href, linkTarget) => {
20028
- void runMutation(
20029
- active.sectionId,
20030
- (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
20031
- );
19684
+ },
19685
+ onMoveLeft: () => {
19686
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
19687
+ (applied) => {
19688
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
19689
+ }
19690
+ );
19691
+ },
19692
+ onMoveRight: () => {
19693
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
19694
+ (applied) => {
19695
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19696
+ }
19697
+ );
19698
+ }
20032
19699
  }
20033
- }
20034
- )
20035
- ] })
19700
+ )
19701
+ }
19702
+ )
20036
19703
  ] });
20037
19704
  }
20038
19705
 
20039
19706
  // src/ui/ai-section/AiPricingCardOverlay.tsx
20040
- import { useCallback as useCallback4, useEffect as useEffect10, useLayoutEffect as useLayoutEffect5, useRef as useRef6, useState as useState9 } from "react";
20041
- import { Check as Check3, ChevronDown as ChevronDown4, Minus as Minus2, Plus as Plus3, Star as Star2 } from "lucide-react";
20042
- import { Fragment as Fragment8, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
19707
+ import { useCallback as useCallback4, useEffect as useEffect10, useLayoutEffect as useLayoutEffect4, useRef as useRef6, useState as useState9 } from "react";
19708
+ import { Check as Check2, ChevronDown as ChevronDown3, Minus, Plus as Plus2, Star as Star2 } from "lucide-react";
19709
+ import { Fragment as Fragment8, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
20043
19710
  var PRIMARY4 = "var(--ohw-primary, #0885FE)";
20044
- 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]";
19711
+ 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]";
20045
19712
  function findPricingCardElement(sectionId, index) {
20046
19713
  const sectionEl2 = findByInstanceId(sectionId);
20047
19714
  if (!sectionEl2) return null;
@@ -20053,7 +19720,7 @@ function findPricingCardElement(sectionId, index) {
20053
19720
  }
20054
19721
  function cardRefFromTarget(target) {
20055
19722
  if (!(target instanceof Element)) return null;
20056
- if (target.closest(CHROME_SELECTOR2)) return null;
19723
+ if (target.closest(CHROME_SELECTOR)) return null;
20057
19724
  const cardEl = target.closest("[data-ohw-pricing-card]");
20058
19725
  if (!cardEl) return null;
20059
19726
  const sectionEl2 = cardEl.closest("[data-ohw-section]");
@@ -20063,21 +19730,21 @@ function cardRefFromTarget(target) {
20063
19730
  if (!sectionId || Number.isNaN(index)) return null;
20064
19731
  return { sectionId, index };
20065
19732
  }
20066
- function sameRef2(a, b) {
19733
+ function sameRef(a, b) {
20067
19734
  return a?.sectionId === b?.sectionId && a?.index === b?.index;
20068
19735
  }
20069
- function rectOf2(el) {
19736
+ function rectOf(el) {
20070
19737
  if (!el) return null;
20071
19738
  const r2 = el.getBoundingClientRect();
20072
19739
  if (r2.width <= 0 || r2.height <= 0) return null;
20073
19740
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
20074
19741
  }
20075
19742
  function readRect3(ref) {
20076
- return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
19743
+ return rectOf(ref && findPricingCardElement(ref.sectionId, ref.index));
20077
19744
  }
20078
19745
  function readGridRect(ref) {
20079
19746
  const card = ref && findPricingCardElement(ref.sectionId, ref.index);
20080
- return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
19747
+ return rectOf(card?.closest("[data-ohw-pricing-collection]") ?? card);
20081
19748
  }
20082
19749
  function useLiveCardRect(ref, grid = false) {
20083
19750
  const [rect, setRect] = useState9(null);
@@ -20107,19 +19774,19 @@ function useLiveCardRect(ref, grid = false) {
20107
19774
  }
20108
19775
  var TOOLBAR_GRID_GAP = 52;
20109
19776
  var TOOLBAR_GRID_GAP_MOBILE = 42;
20110
- var TOOLBAR_EDGE_MARGIN3 = 4;
19777
+ var TOOLBAR_EDGE_MARGIN2 = 4;
20111
19778
  function GridToolbarSlot({ gridRect, children }) {
20112
19779
  const slotRef = useRef6(null);
20113
19780
  const [shift, setShift] = useState9(0);
20114
19781
  const centerX = gridRect.left + gridRect.width / 2;
20115
- useLayoutEffect5(() => {
19782
+ useLayoutEffect4(() => {
20116
19783
  const slot = slotRef.current;
20117
19784
  if (!slot) return;
20118
19785
  const clamp = () => {
20119
19786
  const w = slot.offsetWidth;
20120
19787
  if (w <= 0) return;
20121
19788
  const half = w / 2;
20122
- const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
19789
+ const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
20123
19790
  setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
20124
19791
  };
20125
19792
  clamp();
@@ -20128,7 +19795,7 @@ function GridToolbarSlot({ gridRect, children }) {
20128
19795
  return () => ro.disconnect();
20129
19796
  }, [centerX, children]);
20130
19797
  const mobile = window.innerWidth <= 480;
20131
- return /* @__PURE__ */ jsx22(
19798
+ return /* @__PURE__ */ jsx21(
20132
19799
  "div",
20133
19800
  {
20134
19801
  ref: slotRef,
@@ -20163,7 +19830,7 @@ function requestValidateTree2(postToParent2, tree) {
20163
19830
  });
20164
19831
  }
20165
19832
  function StyleSwatch({ style }) {
20166
- return /* @__PURE__ */ jsx22(
19833
+ return /* @__PURE__ */ jsx21(
20167
19834
  "span",
20168
19835
  {
20169
19836
  "aria-hidden": true,
@@ -20177,35 +19844,35 @@ function StyleSwatch({ style }) {
20177
19844
  );
20178
19845
  }
20179
19846
  function ButtonGlyph() {
20180
- return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20181
- /* @__PURE__ */ jsx22("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
20182
- /* @__PURE__ */ jsx22("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
19847
+ return /* @__PURE__ */ jsxs12("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
19848
+ /* @__PURE__ */ jsx21("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
19849
+ /* @__PURE__ */ jsx21("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
20183
19850
  ] });
20184
19851
  }
20185
19852
  function FeatureGlyph({ mode }) {
20186
- return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20187
- /* @__PURE__ */ jsx22("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
20188
- /* @__PURE__ */ jsx22("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
20189
- /* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
20190
- /* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
20191
- /* @__PURE__ */ jsx22("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
20192
- mode === "add" && /* @__PURE__ */ jsx22("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
19853
+ return /* @__PURE__ */ jsxs12("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
19854
+ /* @__PURE__ */ jsx21("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
19855
+ /* @__PURE__ */ jsx21("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
19856
+ /* @__PURE__ */ jsx21("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
19857
+ /* @__PURE__ */ jsx21("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
19858
+ /* @__PURE__ */ jsx21("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
19859
+ mode === "add" && /* @__PURE__ */ jsx21("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
20193
19860
  ] });
20194
19861
  }
20195
- function ToolbarAction2({
19862
+ function ToolbarAction({
20196
19863
  label,
20197
19864
  onClick,
20198
19865
  disabled = false,
20199
19866
  children
20200
19867
  }) {
20201
- const button = /* @__PURE__ */ jsx22(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
20202
- return /* @__PURE__ */ jsxs13(Tooltip, { children: [
20203
- /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: button }) : button }),
20204
- /* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
19868
+ const button = /* @__PURE__ */ jsx21(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
19869
+ return /* @__PURE__ */ jsxs12(Tooltip, { children: [
19870
+ /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: button }) : button }),
19871
+ /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
20205
19872
  ] });
20206
19873
  }
20207
- function ToolbarSeparator2() {
20208
- return /* @__PURE__ */ jsx22("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
19874
+ function ToolbarSeparator() {
19875
+ return /* @__PURE__ */ jsx21("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
20209
19876
  }
20210
19877
  function CardStyleMenu({
20211
19878
  value,
@@ -20213,7 +19880,7 @@ function CardStyleMenu({
20213
19880
  disabled = false
20214
19881
  }) {
20215
19882
  const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
20216
- const trigger = /* @__PURE__ */ jsxs13(
19883
+ const trigger = /* @__PURE__ */ jsxs12(
20217
19884
  "button",
20218
19885
  {
20219
19886
  type: "button",
@@ -20224,28 +19891,28 @@ function CardStyleMenu({
20224
19891
  disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
20225
19892
  ),
20226
19893
  children: [
20227
- /* @__PURE__ */ jsx22(StyleSwatch, { style: current.value }),
20228
- /* @__PURE__ */ jsx22("span", { className: "flex-1 text-left", children: current.label }),
20229
- /* @__PURE__ */ jsx22(ChevronDown4, { size: 16, style: { pointerEvents: "none" } })
19894
+ /* @__PURE__ */ jsx21(StyleSwatch, { style: current.value }),
19895
+ /* @__PURE__ */ jsx21("span", { className: "flex-1 text-left", children: current.label }),
19896
+ /* @__PURE__ */ jsx21(ChevronDown3, { size: 16, style: { pointerEvents: "none" } })
20230
19897
  ]
20231
19898
  }
20232
19899
  );
20233
19900
  if (disabled) {
20234
- return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20235
- /* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
20236
- /* @__PURE__ */ jsxs13(Tooltip, { children: [
20237
- /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: trigger }) }),
20238
- /* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
19901
+ return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
19902
+ /* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
19903
+ /* @__PURE__ */ jsxs12(Tooltip, { children: [
19904
+ /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: trigger }) }),
19905
+ /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
20239
19906
  ] })
20240
19907
  ] });
20241
19908
  }
20242
- return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20243
- /* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
20244
- /* @__PURE__ */ jsxs13(DropdownMenu, { modal: false, children: [
20245
- /* @__PURE__ */ jsx22(DropdownMenuTrigger, { asChild: true, children: trigger }),
20246
- /* @__PURE__ */ jsx22(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
19909
+ return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
19910
+ /* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
19911
+ /* @__PURE__ */ jsxs12(DropdownMenu, { modal: false, children: [
19912
+ /* @__PURE__ */ jsx21(DropdownMenuTrigger, { asChild: true, children: trigger }),
19913
+ /* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
20247
19914
  const selected = style.value === value;
20248
- return /* @__PURE__ */ jsxs13(
19915
+ return /* @__PURE__ */ jsxs12(
20249
19916
  DropdownMenuItem,
20250
19917
  {
20251
19918
  role: "menuitemradio",
@@ -20253,9 +19920,9 @@ function CardStyleMenu({
20253
19920
  onSelect: () => onChange(style.value),
20254
19921
  className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
20255
19922
  children: [
20256
- /* @__PURE__ */ jsx22(StyleSwatch, { style: style.value }),
20257
- /* @__PURE__ */ jsx22("span", { children: style.label }),
20258
- selected && /* @__PURE__ */ jsx22(Check3, { size: 16, className: "text-bridge-primary" })
19923
+ /* @__PURE__ */ jsx21(StyleSwatch, { style: style.value }),
19924
+ /* @__PURE__ */ jsx21("span", { children: style.label }),
19925
+ selected && /* @__PURE__ */ jsx21(Check2, { size: 16, className: "text-bridge-primary" })
20259
19926
  ]
20260
19927
  },
20261
19928
  style.value
@@ -20285,7 +19952,7 @@ function PricingCardToolbar({
20285
19952
  const style = pricingCardStyle(entry.tree, index);
20286
19953
  const featuredTag = pricingCardFeaturedTag(entry.tree, index);
20287
19954
  const mobile = window.innerWidth <= 480;
20288
- return /* @__PURE__ */ jsx22(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs13(
19955
+ return /* @__PURE__ */ jsx21(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs12(
20289
19956
  "div",
20290
19957
  {
20291
19958
  "data-ohw-bridge": "",
@@ -20297,7 +19964,7 @@ function PricingCardToolbar({
20297
19964
  ),
20298
19965
  style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
20299
19966
  children: [
20300
- /* @__PURE__ */ jsxs13(
19967
+ /* @__PURE__ */ jsxs12(
20301
19968
  "div",
20302
19969
  {
20303
19970
  className: cn(
@@ -20306,8 +19973,8 @@ function PricingCardToolbar({
20306
19973
  mobile ? "flex-wrap justify-center" : "flex-nowrap"
20307
19974
  ),
20308
19975
  children: [
20309
- /* @__PURE__ */ jsxs13(Tooltip, { children: [
20310
- /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22(
19976
+ /* @__PURE__ */ jsxs12(Tooltip, { children: [
19977
+ /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
20311
19978
  CustomToolbarButton,
20312
19979
  {
20313
19980
  type: "button",
@@ -20315,7 +19982,7 @@ function PricingCardToolbar({
20315
19982
  "aria-pressed": featuredTag,
20316
19983
  onClick: () => onSetFeaturedTag(!featuredTag),
20317
19984
  className: "group size-8",
20318
- children: /* @__PURE__ */ jsx22(
19985
+ children: /* @__PURE__ */ jsx21(
20319
19986
  Star2,
20320
19987
  {
20321
19988
  size: 16,
@@ -20330,25 +19997,25 @@ function PricingCardToolbar({
20330
19997
  )
20331
19998
  }
20332
19999
  ) }),
20333
- /* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
20000
+ /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
20334
20001
  ] }),
20335
- /* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
20336
- /* @__PURE__ */ jsx22(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
20337
- /* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
20338
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ jsx22(ButtonGlyph, {}) }),
20339
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ jsxs13("span", { className: "relative inline-flex", children: [
20340
- /* @__PURE__ */ jsx22(ButtonGlyph, {}),
20341
- /* @__PURE__ */ jsx22(Minus2, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
20002
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
20003
+ /* @__PURE__ */ jsx21(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
20004
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
20005
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ jsx21(ButtonGlyph, {}) }),
20006
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ jsxs12("span", { className: "relative inline-flex", children: [
20007
+ /* @__PURE__ */ jsx21(ButtonGlyph, {}),
20008
+ /* @__PURE__ */ jsx21(Minus, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
20342
20009
  ] }) }),
20343
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "add" }) }),
20344
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "remove" }) }),
20345
- /* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
20346
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ jsx22(Plus3, { size: 16, style: { pointerEvents: "none" } }) }),
20347
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ jsx22(Minus2, { size: 16, style: { pointerEvents: "none" } }) })
20010
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ jsx21(FeatureGlyph, { mode: "add" }) }),
20011
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ jsx21(FeatureGlyph, { mode: "remove" }) }),
20012
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
20013
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ jsx21(Plus2, { size: 16, style: { pointerEvents: "none" } }) }),
20014
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ jsx21(Minus, { size: 16, style: { pointerEvents: "none" } }) })
20348
20015
  ]
20349
20016
  }
20350
20017
  ),
20351
- 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 })
20018
+ 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 })
20352
20019
  ]
20353
20020
  }
20354
20021
  ) });
@@ -20382,7 +20049,7 @@ function AiPricingCardOverlay({
20382
20049
  const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
20383
20050
  setHover((prev) => {
20384
20051
  const next = ref && !overEditable ? ref : null;
20385
- return sameRef2(prev, next) ? prev : next;
20052
+ return sameRef(prev, next) ? prev : next;
20386
20053
  });
20387
20054
  };
20388
20055
  const onLeave = () => setHover(null);
@@ -20397,10 +20064,10 @@ function AiPricingCardOverlay({
20397
20064
  const onClick = (e) => {
20398
20065
  const t = e.target;
20399
20066
  if (!(t instanceof Element)) return;
20400
- if (t.closest(CHROME_SELECTOR2)) return;
20067
+ if (t.closest(CHROME_SELECTOR)) return;
20401
20068
  const ref = cardRefFromTarget(t);
20402
- setActive((prev) => sameRef2(prev, ref) ? prev : ref);
20403
- if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
20069
+ setActive((prev) => sameRef(prev, ref) ? prev : ref);
20070
+ if (!ref || !sameRef(activeRef.current, ref)) setError(null);
20404
20071
  };
20405
20072
  document.addEventListener("click", onClick, true);
20406
20073
  return () => document.removeEventListener("click", onClick, true);
@@ -20465,12 +20132,12 @@ function AiPricingCardOverlay({
20465
20132
  const activeEntry = active ? findEntry(active.sectionId) : null;
20466
20133
  const activeCardRect = useLiveCardRect(active);
20467
20134
  const activeGridRect = useLiveCardRect(active, true);
20468
- const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
20469
- return /* @__PURE__ */ jsxs13(Fragment8, { children: [
20470
- hoverRect && /* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20471
- activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ jsxs13(Fragment8, { children: [
20472
- /* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
20473
- /* @__PURE__ */ jsx22(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ jsx22(
20135
+ const hoverRect = useLiveCardRect(hover && !sameRef(hover, active) ? hover : null);
20136
+ return /* @__PURE__ */ jsxs12(Fragment8, { children: [
20137
+ hoverRect && /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20138
+ activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ jsxs12(Fragment8, { children: [
20139
+ /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
20140
+ /* @__PURE__ */ jsx21(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ jsx21(
20474
20141
  PricingCardToolbar,
20475
20142
  {
20476
20143
  entry: activeEntry,
@@ -20498,7 +20165,7 @@ function AiPricingCardOverlay({
20498
20165
  onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
20499
20166
  }
20500
20167
  ) }),
20501
- /* @__PURE__ */ jsx22(
20168
+ /* @__PURE__ */ jsx21(
20502
20169
  "div",
20503
20170
  {
20504
20171
  "data-ohw-bridge": "",
@@ -20562,11 +20229,39 @@ function clearVideo(tree, path) {
20562
20229
  });
20563
20230
  }
20564
20231
 
20232
+ // src/lib/youtube.ts
20233
+ var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
20234
+ function extractYouTubeId(input) {
20235
+ const trimmed = input.trim();
20236
+ if (!trimmed) return null;
20237
+ if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
20238
+ let url;
20239
+ try {
20240
+ url = new URL(trimmed);
20241
+ } catch {
20242
+ return null;
20243
+ }
20244
+ const host = url.hostname.replace(/^www\./, "");
20245
+ if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
20246
+ return null;
20247
+ }
20248
+ let candidate = null;
20249
+ if (host === "youtu.be") {
20250
+ candidate = url.pathname.slice(1).split("/")[0] ?? null;
20251
+ } else if (url.pathname === "/watch") {
20252
+ candidate = url.searchParams.get("v");
20253
+ } else {
20254
+ const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
20255
+ candidate = match ? match[1] : null;
20256
+ }
20257
+ return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
20258
+ }
20259
+
20565
20260
  // src/ui/ai-section/AiVideoOverlay.tsx
20566
- import { Fragment as Fragment9, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
20261
+ import { Fragment as Fragment9, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
20567
20262
  var PRIMARY5 = "#0885FE";
20568
- var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
20569
- var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20263
+ var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY5})`;
20264
+ var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20570
20265
  function findVideoBlockElement(sectionId, path) {
20571
20266
  const sectionEl2 = findByInstanceId(sectionId);
20572
20267
  if (!sectionEl2) return null;
@@ -20626,12 +20321,12 @@ function requestValidateTree3(postToParent2, tree) {
20626
20321
  postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
20627
20322
  });
20628
20323
  }
20629
- function Pill({
20324
+ function Pill2({
20630
20325
  label,
20631
20326
  onClick,
20632
20327
  disabled
20633
20328
  }) {
20634
- return /* @__PURE__ */ jsx23(
20329
+ return /* @__PURE__ */ jsx22(
20635
20330
  "button",
20636
20331
  {
20637
20332
  type: "button",
@@ -20647,7 +20342,7 @@ function Pill({
20647
20342
  border: "none",
20648
20343
  cursor: disabled ? "default" : "pointer",
20649
20344
  background: "#ffffff",
20650
- color: OHW_BLUE_DARK,
20345
+ color: OHW_BLUE_DARK2,
20651
20346
  opacity: disabled ? 0.4 : 1,
20652
20347
  fontSize: 12,
20653
20348
  lineHeight: "16px",
@@ -20690,8 +20385,8 @@ function VideoUrlInput({ value, onCommit }) {
20690
20385
  onCommit(id);
20691
20386
  }
20692
20387
  };
20693
- return /* @__PURE__ */ jsxs14("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
20694
- /* @__PURE__ */ jsxs14(
20388
+ return /* @__PURE__ */ jsxs13("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
20389
+ /* @__PURE__ */ jsxs13(
20695
20390
  "div",
20696
20391
  {
20697
20392
  style: {
@@ -20707,12 +20402,12 @@ function VideoUrlInput({ value, onCommit }) {
20707
20402
  boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
20708
20403
  },
20709
20404
  children: [
20710
- /* @__PURE__ */ jsx23(
20405
+ /* @__PURE__ */ jsx22(
20711
20406
  "span",
20712
20407
  {
20713
20408
  style: {
20714
20409
  flex: "0 0 auto",
20715
- color: OHW_BLUE_DARK,
20410
+ color: OHW_BLUE_DARK2,
20716
20411
  fontSize: 10,
20717
20412
  lineHeight: "16px",
20718
20413
  fontWeight: 700,
@@ -20722,7 +20417,7 @@ function VideoUrlInput({ value, onCommit }) {
20722
20417
  children: "Video"
20723
20418
  }
20724
20419
  ),
20725
- /* @__PURE__ */ jsx23(
20420
+ /* @__PURE__ */ jsx22(
20726
20421
  "input",
20727
20422
  {
20728
20423
  type: "text",
@@ -20759,7 +20454,7 @@ function VideoUrlInput({ value, onCommit }) {
20759
20454
  ]
20760
20455
  }
20761
20456
  ),
20762
- 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." })
20457
+ 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." })
20763
20458
  ] });
20764
20459
  }
20765
20460
  function VideoToolbar({
@@ -20769,7 +20464,7 @@ function VideoToolbar({
20769
20464
  onSetVideoId,
20770
20465
  onRemove
20771
20466
  }) {
20772
- return /* @__PURE__ */ jsxs14(
20467
+ return /* @__PURE__ */ jsxs13(
20773
20468
  "div",
20774
20469
  {
20775
20470
  "data-ohw-bridge": "",
@@ -20781,7 +20476,7 @@ function VideoToolbar({
20781
20476
  gap: 6,
20782
20477
  alignItems: "center",
20783
20478
  width: 280,
20784
- background: OHW_BLUE,
20479
+ background: OHW_BLUE2,
20785
20480
  padding: 8,
20786
20481
  borderRadius: 12,
20787
20482
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -20789,9 +20484,9 @@ function VideoToolbar({
20789
20484
  opacity: pending ? 0.6 : 1
20790
20485
  },
20791
20486
  children: [
20792
- /* @__PURE__ */ jsx23(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
20793
- /* @__PURE__ */ jsx23(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
20794
- error && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20487
+ /* @__PURE__ */ jsx22(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
20488
+ /* @__PURE__ */ jsx22(Pill2, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
20489
+ error && /* @__PURE__ */ jsx22("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20795
20490
  ]
20796
20491
  }
20797
20492
  );
@@ -20911,8 +20606,8 @@ function AiVideoOverlay({
20911
20606
  const activeBlockRect = useLiveBlockRect(active);
20912
20607
  const TOOLBAR_APPROX_H = 90;
20913
20608
  const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
20914
- return /* @__PURE__ */ jsxs14(Fragment9, { children: [
20915
- hoverHandleRect && hover && /* @__PURE__ */ jsx23(
20609
+ return /* @__PURE__ */ jsxs13(Fragment9, { children: [
20610
+ hoverHandleRect && hover && /* @__PURE__ */ jsx22(
20916
20611
  "button",
20917
20612
  {
20918
20613
  type: "button",
@@ -20940,15 +20635,15 @@ function AiVideoOverlay({
20940
20635
  fontSize: 14,
20941
20636
  fontWeight: 700
20942
20637
  },
20943
- children: /* @__PURE__ */ jsx23(Star3, { size: 14, style: { pointerEvents: "none" } })
20638
+ children: /* @__PURE__ */ jsx22(Star3, { size: 14, style: { pointerEvents: "none" } })
20944
20639
  }
20945
20640
  ),
20946
- activeBlockRect && active && activeEntry && /* @__PURE__ */ jsx23(
20641
+ activeBlockRect && active && activeEntry && /* @__PURE__ */ jsx22(
20947
20642
  ItemInteractionLayer,
20948
20643
  {
20949
20644
  rect: activeBlockRect,
20950
20645
  state: toolbarState,
20951
- toolbar: /* @__PURE__ */ jsx23(
20646
+ toolbar: /* @__PURE__ */ jsx22(
20952
20647
  VideoToolbar,
20953
20648
  {
20954
20649
  videoId: videoIdAt(activeEntry.tree, active.path),
@@ -21023,10 +20718,10 @@ function setCarouselAutoplay(tree, on) {
21023
20718
  }
21024
20719
 
21025
20720
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
21026
- import { Fragment as Fragment10, jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
20721
+ import { Fragment as Fragment10, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
21027
20722
  var PRIMARY6 = "#0885FE";
21028
- var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
21029
- var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
20723
+ var OHW_BLUE3 = `var(--ohw-primary, ${PRIMARY6})`;
20724
+ var OHW_BLUE_DARK3 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
21030
20725
  function findCarouselItemElement(sectionId, index) {
21031
20726
  const sectionEl2 = findByInstanceId(sectionId);
21032
20727
  if (!sectionEl2) return null;
@@ -21105,8 +20800,8 @@ function requestAssetPick2(postToParent2) {
21105
20800
  postToParent2({ type: "ow:asset-pick", id });
21106
20801
  });
21107
20802
  }
21108
- function Pill2({ label, onClick, disabled }) {
21109
- return /* @__PURE__ */ jsx24(
20803
+ function Pill3({ label, onClick, disabled }) {
20804
+ return /* @__PURE__ */ jsx23(
21110
20805
  "button",
21111
20806
  {
21112
20807
  type: "button",
@@ -21122,7 +20817,7 @@ function Pill2({ label, onClick, disabled }) {
21122
20817
  border: "none",
21123
20818
  cursor: disabled ? "default" : "pointer",
21124
20819
  background: "#ffffff",
21125
- color: OHW_BLUE_DARK2,
20820
+ color: OHW_BLUE_DARK3,
21126
20821
  opacity: disabled ? 0.4 : 1,
21127
20822
  fontSize: 12,
21128
20823
  lineHeight: "16px",
@@ -21140,7 +20835,7 @@ function TogglePill({
21140
20835
  onToggle,
21141
20836
  disabled
21142
20837
  }) {
21143
- return /* @__PURE__ */ jsxs15(
20838
+ return /* @__PURE__ */ jsxs14(
21144
20839
  "button",
21145
20840
  {
21146
20841
  type: "button",
@@ -21159,7 +20854,7 @@ function TogglePill({
21159
20854
  border: "none",
21160
20855
  cursor: disabled ? "default" : "pointer",
21161
20856
  background: "#ffffff",
21162
- color: OHW_BLUE_DARK2,
20857
+ color: OHW_BLUE_DARK3,
21163
20858
  opacity: disabled ? 0.4 : 1,
21164
20859
  fontSize: 12,
21165
20860
  lineHeight: "16px",
@@ -21169,7 +20864,7 @@ function TogglePill({
21169
20864
  },
21170
20865
  children: [
21171
20866
  label,
21172
- /* @__PURE__ */ jsx24(
20867
+ /* @__PURE__ */ jsx23(
21173
20868
  "span",
21174
20869
  {
21175
20870
  "aria-hidden": true,
@@ -21182,10 +20877,10 @@ function TogglePill({
21182
20877
  // Off is a grey track, not a washed-out blue: the pill's own white background already
21183
20878
  // carries the brand colour in the text, and a pale blue track next to it read as
21184
20879
  // "disabled control" rather than "switch that is off".
21185
- background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
20880
+ background: on ? OHW_BLUE_DARK3 : "#CBD5E1",
21186
20881
  transition: "background 120ms ease"
21187
20882
  },
21188
- children: /* @__PURE__ */ jsx24(
20883
+ children: /* @__PURE__ */ jsx23(
21189
20884
  "span",
21190
20885
  {
21191
20886
  style: {
@@ -21214,7 +20909,7 @@ function CarouselSlideToolbar({
21214
20909
  onChangeImage,
21215
20910
  onToggleAutoplay
21216
20911
  }) {
21217
- return /* @__PURE__ */ jsxs15(
20912
+ return /* @__PURE__ */ jsxs14(
21218
20913
  "div",
21219
20914
  {
21220
20915
  "data-ohw-bridge": "",
@@ -21225,7 +20920,7 @@ function CarouselSlideToolbar({
21225
20920
  flexDirection: "column",
21226
20921
  gap: 6,
21227
20922
  alignItems: "center",
21228
- background: OHW_BLUE2,
20923
+ background: OHW_BLUE3,
21229
20924
  padding: 8,
21230
20925
  borderRadius: 12,
21231
20926
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -21237,11 +20932,11 @@ function CarouselSlideToolbar({
21237
20932
  pointerEvents: pending ? "none" : "auto"
21238
20933
  },
21239
20934
  children: [
21240
- /* @__PURE__ */ jsxs15("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
21241
- /* @__PURE__ */ jsx24(Pill2, { label: "Change Image", onClick: onChangeImage }),
21242
- /* @__PURE__ */ jsx24(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
20935
+ /* @__PURE__ */ jsxs14("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
20936
+ /* @__PURE__ */ jsx23(Pill3, { label: "Change Image", onClick: onChangeImage }),
20937
+ /* @__PURE__ */ jsx23(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
21243
20938
  ] }),
21244
- error && /* @__PURE__ */ jsx24("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20939
+ error && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
21245
20940
  ]
21246
20941
  }
21247
20942
  );
@@ -21381,8 +21076,8 @@ function AiFadeCarouselOverlay({
21381
21076
  const activeItemRect = useLiveItemRect2(active);
21382
21077
  const TOOLBAR_APPROX_H = 90;
21383
21078
  const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
21384
- return /* @__PURE__ */ jsxs15(Fragment10, { children: [
21385
- hoverHandleRect && hover && /* @__PURE__ */ jsx24(
21079
+ return /* @__PURE__ */ jsxs14(Fragment10, { children: [
21080
+ hoverHandleRect && hover && /* @__PURE__ */ jsx23(
21386
21081
  "button",
21387
21082
  {
21388
21083
  type: "button",
@@ -21411,10 +21106,10 @@ function AiFadeCarouselOverlay({
21411
21106
  fontSize: 14,
21412
21107
  fontWeight: 700
21413
21108
  },
21414
- children: /* @__PURE__ */ jsx24(Star4, { size: 14, style: { pointerEvents: "none" } })
21109
+ children: /* @__PURE__ */ jsx23(Star4, { size: 14, style: { pointerEvents: "none" } })
21415
21110
  }
21416
21111
  ),
21417
- swapping && /* @__PURE__ */ jsx24(
21112
+ swapping && /* @__PURE__ */ jsx23(
21418
21113
  "div",
21419
21114
  {
21420
21115
  ref: skeletonRef,
@@ -21432,15 +21127,15 @@ function AiFadeCarouselOverlay({
21432
21127
  zIndex: 2147483646,
21433
21128
  pointerEvents: "none"
21434
21129
  },
21435
- children: /* @__PURE__ */ jsx24("style", { children: MEDIA_SKELETON_CSS })
21130
+ children: /* @__PURE__ */ jsx23("style", { children: MEDIA_SKELETON_CSS })
21436
21131
  }
21437
21132
  ),
21438
- activeItemRect && active && activeEntry && /* @__PURE__ */ jsx24(
21133
+ activeItemRect && active && activeEntry && /* @__PURE__ */ jsx23(
21439
21134
  ItemInteractionLayer,
21440
21135
  {
21441
21136
  rect: activeItemRect,
21442
21137
  state: toolbarState,
21443
- toolbar: /* @__PURE__ */ jsx24(
21138
+ toolbar: /* @__PURE__ */ jsx23(
21444
21139
  CarouselSlideToolbar,
21445
21140
  {
21446
21141
  pending,
@@ -21631,11 +21326,118 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
21631
21326
  // src/ui/link-modal/LinkPopover.tsx
21632
21327
  import { useEffect as useEffect16 } from "react";
21633
21328
 
21329
+ // src/ui/dialog.tsx
21330
+ import * as React9 from "react";
21331
+ import { Dialog as DialogPrimitive } from "radix-ui";
21332
+ import { X as X2 } from "lucide-react";
21333
+ import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
21334
+ function Dialog2({
21335
+ ...props
21336
+ }) {
21337
+ return /* @__PURE__ */ jsx24(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
21338
+ }
21339
+ function DialogPortal({
21340
+ ...props
21341
+ }) {
21342
+ return /* @__PURE__ */ jsx24(DialogPrimitive.Portal, { ...props });
21343
+ }
21344
+ function DialogOverlay({
21345
+ className,
21346
+ ...props
21347
+ }) {
21348
+ return /* @__PURE__ */ jsx24(
21349
+ DialogPrimitive.Overlay,
21350
+ {
21351
+ "data-slot": "dialog-overlay",
21352
+ "data-ohw-link-modal-root": "",
21353
+ className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
21354
+ ...props
21355
+ }
21356
+ );
21357
+ }
21358
+ var DialogContent = React9.forwardRef(
21359
+ ({ className, children, showCloseButton = true, container, ...props }, ref) => {
21360
+ const positionMode = container ? "absolute" : "fixed";
21361
+ return /* @__PURE__ */ jsxs15(DialogPortal, { container: container ?? void 0, children: [
21362
+ /* @__PURE__ */ jsx24(DialogOverlay, { className: cn(positionMode, "inset-0") }),
21363
+ /* @__PURE__ */ jsxs15(
21364
+ DialogPrimitive.Content,
21365
+ {
21366
+ ref,
21367
+ "data-slot": "dialog-content",
21368
+ className: cn(
21369
+ positionMode,
21370
+ "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",
21371
+ "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
21372
+ container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
21373
+ className
21374
+ ),
21375
+ onMouseDown: (e) => e.stopPropagation(),
21376
+ ...props,
21377
+ children: [
21378
+ children,
21379
+ showCloseButton ? /* @__PURE__ */ jsx24(
21380
+ DialogPrimitive.Close,
21381
+ {
21382
+ type: "button",
21383
+ className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
21384
+ "aria-label": "Close",
21385
+ children: /* @__PURE__ */ jsx24(X2, { size: 16, "aria-hidden": true })
21386
+ }
21387
+ ) : null
21388
+ ]
21389
+ }
21390
+ )
21391
+ ] });
21392
+ }
21393
+ );
21394
+ DialogContent.displayName = DialogPrimitive.Content.displayName;
21395
+ function DialogHeader({
21396
+ className,
21397
+ ...props
21398
+ }) {
21399
+ return /* @__PURE__ */ jsx24("div", { className: cn("flex flex-col gap-1.5", className), ...props });
21400
+ }
21401
+ function DialogFooter({
21402
+ className,
21403
+ ...props
21404
+ }) {
21405
+ return /* @__PURE__ */ jsx24(
21406
+ "div",
21407
+ {
21408
+ className: cn("flex items-center justify-end gap-2", className),
21409
+ ...props
21410
+ }
21411
+ );
21412
+ }
21413
+ var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
21414
+ DialogPrimitive.Title,
21415
+ {
21416
+ ref,
21417
+ className: cn(
21418
+ "text-lg font-semibold leading-none tracking-tight text-card-foreground",
21419
+ className
21420
+ ),
21421
+ ...props
21422
+ }
21423
+ ));
21424
+ DialogTitle.displayName = DialogPrimitive.Title.displayName;
21425
+ var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
21426
+ DialogPrimitive.Description,
21427
+ {
21428
+ ref,
21429
+ className: cn("text-sm text-muted-foreground", className),
21430
+ ...props
21431
+ }
21432
+ ));
21433
+ DialogDescription.displayName = DialogPrimitive.Description.displayName;
21434
+ var DialogClose = DialogPrimitive.Close;
21435
+
21634
21436
  // src/ui/link-modal/LinkEditorPanel.tsx
21635
21437
  import { Info, X as X4 } from "lucide-react";
21636
21438
 
21637
21439
  // src/ui/link-modal/DestinationBreadcrumb.tsx
21638
- import { ArrowRight as ArrowRight3, File, GalleryVertical } from "lucide-react";
21440
+ import { ArrowRight as ArrowRight2, File, GalleryVertical } from "lucide-react";
21639
21441
  import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
21640
21442
  function DestinationBreadcrumb({
21641
21443
  pageTitle,
@@ -21649,7 +21451,7 @@ function DestinationBreadcrumb({
21649
21451
  /* @__PURE__ */ jsx25("span", { className: "text-sm font-medium leading-none text-foreground!", children: pageTitle })
21650
21452
  ] }),
21651
21453
  /* @__PURE__ */ jsx25(
21652
- ArrowRight3,
21454
+ ArrowRight2,
21653
21455
  {
21654
21456
  size: 16,
21655
21457
  className: "shrink-0 text-muted-foreground",
@@ -21761,7 +21563,7 @@ function Label({ className, ...props }) {
21761
21563
  }
21762
21564
 
21763
21565
  // src/ui/link-modal/UrlOrPageInput.tsx
21764
- import { ChevronDown as ChevronDown5, File as File2, X as X3 } from "lucide-react";
21566
+ import { ChevronDown as ChevronDown4, File as File2, X as X3 } from "lucide-react";
21765
21567
  import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
21766
21568
  function FieldChevron({
21767
21569
  onClick
@@ -21774,7 +21576,7 @@ function FieldChevron({
21774
21576
  onClick,
21775
21577
  "aria-label": "Open page list",
21776
21578
  tabIndex: -1,
21777
- children: /* @__PURE__ */ jsx29(ChevronDown5, { size: 16 })
21579
+ children: /* @__PURE__ */ jsx29(ChevronDown4, { size: 16 })
21778
21580
  }
21779
21581
  );
21780
21582
  }
@@ -22004,7 +21806,7 @@ function LinkEditorPanel({ state, onClose }) {
22004
21806
  // src/ui/link-modal/SectionPickerOverlay.tsx
22005
21807
  import { useCallback as useCallback7, useEffect as useEffect14, useMemo as useMemo2, useRef as useRef10, useState as useState13 } from "react";
22006
21808
  import { createPortal as createPortal2 } from "react-dom";
22007
- import { ArrowLeft as ArrowLeft3, Check as Check4 } from "lucide-react";
21809
+ import { ArrowLeft as ArrowLeft2, Check as Check3 } from "lucide-react";
22008
21810
  import { usePathname as usePathname2, useRouter as useRouter2 } from "next/navigation";
22009
21811
 
22010
21812
  // src/lib/parent-scroll.ts
@@ -22281,7 +22083,7 @@ function SectionPickerOverlay({
22281
22083
  className: "h-8 min-w-0 gap-1 border-border bg-background px-2 py-1.5 shadow-sm hover:bg-muted cursor-pointer",
22282
22084
  onClick: onBack,
22283
22085
  children: [
22284
- /* @__PURE__ */ jsx31(ArrowLeft3, { className: "size-4 shrink-0", "aria-hidden": true }),
22086
+ /* @__PURE__ */ jsx31(ArrowLeft2, { className: "size-4 shrink-0", "aria-hidden": true }),
22285
22087
  "Back"
22286
22088
  ]
22287
22089
  }
@@ -22350,7 +22152,7 @@ function SectionPickerOverlay({
22350
22152
  className: "absolute right-3 top-3 flex size-8 items-center justify-center rounded-full text-white",
22351
22153
  style: { backgroundColor: "var(--ohw-primary, #0885fe)" },
22352
22154
  "aria-hidden": true,
22353
- children: /* @__PURE__ */ jsx31(Check4, { className: "size-5" })
22155
+ children: /* @__PURE__ */ jsx31(Check3, { className: "size-5" })
22354
22156
  }
22355
22157
  ) : null
22356
22158
  ]
@@ -22734,7 +22536,6 @@ function shouldUseDevFixtures() {
22734
22536
  function getLogoElement(el) {
22735
22537
  const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
22736
22538
  if (marked) return marked;
22737
- if (el.closest('[data-ohw-editable="icon"]')) return null;
22738
22539
  const root = el.closest("nav, [data-ohw-nav-root], footer");
22739
22540
  if (!root) return null;
22740
22541
  const anchor = el.closest("a");
@@ -22804,7 +22605,7 @@ function addFooterColumnWithPersist({
22804
22605
  import {
22805
22606
  useCallback as useCallback9,
22806
22607
  useEffect as useEffect17,
22807
- useLayoutEffect as useLayoutEffect6,
22608
+ useLayoutEffect as useLayoutEffect5,
22808
22609
  useRef as useRef11,
22809
22610
  useState as useState15
22810
22611
  } from "react";
@@ -22901,7 +22702,7 @@ function FloatingPanel({
22901
22702
  return () => window.removeEventListener("message", onParentScroll);
22902
22703
  }, [open]);
22903
22704
  const positionRef = useRef11(position);
22904
- useLayoutEffect6(() => {
22705
+ useLayoutEffect5(() => {
22905
22706
  if (!open) {
22906
22707
  positionRef.current = position;
22907
22708
  return;
@@ -22911,7 +22712,7 @@ function FloatingPanel({
22911
22712
  }
22912
22713
  positionRef.current = position;
22913
22714
  }, [open, position, liveScroll, parentScroll]);
22914
- useLayoutEffect6(() => {
22715
+ useLayoutEffect5(() => {
22915
22716
  if (!open || !panelRef.current) return;
22916
22717
  const el = panelRef.current;
22917
22718
  const header = el.querySelector("[data-ohw-floating-panel-header]");
@@ -23120,7 +22921,7 @@ function SocialsDisplayPanel({ display, onChange, className }) {
23120
22921
  }
23121
22922
 
23122
22923
  // src/ui/button-style-panel.tsx
23123
- import { Check as Check5 } from "lucide-react";
22924
+ import { Check as Check4 } from "lucide-react";
23124
22925
  import { jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
23125
22926
  var SIZE_LABEL = { s: "S", m: "M", l: "L" };
23126
22927
  function ButtonStylePanel({
@@ -23191,7 +22992,7 @@ function ButtonStylePanel({
23191
22992
  {
23192
22993
  className: "absolute right-0.5 top-0.5 flex size-5 items-center justify-center rounded-full bg-primary text-primary-foreground",
23193
22994
  "aria-hidden": true,
23194
- children: /* @__PURE__ */ jsx35(Check5, { className: "size-3", strokeWidth: 3 })
22995
+ children: /* @__PURE__ */ jsx35(Check4, { className: "size-3", strokeWidth: 3 })
23195
22996
  }
23196
22997
  ) : null
23197
22998
  ]
@@ -24216,7 +24017,7 @@ function useSectionDrag({
24216
24017
  }
24217
24018
 
24218
24019
  // src/ui/footer-container-chrome.tsx
24219
- import { Plus as Plus4 } from "lucide-react";
24020
+ import { Plus as Plus3 } from "lucide-react";
24220
24021
  import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
24221
24022
  function FooterContainerChrome({
24222
24023
  rect,
@@ -24257,7 +24058,7 @@ function FooterContainerChrome({
24257
24058
  if (addDisabled) return;
24258
24059
  onAdd();
24259
24060
  },
24260
- children: /* @__PURE__ */ jsx36(Plus4, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24061
+ children: /* @__PURE__ */ jsx36(Plus3, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24261
24062
  }
24262
24063
  ) }),
24263
24064
  /* @__PURE__ */ jsx36(TooltipContent, { side: "bottom", sideOffset: 9, children: addDisabled ? "Maximum columns reached" : "Add item" })
@@ -24664,7 +24465,7 @@ function retargetPageLinks(change, deps) {
24664
24465
  }
24665
24466
 
24666
24467
  // src/ui/navbar-container-chrome.tsx
24667
- import { Plus as Plus5 } from "lucide-react";
24468
+ import { Plus as Plus4 } from "lucide-react";
24668
24469
  import { jsx as jsx37 } from "react/jsx-runtime";
24669
24470
  function NavbarContainerChrome({
24670
24471
  rect,
@@ -24700,7 +24501,7 @@ function NavbarContainerChrome({
24700
24501
  e.stopPropagation();
24701
24502
  onAdd();
24702
24503
  },
24703
- children: /* @__PURE__ */ jsx37(Plus5, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24504
+ children: /* @__PURE__ */ jsx37(Plus4, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24704
24505
  }
24705
24506
  )
24706
24507
  }
@@ -24772,7 +24573,7 @@ function Badge({ className, variant, ...props }) {
24772
24573
  }
24773
24574
 
24774
24575
  // src/OhhwellsBridge.tsx
24775
- import { Brush as Brush2, Link as Link2, Plus as Plus6, Settings } from "lucide-react";
24576
+ import { Brush as Brush2, Link as Link2, Plus as Plus5, Settings } from "lucide-react";
24776
24577
  import { Fragment as Fragment13, jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
24777
24578
  var PRIMARY7 = "#0885FE";
24778
24579
  var IMAGE_FADE_MS = 300;
@@ -25550,7 +25351,7 @@ function getNavigationSelectionParent(el) {
25550
25351
  if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
25551
25352
  return resolveFooterLinksContainerFrom(el);
25552
25353
  }
25553
- 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)) {
25354
+ if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
25554
25355
  return getNavigationRoot(el);
25555
25356
  }
25556
25357
  return null;
@@ -25772,6 +25573,7 @@ var ICONS = {
25772
25573
  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"/>',
25773
25574
  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"/>'
25774
25575
  };
25576
+ var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
25775
25577
  var SELECTION_CHROME_GAP2 = 4;
25776
25578
  var TOOLBAR_STROKE_GAP2 = 4;
25777
25579
  var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
@@ -25869,7 +25671,7 @@ function applyVisibleViewport(el, parentScroll) {
25869
25671
  el.style.top = `${top}px`;
25870
25672
  el.style.height = `${height}px`;
25871
25673
  }
25872
- var TOOLBAR_EDGE_MARGIN4 = 4;
25674
+ var TOOLBAR_EDGE_MARGIN3 = 4;
25873
25675
  function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
25874
25676
  const isAbove = transform.includes("translateY(-100%)");
25875
25677
  let visualTop = isAbove ? top - approxH : top;
@@ -25896,8 +25698,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
25896
25698
  function clampToolbarLeft(centerX, toolbarWidth) {
25897
25699
  const half = toolbarWidth / 2;
25898
25700
  return Math.max(
25899
- TOOLBAR_EDGE_MARGIN4 + half,
25900
- Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
25701
+ TOOLBAR_EDGE_MARGIN3 + half,
25702
+ Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half)
25901
25703
  );
25902
25704
  }
25903
25705
  function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
@@ -26298,7 +26100,7 @@ function OhhwellsBridge() {
26298
26100
  }, []);
26299
26101
  const subdomainFromQuery = searchParams.get("subdomain");
26300
26102
  const [subdomain, setSubdomain] = useState18(() => resolveSubdomain(subdomainFromQuery));
26301
- useLayoutEffect7(() => {
26103
+ useLayoutEffect6(() => {
26302
26104
  const next = resolveSubdomain(subdomainFromQuery);
26303
26105
  if (next !== subdomain) setSubdomain(next);
26304
26106
  if (next) return;
@@ -26780,6 +26582,21 @@ function OhhwellsBridge() {
26780
26582
  const [isItemDragging, setIsItemDragging] = useState18(false);
26781
26583
  const [isFooterFrameSelection, setIsFooterFrameSelection] = useState18(false);
26782
26584
  isFooterFrameSelectionRef.current = isFooterFrameSelection;
26585
+ const [floatingPanel, setFloatingPanel] = useState18(null);
26586
+ const floatingPanelOpenRef = useRef14(false);
26587
+ floatingPanelOpenRef.current = floatingPanel !== null;
26588
+ const floatingPanelRef = useRef14(null);
26589
+ floatingPanelRef.current = floatingPanel;
26590
+ const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
26591
+ const buttonCollectionDragRef = useRef14(null);
26592
+ const buttonDropInsertIndexRef = useRef14(null);
26593
+ const [buttonDropSlots, setButtonDropSlots] = useState18([]);
26594
+ const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
26595
+ const buttonPointerDragRef = useRef14(null);
26596
+ const [buttonStyleTick, setButtonStyleTick] = useState18(0);
26597
+ const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
26598
+ const [editorViewport, setEditorViewport] = useState18("desktop");
26599
+ const [parentScrollSnap, setParentScrollSnap] = useState18(null);
26783
26600
  const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = useState18(null);
26784
26601
  const [footerHeadingVisible, setFooterHeadingVisible] = useState18(null);
26785
26602
  const footerDragRef = useRef14(null);
@@ -26806,21 +26623,6 @@ function OhhwellsBridge() {
26806
26623
  const stylesRef = useRef14("");
26807
26624
  const appliedDrawerRef = useRef14(null);
26808
26625
  const pendingDeleteUndoRef = useRef14(null);
26809
- const [floatingPanel, setFloatingPanel] = useState18(null);
26810
- const floatingPanelOpenRef = useRef14(false);
26811
- const floatingPanelRef = useRef14(null);
26812
- floatingPanelRef.current = floatingPanel;
26813
- const setFloatingPanelRef = useRef14(setFloatingPanel);
26814
- const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
26815
- const buttonCollectionDragRef = useRef14(null);
26816
- const buttonDropInsertIndexRef = useRef14(null);
26817
- const [buttonDropSlots, setButtonDropSlots] = useState18([]);
26818
- const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
26819
- const buttonPointerDragRef = useRef14(null);
26820
- const [buttonStyleTick, setButtonStyleTick] = useState18(0);
26821
- const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
26822
- const [editorViewport, setEditorViewport] = useState18("desktop");
26823
- const [parentScrollSnap, setParentScrollSnap] = useState18(null);
26824
26626
  const [sitePages, setSitePages] = useState18([]);
26825
26627
  const collectionItemsRef = useRef14(/* @__PURE__ */ new Map());
26826
26628
  const [sectionsByPath, setSectionsByPath] = useState18({});
@@ -26830,18 +26632,7 @@ function OhhwellsBridge() {
26830
26632
  const linkPopoverOpenRef = useRef14(false);
26831
26633
  const linkPopoverGraceUntilRef = useRef14(0);
26832
26634
  setLinkPopoverRef.current = setLinkPopover;
26833
- setFloatingPanelRef.current = setFloatingPanel;
26834
26635
  linkPopoverSessionRef.current = linkPopover;
26835
- floatingPanelOpenRef.current = Boolean(floatingPanel);
26836
- useEffect21(() => {
26837
- const syncViewport = () => {
26838
- const next = window.innerWidth <= 480 ? "mobile" : "desktop";
26839
- setEditorViewport((prev) => prev === next ? prev : next);
26840
- };
26841
- syncViewport();
26842
- window.addEventListener("resize", syncViewport);
26843
- return () => window.removeEventListener("resize", syncViewport);
26844
- }, []);
26845
26636
  useEffect21(() => {
26846
26637
  setSectionOrderPersistHandler((entries) => {
26847
26638
  const currentPath = window.location.pathname;
@@ -28548,7 +28339,7 @@ function OhhwellsBridge() {
28548
28339
  isFooterFrameSelection,
28549
28340
  postToParent2
28550
28341
  ]);
28551
- useLayoutEffect7(() => {
28342
+ useLayoutEffect6(() => {
28552
28343
  if (!subdomain || isEditMode) {
28553
28344
  setFetchState("done");
28554
28345
  return;
@@ -28575,7 +28366,6 @@ function OhhwellsBridge() {
28575
28366
  applyAiFooterFromContent(content);
28576
28367
  if (typeof content[STYLE_STORE_KEY] === "string") {
28577
28368
  stylesRef.current = content[STYLE_STORE_KEY];
28578
- document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28579
28369
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28580
28370
  }
28581
28371
  applyBrandChrome(content);
@@ -28586,16 +28376,15 @@ function OhhwellsBridge() {
28586
28376
  if (key === "__ohw_sections") continue;
28587
28377
  if (key === AI_SECTIONS_KEY) continue;
28588
28378
  if (key === AI_FOOTER_KEY) continue;
28589
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28590
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28591
28379
  if (key === BRAND_KIT_KEY) continue;
28592
28380
  if (key === STYLE_STORE_KEY) continue;
28593
28381
  if (BRAND_CHROME_KEYS.has(key)) continue;
28382
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
28594
28383
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
28384
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28595
28385
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28596
28386
  continue;
28597
28387
  }
28598
- if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28599
28388
  if (applyVideoSettingNode(key, val)) continue;
28600
28389
  if (applyCarouselNode(key, val)) continue;
28601
28390
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28635,7 +28424,6 @@ function OhhwellsBridge() {
28635
28424
  });
28636
28425
  applyLinkByKey(key, val);
28637
28426
  }
28638
- applySectionEmbeds(content);
28639
28427
  applyLogoFromContent(content);
28640
28428
  applyLogoSizes(content);
28641
28429
  reconcileNavbarItemsFromContent(content);
@@ -28824,22 +28612,20 @@ function OhhwellsBridge() {
28824
28612
  }
28825
28613
  applyAiFooterFromContent(content);
28826
28614
  if (typeof content[STYLE_STORE_KEY] === "string") {
28827
- document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28828
28615
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28829
28616
  }
28830
28617
  for (const [key, val] of Object.entries(content)) {
28831
28618
  if (key === "__ohw_sections") continue;
28832
28619
  if (key === AI_SECTIONS_KEY) continue;
28833
28620
  if (key === AI_FOOTER_KEY) continue;
28834
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28835
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28836
28621
  if (key === BRAND_KIT_KEY) continue;
28837
28622
  if (key === STYLE_STORE_KEY) continue;
28838
28623
  if (BRAND_CHROME_KEYS.has(key)) continue;
28624
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
28625
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28839
28626
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28840
28627
  continue;
28841
28628
  }
28842
- if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28843
28629
  if (applyVideoSettingNode(key, val)) continue;
28844
28630
  if (applyCarouselNode(key, val)) continue;
28845
28631
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28864,7 +28650,6 @@ function OhhwellsBridge() {
28864
28650
  });
28865
28651
  applyLinkByKey(key, val);
28866
28652
  }
28867
- applySectionEmbeds(content);
28868
28653
  applyLogoFromContent(content);
28869
28654
  reconcileNavbarItemsFromContent(content);
28870
28655
  reconcileFooterOrderFromContent(content);
@@ -28920,7 +28705,7 @@ function OhhwellsBridge() {
28920
28705
  if (debounceTimer) clearTimeout(debounceTimer);
28921
28706
  };
28922
28707
  }, [subdomain, isEditMode, pathname]);
28923
- useLayoutEffect7(() => {
28708
+ useLayoutEffect6(() => {
28924
28709
  const el = document.getElementById("ohw-loader");
28925
28710
  if (!el) return;
28926
28711
  const visible = Boolean(subdomain) && fetchState !== "done";
@@ -29104,11 +28889,26 @@ function OhhwellsBridge() {
29104
28889
  const t2 = setTimeout(measure, 500);
29105
28890
  const ro = new ResizeObserver(schedule);
29106
28891
  ro.observe(document.body);
28892
+ let lastWidth = window.innerWidth;
28893
+ let resizeTimers = [];
28894
+ const clearResizeTimers = () => {
28895
+ resizeTimers.forEach(clearTimeout);
28896
+ resizeTimers = [];
28897
+ };
28898
+ const handleResize = () => {
28899
+ if (window.innerWidth === lastWidth) return;
28900
+ lastWidth = window.innerWidth;
28901
+ clearResizeTimers();
28902
+ resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
28903
+ };
28904
+ window.addEventListener("resize", handleResize);
29107
28905
  return () => {
29108
28906
  clearTimeout(t1);
29109
28907
  clearTimeout(t2);
29110
28908
  if (raf != null) cancelAnimationFrame(raf);
29111
28909
  ro.disconnect();
28910
+ clearResizeTimers();
28911
+ window.removeEventListener("resize", handleResize);
29112
28912
  };
29113
28913
  }, [pathname, isEditMode, postToParent2]);
29114
28914
  useEffect21(() => {
@@ -29405,13 +29205,6 @@ function OhhwellsBridge() {
29405
29205
  if (target.closest("[data-ohw-state-toggle]")) return;
29406
29206
  if (target.closest("[data-ohw-max-badge]")) return;
29407
29207
  if (isInsideLinkEditor(target)) return;
29408
- if (isInsideFloatingPanel(target)) return;
29409
- if (target.closest("[data-ohw-form-toolbar]")) return;
29410
- if (target.closest(
29411
- '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
29412
- )) {
29413
- return;
29414
- }
29415
29208
  if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
29416
29209
  clearMediaSelectionRef.current();
29417
29210
  }
@@ -29435,6 +29228,8 @@ function OhhwellsBridge() {
29435
29228
  return;
29436
29229
  }
29437
29230
  }
29231
+ if (isInsideFloatingPanel(target)) return;
29232
+ if (target.closest("[data-ohw-form-toolbar]")) return;
29438
29233
  const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
29439
29234
  if (collectionItem) {
29440
29235
  e.preventDefault();
@@ -29446,6 +29241,11 @@ function OhhwellsBridge() {
29446
29241
  });
29447
29242
  return;
29448
29243
  }
29244
+ if (target.closest(
29245
+ '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
29246
+ )) {
29247
+ return;
29248
+ }
29449
29249
  {
29450
29250
  const formEl = getFormElement(target);
29451
29251
  const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
@@ -29599,13 +29399,9 @@ function OhhwellsBridge() {
29599
29399
  if (isIconEditable(editable) && !getSocialItem(editable)) {
29600
29400
  e.preventDefault();
29601
29401
  e.stopPropagation();
29402
+ selectIconElementRef.current(editable);
29602
29403
  const aiIcon = editable.hasAttribute("data-ai-icon");
29603
29404
  const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
29604
- if (aiIcon) {
29605
- aiSectionApiRef.current?.selectFromElement(editable);
29606
- } else {
29607
- selectIconElementRef.current(editable);
29608
- }
29609
29405
  postToParentRef.current({
29610
29406
  type: "ow:icon-pick",
29611
29407
  key: editable.dataset.ohwKey ?? "",
@@ -29833,9 +29629,6 @@ function OhhwellsBridge() {
29833
29629
  setHoveredItemRect(null);
29834
29630
  hoveredNavContainerRef.current = null;
29835
29631
  setHoveredNavContainerRect(null);
29836
- siblingHintElRef.current = null;
29837
- setSiblingHintRect(null);
29838
- setSiblingHintRects([]);
29839
29632
  return;
29840
29633
  }
29841
29634
  {
@@ -29956,6 +29749,7 @@ function OhhwellsBridge() {
29956
29749
  hoveredNavContainerRef.current = null;
29957
29750
  setHoveredNavContainerRect(null);
29958
29751
  hoveredItemElRef.current = editable;
29752
+ setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
29959
29753
  }
29960
29754
  }
29961
29755
  }
@@ -30665,11 +30459,7 @@ function OhhwellsBridge() {
30665
30459
  };
30666
30460
  const handleMouseMove = (e) => {
30667
30461
  const { clientX, clientY } = e;
30668
- if (pointOwnedByFloatingPanel(clientX, clientY)) {
30669
- dismissImageHover();
30670
- clearImageHover();
30671
- return;
30672
- }
30462
+ if (pointOwnedByFloatingPanel(clientX, clientY)) return;
30673
30463
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
30674
30464
  document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
30675
30465
  formHoverElRef.current = null;
@@ -30698,12 +30488,7 @@ function OhhwellsBridge() {
30698
30488
  setHoveredItemRect(null);
30699
30489
  hoveredNavContainerRef.current = null;
30700
30490
  setHoveredNavContainerRect(null);
30701
- siblingHintElRef.current = null;
30702
- setSiblingHintRect(null);
30703
- setSiblingHintRects([]);
30704
30491
  dismissImageHover();
30705
- clearImageHover();
30706
- setSectionGap(null);
30707
30492
  return;
30708
30493
  }
30709
30494
  if (probeSocialsRowAt(clientX, clientY)) return;
@@ -30715,11 +30500,7 @@ function OhhwellsBridge() {
30715
30500
  if (e.data?.type !== "ow:pointer-sync") return;
30716
30501
  const { clientX, clientY } = e.data;
30717
30502
  if (typeof clientX !== "number" || typeof clientY !== "number") return;
30718
- if (pointOwnedByFloatingPanel(clientX, clientY)) {
30719
- dismissImageHover();
30720
- clearImageHover();
30721
- return;
30722
- }
30503
+ if (pointOwnedByFloatingPanel(clientX, clientY)) return;
30723
30504
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
30724
30505
  if (probeSocialsRowAt(clientX, clientY)) return;
30725
30506
  probeSectionGapAt(clientX, clientY);
@@ -31099,7 +30880,6 @@ function OhhwellsBridge() {
31099
30880
  applyAiFooterFromContent(content);
31100
30881
  if (typeof content[STYLE_STORE_KEY] === "string") {
31101
30882
  stylesRef.current = content[STYLE_STORE_KEY];
31102
- document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
31103
30883
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
31104
30884
  }
31105
30885
  applyBrandChrome(content);
@@ -31114,16 +30894,15 @@ function OhhwellsBridge() {
31114
30894
  }
31115
30895
  if (key === AI_SECTIONS_KEY) continue;
31116
30896
  if (key === AI_FOOTER_KEY) continue;
31117
- if (key === LOGO_PLACEHOLDER_KEY) continue;
31118
- if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
31119
30897
  if (key === BRAND_KIT_KEY) continue;
31120
30898
  if (key === STYLE_STORE_KEY) continue;
31121
30899
  if (BRAND_CHROME_KEYS.has(key)) continue;
30900
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
31122
30901
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
30902
+ if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
31123
30903
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
31124
30904
  continue;
31125
30905
  }
31126
- if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
31127
30906
  if (applyVideoSettingNode(key, val)) continue;
31128
30907
  if (applyCarouselNode(key, val)) continue;
31129
30908
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -31149,7 +30928,6 @@ function OhhwellsBridge() {
31149
30928
  });
31150
30929
  applyLinkByKey(key, val);
31151
30930
  }
31152
- applySectionEmbeds(content);
31153
30931
  applyLogoFromContent(content);
31154
30932
  applyLogoSizes(content);
31155
30933
  document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
@@ -31782,12 +31560,6 @@ function OhhwellsBridge() {
31782
31560
  closeLinkPopoverRef.current();
31783
31561
  return;
31784
31562
  }
31785
- if (floatingPanelOpenRef.current) {
31786
- setFloatingPanelRef.current(null);
31787
- deselectRef.current();
31788
- deactivateRef.current();
31789
- return;
31790
- }
31791
31563
  deselectRef.current();
31792
31564
  deactivateRef.current();
31793
31565
  clearMediaSelectionRef.current();
@@ -32624,10 +32396,10 @@ function OhhwellsBridge() {
32624
32396
  window.removeEventListener("message", handleDuplicateSection);
32625
32397
  window.removeEventListener("message", handleDeactivate);
32626
32398
  window.removeEventListener("message", handleSelectNav);
32399
+ document.documentElement.removeAttribute("data-ohw-panel-dragging");
32627
32400
  window.removeEventListener("message", handleToastAction);
32628
32401
  window.removeEventListener("message", handleFormCount);
32629
32402
  window.removeEventListener("message", handleUiEscape);
32630
- document.documentElement.removeAttribute("data-ohw-panel-dragging");
32631
32403
  autoSaveTimers.current.forEach(clearTimeout);
32632
32404
  autoSaveTimers.current.clear();
32633
32405
  if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
@@ -32921,7 +32693,7 @@ function OhhwellsBridge() {
32921
32693
  postToParent2({
32922
32694
  type: "ow:ready",
32923
32695
  version: "1",
32924
- bridgeVersion: "0.1.167-next.444",
32696
+ bridgeVersion: "0.1.168",
32925
32697
  path: pathname,
32926
32698
  nodes: collectEditableNodes(editContentRef.current),
32927
32699
  sections
@@ -33656,7 +33428,7 @@ function OhhwellsBridge() {
33656
33428
  className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/80",
33657
33429
  onClick: () => setFieldTypePickerOpen((open) => !open),
33658
33430
  "data-ohw-add-field": "",
33659
- children: /* @__PURE__ */ jsx40(Plus6, { size: 15, "aria-hidden": true })
33431
+ children: /* @__PURE__ */ jsx40(Plus5, { size: 15, "aria-hidden": true })
33660
33432
  }
33661
33433
  ),
33662
33434
  /* @__PURE__ */ jsx40("div", { className: "mx-0.5 h-5 w-px bg-border" }),