@ohhwells/bridge 0.1.168-next.447 → 0.1.169

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.168-next.447";
17493
+ return "0.1.169";
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.168-next.447" : "";
17507
+ const v = true ? "0.1.169" : "";
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
  )
@@ -19138,24 +18950,8 @@ function AiSectionOverlay({
19138
18950
  }
19139
18951
 
19140
18952
  // src/ui/ai-section/AiMediaStripOverlay.tsx
19141
- import { useCallback as useCallback3, useEffect as useEffect9, useLayoutEffect as useLayoutEffect4, useRef as useRef5, useState as useState8 } from "react";
19142
- import {
19143
- AlignCenter,
19144
- AlignLeft,
19145
- AlignRight,
19146
- ArrowLeft as ArrowLeft2,
19147
- ArrowRight as ArrowRight2,
19148
- Check as Check2,
19149
- ChevronDown as ChevronDown3,
19150
- Image as ImageIcon2,
19151
- ImageMinus,
19152
- ImagePlus,
19153
- Link as LinkIcon,
19154
- Minus,
19155
- Palette,
19156
- Plus as Plus2,
19157
- Star
19158
- } from "lucide-react";
18953
+ import { useCallback as useCallback3, useEffect as useEffect9, useRef as useRef5, useState as useState8 } from "react";
18954
+ import { Star } from "lucide-react";
19159
18955
 
19160
18956
  // src/lib/ai-media-strip-tree.ts
19161
18957
  var MEDIA_STRIP_ITEM_MIN = 1;
@@ -19269,6 +19065,14 @@ function setMediaStripItemAsset(tree, index, assetId) {
19269
19065
  return true;
19270
19066
  });
19271
19067
  }
19068
+ function setMediaStripItemAlt(tree, index, alt) {
19069
+ return withMediaStrip(tree, (block) => {
19070
+ const items = block.items;
19071
+ if (index < 0 || index >= items.length) return false;
19072
+ items[index] = { ...items[index], alt };
19073
+ return true;
19074
+ });
19075
+ }
19272
19076
  function setMediaStripItemLink(tree, index, link) {
19273
19077
  return withMediaStrip(tree, (block) => {
19274
19078
  const items = block.items;
@@ -19286,117 +19090,11 @@ function setMediaStripItemLink(tree, index, link) {
19286
19090
  });
19287
19091
  }
19288
19092
 
19289
- // src/ui/dialog.tsx
19290
- import * as React9 from "react";
19291
- import { Dialog as DialogPrimitive } from "radix-ui";
19292
- import { X as X2 } from "lucide-react";
19293
- import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
19294
- function Dialog2({
19295
- ...props
19296
- }) {
19297
- return /* @__PURE__ */ jsx20(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
19298
- }
19299
- function DialogPortal({
19300
- ...props
19301
- }) {
19302
- return /* @__PURE__ */ jsx20(DialogPrimitive.Portal, { ...props });
19303
- }
19304
- function DialogOverlay({
19305
- className,
19306
- ...props
19307
- }) {
19308
- return /* @__PURE__ */ jsx20(
19309
- DialogPrimitive.Overlay,
19310
- {
19311
- "data-slot": "dialog-overlay",
19312
- "data-ohw-link-modal-root": "",
19313
- className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
19314
- ...props
19315
- }
19316
- );
19317
- }
19318
- var DialogContent = React9.forwardRef(
19319
- ({ className, children, showCloseButton = true, container, ...props }, ref) => {
19320
- const positionMode = container ? "absolute" : "fixed";
19321
- return /* @__PURE__ */ jsxs11(DialogPortal, { container: container ?? void 0, children: [
19322
- /* @__PURE__ */ jsx20(DialogOverlay, { className: cn(positionMode, "inset-0") }),
19323
- /* @__PURE__ */ jsxs11(
19324
- DialogPrimitive.Content,
19325
- {
19326
- ref,
19327
- "data-slot": "dialog-content",
19328
- className: cn(
19329
- positionMode,
19330
- "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",
19331
- "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
19332
- container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
19333
- className
19334
- ),
19335
- onMouseDown: (e) => e.stopPropagation(),
19336
- ...props,
19337
- children: [
19338
- children,
19339
- showCloseButton ? /* @__PURE__ */ jsx20(
19340
- DialogPrimitive.Close,
19341
- {
19342
- type: "button",
19343
- className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
19344
- "aria-label": "Close",
19345
- children: /* @__PURE__ */ jsx20(X2, { size: 16, "aria-hidden": true })
19346
- }
19347
- ) : null
19348
- ]
19349
- }
19350
- )
19351
- ] });
19352
- }
19353
- );
19354
- DialogContent.displayName = DialogPrimitive.Content.displayName;
19355
- function DialogHeader({
19356
- className,
19357
- ...props
19358
- }) {
19359
- return /* @__PURE__ */ jsx20("div", { className: cn("flex flex-col gap-1.5", className), ...props });
19360
- }
19361
- function DialogFooter({
19362
- className,
19363
- ...props
19364
- }) {
19365
- return /* @__PURE__ */ jsx20(
19366
- "div",
19367
- {
19368
- className: cn("flex items-center justify-end gap-2", className),
19369
- ...props
19370
- }
19371
- );
19372
- }
19373
- var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
19374
- DialogPrimitive.Title,
19375
- {
19376
- ref,
19377
- className: cn(
19378
- "text-lg font-semibold leading-none tracking-tight text-card-foreground",
19379
- className
19380
- ),
19381
- ...props
19382
- }
19383
- ));
19384
- DialogTitle.displayName = DialogPrimitive.Title.displayName;
19385
- var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
19386
- DialogPrimitive.Description,
19387
- {
19388
- ref,
19389
- className: cn("text-sm text-muted-foreground", className),
19390
- ...props
19391
- }
19392
- ));
19393
- DialogDescription.displayName = DialogPrimitive.Description.displayName;
19394
- var DialogClose = DialogPrimitive.Close;
19395
-
19396
19093
  // src/ui/ai-section/AiMediaStripOverlay.tsx
19397
- import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
19398
- var PRIMARY3 = "var(--ohw-primary, #0885FE)";
19399
- 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]";
19094
+ import { Fragment as Fragment7, jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
19095
+ var PRIMARY3 = "#0885FE";
19096
+ var OHW_BLUE = `var(--ohw-primary, ${PRIMARY3})`;
19097
+ var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
19400
19098
  function findMediaStripItemElement(sectionId, index) {
19401
19099
  const sectionEl2 = findByInstanceId(sectionId);
19402
19100
  if (!sectionEl2) return null;
@@ -19406,35 +19104,14 @@ function findMediaStripItemElement(sectionId, index) {
19406
19104
  }
19407
19105
  return null;
19408
19106
  }
19409
- function itemRefFromTarget(target) {
19410
- if (!(target instanceof Element)) return null;
19411
- if (target.closest(CHROME_SELECTOR)) return null;
19412
- const itemEl = target.closest("[data-ohw-media-strip-item]");
19413
- if (!itemEl) return null;
19414
- const sectionEl2 = itemEl.closest("[data-ohw-section]");
19415
- const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
19416
- const sectionId = unit ? instanceIdOf(unit) || null : null;
19417
- const index = Number(itemEl.dataset.ohwMediaStripIndex);
19418
- if (!sectionId || Number.isNaN(index)) return null;
19419
- return { sectionId, index };
19420
- }
19421
- function sameRef(a, b) {
19422
- return a?.sectionId === b?.sectionId && a?.index === b?.index;
19423
- }
19424
- function rectOf(el) {
19107
+ function readRect2(ref) {
19108
+ const el = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19425
19109
  if (!el) return null;
19426
19110
  const r2 = el.getBoundingClientRect();
19427
19111
  if (r2.width <= 0 || r2.height <= 0) return null;
19428
19112
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
19429
19113
  }
19430
- function readRect2(ref) {
19431
- return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
19432
- }
19433
- function readStripRect(ref) {
19434
- const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19435
- return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
19436
- }
19437
- function useLiveItemRect(ref, strip = false) {
19114
+ function useLiveItemRect(ref) {
19438
19115
  const [rect, setRect] = useState8(null);
19439
19116
  useEffect9(() => {
19440
19117
  if (!ref) {
@@ -19442,7 +19119,7 @@ function useLiveItemRect(ref, strip = false) {
19442
19119
  return;
19443
19120
  }
19444
19121
  const update = () => {
19445
- const next = strip ? readStripRect(ref) : readRect2(ref);
19122
+ const next = readRect2(ref);
19446
19123
  setRect(
19447
19124
  (prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
19448
19125
  );
@@ -19457,49 +19134,9 @@ function useLiveItemRect(ref, strip = false) {
19457
19134
  window.removeEventListener("resize", update);
19458
19135
  clearInterval(interval);
19459
19136
  };
19460
- }, [ref?.sectionId, ref?.index, strip]);
19137
+ }, [ref?.sectionId, ref?.index]);
19461
19138
  return rect;
19462
19139
  }
19463
- var TOOLBAR_STRIP_GAP = 52;
19464
- var TOOLBAR_STRIP_GAP_MOBILE = 42;
19465
- var TOOLBAR_EDGE_MARGIN2 = 4;
19466
- function StripToolbarSlot({ stripRect, children }) {
19467
- const slotRef = useRef5(null);
19468
- const [shift, setShift] = useState8(0);
19469
- const centerX = stripRect.left + stripRect.width / 2;
19470
- useLayoutEffect4(() => {
19471
- const slot = slotRef.current;
19472
- if (!slot) return;
19473
- const clamp = () => {
19474
- const w = slot.offsetWidth;
19475
- if (w <= 0) return;
19476
- const half = w / 2;
19477
- const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
19478
- setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
19479
- };
19480
- clamp();
19481
- const ro = new ResizeObserver(clamp);
19482
- ro.observe(slot);
19483
- return () => ro.disconnect();
19484
- }, [centerX, children]);
19485
- const mobile = window.innerWidth <= 480;
19486
- return /* @__PURE__ */ jsx21(
19487
- "div",
19488
- {
19489
- ref: slotRef,
19490
- "data-ohw-bridge": "",
19491
- "data-ohw-item-interaction": "",
19492
- className: "pointer-events-auto fixed",
19493
- style: {
19494
- top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
19495
- left: centerX + shift,
19496
- transform: "translate(-50%, -100%)",
19497
- zIndex: 2147483645
19498
- },
19499
- children
19500
- }
19501
- );
19502
- }
19503
19140
  function requestValidateTree(postToParent2, tree) {
19504
19141
  return new Promise((resolve) => {
19505
19142
  const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
@@ -19536,72 +19173,116 @@ function requestAssetPick(postToParent2) {
19536
19173
  postToParent2({ type: "ow:asset-pick", id });
19537
19174
  });
19538
19175
  }
19539
- function ToolbarAction({
19176
+ function Pill({
19540
19177
  label,
19541
19178
  onClick,
19542
- disabled = false,
19543
- active = false,
19544
- children
19179
+ disabled,
19180
+ active
19545
19181
  }) {
19546
- const button = /* @__PURE__ */ jsx21(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
19547
- return /* @__PURE__ */ jsxs12(Tooltip, { children: [
19548
- /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: button }) : button }),
19549
- /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
19550
- ] });
19551
- }
19552
- function ToolbarSeparator() {
19553
- return /* @__PURE__ */ jsx21("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
19182
+ return /* @__PURE__ */ jsx20(
19183
+ "button",
19184
+ {
19185
+ type: "button",
19186
+ onClick,
19187
+ disabled,
19188
+ style: {
19189
+ height: 28,
19190
+ padding: "0 10px",
19191
+ display: "inline-flex",
19192
+ alignItems: "center",
19193
+ gap: 4,
19194
+ borderRadius: 999,
19195
+ border: "none",
19196
+ cursor: disabled ? "default" : "pointer",
19197
+ background: active ? OHW_BLUE_DARK : "#ffffff",
19198
+ color: active ? "#ffffff" : OHW_BLUE_DARK,
19199
+ opacity: disabled ? 0.4 : 1,
19200
+ fontSize: 12,
19201
+ lineHeight: "16px",
19202
+ fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19203
+ whiteSpace: "nowrap",
19204
+ flex: "0 0 auto"
19205
+ },
19206
+ children: label
19207
+ }
19208
+ );
19554
19209
  }
19555
- function OptionMenu({
19556
- label,
19557
- value,
19558
- options,
19559
- onChange
19560
- }) {
19561
- const current = options.find((o) => o.value === value) ?? options[0];
19562
- return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
19563
- /* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground", children: label }),
19564
- /* @__PURE__ */ jsxs12(DropdownMenu, { modal: false, children: [
19565
- /* @__PURE__ */ jsx21(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs12(
19566
- "button",
19567
- {
19568
- type: "button",
19569
- "aria-label": label,
19570
- 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",
19571
- children: [
19572
- /* @__PURE__ */ jsx21("span", { className: "flex-1 text-left", children: current.label }),
19573
- /* @__PURE__ */ jsx21(ChevronDown3, { size: 16, style: { pointerEvents: "none" } })
19574
- ]
19575
- }
19576
- ) }),
19577
- /* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
19578
- const selected = option.value === value;
19579
- return /* @__PURE__ */ jsxs12(
19580
- DropdownMenuItem,
19210
+ function AltInput({ value, onCommit }) {
19211
+ const [draft, setDraft] = useState8(value);
19212
+ useEffect9(() => setDraft(value), [value]);
19213
+ return /* @__PURE__ */ jsxs11(
19214
+ "div",
19215
+ {
19216
+ style: {
19217
+ display: "flex",
19218
+ alignItems: "center",
19219
+ gap: 6,
19220
+ height: 28,
19221
+ padding: "0 12px",
19222
+ borderRadius: 999,
19223
+ background: "#ffffff",
19224
+ width: "100%",
19225
+ maxWidth: 260,
19226
+ boxSizing: "border-box"
19227
+ },
19228
+ children: [
19229
+ /* @__PURE__ */ jsx20(
19230
+ "span",
19581
19231
  {
19582
- role: "menuitemradio",
19583
- "aria-checked": selected,
19584
- onSelect: () => onChange(option.value),
19585
- className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
19586
- children: [
19587
- /* @__PURE__ */ jsx21("span", { children: option.label }),
19588
- selected && /* @__PURE__ */ jsx21(Check2, { size: 16, className: "text-bridge-primary" })
19589
- ]
19590
- },
19591
- option.value
19592
- );
19593
- }) })
19594
- ] })
19595
- ] });
19232
+ style: {
19233
+ flex: "0 0 auto",
19234
+ color: OHW_BLUE_DARK,
19235
+ fontSize: 10,
19236
+ fontWeight: 700,
19237
+ textTransform: "uppercase",
19238
+ letterSpacing: 0.4
19239
+ },
19240
+ children: "Alt"
19241
+ }
19242
+ ),
19243
+ /* @__PURE__ */ jsx20(
19244
+ "input",
19245
+ {
19246
+ type: "text",
19247
+ value: draft,
19248
+ onChange: (e) => setDraft(e.target.value),
19249
+ onBlur: () => {
19250
+ if (draft !== value) onCommit(draft);
19251
+ },
19252
+ onKeyDown: (e) => {
19253
+ if (e.key === "Enter") e.currentTarget.blur();
19254
+ if (e.key === "Escape") {
19255
+ setDraft(value);
19256
+ e.currentTarget.blur();
19257
+ }
19258
+ },
19259
+ placeholder: "Describe this image",
19260
+ "aria-label": "Image alt text",
19261
+ style: {
19262
+ flex: 1,
19263
+ minWidth: 0,
19264
+ border: "none",
19265
+ outline: "none",
19266
+ background: "transparent",
19267
+ fontSize: 12,
19268
+ lineHeight: "16px",
19269
+ fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19270
+ color: "#1f2937"
19271
+ }
19272
+ }
19273
+ )
19274
+ ]
19275
+ }
19276
+ );
19596
19277
  }
19597
19278
  var VARIANTS = [
19598
19279
  { value: "logos", label: "Logos" },
19599
19280
  { value: "reel", label: "Reel" }
19600
19281
  ];
19601
19282
  var ALIGNS = [
19602
- { value: "left", label: "Align left", Icon: AlignLeft },
19603
- { value: "center", label: "Align center", Icon: AlignCenter },
19604
- { value: "right", label: "Align right", Icon: AlignRight }
19283
+ { value: "left", label: "Left" },
19284
+ { value: "center", label: "Center" },
19285
+ { value: "right", label: "Right" }
19605
19286
  ];
19606
19287
  var HOVERS = [
19607
19288
  { value: "none", label: "None" },
@@ -19609,104 +19290,104 @@ var HOVERS = [
19609
19290
  { value: "zoom", label: "Zoom" },
19610
19291
  { value: "fade", label: "Fade" }
19611
19292
  ];
19293
+ var TREATMENTS = [
19294
+ { value: "color", label: "Color" },
19295
+ { value: "grayscale", label: "Grayscale" }
19296
+ ];
19612
19297
  var HTTP_URL_RE = /^https?:\/\/\S+$/i;
19613
- function LinkModal({
19614
- href,
19615
- linkTarget,
19616
- onClose,
19617
- onSave
19618
- }) {
19619
- const [draft, setDraft] = useState8(href);
19620
- const [newTab, setNewTab] = useState8(linkTarget !== "same-tab");
19298
+ function LinkInput({ value, onCommit }) {
19299
+ const [draft, setDraft] = useState8(value);
19621
19300
  const [invalid, setInvalid] = useState8(false);
19622
- const save = () => {
19301
+ useEffect9(() => {
19302
+ setDraft(value);
19303
+ setInvalid(false);
19304
+ }, [value]);
19305
+ const commit2 = () => {
19623
19306
  const next = draft.trim();
19624
- if (next && !HTTP_URL_RE.test(next)) {
19625
- setInvalid(true);
19626
- return;
19627
- }
19628
- onSave(next, newTab ? "new-tab" : "same-tab");
19629
- onClose();
19307
+ if (next === value) return setInvalid(false);
19308
+ if (next && !HTTP_URL_RE.test(next)) return setInvalid(true);
19309
+ setInvalid(false);
19310
+ onCommit(next);
19630
19311
  };
19631
- 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: [
19632
- /* @__PURE__ */ jsx21(DialogHeader, { children: /* @__PURE__ */ jsx21(DialogTitle, { className: "text-base", children: "Image link" }) }),
19633
- /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-3", children: [
19634
- /* @__PURE__ */ jsx21(
19635
- "input",
19636
- {
19637
- autoFocus: true,
19638
- type: "text",
19639
- inputMode: "url",
19640
- value: draft,
19641
- onChange: (e) => {
19642
- setDraft(e.target.value);
19643
- setInvalid(false);
19644
- },
19645
- onKeyDown: (e) => {
19646
- if (e.key === "Enter") save();
19647
- },
19648
- placeholder: "https://example.com",
19649
- "aria-label": "Image link URL",
19650
- "aria-invalid": invalid,
19651
- className: cn(
19652
- "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",
19653
- invalid && "border-destructive focus:border-destructive"
19654
- )
19655
- }
19656
- ),
19657
- invalid && /* @__PURE__ */ jsx21("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
19658
- /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
19659
- /* @__PURE__ */ jsx21("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
19660
- "Open in new tab"
19661
- ] })
19662
- ] }),
19663
- /* @__PURE__ */ jsxs12(DialogFooter, { children: [
19664
- href && /* @__PURE__ */ jsx21(
19665
- "button",
19666
- {
19667
- type: "button",
19668
- onClick: () => {
19669
- onSave("", "new-tab");
19670
- onClose();
19671
- },
19672
- className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
19673
- children: "Remove link"
19674
- }
19675
- ),
19676
- /* @__PURE__ */ jsx21(
19677
- "button",
19678
- {
19679
- type: "button",
19680
- onClick: onClose,
19681
- className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
19682
- children: "Cancel"
19683
- }
19684
- ),
19685
- /* @__PURE__ */ jsx21(
19686
- "button",
19687
- {
19688
- type: "button",
19689
- onClick: save,
19690
- className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
19691
- children: "Save"
19692
- }
19693
- )
19694
- ] })
19695
- ] }) });
19312
+ return /* @__PURE__ */ jsxs11(
19313
+ "div",
19314
+ {
19315
+ style: {
19316
+ display: "flex",
19317
+ alignItems: "center",
19318
+ gap: 6,
19319
+ height: 28,
19320
+ padding: "0 12px",
19321
+ borderRadius: 999,
19322
+ background: "#ffffff",
19323
+ width: "100%",
19324
+ maxWidth: 260,
19325
+ boxSizing: "border-box",
19326
+ boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
19327
+ },
19328
+ children: [
19329
+ /* @__PURE__ */ jsx20(
19330
+ "span",
19331
+ {
19332
+ style: {
19333
+ flex: "0 0 auto",
19334
+ color: OHW_BLUE_DARK,
19335
+ fontSize: 10,
19336
+ fontWeight: 700,
19337
+ textTransform: "uppercase",
19338
+ letterSpacing: 0.4
19339
+ },
19340
+ children: "Link"
19341
+ }
19342
+ ),
19343
+ /* @__PURE__ */ jsx20(
19344
+ "input",
19345
+ {
19346
+ type: "text",
19347
+ inputMode: "url",
19348
+ value: draft,
19349
+ onChange: (e) => setDraft(e.target.value),
19350
+ onBlur: commit2,
19351
+ onKeyDown: (e) => {
19352
+ if (e.key === "Enter") e.currentTarget.blur();
19353
+ if (e.key === "Escape") {
19354
+ setDraft(value);
19355
+ setInvalid(false);
19356
+ e.currentTarget.blur();
19357
+ }
19358
+ },
19359
+ placeholder: "https://example.com",
19360
+ "aria-label": "Image link URL",
19361
+ "aria-invalid": invalid,
19362
+ style: {
19363
+ flex: 1,
19364
+ minWidth: 0,
19365
+ border: "none",
19366
+ outline: "none",
19367
+ background: "transparent",
19368
+ fontSize: 12,
19369
+ lineHeight: "16px",
19370
+ fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19371
+ color: "#1f2937"
19372
+ }
19373
+ }
19374
+ )
19375
+ ]
19376
+ }
19377
+ );
19696
19378
  }
19697
19379
  function MediaStripToolbar({
19698
19380
  entry,
19699
19381
  index,
19700
19382
  pending,
19701
19383
  error,
19702
- itemEditOn,
19703
- onToggleItemEdit,
19704
19384
  onSetVariant,
19705
19385
  onSetAlign,
19706
19386
  onSetHover,
19707
19387
  onSetTreatment,
19708
19388
  onResize,
19709
- onOpenLink,
19389
+ onSetAlt,
19390
+ onSetLink,
19710
19391
  onAddItem,
19711
19392
  onRemoveItem,
19712
19393
  onChangeImage,
@@ -19715,102 +19396,81 @@ function MediaStripToolbar({
19715
19396
  }) {
19716
19397
  const items = mediaStripItems(entry.tree);
19717
19398
  const itemCount = items.length;
19399
+ const currentAlt = items[index]?.alt ?? "";
19400
+ const currentHref2 = items[index]?.href ?? "";
19401
+ const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
19718
19402
  const slots = findMediaStripSlots(entry.tree);
19719
19403
  const variant = slots?.variant === "reel" ? "reel" : "logos";
19720
19404
  const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
19721
19405
  const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
19722
19406
  const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
19723
19407
  const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19724
- const mobile = window.innerWidth <= 480;
19725
- const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
19726
- return /* @__PURE__ */ jsx21(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs12(
19408
+ const isMobile = window.innerWidth <= 480;
19409
+ const rowStyle = isMobile ? {
19410
+ display: "flex",
19411
+ gap: 6,
19412
+ flexWrap: "nowrap",
19413
+ justifyContent: "center",
19414
+ overflowX: "auto",
19415
+ WebkitOverflowScrolling: "touch",
19416
+ width: "100%",
19417
+ scrollbarWidth: "none"
19418
+ } : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
19419
+ return /* @__PURE__ */ jsxs11(
19727
19420
  "div",
19728
19421
  {
19729
19422
  "data-ohw-bridge": "",
19730
19423
  "data-ohw-toolbar": "",
19731
19424
  onMouseDown: (e) => e.stopPropagation(),
19732
- className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
19733
- style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
19425
+ style: {
19426
+ display: "flex",
19427
+ flexDirection: "column",
19428
+ gap: 6,
19429
+ alignItems: "center",
19430
+ background: OHW_BLUE,
19431
+ padding: 8,
19432
+ borderRadius: 12,
19433
+ boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
19434
+ pointerEvents: pending ? "none" : "auto",
19435
+ opacity: pending ? 0.6 : 1,
19436
+ maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
19437
+ },
19734
19438
  children: [
19735
- /* @__PURE__ */ jsxs12(
19736
- "div",
19737
- {
19738
- className: cn(
19739
- "flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
19740
- "shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
19741
- mobile ? "flex-wrap justify-center" : "flex-nowrap"
19742
- ),
19743
- children: [
19744
- /* @__PURE__ */ jsxs12(Tooltip, { children: [
19745
- /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
19746
- CustomToolbarButton,
19747
- {
19748
- type: "button",
19749
- "aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
19750
- "aria-pressed": itemEditOn,
19751
- onClick: onToggleItemEdit,
19752
- className: "group size-8",
19753
- children: /* @__PURE__ */ jsx21(
19754
- Star,
19755
- {
19756
- size: 16,
19757
- fill: "currentColor",
19758
- strokeWidth: 0,
19759
- className: cn(
19760
- "transition-colors",
19761
- itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
19762
- ),
19763
- style: { pointerEvents: "none" }
19764
- }
19765
- )
19766
- }
19767
- ) }),
19768
- /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
19769
- ] }),
19770
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19771
- /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(ImageIcon2, { size: 16, style: { pointerEvents: "none" } }) }),
19772
- /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(LinkIcon, { size: 16, style: { pointerEvents: "none" } }) }),
19773
- /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ jsx21(ArrowLeft2, { size: 16, style: { pointerEvents: "none" } }) }),
19774
- /* @__PURE__ */ jsx21(
19775
- ToolbarAction,
19776
- {
19777
- label: gatedLabel("Move right"),
19778
- onClick: onMoveRight,
19779
- disabled: !itemEditOn || index >= itemCount - 1,
19780
- children: /* @__PURE__ */ jsx21(ArrowRight2, { size: 16, style: { pointerEvents: "none" } })
19781
- }
19782
- ),
19783
- /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ jsx21(ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
19784
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19785
- /* @__PURE__ */ jsx21(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
19786
- /* @__PURE__ */ jsx21(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
19787
- /* @__PURE__ */ jsx21(
19788
- ToolbarAction,
19789
- {
19790
- label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
19791
- active: treatment === "grayscale",
19792
- onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
19793
- children: /* @__PURE__ */ jsx21(Palette, { size: 16, style: { pointerEvents: "none" } })
19794
- }
19795
- ),
19796
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19797
- 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)),
19798
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19799
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ jsx21(Minus, { size: 16, style: { pointerEvents: "none" } }) }),
19800
- /* @__PURE__ */ jsxs12("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
19801
- sizeValue,
19802
- "px"
19803
- ] }),
19804
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ jsx21(Plus2, { size: 16, style: { pointerEvents: "none" } }) }),
19805
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19806
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ jsx21(ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
19807
- ]
19808
- }
19809
- ),
19810
- 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 })
19439
+ /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19440
+ VARIANTS.map((v) => /* @__PURE__ */ jsx20(Pill, { label: v.label, active: variant === v.value, onClick: () => onSetVariant(v.value) }, v.value)),
19441
+ ALIGNS.map((a) => /* @__PURE__ */ jsx20(Pill, { label: a.label, active: align === a.value, onClick: () => onSetAlign(a.value) }, a.value))
19442
+ ] }),
19443
+ /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19444
+ HOVERS.map((h) => /* @__PURE__ */ jsx20(Pill, { label: h.label, active: hover === h.value, onClick: () => onSetHover(h.value) }, h.value)),
19445
+ TREATMENTS.map((t) => /* @__PURE__ */ jsx20(Pill, { label: t.label, active: treatment === t.value, onClick: () => onSetTreatment(t.value) }, t.value))
19446
+ ] }),
19447
+ /* @__PURE__ */ jsxs11("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
19448
+ /* @__PURE__ */ jsx20(Pill, { label: "\u2212", onClick: () => onResize(-8) }),
19449
+ /* @__PURE__ */ jsxs11("span", { style: { color: "#ffffff", fontSize: 12, minWidth: 34, textAlign: "center" }, children: [
19450
+ sizeValue,
19451
+ "px"
19452
+ ] }),
19453
+ /* @__PURE__ */ jsx20(Pill, { label: "+", onClick: () => onResize(8) })
19454
+ ] }),
19455
+ /* @__PURE__ */ jsx20("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ jsx20(AltInput, { value: currentAlt, onCommit: onSetAlt }) }),
19456
+ /* @__PURE__ */ jsx20("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ jsx20(LinkInput, { value: currentHref2, onCommit: (href) => onSetLink(href, currentTarget) }) }),
19457
+ currentHref2 && /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19458
+ /* @__PURE__ */ jsx20(Pill, { label: "New tab", active: currentTarget === "new-tab", onClick: () => onSetLink(currentHref2, "new-tab") }),
19459
+ /* @__PURE__ */ jsx20(Pill, { label: "Same tab", active: currentTarget === "same-tab", onClick: () => onSetLink(currentHref2, "same-tab") })
19460
+ ] }),
19461
+ /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19462
+ /* @__PURE__ */ jsx20(Pill, { label: "Change Image", onClick: onChangeImage }),
19463
+ /* @__PURE__ */ jsx20(Pill, { label: "+ Item", onClick: onAddItem }),
19464
+ /* @__PURE__ */ jsx20(Pill, { label: "\u2212 Item", onClick: onRemoveItem, disabled: itemCount <= 1 })
19465
+ ] }),
19466
+ /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19467
+ /* @__PURE__ */ jsx20(Pill, { label: "\u2190 Move", onClick: onMoveLeft, disabled: index <= 0 }),
19468
+ /* @__PURE__ */ jsx20(Pill, { label: "\u2192 Move", onClick: onMoveRight, disabled: index >= itemCount - 1 })
19469
+ ] }),
19470
+ error && /* @__PURE__ */ jsx20("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
19811
19471
  ]
19812
19472
  }
19813
- ) });
19473
+ );
19814
19474
  }
19815
19475
  function findMediaStripSlots(tree) {
19816
19476
  const stack = tree.rows.flatMap((row) => row.blocks);
@@ -19829,23 +19489,31 @@ function AiMediaStripOverlay({
19829
19489
  }) {
19830
19490
  const [hover, setHover] = useState8(null);
19831
19491
  const [active, setActive] = useState8(null);
19832
- const [itemEditOn, setItemEditOn] = useState8(false);
19833
- const [linkOpen, setLinkOpen] = useState8(false);
19834
19492
  const [pending, setPending] = useState8(false);
19835
19493
  const [error, setError] = useState8(null);
19836
19494
  const activeRef = useRef5(null);
19837
19495
  activeRef.current = active;
19838
- const linkOpenRef = useRef5(false);
19839
- linkOpenRef.current = linkOpen;
19840
19496
  useEffect9(() => {
19841
19497
  const onMove = (e) => {
19842
- const ref = itemRefFromTarget(e.target);
19843
19498
  const t = e.target;
19844
- const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
19845
- setHover((prev) => {
19846
- const next = ref && !overEditable ? ref : null;
19847
- return sameRef(prev, next) ? prev : next;
19848
- });
19499
+ if (!(t instanceof HTMLElement)) return;
19500
+ 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]")) {
19501
+ return;
19502
+ }
19503
+ const itemEl = t.closest("[data-ohw-media-strip-item]");
19504
+ if (!itemEl) {
19505
+ setHover(null);
19506
+ return;
19507
+ }
19508
+ const sectionEl2 = itemEl.closest("[data-ohw-section]");
19509
+ const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
19510
+ const sectionId = unit ? instanceIdOf(unit) || null : null;
19511
+ const index = Number(itemEl.dataset.ohwMediaStripIndex);
19512
+ if (!sectionId || Number.isNaN(index)) {
19513
+ setHover(null);
19514
+ return;
19515
+ }
19516
+ setHover({ sectionId, index });
19849
19517
  };
19850
19518
  const onLeave = () => setHover(null);
19851
19519
  document.addEventListener("mousemove", onMove, { passive: true });
@@ -19857,25 +19525,23 @@ function AiMediaStripOverlay({
19857
19525
  }, []);
19858
19526
  useEffect9(() => {
19859
19527
  const onClick = (e) => {
19528
+ const current = activeRef.current;
19529
+ if (!current) return;
19860
19530
  const t = e.target;
19861
- if (!(t instanceof Element)) return;
19862
- if (t.closest(CHROME_SELECTOR)) return;
19863
- const ref = itemRefFromTarget(t);
19864
- if (sameRef(activeRef.current, ref)) return;
19865
- if (ref) clearInteractionChromeRef.current();
19866
- setItemEditOn(false);
19531
+ if (!(t instanceof HTMLElement)) return;
19532
+ if (t.closest("[data-ohw-item-interaction]")) return;
19533
+ const itemEl = findMediaStripItemElement(current.sectionId, current.index);
19534
+ if (itemEl && itemEl.contains(t)) return;
19535
+ setActive(null);
19867
19536
  setError(null);
19868
- setActive(ref);
19869
19537
  };
19870
19538
  document.addEventListener("click", onClick, true);
19871
19539
  return () => document.removeEventListener("click", onClick, true);
19872
- }, [clearInteractionChromeRef]);
19540
+ }, []);
19873
19541
  useEffect9(() => {
19874
19542
  const onBlur = () => {
19875
19543
  if (!activeRef.current) return;
19876
19544
  setActive(null);
19877
- setItemEditOn(false);
19878
- setLinkOpen(false);
19879
19545
  setError(null);
19880
19546
  };
19881
19547
  window.addEventListener("blur", onBlur);
@@ -19885,10 +19551,7 @@ function AiMediaStripOverlay({
19885
19551
  const onKeyDown = (e) => {
19886
19552
  if (e.key !== "Escape") return;
19887
19553
  if (!activeRef.current) return;
19888
- if (linkOpenRef.current) return;
19889
- if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
19890
19554
  setActive(null);
19891
- setItemEditOn(false);
19892
19555
  setError(null);
19893
19556
  };
19894
19557
  document.addEventListener("keydown", onKeyDown);
@@ -19922,133 +19585,137 @@ function AiMediaStripOverlay({
19922
19585
  tree: nextTree,
19923
19586
  label: entry.label,
19924
19587
  media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
19925
- ...entry.brand ? { brand: entry.brand } : {},
19926
- // The user is already looking at the strip they just edited — recentering the viewport
19927
- // on every edit reads as the section jumping around.
19928
- skipScrollIntoView: true
19588
+ ...entry.brand ? { brand: entry.brand } : {}
19929
19589
  });
19930
19590
  return true;
19931
19591
  },
19932
19592
  [findEntry, postToParent2, applyTreeLocalRef]
19933
19593
  );
19934
19594
  const activeEntry = active ? findEntry(active.sectionId) : null;
19595
+ const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
19935
19596
  const activeItemRect = useLiveItemRect(active);
19936
- const activeStripRect = useLiveItemRect(active, true);
19937
- const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
19938
- const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
19939
- const activeItem = active ? activeItems[active.index] : void 0;
19940
- const activeHref = activeItem?.href ?? "";
19941
- const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
19942
- return /* @__PURE__ */ jsxs12(Fragment7, { children: [
19943
- hoverRect && /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
19944
- activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ jsxs12(Fragment7, { children: [
19945
- /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
19946
- /* @__PURE__ */ jsx21(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ jsx21(
19947
- MediaStripToolbar,
19948
- {
19949
- entry: activeEntry,
19950
- index: active.index,
19951
- pending,
19952
- error,
19953
- itemEditOn,
19954
- onToggleItemEdit: () => setItemEditOn((on) => !on),
19955
- onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
19956
- onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
19957
- onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
19958
- onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
19959
- onResize: (delta) => {
19960
- const slots = findMediaStripSlots(activeEntry.tree);
19961
- const variant = slots?.variant === "reel" ? "reel" : "logos";
19962
- const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19963
- void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
19964
- },
19965
- onOpenLink: () => setLinkOpen(true),
19966
- onAddItem: () => {
19967
- void requestAssetPick(postToParent2).then((picked) => {
19968
- if (!picked) return;
19969
- const item = { assetId: picked.assetId, alt: "Logo" };
19597
+ const TOOLBAR_APPROX_H = 170;
19598
+ const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
19599
+ return /* @__PURE__ */ jsxs11(Fragment7, { children: [
19600
+ hoverHandleRect && hover && /* @__PURE__ */ jsx20(
19601
+ "button",
19602
+ {
19603
+ type: "button",
19604
+ "data-ohw-toolbar": "",
19605
+ onClick: () => {
19606
+ clearInteractionChromeRef.current();
19607
+ setActive(hover);
19608
+ },
19609
+ "aria-label": "Configure media item",
19610
+ style: {
19611
+ position: "fixed",
19612
+ top: hoverHandleRect.top + 8,
19613
+ left: hoverHandleRect.left + hoverHandleRect.width - 36,
19614
+ width: 28,
19615
+ height: 28,
19616
+ borderRadius: 8,
19617
+ border: `1.5px dashed ${PRIMARY3}`,
19618
+ background: "#ffffff",
19619
+ color: PRIMARY3,
19620
+ display: "flex",
19621
+ alignItems: "center",
19622
+ justifyContent: "center",
19623
+ cursor: "pointer",
19624
+ zIndex: 2147483643,
19625
+ fontSize: 14,
19626
+ fontWeight: 700
19627
+ },
19628
+ children: /* @__PURE__ */ jsx20(Star, { size: 14, style: { pointerEvents: "none" } })
19629
+ }
19630
+ ),
19631
+ activeItemRect && active && activeEntry && /* @__PURE__ */ jsx20(
19632
+ ItemInteractionLayer,
19633
+ {
19634
+ rect: activeItemRect,
19635
+ state: toolbarState,
19636
+ toolbar: /* @__PURE__ */ jsx20(
19637
+ MediaStripToolbar,
19638
+ {
19639
+ entry: activeEntry,
19640
+ index: active.index,
19641
+ pending,
19642
+ error,
19643
+ onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
19644
+ onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
19645
+ onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
19646
+ onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
19647
+ onResize: (delta) => {
19648
+ const slots = findMediaStripSlots(activeEntry.tree);
19649
+ const variant = slots?.variant === "reel" ? "reel" : "logos";
19650
+ const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19651
+ void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
19652
+ },
19653
+ onSetAlt: (alt) => {
19654
+ void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
19655
+ },
19656
+ onSetLink: (href, linkTarget) => {
19970
19657
  void runMutation(
19971
19658
  active.sectionId,
19972
- (tree) => addMediaStripItem(tree, item, active.index),
19973
- { [picked.assetId]: picked.url }
19974
- ).then((applied) => {
19975
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19659
+ (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
19660
+ );
19661
+ },
19662
+ onAddItem: () => {
19663
+ void requestAssetPick(postToParent2).then((picked) => {
19664
+ if (!picked) return;
19665
+ const item = { assetId: picked.assetId, alt: "Logo" };
19666
+ void runMutation(
19667
+ active.sectionId,
19668
+ (tree) => addMediaStripItem(tree, item, active.index),
19669
+ { [picked.assetId]: picked.url }
19670
+ ).then((applied) => {
19671
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19672
+ });
19976
19673
  });
19977
- });
19978
- },
19979
- onChangeImage: () => {
19980
- void requestAssetPick(postToParent2).then((picked) => {
19981
- if (!picked) return;
19982
- void runMutation(
19983
- active.sectionId,
19984
- (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
19985
- { [picked.assetId]: picked.url }
19674
+ },
19675
+ onChangeImage: () => {
19676
+ void requestAssetPick(postToParent2).then((picked) => {
19677
+ if (!picked) return;
19678
+ void runMutation(
19679
+ active.sectionId,
19680
+ (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
19681
+ { [picked.assetId]: picked.url }
19682
+ );
19683
+ });
19684
+ },
19685
+ onRemoveItem: () => {
19686
+ void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
19687
+ (applied) => {
19688
+ if (applied) setActive(null);
19689
+ }
19986
19690
  );
19987
- });
19988
- },
19989
- onRemoveItem: () => {
19990
- void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
19991
- (applied) => {
19992
- if (applied) setActive(null);
19993
- }
19994
- );
19995
- },
19996
- onMoveLeft: () => {
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
- onMoveRight: () => {
20004
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
20005
- (applied) => {
20006
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
20007
- }
20008
- );
20009
- }
20010
- }
20011
- ) }),
20012
- /* @__PURE__ */ jsx21(
20013
- "div",
20014
- {
20015
- "data-ohw-bridge": "",
20016
- "data-ohw-item-interaction": "",
20017
- "aria-hidden": true,
20018
- className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
20019
- style: {
20020
- top: activeItemRect.top + activeItemRect.height + 10,
20021
- left: activeItemRect.left - 5,
20022
- background: PRIMARY3,
20023
- zIndex: 2147483644
20024
- },
20025
- children: "Media item"
20026
- }
20027
- ),
20028
- linkOpen && /* @__PURE__ */ jsx21(
20029
- LinkModal,
20030
- {
20031
- href: activeHref,
20032
- linkTarget: activeTarget,
20033
- onClose: () => setLinkOpen(false),
20034
- onSave: (href, linkTarget) => {
20035
- void runMutation(
20036
- active.sectionId,
20037
- (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
20038
- );
19691
+ },
19692
+ onMoveLeft: () => {
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
+ },
19699
+ onMoveRight: () => {
19700
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
19701
+ (applied) => {
19702
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19703
+ }
19704
+ );
19705
+ }
20039
19706
  }
20040
- }
20041
- )
20042
- ] })
19707
+ )
19708
+ }
19709
+ )
20043
19710
  ] });
20044
19711
  }
20045
19712
 
20046
19713
  // src/ui/ai-section/AiPricingCardOverlay.tsx
20047
- import { useCallback as useCallback4, useEffect as useEffect10, useLayoutEffect as useLayoutEffect5, useRef as useRef6, useState as useState9 } from "react";
20048
- import { Check as Check3, ChevronDown as ChevronDown4, Minus as Minus2, Plus as Plus3, Star as Star2 } from "lucide-react";
20049
- import { Fragment as Fragment8, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
19714
+ import { useCallback as useCallback4, useEffect as useEffect10, useLayoutEffect as useLayoutEffect4, useRef as useRef6, useState as useState9 } from "react";
19715
+ import { Check as Check2, ChevronDown as ChevronDown3, Minus, Plus as Plus2, Star as Star2 } from "lucide-react";
19716
+ import { Fragment as Fragment8, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
20050
19717
  var PRIMARY4 = "var(--ohw-primary, #0885FE)";
20051
- 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]";
19718
+ 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]";
20052
19719
  function findPricingCardElement(sectionId, index) {
20053
19720
  const sectionEl2 = findByInstanceId(sectionId);
20054
19721
  if (!sectionEl2) return null;
@@ -20060,7 +19727,7 @@ function findPricingCardElement(sectionId, index) {
20060
19727
  }
20061
19728
  function cardRefFromTarget(target) {
20062
19729
  if (!(target instanceof Element)) return null;
20063
- if (target.closest(CHROME_SELECTOR2)) return null;
19730
+ if (target.closest(CHROME_SELECTOR)) return null;
20064
19731
  const cardEl = target.closest("[data-ohw-pricing-card]");
20065
19732
  if (!cardEl) return null;
20066
19733
  const sectionEl2 = cardEl.closest("[data-ohw-section]");
@@ -20070,21 +19737,21 @@ function cardRefFromTarget(target) {
20070
19737
  if (!sectionId || Number.isNaN(index)) return null;
20071
19738
  return { sectionId, index };
20072
19739
  }
20073
- function sameRef2(a, b) {
19740
+ function sameRef(a, b) {
20074
19741
  return a?.sectionId === b?.sectionId && a?.index === b?.index;
20075
19742
  }
20076
- function rectOf2(el) {
19743
+ function rectOf(el) {
20077
19744
  if (!el) return null;
20078
19745
  const r2 = el.getBoundingClientRect();
20079
19746
  if (r2.width <= 0 || r2.height <= 0) return null;
20080
19747
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
20081
19748
  }
20082
19749
  function readRect3(ref) {
20083
- return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
19750
+ return rectOf(ref && findPricingCardElement(ref.sectionId, ref.index));
20084
19751
  }
20085
19752
  function readGridRect(ref) {
20086
19753
  const card = ref && findPricingCardElement(ref.sectionId, ref.index);
20087
- return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
19754
+ return rectOf(card?.closest("[data-ohw-pricing-collection]") ?? card);
20088
19755
  }
20089
19756
  function useLiveCardRect(ref, grid = false) {
20090
19757
  const [rect, setRect] = useState9(null);
@@ -20114,19 +19781,19 @@ function useLiveCardRect(ref, grid = false) {
20114
19781
  }
20115
19782
  var TOOLBAR_GRID_GAP = 52;
20116
19783
  var TOOLBAR_GRID_GAP_MOBILE = 42;
20117
- var TOOLBAR_EDGE_MARGIN3 = 4;
19784
+ var TOOLBAR_EDGE_MARGIN2 = 4;
20118
19785
  function GridToolbarSlot({ gridRect, children }) {
20119
19786
  const slotRef = useRef6(null);
20120
19787
  const [shift, setShift] = useState9(0);
20121
19788
  const centerX = gridRect.left + gridRect.width / 2;
20122
- useLayoutEffect5(() => {
19789
+ useLayoutEffect4(() => {
20123
19790
  const slot = slotRef.current;
20124
19791
  if (!slot) return;
20125
19792
  const clamp = () => {
20126
19793
  const w = slot.offsetWidth;
20127
19794
  if (w <= 0) return;
20128
19795
  const half = w / 2;
20129
- const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
19796
+ const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
20130
19797
  setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
20131
19798
  };
20132
19799
  clamp();
@@ -20135,7 +19802,7 @@ function GridToolbarSlot({ gridRect, children }) {
20135
19802
  return () => ro.disconnect();
20136
19803
  }, [centerX, children]);
20137
19804
  const mobile = window.innerWidth <= 480;
20138
- return /* @__PURE__ */ jsx22(
19805
+ return /* @__PURE__ */ jsx21(
20139
19806
  "div",
20140
19807
  {
20141
19808
  ref: slotRef,
@@ -20170,7 +19837,7 @@ function requestValidateTree2(postToParent2, tree) {
20170
19837
  });
20171
19838
  }
20172
19839
  function StyleSwatch({ style }) {
20173
- return /* @__PURE__ */ jsx22(
19840
+ return /* @__PURE__ */ jsx21(
20174
19841
  "span",
20175
19842
  {
20176
19843
  "aria-hidden": true,
@@ -20184,35 +19851,35 @@ function StyleSwatch({ style }) {
20184
19851
  );
20185
19852
  }
20186
19853
  function ButtonGlyph() {
20187
- return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20188
- /* @__PURE__ */ jsx22("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
20189
- /* @__PURE__ */ jsx22("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
19854
+ return /* @__PURE__ */ jsxs12("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
19855
+ /* @__PURE__ */ jsx21("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
19856
+ /* @__PURE__ */ jsx21("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
20190
19857
  ] });
20191
19858
  }
20192
19859
  function FeatureGlyph({ mode }) {
20193
- return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20194
- /* @__PURE__ */ jsx22("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
20195
- /* @__PURE__ */ jsx22("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
20196
- /* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
20197
- /* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
20198
- /* @__PURE__ */ jsx22("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
20199
- mode === "add" && /* @__PURE__ */ jsx22("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
19860
+ return /* @__PURE__ */ jsxs12("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
19861
+ /* @__PURE__ */ jsx21("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
19862
+ /* @__PURE__ */ jsx21("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
19863
+ /* @__PURE__ */ jsx21("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
19864
+ /* @__PURE__ */ jsx21("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
19865
+ /* @__PURE__ */ jsx21("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
19866
+ mode === "add" && /* @__PURE__ */ jsx21("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
20200
19867
  ] });
20201
19868
  }
20202
- function ToolbarAction2({
19869
+ function ToolbarAction({
20203
19870
  label,
20204
19871
  onClick,
20205
19872
  disabled = false,
20206
19873
  children
20207
19874
  }) {
20208
- const button = /* @__PURE__ */ jsx22(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
20209
- return /* @__PURE__ */ jsxs13(Tooltip, { children: [
20210
- /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: button }) : button }),
20211
- /* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
19875
+ const button = /* @__PURE__ */ jsx21(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
19876
+ return /* @__PURE__ */ jsxs12(Tooltip, { children: [
19877
+ /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: button }) : button }),
19878
+ /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
20212
19879
  ] });
20213
19880
  }
20214
- function ToolbarSeparator2() {
20215
- return /* @__PURE__ */ jsx22("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
19881
+ function ToolbarSeparator() {
19882
+ return /* @__PURE__ */ jsx21("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
20216
19883
  }
20217
19884
  function CardStyleMenu({
20218
19885
  value,
@@ -20220,7 +19887,7 @@ function CardStyleMenu({
20220
19887
  disabled = false
20221
19888
  }) {
20222
19889
  const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
20223
- const trigger = /* @__PURE__ */ jsxs13(
19890
+ const trigger = /* @__PURE__ */ jsxs12(
20224
19891
  "button",
20225
19892
  {
20226
19893
  type: "button",
@@ -20231,28 +19898,28 @@ function CardStyleMenu({
20231
19898
  disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
20232
19899
  ),
20233
19900
  children: [
20234
- /* @__PURE__ */ jsx22(StyleSwatch, { style: current.value }),
20235
- /* @__PURE__ */ jsx22("span", { className: "flex-1 text-left", children: current.label }),
20236
- /* @__PURE__ */ jsx22(ChevronDown4, { size: 16, style: { pointerEvents: "none" } })
19901
+ /* @__PURE__ */ jsx21(StyleSwatch, { style: current.value }),
19902
+ /* @__PURE__ */ jsx21("span", { className: "flex-1 text-left", children: current.label }),
19903
+ /* @__PURE__ */ jsx21(ChevronDown3, { size: 16, style: { pointerEvents: "none" } })
20237
19904
  ]
20238
19905
  }
20239
19906
  );
20240
19907
  if (disabled) {
20241
- return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20242
- /* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
20243
- /* @__PURE__ */ jsxs13(Tooltip, { children: [
20244
- /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: trigger }) }),
20245
- /* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
19908
+ return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
19909
+ /* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
19910
+ /* @__PURE__ */ jsxs12(Tooltip, { children: [
19911
+ /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: trigger }) }),
19912
+ /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
20246
19913
  ] })
20247
19914
  ] });
20248
19915
  }
20249
- return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20250
- /* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
20251
- /* @__PURE__ */ jsxs13(DropdownMenu, { modal: false, children: [
20252
- /* @__PURE__ */ jsx22(DropdownMenuTrigger, { asChild: true, children: trigger }),
20253
- /* @__PURE__ */ jsx22(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
19916
+ return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
19917
+ /* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
19918
+ /* @__PURE__ */ jsxs12(DropdownMenu, { modal: false, children: [
19919
+ /* @__PURE__ */ jsx21(DropdownMenuTrigger, { asChild: true, children: trigger }),
19920
+ /* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
20254
19921
  const selected = style.value === value;
20255
- return /* @__PURE__ */ jsxs13(
19922
+ return /* @__PURE__ */ jsxs12(
20256
19923
  DropdownMenuItem,
20257
19924
  {
20258
19925
  role: "menuitemradio",
@@ -20260,9 +19927,9 @@ function CardStyleMenu({
20260
19927
  onSelect: () => onChange(style.value),
20261
19928
  className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
20262
19929
  children: [
20263
- /* @__PURE__ */ jsx22(StyleSwatch, { style: style.value }),
20264
- /* @__PURE__ */ jsx22("span", { children: style.label }),
20265
- selected && /* @__PURE__ */ jsx22(Check3, { size: 16, className: "text-bridge-primary" })
19930
+ /* @__PURE__ */ jsx21(StyleSwatch, { style: style.value }),
19931
+ /* @__PURE__ */ jsx21("span", { children: style.label }),
19932
+ selected && /* @__PURE__ */ jsx21(Check2, { size: 16, className: "text-bridge-primary" })
20266
19933
  ]
20267
19934
  },
20268
19935
  style.value
@@ -20292,7 +19959,7 @@ function PricingCardToolbar({
20292
19959
  const style = pricingCardStyle(entry.tree, index);
20293
19960
  const featuredTag = pricingCardFeaturedTag(entry.tree, index);
20294
19961
  const mobile = window.innerWidth <= 480;
20295
- return /* @__PURE__ */ jsx22(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs13(
19962
+ return /* @__PURE__ */ jsx21(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs12(
20296
19963
  "div",
20297
19964
  {
20298
19965
  "data-ohw-bridge": "",
@@ -20304,7 +19971,7 @@ function PricingCardToolbar({
20304
19971
  ),
20305
19972
  style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
20306
19973
  children: [
20307
- /* @__PURE__ */ jsxs13(
19974
+ /* @__PURE__ */ jsxs12(
20308
19975
  "div",
20309
19976
  {
20310
19977
  className: cn(
@@ -20313,8 +19980,8 @@ function PricingCardToolbar({
20313
19980
  mobile ? "flex-wrap justify-center" : "flex-nowrap"
20314
19981
  ),
20315
19982
  children: [
20316
- /* @__PURE__ */ jsxs13(Tooltip, { children: [
20317
- /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22(
19983
+ /* @__PURE__ */ jsxs12(Tooltip, { children: [
19984
+ /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
20318
19985
  CustomToolbarButton,
20319
19986
  {
20320
19987
  type: "button",
@@ -20322,7 +19989,7 @@ function PricingCardToolbar({
20322
19989
  "aria-pressed": featuredTag,
20323
19990
  onClick: () => onSetFeaturedTag(!featuredTag),
20324
19991
  className: "group size-8",
20325
- children: /* @__PURE__ */ jsx22(
19992
+ children: /* @__PURE__ */ jsx21(
20326
19993
  Star2,
20327
19994
  {
20328
19995
  size: 16,
@@ -20337,25 +20004,25 @@ function PricingCardToolbar({
20337
20004
  )
20338
20005
  }
20339
20006
  ) }),
20340
- /* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
20007
+ /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
20341
20008
  ] }),
20342
- /* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
20343
- /* @__PURE__ */ jsx22(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
20344
- /* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
20345
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ jsx22(ButtonGlyph, {}) }),
20346
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ jsxs13("span", { className: "relative inline-flex", children: [
20347
- /* @__PURE__ */ jsx22(ButtonGlyph, {}),
20348
- /* @__PURE__ */ jsx22(Minus2, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
20009
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
20010
+ /* @__PURE__ */ jsx21(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
20011
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
20012
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ jsx21(ButtonGlyph, {}) }),
20013
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ jsxs12("span", { className: "relative inline-flex", children: [
20014
+ /* @__PURE__ */ jsx21(ButtonGlyph, {}),
20015
+ /* @__PURE__ */ jsx21(Minus, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
20349
20016
  ] }) }),
20350
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "add" }) }),
20351
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "remove" }) }),
20352
- /* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
20353
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ jsx22(Plus3, { size: 16, style: { pointerEvents: "none" } }) }),
20354
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ jsx22(Minus2, { size: 16, style: { pointerEvents: "none" } }) })
20017
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ jsx21(FeatureGlyph, { mode: "add" }) }),
20018
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ jsx21(FeatureGlyph, { mode: "remove" }) }),
20019
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
20020
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ jsx21(Plus2, { size: 16, style: { pointerEvents: "none" } }) }),
20021
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ jsx21(Minus, { size: 16, style: { pointerEvents: "none" } }) })
20355
20022
  ]
20356
20023
  }
20357
20024
  ),
20358
- 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 })
20025
+ 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 })
20359
20026
  ]
20360
20027
  }
20361
20028
  ) });
@@ -20389,7 +20056,7 @@ function AiPricingCardOverlay({
20389
20056
  const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
20390
20057
  setHover((prev) => {
20391
20058
  const next = ref && !overEditable ? ref : null;
20392
- return sameRef2(prev, next) ? prev : next;
20059
+ return sameRef(prev, next) ? prev : next;
20393
20060
  });
20394
20061
  };
20395
20062
  const onLeave = () => setHover(null);
@@ -20404,10 +20071,10 @@ function AiPricingCardOverlay({
20404
20071
  const onClick = (e) => {
20405
20072
  const t = e.target;
20406
20073
  if (!(t instanceof Element)) return;
20407
- if (t.closest(CHROME_SELECTOR2)) return;
20074
+ if (t.closest(CHROME_SELECTOR)) return;
20408
20075
  const ref = cardRefFromTarget(t);
20409
- setActive((prev) => sameRef2(prev, ref) ? prev : ref);
20410
- if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
20076
+ setActive((prev) => sameRef(prev, ref) ? prev : ref);
20077
+ if (!ref || !sameRef(activeRef.current, ref)) setError(null);
20411
20078
  };
20412
20079
  document.addEventListener("click", onClick, true);
20413
20080
  return () => document.removeEventListener("click", onClick, true);
@@ -20472,12 +20139,12 @@ function AiPricingCardOverlay({
20472
20139
  const activeEntry = active ? findEntry(active.sectionId) : null;
20473
20140
  const activeCardRect = useLiveCardRect(active);
20474
20141
  const activeGridRect = useLiveCardRect(active, true);
20475
- const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
20476
- return /* @__PURE__ */ jsxs13(Fragment8, { children: [
20477
- hoverRect && /* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20478
- activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ jsxs13(Fragment8, { children: [
20479
- /* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
20480
- /* @__PURE__ */ jsx22(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ jsx22(
20142
+ const hoverRect = useLiveCardRect(hover && !sameRef(hover, active) ? hover : null);
20143
+ return /* @__PURE__ */ jsxs12(Fragment8, { children: [
20144
+ hoverRect && /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20145
+ activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ jsxs12(Fragment8, { children: [
20146
+ /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
20147
+ /* @__PURE__ */ jsx21(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ jsx21(
20481
20148
  PricingCardToolbar,
20482
20149
  {
20483
20150
  entry: activeEntry,
@@ -20505,7 +20172,7 @@ function AiPricingCardOverlay({
20505
20172
  onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
20506
20173
  }
20507
20174
  ) }),
20508
- /* @__PURE__ */ jsx22(
20175
+ /* @__PURE__ */ jsx21(
20509
20176
  "div",
20510
20177
  {
20511
20178
  "data-ohw-bridge": "",
@@ -20569,11 +20236,39 @@ function clearVideo(tree, path) {
20569
20236
  });
20570
20237
  }
20571
20238
 
20239
+ // src/lib/youtube.ts
20240
+ var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
20241
+ function extractYouTubeId(input) {
20242
+ const trimmed = input.trim();
20243
+ if (!trimmed) return null;
20244
+ if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
20245
+ let url;
20246
+ try {
20247
+ url = new URL(trimmed);
20248
+ } catch {
20249
+ return null;
20250
+ }
20251
+ const host = url.hostname.replace(/^www\./, "");
20252
+ if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
20253
+ return null;
20254
+ }
20255
+ let candidate = null;
20256
+ if (host === "youtu.be") {
20257
+ candidate = url.pathname.slice(1).split("/")[0] ?? null;
20258
+ } else if (url.pathname === "/watch") {
20259
+ candidate = url.searchParams.get("v");
20260
+ } else {
20261
+ const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
20262
+ candidate = match ? match[1] : null;
20263
+ }
20264
+ return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
20265
+ }
20266
+
20572
20267
  // src/ui/ai-section/AiVideoOverlay.tsx
20573
- import { Fragment as Fragment9, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
20268
+ import { Fragment as Fragment9, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
20574
20269
  var PRIMARY5 = "#0885FE";
20575
- var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
20576
- var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20270
+ var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY5})`;
20271
+ var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20577
20272
  function findVideoBlockElement(sectionId, path) {
20578
20273
  const sectionEl2 = findByInstanceId(sectionId);
20579
20274
  if (!sectionEl2) return null;
@@ -20633,12 +20328,12 @@ function requestValidateTree3(postToParent2, tree) {
20633
20328
  postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
20634
20329
  });
20635
20330
  }
20636
- function Pill({
20331
+ function Pill2({
20637
20332
  label,
20638
20333
  onClick,
20639
20334
  disabled
20640
20335
  }) {
20641
- return /* @__PURE__ */ jsx23(
20336
+ return /* @__PURE__ */ jsx22(
20642
20337
  "button",
20643
20338
  {
20644
20339
  type: "button",
@@ -20654,7 +20349,7 @@ function Pill({
20654
20349
  border: "none",
20655
20350
  cursor: disabled ? "default" : "pointer",
20656
20351
  background: "#ffffff",
20657
- color: OHW_BLUE_DARK,
20352
+ color: OHW_BLUE_DARK2,
20658
20353
  opacity: disabled ? 0.4 : 1,
20659
20354
  fontSize: 12,
20660
20355
  lineHeight: "16px",
@@ -20697,8 +20392,8 @@ function VideoUrlInput({ value, onCommit }) {
20697
20392
  onCommit(id);
20698
20393
  }
20699
20394
  };
20700
- return /* @__PURE__ */ jsxs14("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
20701
- /* @__PURE__ */ jsxs14(
20395
+ return /* @__PURE__ */ jsxs13("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
20396
+ /* @__PURE__ */ jsxs13(
20702
20397
  "div",
20703
20398
  {
20704
20399
  style: {
@@ -20714,12 +20409,12 @@ function VideoUrlInput({ value, onCommit }) {
20714
20409
  boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
20715
20410
  },
20716
20411
  children: [
20717
- /* @__PURE__ */ jsx23(
20412
+ /* @__PURE__ */ jsx22(
20718
20413
  "span",
20719
20414
  {
20720
20415
  style: {
20721
20416
  flex: "0 0 auto",
20722
- color: OHW_BLUE_DARK,
20417
+ color: OHW_BLUE_DARK2,
20723
20418
  fontSize: 10,
20724
20419
  lineHeight: "16px",
20725
20420
  fontWeight: 700,
@@ -20729,7 +20424,7 @@ function VideoUrlInput({ value, onCommit }) {
20729
20424
  children: "Video"
20730
20425
  }
20731
20426
  ),
20732
- /* @__PURE__ */ jsx23(
20427
+ /* @__PURE__ */ jsx22(
20733
20428
  "input",
20734
20429
  {
20735
20430
  type: "text",
@@ -20766,7 +20461,7 @@ function VideoUrlInput({ value, onCommit }) {
20766
20461
  ]
20767
20462
  }
20768
20463
  ),
20769
- 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." })
20464
+ 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." })
20770
20465
  ] });
20771
20466
  }
20772
20467
  function VideoToolbar({
@@ -20776,7 +20471,7 @@ function VideoToolbar({
20776
20471
  onSetVideoId,
20777
20472
  onRemove
20778
20473
  }) {
20779
- return /* @__PURE__ */ jsxs14(
20474
+ return /* @__PURE__ */ jsxs13(
20780
20475
  "div",
20781
20476
  {
20782
20477
  "data-ohw-bridge": "",
@@ -20788,7 +20483,7 @@ function VideoToolbar({
20788
20483
  gap: 6,
20789
20484
  alignItems: "center",
20790
20485
  width: 280,
20791
- background: OHW_BLUE,
20486
+ background: OHW_BLUE2,
20792
20487
  padding: 8,
20793
20488
  borderRadius: 12,
20794
20489
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -20796,9 +20491,9 @@ function VideoToolbar({
20796
20491
  opacity: pending ? 0.6 : 1
20797
20492
  },
20798
20493
  children: [
20799
- /* @__PURE__ */ jsx23(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
20800
- /* @__PURE__ */ jsx23(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
20801
- error && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20494
+ /* @__PURE__ */ jsx22(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
20495
+ /* @__PURE__ */ jsx22(Pill2, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
20496
+ error && /* @__PURE__ */ jsx22("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20802
20497
  ]
20803
20498
  }
20804
20499
  );
@@ -20918,8 +20613,8 @@ function AiVideoOverlay({
20918
20613
  const activeBlockRect = useLiveBlockRect(active);
20919
20614
  const TOOLBAR_APPROX_H = 90;
20920
20615
  const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
20921
- return /* @__PURE__ */ jsxs14(Fragment9, { children: [
20922
- hoverHandleRect && hover && /* @__PURE__ */ jsx23(
20616
+ return /* @__PURE__ */ jsxs13(Fragment9, { children: [
20617
+ hoverHandleRect && hover && /* @__PURE__ */ jsx22(
20923
20618
  "button",
20924
20619
  {
20925
20620
  type: "button",
@@ -20947,15 +20642,15 @@ function AiVideoOverlay({
20947
20642
  fontSize: 14,
20948
20643
  fontWeight: 700
20949
20644
  },
20950
- children: /* @__PURE__ */ jsx23(Star3, { size: 14, style: { pointerEvents: "none" } })
20645
+ children: /* @__PURE__ */ jsx22(Star3, { size: 14, style: { pointerEvents: "none" } })
20951
20646
  }
20952
20647
  ),
20953
- activeBlockRect && active && activeEntry && /* @__PURE__ */ jsx23(
20648
+ activeBlockRect && active && activeEntry && /* @__PURE__ */ jsx22(
20954
20649
  ItemInteractionLayer,
20955
20650
  {
20956
20651
  rect: activeBlockRect,
20957
20652
  state: toolbarState,
20958
- toolbar: /* @__PURE__ */ jsx23(
20653
+ toolbar: /* @__PURE__ */ jsx22(
20959
20654
  VideoToolbar,
20960
20655
  {
20961
20656
  videoId: videoIdAt(activeEntry.tree, active.path),
@@ -21030,10 +20725,10 @@ function setCarouselAutoplay(tree, on) {
21030
20725
  }
21031
20726
 
21032
20727
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
21033
- import { Fragment as Fragment10, jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
20728
+ import { Fragment as Fragment10, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
21034
20729
  var PRIMARY6 = "#0885FE";
21035
- var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
21036
- var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
20730
+ var OHW_BLUE3 = `var(--ohw-primary, ${PRIMARY6})`;
20731
+ var OHW_BLUE_DARK3 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
21037
20732
  function findCarouselItemElement(sectionId, index) {
21038
20733
  const sectionEl2 = findByInstanceId(sectionId);
21039
20734
  if (!sectionEl2) return null;
@@ -21112,8 +20807,8 @@ function requestAssetPick2(postToParent2) {
21112
20807
  postToParent2({ type: "ow:asset-pick", id });
21113
20808
  });
21114
20809
  }
21115
- function Pill2({ label, onClick, disabled }) {
21116
- return /* @__PURE__ */ jsx24(
20810
+ function Pill3({ label, onClick, disabled }) {
20811
+ return /* @__PURE__ */ jsx23(
21117
20812
  "button",
21118
20813
  {
21119
20814
  type: "button",
@@ -21129,7 +20824,7 @@ function Pill2({ label, onClick, disabled }) {
21129
20824
  border: "none",
21130
20825
  cursor: disabled ? "default" : "pointer",
21131
20826
  background: "#ffffff",
21132
- color: OHW_BLUE_DARK2,
20827
+ color: OHW_BLUE_DARK3,
21133
20828
  opacity: disabled ? 0.4 : 1,
21134
20829
  fontSize: 12,
21135
20830
  lineHeight: "16px",
@@ -21147,7 +20842,7 @@ function TogglePill({
21147
20842
  onToggle,
21148
20843
  disabled
21149
20844
  }) {
21150
- return /* @__PURE__ */ jsxs15(
20845
+ return /* @__PURE__ */ jsxs14(
21151
20846
  "button",
21152
20847
  {
21153
20848
  type: "button",
@@ -21166,7 +20861,7 @@ function TogglePill({
21166
20861
  border: "none",
21167
20862
  cursor: disabled ? "default" : "pointer",
21168
20863
  background: "#ffffff",
21169
- color: OHW_BLUE_DARK2,
20864
+ color: OHW_BLUE_DARK3,
21170
20865
  opacity: disabled ? 0.4 : 1,
21171
20866
  fontSize: 12,
21172
20867
  lineHeight: "16px",
@@ -21176,7 +20871,7 @@ function TogglePill({
21176
20871
  },
21177
20872
  children: [
21178
20873
  label,
21179
- /* @__PURE__ */ jsx24(
20874
+ /* @__PURE__ */ jsx23(
21180
20875
  "span",
21181
20876
  {
21182
20877
  "aria-hidden": true,
@@ -21189,10 +20884,10 @@ function TogglePill({
21189
20884
  // Off is a grey track, not a washed-out blue: the pill's own white background already
21190
20885
  // carries the brand colour in the text, and a pale blue track next to it read as
21191
20886
  // "disabled control" rather than "switch that is off".
21192
- background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
20887
+ background: on ? OHW_BLUE_DARK3 : "#CBD5E1",
21193
20888
  transition: "background 120ms ease"
21194
20889
  },
21195
- children: /* @__PURE__ */ jsx24(
20890
+ children: /* @__PURE__ */ jsx23(
21196
20891
  "span",
21197
20892
  {
21198
20893
  style: {
@@ -21221,7 +20916,7 @@ function CarouselSlideToolbar({
21221
20916
  onChangeImage,
21222
20917
  onToggleAutoplay
21223
20918
  }) {
21224
- return /* @__PURE__ */ jsxs15(
20919
+ return /* @__PURE__ */ jsxs14(
21225
20920
  "div",
21226
20921
  {
21227
20922
  "data-ohw-bridge": "",
@@ -21232,7 +20927,7 @@ function CarouselSlideToolbar({
21232
20927
  flexDirection: "column",
21233
20928
  gap: 6,
21234
20929
  alignItems: "center",
21235
- background: OHW_BLUE2,
20930
+ background: OHW_BLUE3,
21236
20931
  padding: 8,
21237
20932
  borderRadius: 12,
21238
20933
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -21244,11 +20939,11 @@ function CarouselSlideToolbar({
21244
20939
  pointerEvents: pending ? "none" : "auto"
21245
20940
  },
21246
20941
  children: [
21247
- /* @__PURE__ */ jsxs15("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
21248
- /* @__PURE__ */ jsx24(Pill2, { label: "Change Image", onClick: onChangeImage }),
21249
- /* @__PURE__ */ jsx24(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
20942
+ /* @__PURE__ */ jsxs14("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
20943
+ /* @__PURE__ */ jsx23(Pill3, { label: "Change Image", onClick: onChangeImage }),
20944
+ /* @__PURE__ */ jsx23(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
21250
20945
  ] }),
21251
- error && /* @__PURE__ */ jsx24("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20946
+ error && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
21252
20947
  ]
21253
20948
  }
21254
20949
  );
@@ -21388,8 +21083,8 @@ function AiFadeCarouselOverlay({
21388
21083
  const activeItemRect = useLiveItemRect2(active);
21389
21084
  const TOOLBAR_APPROX_H = 90;
21390
21085
  const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
21391
- return /* @__PURE__ */ jsxs15(Fragment10, { children: [
21392
- hoverHandleRect && hover && /* @__PURE__ */ jsx24(
21086
+ return /* @__PURE__ */ jsxs14(Fragment10, { children: [
21087
+ hoverHandleRect && hover && /* @__PURE__ */ jsx23(
21393
21088
  "button",
21394
21089
  {
21395
21090
  type: "button",
@@ -21418,10 +21113,10 @@ function AiFadeCarouselOverlay({
21418
21113
  fontSize: 14,
21419
21114
  fontWeight: 700
21420
21115
  },
21421
- children: /* @__PURE__ */ jsx24(Star4, { size: 14, style: { pointerEvents: "none" } })
21116
+ children: /* @__PURE__ */ jsx23(Star4, { size: 14, style: { pointerEvents: "none" } })
21422
21117
  }
21423
21118
  ),
21424
- swapping && /* @__PURE__ */ jsx24(
21119
+ swapping && /* @__PURE__ */ jsx23(
21425
21120
  "div",
21426
21121
  {
21427
21122
  ref: skeletonRef,
@@ -21439,15 +21134,15 @@ function AiFadeCarouselOverlay({
21439
21134
  zIndex: 2147483646,
21440
21135
  pointerEvents: "none"
21441
21136
  },
21442
- children: /* @__PURE__ */ jsx24("style", { children: MEDIA_SKELETON_CSS })
21137
+ children: /* @__PURE__ */ jsx23("style", { children: MEDIA_SKELETON_CSS })
21443
21138
  }
21444
21139
  ),
21445
- activeItemRect && active && activeEntry && /* @__PURE__ */ jsx24(
21140
+ activeItemRect && active && activeEntry && /* @__PURE__ */ jsx23(
21446
21141
  ItemInteractionLayer,
21447
21142
  {
21448
21143
  rect: activeItemRect,
21449
21144
  state: toolbarState,
21450
- toolbar: /* @__PURE__ */ jsx24(
21145
+ toolbar: /* @__PURE__ */ jsx23(
21451
21146
  CarouselSlideToolbar,
21452
21147
  {
21453
21148
  pending,
@@ -21638,11 +21333,118 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
21638
21333
  // src/ui/link-modal/LinkPopover.tsx
21639
21334
  import { useEffect as useEffect16 } from "react";
21640
21335
 
21336
+ // src/ui/dialog.tsx
21337
+ import * as React9 from "react";
21338
+ import { Dialog as DialogPrimitive } from "radix-ui";
21339
+ import { X as X2 } from "lucide-react";
21340
+ import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
21341
+ function Dialog2({
21342
+ ...props
21343
+ }) {
21344
+ return /* @__PURE__ */ jsx24(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
21345
+ }
21346
+ function DialogPortal({
21347
+ ...props
21348
+ }) {
21349
+ return /* @__PURE__ */ jsx24(DialogPrimitive.Portal, { ...props });
21350
+ }
21351
+ function DialogOverlay({
21352
+ className,
21353
+ ...props
21354
+ }) {
21355
+ return /* @__PURE__ */ jsx24(
21356
+ DialogPrimitive.Overlay,
21357
+ {
21358
+ "data-slot": "dialog-overlay",
21359
+ "data-ohw-link-modal-root": "",
21360
+ className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
21361
+ ...props
21362
+ }
21363
+ );
21364
+ }
21365
+ var DialogContent = React9.forwardRef(
21366
+ ({ className, children, showCloseButton = true, container, ...props }, ref) => {
21367
+ const positionMode = container ? "absolute" : "fixed";
21368
+ return /* @__PURE__ */ jsxs15(DialogPortal, { container: container ?? void 0, children: [
21369
+ /* @__PURE__ */ jsx24(DialogOverlay, { className: cn(positionMode, "inset-0") }),
21370
+ /* @__PURE__ */ jsxs15(
21371
+ DialogPrimitive.Content,
21372
+ {
21373
+ ref,
21374
+ "data-slot": "dialog-content",
21375
+ className: cn(
21376
+ positionMode,
21377
+ "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",
21378
+ "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
21379
+ container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
21380
+ className
21381
+ ),
21382
+ onMouseDown: (e) => e.stopPropagation(),
21383
+ ...props,
21384
+ children: [
21385
+ children,
21386
+ showCloseButton ? /* @__PURE__ */ jsx24(
21387
+ DialogPrimitive.Close,
21388
+ {
21389
+ type: "button",
21390
+ className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
21391
+ "aria-label": "Close",
21392
+ children: /* @__PURE__ */ jsx24(X2, { size: 16, "aria-hidden": true })
21393
+ }
21394
+ ) : null
21395
+ ]
21396
+ }
21397
+ )
21398
+ ] });
21399
+ }
21400
+ );
21401
+ DialogContent.displayName = DialogPrimitive.Content.displayName;
21402
+ function DialogHeader({
21403
+ className,
21404
+ ...props
21405
+ }) {
21406
+ return /* @__PURE__ */ jsx24("div", { className: cn("flex flex-col gap-1.5", className), ...props });
21407
+ }
21408
+ function DialogFooter({
21409
+ className,
21410
+ ...props
21411
+ }) {
21412
+ return /* @__PURE__ */ jsx24(
21413
+ "div",
21414
+ {
21415
+ className: cn("flex items-center justify-end gap-2", className),
21416
+ ...props
21417
+ }
21418
+ );
21419
+ }
21420
+ var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
21421
+ DialogPrimitive.Title,
21422
+ {
21423
+ ref,
21424
+ className: cn(
21425
+ "text-lg font-semibold leading-none tracking-tight text-card-foreground",
21426
+ className
21427
+ ),
21428
+ ...props
21429
+ }
21430
+ ));
21431
+ DialogTitle.displayName = DialogPrimitive.Title.displayName;
21432
+ var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
21433
+ DialogPrimitive.Description,
21434
+ {
21435
+ ref,
21436
+ className: cn("text-sm text-muted-foreground", className),
21437
+ ...props
21438
+ }
21439
+ ));
21440
+ DialogDescription.displayName = DialogPrimitive.Description.displayName;
21441
+ var DialogClose = DialogPrimitive.Close;
21442
+
21641
21443
  // src/ui/link-modal/LinkEditorPanel.tsx
21642
21444
  import { Info, X as X4 } from "lucide-react";
21643
21445
 
21644
21446
  // src/ui/link-modal/DestinationBreadcrumb.tsx
21645
- import { ArrowRight as ArrowRight3, File, GalleryVertical } from "lucide-react";
21447
+ import { ArrowRight as ArrowRight2, File, GalleryVertical } from "lucide-react";
21646
21448
  import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
21647
21449
  function DestinationBreadcrumb({
21648
21450
  pageTitle,
@@ -21656,7 +21458,7 @@ function DestinationBreadcrumb({
21656
21458
  /* @__PURE__ */ jsx25("span", { className: "text-sm font-medium leading-none text-foreground!", children: pageTitle })
21657
21459
  ] }),
21658
21460
  /* @__PURE__ */ jsx25(
21659
- ArrowRight3,
21461
+ ArrowRight2,
21660
21462
  {
21661
21463
  size: 16,
21662
21464
  className: "shrink-0 text-muted-foreground",
@@ -21768,7 +21570,7 @@ function Label({ className, ...props }) {
21768
21570
  }
21769
21571
 
21770
21572
  // src/ui/link-modal/UrlOrPageInput.tsx
21771
- import { ChevronDown as ChevronDown5, File as File2, X as X3 } from "lucide-react";
21573
+ import { ChevronDown as ChevronDown4, File as File2, X as X3 } from "lucide-react";
21772
21574
  import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
21773
21575
  function FieldChevron({
21774
21576
  onClick
@@ -21781,7 +21583,7 @@ function FieldChevron({
21781
21583
  onClick,
21782
21584
  "aria-label": "Open page list",
21783
21585
  tabIndex: -1,
21784
- children: /* @__PURE__ */ jsx29(ChevronDown5, { size: 16 })
21586
+ children: /* @__PURE__ */ jsx29(ChevronDown4, { size: 16 })
21785
21587
  }
21786
21588
  );
21787
21589
  }
@@ -22011,7 +21813,7 @@ function LinkEditorPanel({ state, onClose }) {
22011
21813
  // src/ui/link-modal/SectionPickerOverlay.tsx
22012
21814
  import { useCallback as useCallback7, useEffect as useEffect14, useMemo as useMemo2, useRef as useRef10, useState as useState13 } from "react";
22013
21815
  import { createPortal as createPortal2 } from "react-dom";
22014
- import { ArrowLeft as ArrowLeft3, Check as Check4 } from "lucide-react";
21816
+ import { ArrowLeft as ArrowLeft2, Check as Check3 } from "lucide-react";
22015
21817
  import { usePathname as usePathname2, useRouter as useRouter2 } from "next/navigation";
22016
21818
 
22017
21819
  // src/lib/parent-scroll.ts
@@ -22288,7 +22090,7 @@ function SectionPickerOverlay({
22288
22090
  className: "h-8 min-w-0 gap-1 border-border bg-background px-2 py-1.5 shadow-sm hover:bg-muted cursor-pointer",
22289
22091
  onClick: onBack,
22290
22092
  children: [
22291
- /* @__PURE__ */ jsx31(ArrowLeft3, { className: "size-4 shrink-0", "aria-hidden": true }),
22093
+ /* @__PURE__ */ jsx31(ArrowLeft2, { className: "size-4 shrink-0", "aria-hidden": true }),
22292
22094
  "Back"
22293
22095
  ]
22294
22096
  }
@@ -22357,7 +22159,7 @@ function SectionPickerOverlay({
22357
22159
  className: "absolute right-3 top-3 flex size-8 items-center justify-center rounded-full text-white",
22358
22160
  style: { backgroundColor: "var(--ohw-primary, #0885fe)" },
22359
22161
  "aria-hidden": true,
22360
- children: /* @__PURE__ */ jsx31(Check4, { className: "size-5" })
22162
+ children: /* @__PURE__ */ jsx31(Check3, { className: "size-5" })
22361
22163
  }
22362
22164
  ) : null
22363
22165
  ]
@@ -22741,7 +22543,6 @@ function shouldUseDevFixtures() {
22741
22543
  function getLogoElement(el) {
22742
22544
  const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
22743
22545
  if (marked) return marked;
22744
- if (el.closest('[data-ohw-editable="icon"]')) return null;
22745
22546
  const root = el.closest("nav, [data-ohw-nav-root], footer");
22746
22547
  if (!root) return null;
22747
22548
  const anchor = el.closest("a");
@@ -22811,7 +22612,7 @@ function addFooterColumnWithPersist({
22811
22612
  import {
22812
22613
  useCallback as useCallback9,
22813
22614
  useEffect as useEffect17,
22814
- useLayoutEffect as useLayoutEffect6,
22615
+ useLayoutEffect as useLayoutEffect5,
22815
22616
  useRef as useRef11,
22816
22617
  useState as useState15
22817
22618
  } from "react";
@@ -22908,7 +22709,7 @@ function FloatingPanel({
22908
22709
  return () => window.removeEventListener("message", onParentScroll);
22909
22710
  }, [open]);
22910
22711
  const positionRef = useRef11(position);
22911
- useLayoutEffect6(() => {
22712
+ useLayoutEffect5(() => {
22912
22713
  if (!open) {
22913
22714
  positionRef.current = position;
22914
22715
  return;
@@ -22918,7 +22719,7 @@ function FloatingPanel({
22918
22719
  }
22919
22720
  positionRef.current = position;
22920
22721
  }, [open, position, liveScroll, parentScroll]);
22921
- useLayoutEffect6(() => {
22722
+ useLayoutEffect5(() => {
22922
22723
  if (!open || !panelRef.current) return;
22923
22724
  const el = panelRef.current;
22924
22725
  const header = el.querySelector("[data-ohw-floating-panel-header]");
@@ -23127,7 +22928,7 @@ function SocialsDisplayPanel({ display, onChange, className }) {
23127
22928
  }
23128
22929
 
23129
22930
  // src/ui/button-style-panel.tsx
23130
- import { Check as Check5 } from "lucide-react";
22931
+ import { Check as Check4 } from "lucide-react";
23131
22932
  import { jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
23132
22933
  var SIZE_LABEL = { s: "S", m: "M", l: "L" };
23133
22934
  function ButtonStylePanel({
@@ -23198,7 +22999,7 @@ function ButtonStylePanel({
23198
22999
  {
23199
23000
  className: "absolute right-0.5 top-0.5 flex size-5 items-center justify-center rounded-full bg-primary text-primary-foreground",
23200
23001
  "aria-hidden": true,
23201
- children: /* @__PURE__ */ jsx35(Check5, { className: "size-3", strokeWidth: 3 })
23002
+ children: /* @__PURE__ */ jsx35(Check4, { className: "size-3", strokeWidth: 3 })
23202
23003
  }
23203
23004
  ) : null
23204
23005
  ]
@@ -24223,7 +24024,7 @@ function useSectionDrag({
24223
24024
  }
24224
24025
 
24225
24026
  // src/ui/footer-container-chrome.tsx
24226
- import { Plus as Plus4 } from "lucide-react";
24027
+ import { Plus as Plus3 } from "lucide-react";
24227
24028
  import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
24228
24029
  function FooterContainerChrome({
24229
24030
  rect,
@@ -24264,7 +24065,7 @@ function FooterContainerChrome({
24264
24065
  if (addDisabled) return;
24265
24066
  onAdd();
24266
24067
  },
24267
- children: /* @__PURE__ */ jsx36(Plus4, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24068
+ children: /* @__PURE__ */ jsx36(Plus3, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24268
24069
  }
24269
24070
  ) }),
24270
24071
  /* @__PURE__ */ jsx36(TooltipContent, { side: "bottom", sideOffset: 9, children: addDisabled ? "Maximum columns reached" : "Add item" })
@@ -24671,7 +24472,7 @@ function retargetPageLinks(change, deps) {
24671
24472
  }
24672
24473
 
24673
24474
  // src/ui/navbar-container-chrome.tsx
24674
- import { Plus as Plus5 } from "lucide-react";
24475
+ import { Plus as Plus4 } from "lucide-react";
24675
24476
  import { jsx as jsx37 } from "react/jsx-runtime";
24676
24477
  function NavbarContainerChrome({
24677
24478
  rect,
@@ -24707,7 +24508,7 @@ function NavbarContainerChrome({
24707
24508
  e.stopPropagation();
24708
24509
  onAdd();
24709
24510
  },
24710
- children: /* @__PURE__ */ jsx37(Plus5, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24511
+ children: /* @__PURE__ */ jsx37(Plus4, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24711
24512
  }
24712
24513
  )
24713
24514
  }
@@ -24779,7 +24580,7 @@ function Badge({ className, variant, ...props }) {
24779
24580
  }
24780
24581
 
24781
24582
  // src/OhhwellsBridge.tsx
24782
- import { Brush as Brush2, Link as Link2, Plus as Plus6, Settings } from "lucide-react";
24583
+ import { Brush as Brush2, Link as Link2, Plus as Plus5, Settings } from "lucide-react";
24783
24584
  import { Fragment as Fragment13, jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
24784
24585
  var PRIMARY7 = "#0885FE";
24785
24586
  var IMAGE_FADE_MS = 300;
@@ -25557,7 +25358,7 @@ function getNavigationSelectionParent(el) {
25557
25358
  if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
25558
25359
  return resolveFooterLinksContainerFrom(el);
25559
25360
  }
25560
- 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)) {
25361
+ if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
25561
25362
  return getNavigationRoot(el);
25562
25363
  }
25563
25364
  return null;
@@ -25779,6 +25580,7 @@ var ICONS = {
25779
25580
  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"/>',
25780
25581
  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"/>'
25781
25582
  };
25583
+ var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
25782
25584
  var SELECTION_CHROME_GAP2 = 4;
25783
25585
  var TOOLBAR_STROKE_GAP2 = 4;
25784
25586
  var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
@@ -25876,7 +25678,7 @@ function applyVisibleViewport(el, parentScroll) {
25876
25678
  el.style.top = `${top}px`;
25877
25679
  el.style.height = `${height}px`;
25878
25680
  }
25879
- var TOOLBAR_EDGE_MARGIN4 = 4;
25681
+ var TOOLBAR_EDGE_MARGIN3 = 4;
25880
25682
  function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
25881
25683
  const isAbove = transform.includes("translateY(-100%)");
25882
25684
  let visualTop = isAbove ? top - approxH : top;
@@ -25903,8 +25705,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
25903
25705
  function clampToolbarLeft(centerX, toolbarWidth) {
25904
25706
  const half = toolbarWidth / 2;
25905
25707
  return Math.max(
25906
- TOOLBAR_EDGE_MARGIN4 + half,
25907
- Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
25708
+ TOOLBAR_EDGE_MARGIN3 + half,
25709
+ Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half)
25908
25710
  );
25909
25711
  }
25910
25712
  function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
@@ -26305,7 +26107,7 @@ function OhhwellsBridge() {
26305
26107
  }, []);
26306
26108
  const subdomainFromQuery = searchParams.get("subdomain");
26307
26109
  const [subdomain, setSubdomain] = useState18(() => resolveSubdomain(subdomainFromQuery));
26308
- useLayoutEffect7(() => {
26110
+ useLayoutEffect6(() => {
26309
26111
  const next = resolveSubdomain(subdomainFromQuery);
26310
26112
  if (next !== subdomain) setSubdomain(next);
26311
26113
  if (next) return;
@@ -26787,6 +26589,21 @@ function OhhwellsBridge() {
26787
26589
  const [isItemDragging, setIsItemDragging] = useState18(false);
26788
26590
  const [isFooterFrameSelection, setIsFooterFrameSelection] = useState18(false);
26789
26591
  isFooterFrameSelectionRef.current = isFooterFrameSelection;
26592
+ const [floatingPanel, setFloatingPanel] = useState18(null);
26593
+ const floatingPanelOpenRef = useRef14(false);
26594
+ floatingPanelOpenRef.current = floatingPanel !== null;
26595
+ const floatingPanelRef = useRef14(null);
26596
+ floatingPanelRef.current = floatingPanel;
26597
+ const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
26598
+ const buttonCollectionDragRef = useRef14(null);
26599
+ const buttonDropInsertIndexRef = useRef14(null);
26600
+ const [buttonDropSlots, setButtonDropSlots] = useState18([]);
26601
+ const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
26602
+ const buttonPointerDragRef = useRef14(null);
26603
+ const [buttonStyleTick, setButtonStyleTick] = useState18(0);
26604
+ const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
26605
+ const [editorViewport, setEditorViewport] = useState18("desktop");
26606
+ const [parentScrollSnap, setParentScrollSnap] = useState18(null);
26790
26607
  const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = useState18(null);
26791
26608
  const [footerHeadingVisible, setFooterHeadingVisible] = useState18(null);
26792
26609
  const footerDragRef = useRef14(null);
@@ -26813,21 +26630,6 @@ function OhhwellsBridge() {
26813
26630
  const stylesRef = useRef14("");
26814
26631
  const appliedDrawerRef = useRef14(null);
26815
26632
  const pendingDeleteUndoRef = useRef14(null);
26816
- const [floatingPanel, setFloatingPanel] = useState18(null);
26817
- const floatingPanelOpenRef = useRef14(false);
26818
- const floatingPanelRef = useRef14(null);
26819
- floatingPanelRef.current = floatingPanel;
26820
- const setFloatingPanelRef = useRef14(setFloatingPanel);
26821
- const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
26822
- const buttonCollectionDragRef = useRef14(null);
26823
- const buttonDropInsertIndexRef = useRef14(null);
26824
- const [buttonDropSlots, setButtonDropSlots] = useState18([]);
26825
- const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
26826
- const buttonPointerDragRef = useRef14(null);
26827
- const [buttonStyleTick, setButtonStyleTick] = useState18(0);
26828
- const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
26829
- const [editorViewport, setEditorViewport] = useState18("desktop");
26830
- const [parentScrollSnap, setParentScrollSnap] = useState18(null);
26831
26633
  const [sitePages, setSitePages] = useState18([]);
26832
26634
  const collectionItemsRef = useRef14(/* @__PURE__ */ new Map());
26833
26635
  const [sectionsByPath, setSectionsByPath] = useState18({});
@@ -26837,18 +26639,7 @@ function OhhwellsBridge() {
26837
26639
  const linkPopoverOpenRef = useRef14(false);
26838
26640
  const linkPopoverGraceUntilRef = useRef14(0);
26839
26641
  setLinkPopoverRef.current = setLinkPopover;
26840
- setFloatingPanelRef.current = setFloatingPanel;
26841
26642
  linkPopoverSessionRef.current = linkPopover;
26842
- floatingPanelOpenRef.current = Boolean(floatingPanel);
26843
- useEffect21(() => {
26844
- const syncViewport = () => {
26845
- const next = window.innerWidth <= 480 ? "mobile" : "desktop";
26846
- setEditorViewport((prev) => prev === next ? prev : next);
26847
- };
26848
- syncViewport();
26849
- window.addEventListener("resize", syncViewport);
26850
- return () => window.removeEventListener("resize", syncViewport);
26851
- }, []);
26852
26643
  useEffect21(() => {
26853
26644
  setSectionOrderPersistHandler((entries) => {
26854
26645
  const currentPath = window.location.pathname;
@@ -28555,7 +28346,7 @@ function OhhwellsBridge() {
28555
28346
  isFooterFrameSelection,
28556
28347
  postToParent2
28557
28348
  ]);
28558
- useLayoutEffect7(() => {
28349
+ useLayoutEffect6(() => {
28559
28350
  if (!subdomain || isEditMode) {
28560
28351
  setFetchState("done");
28561
28352
  return;
@@ -28582,7 +28373,6 @@ function OhhwellsBridge() {
28582
28373
  applyAiFooterFromContent(content);
28583
28374
  if (typeof content[STYLE_STORE_KEY] === "string") {
28584
28375
  stylesRef.current = content[STYLE_STORE_KEY];
28585
- document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28586
28376
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28587
28377
  }
28588
28378
  applyBrandChrome(content);
@@ -28593,16 +28383,15 @@ function OhhwellsBridge() {
28593
28383
  if (key === "__ohw_sections") continue;
28594
28384
  if (key === AI_SECTIONS_KEY) continue;
28595
28385
  if (key === AI_FOOTER_KEY) continue;
28596
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28597
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28598
28386
  if (key === BRAND_KIT_KEY) continue;
28599
28387
  if (key === STYLE_STORE_KEY) continue;
28600
28388
  if (BRAND_CHROME_KEYS.has(key)) continue;
28389
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
28601
28390
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
28391
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28602
28392
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28603
28393
  continue;
28604
28394
  }
28605
- if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28606
28395
  if (applyVideoSettingNode(key, val)) continue;
28607
28396
  if (applyCarouselNode(key, val)) continue;
28608
28397
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28642,7 +28431,6 @@ function OhhwellsBridge() {
28642
28431
  });
28643
28432
  applyLinkByKey(key, val);
28644
28433
  }
28645
- applySectionEmbeds(content);
28646
28434
  applyLogoFromContent(content);
28647
28435
  applyLogoSizes(content);
28648
28436
  reconcileNavbarItemsFromContent(content);
@@ -28831,22 +28619,20 @@ function OhhwellsBridge() {
28831
28619
  }
28832
28620
  applyAiFooterFromContent(content);
28833
28621
  if (typeof content[STYLE_STORE_KEY] === "string") {
28834
- document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28835
28622
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28836
28623
  }
28837
28624
  for (const [key, val] of Object.entries(content)) {
28838
28625
  if (key === "__ohw_sections") continue;
28839
28626
  if (key === AI_SECTIONS_KEY) continue;
28840
28627
  if (key === AI_FOOTER_KEY) continue;
28841
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28842
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28843
28628
  if (key === BRAND_KIT_KEY) continue;
28844
28629
  if (key === STYLE_STORE_KEY) continue;
28845
28630
  if (BRAND_CHROME_KEYS.has(key)) continue;
28631
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
28632
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28846
28633
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28847
28634
  continue;
28848
28635
  }
28849
- if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28850
28636
  if (applyVideoSettingNode(key, val)) continue;
28851
28637
  if (applyCarouselNode(key, val)) continue;
28852
28638
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28871,7 +28657,6 @@ function OhhwellsBridge() {
28871
28657
  });
28872
28658
  applyLinkByKey(key, val);
28873
28659
  }
28874
- applySectionEmbeds(content);
28875
28660
  applyLogoFromContent(content);
28876
28661
  reconcileNavbarItemsFromContent(content);
28877
28662
  reconcileFooterOrderFromContent(content);
@@ -28927,7 +28712,7 @@ function OhhwellsBridge() {
28927
28712
  if (debounceTimer) clearTimeout(debounceTimer);
28928
28713
  };
28929
28714
  }, [subdomain, isEditMode, pathname]);
28930
- useLayoutEffect7(() => {
28715
+ useLayoutEffect6(() => {
28931
28716
  const el = document.getElementById("ohw-loader");
28932
28717
  if (!el) return;
28933
28718
  const visible = Boolean(subdomain) && fetchState !== "done";
@@ -29111,11 +28896,26 @@ function OhhwellsBridge() {
29111
28896
  const t2 = setTimeout(measure, 500);
29112
28897
  const ro = new ResizeObserver(schedule);
29113
28898
  ro.observe(document.body);
28899
+ let lastWidth = window.innerWidth;
28900
+ let resizeTimers = [];
28901
+ const clearResizeTimers = () => {
28902
+ resizeTimers.forEach(clearTimeout);
28903
+ resizeTimers = [];
28904
+ };
28905
+ const handleResize = () => {
28906
+ if (window.innerWidth === lastWidth) return;
28907
+ lastWidth = window.innerWidth;
28908
+ clearResizeTimers();
28909
+ resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
28910
+ };
28911
+ window.addEventListener("resize", handleResize);
29114
28912
  return () => {
29115
28913
  clearTimeout(t1);
29116
28914
  clearTimeout(t2);
29117
28915
  if (raf != null) cancelAnimationFrame(raf);
29118
28916
  ro.disconnect();
28917
+ clearResizeTimers();
28918
+ window.removeEventListener("resize", handleResize);
29119
28919
  };
29120
28920
  }, [pathname, isEditMode, postToParent2]);
29121
28921
  useEffect21(() => {
@@ -29412,13 +29212,6 @@ function OhhwellsBridge() {
29412
29212
  if (target.closest("[data-ohw-state-toggle]")) return;
29413
29213
  if (target.closest("[data-ohw-max-badge]")) return;
29414
29214
  if (isInsideLinkEditor(target)) return;
29415
- if (isInsideFloatingPanel(target)) return;
29416
- if (target.closest("[data-ohw-form-toolbar]")) return;
29417
- if (target.closest(
29418
- '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
29419
- )) {
29420
- return;
29421
- }
29422
29215
  if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
29423
29216
  clearMediaSelectionRef.current();
29424
29217
  }
@@ -29442,6 +29235,8 @@ function OhhwellsBridge() {
29442
29235
  return;
29443
29236
  }
29444
29237
  }
29238
+ if (isInsideFloatingPanel(target)) return;
29239
+ if (target.closest("[data-ohw-form-toolbar]")) return;
29445
29240
  const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
29446
29241
  if (collectionItem) {
29447
29242
  e.preventDefault();
@@ -29453,6 +29248,11 @@ function OhhwellsBridge() {
29453
29248
  });
29454
29249
  return;
29455
29250
  }
29251
+ if (target.closest(
29252
+ '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
29253
+ )) {
29254
+ return;
29255
+ }
29456
29256
  {
29457
29257
  const formEl = getFormElement(target);
29458
29258
  const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
@@ -29606,13 +29406,9 @@ function OhhwellsBridge() {
29606
29406
  if (isIconEditable(editable) && !getSocialItem(editable)) {
29607
29407
  e.preventDefault();
29608
29408
  e.stopPropagation();
29409
+ selectIconElementRef.current(editable);
29609
29410
  const aiIcon = editable.hasAttribute("data-ai-icon");
29610
29411
  const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
29611
- if (aiIcon) {
29612
- aiSectionApiRef.current?.selectFromElement(editable);
29613
- } else {
29614
- selectIconElementRef.current(editable);
29615
- }
29616
29412
  postToParentRef.current({
29617
29413
  type: "ow:icon-pick",
29618
29414
  key: editable.dataset.ohwKey ?? "",
@@ -29840,9 +29636,6 @@ function OhhwellsBridge() {
29840
29636
  setHoveredItemRect(null);
29841
29637
  hoveredNavContainerRef.current = null;
29842
29638
  setHoveredNavContainerRect(null);
29843
- siblingHintElRef.current = null;
29844
- setSiblingHintRect(null);
29845
- setSiblingHintRects([]);
29846
29639
  return;
29847
29640
  }
29848
29641
  {
@@ -29963,6 +29756,7 @@ function OhhwellsBridge() {
29963
29756
  hoveredNavContainerRef.current = null;
29964
29757
  setHoveredNavContainerRect(null);
29965
29758
  hoveredItemElRef.current = editable;
29759
+ setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
29966
29760
  }
29967
29761
  }
29968
29762
  }
@@ -30672,11 +30466,7 @@ function OhhwellsBridge() {
30672
30466
  };
30673
30467
  const handleMouseMove = (e) => {
30674
30468
  const { clientX, clientY } = e;
30675
- if (pointOwnedByFloatingPanel(clientX, clientY)) {
30676
- dismissImageHover();
30677
- clearImageHover();
30678
- return;
30679
- }
30469
+ if (pointOwnedByFloatingPanel(clientX, clientY)) return;
30680
30470
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
30681
30471
  document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
30682
30472
  formHoverElRef.current = null;
@@ -30705,12 +30495,7 @@ function OhhwellsBridge() {
30705
30495
  setHoveredItemRect(null);
30706
30496
  hoveredNavContainerRef.current = null;
30707
30497
  setHoveredNavContainerRect(null);
30708
- siblingHintElRef.current = null;
30709
- setSiblingHintRect(null);
30710
- setSiblingHintRects([]);
30711
30498
  dismissImageHover();
30712
- clearImageHover();
30713
- setSectionGap(null);
30714
30499
  return;
30715
30500
  }
30716
30501
  if (probeSocialsRowAt(clientX, clientY)) return;
@@ -30722,11 +30507,7 @@ function OhhwellsBridge() {
30722
30507
  if (e.data?.type !== "ow:pointer-sync") return;
30723
30508
  const { clientX, clientY } = e.data;
30724
30509
  if (typeof clientX !== "number" || typeof clientY !== "number") return;
30725
- if (pointOwnedByFloatingPanel(clientX, clientY)) {
30726
- dismissImageHover();
30727
- clearImageHover();
30728
- return;
30729
- }
30510
+ if (pointOwnedByFloatingPanel(clientX, clientY)) return;
30730
30511
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
30731
30512
  if (probeSocialsRowAt(clientX, clientY)) return;
30732
30513
  probeSectionGapAt(clientX, clientY);
@@ -31106,7 +30887,6 @@ function OhhwellsBridge() {
31106
30887
  applyAiFooterFromContent(content);
31107
30888
  if (typeof content[STYLE_STORE_KEY] === "string") {
31108
30889
  stylesRef.current = content[STYLE_STORE_KEY];
31109
- document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
31110
30890
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
31111
30891
  }
31112
30892
  applyBrandChrome(content);
@@ -31121,16 +30901,15 @@ function OhhwellsBridge() {
31121
30901
  }
31122
30902
  if (key === AI_SECTIONS_KEY) continue;
31123
30903
  if (key === AI_FOOTER_KEY) continue;
31124
- if (key === LOGO_PLACEHOLDER_KEY) continue;
31125
- if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
31126
30904
  if (key === BRAND_KIT_KEY) continue;
31127
30905
  if (key === STYLE_STORE_KEY) continue;
31128
30906
  if (BRAND_CHROME_KEYS.has(key)) continue;
30907
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
31129
30908
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
30909
+ if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
31130
30910
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
31131
30911
  continue;
31132
30912
  }
31133
- if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
31134
30913
  if (applyVideoSettingNode(key, val)) continue;
31135
30914
  if (applyCarouselNode(key, val)) continue;
31136
30915
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -31156,7 +30935,6 @@ function OhhwellsBridge() {
31156
30935
  });
31157
30936
  applyLinkByKey(key, val);
31158
30937
  }
31159
- applySectionEmbeds(content);
31160
30938
  applyLogoFromContent(content);
31161
30939
  applyLogoSizes(content);
31162
30940
  document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
@@ -31789,12 +31567,6 @@ function OhhwellsBridge() {
31789
31567
  closeLinkPopoverRef.current();
31790
31568
  return;
31791
31569
  }
31792
- if (floatingPanelOpenRef.current) {
31793
- setFloatingPanelRef.current(null);
31794
- deselectRef.current();
31795
- deactivateRef.current();
31796
- return;
31797
- }
31798
31570
  deselectRef.current();
31799
31571
  deactivateRef.current();
31800
31572
  clearMediaSelectionRef.current();
@@ -32631,10 +32403,10 @@ function OhhwellsBridge() {
32631
32403
  window.removeEventListener("message", handleDuplicateSection);
32632
32404
  window.removeEventListener("message", handleDeactivate);
32633
32405
  window.removeEventListener("message", handleSelectNav);
32406
+ document.documentElement.removeAttribute("data-ohw-panel-dragging");
32634
32407
  window.removeEventListener("message", handleToastAction);
32635
32408
  window.removeEventListener("message", handleFormCount);
32636
32409
  window.removeEventListener("message", handleUiEscape);
32637
- document.documentElement.removeAttribute("data-ohw-panel-dragging");
32638
32410
  autoSaveTimers.current.forEach(clearTimeout);
32639
32411
  autoSaveTimers.current.clear();
32640
32412
  if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
@@ -32928,7 +32700,7 @@ function OhhwellsBridge() {
32928
32700
  postToParent2({
32929
32701
  type: "ow:ready",
32930
32702
  version: "1",
32931
- bridgeVersion: "0.1.168-next.447",
32703
+ bridgeVersion: "0.1.169",
32932
32704
  path: pathname,
32933
32705
  nodes: collectEditableNodes(editContentRef.current),
32934
32706
  sections
@@ -33663,7 +33435,7 @@ function OhhwellsBridge() {
33663
33435
  className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/80",
33664
33436
  onClick: () => setFieldTypePickerOpen((open) => !open),
33665
33437
  "data-ohw-add-field": "",
33666
- children: /* @__PURE__ */ jsx40(Plus6, { size: 15, "aria-hidden": true })
33438
+ children: /* @__PURE__ */ jsx40(Plus5, { size: 15, "aria-hidden": true })
33667
33439
  }
33668
33440
  ),
33669
33441
  /* @__PURE__ */ jsx40("div", { className: "mx-0.5 h-5 w-px bg-border" }),