@ohhwells/bridge 0.1.170-next.453 → 0.1.171

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
 
@@ -1127,21 +1127,21 @@ function chromeFrom(sample) {
1127
1127
  };
1128
1128
  }
1129
1129
  function filledPrimary(seed) {
1130
- const paint2 = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
1131
- const luminance = relativeLuminance(paint2);
1130
+ const paint = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
1131
+ const luminance = relativeLuminance(paint);
1132
1132
  return {
1133
- background: toCss({ ...paint2, a: 1 }),
1133
+ background: toCss({ ...paint, a: 1 }),
1134
1134
  color: luminance > 0.55 ? "rgb(15, 15, 15)" : "rgb(255, 255, 255)",
1135
1135
  borderColor: TRANSPARENT,
1136
1136
  borderWidth: "0px"
1137
1137
  };
1138
1138
  }
1139
1139
  function generatedSecondary(primary) {
1140
- const paint2 = accentColor(primary);
1140
+ const paint = accentColor(primary);
1141
1141
  return {
1142
1142
  background: TRANSPARENT,
1143
- color: paint2,
1144
- borderColor: paint2,
1143
+ color: paint,
1144
+ borderColor: paint,
1145
1145
  borderWidth: "1px"
1146
1146
  };
1147
1147
  }
@@ -1154,9 +1154,9 @@ function generatedGhost(primary) {
1154
1154
  };
1155
1155
  }
1156
1156
  function normalizeOutlineChrome(outline, primary) {
1157
- const paint2 = accentColor(primary);
1157
+ const paint = accentColor(primary);
1158
1158
  const text = parseColor(outline.color);
1159
- const paintRgb = parseColor(paint2);
1159
+ const paintRgb = parseColor(paint);
1160
1160
  const primaryLabel = parseColor(primary.color);
1161
1161
  const matchesOnPrimary = Boolean(text && primaryLabel) && colorKey(outline.color) === colorKey(primary.color);
1162
1162
  const textTooLight = text ? relativeLuminance(text) > 0.7 : false;
@@ -1165,8 +1165,8 @@ function normalizeOutlineChrome(outline, primary) {
1165
1165
  const hasBorder = parseFloat(outline.borderWidth) > 0;
1166
1166
  return {
1167
1167
  ...outline,
1168
- color: paint2,
1169
- borderColor: hasBorder ? paint2 : outline.borderColor
1168
+ color: paint,
1169
+ borderColor: hasBorder ? paint : outline.borderColor
1170
1170
  };
1171
1171
  }
1172
1172
  function generateButtonVariants(samples) {
@@ -6762,21 +6762,6 @@ function pricingCardFeatureCount(tree, index) {
6762
6762
  const target = findPricingCollection(tree)?.children?.[index];
6763
6763
  return target ? pricingFeatureList(target).length : 0;
6764
6764
  }
6765
- function prevailingFeatureIcon(features) {
6766
- const counts = /* @__PURE__ */ new Map();
6767
- for (const row of features) {
6768
- const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
6769
- const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
6770
- entry.count += 1;
6771
- counts.set(key, entry);
6772
- }
6773
- let best = null;
6774
- for (const entry of counts.values()) {
6775
- if (!best || entry.count > best.count) best = entry;
6776
- }
6777
- if (!best) return {};
6778
- return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
6779
- }
6780
6765
  function addPricingCardFeature(tree, index, text) {
6781
6766
  return withPricingCollection(tree, (collection) => {
6782
6767
  const children = collection.children;
@@ -6785,7 +6770,7 @@ function addPricingCardFeature(tree, index, text) {
6785
6770
  const features = pricingFeatureList(target);
6786
6771
  if (features.length >= PRICING_FEATURES_MAX) return false;
6787
6772
  target.slots = target.slots ?? {};
6788
- target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
6773
+ target.slots.features = [...features, { text }];
6789
6774
  return true;
6790
6775
  });
6791
6776
  }
@@ -7429,120 +7414,6 @@ function findSelectableNavContainer(doc = document) {
7429
7414
  );
7430
7415
  }
7431
7416
 
7432
- // src/lib/youtube.ts
7433
- var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
7434
- function extractYouTubeId(input) {
7435
- const trimmed = input.trim();
7436
- if (!trimmed) return null;
7437
- if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
7438
- let url;
7439
- try {
7440
- url = new URL(trimmed);
7441
- } catch {
7442
- return null;
7443
- }
7444
- const host = url.hostname.replace(/^www\./, "");
7445
- if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
7446
- return null;
7447
- }
7448
- let candidate = null;
7449
- if (host === "youtu.be") {
7450
- candidate = url.pathname.slice(1).split("/")[0] ?? null;
7451
- } else if (url.pathname === "/watch") {
7452
- candidate = url.searchParams.get("v");
7453
- } else {
7454
- const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
7455
- candidate = match ? match[1] : null;
7456
- }
7457
- return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
7458
- }
7459
-
7460
- // src/lib/section-embed.ts
7461
- var SECTION_EMBED_SUFFIX = "__ohw_embed";
7462
- function readStoredEmbed(value) {
7463
- if (value.startsWith("start\n")) {
7464
- return { raw: value.slice("start\n".length), at: "start" };
7465
- }
7466
- return { raw: value, at: "end" };
7467
- }
7468
- function embedFrameSrc(value) {
7469
- const videoId = extractYouTubeId(value);
7470
- if (videoId) {
7471
- return { src: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0`, title: "YouTube video" };
7472
- }
7473
- let url;
7474
- try {
7475
- url = new URL(value);
7476
- } catch {
7477
- return null;
7478
- }
7479
- const host = url.hostname.replace(/^www\./, "").toLowerCase();
7480
- if (host === "google.com" && url.pathname.startsWith("/maps") || host === "maps.google.com") {
7481
- const query = url.searchParams.get("q") || url.searchParams.get("query") || "";
7482
- const src = query ? `https://maps.google.com/maps?q=${encodeURIComponent(query)}&output=embed` : `https://maps.google.com/maps?output=embed`;
7483
- return { src, title: "Map" };
7484
- }
7485
- if (host === "maps.app.goo.gl") {
7486
- return { src: value, title: "Map" };
7487
- }
7488
- if (host === "calendly.com" || host.endsWith(".calendly.com") || host === "calendar.google.com") {
7489
- return { src: value, title: "Calendar" };
7490
- }
7491
- if (host === "docs.google.com" && url.pathname.includes("/forms/")) {
7492
- return { src: value.replace(/\/edit(?:\?.*)?$/i, "/viewform"), title: "Form" };
7493
- }
7494
- if (host === "forms.gle") {
7495
- return { src: value, title: "Form" };
7496
- }
7497
- return null;
7498
- }
7499
- function place(section, box, at) {
7500
- if (at === "start") {
7501
- section.insertBefore(box, section.firstChild);
7502
- return;
7503
- }
7504
- section.appendChild(box);
7505
- }
7506
- function paint(section, key, src, title, at) {
7507
- const existing = section.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`);
7508
- const frame = existing?.querySelector("iframe");
7509
- if (existing && frame) {
7510
- if (frame.getAttribute("src") !== src) frame.setAttribute("src", src);
7511
- frame.title = title;
7512
- place(section, existing, at);
7513
- return;
7514
- }
7515
- existing?.remove();
7516
- const box = document.createElement("div");
7517
- box.setAttribute("data-ohw-section-embed", key);
7518
- 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;";
7519
- const frameWrap = document.createElement("div");
7520
- frameWrap.style.cssText = "position:relative;width:100%;aspect-ratio:16/9;min-height:250px;border-radius:12px;overflow:hidden;background:#0f172a;";
7521
- const iframe = document.createElement("iframe");
7522
- iframe.src = src;
7523
- iframe.title = title;
7524
- iframe.style.cssText = "position:absolute;inset:0;width:100%;height:100%;border:0;";
7525
- iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture";
7526
- iframe.setAttribute("allowfullscreen", "");
7527
- frameWrap.appendChild(iframe);
7528
- box.appendChild(frameWrap);
7529
- place(section, box, at);
7530
- }
7531
- function applySectionEmbeds(content) {
7532
- for (const [key, val] of Object.entries(content)) {
7533
- if (!key.endsWith(SECTION_EMBED_SUFFIX)) continue;
7534
- const sectionId = key.slice(0, -SECTION_EMBED_SUFFIX.length);
7535
- const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
7536
- const stored = typeof val === "string" ? readStoredEmbed(val) : null;
7537
- const frame = stored ? embedFrameSrc(stored.raw) : null;
7538
- if (!section || !stored || !frame) {
7539
- section?.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`)?.remove();
7540
- continue;
7541
- }
7542
- paint(section, key, frame.src, frame.title, stored.at);
7543
- }
7544
- }
7545
-
7546
7417
  // src/ui/ai-tree/aiSectionsManager.tsx
7547
7418
  import { flushSync } from "react-dom";
7548
7419
  import { createRoot } from "react-dom/client";
@@ -8116,7 +7987,7 @@ var AI_MOBILE_CSS = [
8116
7987
  // page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
8117
7988
  // template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
8118
7989
  // an exact figure from (no live measurement exists), so this is a safe approximation, not a
8119
- // pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
7990
+ // pixel-exact fit. Horizontal spacing already comes from `data-ai-container`.
8120
7991
  '[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
8121
7992
  // A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
8122
7993
  // window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
@@ -8132,10 +8003,8 @@ var AI_MOBILE_CSS = [
8132
8003
  "[data-ai-section]{overflow-x:hidden}",
8133
8004
  // `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
8134
8005
  // full-bleed section's container sets, so a carousel/media hero that is edge-to-edge on desktop
8135
- // still got a 20px band of section background down both sides on a phone. The footer's own
8136
- // container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
8137
- "[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
8138
- "[data-ai-container]{padding:0 20px !important}",
8006
+ // still got a 20px band of section background down both sides on a phone.
8007
+ "[data-ai-container]:not([data-ai-full-bleed]){padding:0 20px !important}",
8139
8008
  "[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
8140
8009
  "[data-ai-cell]{width:100%;min-width:0}",
8141
8010
  // The rule above turns every row into a COLUMN flex container on phones, which silently breaks
@@ -8340,31 +8209,6 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
8340
8209
  function textAttrs(ctx, path) {
8341
8210
  return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
8342
8211
  }
8343
- var AI_RESPONSIVE_CSS = [
8344
- "@media (max-width: 960px) {",
8345
- " [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
8346
- ' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
8347
- "}",
8348
- "@media (max-width: 640px) {",
8349
- " [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
8350
- " [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
8351
- // Group containers flatten to a column on phones; span placements come along for free.
8352
- // `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
8353
- // the comment there. This sheet's copy is the narrower selector, so without the exemption it
8354
- // flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
8355
- // viewport with the heading/CTA in flow *under* the image, 219px of section background where the
8356
- // layered text used to be.
8357
- ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
8358
- ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
8359
- // `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
8360
- // is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
8361
- // a full-bleed hero gets its 20px side band back below 640px only — the one width where the
8362
- // other rule had already been taught to stand down.
8363
- " [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
8364
- " [data-ai-responsive] { overflow-x: hidden; }",
8365
- " [data-ai-responsive] img { max-width: 100%; }",
8366
- "}"
8367
- ].join("\n");
8368
8212
  var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
8369
8213
  function MediaBox({
8370
8214
  refValue,
@@ -8419,7 +8263,7 @@ function MediaBox({
8419
8263
  position: fill ? "absolute" : void 0,
8420
8264
  inset: fill ? 0 : void 0,
8421
8265
  width: fill ? "100%" : fixedSize ? "auto" : "100%",
8422
- height: fill ? "100%" : fixedSize ? height : void 0,
8266
+ height: fill ? "100%" : void 0,
8423
8267
  aspectRatio: fill ? void 0 : aspectRatio,
8424
8268
  minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
8425
8269
  borderRadius: radius,
@@ -9915,7 +9759,7 @@ function CollectionBlock({ node, ctx, path }) {
9915
9759
  return /* @__PURE__ */ jsx(
9916
9760
  "div",
9917
9761
  {
9918
- "data-ai-grid": String(itemsPerRow),
9762
+ "data-ai-grid": "",
9919
9763
  "data-ohw-pricing-collection": isPricing ? "" : void 0,
9920
9764
  style: {
9921
9765
  display: "grid",
@@ -10217,7 +10061,7 @@ function renderNode(node, ctx, path, ambientAlign) {
10217
10061
  },
10218
10062
  children: [
10219
10063
  i > 0 && ctx.heroOverlapFullBleed ? (
10220
- // The section's `data-ai-section-inner` gave up its max-width/gutter so the base
10064
+ // The section's `data-ai-container` gave up its max-width/gutter so the base
10221
10065
  // layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
10222
10066
  // scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
10223
10067
  // the full section width instead of reading at the usual content width.
@@ -10636,7 +10480,6 @@ function AiTreeRenderer({
10636
10480
  ...fillHeight ? { "data-ai-fill-height": "" } : {},
10637
10481
  ...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
10638
10482
  ...bgAttrs,
10639
- "data-ai-responsive": "",
10640
10483
  style: {
10641
10484
  position: "relative",
10642
10485
  padding: `${padCss} 0`,
@@ -10650,13 +10493,12 @@ function AiTreeRenderer({
10650
10493
  ...fillHeight ? { display: "grid" } : {}
10651
10494
  },
10652
10495
  children: [
10653
- /* @__PURE__ */ jsx("style", { children: AI_RESPONSIVE_CSS }),
10654
- /* @__PURE__ */ jsx("style", { children: AI_MOBILE_CSS }),
10655
10496
  isOverlay && backgroundUrl && /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
10497
+ /* @__PURE__ */ jsx("style", { children: AI_MOBILE_CSS }),
10656
10498
  /* @__PURE__ */ jsx(
10657
10499
  "div",
10658
10500
  {
10659
- "data-ai-section-inner": "",
10501
+ "data-ai-container": "",
10660
10502
  ...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
10661
10503
  style: {
10662
10504
  position: "relative",
@@ -10673,7 +10515,7 @@ function AiTreeRenderer({
10673
10515
  children: tree.rows.map((row, r2) => /* @__PURE__ */ jsx(
10674
10516
  "div",
10675
10517
  {
10676
- "data-ai-columns": "",
10518
+ "data-ai-row": "",
10677
10519
  style: {
10678
10520
  display: "grid",
10679
10521
  gridTemplateColumns: "repeat(12, 1fr)",
@@ -11335,10 +11177,9 @@ function applyAiSectionsToDom(state, options) {
11335
11177
  if (existing && existing.serialized === serialized && existing.container.isConnected) {
11336
11178
  continue;
11337
11179
  }
11180
+ const isNewMount = !existing || !existing.container.isConnected;
11338
11181
  let container = existing?.container;
11339
- let isNewMount = false;
11340
11182
  if (!container || !container.isConnected) {
11341
- isNewMount = true;
11342
11183
  existing?.root.unmount();
11343
11184
  container?.remove();
11344
11185
  container = document.createElement("div");
@@ -11676,34 +11517,6 @@ function minSpanForFooterBlock(type) {
11676
11517
  return 3;
11677
11518
  }
11678
11519
  }
11679
- function readLiveSocialItems() {
11680
- const root = getFooterRoot();
11681
- const row = root?.querySelector("[data-ohw-socials-row]");
11682
- if (!row) return [];
11683
- const items = [];
11684
- for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
11685
- const href = anchor.getAttribute("href")?.trim() ?? "";
11686
- const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
11687
- const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
11688
- if (!platform || !/^https?:\/\//i.test(href)) continue;
11689
- items.push({ platform, href });
11690
- }
11691
- return items;
11692
- }
11693
- function syncSocialRowsFromDom(tree) {
11694
- const root = getFooterRoot();
11695
- if (!root) return;
11696
- const row = root.querySelector("[data-ohw-socials-row]");
11697
- const live = readLiveSocialItems();
11698
- if (row && live.length === 0) return;
11699
- for (const col of tree.columns) {
11700
- col.blocks = col.blocks.flatMap((block) => {
11701
- if (block.type !== "social-row") return [block];
11702
- if (!row) return [];
11703
- return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
11704
- });
11705
- }
11706
- }
11707
11520
  function collectBrandBlocks(tree) {
11708
11521
  const brand = [];
11709
11522
  for (const col of tree.columns) {
@@ -11949,7 +11762,6 @@ function textOf2(el) {
11949
11762
  }
11950
11763
  function syncFooterTreeLinksFromDom(tree) {
11951
11764
  const next = cloneTree(tree);
11952
- syncSocialRowsFromDom(next);
11953
11765
  const domCols = listFooterColumns().map((col) => {
11954
11766
  const heading = getFooterColumnHeadingEl(col);
11955
11767
  const title = heading ? textOf2(heading) : void 0;
@@ -17762,7 +17574,7 @@ function apiBase() {
17762
17574
  function bridgeVersion() {
17763
17575
  try {
17764
17576
  if (true) {
17765
- return "0.1.170-next.453";
17577
+ return "0.1.171";
17766
17578
  }
17767
17579
  } catch {
17768
17580
  }
@@ -17776,7 +17588,7 @@ function stampBridgeVersionOnDocument() {
17776
17588
  return;
17777
17589
  }
17778
17590
  try {
17779
- const v = true ? "0.1.170-next.453" : "";
17591
+ const v = true ? "0.1.171" : "";
17780
17592
  if (v) {
17781
17593
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
17782
17594
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -18456,7 +18268,6 @@ function MediaOverlay({
18456
18268
  (prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
18457
18269
  );
18458
18270
  }, [isVideo]);
18459
- const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
18460
18271
  const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
18461
18272
  const box = {
18462
18273
  position: "fixed",
@@ -18555,10 +18366,11 @@ function MediaOverlay({
18555
18366
  className: "flex items-center justify-center cursor-pointer",
18556
18367
  style: {
18557
18368
  ...box,
18558
- // Visual only. `pointer-events: auto` on this full-bleed rect covered the navbar
18559
- // (hero bg includes the absolute TopNav) and swallowed CTA press-drag. Text overlay
18560
- // and cueOnly also need clicks to fall through — Replace / video controls opt back in.
18561
- pointerEvents: "none",
18369
+ // When text overlays this media, let clicks fall THROUGH to the text underneath. In the
18370
+ // parent this needed a whole `ow:click-at` round-trip to re-hit-test inside the iframe;
18371
+ // in-document, pointer-events does it natively. The button below opts back in, so
18372
+ // Replace still works.
18373
+ pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
18562
18374
  // Selected: a firm component ring with no wash, so the image reads as chosen rather
18563
18375
  // than hovered. Hover keeps the existing tinted preview.
18564
18376
  boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
@@ -18585,17 +18397,17 @@ function MediaOverlay({
18585
18397
  },
18586
18398
  children: [
18587
18399
  isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
18588
- replaceLabel
18400
+ isVideo ? "Replace video" : "Replace image"
18589
18401
  ]
18590
18402
  }
18591
18403
  ),
18592
- showChrome && replaceMode !== "none" && /* @__PURE__ */ jsxs8(
18404
+ replaceMode === "none" || cueOnly ? null : /* @__PURE__ */ jsxs8(
18593
18405
  Button,
18594
18406
  {
18595
18407
  "data-ohw-media-overlay": "",
18596
18408
  variant: "outline",
18597
18409
  size: "sm",
18598
- "aria-label": replaceLabel,
18410
+ "aria-label": isVideo ? "Replace video" : "Replace image",
18599
18411
  className: "gap-1.5 cursor-pointer hover:bg-background",
18600
18412
  style: {
18601
18413
  ...OVERLAY_BUTTON_STYLE,
@@ -18618,7 +18430,7 @@ function MediaOverlay({
18618
18430
  },
18619
18431
  children: [
18620
18432
  isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
18621
- replaceMode === "full" ? replaceLabel : null
18433
+ replaceMode === "full" ? isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image" : null
18622
18434
  ]
18623
18435
  }
18624
18436
  )
@@ -19249,24 +19061,8 @@ function AiSectionOverlay({
19249
19061
  }
19250
19062
 
19251
19063
  // src/ui/ai-section/AiMediaStripOverlay.tsx
19252
- import { useCallback as useCallback3, useEffect as useEffect9, useLayoutEffect as useLayoutEffect4, useRef as useRef5, useState as useState8 } from "react";
19253
- import {
19254
- AlignCenter,
19255
- AlignLeft,
19256
- AlignRight,
19257
- ArrowLeft as ArrowLeft2,
19258
- ArrowRight as ArrowRight2,
19259
- Check as Check2,
19260
- ChevronDown as ChevronDown3,
19261
- Image as ImageIcon2,
19262
- ImageMinus,
19263
- ImagePlus,
19264
- Link as LinkIcon,
19265
- Minus,
19266
- Palette,
19267
- Plus as Plus2,
19268
- Star
19269
- } from "lucide-react";
19064
+ import { useCallback as useCallback3, useEffect as useEffect9, useRef as useRef5, useState as useState8 } from "react";
19065
+ import { Star } from "lucide-react";
19270
19066
 
19271
19067
  // src/lib/ai-media-strip-tree.ts
19272
19068
  var MEDIA_STRIP_ITEM_MIN = 1;
@@ -19380,6 +19176,14 @@ function setMediaStripItemAsset(tree, index, assetId) {
19380
19176
  return true;
19381
19177
  });
19382
19178
  }
19179
+ function setMediaStripItemAlt(tree, index, alt) {
19180
+ return withMediaStrip(tree, (block) => {
19181
+ const items = block.items;
19182
+ if (index < 0 || index >= items.length) return false;
19183
+ items[index] = { ...items[index], alt };
19184
+ return true;
19185
+ });
19186
+ }
19383
19187
  function setMediaStripItemLink(tree, index, link) {
19384
19188
  return withMediaStrip(tree, (block) => {
19385
19189
  const items = block.items;
@@ -19397,117 +19201,11 @@ function setMediaStripItemLink(tree, index, link) {
19397
19201
  });
19398
19202
  }
19399
19203
 
19400
- // src/ui/dialog.tsx
19401
- import * as React9 from "react";
19402
- import { Dialog as DialogPrimitive } from "radix-ui";
19403
- import { X as X2 } from "lucide-react";
19404
- import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
19405
- function Dialog2({
19406
- ...props
19407
- }) {
19408
- return /* @__PURE__ */ jsx20(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
19409
- }
19410
- function DialogPortal({
19411
- ...props
19412
- }) {
19413
- return /* @__PURE__ */ jsx20(DialogPrimitive.Portal, { ...props });
19414
- }
19415
- function DialogOverlay({
19416
- className,
19417
- ...props
19418
- }) {
19419
- return /* @__PURE__ */ jsx20(
19420
- DialogPrimitive.Overlay,
19421
- {
19422
- "data-slot": "dialog-overlay",
19423
- "data-ohw-link-modal-root": "",
19424
- className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
19425
- ...props
19426
- }
19427
- );
19428
- }
19429
- var DialogContent = React9.forwardRef(
19430
- ({ className, children, showCloseButton = true, container, ...props }, ref) => {
19431
- const positionMode = container ? "absolute" : "fixed";
19432
- return /* @__PURE__ */ jsxs11(DialogPortal, { container: container ?? void 0, children: [
19433
- /* @__PURE__ */ jsx20(DialogOverlay, { className: cn(positionMode, "inset-0") }),
19434
- /* @__PURE__ */ jsxs11(
19435
- DialogPrimitive.Content,
19436
- {
19437
- ref,
19438
- "data-slot": "dialog-content",
19439
- className: cn(
19440
- positionMode,
19441
- "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",
19442
- "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
19443
- container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
19444
- className
19445
- ),
19446
- onMouseDown: (e) => e.stopPropagation(),
19447
- ...props,
19448
- children: [
19449
- children,
19450
- showCloseButton ? /* @__PURE__ */ jsx20(
19451
- DialogPrimitive.Close,
19452
- {
19453
- type: "button",
19454
- className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
19455
- "aria-label": "Close",
19456
- children: /* @__PURE__ */ jsx20(X2, { size: 16, "aria-hidden": true })
19457
- }
19458
- ) : null
19459
- ]
19460
- }
19461
- )
19462
- ] });
19463
- }
19464
- );
19465
- DialogContent.displayName = DialogPrimitive.Content.displayName;
19466
- function DialogHeader({
19467
- className,
19468
- ...props
19469
- }) {
19470
- return /* @__PURE__ */ jsx20("div", { className: cn("flex flex-col gap-1.5", className), ...props });
19471
- }
19472
- function DialogFooter({
19473
- className,
19474
- ...props
19475
- }) {
19476
- return /* @__PURE__ */ jsx20(
19477
- "div",
19478
- {
19479
- className: cn("flex items-center justify-end gap-2", className),
19480
- ...props
19481
- }
19482
- );
19483
- }
19484
- var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
19485
- DialogPrimitive.Title,
19486
- {
19487
- ref,
19488
- className: cn(
19489
- "text-lg font-semibold leading-none tracking-tight text-card-foreground",
19490
- className
19491
- ),
19492
- ...props
19493
- }
19494
- ));
19495
- DialogTitle.displayName = DialogPrimitive.Title.displayName;
19496
- var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
19497
- DialogPrimitive.Description,
19498
- {
19499
- ref,
19500
- className: cn("text-sm text-muted-foreground", className),
19501
- ...props
19502
- }
19503
- ));
19504
- DialogDescription.displayName = DialogPrimitive.Description.displayName;
19505
- var DialogClose = DialogPrimitive.Close;
19506
-
19507
19204
  // src/ui/ai-section/AiMediaStripOverlay.tsx
19508
- import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
19509
- var PRIMARY3 = "var(--ohw-primary, #0885FE)";
19510
- 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]";
19205
+ import { Fragment as Fragment7, jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
19206
+ var PRIMARY3 = "#0885FE";
19207
+ var OHW_BLUE = `var(--ohw-primary, ${PRIMARY3})`;
19208
+ var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
19511
19209
  function findMediaStripItemElement(sectionId, index) {
19512
19210
  const sectionEl2 = findByInstanceId(sectionId);
19513
19211
  if (!sectionEl2) return null;
@@ -19517,35 +19215,14 @@ function findMediaStripItemElement(sectionId, index) {
19517
19215
  }
19518
19216
  return null;
19519
19217
  }
19520
- function itemRefFromTarget(target) {
19521
- if (!(target instanceof Element)) return null;
19522
- if (target.closest(CHROME_SELECTOR)) return null;
19523
- const itemEl = target.closest("[data-ohw-media-strip-item]");
19524
- if (!itemEl) return null;
19525
- const sectionEl2 = itemEl.closest("[data-ohw-section]");
19526
- const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
19527
- const sectionId = unit ? instanceIdOf(unit) || null : null;
19528
- const index = Number(itemEl.dataset.ohwMediaStripIndex);
19529
- if (!sectionId || Number.isNaN(index)) return null;
19530
- return { sectionId, index };
19531
- }
19532
- function sameRef(a, b) {
19533
- return a?.sectionId === b?.sectionId && a?.index === b?.index;
19534
- }
19535
- function rectOf(el) {
19218
+ function readRect2(ref) {
19219
+ const el = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19536
19220
  if (!el) return null;
19537
19221
  const r2 = el.getBoundingClientRect();
19538
19222
  if (r2.width <= 0 || r2.height <= 0) return null;
19539
19223
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
19540
19224
  }
19541
- function readRect2(ref) {
19542
- return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
19543
- }
19544
- function readStripRect(ref) {
19545
- const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19546
- return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
19547
- }
19548
- function useLiveItemRect(ref, strip = false) {
19225
+ function useLiveItemRect(ref) {
19549
19226
  const [rect, setRect] = useState8(null);
19550
19227
  useEffect9(() => {
19551
19228
  if (!ref) {
@@ -19553,7 +19230,7 @@ function useLiveItemRect(ref, strip = false) {
19553
19230
  return;
19554
19231
  }
19555
19232
  const update = () => {
19556
- const next = strip ? readStripRect(ref) : readRect2(ref);
19233
+ const next = readRect2(ref);
19557
19234
  setRect(
19558
19235
  (prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
19559
19236
  );
@@ -19568,49 +19245,9 @@ function useLiveItemRect(ref, strip = false) {
19568
19245
  window.removeEventListener("resize", update);
19569
19246
  clearInterval(interval);
19570
19247
  };
19571
- }, [ref?.sectionId, ref?.index, strip]);
19248
+ }, [ref?.sectionId, ref?.index]);
19572
19249
  return rect;
19573
19250
  }
19574
- var TOOLBAR_STRIP_GAP = 52;
19575
- var TOOLBAR_STRIP_GAP_MOBILE = 42;
19576
- var TOOLBAR_EDGE_MARGIN2 = 4;
19577
- function StripToolbarSlot({ stripRect, children }) {
19578
- const slotRef = useRef5(null);
19579
- const [shift, setShift] = useState8(0);
19580
- const centerX = stripRect.left + stripRect.width / 2;
19581
- useLayoutEffect4(() => {
19582
- const slot = slotRef.current;
19583
- if (!slot) return;
19584
- const clamp = () => {
19585
- const w = slot.offsetWidth;
19586
- if (w <= 0) return;
19587
- const half = w / 2;
19588
- const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
19589
- setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
19590
- };
19591
- clamp();
19592
- const ro = new ResizeObserver(clamp);
19593
- ro.observe(slot);
19594
- return () => ro.disconnect();
19595
- }, [centerX, children]);
19596
- const mobile = window.innerWidth <= 480;
19597
- return /* @__PURE__ */ jsx21(
19598
- "div",
19599
- {
19600
- ref: slotRef,
19601
- "data-ohw-bridge": "",
19602
- "data-ohw-item-interaction": "",
19603
- className: "pointer-events-auto fixed",
19604
- style: {
19605
- top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
19606
- left: centerX + shift,
19607
- transform: "translate(-50%, -100%)",
19608
- zIndex: 2147483645
19609
- },
19610
- children
19611
- }
19612
- );
19613
- }
19614
19251
  function requestValidateTree(postToParent2, tree) {
19615
19252
  return new Promise((resolve) => {
19616
19253
  const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
@@ -19647,72 +19284,116 @@ function requestAssetPick(postToParent2) {
19647
19284
  postToParent2({ type: "ow:asset-pick", id });
19648
19285
  });
19649
19286
  }
19650
- function ToolbarAction({
19287
+ function Pill({
19651
19288
  label,
19652
19289
  onClick,
19653
- disabled = false,
19654
- active = false,
19655
- children
19290
+ disabled,
19291
+ active
19656
19292
  }) {
19657
- const button = /* @__PURE__ */ jsx21(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
19658
- return /* @__PURE__ */ jsxs12(Tooltip, { children: [
19659
- /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: button }) : button }),
19660
- /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
19661
- ] });
19662
- }
19663
- function ToolbarSeparator() {
19664
- return /* @__PURE__ */ jsx21("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
19293
+ return /* @__PURE__ */ jsx20(
19294
+ "button",
19295
+ {
19296
+ type: "button",
19297
+ onClick,
19298
+ disabled,
19299
+ style: {
19300
+ height: 28,
19301
+ padding: "0 10px",
19302
+ display: "inline-flex",
19303
+ alignItems: "center",
19304
+ gap: 4,
19305
+ borderRadius: 999,
19306
+ border: "none",
19307
+ cursor: disabled ? "default" : "pointer",
19308
+ background: active ? OHW_BLUE_DARK : "#ffffff",
19309
+ color: active ? "#ffffff" : OHW_BLUE_DARK,
19310
+ opacity: disabled ? 0.4 : 1,
19311
+ fontSize: 12,
19312
+ lineHeight: "16px",
19313
+ fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19314
+ whiteSpace: "nowrap",
19315
+ flex: "0 0 auto"
19316
+ },
19317
+ children: label
19318
+ }
19319
+ );
19665
19320
  }
19666
- function OptionMenu({
19667
- label,
19668
- value,
19669
- options,
19670
- onChange
19671
- }) {
19672
- const current = options.find((o) => o.value === value) ?? options[0];
19673
- return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
19674
- /* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground", children: label }),
19675
- /* @__PURE__ */ jsxs12(DropdownMenu, { modal: false, children: [
19676
- /* @__PURE__ */ jsx21(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs12(
19677
- "button",
19678
- {
19679
- type: "button",
19680
- "aria-label": label,
19681
- 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",
19682
- children: [
19683
- /* @__PURE__ */ jsx21("span", { className: "flex-1 text-left", children: current.label }),
19684
- /* @__PURE__ */ jsx21(ChevronDown3, { size: 16, style: { pointerEvents: "none" } })
19685
- ]
19686
- }
19687
- ) }),
19688
- /* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
19689
- const selected = option.value === value;
19690
- return /* @__PURE__ */ jsxs12(
19691
- DropdownMenuItem,
19321
+ function AltInput({ value, onCommit }) {
19322
+ const [draft, setDraft] = useState8(value);
19323
+ useEffect9(() => setDraft(value), [value]);
19324
+ return /* @__PURE__ */ jsxs11(
19325
+ "div",
19326
+ {
19327
+ style: {
19328
+ display: "flex",
19329
+ alignItems: "center",
19330
+ gap: 6,
19331
+ height: 28,
19332
+ padding: "0 12px",
19333
+ borderRadius: 999,
19334
+ background: "#ffffff",
19335
+ width: "100%",
19336
+ maxWidth: 260,
19337
+ boxSizing: "border-box"
19338
+ },
19339
+ children: [
19340
+ /* @__PURE__ */ jsx20(
19341
+ "span",
19692
19342
  {
19693
- role: "menuitemradio",
19694
- "aria-checked": selected,
19695
- onSelect: () => onChange(option.value),
19696
- className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
19697
- children: [
19698
- /* @__PURE__ */ jsx21("span", { children: option.label }),
19699
- selected && /* @__PURE__ */ jsx21(Check2, { size: 16, className: "text-bridge-primary" })
19700
- ]
19701
- },
19702
- option.value
19703
- );
19704
- }) })
19705
- ] })
19706
- ] });
19343
+ style: {
19344
+ flex: "0 0 auto",
19345
+ color: OHW_BLUE_DARK,
19346
+ fontSize: 10,
19347
+ fontWeight: 700,
19348
+ textTransform: "uppercase",
19349
+ letterSpacing: 0.4
19350
+ },
19351
+ children: "Alt"
19352
+ }
19353
+ ),
19354
+ /* @__PURE__ */ jsx20(
19355
+ "input",
19356
+ {
19357
+ type: "text",
19358
+ value: draft,
19359
+ onChange: (e) => setDraft(e.target.value),
19360
+ onBlur: () => {
19361
+ if (draft !== value) onCommit(draft);
19362
+ },
19363
+ onKeyDown: (e) => {
19364
+ if (e.key === "Enter") e.currentTarget.blur();
19365
+ if (e.key === "Escape") {
19366
+ setDraft(value);
19367
+ e.currentTarget.blur();
19368
+ }
19369
+ },
19370
+ placeholder: "Describe this image",
19371
+ "aria-label": "Image alt text",
19372
+ style: {
19373
+ flex: 1,
19374
+ minWidth: 0,
19375
+ border: "none",
19376
+ outline: "none",
19377
+ background: "transparent",
19378
+ fontSize: 12,
19379
+ lineHeight: "16px",
19380
+ fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19381
+ color: "#1f2937"
19382
+ }
19383
+ }
19384
+ )
19385
+ ]
19386
+ }
19387
+ );
19707
19388
  }
19708
19389
  var VARIANTS = [
19709
19390
  { value: "logos", label: "Logos" },
19710
19391
  { value: "reel", label: "Reel" }
19711
19392
  ];
19712
19393
  var ALIGNS = [
19713
- { value: "left", label: "Align left", Icon: AlignLeft },
19714
- { value: "center", label: "Align center", Icon: AlignCenter },
19715
- { value: "right", label: "Align right", Icon: AlignRight }
19394
+ { value: "left", label: "Left" },
19395
+ { value: "center", label: "Center" },
19396
+ { value: "right", label: "Right" }
19716
19397
  ];
19717
19398
  var HOVERS = [
19718
19399
  { value: "none", label: "None" },
@@ -19720,104 +19401,104 @@ var HOVERS = [
19720
19401
  { value: "zoom", label: "Zoom" },
19721
19402
  { value: "fade", label: "Fade" }
19722
19403
  ];
19404
+ var TREATMENTS = [
19405
+ { value: "color", label: "Color" },
19406
+ { value: "grayscale", label: "Grayscale" }
19407
+ ];
19723
19408
  var HTTP_URL_RE = /^https?:\/\/\S+$/i;
19724
- function LinkModal({
19725
- href,
19726
- linkTarget,
19727
- onClose,
19728
- onSave
19729
- }) {
19730
- const [draft, setDraft] = useState8(href);
19731
- const [newTab, setNewTab] = useState8(linkTarget !== "same-tab");
19409
+ function LinkInput({ value, onCommit }) {
19410
+ const [draft, setDraft] = useState8(value);
19732
19411
  const [invalid, setInvalid] = useState8(false);
19733
- const save = () => {
19412
+ useEffect9(() => {
19413
+ setDraft(value);
19414
+ setInvalid(false);
19415
+ }, [value]);
19416
+ const commit2 = () => {
19734
19417
  const next = draft.trim();
19735
- if (next && !HTTP_URL_RE.test(next)) {
19736
- setInvalid(true);
19737
- return;
19738
- }
19739
- onSave(next, newTab ? "new-tab" : "same-tab");
19740
- onClose();
19418
+ if (next === value) return setInvalid(false);
19419
+ if (next && !HTTP_URL_RE.test(next)) return setInvalid(true);
19420
+ setInvalid(false);
19421
+ onCommit(next);
19741
19422
  };
19742
- 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: [
19743
- /* @__PURE__ */ jsx21(DialogHeader, { children: /* @__PURE__ */ jsx21(DialogTitle, { className: "text-base", children: "Image link" }) }),
19744
- /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-3", children: [
19745
- /* @__PURE__ */ jsx21(
19746
- "input",
19747
- {
19748
- autoFocus: true,
19749
- type: "text",
19750
- inputMode: "url",
19751
- value: draft,
19752
- onChange: (e) => {
19753
- setDraft(e.target.value);
19754
- setInvalid(false);
19755
- },
19756
- onKeyDown: (e) => {
19757
- if (e.key === "Enter") save();
19758
- },
19759
- placeholder: "https://example.com",
19760
- "aria-label": "Image link URL",
19761
- "aria-invalid": invalid,
19762
- className: cn(
19763
- "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",
19764
- invalid && "border-destructive focus:border-destructive"
19765
- )
19766
- }
19767
- ),
19768
- invalid && /* @__PURE__ */ jsx21("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
19769
- /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
19770
- /* @__PURE__ */ jsx21("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
19771
- "Open in new tab"
19772
- ] })
19773
- ] }),
19774
- /* @__PURE__ */ jsxs12(DialogFooter, { children: [
19775
- href && /* @__PURE__ */ jsx21(
19776
- "button",
19777
- {
19778
- type: "button",
19779
- onClick: () => {
19780
- onSave("", "new-tab");
19781
- onClose();
19782
- },
19783
- className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
19784
- children: "Remove link"
19785
- }
19786
- ),
19787
- /* @__PURE__ */ jsx21(
19788
- "button",
19789
- {
19790
- type: "button",
19791
- onClick: onClose,
19792
- className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
19793
- children: "Cancel"
19794
- }
19795
- ),
19796
- /* @__PURE__ */ jsx21(
19797
- "button",
19798
- {
19799
- type: "button",
19800
- onClick: save,
19801
- className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
19802
- children: "Save"
19803
- }
19804
- )
19805
- ] })
19806
- ] }) });
19423
+ return /* @__PURE__ */ jsxs11(
19424
+ "div",
19425
+ {
19426
+ style: {
19427
+ display: "flex",
19428
+ alignItems: "center",
19429
+ gap: 6,
19430
+ height: 28,
19431
+ padding: "0 12px",
19432
+ borderRadius: 999,
19433
+ background: "#ffffff",
19434
+ width: "100%",
19435
+ maxWidth: 260,
19436
+ boxSizing: "border-box",
19437
+ boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
19438
+ },
19439
+ children: [
19440
+ /* @__PURE__ */ jsx20(
19441
+ "span",
19442
+ {
19443
+ style: {
19444
+ flex: "0 0 auto",
19445
+ color: OHW_BLUE_DARK,
19446
+ fontSize: 10,
19447
+ fontWeight: 700,
19448
+ textTransform: "uppercase",
19449
+ letterSpacing: 0.4
19450
+ },
19451
+ children: "Link"
19452
+ }
19453
+ ),
19454
+ /* @__PURE__ */ jsx20(
19455
+ "input",
19456
+ {
19457
+ type: "text",
19458
+ inputMode: "url",
19459
+ value: draft,
19460
+ onChange: (e) => setDraft(e.target.value),
19461
+ onBlur: commit2,
19462
+ onKeyDown: (e) => {
19463
+ if (e.key === "Enter") e.currentTarget.blur();
19464
+ if (e.key === "Escape") {
19465
+ setDraft(value);
19466
+ setInvalid(false);
19467
+ e.currentTarget.blur();
19468
+ }
19469
+ },
19470
+ placeholder: "https://example.com",
19471
+ "aria-label": "Image link URL",
19472
+ "aria-invalid": invalid,
19473
+ style: {
19474
+ flex: 1,
19475
+ minWidth: 0,
19476
+ border: "none",
19477
+ outline: "none",
19478
+ background: "transparent",
19479
+ fontSize: 12,
19480
+ lineHeight: "16px",
19481
+ fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19482
+ color: "#1f2937"
19483
+ }
19484
+ }
19485
+ )
19486
+ ]
19487
+ }
19488
+ );
19807
19489
  }
19808
19490
  function MediaStripToolbar({
19809
19491
  entry,
19810
19492
  index,
19811
19493
  pending,
19812
19494
  error,
19813
- itemEditOn,
19814
- onToggleItemEdit,
19815
19495
  onSetVariant,
19816
19496
  onSetAlign,
19817
19497
  onSetHover,
19818
19498
  onSetTreatment,
19819
19499
  onResize,
19820
- onOpenLink,
19500
+ onSetAlt,
19501
+ onSetLink,
19821
19502
  onAddItem,
19822
19503
  onRemoveItem,
19823
19504
  onChangeImage,
@@ -19826,102 +19507,81 @@ function MediaStripToolbar({
19826
19507
  }) {
19827
19508
  const items = mediaStripItems(entry.tree);
19828
19509
  const itemCount = items.length;
19510
+ const currentAlt = items[index]?.alt ?? "";
19511
+ const currentHref2 = items[index]?.href ?? "";
19512
+ const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
19829
19513
  const slots = findMediaStripSlots(entry.tree);
19830
19514
  const variant = slots?.variant === "reel" ? "reel" : "logos";
19831
19515
  const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
19832
19516
  const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
19833
19517
  const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
19834
19518
  const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19835
- const mobile = window.innerWidth <= 480;
19836
- const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
19837
- return /* @__PURE__ */ jsx21(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs12(
19519
+ const isMobile = window.innerWidth <= 480;
19520
+ const rowStyle = isMobile ? {
19521
+ display: "flex",
19522
+ gap: 6,
19523
+ flexWrap: "nowrap",
19524
+ justifyContent: "center",
19525
+ overflowX: "auto",
19526
+ WebkitOverflowScrolling: "touch",
19527
+ width: "100%",
19528
+ scrollbarWidth: "none"
19529
+ } : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
19530
+ return /* @__PURE__ */ jsxs11(
19838
19531
  "div",
19839
19532
  {
19840
19533
  "data-ohw-bridge": "",
19841
19534
  "data-ohw-toolbar": "",
19842
19535
  onMouseDown: (e) => e.stopPropagation(),
19843
- className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
19844
- style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
19536
+ style: {
19537
+ display: "flex",
19538
+ flexDirection: "column",
19539
+ gap: 6,
19540
+ alignItems: "center",
19541
+ background: OHW_BLUE,
19542
+ padding: 8,
19543
+ borderRadius: 12,
19544
+ boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
19545
+ pointerEvents: pending ? "none" : "auto",
19546
+ opacity: pending ? 0.6 : 1,
19547
+ maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
19548
+ },
19845
19549
  children: [
19846
- /* @__PURE__ */ jsxs12(
19847
- "div",
19848
- {
19849
- className: cn(
19850
- "flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
19851
- "shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
19852
- mobile ? "flex-wrap justify-center" : "flex-nowrap"
19853
- ),
19854
- children: [
19855
- /* @__PURE__ */ jsxs12(Tooltip, { children: [
19856
- /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
19857
- CustomToolbarButton,
19858
- {
19859
- type: "button",
19860
- "aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
19861
- "aria-pressed": itemEditOn,
19862
- onClick: onToggleItemEdit,
19863
- className: "group size-8",
19864
- children: /* @__PURE__ */ jsx21(
19865
- Star,
19866
- {
19867
- size: 16,
19868
- fill: "currentColor",
19869
- strokeWidth: 0,
19870
- className: cn(
19871
- "transition-colors",
19872
- itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
19873
- ),
19874
- style: { pointerEvents: "none" }
19875
- }
19876
- )
19877
- }
19878
- ) }),
19879
- /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
19880
- ] }),
19881
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19882
- /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(ImageIcon2, { size: 16, style: { pointerEvents: "none" } }) }),
19883
- /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(LinkIcon, { size: 16, style: { pointerEvents: "none" } }) }),
19884
- /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ jsx21(ArrowLeft2, { size: 16, style: { pointerEvents: "none" } }) }),
19885
- /* @__PURE__ */ jsx21(
19886
- ToolbarAction,
19887
- {
19888
- label: gatedLabel("Move right"),
19889
- onClick: onMoveRight,
19890
- disabled: !itemEditOn || index >= itemCount - 1,
19891
- children: /* @__PURE__ */ jsx21(ArrowRight2, { size: 16, style: { pointerEvents: "none" } })
19892
- }
19893
- ),
19894
- /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ jsx21(ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
19895
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19896
- /* @__PURE__ */ jsx21(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
19897
- /* @__PURE__ */ jsx21(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
19898
- /* @__PURE__ */ jsx21(
19899
- ToolbarAction,
19900
- {
19901
- label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
19902
- active: treatment === "grayscale",
19903
- onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
19904
- children: /* @__PURE__ */ jsx21(Palette, { size: 16, style: { pointerEvents: "none" } })
19905
- }
19906
- ),
19907
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19908
- 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)),
19909
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19910
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ jsx21(Minus, { size: 16, style: { pointerEvents: "none" } }) }),
19911
- /* @__PURE__ */ jsxs12("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
19912
- sizeValue,
19913
- "px"
19914
- ] }),
19915
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ jsx21(Plus2, { size: 16, style: { pointerEvents: "none" } }) }),
19916
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19917
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ jsx21(ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
19918
- ]
19919
- }
19920
- ),
19921
- 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 })
19550
+ /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19551
+ VARIANTS.map((v) => /* @__PURE__ */ jsx20(Pill, { label: v.label, active: variant === v.value, onClick: () => onSetVariant(v.value) }, v.value)),
19552
+ ALIGNS.map((a) => /* @__PURE__ */ jsx20(Pill, { label: a.label, active: align === a.value, onClick: () => onSetAlign(a.value) }, a.value))
19553
+ ] }),
19554
+ /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19555
+ HOVERS.map((h) => /* @__PURE__ */ jsx20(Pill, { label: h.label, active: hover === h.value, onClick: () => onSetHover(h.value) }, h.value)),
19556
+ TREATMENTS.map((t) => /* @__PURE__ */ jsx20(Pill, { label: t.label, active: treatment === t.value, onClick: () => onSetTreatment(t.value) }, t.value))
19557
+ ] }),
19558
+ /* @__PURE__ */ jsxs11("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
19559
+ /* @__PURE__ */ jsx20(Pill, { label: "\u2212", onClick: () => onResize(-8) }),
19560
+ /* @__PURE__ */ jsxs11("span", { style: { color: "#ffffff", fontSize: 12, minWidth: 34, textAlign: "center" }, children: [
19561
+ sizeValue,
19562
+ "px"
19563
+ ] }),
19564
+ /* @__PURE__ */ jsx20(Pill, { label: "+", onClick: () => onResize(8) })
19565
+ ] }),
19566
+ /* @__PURE__ */ jsx20("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ jsx20(AltInput, { value: currentAlt, onCommit: onSetAlt }) }),
19567
+ /* @__PURE__ */ jsx20("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ jsx20(LinkInput, { value: currentHref2, onCommit: (href) => onSetLink(href, currentTarget) }) }),
19568
+ currentHref2 && /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19569
+ /* @__PURE__ */ jsx20(Pill, { label: "New tab", active: currentTarget === "new-tab", onClick: () => onSetLink(currentHref2, "new-tab") }),
19570
+ /* @__PURE__ */ jsx20(Pill, { label: "Same tab", active: currentTarget === "same-tab", onClick: () => onSetLink(currentHref2, "same-tab") })
19571
+ ] }),
19572
+ /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19573
+ /* @__PURE__ */ jsx20(Pill, { label: "Change Image", onClick: onChangeImage }),
19574
+ /* @__PURE__ */ jsx20(Pill, { label: "+ Item", onClick: onAddItem }),
19575
+ /* @__PURE__ */ jsx20(Pill, { label: "\u2212 Item", onClick: onRemoveItem, disabled: itemCount <= 1 })
19576
+ ] }),
19577
+ /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19578
+ /* @__PURE__ */ jsx20(Pill, { label: "\u2190 Move", onClick: onMoveLeft, disabled: index <= 0 }),
19579
+ /* @__PURE__ */ jsx20(Pill, { label: "\u2192 Move", onClick: onMoveRight, disabled: index >= itemCount - 1 })
19580
+ ] }),
19581
+ error && /* @__PURE__ */ jsx20("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
19922
19582
  ]
19923
19583
  }
19924
- ) });
19584
+ );
19925
19585
  }
19926
19586
  function findMediaStripSlots(tree) {
19927
19587
  const stack = tree.rows.flatMap((row) => row.blocks);
@@ -19940,23 +19600,31 @@ function AiMediaStripOverlay({
19940
19600
  }) {
19941
19601
  const [hover, setHover] = useState8(null);
19942
19602
  const [active, setActive] = useState8(null);
19943
- const [itemEditOn, setItemEditOn] = useState8(false);
19944
- const [linkOpen, setLinkOpen] = useState8(false);
19945
19603
  const [pending, setPending] = useState8(false);
19946
19604
  const [error, setError] = useState8(null);
19947
19605
  const activeRef = useRef5(null);
19948
19606
  activeRef.current = active;
19949
- const linkOpenRef = useRef5(false);
19950
- linkOpenRef.current = linkOpen;
19951
19607
  useEffect9(() => {
19952
19608
  const onMove = (e) => {
19953
- const ref = itemRefFromTarget(e.target);
19954
19609
  const t = e.target;
19955
- const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
19956
- setHover((prev) => {
19957
- const next = ref && !overEditable ? ref : null;
19958
- return sameRef(prev, next) ? prev : next;
19959
- });
19610
+ if (!(t instanceof HTMLElement)) return;
19611
+ 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]")) {
19612
+ return;
19613
+ }
19614
+ const itemEl = t.closest("[data-ohw-media-strip-item]");
19615
+ if (!itemEl) {
19616
+ setHover(null);
19617
+ return;
19618
+ }
19619
+ const sectionEl2 = itemEl.closest("[data-ohw-section]");
19620
+ const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
19621
+ const sectionId = unit ? instanceIdOf(unit) || null : null;
19622
+ const index = Number(itemEl.dataset.ohwMediaStripIndex);
19623
+ if (!sectionId || Number.isNaN(index)) {
19624
+ setHover(null);
19625
+ return;
19626
+ }
19627
+ setHover({ sectionId, index });
19960
19628
  };
19961
19629
  const onLeave = () => setHover(null);
19962
19630
  document.addEventListener("mousemove", onMove, { passive: true });
@@ -19968,25 +19636,23 @@ function AiMediaStripOverlay({
19968
19636
  }, []);
19969
19637
  useEffect9(() => {
19970
19638
  const onClick = (e) => {
19639
+ const current = activeRef.current;
19640
+ if (!current) return;
19971
19641
  const t = e.target;
19972
- if (!(t instanceof Element)) return;
19973
- if (t.closest(CHROME_SELECTOR)) return;
19974
- const ref = itemRefFromTarget(t);
19975
- if (sameRef(activeRef.current, ref)) return;
19976
- if (ref) clearInteractionChromeRef.current();
19977
- setItemEditOn(false);
19642
+ if (!(t instanceof HTMLElement)) return;
19643
+ if (t.closest("[data-ohw-item-interaction]")) return;
19644
+ const itemEl = findMediaStripItemElement(current.sectionId, current.index);
19645
+ if (itemEl && itemEl.contains(t)) return;
19646
+ setActive(null);
19978
19647
  setError(null);
19979
- setActive(ref);
19980
19648
  };
19981
19649
  document.addEventListener("click", onClick, true);
19982
19650
  return () => document.removeEventListener("click", onClick, true);
19983
- }, [clearInteractionChromeRef]);
19651
+ }, []);
19984
19652
  useEffect9(() => {
19985
19653
  const onBlur = () => {
19986
19654
  if (!activeRef.current) return;
19987
19655
  setActive(null);
19988
- setItemEditOn(false);
19989
- setLinkOpen(false);
19990
19656
  setError(null);
19991
19657
  };
19992
19658
  window.addEventListener("blur", onBlur);
@@ -19996,10 +19662,7 @@ function AiMediaStripOverlay({
19996
19662
  const onKeyDown = (e) => {
19997
19663
  if (e.key !== "Escape") return;
19998
19664
  if (!activeRef.current) return;
19999
- if (linkOpenRef.current) return;
20000
- if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
20001
19665
  setActive(null);
20002
- setItemEditOn(false);
20003
19666
  setError(null);
20004
19667
  };
20005
19668
  document.addEventListener("keydown", onKeyDown);
@@ -20033,133 +19696,137 @@ function AiMediaStripOverlay({
20033
19696
  tree: nextTree,
20034
19697
  label: entry.label,
20035
19698
  media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
20036
- ...entry.brand ? { brand: entry.brand } : {},
20037
- // The user is already looking at the strip they just edited — recentering the viewport
20038
- // on every edit reads as the section jumping around.
20039
- skipScrollIntoView: true
19699
+ ...entry.brand ? { brand: entry.brand } : {}
20040
19700
  });
20041
19701
  return true;
20042
19702
  },
20043
19703
  [findEntry, postToParent2, applyTreeLocalRef]
20044
19704
  );
20045
19705
  const activeEntry = active ? findEntry(active.sectionId) : null;
19706
+ const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
20046
19707
  const activeItemRect = useLiveItemRect(active);
20047
- const activeStripRect = useLiveItemRect(active, true);
20048
- const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
20049
- const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
20050
- const activeItem = active ? activeItems[active.index] : void 0;
20051
- const activeHref = activeItem?.href ?? "";
20052
- const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
20053
- return /* @__PURE__ */ jsxs12(Fragment7, { children: [
20054
- hoverRect && /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20055
- activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ jsxs12(Fragment7, { children: [
20056
- /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
20057
- /* @__PURE__ */ jsx21(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ jsx21(
20058
- MediaStripToolbar,
20059
- {
20060
- entry: activeEntry,
20061
- index: active.index,
20062
- pending,
20063
- error,
20064
- itemEditOn,
20065
- onToggleItemEdit: () => setItemEditOn((on) => !on),
20066
- onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
20067
- onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
20068
- onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
20069
- onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
20070
- onResize: (delta) => {
20071
- const slots = findMediaStripSlots(activeEntry.tree);
20072
- const variant = slots?.variant === "reel" ? "reel" : "logos";
20073
- const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
20074
- void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
20075
- },
20076
- onOpenLink: () => setLinkOpen(true),
20077
- onAddItem: () => {
20078
- void requestAssetPick(postToParent2).then((picked) => {
20079
- if (!picked) return;
20080
- const item = { assetId: picked.assetId, alt: "Logo" };
19708
+ const TOOLBAR_APPROX_H = 170;
19709
+ const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
19710
+ return /* @__PURE__ */ jsxs11(Fragment7, { children: [
19711
+ hoverHandleRect && hover && /* @__PURE__ */ jsx20(
19712
+ "button",
19713
+ {
19714
+ type: "button",
19715
+ "data-ohw-toolbar": "",
19716
+ onClick: () => {
19717
+ clearInteractionChromeRef.current();
19718
+ setActive(hover);
19719
+ },
19720
+ "aria-label": "Configure media item",
19721
+ style: {
19722
+ position: "fixed",
19723
+ top: hoverHandleRect.top + 8,
19724
+ left: hoverHandleRect.left + hoverHandleRect.width - 36,
19725
+ width: 28,
19726
+ height: 28,
19727
+ borderRadius: 8,
19728
+ border: `1.5px dashed ${PRIMARY3}`,
19729
+ background: "#ffffff",
19730
+ color: PRIMARY3,
19731
+ display: "flex",
19732
+ alignItems: "center",
19733
+ justifyContent: "center",
19734
+ cursor: "pointer",
19735
+ zIndex: 2147483643,
19736
+ fontSize: 14,
19737
+ fontWeight: 700
19738
+ },
19739
+ children: /* @__PURE__ */ jsx20(Star, { size: 14, style: { pointerEvents: "none" } })
19740
+ }
19741
+ ),
19742
+ activeItemRect && active && activeEntry && /* @__PURE__ */ jsx20(
19743
+ ItemInteractionLayer,
19744
+ {
19745
+ rect: activeItemRect,
19746
+ state: toolbarState,
19747
+ toolbar: /* @__PURE__ */ jsx20(
19748
+ MediaStripToolbar,
19749
+ {
19750
+ entry: activeEntry,
19751
+ index: active.index,
19752
+ pending,
19753
+ error,
19754
+ onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
19755
+ onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
19756
+ onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
19757
+ onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
19758
+ onResize: (delta) => {
19759
+ const slots = findMediaStripSlots(activeEntry.tree);
19760
+ const variant = slots?.variant === "reel" ? "reel" : "logos";
19761
+ const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19762
+ void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
19763
+ },
19764
+ onSetAlt: (alt) => {
19765
+ void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
19766
+ },
19767
+ onSetLink: (href, linkTarget) => {
20081
19768
  void runMutation(
20082
19769
  active.sectionId,
20083
- (tree) => addMediaStripItem(tree, item, active.index),
20084
- { [picked.assetId]: picked.url }
20085
- ).then((applied) => {
20086
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19770
+ (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
19771
+ );
19772
+ },
19773
+ onAddItem: () => {
19774
+ void requestAssetPick(postToParent2).then((picked) => {
19775
+ if (!picked) return;
19776
+ const item = { assetId: picked.assetId, alt: "Logo" };
19777
+ void runMutation(
19778
+ active.sectionId,
19779
+ (tree) => addMediaStripItem(tree, item, active.index),
19780
+ { [picked.assetId]: picked.url }
19781
+ ).then((applied) => {
19782
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19783
+ });
20087
19784
  });
20088
- });
20089
- },
20090
- onChangeImage: () => {
20091
- void requestAssetPick(postToParent2).then((picked) => {
20092
- if (!picked) return;
20093
- void runMutation(
20094
- active.sectionId,
20095
- (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
20096
- { [picked.assetId]: picked.url }
19785
+ },
19786
+ onChangeImage: () => {
19787
+ void requestAssetPick(postToParent2).then((picked) => {
19788
+ if (!picked) return;
19789
+ void runMutation(
19790
+ active.sectionId,
19791
+ (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
19792
+ { [picked.assetId]: picked.url }
19793
+ );
19794
+ });
19795
+ },
19796
+ onRemoveItem: () => {
19797
+ void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
19798
+ (applied) => {
19799
+ if (applied) setActive(null);
19800
+ }
20097
19801
  );
20098
- });
20099
- },
20100
- onRemoveItem: () => {
20101
- void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
20102
- (applied) => {
20103
- if (applied) setActive(null);
20104
- }
20105
- );
20106
- },
20107
- onMoveLeft: () => {
20108
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
20109
- (applied) => {
20110
- if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
20111
- }
20112
- );
20113
- },
20114
- onMoveRight: () => {
20115
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
20116
- (applied) => {
20117
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
20118
- }
20119
- );
20120
- }
20121
- }
20122
- ) }),
20123
- /* @__PURE__ */ jsx21(
20124
- "div",
20125
- {
20126
- "data-ohw-bridge": "",
20127
- "data-ohw-item-interaction": "",
20128
- "aria-hidden": true,
20129
- className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
20130
- style: {
20131
- top: activeItemRect.top + activeItemRect.height + 10,
20132
- left: activeItemRect.left - 5,
20133
- background: PRIMARY3,
20134
- zIndex: 2147483644
20135
- },
20136
- children: "Media item"
20137
- }
20138
- ),
20139
- linkOpen && /* @__PURE__ */ jsx21(
20140
- LinkModal,
20141
- {
20142
- href: activeHref,
20143
- linkTarget: activeTarget,
20144
- onClose: () => setLinkOpen(false),
20145
- onSave: (href, linkTarget) => {
20146
- void runMutation(
20147
- active.sectionId,
20148
- (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
20149
- );
19802
+ },
19803
+ onMoveLeft: () => {
19804
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
19805
+ (applied) => {
19806
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
19807
+ }
19808
+ );
19809
+ },
19810
+ onMoveRight: () => {
19811
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
19812
+ (applied) => {
19813
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19814
+ }
19815
+ );
19816
+ }
20150
19817
  }
20151
- }
20152
- )
20153
- ] })
19818
+ )
19819
+ }
19820
+ )
20154
19821
  ] });
20155
19822
  }
20156
19823
 
20157
19824
  // src/ui/ai-section/AiPricingCardOverlay.tsx
20158
- import { useCallback as useCallback4, useEffect as useEffect10, useLayoutEffect as useLayoutEffect5, useRef as useRef6, useState as useState9 } from "react";
20159
- import { Check as Check3, ChevronDown as ChevronDown4, Minus as Minus2, Plus as Plus3, Star as Star2 } from "lucide-react";
20160
- import { Fragment as Fragment8, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
19825
+ import { useCallback as useCallback4, useEffect as useEffect10, useLayoutEffect as useLayoutEffect4, useRef as useRef6, useState as useState9 } from "react";
19826
+ import { Check as Check2, ChevronDown as ChevronDown3, Minus, Plus as Plus2, Star as Star2 } from "lucide-react";
19827
+ import { Fragment as Fragment8, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
20161
19828
  var PRIMARY4 = "var(--ohw-primary, #0885FE)";
20162
- 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]";
19829
+ 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]";
20163
19830
  function findPricingCardElement(sectionId, index) {
20164
19831
  const sectionEl2 = findByInstanceId(sectionId);
20165
19832
  if (!sectionEl2) return null;
@@ -20171,7 +19838,7 @@ function findPricingCardElement(sectionId, index) {
20171
19838
  }
20172
19839
  function cardRefFromTarget(target) {
20173
19840
  if (!(target instanceof Element)) return null;
20174
- if (target.closest(CHROME_SELECTOR2)) return null;
19841
+ if (target.closest(CHROME_SELECTOR)) return null;
20175
19842
  const cardEl = target.closest("[data-ohw-pricing-card]");
20176
19843
  if (!cardEl) return null;
20177
19844
  const sectionEl2 = cardEl.closest("[data-ohw-section]");
@@ -20181,21 +19848,21 @@ function cardRefFromTarget(target) {
20181
19848
  if (!sectionId || Number.isNaN(index)) return null;
20182
19849
  return { sectionId, index };
20183
19850
  }
20184
- function sameRef2(a, b) {
19851
+ function sameRef(a, b) {
20185
19852
  return a?.sectionId === b?.sectionId && a?.index === b?.index;
20186
19853
  }
20187
- function rectOf2(el) {
19854
+ function rectOf(el) {
20188
19855
  if (!el) return null;
20189
19856
  const r2 = el.getBoundingClientRect();
20190
19857
  if (r2.width <= 0 || r2.height <= 0) return null;
20191
19858
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
20192
19859
  }
20193
19860
  function readRect3(ref) {
20194
- return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
19861
+ return rectOf(ref && findPricingCardElement(ref.sectionId, ref.index));
20195
19862
  }
20196
19863
  function readGridRect(ref) {
20197
19864
  const card = ref && findPricingCardElement(ref.sectionId, ref.index);
20198
- return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
19865
+ return rectOf(card?.closest("[data-ohw-pricing-collection]") ?? card);
20199
19866
  }
20200
19867
  function useLiveCardRect(ref, grid = false) {
20201
19868
  const [rect, setRect] = useState9(null);
@@ -20225,19 +19892,19 @@ function useLiveCardRect(ref, grid = false) {
20225
19892
  }
20226
19893
  var TOOLBAR_GRID_GAP = 52;
20227
19894
  var TOOLBAR_GRID_GAP_MOBILE = 42;
20228
- var TOOLBAR_EDGE_MARGIN3 = 4;
19895
+ var TOOLBAR_EDGE_MARGIN2 = 4;
20229
19896
  function GridToolbarSlot({ gridRect, children }) {
20230
19897
  const slotRef = useRef6(null);
20231
19898
  const [shift, setShift] = useState9(0);
20232
19899
  const centerX = gridRect.left + gridRect.width / 2;
20233
- useLayoutEffect5(() => {
19900
+ useLayoutEffect4(() => {
20234
19901
  const slot = slotRef.current;
20235
19902
  if (!slot) return;
20236
19903
  const clamp = () => {
20237
19904
  const w = slot.offsetWidth;
20238
19905
  if (w <= 0) return;
20239
19906
  const half = w / 2;
20240
- const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
19907
+ const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
20241
19908
  setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
20242
19909
  };
20243
19910
  clamp();
@@ -20246,7 +19913,7 @@ function GridToolbarSlot({ gridRect, children }) {
20246
19913
  return () => ro.disconnect();
20247
19914
  }, [centerX, children]);
20248
19915
  const mobile = window.innerWidth <= 480;
20249
- return /* @__PURE__ */ jsx22(
19916
+ return /* @__PURE__ */ jsx21(
20250
19917
  "div",
20251
19918
  {
20252
19919
  ref: slotRef,
@@ -20281,7 +19948,7 @@ function requestValidateTree2(postToParent2, tree) {
20281
19948
  });
20282
19949
  }
20283
19950
  function StyleSwatch({ style }) {
20284
- return /* @__PURE__ */ jsx22(
19951
+ return /* @__PURE__ */ jsx21(
20285
19952
  "span",
20286
19953
  {
20287
19954
  "aria-hidden": true,
@@ -20295,35 +19962,35 @@ function StyleSwatch({ style }) {
20295
19962
  );
20296
19963
  }
20297
19964
  function ButtonGlyph() {
20298
- return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20299
- /* @__PURE__ */ jsx22("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
20300
- /* @__PURE__ */ jsx22("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
19965
+ return /* @__PURE__ */ jsxs12("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
19966
+ /* @__PURE__ */ jsx21("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
19967
+ /* @__PURE__ */ jsx21("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
20301
19968
  ] });
20302
19969
  }
20303
19970
  function FeatureGlyph({ mode }) {
20304
- return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20305
- /* @__PURE__ */ jsx22("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
20306
- /* @__PURE__ */ jsx22("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
20307
- /* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
20308
- /* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
20309
- /* @__PURE__ */ jsx22("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
20310
- mode === "add" && /* @__PURE__ */ jsx22("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
19971
+ return /* @__PURE__ */ jsxs12("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
19972
+ /* @__PURE__ */ jsx21("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
19973
+ /* @__PURE__ */ jsx21("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
19974
+ /* @__PURE__ */ jsx21("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
19975
+ /* @__PURE__ */ jsx21("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
19976
+ /* @__PURE__ */ jsx21("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
19977
+ mode === "add" && /* @__PURE__ */ jsx21("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
20311
19978
  ] });
20312
19979
  }
20313
- function ToolbarAction2({
19980
+ function ToolbarAction({
20314
19981
  label,
20315
19982
  onClick,
20316
19983
  disabled = false,
20317
19984
  children
20318
19985
  }) {
20319
- const button = /* @__PURE__ */ jsx22(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
20320
- return /* @__PURE__ */ jsxs13(Tooltip, { children: [
20321
- /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: button }) : button }),
20322
- /* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
19986
+ const button = /* @__PURE__ */ jsx21(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
19987
+ return /* @__PURE__ */ jsxs12(Tooltip, { children: [
19988
+ /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: button }) : button }),
19989
+ /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
20323
19990
  ] });
20324
19991
  }
20325
- function ToolbarSeparator2() {
20326
- return /* @__PURE__ */ jsx22("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
19992
+ function ToolbarSeparator() {
19993
+ return /* @__PURE__ */ jsx21("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
20327
19994
  }
20328
19995
  function CardStyleMenu({
20329
19996
  value,
@@ -20331,7 +19998,7 @@ function CardStyleMenu({
20331
19998
  disabled = false
20332
19999
  }) {
20333
20000
  const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
20334
- const trigger = /* @__PURE__ */ jsxs13(
20001
+ const trigger = /* @__PURE__ */ jsxs12(
20335
20002
  "button",
20336
20003
  {
20337
20004
  type: "button",
@@ -20342,28 +20009,28 @@ function CardStyleMenu({
20342
20009
  disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
20343
20010
  ),
20344
20011
  children: [
20345
- /* @__PURE__ */ jsx22(StyleSwatch, { style: current.value }),
20346
- /* @__PURE__ */ jsx22("span", { className: "flex-1 text-left", children: current.label }),
20347
- /* @__PURE__ */ jsx22(ChevronDown4, { size: 16, style: { pointerEvents: "none" } })
20012
+ /* @__PURE__ */ jsx21(StyleSwatch, { style: current.value }),
20013
+ /* @__PURE__ */ jsx21("span", { className: "flex-1 text-left", children: current.label }),
20014
+ /* @__PURE__ */ jsx21(ChevronDown3, { size: 16, style: { pointerEvents: "none" } })
20348
20015
  ]
20349
20016
  }
20350
20017
  );
20351
20018
  if (disabled) {
20352
- return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20353
- /* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
20354
- /* @__PURE__ */ jsxs13(Tooltip, { children: [
20355
- /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: trigger }) }),
20356
- /* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
20019
+ return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20020
+ /* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
20021
+ /* @__PURE__ */ jsxs12(Tooltip, { children: [
20022
+ /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: trigger }) }),
20023
+ /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
20357
20024
  ] })
20358
20025
  ] });
20359
20026
  }
20360
- return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20361
- /* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
20362
- /* @__PURE__ */ jsxs13(DropdownMenu, { modal: false, children: [
20363
- /* @__PURE__ */ jsx22(DropdownMenuTrigger, { asChild: true, children: trigger }),
20364
- /* @__PURE__ */ jsx22(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
20027
+ return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20028
+ /* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
20029
+ /* @__PURE__ */ jsxs12(DropdownMenu, { modal: false, children: [
20030
+ /* @__PURE__ */ jsx21(DropdownMenuTrigger, { asChild: true, children: trigger }),
20031
+ /* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
20365
20032
  const selected = style.value === value;
20366
- return /* @__PURE__ */ jsxs13(
20033
+ return /* @__PURE__ */ jsxs12(
20367
20034
  DropdownMenuItem,
20368
20035
  {
20369
20036
  role: "menuitemradio",
@@ -20371,9 +20038,9 @@ function CardStyleMenu({
20371
20038
  onSelect: () => onChange(style.value),
20372
20039
  className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
20373
20040
  children: [
20374
- /* @__PURE__ */ jsx22(StyleSwatch, { style: style.value }),
20375
- /* @__PURE__ */ jsx22("span", { children: style.label }),
20376
- selected && /* @__PURE__ */ jsx22(Check3, { size: 16, className: "text-bridge-primary" })
20041
+ /* @__PURE__ */ jsx21(StyleSwatch, { style: style.value }),
20042
+ /* @__PURE__ */ jsx21("span", { children: style.label }),
20043
+ selected && /* @__PURE__ */ jsx21(Check2, { size: 16, className: "text-bridge-primary" })
20377
20044
  ]
20378
20045
  },
20379
20046
  style.value
@@ -20403,7 +20070,7 @@ function PricingCardToolbar({
20403
20070
  const style = pricingCardStyle(entry.tree, index);
20404
20071
  const featuredTag = pricingCardFeaturedTag(entry.tree, index);
20405
20072
  const mobile = window.innerWidth <= 480;
20406
- return /* @__PURE__ */ jsx22(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs13(
20073
+ return /* @__PURE__ */ jsx21(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs12(
20407
20074
  "div",
20408
20075
  {
20409
20076
  "data-ohw-bridge": "",
@@ -20415,7 +20082,7 @@ function PricingCardToolbar({
20415
20082
  ),
20416
20083
  style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
20417
20084
  children: [
20418
- /* @__PURE__ */ jsxs13(
20085
+ /* @__PURE__ */ jsxs12(
20419
20086
  "div",
20420
20087
  {
20421
20088
  className: cn(
@@ -20424,8 +20091,8 @@ function PricingCardToolbar({
20424
20091
  mobile ? "flex-wrap justify-center" : "flex-nowrap"
20425
20092
  ),
20426
20093
  children: [
20427
- /* @__PURE__ */ jsxs13(Tooltip, { children: [
20428
- /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22(
20094
+ /* @__PURE__ */ jsxs12(Tooltip, { children: [
20095
+ /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
20429
20096
  CustomToolbarButton,
20430
20097
  {
20431
20098
  type: "button",
@@ -20433,7 +20100,7 @@ function PricingCardToolbar({
20433
20100
  "aria-pressed": featuredTag,
20434
20101
  onClick: () => onSetFeaturedTag(!featuredTag),
20435
20102
  className: "group size-8",
20436
- children: /* @__PURE__ */ jsx22(
20103
+ children: /* @__PURE__ */ jsx21(
20437
20104
  Star2,
20438
20105
  {
20439
20106
  size: 16,
@@ -20448,25 +20115,25 @@ function PricingCardToolbar({
20448
20115
  )
20449
20116
  }
20450
20117
  ) }),
20451
- /* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
20118
+ /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
20452
20119
  ] }),
20453
- /* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
20454
- /* @__PURE__ */ jsx22(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
20455
- /* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
20456
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ jsx22(ButtonGlyph, {}) }),
20457
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ jsxs13("span", { className: "relative inline-flex", children: [
20458
- /* @__PURE__ */ jsx22(ButtonGlyph, {}),
20459
- /* @__PURE__ */ jsx22(Minus2, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
20120
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
20121
+ /* @__PURE__ */ jsx21(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
20122
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
20123
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ jsx21(ButtonGlyph, {}) }),
20124
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ jsxs12("span", { className: "relative inline-flex", children: [
20125
+ /* @__PURE__ */ jsx21(ButtonGlyph, {}),
20126
+ /* @__PURE__ */ jsx21(Minus, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
20460
20127
  ] }) }),
20461
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "add" }) }),
20462
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "remove" }) }),
20463
- /* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
20464
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ jsx22(Plus3, { size: 16, style: { pointerEvents: "none" } }) }),
20465
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ jsx22(Minus2, { size: 16, style: { pointerEvents: "none" } }) })
20128
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ jsx21(FeatureGlyph, { mode: "add" }) }),
20129
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ jsx21(FeatureGlyph, { mode: "remove" }) }),
20130
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
20131
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ jsx21(Plus2, { size: 16, style: { pointerEvents: "none" } }) }),
20132
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ jsx21(Minus, { size: 16, style: { pointerEvents: "none" } }) })
20466
20133
  ]
20467
20134
  }
20468
20135
  ),
20469
- 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 })
20136
+ 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 })
20470
20137
  ]
20471
20138
  }
20472
20139
  ) });
@@ -20500,7 +20167,7 @@ function AiPricingCardOverlay({
20500
20167
  const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
20501
20168
  setHover((prev) => {
20502
20169
  const next = ref && !overEditable ? ref : null;
20503
- return sameRef2(prev, next) ? prev : next;
20170
+ return sameRef(prev, next) ? prev : next;
20504
20171
  });
20505
20172
  };
20506
20173
  const onLeave = () => setHover(null);
@@ -20515,10 +20182,10 @@ function AiPricingCardOverlay({
20515
20182
  const onClick = (e) => {
20516
20183
  const t = e.target;
20517
20184
  if (!(t instanceof Element)) return;
20518
- if (t.closest(CHROME_SELECTOR2)) return;
20185
+ if (t.closest(CHROME_SELECTOR)) return;
20519
20186
  const ref = cardRefFromTarget(t);
20520
- setActive((prev) => sameRef2(prev, ref) ? prev : ref);
20521
- if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
20187
+ setActive((prev) => sameRef(prev, ref) ? prev : ref);
20188
+ if (!ref || !sameRef(activeRef.current, ref)) setError(null);
20522
20189
  };
20523
20190
  document.addEventListener("click", onClick, true);
20524
20191
  return () => document.removeEventListener("click", onClick, true);
@@ -20583,12 +20250,12 @@ function AiPricingCardOverlay({
20583
20250
  const activeEntry = active ? findEntry(active.sectionId) : null;
20584
20251
  const activeCardRect = useLiveCardRect(active);
20585
20252
  const activeGridRect = useLiveCardRect(active, true);
20586
- const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
20587
- return /* @__PURE__ */ jsxs13(Fragment8, { children: [
20588
- hoverRect && /* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20589
- activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ jsxs13(Fragment8, { children: [
20590
- /* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
20591
- /* @__PURE__ */ jsx22(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ jsx22(
20253
+ const hoverRect = useLiveCardRect(hover && !sameRef(hover, active) ? hover : null);
20254
+ return /* @__PURE__ */ jsxs12(Fragment8, { children: [
20255
+ hoverRect && /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20256
+ activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ jsxs12(Fragment8, { children: [
20257
+ /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
20258
+ /* @__PURE__ */ jsx21(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ jsx21(
20592
20259
  PricingCardToolbar,
20593
20260
  {
20594
20261
  entry: activeEntry,
@@ -20616,7 +20283,7 @@ function AiPricingCardOverlay({
20616
20283
  onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
20617
20284
  }
20618
20285
  ) }),
20619
- /* @__PURE__ */ jsx22(
20286
+ /* @__PURE__ */ jsx21(
20620
20287
  "div",
20621
20288
  {
20622
20289
  "data-ohw-bridge": "",
@@ -20680,11 +20347,39 @@ function clearVideo(tree, path) {
20680
20347
  });
20681
20348
  }
20682
20349
 
20350
+ // src/lib/youtube.ts
20351
+ var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
20352
+ function extractYouTubeId(input) {
20353
+ const trimmed = input.trim();
20354
+ if (!trimmed) return null;
20355
+ if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
20356
+ let url;
20357
+ try {
20358
+ url = new URL(trimmed);
20359
+ } catch {
20360
+ return null;
20361
+ }
20362
+ const host = url.hostname.replace(/^www\./, "");
20363
+ if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
20364
+ return null;
20365
+ }
20366
+ let candidate = null;
20367
+ if (host === "youtu.be") {
20368
+ candidate = url.pathname.slice(1).split("/")[0] ?? null;
20369
+ } else if (url.pathname === "/watch") {
20370
+ candidate = url.searchParams.get("v");
20371
+ } else {
20372
+ const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
20373
+ candidate = match ? match[1] : null;
20374
+ }
20375
+ return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
20376
+ }
20377
+
20683
20378
  // src/ui/ai-section/AiVideoOverlay.tsx
20684
- import { Fragment as Fragment9, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
20379
+ import { Fragment as Fragment9, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
20685
20380
  var PRIMARY5 = "#0885FE";
20686
- var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
20687
- var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20381
+ var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY5})`;
20382
+ var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20688
20383
  function findVideoBlockElement(sectionId, path) {
20689
20384
  const sectionEl2 = findByInstanceId(sectionId);
20690
20385
  if (!sectionEl2) return null;
@@ -20744,12 +20439,12 @@ function requestValidateTree3(postToParent2, tree) {
20744
20439
  postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
20745
20440
  });
20746
20441
  }
20747
- function Pill({
20442
+ function Pill2({
20748
20443
  label,
20749
20444
  onClick,
20750
20445
  disabled
20751
20446
  }) {
20752
- return /* @__PURE__ */ jsx23(
20447
+ return /* @__PURE__ */ jsx22(
20753
20448
  "button",
20754
20449
  {
20755
20450
  type: "button",
@@ -20765,7 +20460,7 @@ function Pill({
20765
20460
  border: "none",
20766
20461
  cursor: disabled ? "default" : "pointer",
20767
20462
  background: "#ffffff",
20768
- color: OHW_BLUE_DARK,
20463
+ color: OHW_BLUE_DARK2,
20769
20464
  opacity: disabled ? 0.4 : 1,
20770
20465
  fontSize: 12,
20771
20466
  lineHeight: "16px",
@@ -20808,8 +20503,8 @@ function VideoUrlInput({ value, onCommit }) {
20808
20503
  onCommit(id);
20809
20504
  }
20810
20505
  };
20811
- return /* @__PURE__ */ jsxs14("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
20812
- /* @__PURE__ */ jsxs14(
20506
+ return /* @__PURE__ */ jsxs13("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
20507
+ /* @__PURE__ */ jsxs13(
20813
20508
  "div",
20814
20509
  {
20815
20510
  style: {
@@ -20825,12 +20520,12 @@ function VideoUrlInput({ value, onCommit }) {
20825
20520
  boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
20826
20521
  },
20827
20522
  children: [
20828
- /* @__PURE__ */ jsx23(
20523
+ /* @__PURE__ */ jsx22(
20829
20524
  "span",
20830
20525
  {
20831
20526
  style: {
20832
20527
  flex: "0 0 auto",
20833
- color: OHW_BLUE_DARK,
20528
+ color: OHW_BLUE_DARK2,
20834
20529
  fontSize: 10,
20835
20530
  lineHeight: "16px",
20836
20531
  fontWeight: 700,
@@ -20840,7 +20535,7 @@ function VideoUrlInput({ value, onCommit }) {
20840
20535
  children: "Video"
20841
20536
  }
20842
20537
  ),
20843
- /* @__PURE__ */ jsx23(
20538
+ /* @__PURE__ */ jsx22(
20844
20539
  "input",
20845
20540
  {
20846
20541
  type: "text",
@@ -20877,7 +20572,7 @@ function VideoUrlInput({ value, onCommit }) {
20877
20572
  ]
20878
20573
  }
20879
20574
  ),
20880
- 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." })
20575
+ 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." })
20881
20576
  ] });
20882
20577
  }
20883
20578
  function VideoToolbar({
@@ -20887,7 +20582,7 @@ function VideoToolbar({
20887
20582
  onSetVideoId,
20888
20583
  onRemove
20889
20584
  }) {
20890
- return /* @__PURE__ */ jsxs14(
20585
+ return /* @__PURE__ */ jsxs13(
20891
20586
  "div",
20892
20587
  {
20893
20588
  "data-ohw-bridge": "",
@@ -20899,7 +20594,7 @@ function VideoToolbar({
20899
20594
  gap: 6,
20900
20595
  alignItems: "center",
20901
20596
  width: 280,
20902
- background: OHW_BLUE,
20597
+ background: OHW_BLUE2,
20903
20598
  padding: 8,
20904
20599
  borderRadius: 12,
20905
20600
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -20907,9 +20602,9 @@ function VideoToolbar({
20907
20602
  opacity: pending ? 0.6 : 1
20908
20603
  },
20909
20604
  children: [
20910
- /* @__PURE__ */ jsx23(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
20911
- /* @__PURE__ */ jsx23(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
20912
- error && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20605
+ /* @__PURE__ */ jsx22(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
20606
+ /* @__PURE__ */ jsx22(Pill2, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
20607
+ error && /* @__PURE__ */ jsx22("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20913
20608
  ]
20914
20609
  }
20915
20610
  );
@@ -21029,8 +20724,8 @@ function AiVideoOverlay({
21029
20724
  const activeBlockRect = useLiveBlockRect(active);
21030
20725
  const TOOLBAR_APPROX_H = 90;
21031
20726
  const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
21032
- return /* @__PURE__ */ jsxs14(Fragment9, { children: [
21033
- hoverHandleRect && hover && /* @__PURE__ */ jsx23(
20727
+ return /* @__PURE__ */ jsxs13(Fragment9, { children: [
20728
+ hoverHandleRect && hover && /* @__PURE__ */ jsx22(
21034
20729
  "button",
21035
20730
  {
21036
20731
  type: "button",
@@ -21058,15 +20753,15 @@ function AiVideoOverlay({
21058
20753
  fontSize: 14,
21059
20754
  fontWeight: 700
21060
20755
  },
21061
- children: /* @__PURE__ */ jsx23(Star3, { size: 14, style: { pointerEvents: "none" } })
20756
+ children: /* @__PURE__ */ jsx22(Star3, { size: 14, style: { pointerEvents: "none" } })
21062
20757
  }
21063
20758
  ),
21064
- activeBlockRect && active && activeEntry && /* @__PURE__ */ jsx23(
20759
+ activeBlockRect && active && activeEntry && /* @__PURE__ */ jsx22(
21065
20760
  ItemInteractionLayer,
21066
20761
  {
21067
20762
  rect: activeBlockRect,
21068
20763
  state: toolbarState,
21069
- toolbar: /* @__PURE__ */ jsx23(
20764
+ toolbar: /* @__PURE__ */ jsx22(
21070
20765
  VideoToolbar,
21071
20766
  {
21072
20767
  videoId: videoIdAt(activeEntry.tree, active.path),
@@ -21141,10 +20836,10 @@ function setCarouselAutoplay(tree, on) {
21141
20836
  }
21142
20837
 
21143
20838
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
21144
- import { Fragment as Fragment10, jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
20839
+ import { Fragment as Fragment10, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
21145
20840
  var PRIMARY6 = "#0885FE";
21146
- var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
21147
- var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
20841
+ var OHW_BLUE3 = `var(--ohw-primary, ${PRIMARY6})`;
20842
+ var OHW_BLUE_DARK3 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
21148
20843
  function findCarouselItemElement(sectionId, index) {
21149
20844
  const sectionEl2 = findByInstanceId(sectionId);
21150
20845
  if (!sectionEl2) return null;
@@ -21223,8 +20918,8 @@ function requestAssetPick2(postToParent2) {
21223
20918
  postToParent2({ type: "ow:asset-pick", id });
21224
20919
  });
21225
20920
  }
21226
- function Pill2({ label, onClick, disabled }) {
21227
- return /* @__PURE__ */ jsx24(
20921
+ function Pill3({ label, onClick, disabled }) {
20922
+ return /* @__PURE__ */ jsx23(
21228
20923
  "button",
21229
20924
  {
21230
20925
  type: "button",
@@ -21240,7 +20935,7 @@ function Pill2({ label, onClick, disabled }) {
21240
20935
  border: "none",
21241
20936
  cursor: disabled ? "default" : "pointer",
21242
20937
  background: "#ffffff",
21243
- color: OHW_BLUE_DARK2,
20938
+ color: OHW_BLUE_DARK3,
21244
20939
  opacity: disabled ? 0.4 : 1,
21245
20940
  fontSize: 12,
21246
20941
  lineHeight: "16px",
@@ -21258,7 +20953,7 @@ function TogglePill({
21258
20953
  onToggle,
21259
20954
  disabled
21260
20955
  }) {
21261
- return /* @__PURE__ */ jsxs15(
20956
+ return /* @__PURE__ */ jsxs14(
21262
20957
  "button",
21263
20958
  {
21264
20959
  type: "button",
@@ -21277,7 +20972,7 @@ function TogglePill({
21277
20972
  border: "none",
21278
20973
  cursor: disabled ? "default" : "pointer",
21279
20974
  background: "#ffffff",
21280
- color: OHW_BLUE_DARK2,
20975
+ color: OHW_BLUE_DARK3,
21281
20976
  opacity: disabled ? 0.4 : 1,
21282
20977
  fontSize: 12,
21283
20978
  lineHeight: "16px",
@@ -21287,7 +20982,7 @@ function TogglePill({
21287
20982
  },
21288
20983
  children: [
21289
20984
  label,
21290
- /* @__PURE__ */ jsx24(
20985
+ /* @__PURE__ */ jsx23(
21291
20986
  "span",
21292
20987
  {
21293
20988
  "aria-hidden": true,
@@ -21300,10 +20995,10 @@ function TogglePill({
21300
20995
  // Off is a grey track, not a washed-out blue: the pill's own white background already
21301
20996
  // carries the brand colour in the text, and a pale blue track next to it read as
21302
20997
  // "disabled control" rather than "switch that is off".
21303
- background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
20998
+ background: on ? OHW_BLUE_DARK3 : "#CBD5E1",
21304
20999
  transition: "background 120ms ease"
21305
21000
  },
21306
- children: /* @__PURE__ */ jsx24(
21001
+ children: /* @__PURE__ */ jsx23(
21307
21002
  "span",
21308
21003
  {
21309
21004
  style: {
@@ -21332,7 +21027,7 @@ function CarouselSlideToolbar({
21332
21027
  onChangeImage,
21333
21028
  onToggleAutoplay
21334
21029
  }) {
21335
- return /* @__PURE__ */ jsxs15(
21030
+ return /* @__PURE__ */ jsxs14(
21336
21031
  "div",
21337
21032
  {
21338
21033
  "data-ohw-bridge": "",
@@ -21343,7 +21038,7 @@ function CarouselSlideToolbar({
21343
21038
  flexDirection: "column",
21344
21039
  gap: 6,
21345
21040
  alignItems: "center",
21346
- background: OHW_BLUE2,
21041
+ background: OHW_BLUE3,
21347
21042
  padding: 8,
21348
21043
  borderRadius: 12,
21349
21044
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -21355,11 +21050,11 @@ function CarouselSlideToolbar({
21355
21050
  pointerEvents: pending ? "none" : "auto"
21356
21051
  },
21357
21052
  children: [
21358
- /* @__PURE__ */ jsxs15("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
21359
- /* @__PURE__ */ jsx24(Pill2, { label: "Change Image", onClick: onChangeImage }),
21360
- /* @__PURE__ */ jsx24(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
21053
+ /* @__PURE__ */ jsxs14("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
21054
+ /* @__PURE__ */ jsx23(Pill3, { label: "Change Image", onClick: onChangeImage }),
21055
+ /* @__PURE__ */ jsx23(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
21361
21056
  ] }),
21362
- error && /* @__PURE__ */ jsx24("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
21057
+ error && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
21363
21058
  ]
21364
21059
  }
21365
21060
  );
@@ -21499,8 +21194,8 @@ function AiFadeCarouselOverlay({
21499
21194
  const activeItemRect = useLiveItemRect2(active);
21500
21195
  const TOOLBAR_APPROX_H = 90;
21501
21196
  const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
21502
- return /* @__PURE__ */ jsxs15(Fragment10, { children: [
21503
- hoverHandleRect && hover && /* @__PURE__ */ jsx24(
21197
+ return /* @__PURE__ */ jsxs14(Fragment10, { children: [
21198
+ hoverHandleRect && hover && /* @__PURE__ */ jsx23(
21504
21199
  "button",
21505
21200
  {
21506
21201
  type: "button",
@@ -21529,10 +21224,10 @@ function AiFadeCarouselOverlay({
21529
21224
  fontSize: 14,
21530
21225
  fontWeight: 700
21531
21226
  },
21532
- children: /* @__PURE__ */ jsx24(Star4, { size: 14, style: { pointerEvents: "none" } })
21227
+ children: /* @__PURE__ */ jsx23(Star4, { size: 14, style: { pointerEvents: "none" } })
21533
21228
  }
21534
21229
  ),
21535
- swapping && /* @__PURE__ */ jsx24(
21230
+ swapping && /* @__PURE__ */ jsx23(
21536
21231
  "div",
21537
21232
  {
21538
21233
  ref: skeletonRef,
@@ -21550,15 +21245,15 @@ function AiFadeCarouselOverlay({
21550
21245
  zIndex: 2147483646,
21551
21246
  pointerEvents: "none"
21552
21247
  },
21553
- children: /* @__PURE__ */ jsx24("style", { children: MEDIA_SKELETON_CSS })
21248
+ children: /* @__PURE__ */ jsx23("style", { children: MEDIA_SKELETON_CSS })
21554
21249
  }
21555
21250
  ),
21556
- activeItemRect && active && activeEntry && /* @__PURE__ */ jsx24(
21251
+ activeItemRect && active && activeEntry && /* @__PURE__ */ jsx23(
21557
21252
  ItemInteractionLayer,
21558
21253
  {
21559
21254
  rect: activeItemRect,
21560
21255
  state: toolbarState,
21561
- toolbar: /* @__PURE__ */ jsx24(
21256
+ toolbar: /* @__PURE__ */ jsx23(
21562
21257
  CarouselSlideToolbar,
21563
21258
  {
21564
21259
  pending,
@@ -21749,11 +21444,118 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
21749
21444
  // src/ui/link-modal/LinkPopover.tsx
21750
21445
  import { useEffect as useEffect16 } from "react";
21751
21446
 
21447
+ // src/ui/dialog.tsx
21448
+ import * as React9 from "react";
21449
+ import { Dialog as DialogPrimitive } from "radix-ui";
21450
+ import { X as X2 } from "lucide-react";
21451
+ import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
21452
+ function Dialog2({
21453
+ ...props
21454
+ }) {
21455
+ return /* @__PURE__ */ jsx24(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
21456
+ }
21457
+ function DialogPortal({
21458
+ ...props
21459
+ }) {
21460
+ return /* @__PURE__ */ jsx24(DialogPrimitive.Portal, { ...props });
21461
+ }
21462
+ function DialogOverlay({
21463
+ className,
21464
+ ...props
21465
+ }) {
21466
+ return /* @__PURE__ */ jsx24(
21467
+ DialogPrimitive.Overlay,
21468
+ {
21469
+ "data-slot": "dialog-overlay",
21470
+ "data-ohw-link-modal-root": "",
21471
+ className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
21472
+ ...props
21473
+ }
21474
+ );
21475
+ }
21476
+ var DialogContent = React9.forwardRef(
21477
+ ({ className, children, showCloseButton = true, container, ...props }, ref) => {
21478
+ const positionMode = container ? "absolute" : "fixed";
21479
+ return /* @__PURE__ */ jsxs15(DialogPortal, { container: container ?? void 0, children: [
21480
+ /* @__PURE__ */ jsx24(DialogOverlay, { className: cn(positionMode, "inset-0") }),
21481
+ /* @__PURE__ */ jsxs15(
21482
+ DialogPrimitive.Content,
21483
+ {
21484
+ ref,
21485
+ "data-slot": "dialog-content",
21486
+ className: cn(
21487
+ positionMode,
21488
+ "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",
21489
+ "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
21490
+ container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
21491
+ className
21492
+ ),
21493
+ onMouseDown: (e) => e.stopPropagation(),
21494
+ ...props,
21495
+ children: [
21496
+ children,
21497
+ showCloseButton ? /* @__PURE__ */ jsx24(
21498
+ DialogPrimitive.Close,
21499
+ {
21500
+ type: "button",
21501
+ className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
21502
+ "aria-label": "Close",
21503
+ children: /* @__PURE__ */ jsx24(X2, { size: 16, "aria-hidden": true })
21504
+ }
21505
+ ) : null
21506
+ ]
21507
+ }
21508
+ )
21509
+ ] });
21510
+ }
21511
+ );
21512
+ DialogContent.displayName = DialogPrimitive.Content.displayName;
21513
+ function DialogHeader({
21514
+ className,
21515
+ ...props
21516
+ }) {
21517
+ return /* @__PURE__ */ jsx24("div", { className: cn("flex flex-col gap-1.5", className), ...props });
21518
+ }
21519
+ function DialogFooter({
21520
+ className,
21521
+ ...props
21522
+ }) {
21523
+ return /* @__PURE__ */ jsx24(
21524
+ "div",
21525
+ {
21526
+ className: cn("flex items-center justify-end gap-2", className),
21527
+ ...props
21528
+ }
21529
+ );
21530
+ }
21531
+ var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
21532
+ DialogPrimitive.Title,
21533
+ {
21534
+ ref,
21535
+ className: cn(
21536
+ "text-lg font-semibold leading-none tracking-tight text-card-foreground",
21537
+ className
21538
+ ),
21539
+ ...props
21540
+ }
21541
+ ));
21542
+ DialogTitle.displayName = DialogPrimitive.Title.displayName;
21543
+ var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
21544
+ DialogPrimitive.Description,
21545
+ {
21546
+ ref,
21547
+ className: cn("text-sm text-muted-foreground", className),
21548
+ ...props
21549
+ }
21550
+ ));
21551
+ DialogDescription.displayName = DialogPrimitive.Description.displayName;
21552
+ var DialogClose = DialogPrimitive.Close;
21553
+
21752
21554
  // src/ui/link-modal/LinkEditorPanel.tsx
21753
21555
  import { Info, X as X4 } from "lucide-react";
21754
21556
 
21755
21557
  // src/ui/link-modal/DestinationBreadcrumb.tsx
21756
- import { ArrowRight as ArrowRight3, File, GalleryVertical } from "lucide-react";
21558
+ import { ArrowRight as ArrowRight2, File, GalleryVertical } from "lucide-react";
21757
21559
  import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
21758
21560
  function DestinationBreadcrumb({
21759
21561
  pageTitle,
@@ -21767,7 +21569,7 @@ function DestinationBreadcrumb({
21767
21569
  /* @__PURE__ */ jsx25("span", { className: "text-sm font-medium leading-none text-foreground!", children: pageTitle })
21768
21570
  ] }),
21769
21571
  /* @__PURE__ */ jsx25(
21770
- ArrowRight3,
21572
+ ArrowRight2,
21771
21573
  {
21772
21574
  size: 16,
21773
21575
  className: "shrink-0 text-muted-foreground",
@@ -21879,7 +21681,7 @@ function Label({ className, ...props }) {
21879
21681
  }
21880
21682
 
21881
21683
  // src/ui/link-modal/UrlOrPageInput.tsx
21882
- import { ChevronDown as ChevronDown5, File as File2, X as X3 } from "lucide-react";
21684
+ import { ChevronDown as ChevronDown4, File as File2, X as X3 } from "lucide-react";
21883
21685
  import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
21884
21686
  function FieldChevron({
21885
21687
  onClick
@@ -21892,7 +21694,7 @@ function FieldChevron({
21892
21694
  onClick,
21893
21695
  "aria-label": "Open page list",
21894
21696
  tabIndex: -1,
21895
- children: /* @__PURE__ */ jsx29(ChevronDown5, { size: 16 })
21697
+ children: /* @__PURE__ */ jsx29(ChevronDown4, { size: 16 })
21896
21698
  }
21897
21699
  );
21898
21700
  }
@@ -22122,7 +21924,7 @@ function LinkEditorPanel({ state, onClose }) {
22122
21924
  // src/ui/link-modal/SectionPickerOverlay.tsx
22123
21925
  import { useCallback as useCallback7, useEffect as useEffect14, useMemo as useMemo2, useRef as useRef10, useState as useState13 } from "react";
22124
21926
  import { createPortal as createPortal2 } from "react-dom";
22125
- import { ArrowLeft as ArrowLeft3, Check as Check4 } from "lucide-react";
21927
+ import { ArrowLeft as ArrowLeft2, Check as Check3 } from "lucide-react";
22126
21928
  import { usePathname as usePathname2, useRouter as useRouter2 } from "next/navigation";
22127
21929
 
22128
21930
  // src/lib/parent-scroll.ts
@@ -22399,7 +22201,7 @@ function SectionPickerOverlay({
22399
22201
  className: "h-8 min-w-0 gap-1 border-border bg-background px-2 py-1.5 shadow-sm hover:bg-muted cursor-pointer",
22400
22202
  onClick: onBack,
22401
22203
  children: [
22402
- /* @__PURE__ */ jsx31(ArrowLeft3, { className: "size-4 shrink-0", "aria-hidden": true }),
22204
+ /* @__PURE__ */ jsx31(ArrowLeft2, { className: "size-4 shrink-0", "aria-hidden": true }),
22403
22205
  "Back"
22404
22206
  ]
22405
22207
  }
@@ -22468,7 +22270,7 @@ function SectionPickerOverlay({
22468
22270
  className: "absolute right-3 top-3 flex size-8 items-center justify-center rounded-full text-white",
22469
22271
  style: { backgroundColor: "var(--ohw-primary, #0885fe)" },
22470
22272
  "aria-hidden": true,
22471
- children: /* @__PURE__ */ jsx31(Check4, { className: "size-5" })
22273
+ children: /* @__PURE__ */ jsx31(Check3, { className: "size-5" })
22472
22274
  }
22473
22275
  ) : null
22474
22276
  ]
@@ -22852,7 +22654,6 @@ function shouldUseDevFixtures() {
22852
22654
  function getLogoElement(el) {
22853
22655
  const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
22854
22656
  if (marked) return marked;
22855
- if (el.closest('[data-ohw-editable="icon"]')) return null;
22856
22657
  const root = el.closest("nav, [data-ohw-nav-root], footer");
22857
22658
  if (!root) return null;
22858
22659
  const anchor = el.closest("a");
@@ -22922,7 +22723,7 @@ function addFooterColumnWithPersist({
22922
22723
  import {
22923
22724
  useCallback as useCallback9,
22924
22725
  useEffect as useEffect17,
22925
- useLayoutEffect as useLayoutEffect6,
22726
+ useLayoutEffect as useLayoutEffect5,
22926
22727
  useRef as useRef11,
22927
22728
  useState as useState15
22928
22729
  } from "react";
@@ -23019,7 +22820,7 @@ function FloatingPanel({
23019
22820
  return () => window.removeEventListener("message", onParentScroll);
23020
22821
  }, [open]);
23021
22822
  const positionRef = useRef11(position);
23022
- useLayoutEffect6(() => {
22823
+ useLayoutEffect5(() => {
23023
22824
  if (!open) {
23024
22825
  positionRef.current = position;
23025
22826
  return;
@@ -23029,7 +22830,7 @@ function FloatingPanel({
23029
22830
  }
23030
22831
  positionRef.current = position;
23031
22832
  }, [open, position, liveScroll, parentScroll]);
23032
- useLayoutEffect6(() => {
22833
+ useLayoutEffect5(() => {
23033
22834
  if (!open || !panelRef.current) return;
23034
22835
  const el = panelRef.current;
23035
22836
  const header = el.querySelector("[data-ohw-floating-panel-header]");
@@ -23238,7 +23039,7 @@ function SocialsDisplayPanel({ display, onChange, className }) {
23238
23039
  }
23239
23040
 
23240
23041
  // src/ui/button-style-panel.tsx
23241
- import { Check as Check5 } from "lucide-react";
23042
+ import { Check as Check4 } from "lucide-react";
23242
23043
  import { jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
23243
23044
  var SIZE_LABEL = { s: "S", m: "M", l: "L" };
23244
23045
  function ButtonStylePanel({
@@ -23309,7 +23110,7 @@ function ButtonStylePanel({
23309
23110
  {
23310
23111
  className: "absolute right-0.5 top-0.5 flex size-5 items-center justify-center rounded-full bg-primary text-primary-foreground",
23311
23112
  "aria-hidden": true,
23312
- children: /* @__PURE__ */ jsx35(Check5, { className: "size-3", strokeWidth: 3 })
23113
+ children: /* @__PURE__ */ jsx35(Check4, { className: "size-3", strokeWidth: 3 })
23313
23114
  }
23314
23115
  ) : null
23315
23116
  ]
@@ -24341,7 +24142,7 @@ function useSectionDrag({
24341
24142
  }
24342
24143
 
24343
24144
  // src/ui/footer-container-chrome.tsx
24344
- import { Plus as Plus4 } from "lucide-react";
24145
+ import { Plus as Plus3 } from "lucide-react";
24345
24146
  import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
24346
24147
  function FooterContainerChrome({
24347
24148
  rect,
@@ -24382,7 +24183,7 @@ function FooterContainerChrome({
24382
24183
  if (addDisabled) return;
24383
24184
  onAdd();
24384
24185
  },
24385
- children: /* @__PURE__ */ jsx36(Plus4, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24186
+ children: /* @__PURE__ */ jsx36(Plus3, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24386
24187
  }
24387
24188
  ) }),
24388
24189
  /* @__PURE__ */ jsx36(TooltipContent, { side: "bottom", sideOffset: 9, children: addDisabled ? "Maximum columns reached" : "Add item" })
@@ -24789,7 +24590,7 @@ function retargetPageLinks(change, deps) {
24789
24590
  }
24790
24591
 
24791
24592
  // src/ui/navbar-container-chrome.tsx
24792
- import { Plus as Plus5 } from "lucide-react";
24593
+ import { Plus as Plus4 } from "lucide-react";
24793
24594
  import { jsx as jsx37 } from "react/jsx-runtime";
24794
24595
  function NavbarContainerChrome({
24795
24596
  rect,
@@ -24825,7 +24626,7 @@ function NavbarContainerChrome({
24825
24626
  e.stopPropagation();
24826
24627
  onAdd();
24827
24628
  },
24828
- children: /* @__PURE__ */ jsx37(Plus5, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24629
+ children: /* @__PURE__ */ jsx37(Plus4, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24829
24630
  }
24830
24631
  )
24831
24632
  }
@@ -24897,7 +24698,7 @@ function Badge({ className, variant, ...props }) {
24897
24698
  }
24898
24699
 
24899
24700
  // src/OhhwellsBridge.tsx
24900
- import { Brush as Brush2, Link as Link2, Plus as Plus6, Settings } from "lucide-react";
24701
+ import { Brush as Brush2, Link as Link2, Plus as Plus5, Settings } from "lucide-react";
24901
24702
  import { Fragment as Fragment13, jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
24902
24703
  var PRIMARY7 = "#0885FE";
24903
24704
  var IMAGE_FADE_MS = 300;
@@ -25675,7 +25476,7 @@ function getNavigationSelectionParent(el) {
25675
25476
  if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
25676
25477
  return resolveFooterLinksContainerFrom(el);
25677
25478
  }
25678
- 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)) {
25479
+ if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
25679
25480
  return getNavigationRoot(el);
25680
25481
  }
25681
25482
  return null;
@@ -25897,6 +25698,7 @@ var ICONS = {
25897
25698
  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"/>',
25898
25699
  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"/>'
25899
25700
  };
25701
+ var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
25900
25702
  var SELECTION_CHROME_GAP2 = 4;
25901
25703
  var TOOLBAR_STROKE_GAP2 = 4;
25902
25704
  var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
@@ -25994,7 +25796,7 @@ function applyVisibleViewport(el, parentScroll) {
25994
25796
  el.style.top = `${top}px`;
25995
25797
  el.style.height = `${height}px`;
25996
25798
  }
25997
- var TOOLBAR_EDGE_MARGIN4 = 4;
25799
+ var TOOLBAR_EDGE_MARGIN3 = 4;
25998
25800
  function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
25999
25801
  const isAbove = transform.includes("translateY(-100%)");
26000
25802
  let visualTop = isAbove ? top - approxH : top;
@@ -26021,8 +25823,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
26021
25823
  function clampToolbarLeft(centerX, toolbarWidth) {
26022
25824
  const half = toolbarWidth / 2;
26023
25825
  return Math.max(
26024
- TOOLBAR_EDGE_MARGIN4 + half,
26025
- Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
25826
+ TOOLBAR_EDGE_MARGIN3 + half,
25827
+ Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half)
26026
25828
  );
26027
25829
  }
26028
25830
  function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
@@ -26423,7 +26225,7 @@ function OhhwellsBridge() {
26423
26225
  }, []);
26424
26226
  const subdomainFromQuery = searchParams.get("subdomain");
26425
26227
  const [subdomain, setSubdomain] = useState18(() => resolveSubdomain(subdomainFromQuery));
26426
- useLayoutEffect7(() => {
26228
+ useLayoutEffect6(() => {
26427
26229
  const next = resolveSubdomain(subdomainFromQuery);
26428
26230
  if (next !== subdomain) setSubdomain(next);
26429
26231
  if (next) return;
@@ -26905,6 +26707,21 @@ function OhhwellsBridge() {
26905
26707
  const [isItemDragging, setIsItemDragging] = useState18(false);
26906
26708
  const [isFooterFrameSelection, setIsFooterFrameSelection] = useState18(false);
26907
26709
  isFooterFrameSelectionRef.current = isFooterFrameSelection;
26710
+ const [floatingPanel, setFloatingPanel] = useState18(null);
26711
+ const floatingPanelOpenRef = useRef14(false);
26712
+ floatingPanelOpenRef.current = floatingPanel !== null;
26713
+ const floatingPanelRef = useRef14(null);
26714
+ floatingPanelRef.current = floatingPanel;
26715
+ const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
26716
+ const buttonCollectionDragRef = useRef14(null);
26717
+ const buttonDropInsertIndexRef = useRef14(null);
26718
+ const [buttonDropSlots, setButtonDropSlots] = useState18([]);
26719
+ const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
26720
+ const buttonPointerDragRef = useRef14(null);
26721
+ const [buttonStyleTick, setButtonStyleTick] = useState18(0);
26722
+ const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
26723
+ const [editorViewport, setEditorViewport] = useState18("desktop");
26724
+ const [parentScrollSnap, setParentScrollSnap] = useState18(null);
26908
26725
  const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = useState18(null);
26909
26726
  const [footerHeadingVisible, setFooterHeadingVisible] = useState18(null);
26910
26727
  const footerDragRef = useRef14(null);
@@ -26931,21 +26748,6 @@ function OhhwellsBridge() {
26931
26748
  const stylesRef = useRef14("");
26932
26749
  const appliedDrawerRef = useRef14(null);
26933
26750
  const pendingDeleteUndoRef = useRef14(null);
26934
- const [floatingPanel, setFloatingPanel] = useState18(null);
26935
- const floatingPanelOpenRef = useRef14(false);
26936
- const floatingPanelRef = useRef14(null);
26937
- floatingPanelRef.current = floatingPanel;
26938
- const setFloatingPanelRef = useRef14(setFloatingPanel);
26939
- const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
26940
- const buttonCollectionDragRef = useRef14(null);
26941
- const buttonDropInsertIndexRef = useRef14(null);
26942
- const [buttonDropSlots, setButtonDropSlots] = useState18([]);
26943
- const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
26944
- const buttonPointerDragRef = useRef14(null);
26945
- const [buttonStyleTick, setButtonStyleTick] = useState18(0);
26946
- const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
26947
- const [editorViewport, setEditorViewport] = useState18("desktop");
26948
- const [parentScrollSnap, setParentScrollSnap] = useState18(null);
26949
26751
  const [sitePages, setSitePages] = useState18([]);
26950
26752
  const collectionItemsRef = useRef14(/* @__PURE__ */ new Map());
26951
26753
  const [sectionsByPath, setSectionsByPath] = useState18({});
@@ -26955,18 +26757,7 @@ function OhhwellsBridge() {
26955
26757
  const linkPopoverOpenRef = useRef14(false);
26956
26758
  const linkPopoverGraceUntilRef = useRef14(0);
26957
26759
  setLinkPopoverRef.current = setLinkPopover;
26958
- setFloatingPanelRef.current = setFloatingPanel;
26959
26760
  linkPopoverSessionRef.current = linkPopover;
26960
- floatingPanelOpenRef.current = Boolean(floatingPanel);
26961
- useEffect21(() => {
26962
- const syncViewport = () => {
26963
- const next = window.innerWidth <= 480 ? "mobile" : "desktop";
26964
- setEditorViewport((prev) => prev === next ? prev : next);
26965
- };
26966
- syncViewport();
26967
- window.addEventListener("resize", syncViewport);
26968
- return () => window.removeEventListener("resize", syncViewport);
26969
- }, []);
26970
26761
  useEffect21(() => {
26971
26762
  setSectionOrderPersistHandler((entries) => {
26972
26763
  const currentPath = window.location.pathname;
@@ -28673,7 +28464,7 @@ function OhhwellsBridge() {
28673
28464
  isFooterFrameSelection,
28674
28465
  postToParent2
28675
28466
  ]);
28676
- useLayoutEffect7(() => {
28467
+ useLayoutEffect6(() => {
28677
28468
  if (!subdomain || isEditMode) {
28678
28469
  setFetchState("done");
28679
28470
  return;
@@ -28700,7 +28491,6 @@ function OhhwellsBridge() {
28700
28491
  applyAiFooterFromContent(content);
28701
28492
  if (typeof content[STYLE_STORE_KEY] === "string") {
28702
28493
  stylesRef.current = content[STYLE_STORE_KEY];
28703
- document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28704
28494
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28705
28495
  }
28706
28496
  applyBrandChrome(content);
@@ -28711,16 +28501,15 @@ function OhhwellsBridge() {
28711
28501
  if (key === "__ohw_sections") continue;
28712
28502
  if (key === AI_SECTIONS_KEY) continue;
28713
28503
  if (key === AI_FOOTER_KEY) continue;
28714
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28715
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28716
28504
  if (key === BRAND_KIT_KEY) continue;
28717
28505
  if (key === STYLE_STORE_KEY) continue;
28718
28506
  if (BRAND_CHROME_KEYS.has(key)) continue;
28507
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
28719
28508
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
28509
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28720
28510
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28721
28511
  continue;
28722
28512
  }
28723
- if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28724
28513
  if (applyVideoSettingNode(key, val)) continue;
28725
28514
  if (applyCarouselNode(key, val)) continue;
28726
28515
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28760,7 +28549,6 @@ function OhhwellsBridge() {
28760
28549
  });
28761
28550
  applyLinkByKey(key, val);
28762
28551
  }
28763
- applySectionEmbeds(content);
28764
28552
  applyLogoFromContent(content);
28765
28553
  applyLogoSizes(content);
28766
28554
  reconcileNavbarItemsFromContent(content);
@@ -28949,22 +28737,20 @@ function OhhwellsBridge() {
28949
28737
  }
28950
28738
  applyAiFooterFromContent(content);
28951
28739
  if (typeof content[STYLE_STORE_KEY] === "string") {
28952
- document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28953
28740
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28954
28741
  }
28955
28742
  for (const [key, val] of Object.entries(content)) {
28956
28743
  if (key === "__ohw_sections") continue;
28957
28744
  if (key === AI_SECTIONS_KEY) continue;
28958
28745
  if (key === AI_FOOTER_KEY) continue;
28959
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28960
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28961
28746
  if (key === BRAND_KIT_KEY) continue;
28962
28747
  if (key === STYLE_STORE_KEY) continue;
28963
28748
  if (BRAND_CHROME_KEYS.has(key)) continue;
28749
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
28750
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28964
28751
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28965
28752
  continue;
28966
28753
  }
28967
- if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28968
28754
  if (applyVideoSettingNode(key, val)) continue;
28969
28755
  if (applyCarouselNode(key, val)) continue;
28970
28756
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28989,7 +28775,6 @@ function OhhwellsBridge() {
28989
28775
  });
28990
28776
  applyLinkByKey(key, val);
28991
28777
  }
28992
- applySectionEmbeds(content);
28993
28778
  applyLogoFromContent(content);
28994
28779
  reconcileNavbarItemsFromContent(content);
28995
28780
  reconcileFooterOrderFromContent(content);
@@ -29045,7 +28830,7 @@ function OhhwellsBridge() {
29045
28830
  if (debounceTimer) clearTimeout(debounceTimer);
29046
28831
  };
29047
28832
  }, [subdomain, isEditMode, pathname]);
29048
- useLayoutEffect7(() => {
28833
+ useLayoutEffect6(() => {
29049
28834
  const el = document.getElementById("ohw-loader");
29050
28835
  if (!el) return;
29051
28836
  const visible = Boolean(subdomain) && fetchState !== "done";
@@ -29229,11 +29014,26 @@ function OhhwellsBridge() {
29229
29014
  const t2 = setTimeout(measure, 500);
29230
29015
  const ro = new ResizeObserver(schedule);
29231
29016
  ro.observe(document.body);
29017
+ let lastWidth = window.innerWidth;
29018
+ let resizeTimers = [];
29019
+ const clearResizeTimers = () => {
29020
+ resizeTimers.forEach(clearTimeout);
29021
+ resizeTimers = [];
29022
+ };
29023
+ const handleResize = () => {
29024
+ if (window.innerWidth === lastWidth) return;
29025
+ lastWidth = window.innerWidth;
29026
+ clearResizeTimers();
29027
+ resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
29028
+ };
29029
+ window.addEventListener("resize", handleResize);
29232
29030
  return () => {
29233
29031
  clearTimeout(t1);
29234
29032
  clearTimeout(t2);
29235
29033
  if (raf != null) cancelAnimationFrame(raf);
29236
29034
  ro.disconnect();
29035
+ clearResizeTimers();
29036
+ window.removeEventListener("resize", handleResize);
29237
29037
  };
29238
29038
  }, [pathname, isEditMode, postToParent2]);
29239
29039
  useEffect21(() => {
@@ -29530,13 +29330,6 @@ function OhhwellsBridge() {
29530
29330
  if (target.closest("[data-ohw-state-toggle]")) return;
29531
29331
  if (target.closest("[data-ohw-max-badge]")) return;
29532
29332
  if (isInsideLinkEditor(target)) return;
29533
- if (isInsideFloatingPanel(target)) return;
29534
- if (target.closest("[data-ohw-form-toolbar]")) return;
29535
- if (target.closest(
29536
- '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
29537
- )) {
29538
- return;
29539
- }
29540
29333
  if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
29541
29334
  clearMediaSelectionRef.current();
29542
29335
  }
@@ -29560,6 +29353,8 @@ function OhhwellsBridge() {
29560
29353
  return;
29561
29354
  }
29562
29355
  }
29356
+ if (isInsideFloatingPanel(target)) return;
29357
+ if (target.closest("[data-ohw-form-toolbar]")) return;
29563
29358
  const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
29564
29359
  if (collectionItem) {
29565
29360
  e.preventDefault();
@@ -29571,6 +29366,11 @@ function OhhwellsBridge() {
29571
29366
  });
29572
29367
  return;
29573
29368
  }
29369
+ if (target.closest(
29370
+ '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
29371
+ )) {
29372
+ return;
29373
+ }
29574
29374
  {
29575
29375
  const formEl = getFormElement(target);
29576
29376
  const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
@@ -29724,13 +29524,9 @@ function OhhwellsBridge() {
29724
29524
  if (isIconEditable(editable) && !getSocialItem(editable)) {
29725
29525
  e.preventDefault();
29726
29526
  e.stopPropagation();
29527
+ selectIconElementRef.current(editable);
29727
29528
  const aiIcon = editable.hasAttribute("data-ai-icon");
29728
29529
  const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
29729
- if (aiIcon) {
29730
- aiSectionApiRef.current?.selectFromElement(editable);
29731
- } else {
29732
- selectIconElementRef.current(editable);
29733
- }
29734
29530
  postToParentRef.current({
29735
29531
  type: "ow:icon-pick",
29736
29532
  key: editable.dataset.ohwKey ?? "",
@@ -29958,9 +29754,6 @@ function OhhwellsBridge() {
29958
29754
  setHoveredItemRect(null);
29959
29755
  hoveredNavContainerRef.current = null;
29960
29756
  setHoveredNavContainerRect(null);
29961
- siblingHintElRef.current = null;
29962
- setSiblingHintRect(null);
29963
- setSiblingHintRects([]);
29964
29757
  return;
29965
29758
  }
29966
29759
  {
@@ -30081,6 +29874,7 @@ function OhhwellsBridge() {
30081
29874
  hoveredNavContainerRef.current = null;
30082
29875
  setHoveredNavContainerRect(null);
30083
29876
  hoveredItemElRef.current = editable;
29877
+ setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
30084
29878
  }
30085
29879
  }
30086
29880
  }
@@ -30790,11 +30584,7 @@ function OhhwellsBridge() {
30790
30584
  };
30791
30585
  const handleMouseMove = (e) => {
30792
30586
  const { clientX, clientY } = e;
30793
- if (pointOwnedByFloatingPanel(clientX, clientY)) {
30794
- dismissImageHover();
30795
- clearImageHover();
30796
- return;
30797
- }
30587
+ if (pointOwnedByFloatingPanel(clientX, clientY)) return;
30798
30588
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
30799
30589
  document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
30800
30590
  formHoverElRef.current = null;
@@ -30823,12 +30613,7 @@ function OhhwellsBridge() {
30823
30613
  setHoveredItemRect(null);
30824
30614
  hoveredNavContainerRef.current = null;
30825
30615
  setHoveredNavContainerRect(null);
30826
- siblingHintElRef.current = null;
30827
- setSiblingHintRect(null);
30828
- setSiblingHintRects([]);
30829
30616
  dismissImageHover();
30830
- clearImageHover();
30831
- setSectionGap(null);
30832
30617
  return;
30833
30618
  }
30834
30619
  if (probeSocialsRowAt(clientX, clientY)) return;
@@ -30840,11 +30625,7 @@ function OhhwellsBridge() {
30840
30625
  if (e.data?.type !== "ow:pointer-sync") return;
30841
30626
  const { clientX, clientY } = e.data;
30842
30627
  if (typeof clientX !== "number" || typeof clientY !== "number") return;
30843
- if (pointOwnedByFloatingPanel(clientX, clientY)) {
30844
- dismissImageHover();
30845
- clearImageHover();
30846
- return;
30847
- }
30628
+ if (pointOwnedByFloatingPanel(clientX, clientY)) return;
30848
30629
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
30849
30630
  if (probeSocialsRowAt(clientX, clientY)) return;
30850
30631
  probeSectionGapAt(clientX, clientY);
@@ -31224,7 +31005,6 @@ function OhhwellsBridge() {
31224
31005
  applyAiFooterFromContent(content);
31225
31006
  if (typeof content[STYLE_STORE_KEY] === "string") {
31226
31007
  stylesRef.current = content[STYLE_STORE_KEY];
31227
- document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
31228
31008
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
31229
31009
  }
31230
31010
  applyBrandChrome(content);
@@ -31239,16 +31019,15 @@ function OhhwellsBridge() {
31239
31019
  }
31240
31020
  if (key === AI_SECTIONS_KEY) continue;
31241
31021
  if (key === AI_FOOTER_KEY) continue;
31242
- if (key === LOGO_PLACEHOLDER_KEY) continue;
31243
- if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
31244
31022
  if (key === BRAND_KIT_KEY) continue;
31245
31023
  if (key === STYLE_STORE_KEY) continue;
31246
31024
  if (BRAND_CHROME_KEYS.has(key)) continue;
31025
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
31247
31026
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
31027
+ if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
31248
31028
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
31249
31029
  continue;
31250
31030
  }
31251
- if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
31252
31031
  if (applyVideoSettingNode(key, val)) continue;
31253
31032
  if (applyCarouselNode(key, val)) continue;
31254
31033
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -31274,7 +31053,6 @@ function OhhwellsBridge() {
31274
31053
  });
31275
31054
  applyLinkByKey(key, val);
31276
31055
  }
31277
- applySectionEmbeds(content);
31278
31056
  applyLogoFromContent(content);
31279
31057
  applyLogoSizes(content);
31280
31058
  document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
@@ -31914,12 +31692,6 @@ function OhhwellsBridge() {
31914
31692
  closeLinkPopoverRef.current();
31915
31693
  return;
31916
31694
  }
31917
- if (floatingPanelOpenRef.current) {
31918
- setFloatingPanelRef.current(null);
31919
- deselectRef.current();
31920
- deactivateRef.current();
31921
- return;
31922
- }
31923
31695
  deselectRef.current();
31924
31696
  deactivateRef.current();
31925
31697
  clearMediaSelectionRef.current();
@@ -32750,10 +32522,10 @@ function OhhwellsBridge() {
32750
32522
  window.removeEventListener("message", handleDuplicateSection);
32751
32523
  window.removeEventListener("message", handleDeactivate);
32752
32524
  window.removeEventListener("message", handleSelectNav);
32525
+ document.documentElement.removeAttribute("data-ohw-panel-dragging");
32753
32526
  window.removeEventListener("message", handleToastAction);
32754
32527
  window.removeEventListener("message", handleFormCount);
32755
32528
  window.removeEventListener("message", handleUiEscape);
32756
- document.documentElement.removeAttribute("data-ohw-panel-dragging");
32757
32529
  autoSaveTimers.current.forEach(clearTimeout);
32758
32530
  autoSaveTimers.current.clear();
32759
32531
  if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
@@ -33047,7 +32819,7 @@ function OhhwellsBridge() {
33047
32819
  postToParent2({
33048
32820
  type: "ow:ready",
33049
32821
  version: "1",
33050
- bridgeVersion: "0.1.170-next.453",
32822
+ bridgeVersion: "0.1.171",
33051
32823
  path: pathname,
33052
32824
  nodes: collectEditableNodes(editContentRef.current),
33053
32825
  sections
@@ -33783,7 +33555,7 @@ function OhhwellsBridge() {
33783
33555
  className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/80",
33784
33556
  onClick: () => setFieldTypePickerOpen((open) => !open),
33785
33557
  "data-ohw-add-field": "",
33786
- children: /* @__PURE__ */ jsx40(Plus6, { size: 15, "aria-hidden": true })
33558
+ children: /* @__PURE__ */ jsx40(Plus5, { size: 15, "aria-hidden": true })
33787
33559
  }
33788
33560
  ),
33789
33561
  /* @__PURE__ */ jsx40("div", { className: "mx-0.5 h-5 w-px bg-border" }),