@ohhwells/bridge 0.1.169 → 0.1.170-next.453

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -307,9 +307,23 @@ function parseSectionsFromHtml(html) {
307
307
  return parseSectionsFromRoot(doc);
308
308
  }
309
309
 
310
+ // src/lib/soft-hide.ts
311
+ var PREV_DISPLAY_ATTR = "data-ohw-prev-display";
312
+ function softHide(el) {
313
+ if (!el.hasAttribute(PREV_DISPLAY_ATTR)) el.setAttribute(PREV_DISPLAY_ATTR, el.style.display);
314
+ el.style.display = "none";
315
+ }
316
+ function softUnhide(el) {
317
+ const prev = el.getAttribute(PREV_DISPLAY_ATTR);
318
+ el.removeAttribute(PREV_DISPLAY_ATTR);
319
+ if (prev) el.style.display = prev;
320
+ else el.style.removeProperty("display");
321
+ }
322
+
310
323
  // src/lib/section-instances.ts
311
324
  var SECTION_ORDER_KEY = "__ohw_section_order";
312
325
  var REMOVED_ATTR = "data-ohw-section-removed";
326
+ var CLONE_ATTR = "data-ohw-section-clone";
313
327
  function isRemovedSection(el) {
314
328
  return el.hasAttribute(REMOVED_ATTR);
315
329
  }
@@ -378,14 +392,14 @@ function syncRemovedFlags(entries) {
378
392
  const removedIds = new Set(entries.filter((e) => e.removed).map((e) => e.instanceId));
379
393
  document.querySelectorAll(`[${REMOVED_ATTR}]`).forEach((el) => {
380
394
  if (!removedIds.has(instanceIdOf(el))) {
381
- el.style.removeProperty("display");
395
+ softUnhide(el);
382
396
  el.removeAttribute(REMOVED_ATTR);
383
397
  }
384
398
  });
385
399
  for (const id of removedIds) {
386
400
  const el = findByInstanceId(id);
387
401
  if (el) {
388
- el.style.display = "none";
402
+ softHide(el);
389
403
  el.setAttribute(REMOVED_ATTR, "");
390
404
  }
391
405
  }
@@ -438,6 +452,7 @@ function duplicateSectionInstance(instanceId, newId, currentPath, existingEntrie
438
452
  if (!original) return null;
439
453
  const clone = original.cloneNode(true);
440
454
  clone.setAttribute("data-ohw-instance", newId);
455
+ clone.setAttribute(CLONE_ATTR, "");
441
456
  const keyRekeys = rekeySectionSubtree(clone, newId);
442
457
  original.insertAdjacentElement("afterend", clone);
443
458
  const byId = new Map(existingEntries.map((e) => [e.instanceId, e]));
@@ -457,6 +472,15 @@ function duplicateSectionInstance(instanceId, newId, currentPath, existingEntrie
457
472
  function newInstanceId() {
458
473
  return typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `instance-${Date.now()}-${Math.random().toString(36).slice(2)}`;
459
474
  }
475
+ function orderBeforeMove(raw, currentPath) {
476
+ const entries = topLevelSections().map((el, order) => ({
477
+ instanceId: instanceIdOf(el),
478
+ type: sectionTypeOf(el),
479
+ order,
480
+ pagePath: currentPath
481
+ }));
482
+ return JSON.stringify(mergePageSectionOrder(raw, currentPath, entries));
483
+ }
460
484
  function getPageSectionOrderEntries(raw, currentPath) {
461
485
  if (!raw) return [];
462
486
  try {
@@ -508,6 +532,10 @@ function initSectionInstancesFromContent(content, currentPath) {
508
532
  if (type) el.setAttribute("data-ohw-instance", type);
509
533
  });
510
534
  const entries = getPageSectionOrderEntries(content[SECTION_ORDER_KEY], currentPath);
535
+ const listed = new Set(entries.map((entry) => entry.instanceId));
536
+ document.querySelectorAll(`[${CLONE_ATTR}]`).forEach((clone) => {
537
+ if (!listed.has(instanceIdOf(clone))) clone.remove();
538
+ });
511
539
  for (const entry of entries) {
512
540
  if (entry.instanceId === entry.type) continue;
513
541
  if (document.querySelector(`[data-ohw-instance="${CSS.escape(entry.instanceId)}"]`)) continue;
@@ -517,6 +545,7 @@ function initSectionInstancesFromContent(content, currentPath) {
517
545
  if (!original) continue;
518
546
  const clone = original.cloneNode(true);
519
547
  clone.setAttribute("data-ohw-instance", entry.instanceId);
548
+ clone.setAttribute(CLONE_ATTR, "");
520
549
  rekeySectionSubtree(clone, entry.instanceId);
521
550
  original.insertAdjacentElement("afterend", clone);
522
551
  }
@@ -1216,21 +1245,21 @@ function chromeFrom(sample) {
1216
1245
  };
1217
1246
  }
1218
1247
  function filledPrimary(seed) {
1219
- const paint = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
1220
- const luminance = relativeLuminance(paint);
1248
+ const paint2 = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
1249
+ const luminance = relativeLuminance(paint2);
1221
1250
  return {
1222
- background: toCss({ ...paint, a: 1 }),
1251
+ background: toCss({ ...paint2, a: 1 }),
1223
1252
  color: luminance > 0.55 ? "rgb(15, 15, 15)" : "rgb(255, 255, 255)",
1224
1253
  borderColor: TRANSPARENT,
1225
1254
  borderWidth: "0px"
1226
1255
  };
1227
1256
  }
1228
1257
  function generatedSecondary(primary) {
1229
- const paint = accentColor(primary);
1258
+ const paint2 = accentColor(primary);
1230
1259
  return {
1231
1260
  background: TRANSPARENT,
1232
- color: paint,
1233
- borderColor: paint,
1261
+ color: paint2,
1262
+ borderColor: paint2,
1234
1263
  borderWidth: "1px"
1235
1264
  };
1236
1265
  }
@@ -1243,9 +1272,9 @@ function generatedGhost(primary) {
1243
1272
  };
1244
1273
  }
1245
1274
  function normalizeOutlineChrome(outline, primary) {
1246
- const paint = accentColor(primary);
1275
+ const paint2 = accentColor(primary);
1247
1276
  const text = parseColor(outline.color);
1248
- const paintRgb = parseColor(paint);
1277
+ const paintRgb = parseColor(paint2);
1249
1278
  const primaryLabel = parseColor(primary.color);
1250
1279
  const matchesOnPrimary = Boolean(text && primaryLabel) && colorKey(outline.color) === colorKey(primary.color);
1251
1280
  const textTooLight = text ? relativeLuminance(text) > 0.7 : false;
@@ -1254,8 +1283,8 @@ function normalizeOutlineChrome(outline, primary) {
1254
1283
  const hasBorder = parseFloat(outline.borderWidth) > 0;
1255
1284
  return {
1256
1285
  ...outline,
1257
- color: paint,
1258
- borderColor: hasBorder ? paint : outline.borderColor
1286
+ color: paint2,
1287
+ borderColor: hasBorder ? paint2 : outline.borderColor
1259
1288
  };
1260
1289
  }
1261
1290
  function generateButtonVariants(samples) {
@@ -1674,6 +1703,8 @@ function brandTrackedFontFamily(doc, stack) {
1674
1703
  }
1675
1704
  var paintLockByEl = /* @__PURE__ */ new WeakMap();
1676
1705
  var paintObserverByEl = /* @__PURE__ */ new WeakMap();
1706
+ var prePaintByEl = /* @__PURE__ */ new WeakMap();
1707
+ var paintedEls = /* @__PURE__ */ new Set();
1677
1708
  var PAINT_GUARD_ATTRS = {
1678
1709
  attributes: true,
1679
1710
  attributeFilter: ["style", "class"]
@@ -1737,6 +1768,18 @@ function paintedTokensOf(el) {
1737
1768
  }
1738
1769
  function applyButtonStyle(el, assignment, tokens) {
1739
1770
  const doc = el.ownerDocument;
1771
+ if (!prePaintByEl.has(el)) {
1772
+ const label = labelElement(el);
1773
+ const ownLabel = label && label !== el ? label : null;
1774
+ prePaintByEl.set(el, {
1775
+ style: el.getAttribute("style"),
1776
+ variant: el.getAttribute("data-ohw-btn-variant"),
1777
+ size: el.getAttribute("data-ohw-btn-size"),
1778
+ label: ownLabel,
1779
+ labelStyle: ownLabel?.getAttribute("style") ?? null
1780
+ });
1781
+ }
1782
+ paintedEls.add(el);
1740
1783
  const tracked = {
1741
1784
  ...tokens,
1742
1785
  variants: {
@@ -1756,6 +1799,31 @@ function applyButtonStylesFromContent(doc, content) {
1756
1799
  if (!el) continue;
1757
1800
  applyButtonStyle(el, assignment, tokensFromButton(el));
1758
1801
  }
1802
+ for (const el of paintedEls) {
1803
+ if (!el.isConnected) {
1804
+ paintedEls.delete(el);
1805
+ continue;
1806
+ }
1807
+ const id = buttonId(el);
1808
+ if (el.ownerDocument === doc && (!id || !assignments[id])) unpaintButton(el);
1809
+ }
1810
+ }
1811
+ function unpaintButton(el) {
1812
+ paintObserverByEl.get(el)?.disconnect();
1813
+ paintObserverByEl.delete(el);
1814
+ paintLockByEl.delete(el);
1815
+ paintedEls.delete(el);
1816
+ const before = prePaintByEl.get(el);
1817
+ prePaintByEl.delete(el);
1818
+ if (!before) return;
1819
+ const restore = (target, name, value) => {
1820
+ if (value === null) target.removeAttribute(name);
1821
+ else target.setAttribute(name, value);
1822
+ };
1823
+ restore(el, "style", before.style);
1824
+ restore(el, "data-ohw-btn-variant", before.variant);
1825
+ restore(el, "data-ohw-btn-size", before.size);
1826
+ if (before.label?.isConnected) restore(before.label, "style", before.labelStyle);
1759
1827
  }
1760
1828
  function withAssignment(content, id, assignment) {
1761
1829
  return { ...readAssignments(content), [id]: assignment };
@@ -2306,6 +2374,7 @@ function reconcileButtonCollections(doc, content) {
2306
2374
  }
2307
2375
  const snapshots = readSnapshots(content);
2308
2376
  const collections = readCollections(content);
2377
+ dropUnsavedCopies(doc, snapshots, collections);
2309
2378
  for (const collectionState of Object.values(collections)) {
2310
2379
  const live = collectionState.members.map((id) => findButton(doc, id) ?? restoreSnapshot(doc, snapshots[id], content)).filter((el) => Boolean(el && !hidden.has(buttonId(el) ?? "")));
2311
2380
  if (live.length === 0) continue;
@@ -2330,6 +2399,18 @@ function reconcileButtonCollections(doc, content) {
2330
2399
  for (const member of live) setButtonDragAttr(member);
2331
2400
  }
2332
2401
  }
2402
+ function dropUnsavedCopies(doc, snapshots, collections) {
2403
+ const stale = Array.from(doc.querySelectorAll('[data-ohw-href-key*="-copy-"]')).filter((el) => {
2404
+ const id = buttonId(el);
2405
+ return Boolean(id && /-copy-\d+-href$/.test(id) && !snapshots[id]);
2406
+ });
2407
+ for (const el of stale) {
2408
+ const collection = buttonCollectionOf(el);
2409
+ el.remove();
2410
+ const id = collection?.getAttribute(COLLECTION_ATTR) ?? "";
2411
+ if (collection && !collections[id] && listCollectionMembers(collection).length <= 1) unwrapCollection(collection);
2412
+ }
2413
+ }
2333
2414
  function restoreSnapshot(doc, snapshot, content) {
2334
2415
  if (!snapshot) return null;
2335
2416
  const existing = findButton(doc, snapshot.id);
@@ -4864,6 +4945,9 @@ function reconcileNavbarItemsFromContent(content) {
4864
4945
  }
4865
4946
  }
4866
4947
  pruneNavbarItemsNotInOrder(allowed);
4948
+ for (const node of orderForest) {
4949
+ if (node.children.length === 0) collapseEmptyNavDropdownForParent(node.id);
4950
+ }
4867
4951
  applyNavForest(orderForest);
4868
4952
  for (const parentKey of openParentKeys) {
4869
4953
  const trigger = document.querySelector(
@@ -5783,10 +5867,10 @@ function rekeyItemClone(clone, source, sibling, group, newIndex) {
5783
5867
  function setRemoved(el, removed) {
5784
5868
  if (removed) {
5785
5869
  el.setAttribute(ITEM_REMOVED_ATTR, "");
5786
- el.style.display = "none";
5870
+ softHide(el);
5787
5871
  } else if (el.hasAttribute(ITEM_REMOVED_ATTR)) {
5788
5872
  el.removeAttribute(ITEM_REMOVED_ATTR);
5789
- el.style.removeProperty("display");
5873
+ softUnhide(el);
5790
5874
  }
5791
5875
  }
5792
5876
  function seedState(group) {
@@ -6796,6 +6880,21 @@ function pricingCardFeatureCount(tree, index) {
6796
6880
  const target = findPricingCollection(tree)?.children?.[index];
6797
6881
  return target ? pricingFeatureList(target).length : 0;
6798
6882
  }
6883
+ function prevailingFeatureIcon(features) {
6884
+ const counts = /* @__PURE__ */ new Map();
6885
+ for (const row of features) {
6886
+ const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
6887
+ const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
6888
+ entry.count += 1;
6889
+ counts.set(key, entry);
6890
+ }
6891
+ let best = null;
6892
+ for (const entry of counts.values()) {
6893
+ if (!best || entry.count > best.count) best = entry;
6894
+ }
6895
+ if (!best) return {};
6896
+ return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
6897
+ }
6799
6898
  function addPricingCardFeature(tree, index, text) {
6800
6899
  return withPricingCollection(tree, (collection) => {
6801
6900
  const children = collection.children;
@@ -6804,7 +6903,7 @@ function addPricingCardFeature(tree, index, text) {
6804
6903
  const features = pricingFeatureList(target);
6805
6904
  if (features.length >= PRICING_FEATURES_MAX) return false;
6806
6905
  target.slots = target.slots ?? {};
6807
- target.slots.features = [...features, { text }];
6906
+ target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
6808
6907
  return true;
6809
6908
  });
6810
6909
  }
@@ -7448,6 +7547,120 @@ function findSelectableNavContainer(doc = document) {
7448
7547
  );
7449
7548
  }
7450
7549
 
7550
+ // src/lib/youtube.ts
7551
+ var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
7552
+ function extractYouTubeId(input) {
7553
+ const trimmed = input.trim();
7554
+ if (!trimmed) return null;
7555
+ if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
7556
+ let url;
7557
+ try {
7558
+ url = new URL(trimmed);
7559
+ } catch {
7560
+ return null;
7561
+ }
7562
+ const host = url.hostname.replace(/^www\./, "");
7563
+ if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
7564
+ return null;
7565
+ }
7566
+ let candidate = null;
7567
+ if (host === "youtu.be") {
7568
+ candidate = url.pathname.slice(1).split("/")[0] ?? null;
7569
+ } else if (url.pathname === "/watch") {
7570
+ candidate = url.searchParams.get("v");
7571
+ } else {
7572
+ const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
7573
+ candidate = match ? match[1] : null;
7574
+ }
7575
+ return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
7576
+ }
7577
+
7578
+ // src/lib/section-embed.ts
7579
+ var SECTION_EMBED_SUFFIX = "__ohw_embed";
7580
+ function readStoredEmbed(value) {
7581
+ if (value.startsWith("start\n")) {
7582
+ return { raw: value.slice("start\n".length), at: "start" };
7583
+ }
7584
+ return { raw: value, at: "end" };
7585
+ }
7586
+ function embedFrameSrc(value) {
7587
+ const videoId = extractYouTubeId(value);
7588
+ if (videoId) {
7589
+ return { src: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0`, title: "YouTube video" };
7590
+ }
7591
+ let url;
7592
+ try {
7593
+ url = new URL(value);
7594
+ } catch {
7595
+ return null;
7596
+ }
7597
+ const host = url.hostname.replace(/^www\./, "").toLowerCase();
7598
+ if (host === "google.com" && url.pathname.startsWith("/maps") || host === "maps.google.com") {
7599
+ const query = url.searchParams.get("q") || url.searchParams.get("query") || "";
7600
+ const src = query ? `https://maps.google.com/maps?q=${encodeURIComponent(query)}&output=embed` : `https://maps.google.com/maps?output=embed`;
7601
+ return { src, title: "Map" };
7602
+ }
7603
+ if (host === "maps.app.goo.gl") {
7604
+ return { src: value, title: "Map" };
7605
+ }
7606
+ if (host === "calendly.com" || host.endsWith(".calendly.com") || host === "calendar.google.com") {
7607
+ return { src: value, title: "Calendar" };
7608
+ }
7609
+ if (host === "docs.google.com" && url.pathname.includes("/forms/")) {
7610
+ return { src: value.replace(/\/edit(?:\?.*)?$/i, "/viewform"), title: "Form" };
7611
+ }
7612
+ if (host === "forms.gle") {
7613
+ return { src: value, title: "Form" };
7614
+ }
7615
+ return null;
7616
+ }
7617
+ function place(section, box, at) {
7618
+ if (at === "start") {
7619
+ section.insertBefore(box, section.firstChild);
7620
+ return;
7621
+ }
7622
+ section.appendChild(box);
7623
+ }
7624
+ function paint(section, key, src, title, at) {
7625
+ const existing = section.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`);
7626
+ const frame = existing?.querySelector("iframe");
7627
+ if (existing && frame) {
7628
+ if (frame.getAttribute("src") !== src) frame.setAttribute("src", src);
7629
+ frame.title = title;
7630
+ place(section, existing, at);
7631
+ return;
7632
+ }
7633
+ existing?.remove();
7634
+ const box = document.createElement("div");
7635
+ box.setAttribute("data-ohw-section-embed", key);
7636
+ 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;";
7637
+ const frameWrap = document.createElement("div");
7638
+ frameWrap.style.cssText = "position:relative;width:100%;aspect-ratio:16/9;min-height:250px;border-radius:12px;overflow:hidden;background:#0f172a;";
7639
+ const iframe = document.createElement("iframe");
7640
+ iframe.src = src;
7641
+ iframe.title = title;
7642
+ iframe.style.cssText = "position:absolute;inset:0;width:100%;height:100%;border:0;";
7643
+ iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture";
7644
+ iframe.setAttribute("allowfullscreen", "");
7645
+ frameWrap.appendChild(iframe);
7646
+ box.appendChild(frameWrap);
7647
+ place(section, box, at);
7648
+ }
7649
+ function applySectionEmbeds(content) {
7650
+ for (const [key, val] of Object.entries(content)) {
7651
+ if (!key.endsWith(SECTION_EMBED_SUFFIX)) continue;
7652
+ const sectionId = key.slice(0, -SECTION_EMBED_SUFFIX.length);
7653
+ const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
7654
+ const stored = typeof val === "string" ? readStoredEmbed(val) : null;
7655
+ const frame = stored ? embedFrameSrc(stored.raw) : null;
7656
+ if (!section || !stored || !frame) {
7657
+ section?.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`)?.remove();
7658
+ continue;
7659
+ }
7660
+ paint(section, key, frame.src, frame.title, stored.at);
7661
+ }
7662
+ }
7663
+
7451
7664
  // src/ui/ai-tree/aiSectionsManager.tsx
7452
7665
  var import_react_dom = require("react-dom");
7453
7666
  var import_client = require("react-dom/client");
@@ -8021,7 +8234,7 @@ var AI_MOBILE_CSS = [
8021
8234
  // page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
8022
8235
  // template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
8023
8236
  // an exact figure from (no live measurement exists), so this is a safe approximation, not a
8024
- // pixel-exact fit. Horizontal spacing already comes from `data-ai-container`.
8237
+ // pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
8025
8238
  '[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
8026
8239
  // A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
8027
8240
  // window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
@@ -8037,8 +8250,10 @@ var AI_MOBILE_CSS = [
8037
8250
  "[data-ai-section]{overflow-x:hidden}",
8038
8251
  // `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
8039
8252
  // full-bleed section's container sets, so a carousel/media hero that is edge-to-edge on desktop
8040
- // still got a 20px band of section background down both sides on a phone.
8041
- "[data-ai-container]:not([data-ai-full-bleed]){padding:0 20px !important}",
8253
+ // still got a 20px band of section background down both sides on a phone. The footer's own
8254
+ // container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
8255
+ "[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
8256
+ "[data-ai-container]{padding:0 20px !important}",
8042
8257
  "[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
8043
8258
  "[data-ai-cell]{width:100%;min-width:0}",
8044
8259
  // The rule above turns every row into a COLUMN flex container on phones, which silently breaks
@@ -8243,6 +8458,31 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
8243
8458
  function textAttrs(ctx, path) {
8244
8459
  return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
8245
8460
  }
8461
+ var AI_RESPONSIVE_CSS = [
8462
+ "@media (max-width: 960px) {",
8463
+ " [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
8464
+ ' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
8465
+ "}",
8466
+ "@media (max-width: 640px) {",
8467
+ " [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
8468
+ " [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
8469
+ // Group containers flatten to a column on phones; span placements come along for free.
8470
+ // `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
8471
+ // the comment there. This sheet's copy is the narrower selector, so without the exemption it
8472
+ // flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
8473
+ // viewport with the heading/CTA in flow *under* the image, 219px of section background where the
8474
+ // layered text used to be.
8475
+ ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
8476
+ ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
8477
+ // `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
8478
+ // is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
8479
+ // a full-bleed hero gets its 20px side band back below 640px only — the one width where the
8480
+ // other rule had already been taught to stand down.
8481
+ " [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
8482
+ " [data-ai-responsive] { overflow-x: hidden; }",
8483
+ " [data-ai-responsive] img { max-width: 100%; }",
8484
+ "}"
8485
+ ].join("\n");
8246
8486
  var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
8247
8487
  function MediaBox({
8248
8488
  refValue,
@@ -8297,7 +8537,7 @@ function MediaBox({
8297
8537
  position: fill ? "absolute" : void 0,
8298
8538
  inset: fill ? 0 : void 0,
8299
8539
  width: fill ? "100%" : fixedSize ? "auto" : "100%",
8300
- height: fill ? "100%" : void 0,
8540
+ height: fill ? "100%" : fixedSize ? height : void 0,
8301
8541
  aspectRatio: fill ? void 0 : aspectRatio,
8302
8542
  minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
8303
8543
  borderRadius: radius,
@@ -9793,7 +10033,7 @@ function CollectionBlock({ node, ctx, path }) {
9793
10033
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
9794
10034
  "div",
9795
10035
  {
9796
- "data-ai-grid": "",
10036
+ "data-ai-grid": String(itemsPerRow),
9797
10037
  "data-ohw-pricing-collection": isPricing ? "" : void 0,
9798
10038
  style: {
9799
10039
  display: "grid",
@@ -10095,7 +10335,7 @@ function renderNode(node, ctx, path, ambientAlign) {
10095
10335
  },
10096
10336
  children: [
10097
10337
  i > 0 && ctx.heroOverlapFullBleed ? (
10098
- // The section's `data-ai-container` gave up its max-width/gutter so the base
10338
+ // The section's `data-ai-section-inner` gave up its max-width/gutter so the base
10099
10339
  // layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
10100
10340
  // scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
10101
10341
  // the full section width instead of reading at the usual content width.
@@ -10514,6 +10754,7 @@ function AiTreeRenderer({
10514
10754
  ...fillHeight ? { "data-ai-fill-height": "" } : {},
10515
10755
  ...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
10516
10756
  ...bgAttrs,
10757
+ "data-ai-responsive": "",
10517
10758
  style: {
10518
10759
  position: "relative",
10519
10760
  padding: `${padCss} 0`,
@@ -10527,12 +10768,13 @@ function AiTreeRenderer({
10527
10768
  ...fillHeight ? { display: "grid" } : {}
10528
10769
  },
10529
10770
  children: [
10530
- isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
10771
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_RESPONSIVE_CSS }),
10531
10772
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_MOBILE_CSS }),
10773
+ isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
10532
10774
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
10533
10775
  "div",
10534
10776
  {
10535
- "data-ai-container": "",
10777
+ "data-ai-section-inner": "",
10536
10778
  ...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
10537
10779
  style: {
10538
10780
  position: "relative",
@@ -10549,7 +10791,7 @@ function AiTreeRenderer({
10549
10791
  children: tree.rows.map((row, r2) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
10550
10792
  "div",
10551
10793
  {
10552
- "data-ai-row": "",
10794
+ "data-ai-columns": "",
10553
10795
  style: {
10554
10796
  display: "grid",
10555
10797
  gridTemplateColumns: "repeat(12, 1fr)",
@@ -11211,9 +11453,10 @@ function applyAiSectionsToDom(state, options) {
11211
11453
  if (existing && existing.serialized === serialized && existing.container.isConnected) {
11212
11454
  continue;
11213
11455
  }
11214
- const isNewMount = !existing || !existing.container.isConnected;
11215
11456
  let container = existing?.container;
11457
+ let isNewMount = false;
11216
11458
  if (!container || !container.isConnected) {
11459
+ isNewMount = true;
11217
11460
  existing?.root.unmount();
11218
11461
  container?.remove();
11219
11462
  container = document.createElement("div");
@@ -11551,6 +11794,34 @@ function minSpanForFooterBlock(type) {
11551
11794
  return 3;
11552
11795
  }
11553
11796
  }
11797
+ function readLiveSocialItems() {
11798
+ const root = getFooterRoot();
11799
+ const row = root?.querySelector("[data-ohw-socials-row]");
11800
+ if (!row) return [];
11801
+ const items = [];
11802
+ for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
11803
+ const href = anchor.getAttribute("href")?.trim() ?? "";
11804
+ const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
11805
+ const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
11806
+ if (!platform || !/^https?:\/\//i.test(href)) continue;
11807
+ items.push({ platform, href });
11808
+ }
11809
+ return items;
11810
+ }
11811
+ function syncSocialRowsFromDom(tree) {
11812
+ const root = getFooterRoot();
11813
+ if (!root) return;
11814
+ const row = root.querySelector("[data-ohw-socials-row]");
11815
+ const live = readLiveSocialItems();
11816
+ if (row && live.length === 0) return;
11817
+ for (const col of tree.columns) {
11818
+ col.blocks = col.blocks.flatMap((block) => {
11819
+ if (block.type !== "social-row") return [block];
11820
+ if (!row) return [];
11821
+ return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
11822
+ });
11823
+ }
11824
+ }
11554
11825
  function collectBrandBlocks(tree) {
11555
11826
  const brand = [];
11556
11827
  for (const col of tree.columns) {
@@ -11796,6 +12067,7 @@ function textOf2(el) {
11796
12067
  }
11797
12068
  function syncFooterTreeLinksFromDom(tree) {
11798
12069
  const next = cloneTree(tree);
12070
+ syncSocialRowsFromDom(next);
11799
12071
  const domCols = listFooterColumns().map((col) => {
11800
12072
  const heading = getFooterColumnHeadingEl(col);
11801
12073
  const title = heading ? textOf2(heading) : void 0;
@@ -17608,7 +17880,7 @@ function apiBase() {
17608
17880
  function bridgeVersion() {
17609
17881
  try {
17610
17882
  if (true) {
17611
- return "0.1.169";
17883
+ return "0.1.170-next.453";
17612
17884
  }
17613
17885
  } catch {
17614
17886
  }
@@ -17622,7 +17894,7 @@ function stampBridgeVersionOnDocument() {
17622
17894
  return;
17623
17895
  }
17624
17896
  try {
17625
- const v = true ? "0.1.169" : "";
17897
+ const v = true ? "0.1.170-next.453" : "";
17626
17898
  if (v) {
17627
17899
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
17628
17900
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -17783,7 +18055,9 @@ function isFieldRequired(wrapper) {
17783
18055
  function markFormFields(form) {
17784
18056
  form.querySelectorAll("input, textarea").forEach((input) => {
17785
18057
  const type = input.type;
17786
- if (type === "submit" || type === "button" || type === "reset" || type === "hidden") return;
18058
+ if (type === "submit" || type === "button" || type === "reset" || type === "hidden" || type === "checkbox" || type === "radio") {
18059
+ return;
18060
+ }
17787
18061
  if (getFieldWrapper(input)) return;
17788
18062
  let wrapper = input;
17789
18063
  while (wrapper.parentElement && wrapper.parentElement !== form && wrapper.parentElement.querySelectorAll("input, textarea").length === 1) {
@@ -18300,6 +18574,7 @@ function MediaOverlay({
18300
18574
  (prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
18301
18575
  );
18302
18576
  }, [isVideo]);
18577
+ const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
18303
18578
  const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
18304
18579
  const box = {
18305
18580
  position: "fixed",
@@ -18398,11 +18673,10 @@ function MediaOverlay({
18398
18673
  className: "flex items-center justify-center cursor-pointer",
18399
18674
  style: {
18400
18675
  ...box,
18401
- // When text overlays this media, let clicks fall THROUGH to the text underneath. In the
18402
- // parent this needed a whole `ow:click-at` round-trip to re-hit-test inside the iframe;
18403
- // in-document, pointer-events does it natively. The button below opts back in, so
18404
- // Replace still works.
18405
- pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
18676
+ // Visual only. `pointer-events: auto` on this full-bleed rect covered the navbar
18677
+ // (hero bg includes the absolute TopNav) and swallowed CTA press-drag. Text overlay
18678
+ // and cueOnly also need clicks to fall through — Replace / video controls opt back in.
18679
+ pointerEvents: "none",
18406
18680
  // Selected: a firm component ring with no wash, so the image reads as chosen rather
18407
18681
  // than hovered. Hover keeps the existing tinted preview.
18408
18682
  boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
@@ -18429,17 +18703,17 @@ function MediaOverlay({
18429
18703
  },
18430
18704
  children: [
18431
18705
  isVideo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.Film, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.ImageIcon, { size: 14 }),
18432
- isVideo ? "Replace video" : "Replace image"
18706
+ replaceLabel
18433
18707
  ]
18434
18708
  }
18435
18709
  ),
18436
- replaceMode === "none" || cueOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
18710
+ showChrome && replaceMode !== "none" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
18437
18711
  Button,
18438
18712
  {
18439
18713
  "data-ohw-media-overlay": "",
18440
18714
  variant: "outline",
18441
18715
  size: "sm",
18442
- "aria-label": isVideo ? "Replace video" : "Replace image",
18716
+ "aria-label": replaceLabel,
18443
18717
  className: "gap-1.5 cursor-pointer hover:bg-background",
18444
18718
  style: {
18445
18719
  ...OVERLAY_BUTTON_STYLE,
@@ -18462,7 +18736,7 @@ function MediaOverlay({
18462
18736
  },
18463
18737
  children: [
18464
18738
  isVideo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.Film, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.ImageIcon, { size: 14 }),
18465
- replaceMode === "full" ? isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image" : null
18739
+ replaceMode === "full" ? replaceLabel : null
18466
18740
  ]
18467
18741
  }
18468
18742
  )
@@ -18610,7 +18884,7 @@ function highlightedRect() {
18610
18884
  const rect = first.getBoundingClientRect();
18611
18885
  return { top: rect.top + window.scrollY, bottom: rect.bottom + window.scrollY };
18612
18886
  }
18613
- function installAiChangeHighlight() {
18887
+ function installAiChangeHighlight(select) {
18614
18888
  const onMessage = (e) => {
18615
18889
  const data = e.data;
18616
18890
  if (data?.type !== "ow:ai-highlight") return;
@@ -18619,6 +18893,8 @@ function installAiChangeHighlight() {
18619
18893
  const item = raw && typeof raw.sectionId === "string" && typeof raw.group === "string" && typeof raw.index === "number" ? { sectionId: raw.sectionId, group: raw.group, index: raw.index } : void 0;
18620
18894
  const sectionId = typeof data.sectionId === "string" ? data.sectionId : void 0;
18621
18895
  const found = highlightChangedElements(keys, item, sectionId);
18896
+ const first = data.select === true ? document.querySelector(`[${MARK_ATTR}]`) : null;
18897
+ if (first) select?.(first);
18622
18898
  const rect = data.reveal === true && found > 0 ? highlightedRect() : null;
18623
18899
  window.parent?.postMessage({ type: "ow:ai-highlight-done", found, ...rect ? { rect } : {} }, "*");
18624
18900
  };
@@ -18626,6 +18902,28 @@ function installAiChangeHighlight() {
18626
18902
  return () => window.removeEventListener("message", onMessage);
18627
18903
  }
18628
18904
 
18905
+ // src/lib/history-key-relay.ts
18906
+ var isMac = () => typeof navigator !== "undefined" && /Mac|iPhone|iPad/i.test(navigator.platform || navigator.userAgent);
18907
+ function historyActionFor(e, mac = isMac()) {
18908
+ const mod = mac ? e.metaKey : e.ctrlKey;
18909
+ if (!mod || e.altKey) return null;
18910
+ const key = e.key.toLowerCase();
18911
+ if (key === "z") return e.shiftKey ? "redo" : "undo";
18912
+ if (key === "y" && !mac) return "redo";
18913
+ return null;
18914
+ }
18915
+ var isEditingText = (el) => !!el && (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement || el instanceof HTMLElement && el.isContentEditable);
18916
+ function installHistoryKeyRelay() {
18917
+ const onKeyDown = (e) => {
18918
+ const action = historyActionFor(e);
18919
+ if (!action || isEditingText(document.activeElement)) return;
18920
+ e.preventDefault();
18921
+ window.parent?.postMessage({ type: "ow:history-key", action }, "*");
18922
+ };
18923
+ window.addEventListener("keydown", onKeyDown);
18924
+ return () => window.removeEventListener("keydown", onKeyDown);
18925
+ }
18926
+
18629
18927
  // src/ui/ai-section/AiSectionOverlay.tsx
18630
18928
  var import_jsx_runtime19 = require("react/jsx-runtime");
18631
18929
  var findSectionElement = findByInstanceId;
@@ -18878,7 +19176,8 @@ function AiSectionOverlay({
18878
19176
  window.addEventListener("message", onMessage);
18879
19177
  return () => window.removeEventListener("message", onMessage);
18880
19178
  }, [postToParent2]);
18881
- (0, import_react12.useEffect)(() => installAiChangeHighlight(), []);
19179
+ (0, import_react12.useEffect)(() => installAiChangeHighlight((el) => selectFromElement(el)), [selectFromElement]);
19180
+ (0, import_react12.useEffect)(() => installHistoryKeyRelay(), []);
18882
19181
  const [hoveredId, setHoveredId] = (0, import_react12.useState)(null);
18883
19182
  (0, import_react12.useEffect)(() => {
18884
19183
  const onMove = (e) => {
@@ -19069,7 +19368,7 @@ function AiSectionOverlay({
19069
19368
 
19070
19369
  // src/ui/ai-section/AiMediaStripOverlay.tsx
19071
19370
  var import_react13 = require("react");
19072
- var import_lucide_react8 = require("lucide-react");
19371
+ var import_lucide_react9 = require("lucide-react");
19073
19372
 
19074
19373
  // src/lib/ai-media-strip-tree.ts
19075
19374
  var MEDIA_STRIP_ITEM_MIN = 1;
@@ -19183,14 +19482,6 @@ function setMediaStripItemAsset(tree, index, assetId) {
19183
19482
  return true;
19184
19483
  });
19185
19484
  }
19186
- function setMediaStripItemAlt(tree, index, alt) {
19187
- return withMediaStrip(tree, (block) => {
19188
- const items = block.items;
19189
- if (index < 0 || index >= items.length) return false;
19190
- items[index] = { ...items[index], alt };
19191
- return true;
19192
- });
19193
- }
19194
19485
  function setMediaStripItemLink(tree, index, link) {
19195
19486
  return withMediaStrip(tree, (block) => {
19196
19487
  const items = block.items;
@@ -19208,11 +19499,117 @@ function setMediaStripItemLink(tree, index, link) {
19208
19499
  });
19209
19500
  }
19210
19501
 
19211
- // src/ui/ai-section/AiMediaStripOverlay.tsx
19502
+ // src/ui/dialog.tsx
19503
+ var React9 = __toESM(require("react"), 1);
19504
+ var import_radix_ui6 = require("radix-ui");
19505
+ var import_lucide_react8 = require("lucide-react");
19212
19506
  var import_jsx_runtime20 = require("react/jsx-runtime");
19213
- var PRIMARY3 = "#0885FE";
19214
- var OHW_BLUE = `var(--ohw-primary, ${PRIMARY3})`;
19215
- var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
19507
+ function Dialog2({
19508
+ ...props
19509
+ }) {
19510
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
19511
+ }
19512
+ function DialogPortal({
19513
+ ...props
19514
+ }) {
19515
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
19516
+ }
19517
+ function DialogOverlay({
19518
+ className,
19519
+ ...props
19520
+ }) {
19521
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19522
+ import_radix_ui6.Dialog.Overlay,
19523
+ {
19524
+ "data-slot": "dialog-overlay",
19525
+ "data-ohw-link-modal-root": "",
19526
+ className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
19527
+ ...props
19528
+ }
19529
+ );
19530
+ }
19531
+ var DialogContent = React9.forwardRef(
19532
+ ({ className, children, showCloseButton = true, container, ...props }, ref) => {
19533
+ const positionMode = container ? "absolute" : "fixed";
19534
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DialogPortal, { container: container ?? void 0, children: [
19535
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
19536
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
19537
+ import_radix_ui6.Dialog.Content,
19538
+ {
19539
+ ref,
19540
+ "data-slot": "dialog-content",
19541
+ className: cn(
19542
+ positionMode,
19543
+ "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",
19544
+ "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
19545
+ container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
19546
+ className
19547
+ ),
19548
+ onMouseDown: (e) => e.stopPropagation(),
19549
+ ...props,
19550
+ children: [
19551
+ children,
19552
+ showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19553
+ import_radix_ui6.Dialog.Close,
19554
+ {
19555
+ type: "button",
19556
+ className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
19557
+ "aria-label": "Close",
19558
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.X, { size: 16, "aria-hidden": true })
19559
+ }
19560
+ ) : null
19561
+ ]
19562
+ }
19563
+ )
19564
+ ] });
19565
+ }
19566
+ );
19567
+ DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
19568
+ function DialogHeader({
19569
+ className,
19570
+ ...props
19571
+ }) {
19572
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
19573
+ }
19574
+ function DialogFooter({
19575
+ className,
19576
+ ...props
19577
+ }) {
19578
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19579
+ "div",
19580
+ {
19581
+ className: cn("flex items-center justify-end gap-2", className),
19582
+ ...props
19583
+ }
19584
+ );
19585
+ }
19586
+ var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19587
+ import_radix_ui6.Dialog.Title,
19588
+ {
19589
+ ref,
19590
+ className: cn(
19591
+ "text-lg font-semibold leading-none tracking-tight text-card-foreground",
19592
+ className
19593
+ ),
19594
+ ...props
19595
+ }
19596
+ ));
19597
+ DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
19598
+ var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19599
+ import_radix_ui6.Dialog.Description,
19600
+ {
19601
+ ref,
19602
+ className: cn("text-sm text-muted-foreground", className),
19603
+ ...props
19604
+ }
19605
+ ));
19606
+ DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
19607
+ var DialogClose = import_radix_ui6.Dialog.Close;
19608
+
19609
+ // src/ui/ai-section/AiMediaStripOverlay.tsx
19610
+ var import_jsx_runtime21 = require("react/jsx-runtime");
19611
+ var PRIMARY3 = "var(--ohw-primary, #0885FE)";
19612
+ 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]";
19216
19613
  function findMediaStripItemElement(sectionId, index) {
19217
19614
  const sectionEl2 = findByInstanceId(sectionId);
19218
19615
  if (!sectionEl2) return null;
@@ -19222,14 +19619,35 @@ function findMediaStripItemElement(sectionId, index) {
19222
19619
  }
19223
19620
  return null;
19224
19621
  }
19225
- function readRect2(ref) {
19226
- const el = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19622
+ function itemRefFromTarget(target) {
19623
+ if (!(target instanceof Element)) return null;
19624
+ if (target.closest(CHROME_SELECTOR)) return null;
19625
+ const itemEl = target.closest("[data-ohw-media-strip-item]");
19626
+ if (!itemEl) return null;
19627
+ const sectionEl2 = itemEl.closest("[data-ohw-section]");
19628
+ const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
19629
+ const sectionId = unit ? instanceIdOf(unit) || null : null;
19630
+ const index = Number(itemEl.dataset.ohwMediaStripIndex);
19631
+ if (!sectionId || Number.isNaN(index)) return null;
19632
+ return { sectionId, index };
19633
+ }
19634
+ function sameRef(a, b) {
19635
+ return a?.sectionId === b?.sectionId && a?.index === b?.index;
19636
+ }
19637
+ function rectOf(el) {
19227
19638
  if (!el) return null;
19228
19639
  const r2 = el.getBoundingClientRect();
19229
19640
  if (r2.width <= 0 || r2.height <= 0) return null;
19230
19641
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
19231
19642
  }
19232
- function useLiveItemRect(ref) {
19643
+ function readRect2(ref) {
19644
+ return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
19645
+ }
19646
+ function readStripRect(ref) {
19647
+ const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19648
+ return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
19649
+ }
19650
+ function useLiveItemRect(ref, strip = false) {
19233
19651
  const [rect, setRect] = (0, import_react13.useState)(null);
19234
19652
  (0, import_react13.useEffect)(() => {
19235
19653
  if (!ref) {
@@ -19237,7 +19655,7 @@ function useLiveItemRect(ref) {
19237
19655
  return;
19238
19656
  }
19239
19657
  const update = () => {
19240
- const next = readRect2(ref);
19658
+ const next = strip ? readStripRect(ref) : readRect2(ref);
19241
19659
  setRect(
19242
19660
  (prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
19243
19661
  );
@@ -19252,33 +19670,73 @@ function useLiveItemRect(ref) {
19252
19670
  window.removeEventListener("resize", update);
19253
19671
  clearInterval(interval);
19254
19672
  };
19255
- }, [ref?.sectionId, ref?.index]);
19673
+ }, [ref?.sectionId, ref?.index, strip]);
19256
19674
  return rect;
19257
19675
  }
19258
- function requestValidateTree(postToParent2, tree) {
19259
- return new Promise((resolve) => {
19260
- const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
19261
- const timeout = window.setTimeout(() => {
19262
- window.removeEventListener("message", onMessage);
19263
- resolve({ ok: false, reasons: ["Validation request timed out."] });
19264
- }, 8e3);
19265
- function onMessage(e) {
19266
- if (e.data?.type !== "ow:ai-validate-tree-result" || e.data.id !== id) return;
19267
- window.clearTimeout(timeout);
19268
- window.removeEventListener("message", onMessage);
19269
- resolve({ ok: e.data.ok === true, reasons: Array.isArray(e.data.reasons) ? e.data.reasons : [] });
19270
- }
19271
- window.addEventListener("message", onMessage);
19272
- postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
19273
- });
19274
- }
19275
- function requestAssetPick(postToParent2) {
19276
- return new Promise((resolve) => {
19277
- const id = `ai-asset-pick-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
19278
- const timeout = window.setTimeout(() => {
19279
- window.removeEventListener("message", onMessage);
19280
- resolve(null);
19281
- }, 3e5);
19676
+ var TOOLBAR_STRIP_GAP = 52;
19677
+ var TOOLBAR_STRIP_GAP_MOBILE = 42;
19678
+ var TOOLBAR_EDGE_MARGIN2 = 4;
19679
+ function StripToolbarSlot({ stripRect, children }) {
19680
+ const slotRef = (0, import_react13.useRef)(null);
19681
+ const [shift, setShift] = (0, import_react13.useState)(0);
19682
+ const centerX = stripRect.left + stripRect.width / 2;
19683
+ (0, import_react13.useLayoutEffect)(() => {
19684
+ const slot = slotRef.current;
19685
+ if (!slot) return;
19686
+ const clamp = () => {
19687
+ const w = slot.offsetWidth;
19688
+ if (w <= 0) return;
19689
+ const half = w / 2;
19690
+ const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
19691
+ setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
19692
+ };
19693
+ clamp();
19694
+ const ro = new ResizeObserver(clamp);
19695
+ ro.observe(slot);
19696
+ return () => ro.disconnect();
19697
+ }, [centerX, children]);
19698
+ const mobile = window.innerWidth <= 480;
19699
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19700
+ "div",
19701
+ {
19702
+ ref: slotRef,
19703
+ "data-ohw-bridge": "",
19704
+ "data-ohw-item-interaction": "",
19705
+ className: "pointer-events-auto fixed",
19706
+ style: {
19707
+ top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
19708
+ left: centerX + shift,
19709
+ transform: "translate(-50%, -100%)",
19710
+ zIndex: 2147483645
19711
+ },
19712
+ children
19713
+ }
19714
+ );
19715
+ }
19716
+ function requestValidateTree(postToParent2, tree) {
19717
+ return new Promise((resolve) => {
19718
+ const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
19719
+ const timeout = window.setTimeout(() => {
19720
+ window.removeEventListener("message", onMessage);
19721
+ resolve({ ok: false, reasons: ["Validation request timed out."] });
19722
+ }, 8e3);
19723
+ function onMessage(e) {
19724
+ if (e.data?.type !== "ow:ai-validate-tree-result" || e.data.id !== id) return;
19725
+ window.clearTimeout(timeout);
19726
+ window.removeEventListener("message", onMessage);
19727
+ resolve({ ok: e.data.ok === true, reasons: Array.isArray(e.data.reasons) ? e.data.reasons : [] });
19728
+ }
19729
+ window.addEventListener("message", onMessage);
19730
+ postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
19731
+ });
19732
+ }
19733
+ function requestAssetPick(postToParent2) {
19734
+ return new Promise((resolve) => {
19735
+ const id = `ai-asset-pick-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
19736
+ const timeout = window.setTimeout(() => {
19737
+ window.removeEventListener("message", onMessage);
19738
+ resolve(null);
19739
+ }, 3e5);
19282
19740
  function onMessage(e) {
19283
19741
  if (e.data?.type !== "ow:asset-picked" || e.data.id !== id) return;
19284
19742
  window.clearTimeout(timeout);
@@ -19291,116 +19749,72 @@ function requestAssetPick(postToParent2) {
19291
19749
  postToParent2({ type: "ow:asset-pick", id });
19292
19750
  });
19293
19751
  }
19294
- function Pill({
19752
+ function ToolbarAction({
19295
19753
  label,
19296
19754
  onClick,
19297
- disabled,
19298
- active
19755
+ disabled = false,
19756
+ active = false,
19757
+ children
19299
19758
  }) {
19300
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19301
- "button",
19302
- {
19303
- type: "button",
19304
- onClick,
19305
- disabled,
19306
- style: {
19307
- height: 28,
19308
- padding: "0 10px",
19309
- display: "inline-flex",
19310
- alignItems: "center",
19311
- gap: 4,
19312
- borderRadius: 999,
19313
- border: "none",
19314
- cursor: disabled ? "default" : "pointer",
19315
- background: active ? OHW_BLUE_DARK : "#ffffff",
19316
- color: active ? "#ffffff" : OHW_BLUE_DARK,
19317
- opacity: disabled ? 0.4 : 1,
19318
- fontSize: 12,
19319
- lineHeight: "16px",
19320
- fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19321
- whiteSpace: "nowrap",
19322
- flex: "0 0 auto"
19323
- },
19324
- children: label
19325
- }
19326
- );
19759
+ const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
19760
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
19761
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: button }) : button }),
19762
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
19763
+ ] });
19327
19764
  }
19328
- function AltInput({ value, onCommit }) {
19329
- const [draft, setDraft] = (0, import_react13.useState)(value);
19330
- (0, import_react13.useEffect)(() => setDraft(value), [value]);
19331
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
19332
- "div",
19333
- {
19334
- style: {
19335
- display: "flex",
19336
- alignItems: "center",
19337
- gap: 6,
19338
- height: 28,
19339
- padding: "0 12px",
19340
- borderRadius: 999,
19341
- background: "#ffffff",
19342
- width: "100%",
19343
- maxWidth: 260,
19344
- boxSizing: "border-box"
19345
- },
19346
- children: [
19347
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19348
- "span",
19349
- {
19350
- style: {
19351
- flex: "0 0 auto",
19352
- color: OHW_BLUE_DARK,
19353
- fontSize: 10,
19354
- fontWeight: 700,
19355
- textTransform: "uppercase",
19356
- letterSpacing: 0.4
19357
- },
19358
- children: "Alt"
19359
- }
19360
- ),
19361
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19362
- "input",
19765
+ function ToolbarSeparator() {
19766
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
19767
+ }
19768
+ function OptionMenu({
19769
+ label,
19770
+ value,
19771
+ options,
19772
+ onChange
19773
+ }) {
19774
+ const current = options.find((o) => o.value === value) ?? options[0];
19775
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
19776
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground", children: label }),
19777
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu, { modal: false, children: [
19778
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
19779
+ "button",
19780
+ {
19781
+ type: "button",
19782
+ "aria-label": label,
19783
+ 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",
19784
+ children: [
19785
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1 text-left", children: current.label }),
19786
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
19787
+ ]
19788
+ }
19789
+ ) }),
19790
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
19791
+ const selected = option.value === value;
19792
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
19793
+ DropdownMenuItem,
19363
19794
  {
19364
- type: "text",
19365
- value: draft,
19366
- onChange: (e) => setDraft(e.target.value),
19367
- onBlur: () => {
19368
- if (draft !== value) onCommit(draft);
19369
- },
19370
- onKeyDown: (e) => {
19371
- if (e.key === "Enter") e.currentTarget.blur();
19372
- if (e.key === "Escape") {
19373
- setDraft(value);
19374
- e.currentTarget.blur();
19375
- }
19376
- },
19377
- placeholder: "Describe this image",
19378
- "aria-label": "Image alt text",
19379
- style: {
19380
- flex: 1,
19381
- minWidth: 0,
19382
- border: "none",
19383
- outline: "none",
19384
- background: "transparent",
19385
- fontSize: 12,
19386
- lineHeight: "16px",
19387
- fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19388
- color: "#1f2937"
19389
- }
19390
- }
19391
- )
19392
- ]
19393
- }
19394
- );
19795
+ role: "menuitemradio",
19796
+ "aria-checked": selected,
19797
+ onSelect: () => onChange(option.value),
19798
+ className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
19799
+ children: [
19800
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: option.label }),
19801
+ selected && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Check, { size: 16, className: "text-bridge-primary" })
19802
+ ]
19803
+ },
19804
+ option.value
19805
+ );
19806
+ }) })
19807
+ ] })
19808
+ ] });
19395
19809
  }
19396
19810
  var VARIANTS = [
19397
19811
  { value: "logos", label: "Logos" },
19398
19812
  { value: "reel", label: "Reel" }
19399
19813
  ];
19400
19814
  var ALIGNS = [
19401
- { value: "left", label: "Left" },
19402
- { value: "center", label: "Center" },
19403
- { value: "right", label: "Right" }
19815
+ { value: "left", label: "Align left", Icon: import_lucide_react9.AlignLeft },
19816
+ { value: "center", label: "Align center", Icon: import_lucide_react9.AlignCenter },
19817
+ { value: "right", label: "Align right", Icon: import_lucide_react9.AlignRight }
19404
19818
  ];
19405
19819
  var HOVERS = [
19406
19820
  { value: "none", label: "None" },
@@ -19408,104 +19822,104 @@ var HOVERS = [
19408
19822
  { value: "zoom", label: "Zoom" },
19409
19823
  { value: "fade", label: "Fade" }
19410
19824
  ];
19411
- var TREATMENTS = [
19412
- { value: "color", label: "Color" },
19413
- { value: "grayscale", label: "Grayscale" }
19414
- ];
19415
19825
  var HTTP_URL_RE = /^https?:\/\/\S+$/i;
19416
- function LinkInput({ value, onCommit }) {
19417
- const [draft, setDraft] = (0, import_react13.useState)(value);
19826
+ function LinkModal({
19827
+ href,
19828
+ linkTarget,
19829
+ onClose,
19830
+ onSave
19831
+ }) {
19832
+ const [draft, setDraft] = (0, import_react13.useState)(href);
19833
+ const [newTab, setNewTab] = (0, import_react13.useState)(linkTarget !== "same-tab");
19418
19834
  const [invalid, setInvalid] = (0, import_react13.useState)(false);
19419
- (0, import_react13.useEffect)(() => {
19420
- setDraft(value);
19421
- setInvalid(false);
19422
- }, [value]);
19423
- const commit2 = () => {
19835
+ const save = () => {
19424
19836
  const next = draft.trim();
19425
- if (next === value) return setInvalid(false);
19426
- if (next && !HTTP_URL_RE.test(next)) return setInvalid(true);
19427
- setInvalid(false);
19428
- onCommit(next);
19429
- };
19430
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
19431
- "div",
19432
- {
19433
- style: {
19434
- display: "flex",
19435
- alignItems: "center",
19436
- gap: 6,
19437
- height: 28,
19438
- padding: "0 12px",
19439
- borderRadius: 999,
19440
- background: "#ffffff",
19441
- width: "100%",
19442
- maxWidth: 260,
19443
- boxSizing: "border-box",
19444
- boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
19445
- },
19446
- children: [
19447
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19448
- "span",
19449
- {
19450
- style: {
19451
- flex: "0 0 auto",
19452
- color: OHW_BLUE_DARK,
19453
- fontSize: 10,
19454
- fontWeight: 700,
19455
- textTransform: "uppercase",
19456
- letterSpacing: 0.4
19457
- },
19458
- children: "Link"
19459
- }
19460
- ),
19461
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19462
- "input",
19463
- {
19464
- type: "text",
19465
- inputMode: "url",
19466
- value: draft,
19467
- onChange: (e) => setDraft(e.target.value),
19468
- onBlur: commit2,
19469
- onKeyDown: (e) => {
19470
- if (e.key === "Enter") e.currentTarget.blur();
19471
- if (e.key === "Escape") {
19472
- setDraft(value);
19473
- setInvalid(false);
19474
- e.currentTarget.blur();
19475
- }
19476
- },
19477
- placeholder: "https://example.com",
19478
- "aria-label": "Image link URL",
19479
- "aria-invalid": invalid,
19480
- style: {
19481
- flex: 1,
19482
- minWidth: 0,
19483
- border: "none",
19484
- outline: "none",
19485
- background: "transparent",
19486
- fontSize: 12,
19487
- lineHeight: "16px",
19488
- fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19489
- color: "#1f2937"
19490
- }
19491
- }
19492
- )
19493
- ]
19837
+ if (next && !HTTP_URL_RE.test(next)) {
19838
+ setInvalid(true);
19839
+ return;
19494
19840
  }
19495
- );
19841
+ onSave(next, newTab ? "new-tab" : "same-tab");
19842
+ onClose();
19843
+ };
19844
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Dialog2, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogContent, { "data-ohw-link-modal-root": "", className: "max-w-[400px] gap-4 p-5", children: [
19845
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogTitle, { className: "text-base", children: "Image link" }) }),
19846
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-3", children: [
19847
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19848
+ "input",
19849
+ {
19850
+ autoFocus: true,
19851
+ type: "text",
19852
+ inputMode: "url",
19853
+ value: draft,
19854
+ onChange: (e) => {
19855
+ setDraft(e.target.value);
19856
+ setInvalid(false);
19857
+ },
19858
+ onKeyDown: (e) => {
19859
+ if (e.key === "Enter") save();
19860
+ },
19861
+ placeholder: "https://example.com",
19862
+ "aria-label": "Image link URL",
19863
+ "aria-invalid": invalid,
19864
+ className: cn(
19865
+ "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",
19866
+ invalid && "border-destructive focus:border-destructive"
19867
+ )
19868
+ }
19869
+ ),
19870
+ invalid && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
19871
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
19872
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
19873
+ "Open in new tab"
19874
+ ] })
19875
+ ] }),
19876
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogFooter, { children: [
19877
+ href && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19878
+ "button",
19879
+ {
19880
+ type: "button",
19881
+ onClick: () => {
19882
+ onSave("", "new-tab");
19883
+ onClose();
19884
+ },
19885
+ className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
19886
+ children: "Remove link"
19887
+ }
19888
+ ),
19889
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19890
+ "button",
19891
+ {
19892
+ type: "button",
19893
+ onClick: onClose,
19894
+ className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
19895
+ children: "Cancel"
19896
+ }
19897
+ ),
19898
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19899
+ "button",
19900
+ {
19901
+ type: "button",
19902
+ onClick: save,
19903
+ className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
19904
+ children: "Save"
19905
+ }
19906
+ )
19907
+ ] })
19908
+ ] }) });
19496
19909
  }
19497
19910
  function MediaStripToolbar({
19498
19911
  entry,
19499
19912
  index,
19500
19913
  pending,
19501
19914
  error,
19915
+ itemEditOn,
19916
+ onToggleItemEdit,
19502
19917
  onSetVariant,
19503
19918
  onSetAlign,
19504
19919
  onSetHover,
19505
19920
  onSetTreatment,
19506
19921
  onResize,
19507
- onSetAlt,
19508
- onSetLink,
19922
+ onOpenLink,
19509
19923
  onAddItem,
19510
19924
  onRemoveItem,
19511
19925
  onChangeImage,
@@ -19514,81 +19928,102 @@ function MediaStripToolbar({
19514
19928
  }) {
19515
19929
  const items = mediaStripItems(entry.tree);
19516
19930
  const itemCount = items.length;
19517
- const currentAlt = items[index]?.alt ?? "";
19518
- const currentHref2 = items[index]?.href ?? "";
19519
- const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
19520
19931
  const slots = findMediaStripSlots(entry.tree);
19521
19932
  const variant = slots?.variant === "reel" ? "reel" : "logos";
19522
19933
  const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
19523
19934
  const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
19524
19935
  const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
19525
19936
  const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19526
- const isMobile = window.innerWidth <= 480;
19527
- const rowStyle = isMobile ? {
19528
- display: "flex",
19529
- gap: 6,
19530
- flexWrap: "nowrap",
19531
- justifyContent: "center",
19532
- overflowX: "auto",
19533
- WebkitOverflowScrolling: "touch",
19534
- width: "100%",
19535
- scrollbarWidth: "none"
19536
- } : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
19537
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
19937
+ const mobile = window.innerWidth <= 480;
19938
+ const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
19939
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
19538
19940
  "div",
19539
19941
  {
19540
19942
  "data-ohw-bridge": "",
19541
19943
  "data-ohw-toolbar": "",
19542
19944
  onMouseDown: (e) => e.stopPropagation(),
19543
- style: {
19544
- display: "flex",
19545
- flexDirection: "column",
19546
- gap: 6,
19547
- alignItems: "center",
19548
- background: OHW_BLUE,
19549
- padding: 8,
19550
- borderRadius: 12,
19551
- boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
19552
- pointerEvents: pending ? "none" : "auto",
19553
- opacity: pending ? 0.6 : 1,
19554
- maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
19555
- },
19945
+ className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
19946
+ style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
19556
19947
  children: [
19557
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19558
- VARIANTS.map((v) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: v.label, active: variant === v.value, onClick: () => onSetVariant(v.value) }, v.value)),
19559
- ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: a.label, active: align === a.value, onClick: () => onSetAlign(a.value) }, a.value))
19560
- ] }),
19561
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19562
- HOVERS.map((h) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: h.label, active: hover === h.value, onClick: () => onSetHover(h.value) }, h.value)),
19563
- TREATMENTS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: t.label, active: treatment === t.value, onClick: () => onSetTreatment(t.value) }, t.value))
19564
- ] }),
19565
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
19566
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2212", onClick: () => onResize(-8) }),
19567
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { style: { color: "#ffffff", fontSize: 12, minWidth: 34, textAlign: "center" }, children: [
19568
- sizeValue,
19569
- "px"
19570
- ] }),
19571
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "+", onClick: () => onResize(8) })
19572
- ] }),
19573
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AltInput, { value: currentAlt, onCommit: onSetAlt }) }),
19574
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(LinkInput, { value: currentHref2, onCommit: (href) => onSetLink(href, currentTarget) }) }),
19575
- currentHref2 && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19576
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "New tab", active: currentTarget === "new-tab", onClick: () => onSetLink(currentHref2, "new-tab") }),
19577
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "Same tab", active: currentTarget === "same-tab", onClick: () => onSetLink(currentHref2, "same-tab") })
19578
- ] }),
19579
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19580
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "Change Image", onClick: onChangeImage }),
19581
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "+ Item", onClick: onAddItem }),
19582
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2212 Item", onClick: onRemoveItem, disabled: itemCount <= 1 })
19583
- ] }),
19584
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19585
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2190 Move", onClick: onMoveLeft, disabled: index <= 0 }),
19586
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2192 Move", onClick: onMoveRight, disabled: index >= itemCount - 1 })
19587
- ] }),
19588
- error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
19948
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
19949
+ "div",
19950
+ {
19951
+ className: cn(
19952
+ "flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
19953
+ "shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
19954
+ mobile ? "flex-wrap justify-center" : "flex-nowrap"
19955
+ ),
19956
+ children: [
19957
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
19958
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19959
+ CustomToolbarButton,
19960
+ {
19961
+ type: "button",
19962
+ "aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
19963
+ "aria-pressed": itemEditOn,
19964
+ onClick: onToggleItemEdit,
19965
+ className: "group size-8",
19966
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19967
+ import_lucide_react9.Star,
19968
+ {
19969
+ size: 16,
19970
+ fill: "currentColor",
19971
+ strokeWidth: 0,
19972
+ className: cn(
19973
+ "transition-colors",
19974
+ itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
19975
+ ),
19976
+ style: { pointerEvents: "none" }
19977
+ }
19978
+ )
19979
+ }
19980
+ ) }),
19981
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
19982
+ ] }),
19983
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
19984
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Image, { size: 16, style: { pointerEvents: "none" } }) }),
19985
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Link, { size: 16, style: { pointerEvents: "none" } }) }),
19986
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ArrowLeft, { size: 16, style: { pointerEvents: "none" } }) }),
19987
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19988
+ ToolbarAction,
19989
+ {
19990
+ label: gatedLabel("Move right"),
19991
+ onClick: onMoveRight,
19992
+ disabled: !itemEditOn || index >= itemCount - 1,
19993
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ArrowRight, { size: 16, style: { pointerEvents: "none" } })
19994
+ }
19995
+ ),
19996
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
19997
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
19998
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
19999
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
20000
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20001
+ ToolbarAction,
20002
+ {
20003
+ label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
20004
+ active: treatment === "grayscale",
20005
+ onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
20006
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Palette, { size: 16, style: { pointerEvents: "none" } })
20007
+ }
20008
+ ),
20009
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
20010
+ ALIGNS.map(({ value, label, Icon }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label, active: align === value, onClick: () => onSetAlign(value), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon, { size: 16, style: { pointerEvents: "none" } }) }, value)),
20011
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
20012
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Minus, { size: 16, style: { pointerEvents: "none" } }) }),
20013
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
20014
+ sizeValue,
20015
+ "px"
20016
+ ] }),
20017
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
20018
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
20019
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
20020
+ ]
20021
+ }
20022
+ ),
20023
+ error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
19589
20024
  ]
19590
20025
  }
19591
- );
20026
+ ) });
19592
20027
  }
19593
20028
  function findMediaStripSlots(tree) {
19594
20029
  const stack = tree.rows.flatMap((row) => row.blocks);
@@ -19607,31 +20042,23 @@ function AiMediaStripOverlay({
19607
20042
  }) {
19608
20043
  const [hover, setHover] = (0, import_react13.useState)(null);
19609
20044
  const [active, setActive] = (0, import_react13.useState)(null);
20045
+ const [itemEditOn, setItemEditOn] = (0, import_react13.useState)(false);
20046
+ const [linkOpen, setLinkOpen] = (0, import_react13.useState)(false);
19610
20047
  const [pending, setPending] = (0, import_react13.useState)(false);
19611
20048
  const [error, setError] = (0, import_react13.useState)(null);
19612
20049
  const activeRef = (0, import_react13.useRef)(null);
19613
20050
  activeRef.current = active;
20051
+ const linkOpenRef = (0, import_react13.useRef)(false);
20052
+ linkOpenRef.current = linkOpen;
19614
20053
  (0, import_react13.useEffect)(() => {
19615
20054
  const onMove = (e) => {
20055
+ const ref = itemRefFromTarget(e.target);
19616
20056
  const t = e.target;
19617
- if (!(t instanceof HTMLElement)) return;
19618
- 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]")) {
19619
- return;
19620
- }
19621
- const itemEl = t.closest("[data-ohw-media-strip-item]");
19622
- if (!itemEl) {
19623
- setHover(null);
19624
- return;
19625
- }
19626
- const sectionEl2 = itemEl.closest("[data-ohw-section]");
19627
- const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
19628
- const sectionId = unit ? instanceIdOf(unit) || null : null;
19629
- const index = Number(itemEl.dataset.ohwMediaStripIndex);
19630
- if (!sectionId || Number.isNaN(index)) {
19631
- setHover(null);
19632
- return;
19633
- }
19634
- setHover({ sectionId, index });
20057
+ const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
20058
+ setHover((prev) => {
20059
+ const next = ref && !overEditable ? ref : null;
20060
+ return sameRef(prev, next) ? prev : next;
20061
+ });
19635
20062
  };
19636
20063
  const onLeave = () => setHover(null);
19637
20064
  document.addEventListener("mousemove", onMove, { passive: true });
@@ -19643,23 +20070,25 @@ function AiMediaStripOverlay({
19643
20070
  }, []);
19644
20071
  (0, import_react13.useEffect)(() => {
19645
20072
  const onClick = (e) => {
19646
- const current = activeRef.current;
19647
- if (!current) return;
19648
20073
  const t = e.target;
19649
- if (!(t instanceof HTMLElement)) return;
19650
- if (t.closest("[data-ohw-item-interaction]")) return;
19651
- const itemEl = findMediaStripItemElement(current.sectionId, current.index);
19652
- if (itemEl && itemEl.contains(t)) return;
19653
- setActive(null);
20074
+ if (!(t instanceof Element)) return;
20075
+ if (t.closest(CHROME_SELECTOR)) return;
20076
+ const ref = itemRefFromTarget(t);
20077
+ if (sameRef(activeRef.current, ref)) return;
20078
+ if (ref) clearInteractionChromeRef.current();
20079
+ setItemEditOn(false);
19654
20080
  setError(null);
20081
+ setActive(ref);
19655
20082
  };
19656
20083
  document.addEventListener("click", onClick, true);
19657
20084
  return () => document.removeEventListener("click", onClick, true);
19658
- }, []);
20085
+ }, [clearInteractionChromeRef]);
19659
20086
  (0, import_react13.useEffect)(() => {
19660
20087
  const onBlur = () => {
19661
20088
  if (!activeRef.current) return;
19662
20089
  setActive(null);
20090
+ setItemEditOn(false);
20091
+ setLinkOpen(false);
19663
20092
  setError(null);
19664
20093
  };
19665
20094
  window.addEventListener("blur", onBlur);
@@ -19669,7 +20098,10 @@ function AiMediaStripOverlay({
19669
20098
  const onKeyDown = (e) => {
19670
20099
  if (e.key !== "Escape") return;
19671
20100
  if (!activeRef.current) return;
20101
+ if (linkOpenRef.current) return;
20102
+ if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
19672
20103
  setActive(null);
20104
+ setItemEditOn(false);
19673
20105
  setError(null);
19674
20106
  };
19675
20107
  document.addEventListener("keydown", onKeyDown);
@@ -19703,137 +20135,133 @@ function AiMediaStripOverlay({
19703
20135
  tree: nextTree,
19704
20136
  label: entry.label,
19705
20137
  media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
19706
- ...entry.brand ? { brand: entry.brand } : {}
20138
+ ...entry.brand ? { brand: entry.brand } : {},
20139
+ // The user is already looking at the strip they just edited — recentering the viewport
20140
+ // on every edit reads as the section jumping around.
20141
+ skipScrollIntoView: true
19707
20142
  });
19708
20143
  return true;
19709
20144
  },
19710
20145
  [findEntry, postToParent2, applyTreeLocalRef]
19711
20146
  );
19712
20147
  const activeEntry = active ? findEntry(active.sectionId) : null;
19713
- const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
19714
20148
  const activeItemRect = useLiveItemRect(active);
19715
- const TOOLBAR_APPROX_H = 170;
19716
- const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
19717
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
19718
- hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19719
- "button",
19720
- {
19721
- type: "button",
19722
- "data-ohw-toolbar": "",
19723
- onClick: () => {
19724
- clearInteractionChromeRef.current();
19725
- setActive(hover);
19726
- },
19727
- "aria-label": "Configure media item",
19728
- style: {
19729
- position: "fixed",
19730
- top: hoverHandleRect.top + 8,
19731
- left: hoverHandleRect.left + hoverHandleRect.width - 36,
19732
- width: 28,
19733
- height: 28,
19734
- borderRadius: 8,
19735
- border: `1.5px dashed ${PRIMARY3}`,
19736
- background: "#ffffff",
19737
- color: PRIMARY3,
19738
- display: "flex",
19739
- alignItems: "center",
19740
- justifyContent: "center",
19741
- cursor: "pointer",
19742
- zIndex: 2147483643,
19743
- fontSize: 14,
19744
- fontWeight: 700
19745
- },
19746
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.Star, { size: 14, style: { pointerEvents: "none" } })
19747
- }
19748
- ),
19749
- activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19750
- ItemInteractionLayer,
19751
- {
19752
- rect: activeItemRect,
19753
- state: toolbarState,
19754
- toolbar: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19755
- MediaStripToolbar,
19756
- {
19757
- entry: activeEntry,
19758
- index: active.index,
19759
- pending,
19760
- error,
19761
- onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
19762
- onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
19763
- onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
19764
- onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
19765
- onResize: (delta) => {
19766
- const slots = findMediaStripSlots(activeEntry.tree);
19767
- const variant = slots?.variant === "reel" ? "reel" : "logos";
19768
- const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19769
- void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
19770
- },
19771
- onSetAlt: (alt) => {
19772
- void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
19773
- },
19774
- onSetLink: (href, linkTarget) => {
20149
+ const activeStripRect = useLiveItemRect(active, true);
20150
+ const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
20151
+ const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
20152
+ const activeItem = active ? activeItems[active.index] : void 0;
20153
+ const activeHref = activeItem?.href ?? "";
20154
+ const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
20155
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
20156
+ hoverRect && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20157
+ activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
20158
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
20159
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20160
+ MediaStripToolbar,
20161
+ {
20162
+ entry: activeEntry,
20163
+ index: active.index,
20164
+ pending,
20165
+ error,
20166
+ itemEditOn,
20167
+ onToggleItemEdit: () => setItemEditOn((on) => !on),
20168
+ onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
20169
+ onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
20170
+ onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
20171
+ onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
20172
+ onResize: (delta) => {
20173
+ const slots = findMediaStripSlots(activeEntry.tree);
20174
+ const variant = slots?.variant === "reel" ? "reel" : "logos";
20175
+ const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
20176
+ void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
20177
+ },
20178
+ onOpenLink: () => setLinkOpen(true),
20179
+ onAddItem: () => {
20180
+ void requestAssetPick(postToParent2).then((picked) => {
20181
+ if (!picked) return;
20182
+ const item = { assetId: picked.assetId, alt: "Logo" };
19775
20183
  void runMutation(
19776
20184
  active.sectionId,
19777
- (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
19778
- );
19779
- },
19780
- onAddItem: () => {
19781
- void requestAssetPick(postToParent2).then((picked) => {
19782
- if (!picked) return;
19783
- const item = { assetId: picked.assetId, alt: "Logo" };
19784
- void runMutation(
19785
- active.sectionId,
19786
- (tree) => addMediaStripItem(tree, item, active.index),
19787
- { [picked.assetId]: picked.url }
19788
- ).then((applied) => {
19789
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19790
- });
20185
+ (tree) => addMediaStripItem(tree, item, active.index),
20186
+ { [picked.assetId]: picked.url }
20187
+ ).then((applied) => {
20188
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19791
20189
  });
19792
- },
19793
- onChangeImage: () => {
19794
- void requestAssetPick(postToParent2).then((picked) => {
19795
- if (!picked) return;
19796
- void runMutation(
19797
- active.sectionId,
19798
- (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
19799
- { [picked.assetId]: picked.url }
19800
- );
19801
- });
19802
- },
19803
- onRemoveItem: () => {
19804
- void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
19805
- (applied) => {
19806
- if (applied) setActive(null);
19807
- }
19808
- );
19809
- },
19810
- onMoveLeft: () => {
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
- },
19817
- onMoveRight: () => {
19818
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
19819
- (applied) => {
19820
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19821
- }
20190
+ });
20191
+ },
20192
+ onChangeImage: () => {
20193
+ void requestAssetPick(postToParent2).then((picked) => {
20194
+ if (!picked) return;
20195
+ void runMutation(
20196
+ active.sectionId,
20197
+ (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
20198
+ { [picked.assetId]: picked.url }
19822
20199
  );
19823
- }
20200
+ });
20201
+ },
20202
+ onRemoveItem: () => {
20203
+ void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
20204
+ (applied) => {
20205
+ if (applied) setActive(null);
20206
+ }
20207
+ );
20208
+ },
20209
+ onMoveLeft: () => {
20210
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
20211
+ (applied) => {
20212
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
20213
+ }
20214
+ );
20215
+ },
20216
+ onMoveRight: () => {
20217
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
20218
+ (applied) => {
20219
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
20220
+ }
20221
+ );
19824
20222
  }
19825
- )
19826
- }
19827
- )
20223
+ }
20224
+ ) }),
20225
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20226
+ "div",
20227
+ {
20228
+ "data-ohw-bridge": "",
20229
+ "data-ohw-item-interaction": "",
20230
+ "aria-hidden": true,
20231
+ className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
20232
+ style: {
20233
+ top: activeItemRect.top + activeItemRect.height + 10,
20234
+ left: activeItemRect.left - 5,
20235
+ background: PRIMARY3,
20236
+ zIndex: 2147483644
20237
+ },
20238
+ children: "Media item"
20239
+ }
20240
+ ),
20241
+ linkOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20242
+ LinkModal,
20243
+ {
20244
+ href: activeHref,
20245
+ linkTarget: activeTarget,
20246
+ onClose: () => setLinkOpen(false),
20247
+ onSave: (href, linkTarget) => {
20248
+ void runMutation(
20249
+ active.sectionId,
20250
+ (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
20251
+ );
20252
+ }
20253
+ }
20254
+ )
20255
+ ] })
19828
20256
  ] });
19829
20257
  }
19830
20258
 
19831
20259
  // src/ui/ai-section/AiPricingCardOverlay.tsx
19832
20260
  var import_react14 = require("react");
19833
- var import_lucide_react9 = require("lucide-react");
19834
- var import_jsx_runtime21 = require("react/jsx-runtime");
20261
+ var import_lucide_react10 = require("lucide-react");
20262
+ var import_jsx_runtime22 = require("react/jsx-runtime");
19835
20263
  var PRIMARY4 = "var(--ohw-primary, #0885FE)";
19836
- 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]";
20264
+ 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]";
19837
20265
  function findPricingCardElement(sectionId, index) {
19838
20266
  const sectionEl2 = findByInstanceId(sectionId);
19839
20267
  if (!sectionEl2) return null;
@@ -19845,7 +20273,7 @@ function findPricingCardElement(sectionId, index) {
19845
20273
  }
19846
20274
  function cardRefFromTarget(target) {
19847
20275
  if (!(target instanceof Element)) return null;
19848
- if (target.closest(CHROME_SELECTOR)) return null;
20276
+ if (target.closest(CHROME_SELECTOR2)) return null;
19849
20277
  const cardEl = target.closest("[data-ohw-pricing-card]");
19850
20278
  if (!cardEl) return null;
19851
20279
  const sectionEl2 = cardEl.closest("[data-ohw-section]");
@@ -19855,21 +20283,21 @@ function cardRefFromTarget(target) {
19855
20283
  if (!sectionId || Number.isNaN(index)) return null;
19856
20284
  return { sectionId, index };
19857
20285
  }
19858
- function sameRef(a, b) {
20286
+ function sameRef2(a, b) {
19859
20287
  return a?.sectionId === b?.sectionId && a?.index === b?.index;
19860
20288
  }
19861
- function rectOf(el) {
20289
+ function rectOf2(el) {
19862
20290
  if (!el) return null;
19863
20291
  const r2 = el.getBoundingClientRect();
19864
20292
  if (r2.width <= 0 || r2.height <= 0) return null;
19865
20293
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
19866
20294
  }
19867
20295
  function readRect3(ref) {
19868
- return rectOf(ref && findPricingCardElement(ref.sectionId, ref.index));
20296
+ return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
19869
20297
  }
19870
20298
  function readGridRect(ref) {
19871
20299
  const card = ref && findPricingCardElement(ref.sectionId, ref.index);
19872
- return rectOf(card?.closest("[data-ohw-pricing-collection]") ?? card);
20300
+ return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
19873
20301
  }
19874
20302
  function useLiveCardRect(ref, grid = false) {
19875
20303
  const [rect, setRect] = (0, import_react14.useState)(null);
@@ -19899,7 +20327,7 @@ function useLiveCardRect(ref, grid = false) {
19899
20327
  }
19900
20328
  var TOOLBAR_GRID_GAP = 52;
19901
20329
  var TOOLBAR_GRID_GAP_MOBILE = 42;
19902
- var TOOLBAR_EDGE_MARGIN2 = 4;
20330
+ var TOOLBAR_EDGE_MARGIN3 = 4;
19903
20331
  function GridToolbarSlot({ gridRect, children }) {
19904
20332
  const slotRef = (0, import_react14.useRef)(null);
19905
20333
  const [shift, setShift] = (0, import_react14.useState)(0);
@@ -19911,7 +20339,7 @@ function GridToolbarSlot({ gridRect, children }) {
19911
20339
  const w = slot.offsetWidth;
19912
20340
  if (w <= 0) return;
19913
20341
  const half = w / 2;
19914
- const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
20342
+ const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
19915
20343
  setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
19916
20344
  };
19917
20345
  clamp();
@@ -19920,7 +20348,7 @@ function GridToolbarSlot({ gridRect, children }) {
19920
20348
  return () => ro.disconnect();
19921
20349
  }, [centerX, children]);
19922
20350
  const mobile = window.innerWidth <= 480;
19923
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20351
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
19924
20352
  "div",
19925
20353
  {
19926
20354
  ref: slotRef,
@@ -19955,7 +20383,7 @@ function requestValidateTree2(postToParent2, tree) {
19955
20383
  });
19956
20384
  }
19957
20385
  function StyleSwatch({ style }) {
19958
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20386
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
19959
20387
  "span",
19960
20388
  {
19961
20389
  "aria-hidden": true,
@@ -19969,35 +20397,35 @@ function StyleSwatch({ style }) {
19969
20397
  );
19970
20398
  }
19971
20399
  function ButtonGlyph() {
19972
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
19973
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
19974
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
20400
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20401
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
20402
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
19975
20403
  ] });
19976
20404
  }
19977
20405
  function FeatureGlyph({ mode }) {
19978
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
19979
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
19980
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
19981
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
19982
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
19983
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
19984
- mode === "add" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
20406
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20407
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
20408
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
20409
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
20410
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
20411
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
20412
+ mode === "add" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
19985
20413
  ] });
19986
20414
  }
19987
- function ToolbarAction({
20415
+ function ToolbarAction2({
19988
20416
  label,
19989
20417
  onClick,
19990
20418
  disabled = false,
19991
20419
  children
19992
20420
  }) {
19993
- const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
19994
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
19995
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: button }) : button }),
19996
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
20421
+ const button = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
20422
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
20423
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: button }) : button }),
20424
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
19997
20425
  ] });
19998
20426
  }
19999
- function ToolbarSeparator() {
20000
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
20427
+ function ToolbarSeparator2() {
20428
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
20001
20429
  }
20002
20430
  function CardStyleMenu({
20003
20431
  value,
@@ -20005,7 +20433,7 @@ function CardStyleMenu({
20005
20433
  disabled = false
20006
20434
  }) {
20007
20435
  const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
20008
- const trigger = /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20436
+ const trigger = /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
20009
20437
  "button",
20010
20438
  {
20011
20439
  type: "button",
@@ -20016,28 +20444,28 @@ function CardStyleMenu({
20016
20444
  disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
20017
20445
  ),
20018
20446
  children: [
20019
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StyleSwatch, { style: current.value }),
20020
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1 text-left", children: current.label }),
20021
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
20447
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: current.value }),
20448
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex-1 text-left", children: current.label }),
20449
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
20022
20450
  ]
20023
20451
  }
20024
20452
  );
20025
20453
  if (disabled) {
20026
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20027
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
20028
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
20029
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: trigger }) }),
20030
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
20454
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20455
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
20456
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
20457
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: trigger }) }),
20458
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
20031
20459
  ] })
20032
20460
  ] });
20033
20461
  }
20034
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20035
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
20036
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu, { modal: false, children: [
20037
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { asChild: true, children: trigger }),
20038
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
20462
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20463
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
20464
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenu, { modal: false, children: [
20465
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuTrigger, { asChild: true, children: trigger }),
20466
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
20039
20467
  const selected = style.value === value;
20040
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20468
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
20041
20469
  DropdownMenuItem,
20042
20470
  {
20043
20471
  role: "menuitemradio",
@@ -20045,9 +20473,9 @@ function CardStyleMenu({
20045
20473
  onSelect: () => onChange(style.value),
20046
20474
  className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
20047
20475
  children: [
20048
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StyleSwatch, { style: style.value }),
20049
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: style.label }),
20050
- selected && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Check, { size: 16, className: "text-bridge-primary" })
20476
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: style.value }),
20477
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: style.label }),
20478
+ selected && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Check, { size: 16, className: "text-bridge-primary" })
20051
20479
  ]
20052
20480
  },
20053
20481
  style.value
@@ -20077,7 +20505,7 @@ function PricingCardToolbar({
20077
20505
  const style = pricingCardStyle(entry.tree, index);
20078
20506
  const featuredTag = pricingCardFeaturedTag(entry.tree, index);
20079
20507
  const mobile = window.innerWidth <= 480;
20080
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20508
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
20081
20509
  "div",
20082
20510
  {
20083
20511
  "data-ohw-bridge": "",
@@ -20089,7 +20517,7 @@ function PricingCardToolbar({
20089
20517
  ),
20090
20518
  style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
20091
20519
  children: [
20092
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20520
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
20093
20521
  "div",
20094
20522
  {
20095
20523
  className: cn(
@@ -20098,8 +20526,8 @@ function PricingCardToolbar({
20098
20526
  mobile ? "flex-wrap justify-center" : "flex-nowrap"
20099
20527
  ),
20100
20528
  children: [
20101
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
20102
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20529
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
20530
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20103
20531
  CustomToolbarButton,
20104
20532
  {
20105
20533
  type: "button",
@@ -20107,8 +20535,8 @@ function PricingCardToolbar({
20107
20535
  "aria-pressed": featuredTag,
20108
20536
  onClick: () => onSetFeaturedTag(!featuredTag),
20109
20537
  className: "group size-8",
20110
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20111
- import_lucide_react9.Star,
20538
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20539
+ import_lucide_react10.Star,
20112
20540
  {
20113
20541
  size: 16,
20114
20542
  fill: "currentColor",
@@ -20122,25 +20550,25 @@ function PricingCardToolbar({
20122
20550
  )
20123
20551
  }
20124
20552
  ) }),
20125
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
20553
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
20126
20554
  ] }),
20127
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
20128
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
20129
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
20130
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ButtonGlyph, {}) }),
20131
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "relative inline-flex", children: [
20132
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ButtonGlyph, {}),
20133
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Minus, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
20555
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
20556
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
20557
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
20558
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}) }),
20559
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "relative inline-flex", children: [
20560
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}),
20561
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Minus, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
20134
20562
  ] }) }),
20135
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FeatureGlyph, { mode: "add" }) }),
20136
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FeatureGlyph, { mode: "remove" }) }),
20137
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
20138
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
20139
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Minus, { size: 16, style: { pointerEvents: "none" } }) })
20563
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FeatureGlyph, { mode: "add" }) }),
20564
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FeatureGlyph, { mode: "remove" }) }),
20565
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
20566
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
20567
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Minus, { size: 16, style: { pointerEvents: "none" } }) })
20140
20568
  ]
20141
20569
  }
20142
20570
  ),
20143
- error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
20571
+ error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
20144
20572
  ]
20145
20573
  }
20146
20574
  ) });
@@ -20174,7 +20602,7 @@ function AiPricingCardOverlay({
20174
20602
  const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
20175
20603
  setHover((prev) => {
20176
20604
  const next = ref && !overEditable ? ref : null;
20177
- return sameRef(prev, next) ? prev : next;
20605
+ return sameRef2(prev, next) ? prev : next;
20178
20606
  });
20179
20607
  };
20180
20608
  const onLeave = () => setHover(null);
@@ -20189,10 +20617,10 @@ function AiPricingCardOverlay({
20189
20617
  const onClick = (e) => {
20190
20618
  const t = e.target;
20191
20619
  if (!(t instanceof Element)) return;
20192
- if (t.closest(CHROME_SELECTOR)) return;
20620
+ if (t.closest(CHROME_SELECTOR2)) return;
20193
20621
  const ref = cardRefFromTarget(t);
20194
- setActive((prev) => sameRef(prev, ref) ? prev : ref);
20195
- if (!ref || !sameRef(activeRef.current, ref)) setError(null);
20622
+ setActive((prev) => sameRef2(prev, ref) ? prev : ref);
20623
+ if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
20196
20624
  };
20197
20625
  document.addEventListener("click", onClick, true);
20198
20626
  return () => document.removeEventListener("click", onClick, true);
@@ -20257,12 +20685,12 @@ function AiPricingCardOverlay({
20257
20685
  const activeEntry = active ? findEntry(active.sectionId) : null;
20258
20686
  const activeCardRect = useLiveCardRect(active);
20259
20687
  const activeGridRect = useLiveCardRect(active, true);
20260
- const hoverRect = useLiveCardRect(hover && !sameRef(hover, active) ? hover : null);
20261
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
20262
- hoverRect && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20263
- activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
20264
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
20265
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20688
+ const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
20689
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
20690
+ hoverRect && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20691
+ activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
20692
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
20693
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20266
20694
  PricingCardToolbar,
20267
20695
  {
20268
20696
  entry: activeEntry,
@@ -20290,7 +20718,7 @@ function AiPricingCardOverlay({
20290
20718
  onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
20291
20719
  }
20292
20720
  ) }),
20293
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20721
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20294
20722
  "div",
20295
20723
  {
20296
20724
  "data-ohw-bridge": "",
@@ -20312,7 +20740,7 @@ function AiPricingCardOverlay({
20312
20740
 
20313
20741
  // src/ui/ai-section/AiVideoOverlay.tsx
20314
20742
  var import_react15 = require("react");
20315
- var import_lucide_react10 = require("lucide-react");
20743
+ var import_lucide_react11 = require("lucide-react");
20316
20744
 
20317
20745
  // src/lib/ai-video-tree.ts
20318
20746
  function resolveVideoBlock(tree, path) {
@@ -20354,39 +20782,11 @@ function clearVideo(tree, path) {
20354
20782
  });
20355
20783
  }
20356
20784
 
20357
- // src/lib/youtube.ts
20358
- var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
20359
- function extractYouTubeId(input) {
20360
- const trimmed = input.trim();
20361
- if (!trimmed) return null;
20362
- if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
20363
- let url;
20364
- try {
20365
- url = new URL(trimmed);
20366
- } catch {
20367
- return null;
20368
- }
20369
- const host = url.hostname.replace(/^www\./, "");
20370
- if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
20371
- return null;
20372
- }
20373
- let candidate = null;
20374
- if (host === "youtu.be") {
20375
- candidate = url.pathname.slice(1).split("/")[0] ?? null;
20376
- } else if (url.pathname === "/watch") {
20377
- candidate = url.searchParams.get("v");
20378
- } else {
20379
- const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
20380
- candidate = match ? match[1] : null;
20381
- }
20382
- return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
20383
- }
20384
-
20385
20785
  // src/ui/ai-section/AiVideoOverlay.tsx
20386
- var import_jsx_runtime22 = require("react/jsx-runtime");
20786
+ var import_jsx_runtime23 = require("react/jsx-runtime");
20387
20787
  var PRIMARY5 = "#0885FE";
20388
- var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY5})`;
20389
- var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20788
+ var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
20789
+ var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20390
20790
  function findVideoBlockElement(sectionId, path) {
20391
20791
  const sectionEl2 = findByInstanceId(sectionId);
20392
20792
  if (!sectionEl2) return null;
@@ -20446,12 +20846,12 @@ function requestValidateTree3(postToParent2, tree) {
20446
20846
  postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
20447
20847
  });
20448
20848
  }
20449
- function Pill2({
20849
+ function Pill({
20450
20850
  label,
20451
20851
  onClick,
20452
20852
  disabled
20453
20853
  }) {
20454
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20854
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20455
20855
  "button",
20456
20856
  {
20457
20857
  type: "button",
@@ -20467,7 +20867,7 @@ function Pill2({
20467
20867
  border: "none",
20468
20868
  cursor: disabled ? "default" : "pointer",
20469
20869
  background: "#ffffff",
20470
- color: OHW_BLUE_DARK2,
20870
+ color: OHW_BLUE_DARK,
20471
20871
  opacity: disabled ? 0.4 : 1,
20472
20872
  fontSize: 12,
20473
20873
  lineHeight: "16px",
@@ -20510,8 +20910,8 @@ function VideoUrlInput({ value, onCommit }) {
20510
20910
  onCommit(id);
20511
20911
  }
20512
20912
  };
20513
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
20514
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
20913
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
20914
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
20515
20915
  "div",
20516
20916
  {
20517
20917
  style: {
@@ -20527,12 +20927,12 @@ function VideoUrlInput({ value, onCommit }) {
20527
20927
  boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
20528
20928
  },
20529
20929
  children: [
20530
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20930
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20531
20931
  "span",
20532
20932
  {
20533
20933
  style: {
20534
20934
  flex: "0 0 auto",
20535
- color: OHW_BLUE_DARK2,
20935
+ color: OHW_BLUE_DARK,
20536
20936
  fontSize: 10,
20537
20937
  lineHeight: "16px",
20538
20938
  fontWeight: 700,
@@ -20542,7 +20942,7 @@ function VideoUrlInput({ value, onCommit }) {
20542
20942
  children: "Video"
20543
20943
  }
20544
20944
  ),
20545
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20945
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20546
20946
  "input",
20547
20947
  {
20548
20948
  type: "text",
@@ -20579,7 +20979,7 @@ function VideoUrlInput({ value, onCommit }) {
20579
20979
  ]
20580
20980
  }
20581
20981
  ),
20582
- invalid && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
20982
+ invalid && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
20583
20983
  ] });
20584
20984
  }
20585
20985
  function VideoToolbar({
@@ -20589,7 +20989,7 @@ function VideoToolbar({
20589
20989
  onSetVideoId,
20590
20990
  onRemove
20591
20991
  }) {
20592
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
20992
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
20593
20993
  "div",
20594
20994
  {
20595
20995
  "data-ohw-bridge": "",
@@ -20601,7 +21001,7 @@ function VideoToolbar({
20601
21001
  gap: 6,
20602
21002
  alignItems: "center",
20603
21003
  width: 280,
20604
- background: OHW_BLUE2,
21004
+ background: OHW_BLUE,
20605
21005
  padding: 8,
20606
21006
  borderRadius: 12,
20607
21007
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -20609,9 +21009,9 @@ function VideoToolbar({
20609
21009
  opacity: pending ? 0.6 : 1
20610
21010
  },
20611
21011
  children: [
20612
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
20613
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Pill2, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
20614
- error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
21012
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
21013
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
21014
+ error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20615
21015
  ]
20616
21016
  }
20617
21017
  );
@@ -20731,8 +21131,8 @@ function AiVideoOverlay({
20731
21131
  const activeBlockRect = useLiveBlockRect(active);
20732
21132
  const TOOLBAR_APPROX_H = 90;
20733
21133
  const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
20734
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
20735
- hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
21134
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
21135
+ hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20736
21136
  "button",
20737
21137
  {
20738
21138
  type: "button",
@@ -20760,15 +21160,15 @@ function AiVideoOverlay({
20760
21160
  fontSize: 14,
20761
21161
  fontWeight: 700
20762
21162
  },
20763
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Star, { size: 14, style: { pointerEvents: "none" } })
21163
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Star, { size: 14, style: { pointerEvents: "none" } })
20764
21164
  }
20765
21165
  ),
20766
- activeBlockRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
21166
+ activeBlockRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20767
21167
  ItemInteractionLayer,
20768
21168
  {
20769
21169
  rect: activeBlockRect,
20770
21170
  state: toolbarState,
20771
- toolbar: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
21171
+ toolbar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20772
21172
  VideoToolbar,
20773
21173
  {
20774
21174
  videoId: videoIdAt(activeEntry.tree, active.path),
@@ -20792,7 +21192,7 @@ function AiVideoOverlay({
20792
21192
 
20793
21193
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
20794
21194
  var import_react16 = require("react");
20795
- var import_lucide_react11 = require("lucide-react");
21195
+ var import_lucide_react12 = require("lucide-react");
20796
21196
 
20797
21197
  // src/lib/ai-carousel-tree.ts
20798
21198
  function isCarouselBlock(node) {
@@ -20843,10 +21243,10 @@ function setCarouselAutoplay(tree, on) {
20843
21243
  }
20844
21244
 
20845
21245
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
20846
- var import_jsx_runtime23 = require("react/jsx-runtime");
21246
+ var import_jsx_runtime24 = require("react/jsx-runtime");
20847
21247
  var PRIMARY6 = "#0885FE";
20848
- var OHW_BLUE3 = `var(--ohw-primary, ${PRIMARY6})`;
20849
- var OHW_BLUE_DARK3 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
21248
+ var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
21249
+ var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
20850
21250
  function findCarouselItemElement(sectionId, index) {
20851
21251
  const sectionEl2 = findByInstanceId(sectionId);
20852
21252
  if (!sectionEl2) return null;
@@ -20925,8 +21325,8 @@ function requestAssetPick2(postToParent2) {
20925
21325
  postToParent2({ type: "ow:asset-pick", id });
20926
21326
  });
20927
21327
  }
20928
- function Pill3({ label, onClick, disabled }) {
20929
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21328
+ function Pill2({ label, onClick, disabled }) {
21329
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
20930
21330
  "button",
20931
21331
  {
20932
21332
  type: "button",
@@ -20942,7 +21342,7 @@ function Pill3({ label, onClick, disabled }) {
20942
21342
  border: "none",
20943
21343
  cursor: disabled ? "default" : "pointer",
20944
21344
  background: "#ffffff",
20945
- color: OHW_BLUE_DARK3,
21345
+ color: OHW_BLUE_DARK2,
20946
21346
  opacity: disabled ? 0.4 : 1,
20947
21347
  fontSize: 12,
20948
21348
  lineHeight: "16px",
@@ -20960,7 +21360,7 @@ function TogglePill({
20960
21360
  onToggle,
20961
21361
  disabled
20962
21362
  }) {
20963
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
21363
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
20964
21364
  "button",
20965
21365
  {
20966
21366
  type: "button",
@@ -20979,7 +21379,7 @@ function TogglePill({
20979
21379
  border: "none",
20980
21380
  cursor: disabled ? "default" : "pointer",
20981
21381
  background: "#ffffff",
20982
- color: OHW_BLUE_DARK3,
21382
+ color: OHW_BLUE_DARK2,
20983
21383
  opacity: disabled ? 0.4 : 1,
20984
21384
  fontSize: 12,
20985
21385
  lineHeight: "16px",
@@ -20989,7 +21389,7 @@ function TogglePill({
20989
21389
  },
20990
21390
  children: [
20991
21391
  label,
20992
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21392
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
20993
21393
  "span",
20994
21394
  {
20995
21395
  "aria-hidden": true,
@@ -21002,10 +21402,10 @@ function TogglePill({
21002
21402
  // Off is a grey track, not a washed-out blue: the pill's own white background already
21003
21403
  // carries the brand colour in the text, and a pale blue track next to it read as
21004
21404
  // "disabled control" rather than "switch that is off".
21005
- background: on ? OHW_BLUE_DARK3 : "#CBD5E1",
21405
+ background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
21006
21406
  transition: "background 120ms ease"
21007
21407
  },
21008
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21408
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21009
21409
  "span",
21010
21410
  {
21011
21411
  style: {
@@ -21034,7 +21434,7 @@ function CarouselSlideToolbar({
21034
21434
  onChangeImage,
21035
21435
  onToggleAutoplay
21036
21436
  }) {
21037
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
21437
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
21038
21438
  "div",
21039
21439
  {
21040
21440
  "data-ohw-bridge": "",
@@ -21045,7 +21445,7 @@ function CarouselSlideToolbar({
21045
21445
  flexDirection: "column",
21046
21446
  gap: 6,
21047
21447
  alignItems: "center",
21048
- background: OHW_BLUE3,
21448
+ background: OHW_BLUE2,
21049
21449
  padding: 8,
21050
21450
  borderRadius: 12,
21051
21451
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -21057,11 +21457,11 @@ function CarouselSlideToolbar({
21057
21457
  pointerEvents: pending ? "none" : "auto"
21058
21458
  },
21059
21459
  children: [
21060
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
21061
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pill3, { label: "Change Image", onClick: onChangeImage }),
21062
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
21460
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
21461
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Pill2, { label: "Change Image", onClick: onChangeImage }),
21462
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
21063
21463
  ] }),
21064
- error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
21464
+ error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
21065
21465
  ]
21066
21466
  }
21067
21467
  );
@@ -21201,8 +21601,8 @@ function AiFadeCarouselOverlay({
21201
21601
  const activeItemRect = useLiveItemRect2(active);
21202
21602
  const TOOLBAR_APPROX_H = 90;
21203
21603
  const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
21204
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
21205
- hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21604
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
21605
+ hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21206
21606
  "button",
21207
21607
  {
21208
21608
  type: "button",
@@ -21231,10 +21631,10 @@ function AiFadeCarouselOverlay({
21231
21631
  fontSize: 14,
21232
21632
  fontWeight: 700
21233
21633
  },
21234
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Star, { size: 14, style: { pointerEvents: "none" } })
21634
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Star, { size: 14, style: { pointerEvents: "none" } })
21235
21635
  }
21236
21636
  ),
21237
- swapping && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21637
+ swapping && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21238
21638
  "div",
21239
21639
  {
21240
21640
  ref: skeletonRef,
@@ -21252,15 +21652,15 @@ function AiFadeCarouselOverlay({
21252
21652
  zIndex: 2147483646,
21253
21653
  pointerEvents: "none"
21254
21654
  },
21255
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("style", { children: MEDIA_SKELETON_CSS })
21655
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("style", { children: MEDIA_SKELETON_CSS })
21256
21656
  }
21257
21657
  ),
21258
- activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21658
+ activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21259
21659
  ItemInteractionLayer,
21260
21660
  {
21261
21661
  rect: activeItemRect,
21262
21662
  state: toolbarState,
21263
- toolbar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21663
+ toolbar: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21264
21664
  CarouselSlideToolbar,
21265
21665
  {
21266
21666
  pending,
@@ -21451,113 +21851,6 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
21451
21851
  // src/ui/link-modal/LinkPopover.tsx
21452
21852
  var import_react20 = require("react");
21453
21853
 
21454
- // src/ui/dialog.tsx
21455
- var React9 = __toESM(require("react"), 1);
21456
- var import_radix_ui6 = require("radix-ui");
21457
- var import_lucide_react12 = require("lucide-react");
21458
- var import_jsx_runtime24 = require("react/jsx-runtime");
21459
- function Dialog2({
21460
- ...props
21461
- }) {
21462
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
21463
- }
21464
- function DialogPortal({
21465
- ...props
21466
- }) {
21467
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
21468
- }
21469
- function DialogOverlay({
21470
- className,
21471
- ...props
21472
- }) {
21473
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21474
- import_radix_ui6.Dialog.Overlay,
21475
- {
21476
- "data-slot": "dialog-overlay",
21477
- "data-ohw-link-modal-root": "",
21478
- className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
21479
- ...props
21480
- }
21481
- );
21482
- }
21483
- var DialogContent = React9.forwardRef(
21484
- ({ className, children, showCloseButton = true, container, ...props }, ref) => {
21485
- const positionMode = container ? "absolute" : "fixed";
21486
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(DialogPortal, { container: container ?? void 0, children: [
21487
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
21488
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
21489
- import_radix_ui6.Dialog.Content,
21490
- {
21491
- ref,
21492
- "data-slot": "dialog-content",
21493
- className: cn(
21494
- positionMode,
21495
- "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",
21496
- "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
21497
- container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
21498
- className
21499
- ),
21500
- onMouseDown: (e) => e.stopPropagation(),
21501
- ...props,
21502
- children: [
21503
- children,
21504
- showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21505
- import_radix_ui6.Dialog.Close,
21506
- {
21507
- type: "button",
21508
- className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
21509
- "aria-label": "Close",
21510
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.X, { size: 16, "aria-hidden": true })
21511
- }
21512
- ) : null
21513
- ]
21514
- }
21515
- )
21516
- ] });
21517
- }
21518
- );
21519
- DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
21520
- function DialogHeader({
21521
- className,
21522
- ...props
21523
- }) {
21524
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
21525
- }
21526
- function DialogFooter({
21527
- className,
21528
- ...props
21529
- }) {
21530
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21531
- "div",
21532
- {
21533
- className: cn("flex items-center justify-end gap-2", className),
21534
- ...props
21535
- }
21536
- );
21537
- }
21538
- var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21539
- import_radix_ui6.Dialog.Title,
21540
- {
21541
- ref,
21542
- className: cn(
21543
- "text-lg font-semibold leading-none tracking-tight text-card-foreground",
21544
- className
21545
- ),
21546
- ...props
21547
- }
21548
- ));
21549
- DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
21550
- var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21551
- import_radix_ui6.Dialog.Description,
21552
- {
21553
- ref,
21554
- className: cn("text-sm text-muted-foreground", className),
21555
- ...props
21556
- }
21557
- ));
21558
- DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
21559
- var DialogClose = import_radix_ui6.Dialog.Close;
21560
-
21561
21854
  // src/ui/link-modal/LinkEditorPanel.tsx
21562
21855
  var import_lucide_react16 = require("lucide-react");
21563
21856
 
@@ -22661,6 +22954,7 @@ function shouldUseDevFixtures() {
22661
22954
  function getLogoElement(el) {
22662
22955
  const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
22663
22956
  if (marked) return marked;
22957
+ if (el.closest('[data-ohw-editable="icon"]')) return null;
22664
22958
  const root = el.closest("nav, [data-ohw-nav-root], footer");
22665
22959
  if (!root) return null;
22666
22960
  const anchor = el.closest("a");
@@ -23997,12 +24291,19 @@ function useSectionDrag({
23997
24291
  clearSectionDragVisuals();
23998
24292
  return;
23999
24293
  }
24294
+ const previous = orderBeforeMove(editContentRef.current[SECTION_ORDER_KEY], window.location.pathname);
24000
24295
  const orderJson = JSON.stringify(
24001
24296
  mergePageSectionOrder(editContentRef.current[SECTION_ORDER_KEY], window.location.pathname, entries)
24002
24297
  );
24003
24298
  editContentRef.current = { ...editContentRef.current, [SECTION_ORDER_KEY]: orderJson };
24004
24299
  setAiSectionOrder(orderJson, window.location.pathname);
24005
- postToParentRef.current({ type: "ow:change", nodes: [{ key: SECTION_ORDER_KEY, text: orderJson }] });
24300
+ postToParentRef.current({
24301
+ type: "ow:change",
24302
+ nodes: [{ key: SECTION_ORDER_KEY, text: orderJson }],
24303
+ previous: { [SECTION_ORDER_KEY]: previous },
24304
+ // Undo scrolls to this section; a one-place move swaps two, so the order alone can't say which.
24305
+ moved: session.instanceId
24306
+ });
24006
24307
  applyPersistedOrder(getPageSectionOrderEntries(orderJson, window.location.pathname));
24007
24308
  clearSectionDragVisuals();
24008
24309
  requestAnimationFrame(() => {
@@ -25470,7 +25771,7 @@ function getNavigationSelectionParent(el) {
25470
25771
  if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
25471
25772
  return resolveFooterLinksContainerFrom(el);
25472
25773
  }
25473
- if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
25774
+ 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)) {
25474
25775
  return getNavigationRoot(el);
25475
25776
  }
25476
25777
  return null;
@@ -25692,7 +25993,6 @@ var ICONS = {
25692
25993
  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"/>',
25693
25994
  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"/>'
25694
25995
  };
25695
- var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
25696
25996
  var SELECTION_CHROME_GAP2 = 4;
25697
25997
  var TOOLBAR_STROKE_GAP2 = 4;
25698
25998
  var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
@@ -25790,7 +26090,7 @@ function applyVisibleViewport(el, parentScroll) {
25790
26090
  el.style.top = `${top}px`;
25791
26091
  el.style.height = `${height}px`;
25792
26092
  }
25793
- var TOOLBAR_EDGE_MARGIN3 = 4;
26093
+ var TOOLBAR_EDGE_MARGIN4 = 4;
25794
26094
  function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
25795
26095
  const isAbove = transform.includes("translateY(-100%)");
25796
26096
  let visualTop = isAbove ? top - approxH : top;
@@ -25817,8 +26117,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
25817
26117
  function clampToolbarLeft(centerX, toolbarWidth) {
25818
26118
  const half = toolbarWidth / 2;
25819
26119
  return Math.max(
25820
- TOOLBAR_EDGE_MARGIN3 + half,
25821
- Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half)
26120
+ TOOLBAR_EDGE_MARGIN4 + half,
26121
+ Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
25822
26122
  );
25823
26123
  }
25824
26124
  function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
@@ -26701,21 +27001,6 @@ function OhhwellsBridge() {
26701
27001
  const [isItemDragging, setIsItemDragging] = (0, import_react25.useState)(false);
26702
27002
  const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react25.useState)(false);
26703
27003
  isFooterFrameSelectionRef.current = isFooterFrameSelection;
26704
- const [floatingPanel, setFloatingPanel] = (0, import_react25.useState)(null);
26705
- const floatingPanelOpenRef = (0, import_react25.useRef)(false);
26706
- floatingPanelOpenRef.current = floatingPanel !== null;
26707
- const floatingPanelRef = (0, import_react25.useRef)(null);
26708
- floatingPanelRef.current = floatingPanel;
26709
- const [floatingPanelPos, setFloatingPanelPos] = (0, import_react25.useState)(null);
26710
- const buttonCollectionDragRef = (0, import_react25.useRef)(null);
26711
- const buttonDropInsertIndexRef = (0, import_react25.useRef)(null);
26712
- const [buttonDropSlots, setButtonDropSlots] = (0, import_react25.useState)([]);
26713
- const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react25.useState)(null);
26714
- const buttonPointerDragRef = (0, import_react25.useRef)(null);
26715
- const [buttonStyleTick, setButtonStyleTick] = (0, import_react25.useState)(0);
26716
- const [logoSizeDraft, setLogoSizeDraft] = (0, import_react25.useState)(null);
26717
- const [editorViewport, setEditorViewport] = (0, import_react25.useState)("desktop");
26718
- const [parentScrollSnap, setParentScrollSnap] = (0, import_react25.useState)(null);
26719
27004
  const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react25.useState)(null);
26720
27005
  const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react25.useState)(null);
26721
27006
  const footerDragRef = (0, import_react25.useRef)(null);
@@ -26742,6 +27027,21 @@ function OhhwellsBridge() {
26742
27027
  const stylesRef = (0, import_react25.useRef)("");
26743
27028
  const appliedDrawerRef = (0, import_react25.useRef)(null);
26744
27029
  const pendingDeleteUndoRef = (0, import_react25.useRef)(null);
27030
+ const [floatingPanel, setFloatingPanel] = (0, import_react25.useState)(null);
27031
+ const floatingPanelOpenRef = (0, import_react25.useRef)(false);
27032
+ const floatingPanelRef = (0, import_react25.useRef)(null);
27033
+ floatingPanelRef.current = floatingPanel;
27034
+ const setFloatingPanelRef = (0, import_react25.useRef)(setFloatingPanel);
27035
+ const [floatingPanelPos, setFloatingPanelPos] = (0, import_react25.useState)(null);
27036
+ const buttonCollectionDragRef = (0, import_react25.useRef)(null);
27037
+ const buttonDropInsertIndexRef = (0, import_react25.useRef)(null);
27038
+ const [buttonDropSlots, setButtonDropSlots] = (0, import_react25.useState)([]);
27039
+ const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react25.useState)(null);
27040
+ const buttonPointerDragRef = (0, import_react25.useRef)(null);
27041
+ const [buttonStyleTick, setButtonStyleTick] = (0, import_react25.useState)(0);
27042
+ const [logoSizeDraft, setLogoSizeDraft] = (0, import_react25.useState)(null);
27043
+ const [editorViewport, setEditorViewport] = (0, import_react25.useState)("desktop");
27044
+ const [parentScrollSnap, setParentScrollSnap] = (0, import_react25.useState)(null);
26745
27045
  const [sitePages, setSitePages] = (0, import_react25.useState)([]);
26746
27046
  const collectionItemsRef = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
26747
27047
  const [sectionsByPath, setSectionsByPath] = (0, import_react25.useState)({});
@@ -26751,7 +27051,18 @@ function OhhwellsBridge() {
26751
27051
  const linkPopoverOpenRef = (0, import_react25.useRef)(false);
26752
27052
  const linkPopoverGraceUntilRef = (0, import_react25.useRef)(0);
26753
27053
  setLinkPopoverRef.current = setLinkPopover;
27054
+ setFloatingPanelRef.current = setFloatingPanel;
26754
27055
  linkPopoverSessionRef.current = linkPopover;
27056
+ floatingPanelOpenRef.current = Boolean(floatingPanel);
27057
+ (0, import_react25.useEffect)(() => {
27058
+ const syncViewport = () => {
27059
+ const next = window.innerWidth <= 480 ? "mobile" : "desktop";
27060
+ setEditorViewport((prev) => prev === next ? prev : next);
27061
+ };
27062
+ syncViewport();
27063
+ window.addEventListener("resize", syncViewport);
27064
+ return () => window.removeEventListener("resize", syncViewport);
27065
+ }, []);
26755
27066
  (0, import_react25.useEffect)(() => {
26756
27067
  setSectionOrderPersistHandler((entries) => {
26757
27068
  const currentPath = window.location.pathname;
@@ -28485,6 +28796,7 @@ function OhhwellsBridge() {
28485
28796
  applyAiFooterFromContent(content);
28486
28797
  if (typeof content[STYLE_STORE_KEY] === "string") {
28487
28798
  stylesRef.current = content[STYLE_STORE_KEY];
28799
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28488
28800
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28489
28801
  }
28490
28802
  applyBrandChrome(content);
@@ -28495,15 +28807,16 @@ function OhhwellsBridge() {
28495
28807
  if (key === "__ohw_sections") continue;
28496
28808
  if (key === AI_SECTIONS_KEY) continue;
28497
28809
  if (key === AI_FOOTER_KEY) continue;
28810
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
28811
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28498
28812
  if (key === BRAND_KIT_KEY) continue;
28499
28813
  if (key === STYLE_STORE_KEY) continue;
28500
28814
  if (BRAND_CHROME_KEYS.has(key)) continue;
28501
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28502
28815
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
28503
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28504
28816
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28505
28817
  continue;
28506
28818
  }
28819
+ if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28507
28820
  if (applyVideoSettingNode(key, val)) continue;
28508
28821
  if (applyCarouselNode(key, val)) continue;
28509
28822
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28543,6 +28856,7 @@ function OhhwellsBridge() {
28543
28856
  });
28544
28857
  applyLinkByKey(key, val);
28545
28858
  }
28859
+ applySectionEmbeds(content);
28546
28860
  applyLogoFromContent(content);
28547
28861
  applyLogoSizes(content);
28548
28862
  reconcileNavbarItemsFromContent(content);
@@ -28731,20 +29045,22 @@ function OhhwellsBridge() {
28731
29045
  }
28732
29046
  applyAiFooterFromContent(content);
28733
29047
  if (typeof content[STYLE_STORE_KEY] === "string") {
29048
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28734
29049
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28735
29050
  }
28736
29051
  for (const [key, val] of Object.entries(content)) {
28737
29052
  if (key === "__ohw_sections") continue;
28738
29053
  if (key === AI_SECTIONS_KEY) continue;
28739
29054
  if (key === AI_FOOTER_KEY) continue;
29055
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
29056
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28740
29057
  if (key === BRAND_KIT_KEY) continue;
28741
29058
  if (key === STYLE_STORE_KEY) continue;
28742
29059
  if (BRAND_CHROME_KEYS.has(key)) continue;
28743
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28744
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28745
29060
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28746
29061
  continue;
28747
29062
  }
29063
+ if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28748
29064
  if (applyVideoSettingNode(key, val)) continue;
28749
29065
  if (applyCarouselNode(key, val)) continue;
28750
29066
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28769,6 +29085,7 @@ function OhhwellsBridge() {
28769
29085
  });
28770
29086
  applyLinkByKey(key, val);
28771
29087
  }
29088
+ applySectionEmbeds(content);
28772
29089
  applyLogoFromContent(content);
28773
29090
  reconcileNavbarItemsFromContent(content);
28774
29091
  reconcileFooterOrderFromContent(content);
@@ -29008,26 +29325,11 @@ function OhhwellsBridge() {
29008
29325
  const t2 = setTimeout(measure, 500);
29009
29326
  const ro = new ResizeObserver(schedule);
29010
29327
  ro.observe(document.body);
29011
- let lastWidth = window.innerWidth;
29012
- let resizeTimers = [];
29013
- const clearResizeTimers = () => {
29014
- resizeTimers.forEach(clearTimeout);
29015
- resizeTimers = [];
29016
- };
29017
- const handleResize = () => {
29018
- if (window.innerWidth === lastWidth) return;
29019
- lastWidth = window.innerWidth;
29020
- clearResizeTimers();
29021
- resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
29022
- };
29023
- window.addEventListener("resize", handleResize);
29024
29328
  return () => {
29025
29329
  clearTimeout(t1);
29026
29330
  clearTimeout(t2);
29027
29331
  if (raf != null) cancelAnimationFrame(raf);
29028
29332
  ro.disconnect();
29029
- clearResizeTimers();
29030
- window.removeEventListener("resize", handleResize);
29031
29333
  };
29032
29334
  }, [pathname, isEditMode, postToParent2]);
29033
29335
  (0, import_react25.useEffect)(() => {
@@ -29324,6 +29626,13 @@ function OhhwellsBridge() {
29324
29626
  if (target.closest("[data-ohw-state-toggle]")) return;
29325
29627
  if (target.closest("[data-ohw-max-badge]")) return;
29326
29628
  if (isInsideLinkEditor(target)) return;
29629
+ if (isInsideFloatingPanel(target)) return;
29630
+ if (target.closest("[data-ohw-form-toolbar]")) return;
29631
+ if (target.closest(
29632
+ '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
29633
+ )) {
29634
+ return;
29635
+ }
29327
29636
  if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
29328
29637
  clearMediaSelectionRef.current();
29329
29638
  }
@@ -29347,8 +29656,6 @@ function OhhwellsBridge() {
29347
29656
  return;
29348
29657
  }
29349
29658
  }
29350
- if (isInsideFloatingPanel(target)) return;
29351
- if (target.closest("[data-ohw-form-toolbar]")) return;
29352
29659
  const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
29353
29660
  if (collectionItem) {
29354
29661
  e.preventDefault();
@@ -29360,11 +29667,6 @@ function OhhwellsBridge() {
29360
29667
  });
29361
29668
  return;
29362
29669
  }
29363
- if (target.closest(
29364
- '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
29365
- )) {
29366
- return;
29367
- }
29368
29670
  {
29369
29671
  const formEl = getFormElement(target);
29370
29672
  const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
@@ -29518,9 +29820,13 @@ function OhhwellsBridge() {
29518
29820
  if (isIconEditable(editable) && !getSocialItem(editable)) {
29519
29821
  e.preventDefault();
29520
29822
  e.stopPropagation();
29521
- selectIconElementRef.current(editable);
29522
29823
  const aiIcon = editable.hasAttribute("data-ai-icon");
29523
29824
  const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
29825
+ if (aiIcon) {
29826
+ aiSectionApiRef.current?.selectFromElement(editable);
29827
+ } else {
29828
+ selectIconElementRef.current(editable);
29829
+ }
29524
29830
  postToParentRef.current({
29525
29831
  type: "ow:icon-pick",
29526
29832
  key: editable.dataset.ohwKey ?? "",
@@ -29748,6 +30054,9 @@ function OhhwellsBridge() {
29748
30054
  setHoveredItemRect(null);
29749
30055
  hoveredNavContainerRef.current = null;
29750
30056
  setHoveredNavContainerRect(null);
30057
+ siblingHintElRef.current = null;
30058
+ setSiblingHintRect(null);
30059
+ setSiblingHintRects([]);
29751
30060
  return;
29752
30061
  }
29753
30062
  {
@@ -29868,7 +30177,6 @@ function OhhwellsBridge() {
29868
30177
  hoveredNavContainerRef.current = null;
29869
30178
  setHoveredNavContainerRect(null);
29870
30179
  hoveredItemElRef.current = editable;
29871
- setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
29872
30180
  }
29873
30181
  }
29874
30182
  }
@@ -30578,7 +30886,11 @@ function OhhwellsBridge() {
30578
30886
  };
30579
30887
  const handleMouseMove = (e) => {
30580
30888
  const { clientX, clientY } = e;
30581
- if (pointOwnedByFloatingPanel(clientX, clientY)) return;
30889
+ if (pointOwnedByFloatingPanel(clientX, clientY)) {
30890
+ dismissImageHover();
30891
+ clearImageHover();
30892
+ return;
30893
+ }
30582
30894
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
30583
30895
  document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
30584
30896
  formHoverElRef.current = null;
@@ -30607,7 +30919,12 @@ function OhhwellsBridge() {
30607
30919
  setHoveredItemRect(null);
30608
30920
  hoveredNavContainerRef.current = null;
30609
30921
  setHoveredNavContainerRect(null);
30922
+ siblingHintElRef.current = null;
30923
+ setSiblingHintRect(null);
30924
+ setSiblingHintRects([]);
30610
30925
  dismissImageHover();
30926
+ clearImageHover();
30927
+ setSectionGap(null);
30611
30928
  return;
30612
30929
  }
30613
30930
  if (probeSocialsRowAt(clientX, clientY)) return;
@@ -30619,7 +30936,11 @@ function OhhwellsBridge() {
30619
30936
  if (e.data?.type !== "ow:pointer-sync") return;
30620
30937
  const { clientX, clientY } = e.data;
30621
30938
  if (typeof clientX !== "number" || typeof clientY !== "number") return;
30622
- if (pointOwnedByFloatingPanel(clientX, clientY)) return;
30939
+ if (pointOwnedByFloatingPanel(clientX, clientY)) {
30940
+ dismissImageHover();
30941
+ clearImageHover();
30942
+ return;
30943
+ }
30623
30944
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
30624
30945
  if (probeSocialsRowAt(clientX, clientY)) return;
30625
30946
  probeSectionGapAt(clientX, clientY);
@@ -30999,6 +31320,7 @@ function OhhwellsBridge() {
30999
31320
  applyAiFooterFromContent(content);
31000
31321
  if (typeof content[STYLE_STORE_KEY] === "string") {
31001
31322
  stylesRef.current = content[STYLE_STORE_KEY];
31323
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
31002
31324
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
31003
31325
  }
31004
31326
  applyBrandChrome(content);
@@ -31013,15 +31335,16 @@ function OhhwellsBridge() {
31013
31335
  }
31014
31336
  if (key === AI_SECTIONS_KEY) continue;
31015
31337
  if (key === AI_FOOTER_KEY) continue;
31338
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
31339
+ if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
31016
31340
  if (key === BRAND_KIT_KEY) continue;
31017
31341
  if (key === STYLE_STORE_KEY) continue;
31018
31342
  if (BRAND_CHROME_KEYS.has(key)) continue;
31019
- if (key === LOGO_PLACEHOLDER_KEY) continue;
31020
31343
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
31021
- if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
31022
31344
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
31023
31345
  continue;
31024
31346
  }
31347
+ if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
31025
31348
  if (applyVideoSettingNode(key, val)) continue;
31026
31349
  if (applyCarouselNode(key, val)) continue;
31027
31350
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -31047,6 +31370,7 @@ function OhhwellsBridge() {
31047
31370
  });
31048
31371
  applyLinkByKey(key, val);
31049
31372
  }
31373
+ applySectionEmbeds(content);
31050
31374
  applyLogoFromContent(content);
31051
31375
  applyLogoSizes(content);
31052
31376
  document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
@@ -31061,6 +31385,7 @@ function OhhwellsBridge() {
31061
31385
  reconcileNavbarItemsFromContent(editContentRef.current);
31062
31386
  reconcileFooterOrderFromContent(editContentRef.current);
31063
31387
  syncButtonsFromContent(document, editContentRef.current);
31388
+ if (selectedElRef.current && !selectedElRef.current.isConnected) deselectRef.current();
31064
31389
  syncNavigationDragCursorAttrs();
31065
31390
  if (typeof content[STYLE_STORE_KEY] === "string") {
31066
31391
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
@@ -31492,6 +31817,7 @@ function OhhwellsBridge() {
31492
31817
  const instanceId = typeof e.data.instanceId === "string" ? e.data.instanceId : "";
31493
31818
  const direction = e.data.direction === "up" || e.data.direction === "down" ? e.data.direction : null;
31494
31819
  if (!instanceId || !direction) return;
31820
+ const previous = orderBeforeMove(editContentRef.current[SECTION_ORDER_KEY], window.location.pathname);
31495
31821
  const entries = moveSectionInstance(instanceId, direction, window.location.pathname);
31496
31822
  if (!entries) return;
31497
31823
  const orderJson = JSON.stringify(
@@ -31500,7 +31826,12 @@ function OhhwellsBridge() {
31500
31826
  editContentRef.current = { ...editContentRef.current, [SECTION_ORDER_KEY]: orderJson };
31501
31827
  applyPersistedOrder(getPageSectionOrderEntries(orderJson, window.location.pathname));
31502
31828
  setAiSectionOrder(orderJson, window.location.pathname);
31503
- postToParentRef.current({ type: "ow:change", nodes: [{ key: SECTION_ORDER_KEY, text: orderJson }] });
31829
+ postToParentRef.current({
31830
+ type: "ow:change",
31831
+ nodes: [{ key: SECTION_ORDER_KEY, text: orderJson }],
31832
+ previous: { [SECTION_ORDER_KEY]: previous },
31833
+ moved: instanceId
31834
+ });
31504
31835
  window.dispatchEvent(new Event("resize"));
31505
31836
  };
31506
31837
  window.addEventListener("message", handleMoveSection);
@@ -31679,6 +32010,12 @@ function OhhwellsBridge() {
31679
32010
  closeLinkPopoverRef.current();
31680
32011
  return;
31681
32012
  }
32013
+ if (floatingPanelOpenRef.current) {
32014
+ setFloatingPanelRef.current(null);
32015
+ deselectRef.current();
32016
+ deactivateRef.current();
32017
+ return;
32018
+ }
31682
32019
  deselectRef.current();
31683
32020
  deactivateRef.current();
31684
32021
  clearMediaSelectionRef.current();
@@ -31863,12 +32200,6 @@ function OhhwellsBridge() {
31863
32200
  return;
31864
32201
  }
31865
32202
  }
31866
- if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "z" && !activeElRef.current) {
31867
- if (runPendingDeleteUndoRef.current()) {
31868
- e.preventDefault();
31869
- return;
31870
- }
31871
- }
31872
32203
  if (e.key !== "Escape") return;
31873
32204
  const el = activeElRef.current;
31874
32205
  if (el && originalContentRef.current !== null) {
@@ -32515,10 +32846,10 @@ function OhhwellsBridge() {
32515
32846
  window.removeEventListener("message", handleDuplicateSection);
32516
32847
  window.removeEventListener("message", handleDeactivate);
32517
32848
  window.removeEventListener("message", handleSelectNav);
32518
- document.documentElement.removeAttribute("data-ohw-panel-dragging");
32519
32849
  window.removeEventListener("message", handleToastAction);
32520
32850
  window.removeEventListener("message", handleFormCount);
32521
32851
  window.removeEventListener("message", handleUiEscape);
32852
+ document.documentElement.removeAttribute("data-ohw-panel-dragging");
32522
32853
  autoSaveTimers.current.forEach(clearTimeout);
32523
32854
  autoSaveTimers.current.clear();
32524
32855
  if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
@@ -32812,7 +33143,7 @@ function OhhwellsBridge() {
32812
33143
  postToParent2({
32813
33144
  type: "ow:ready",
32814
33145
  version: "1",
32815
- bridgeVersion: "0.1.169",
33146
+ bridgeVersion: "0.1.170-next.453",
32816
33147
  path: pathname,
32817
33148
  nodes: collectEditableNodes(editContentRef.current),
32818
33149
  sections
@@ -33013,7 +33344,7 @@ function OhhwellsBridge() {
33013
33344
  const copyHref = result.copy.getAttribute("data-ohw-href-key");
33014
33345
  const copyHrefVal = copyHref ? result.content[copyHref] : void 0;
33015
33346
  if (copyHref && copyHrefVal !== void 0) applyLinkByKey(copyHref, copyHrefVal);
33016
- postToParent2({ type: "ow:change", nodes: result.nodes });
33347
+ postToParent2({ type: "ow:change", nodes: result.nodes, label: "Button duplicated" });
33017
33348
  enforceLinkHrefs();
33018
33349
  requestAnimationFrame(() => {
33019
33350
  selectRef.current(result.copy);
@@ -33062,7 +33393,7 @@ function OhhwellsBridge() {
33062
33393
  ...editContentRef.current,
33063
33394
  ...Object.fromEntries(nodes.map((node) => [node.key, node.text]))
33064
33395
  };
33065
- postToParent2({ type: "ow:change", nodes });
33396
+ postToParent2({ type: "ow:change", nodes, label: "Social icon duplicated" });
33066
33397
  enforceLinkHrefs();
33067
33398
  const copyRow = findSocialsRow(result.item);
33068
33399
  if (copyRow) applySocialsDisplayToRow(copyRow, socialsDisplayFor(copyRow, editContentRef.current));
@@ -33112,7 +33443,7 @@ function OhhwellsBridge() {
33112
33443
  [NAV_COUNT_KEY]: navCount,
33113
33444
  [NAV_ORDER_KEY]: result.orderJson
33114
33445
  };
33115
- postToParent2({ type: "ow:change", nodes });
33446
+ postToParent2({ type: "ow:change", nodes, label: "Link duplicated" });
33116
33447
  enforceLinkHrefs();
33117
33448
  if (isNestedNavChild(selected) || navItemOwnsDropdownPanel(selected)) {
33118
33449
  setNavGroupForceOpen(selected, true);
@@ -33152,7 +33483,8 @@ function OhhwellsBridge() {
33152
33483
  { key: result.hrefKey, text: result.href },
33153
33484
  { key: result.labelKey, text: result.label },
33154
33485
  { key: FOOTER_ORDER_KEY, text: orderJson }
33155
- ]
33486
+ ],
33487
+ label: "Link duplicated"
33156
33488
  });
33157
33489
  enforceLinkHrefs();
33158
33490
  requestAnimationFrame(() => {