@ohhwells/bridge 0.1.168 → 0.1.169-next.448

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,6 +307,19 @@ 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";
@@ -378,14 +391,14 @@ function syncRemovedFlags(entries) {
378
391
  const removedIds = new Set(entries.filter((e) => e.removed).map((e) => e.instanceId));
379
392
  document.querySelectorAll(`[${REMOVED_ATTR}]`).forEach((el) => {
380
393
  if (!removedIds.has(instanceIdOf(el))) {
381
- el.style.removeProperty("display");
394
+ softUnhide(el);
382
395
  el.removeAttribute(REMOVED_ATTR);
383
396
  }
384
397
  });
385
398
  for (const id of removedIds) {
386
399
  const el = findByInstanceId(id);
387
400
  if (el) {
388
- el.style.display = "none";
401
+ softHide(el);
389
402
  el.setAttribute(REMOVED_ATTR, "");
390
403
  }
391
404
  }
@@ -457,6 +470,15 @@ function duplicateSectionInstance(instanceId, newId, currentPath, existingEntrie
457
470
  function newInstanceId() {
458
471
  return typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `instance-${Date.now()}-${Math.random().toString(36).slice(2)}`;
459
472
  }
473
+ function orderBeforeMove(raw, currentPath) {
474
+ const entries = topLevelSections().map((el, order) => ({
475
+ instanceId: instanceIdOf(el),
476
+ type: sectionTypeOf(el),
477
+ order,
478
+ pagePath: currentPath
479
+ }));
480
+ return JSON.stringify(mergePageSectionOrder(raw, currentPath, entries));
481
+ }
460
482
  function getPageSectionOrderEntries(raw, currentPath) {
461
483
  if (!raw) return [];
462
484
  try {
@@ -1216,21 +1238,21 @@ function chromeFrom(sample) {
1216
1238
  };
1217
1239
  }
1218
1240
  function filledPrimary(seed) {
1219
- const paint = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
1220
- const luminance = relativeLuminance(paint);
1241
+ const paint2 = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
1242
+ const luminance = relativeLuminance(paint2);
1221
1243
  return {
1222
- background: toCss({ ...paint, a: 1 }),
1244
+ background: toCss({ ...paint2, a: 1 }),
1223
1245
  color: luminance > 0.55 ? "rgb(15, 15, 15)" : "rgb(255, 255, 255)",
1224
1246
  borderColor: TRANSPARENT,
1225
1247
  borderWidth: "0px"
1226
1248
  };
1227
1249
  }
1228
1250
  function generatedSecondary(primary) {
1229
- const paint = accentColor(primary);
1251
+ const paint2 = accentColor(primary);
1230
1252
  return {
1231
1253
  background: TRANSPARENT,
1232
- color: paint,
1233
- borderColor: paint,
1254
+ color: paint2,
1255
+ borderColor: paint2,
1234
1256
  borderWidth: "1px"
1235
1257
  };
1236
1258
  }
@@ -1243,9 +1265,9 @@ function generatedGhost(primary) {
1243
1265
  };
1244
1266
  }
1245
1267
  function normalizeOutlineChrome(outline, primary) {
1246
- const paint = accentColor(primary);
1268
+ const paint2 = accentColor(primary);
1247
1269
  const text = parseColor(outline.color);
1248
- const paintRgb = parseColor(paint);
1270
+ const paintRgb = parseColor(paint2);
1249
1271
  const primaryLabel = parseColor(primary.color);
1250
1272
  const matchesOnPrimary = Boolean(text && primaryLabel) && colorKey(outline.color) === colorKey(primary.color);
1251
1273
  const textTooLight = text ? relativeLuminance(text) > 0.7 : false;
@@ -1254,8 +1276,8 @@ function normalizeOutlineChrome(outline, primary) {
1254
1276
  const hasBorder = parseFloat(outline.borderWidth) > 0;
1255
1277
  return {
1256
1278
  ...outline,
1257
- color: paint,
1258
- borderColor: hasBorder ? paint : outline.borderColor
1279
+ color: paint2,
1280
+ borderColor: hasBorder ? paint2 : outline.borderColor
1259
1281
  };
1260
1282
  }
1261
1283
  function generateButtonVariants(samples) {
@@ -5783,10 +5805,10 @@ function rekeyItemClone(clone, source, sibling, group, newIndex) {
5783
5805
  function setRemoved(el, removed) {
5784
5806
  if (removed) {
5785
5807
  el.setAttribute(ITEM_REMOVED_ATTR, "");
5786
- el.style.display = "none";
5808
+ softHide(el);
5787
5809
  } else if (el.hasAttribute(ITEM_REMOVED_ATTR)) {
5788
5810
  el.removeAttribute(ITEM_REMOVED_ATTR);
5789
- el.style.removeProperty("display");
5811
+ softUnhide(el);
5790
5812
  }
5791
5813
  }
5792
5814
  function seedState(group) {
@@ -6796,6 +6818,21 @@ function pricingCardFeatureCount(tree, index) {
6796
6818
  const target = findPricingCollection(tree)?.children?.[index];
6797
6819
  return target ? pricingFeatureList(target).length : 0;
6798
6820
  }
6821
+ function prevailingFeatureIcon(features) {
6822
+ const counts = /* @__PURE__ */ new Map();
6823
+ for (const row of features) {
6824
+ const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
6825
+ const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
6826
+ entry.count += 1;
6827
+ counts.set(key, entry);
6828
+ }
6829
+ let best = null;
6830
+ for (const entry of counts.values()) {
6831
+ if (!best || entry.count > best.count) best = entry;
6832
+ }
6833
+ if (!best) return {};
6834
+ return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
6835
+ }
6799
6836
  function addPricingCardFeature(tree, index, text) {
6800
6837
  return withPricingCollection(tree, (collection) => {
6801
6838
  const children = collection.children;
@@ -6804,7 +6841,7 @@ function addPricingCardFeature(tree, index, text) {
6804
6841
  const features = pricingFeatureList(target);
6805
6842
  if (features.length >= PRICING_FEATURES_MAX) return false;
6806
6843
  target.slots = target.slots ?? {};
6807
- target.slots.features = [...features, { text }];
6844
+ target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
6808
6845
  return true;
6809
6846
  });
6810
6847
  }
@@ -7448,6 +7485,120 @@ function findSelectableNavContainer(doc = document) {
7448
7485
  );
7449
7486
  }
7450
7487
 
7488
+ // src/lib/youtube.ts
7489
+ var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
7490
+ function extractYouTubeId(input) {
7491
+ const trimmed = input.trim();
7492
+ if (!trimmed) return null;
7493
+ if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
7494
+ let url;
7495
+ try {
7496
+ url = new URL(trimmed);
7497
+ } catch {
7498
+ return null;
7499
+ }
7500
+ const host = url.hostname.replace(/^www\./, "");
7501
+ if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
7502
+ return null;
7503
+ }
7504
+ let candidate = null;
7505
+ if (host === "youtu.be") {
7506
+ candidate = url.pathname.slice(1).split("/")[0] ?? null;
7507
+ } else if (url.pathname === "/watch") {
7508
+ candidate = url.searchParams.get("v");
7509
+ } else {
7510
+ const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
7511
+ candidate = match ? match[1] : null;
7512
+ }
7513
+ return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
7514
+ }
7515
+
7516
+ // src/lib/section-embed.ts
7517
+ var SECTION_EMBED_SUFFIX = "__ohw_embed";
7518
+ function readStoredEmbed(value) {
7519
+ if (value.startsWith("start\n")) {
7520
+ return { raw: value.slice("start\n".length), at: "start" };
7521
+ }
7522
+ return { raw: value, at: "end" };
7523
+ }
7524
+ function embedFrameSrc(value) {
7525
+ const videoId = extractYouTubeId(value);
7526
+ if (videoId) {
7527
+ return { src: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0`, title: "YouTube video" };
7528
+ }
7529
+ let url;
7530
+ try {
7531
+ url = new URL(value);
7532
+ } catch {
7533
+ return null;
7534
+ }
7535
+ const host = url.hostname.replace(/^www\./, "").toLowerCase();
7536
+ if (host === "google.com" && url.pathname.startsWith("/maps") || host === "maps.google.com") {
7537
+ const query = url.searchParams.get("q") || url.searchParams.get("query") || "";
7538
+ const src = query ? `https://maps.google.com/maps?q=${encodeURIComponent(query)}&output=embed` : `https://maps.google.com/maps?output=embed`;
7539
+ return { src, title: "Map" };
7540
+ }
7541
+ if (host === "maps.app.goo.gl") {
7542
+ return { src: value, title: "Map" };
7543
+ }
7544
+ if (host === "calendly.com" || host.endsWith(".calendly.com") || host === "calendar.google.com") {
7545
+ return { src: value, title: "Calendar" };
7546
+ }
7547
+ if (host === "docs.google.com" && url.pathname.includes("/forms/")) {
7548
+ return { src: value.replace(/\/edit(?:\?.*)?$/i, "/viewform"), title: "Form" };
7549
+ }
7550
+ if (host === "forms.gle") {
7551
+ return { src: value, title: "Form" };
7552
+ }
7553
+ return null;
7554
+ }
7555
+ function place(section, box, at) {
7556
+ if (at === "start") {
7557
+ section.insertBefore(box, section.firstChild);
7558
+ return;
7559
+ }
7560
+ section.appendChild(box);
7561
+ }
7562
+ function paint(section, key, src, title, at) {
7563
+ const existing = section.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`);
7564
+ const frame = existing?.querySelector("iframe");
7565
+ if (existing && frame) {
7566
+ if (frame.getAttribute("src") !== src) frame.setAttribute("src", src);
7567
+ frame.title = title;
7568
+ place(section, existing, at);
7569
+ return;
7570
+ }
7571
+ existing?.remove();
7572
+ const box = document.createElement("div");
7573
+ box.setAttribute("data-ohw-section-embed", key);
7574
+ 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;";
7575
+ const frameWrap = document.createElement("div");
7576
+ frameWrap.style.cssText = "position:relative;width:100%;aspect-ratio:16/9;min-height:250px;border-radius:12px;overflow:hidden;background:#0f172a;";
7577
+ const iframe = document.createElement("iframe");
7578
+ iframe.src = src;
7579
+ iframe.title = title;
7580
+ iframe.style.cssText = "position:absolute;inset:0;width:100%;height:100%;border:0;";
7581
+ iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture";
7582
+ iframe.setAttribute("allowfullscreen", "");
7583
+ frameWrap.appendChild(iframe);
7584
+ box.appendChild(frameWrap);
7585
+ place(section, box, at);
7586
+ }
7587
+ function applySectionEmbeds(content) {
7588
+ for (const [key, val] of Object.entries(content)) {
7589
+ if (!key.endsWith(SECTION_EMBED_SUFFIX)) continue;
7590
+ const sectionId = key.slice(0, -SECTION_EMBED_SUFFIX.length);
7591
+ const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
7592
+ const stored = typeof val === "string" ? readStoredEmbed(val) : null;
7593
+ const frame = stored ? embedFrameSrc(stored.raw) : null;
7594
+ if (!section || !stored || !frame) {
7595
+ section?.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`)?.remove();
7596
+ continue;
7597
+ }
7598
+ paint(section, key, frame.src, frame.title, stored.at);
7599
+ }
7600
+ }
7601
+
7451
7602
  // src/ui/ai-tree/aiSectionsManager.tsx
7452
7603
  var import_react_dom = require("react-dom");
7453
7604
  var import_client = require("react-dom/client");
@@ -8021,7 +8172,7 @@ var AI_MOBILE_CSS = [
8021
8172
  // page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
8022
8173
  // template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
8023
8174
  // 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`.
8175
+ // pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
8025
8176
  '[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
8026
8177
  // A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
8027
8178
  // window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
@@ -8037,8 +8188,10 @@ var AI_MOBILE_CSS = [
8037
8188
  "[data-ai-section]{overflow-x:hidden}",
8038
8189
  // `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
8039
8190
  // 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}",
8191
+ // still got a 20px band of section background down both sides on a phone. The footer's own
8192
+ // container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
8193
+ "[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
8194
+ "[data-ai-container]{padding:0 20px !important}",
8042
8195
  "[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
8043
8196
  "[data-ai-cell]{width:100%;min-width:0}",
8044
8197
  // The rule above turns every row into a COLUMN flex container on phones, which silently breaks
@@ -8243,6 +8396,31 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
8243
8396
  function textAttrs(ctx, path) {
8244
8397
  return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
8245
8398
  }
8399
+ var AI_RESPONSIVE_CSS = [
8400
+ "@media (max-width: 960px) {",
8401
+ " [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
8402
+ ' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
8403
+ "}",
8404
+ "@media (max-width: 640px) {",
8405
+ " [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
8406
+ " [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
8407
+ // Group containers flatten to a column on phones; span placements come along for free.
8408
+ // `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
8409
+ // the comment there. This sheet's copy is the narrower selector, so without the exemption it
8410
+ // flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
8411
+ // viewport with the heading/CTA in flow *under* the image, 219px of section background where the
8412
+ // layered text used to be.
8413
+ ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
8414
+ ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
8415
+ // `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
8416
+ // is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
8417
+ // a full-bleed hero gets its 20px side band back below 640px only — the one width where the
8418
+ // other rule had already been taught to stand down.
8419
+ " [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
8420
+ " [data-ai-responsive] { overflow-x: hidden; }",
8421
+ " [data-ai-responsive] img { max-width: 100%; }",
8422
+ "}"
8423
+ ].join("\n");
8246
8424
  var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
8247
8425
  function MediaBox({
8248
8426
  refValue,
@@ -8297,7 +8475,7 @@ function MediaBox({
8297
8475
  position: fill ? "absolute" : void 0,
8298
8476
  inset: fill ? 0 : void 0,
8299
8477
  width: fill ? "100%" : fixedSize ? "auto" : "100%",
8300
- height: fill ? "100%" : void 0,
8478
+ height: fill ? "100%" : fixedSize ? height : void 0,
8301
8479
  aspectRatio: fill ? void 0 : aspectRatio,
8302
8480
  minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
8303
8481
  borderRadius: radius,
@@ -9793,7 +9971,7 @@ function CollectionBlock({ node, ctx, path }) {
9793
9971
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
9794
9972
  "div",
9795
9973
  {
9796
- "data-ai-grid": "",
9974
+ "data-ai-grid": String(itemsPerRow),
9797
9975
  "data-ohw-pricing-collection": isPricing ? "" : void 0,
9798
9976
  style: {
9799
9977
  display: "grid",
@@ -10095,7 +10273,7 @@ function renderNode(node, ctx, path, ambientAlign) {
10095
10273
  },
10096
10274
  children: [
10097
10275
  i > 0 && ctx.heroOverlapFullBleed ? (
10098
- // The section's `data-ai-container` gave up its max-width/gutter so the base
10276
+ // The section's `data-ai-section-inner` gave up its max-width/gutter so the base
10099
10277
  // layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
10100
10278
  // scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
10101
10279
  // the full section width instead of reading at the usual content width.
@@ -10514,6 +10692,7 @@ function AiTreeRenderer({
10514
10692
  ...fillHeight ? { "data-ai-fill-height": "" } : {},
10515
10693
  ...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
10516
10694
  ...bgAttrs,
10695
+ "data-ai-responsive": "",
10517
10696
  style: {
10518
10697
  position: "relative",
10519
10698
  padding: `${padCss} 0`,
@@ -10527,12 +10706,13 @@ function AiTreeRenderer({
10527
10706
  ...fillHeight ? { display: "grid" } : {}
10528
10707
  },
10529
10708
  children: [
10530
- isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
10709
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_RESPONSIVE_CSS }),
10531
10710
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_MOBILE_CSS }),
10711
+ isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
10532
10712
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
10533
10713
  "div",
10534
10714
  {
10535
- "data-ai-container": "",
10715
+ "data-ai-section-inner": "",
10536
10716
  ...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
10537
10717
  style: {
10538
10718
  position: "relative",
@@ -10549,7 +10729,7 @@ function AiTreeRenderer({
10549
10729
  children: tree.rows.map((row, r2) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
10550
10730
  "div",
10551
10731
  {
10552
- "data-ai-row": "",
10732
+ "data-ai-columns": "",
10553
10733
  style: {
10554
10734
  display: "grid",
10555
10735
  gridTemplateColumns: "repeat(12, 1fr)",
@@ -11211,9 +11391,10 @@ function applyAiSectionsToDom(state, options) {
11211
11391
  if (existing && existing.serialized === serialized && existing.container.isConnected) {
11212
11392
  continue;
11213
11393
  }
11214
- const isNewMount = !existing || !existing.container.isConnected;
11215
11394
  let container = existing?.container;
11395
+ let isNewMount = false;
11216
11396
  if (!container || !container.isConnected) {
11397
+ isNewMount = true;
11217
11398
  existing?.root.unmount();
11218
11399
  container?.remove();
11219
11400
  container = document.createElement("div");
@@ -11551,6 +11732,34 @@ function minSpanForFooterBlock(type) {
11551
11732
  return 3;
11552
11733
  }
11553
11734
  }
11735
+ function readLiveSocialItems() {
11736
+ const root = getFooterRoot();
11737
+ const row = root?.querySelector("[data-ohw-socials-row]");
11738
+ if (!row) return [];
11739
+ const items = [];
11740
+ for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
11741
+ const href = anchor.getAttribute("href")?.trim() ?? "";
11742
+ const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
11743
+ const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
11744
+ if (!platform || !/^https?:\/\//i.test(href)) continue;
11745
+ items.push({ platform, href });
11746
+ }
11747
+ return items;
11748
+ }
11749
+ function syncSocialRowsFromDom(tree) {
11750
+ const root = getFooterRoot();
11751
+ if (!root) return;
11752
+ const row = root.querySelector("[data-ohw-socials-row]");
11753
+ const live = readLiveSocialItems();
11754
+ if (row && live.length === 0) return;
11755
+ for (const col of tree.columns) {
11756
+ col.blocks = col.blocks.flatMap((block) => {
11757
+ if (block.type !== "social-row") return [block];
11758
+ if (!row) return [];
11759
+ return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
11760
+ });
11761
+ }
11762
+ }
11554
11763
  function collectBrandBlocks(tree) {
11555
11764
  const brand = [];
11556
11765
  for (const col of tree.columns) {
@@ -11796,6 +12005,7 @@ function textOf2(el) {
11796
12005
  }
11797
12006
  function syncFooterTreeLinksFromDom(tree) {
11798
12007
  const next = cloneTree(tree);
12008
+ syncSocialRowsFromDom(next);
11799
12009
  const domCols = listFooterColumns().map((col) => {
11800
12010
  const heading = getFooterColumnHeadingEl(col);
11801
12011
  const title = heading ? textOf2(heading) : void 0;
@@ -17608,7 +17818,7 @@ function apiBase() {
17608
17818
  function bridgeVersion() {
17609
17819
  try {
17610
17820
  if (true) {
17611
- return "0.1.168";
17821
+ return "0.1.169-next.448";
17612
17822
  }
17613
17823
  } catch {
17614
17824
  }
@@ -17622,7 +17832,7 @@ function stampBridgeVersionOnDocument() {
17622
17832
  return;
17623
17833
  }
17624
17834
  try {
17625
- const v = true ? "0.1.168" : "";
17835
+ const v = true ? "0.1.169-next.448" : "";
17626
17836
  if (v) {
17627
17837
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
17628
17838
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -18300,6 +18510,7 @@ function MediaOverlay({
18300
18510
  (prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
18301
18511
  );
18302
18512
  }, [isVideo]);
18513
+ const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
18303
18514
  const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
18304
18515
  const box = {
18305
18516
  position: "fixed",
@@ -18398,11 +18609,10 @@ function MediaOverlay({
18398
18609
  className: "flex items-center justify-center cursor-pointer",
18399
18610
  style: {
18400
18611
  ...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",
18612
+ // Visual only. `pointer-events: auto` on this full-bleed rect covered the navbar
18613
+ // (hero bg includes the absolute TopNav) and swallowed CTA press-drag. Text overlay
18614
+ // and cueOnly also need clicks to fall through — Replace / video controls opt back in.
18615
+ pointerEvents: "none",
18406
18616
  // Selected: a firm component ring with no wash, so the image reads as chosen rather
18407
18617
  // than hovered. Hover keeps the existing tinted preview.
18408
18618
  boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
@@ -18429,17 +18639,17 @@ function MediaOverlay({
18429
18639
  },
18430
18640
  children: [
18431
18641
  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"
18642
+ replaceLabel
18433
18643
  ]
18434
18644
  }
18435
18645
  ),
18436
- replaceMode === "none" || cueOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
18646
+ showChrome && replaceMode !== "none" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
18437
18647
  Button,
18438
18648
  {
18439
18649
  "data-ohw-media-overlay": "",
18440
18650
  variant: "outline",
18441
18651
  size: "sm",
18442
- "aria-label": isVideo ? "Replace video" : "Replace image",
18652
+ "aria-label": replaceLabel,
18443
18653
  className: "gap-1.5 cursor-pointer hover:bg-background",
18444
18654
  style: {
18445
18655
  ...OVERLAY_BUTTON_STYLE,
@@ -18462,7 +18672,7 @@ function MediaOverlay({
18462
18672
  },
18463
18673
  children: [
18464
18674
  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
18675
+ replaceMode === "full" ? replaceLabel : null
18466
18676
  ]
18467
18677
  }
18468
18678
  )
@@ -18604,7 +18814,13 @@ function highlightChangedElements(keys, item, sectionId) {
18604
18814
  clearTimer = setTimeout(clearChangeHighlight, HIGHLIGHT_MS);
18605
18815
  return targets.length;
18606
18816
  }
18607
- function installAiChangeHighlight() {
18817
+ function highlightedRect() {
18818
+ const first = document.querySelector(`[${MARK_ATTR}]`);
18819
+ if (!first) return null;
18820
+ const rect = first.getBoundingClientRect();
18821
+ return { top: rect.top + window.scrollY, bottom: rect.bottom + window.scrollY };
18822
+ }
18823
+ function installAiChangeHighlight(select) {
18608
18824
  const onMessage = (e) => {
18609
18825
  const data = e.data;
18610
18826
  if (data?.type !== "ow:ai-highlight") return;
@@ -18613,12 +18829,37 @@ function installAiChangeHighlight() {
18613
18829
  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;
18614
18830
  const sectionId = typeof data.sectionId === "string" ? data.sectionId : void 0;
18615
18831
  const found = highlightChangedElements(keys, item, sectionId);
18616
- window.parent?.postMessage({ type: "ow:ai-highlight-done", found }, "*");
18832
+ const first = data.select === true ? document.querySelector(`[${MARK_ATTR}]`) : null;
18833
+ if (first) select?.(first);
18834
+ const rect = data.reveal === true && found > 0 ? highlightedRect() : null;
18835
+ window.parent?.postMessage({ type: "ow:ai-highlight-done", found, ...rect ? { rect } : {} }, "*");
18617
18836
  };
18618
18837
  window.addEventListener("message", onMessage);
18619
18838
  return () => window.removeEventListener("message", onMessage);
18620
18839
  }
18621
18840
 
18841
+ // src/lib/history-key-relay.ts
18842
+ var isMac = () => typeof navigator !== "undefined" && /Mac|iPhone|iPad/i.test(navigator.platform || navigator.userAgent);
18843
+ function historyActionFor(e, mac = isMac()) {
18844
+ const mod = mac ? e.metaKey : e.ctrlKey;
18845
+ if (!mod || e.altKey) return null;
18846
+ const key = e.key.toLowerCase();
18847
+ if (key === "z") return e.shiftKey ? "redo" : "undo";
18848
+ if (key === "y" && !mac) return "redo";
18849
+ return null;
18850
+ }
18851
+ var isEditingText = (el) => !!el && (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement || el instanceof HTMLElement && el.isContentEditable);
18852
+ function installHistoryKeyRelay() {
18853
+ const onKeyDown = (e) => {
18854
+ const action = historyActionFor(e);
18855
+ if (!action || isEditingText(document.activeElement)) return;
18856
+ e.preventDefault();
18857
+ window.parent?.postMessage({ type: "ow:history-key", action }, "*");
18858
+ };
18859
+ window.addEventListener("keydown", onKeyDown);
18860
+ return () => window.removeEventListener("keydown", onKeyDown);
18861
+ }
18862
+
18622
18863
  // src/ui/ai-section/AiSectionOverlay.tsx
18623
18864
  var import_jsx_runtime19 = require("react/jsx-runtime");
18624
18865
  var findSectionElement = findByInstanceId;
@@ -18871,7 +19112,8 @@ function AiSectionOverlay({
18871
19112
  window.addEventListener("message", onMessage);
18872
19113
  return () => window.removeEventListener("message", onMessage);
18873
19114
  }, [postToParent2]);
18874
- (0, import_react12.useEffect)(() => installAiChangeHighlight(), []);
19115
+ (0, import_react12.useEffect)(() => installAiChangeHighlight((el) => selectFromElement(el)), [selectFromElement]);
19116
+ (0, import_react12.useEffect)(() => installHistoryKeyRelay(), []);
18875
19117
  const [hoveredId, setHoveredId] = (0, import_react12.useState)(null);
18876
19118
  (0, import_react12.useEffect)(() => {
18877
19119
  const onMove = (e) => {
@@ -19062,7 +19304,7 @@ function AiSectionOverlay({
19062
19304
 
19063
19305
  // src/ui/ai-section/AiMediaStripOverlay.tsx
19064
19306
  var import_react13 = require("react");
19065
- var import_lucide_react8 = require("lucide-react");
19307
+ var import_lucide_react9 = require("lucide-react");
19066
19308
 
19067
19309
  // src/lib/ai-media-strip-tree.ts
19068
19310
  var MEDIA_STRIP_ITEM_MIN = 1;
@@ -19176,14 +19418,6 @@ function setMediaStripItemAsset(tree, index, assetId) {
19176
19418
  return true;
19177
19419
  });
19178
19420
  }
19179
- function setMediaStripItemAlt(tree, index, alt) {
19180
- return withMediaStrip(tree, (block) => {
19181
- const items = block.items;
19182
- if (index < 0 || index >= items.length) return false;
19183
- items[index] = { ...items[index], alt };
19184
- return true;
19185
- });
19186
- }
19187
19421
  function setMediaStripItemLink(tree, index, link) {
19188
19422
  return withMediaStrip(tree, (block) => {
19189
19423
  const items = block.items;
@@ -19201,11 +19435,117 @@ function setMediaStripItemLink(tree, index, link) {
19201
19435
  });
19202
19436
  }
19203
19437
 
19204
- // src/ui/ai-section/AiMediaStripOverlay.tsx
19438
+ // src/ui/dialog.tsx
19439
+ var React9 = __toESM(require("react"), 1);
19440
+ var import_radix_ui6 = require("radix-ui");
19441
+ var import_lucide_react8 = require("lucide-react");
19205
19442
  var import_jsx_runtime20 = require("react/jsx-runtime");
19206
- var PRIMARY3 = "#0885FE";
19207
- var OHW_BLUE = `var(--ohw-primary, ${PRIMARY3})`;
19208
- var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
19443
+ function Dialog2({
19444
+ ...props
19445
+ }) {
19446
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
19447
+ }
19448
+ function DialogPortal({
19449
+ ...props
19450
+ }) {
19451
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
19452
+ }
19453
+ function DialogOverlay({
19454
+ className,
19455
+ ...props
19456
+ }) {
19457
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19458
+ import_radix_ui6.Dialog.Overlay,
19459
+ {
19460
+ "data-slot": "dialog-overlay",
19461
+ "data-ohw-link-modal-root": "",
19462
+ className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
19463
+ ...props
19464
+ }
19465
+ );
19466
+ }
19467
+ var DialogContent = React9.forwardRef(
19468
+ ({ className, children, showCloseButton = true, container, ...props }, ref) => {
19469
+ const positionMode = container ? "absolute" : "fixed";
19470
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DialogPortal, { container: container ?? void 0, children: [
19471
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
19472
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
19473
+ import_radix_ui6.Dialog.Content,
19474
+ {
19475
+ ref,
19476
+ "data-slot": "dialog-content",
19477
+ className: cn(
19478
+ positionMode,
19479
+ "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",
19480
+ "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
19481
+ container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
19482
+ className
19483
+ ),
19484
+ onMouseDown: (e) => e.stopPropagation(),
19485
+ ...props,
19486
+ children: [
19487
+ children,
19488
+ showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19489
+ import_radix_ui6.Dialog.Close,
19490
+ {
19491
+ type: "button",
19492
+ className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
19493
+ "aria-label": "Close",
19494
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.X, { size: 16, "aria-hidden": true })
19495
+ }
19496
+ ) : null
19497
+ ]
19498
+ }
19499
+ )
19500
+ ] });
19501
+ }
19502
+ );
19503
+ DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
19504
+ function DialogHeader({
19505
+ className,
19506
+ ...props
19507
+ }) {
19508
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
19509
+ }
19510
+ function DialogFooter({
19511
+ className,
19512
+ ...props
19513
+ }) {
19514
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19515
+ "div",
19516
+ {
19517
+ className: cn("flex items-center justify-end gap-2", className),
19518
+ ...props
19519
+ }
19520
+ );
19521
+ }
19522
+ var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19523
+ import_radix_ui6.Dialog.Title,
19524
+ {
19525
+ ref,
19526
+ className: cn(
19527
+ "text-lg font-semibold leading-none tracking-tight text-card-foreground",
19528
+ className
19529
+ ),
19530
+ ...props
19531
+ }
19532
+ ));
19533
+ DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
19534
+ var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19535
+ import_radix_ui6.Dialog.Description,
19536
+ {
19537
+ ref,
19538
+ className: cn("text-sm text-muted-foreground", className),
19539
+ ...props
19540
+ }
19541
+ ));
19542
+ DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
19543
+ var DialogClose = import_radix_ui6.Dialog.Close;
19544
+
19545
+ // src/ui/ai-section/AiMediaStripOverlay.tsx
19546
+ var import_jsx_runtime21 = require("react/jsx-runtime");
19547
+ var PRIMARY3 = "var(--ohw-primary, #0885FE)";
19548
+ 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]";
19209
19549
  function findMediaStripItemElement(sectionId, index) {
19210
19550
  const sectionEl2 = findByInstanceId(sectionId);
19211
19551
  if (!sectionEl2) return null;
@@ -19215,14 +19555,35 @@ function findMediaStripItemElement(sectionId, index) {
19215
19555
  }
19216
19556
  return null;
19217
19557
  }
19218
- function readRect2(ref) {
19219
- const el = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19558
+ function itemRefFromTarget(target) {
19559
+ if (!(target instanceof Element)) return null;
19560
+ if (target.closest(CHROME_SELECTOR)) return null;
19561
+ const itemEl = target.closest("[data-ohw-media-strip-item]");
19562
+ if (!itemEl) return null;
19563
+ const sectionEl2 = itemEl.closest("[data-ohw-section]");
19564
+ const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
19565
+ const sectionId = unit ? instanceIdOf(unit) || null : null;
19566
+ const index = Number(itemEl.dataset.ohwMediaStripIndex);
19567
+ if (!sectionId || Number.isNaN(index)) return null;
19568
+ return { sectionId, index };
19569
+ }
19570
+ function sameRef(a, b) {
19571
+ return a?.sectionId === b?.sectionId && a?.index === b?.index;
19572
+ }
19573
+ function rectOf(el) {
19220
19574
  if (!el) return null;
19221
19575
  const r2 = el.getBoundingClientRect();
19222
19576
  if (r2.width <= 0 || r2.height <= 0) return null;
19223
19577
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
19224
19578
  }
19225
- function useLiveItemRect(ref) {
19579
+ function readRect2(ref) {
19580
+ return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
19581
+ }
19582
+ function readStripRect(ref) {
19583
+ const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19584
+ return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
19585
+ }
19586
+ function useLiveItemRect(ref, strip = false) {
19226
19587
  const [rect, setRect] = (0, import_react13.useState)(null);
19227
19588
  (0, import_react13.useEffect)(() => {
19228
19589
  if (!ref) {
@@ -19230,7 +19591,7 @@ function useLiveItemRect(ref) {
19230
19591
  return;
19231
19592
  }
19232
19593
  const update = () => {
19233
- const next = readRect2(ref);
19594
+ const next = strip ? readStripRect(ref) : readRect2(ref);
19234
19595
  setRect(
19235
19596
  (prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
19236
19597
  );
@@ -19245,9 +19606,49 @@ function useLiveItemRect(ref) {
19245
19606
  window.removeEventListener("resize", update);
19246
19607
  clearInterval(interval);
19247
19608
  };
19248
- }, [ref?.sectionId, ref?.index]);
19609
+ }, [ref?.sectionId, ref?.index, strip]);
19249
19610
  return rect;
19250
19611
  }
19612
+ var TOOLBAR_STRIP_GAP = 52;
19613
+ var TOOLBAR_STRIP_GAP_MOBILE = 42;
19614
+ var TOOLBAR_EDGE_MARGIN2 = 4;
19615
+ function StripToolbarSlot({ stripRect, children }) {
19616
+ const slotRef = (0, import_react13.useRef)(null);
19617
+ const [shift, setShift] = (0, import_react13.useState)(0);
19618
+ const centerX = stripRect.left + stripRect.width / 2;
19619
+ (0, import_react13.useLayoutEffect)(() => {
19620
+ const slot = slotRef.current;
19621
+ if (!slot) return;
19622
+ const clamp = () => {
19623
+ const w = slot.offsetWidth;
19624
+ if (w <= 0) return;
19625
+ const half = w / 2;
19626
+ const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
19627
+ setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
19628
+ };
19629
+ clamp();
19630
+ const ro = new ResizeObserver(clamp);
19631
+ ro.observe(slot);
19632
+ return () => ro.disconnect();
19633
+ }, [centerX, children]);
19634
+ const mobile = window.innerWidth <= 480;
19635
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19636
+ "div",
19637
+ {
19638
+ ref: slotRef,
19639
+ "data-ohw-bridge": "",
19640
+ "data-ohw-item-interaction": "",
19641
+ className: "pointer-events-auto fixed",
19642
+ style: {
19643
+ top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
19644
+ left: centerX + shift,
19645
+ transform: "translate(-50%, -100%)",
19646
+ zIndex: 2147483645
19647
+ },
19648
+ children
19649
+ }
19650
+ );
19651
+ }
19251
19652
  function requestValidateTree(postToParent2, tree) {
19252
19653
  return new Promise((resolve) => {
19253
19654
  const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
@@ -19284,116 +19685,72 @@ function requestAssetPick(postToParent2) {
19284
19685
  postToParent2({ type: "ow:asset-pick", id });
19285
19686
  });
19286
19687
  }
19287
- function Pill({
19688
+ function ToolbarAction({
19288
19689
  label,
19289
19690
  onClick,
19290
- disabled,
19291
- active
19292
- }) {
19293
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19294
- "button",
19295
- {
19296
- type: "button",
19297
- onClick,
19298
- disabled,
19299
- style: {
19300
- height: 28,
19301
- padding: "0 10px",
19302
- display: "inline-flex",
19303
- alignItems: "center",
19304
- gap: 4,
19305
- borderRadius: 999,
19306
- border: "none",
19307
- cursor: disabled ? "default" : "pointer",
19308
- background: active ? OHW_BLUE_DARK : "#ffffff",
19309
- color: active ? "#ffffff" : OHW_BLUE_DARK,
19310
- opacity: disabled ? 0.4 : 1,
19311
- fontSize: 12,
19312
- lineHeight: "16px",
19313
- fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19314
- whiteSpace: "nowrap",
19315
- flex: "0 0 auto"
19316
- },
19317
- children: label
19318
- }
19319
- );
19691
+ disabled = false,
19692
+ active = false,
19693
+ children
19694
+ }) {
19695
+ const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
19696
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
19697
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: button }) : button }),
19698
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
19699
+ ] });
19320
19700
  }
19321
- function AltInput({ value, onCommit }) {
19322
- const [draft, setDraft] = (0, import_react13.useState)(value);
19323
- (0, import_react13.useEffect)(() => setDraft(value), [value]);
19324
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
19325
- "div",
19326
- {
19327
- style: {
19328
- display: "flex",
19329
- alignItems: "center",
19330
- gap: 6,
19331
- height: 28,
19332
- padding: "0 12px",
19333
- borderRadius: 999,
19334
- background: "#ffffff",
19335
- width: "100%",
19336
- maxWidth: 260,
19337
- boxSizing: "border-box"
19338
- },
19339
- children: [
19340
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19341
- "span",
19342
- {
19343
- style: {
19344
- flex: "0 0 auto",
19345
- color: OHW_BLUE_DARK,
19346
- fontSize: 10,
19347
- fontWeight: 700,
19348
- textTransform: "uppercase",
19349
- letterSpacing: 0.4
19350
- },
19351
- children: "Alt"
19352
- }
19353
- ),
19354
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19355
- "input",
19701
+ function ToolbarSeparator() {
19702
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
19703
+ }
19704
+ function OptionMenu({
19705
+ label,
19706
+ value,
19707
+ options,
19708
+ onChange
19709
+ }) {
19710
+ const current = options.find((o) => o.value === value) ?? options[0];
19711
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
19712
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground", children: label }),
19713
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu, { modal: false, children: [
19714
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
19715
+ "button",
19716
+ {
19717
+ type: "button",
19718
+ "aria-label": label,
19719
+ 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",
19720
+ children: [
19721
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1 text-left", children: current.label }),
19722
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
19723
+ ]
19724
+ }
19725
+ ) }),
19726
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
19727
+ const selected = option.value === value;
19728
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
19729
+ DropdownMenuItem,
19356
19730
  {
19357
- type: "text",
19358
- value: draft,
19359
- onChange: (e) => setDraft(e.target.value),
19360
- onBlur: () => {
19361
- if (draft !== value) onCommit(draft);
19362
- },
19363
- onKeyDown: (e) => {
19364
- if (e.key === "Enter") e.currentTarget.blur();
19365
- if (e.key === "Escape") {
19366
- setDraft(value);
19367
- e.currentTarget.blur();
19368
- }
19369
- },
19370
- placeholder: "Describe this image",
19371
- "aria-label": "Image alt text",
19372
- style: {
19373
- flex: 1,
19374
- minWidth: 0,
19375
- border: "none",
19376
- outline: "none",
19377
- background: "transparent",
19378
- fontSize: 12,
19379
- lineHeight: "16px",
19380
- fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19381
- color: "#1f2937"
19382
- }
19383
- }
19384
- )
19385
- ]
19386
- }
19387
- );
19731
+ role: "menuitemradio",
19732
+ "aria-checked": selected,
19733
+ onSelect: () => onChange(option.value),
19734
+ className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
19735
+ children: [
19736
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: option.label }),
19737
+ selected && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Check, { size: 16, className: "text-bridge-primary" })
19738
+ ]
19739
+ },
19740
+ option.value
19741
+ );
19742
+ }) })
19743
+ ] })
19744
+ ] });
19388
19745
  }
19389
19746
  var VARIANTS = [
19390
19747
  { value: "logos", label: "Logos" },
19391
19748
  { value: "reel", label: "Reel" }
19392
19749
  ];
19393
19750
  var ALIGNS = [
19394
- { value: "left", label: "Left" },
19395
- { value: "center", label: "Center" },
19396
- { value: "right", label: "Right" }
19751
+ { value: "left", label: "Align left", Icon: import_lucide_react9.AlignLeft },
19752
+ { value: "center", label: "Align center", Icon: import_lucide_react9.AlignCenter },
19753
+ { value: "right", label: "Align right", Icon: import_lucide_react9.AlignRight }
19397
19754
  ];
19398
19755
  var HOVERS = [
19399
19756
  { value: "none", label: "None" },
@@ -19401,104 +19758,104 @@ var HOVERS = [
19401
19758
  { value: "zoom", label: "Zoom" },
19402
19759
  { value: "fade", label: "Fade" }
19403
19760
  ];
19404
- var TREATMENTS = [
19405
- { value: "color", label: "Color" },
19406
- { value: "grayscale", label: "Grayscale" }
19407
- ];
19408
19761
  var HTTP_URL_RE = /^https?:\/\/\S+$/i;
19409
- function LinkInput({ value, onCommit }) {
19410
- const [draft, setDraft] = (0, import_react13.useState)(value);
19762
+ function LinkModal({
19763
+ href,
19764
+ linkTarget,
19765
+ onClose,
19766
+ onSave
19767
+ }) {
19768
+ const [draft, setDraft] = (0, import_react13.useState)(href);
19769
+ const [newTab, setNewTab] = (0, import_react13.useState)(linkTarget !== "same-tab");
19411
19770
  const [invalid, setInvalid] = (0, import_react13.useState)(false);
19412
- (0, import_react13.useEffect)(() => {
19413
- setDraft(value);
19414
- setInvalid(false);
19415
- }, [value]);
19416
- const commit2 = () => {
19771
+ const save = () => {
19417
19772
  const next = draft.trim();
19418
- if (next === value) return setInvalid(false);
19419
- if (next && !HTTP_URL_RE.test(next)) return setInvalid(true);
19420
- setInvalid(false);
19421
- onCommit(next);
19422
- };
19423
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
19424
- "div",
19425
- {
19426
- style: {
19427
- display: "flex",
19428
- alignItems: "center",
19429
- gap: 6,
19430
- height: 28,
19431
- padding: "0 12px",
19432
- borderRadius: 999,
19433
- background: "#ffffff",
19434
- width: "100%",
19435
- maxWidth: 260,
19436
- boxSizing: "border-box",
19437
- boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
19438
- },
19439
- children: [
19440
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19441
- "span",
19442
- {
19443
- style: {
19444
- flex: "0 0 auto",
19445
- color: OHW_BLUE_DARK,
19446
- fontSize: 10,
19447
- fontWeight: 700,
19448
- textTransform: "uppercase",
19449
- letterSpacing: 0.4
19450
- },
19451
- children: "Link"
19452
- }
19453
- ),
19454
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19455
- "input",
19456
- {
19457
- type: "text",
19458
- inputMode: "url",
19459
- value: draft,
19460
- onChange: (e) => setDraft(e.target.value),
19461
- onBlur: commit2,
19462
- onKeyDown: (e) => {
19463
- if (e.key === "Enter") e.currentTarget.blur();
19464
- if (e.key === "Escape") {
19465
- setDraft(value);
19466
- setInvalid(false);
19467
- e.currentTarget.blur();
19468
- }
19469
- },
19470
- placeholder: "https://example.com",
19471
- "aria-label": "Image link URL",
19472
- "aria-invalid": invalid,
19473
- style: {
19474
- flex: 1,
19475
- minWidth: 0,
19476
- border: "none",
19477
- outline: "none",
19478
- background: "transparent",
19479
- fontSize: 12,
19480
- lineHeight: "16px",
19481
- fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19482
- color: "#1f2937"
19483
- }
19484
- }
19485
- )
19486
- ]
19773
+ if (next && !HTTP_URL_RE.test(next)) {
19774
+ setInvalid(true);
19775
+ return;
19487
19776
  }
19488
- );
19777
+ onSave(next, newTab ? "new-tab" : "same-tab");
19778
+ onClose();
19779
+ };
19780
+ 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: [
19781
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogTitle, { className: "text-base", children: "Image link" }) }),
19782
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-3", children: [
19783
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19784
+ "input",
19785
+ {
19786
+ autoFocus: true,
19787
+ type: "text",
19788
+ inputMode: "url",
19789
+ value: draft,
19790
+ onChange: (e) => {
19791
+ setDraft(e.target.value);
19792
+ setInvalid(false);
19793
+ },
19794
+ onKeyDown: (e) => {
19795
+ if (e.key === "Enter") save();
19796
+ },
19797
+ placeholder: "https://example.com",
19798
+ "aria-label": "Image link URL",
19799
+ "aria-invalid": invalid,
19800
+ className: cn(
19801
+ "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",
19802
+ invalid && "border-destructive focus:border-destructive"
19803
+ )
19804
+ }
19805
+ ),
19806
+ invalid && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
19807
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
19808
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
19809
+ "Open in new tab"
19810
+ ] })
19811
+ ] }),
19812
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogFooter, { children: [
19813
+ href && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19814
+ "button",
19815
+ {
19816
+ type: "button",
19817
+ onClick: () => {
19818
+ onSave("", "new-tab");
19819
+ onClose();
19820
+ },
19821
+ className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
19822
+ children: "Remove link"
19823
+ }
19824
+ ),
19825
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19826
+ "button",
19827
+ {
19828
+ type: "button",
19829
+ onClick: onClose,
19830
+ className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
19831
+ children: "Cancel"
19832
+ }
19833
+ ),
19834
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19835
+ "button",
19836
+ {
19837
+ type: "button",
19838
+ onClick: save,
19839
+ className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
19840
+ children: "Save"
19841
+ }
19842
+ )
19843
+ ] })
19844
+ ] }) });
19489
19845
  }
19490
19846
  function MediaStripToolbar({
19491
19847
  entry,
19492
19848
  index,
19493
19849
  pending,
19494
19850
  error,
19851
+ itemEditOn,
19852
+ onToggleItemEdit,
19495
19853
  onSetVariant,
19496
19854
  onSetAlign,
19497
19855
  onSetHover,
19498
19856
  onSetTreatment,
19499
19857
  onResize,
19500
- onSetAlt,
19501
- onSetLink,
19858
+ onOpenLink,
19502
19859
  onAddItem,
19503
19860
  onRemoveItem,
19504
19861
  onChangeImage,
@@ -19507,81 +19864,102 @@ function MediaStripToolbar({
19507
19864
  }) {
19508
19865
  const items = mediaStripItems(entry.tree);
19509
19866
  const itemCount = items.length;
19510
- const currentAlt = items[index]?.alt ?? "";
19511
- const currentHref2 = items[index]?.href ?? "";
19512
- const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
19513
19867
  const slots = findMediaStripSlots(entry.tree);
19514
19868
  const variant = slots?.variant === "reel" ? "reel" : "logos";
19515
19869
  const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
19516
19870
  const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
19517
19871
  const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
19518
19872
  const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19519
- const isMobile = window.innerWidth <= 480;
19520
- const rowStyle = isMobile ? {
19521
- display: "flex",
19522
- gap: 6,
19523
- flexWrap: "nowrap",
19524
- justifyContent: "center",
19525
- overflowX: "auto",
19526
- WebkitOverflowScrolling: "touch",
19527
- width: "100%",
19528
- scrollbarWidth: "none"
19529
- } : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
19530
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
19873
+ const mobile = window.innerWidth <= 480;
19874
+ const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
19875
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
19531
19876
  "div",
19532
19877
  {
19533
19878
  "data-ohw-bridge": "",
19534
19879
  "data-ohw-toolbar": "",
19535
19880
  onMouseDown: (e) => e.stopPropagation(),
19536
- style: {
19537
- display: "flex",
19538
- flexDirection: "column",
19539
- gap: 6,
19540
- alignItems: "center",
19541
- background: OHW_BLUE,
19542
- padding: 8,
19543
- borderRadius: 12,
19544
- boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
19545
- pointerEvents: pending ? "none" : "auto",
19546
- opacity: pending ? 0.6 : 1,
19547
- maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
19548
- },
19881
+ className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
19882
+ style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
19549
19883
  children: [
19550
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19551
- VARIANTS.map((v) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: v.label, active: variant === v.value, onClick: () => onSetVariant(v.value) }, v.value)),
19552
- ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: a.label, active: align === a.value, onClick: () => onSetAlign(a.value) }, a.value))
19553
- ] }),
19554
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19555
- HOVERS.map((h) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: h.label, active: hover === h.value, onClick: () => onSetHover(h.value) }, h.value)),
19556
- TREATMENTS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: t.label, active: treatment === t.value, onClick: () => onSetTreatment(t.value) }, t.value))
19557
- ] }),
19558
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
19559
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2212", onClick: () => onResize(-8) }),
19560
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { style: { color: "#ffffff", fontSize: 12, minWidth: 34, textAlign: "center" }, children: [
19561
- sizeValue,
19562
- "px"
19563
- ] }),
19564
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "+", onClick: () => onResize(8) })
19565
- ] }),
19566
- /* @__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 }) }),
19567
- /* @__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) }) }),
19568
- currentHref2 && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19569
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "New tab", active: currentTarget === "new-tab", onClick: () => onSetLink(currentHref2, "new-tab") }),
19570
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "Same tab", active: currentTarget === "same-tab", onClick: () => onSetLink(currentHref2, "same-tab") })
19571
- ] }),
19572
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19573
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "Change Image", onClick: onChangeImage }),
19574
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "+ Item", onClick: onAddItem }),
19575
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2212 Item", onClick: onRemoveItem, disabled: itemCount <= 1 })
19576
- ] }),
19577
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19578
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2190 Move", onClick: onMoveLeft, disabled: index <= 0 }),
19579
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2192 Move", onClick: onMoveRight, disabled: index >= itemCount - 1 })
19580
- ] }),
19581
- error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
19884
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
19885
+ "div",
19886
+ {
19887
+ className: cn(
19888
+ "flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
19889
+ "shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
19890
+ mobile ? "flex-wrap justify-center" : "flex-nowrap"
19891
+ ),
19892
+ children: [
19893
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
19894
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19895
+ CustomToolbarButton,
19896
+ {
19897
+ type: "button",
19898
+ "aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
19899
+ "aria-pressed": itemEditOn,
19900
+ onClick: onToggleItemEdit,
19901
+ className: "group size-8",
19902
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19903
+ import_lucide_react9.Star,
19904
+ {
19905
+ size: 16,
19906
+ fill: "currentColor",
19907
+ strokeWidth: 0,
19908
+ className: cn(
19909
+ "transition-colors",
19910
+ itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
19911
+ ),
19912
+ style: { pointerEvents: "none" }
19913
+ }
19914
+ )
19915
+ }
19916
+ ) }),
19917
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
19918
+ ] }),
19919
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
19920
+ /* @__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" } }) }),
19921
+ /* @__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" } }) }),
19922
+ /* @__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" } }) }),
19923
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19924
+ ToolbarAction,
19925
+ {
19926
+ label: gatedLabel("Move right"),
19927
+ onClick: onMoveRight,
19928
+ disabled: !itemEditOn || index >= itemCount - 1,
19929
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ArrowRight, { size: 16, style: { pointerEvents: "none" } })
19930
+ }
19931
+ ),
19932
+ /* @__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" } }) }),
19933
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
19934
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
19935
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
19936
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19937
+ ToolbarAction,
19938
+ {
19939
+ label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
19940
+ active: treatment === "grayscale",
19941
+ onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
19942
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Palette, { size: 16, style: { pointerEvents: "none" } })
19943
+ }
19944
+ ),
19945
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
19946
+ 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)),
19947
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
19948
+ /* @__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" } }) }),
19949
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
19950
+ sizeValue,
19951
+ "px"
19952
+ ] }),
19953
+ /* @__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" } }) }),
19954
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
19955
+ /* @__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" } }) })
19956
+ ]
19957
+ }
19958
+ ),
19959
+ 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 })
19582
19960
  ]
19583
19961
  }
19584
- );
19962
+ ) });
19585
19963
  }
19586
19964
  function findMediaStripSlots(tree) {
19587
19965
  const stack = tree.rows.flatMap((row) => row.blocks);
@@ -19600,31 +19978,23 @@ function AiMediaStripOverlay({
19600
19978
  }) {
19601
19979
  const [hover, setHover] = (0, import_react13.useState)(null);
19602
19980
  const [active, setActive] = (0, import_react13.useState)(null);
19981
+ const [itemEditOn, setItemEditOn] = (0, import_react13.useState)(false);
19982
+ const [linkOpen, setLinkOpen] = (0, import_react13.useState)(false);
19603
19983
  const [pending, setPending] = (0, import_react13.useState)(false);
19604
19984
  const [error, setError] = (0, import_react13.useState)(null);
19605
19985
  const activeRef = (0, import_react13.useRef)(null);
19606
19986
  activeRef.current = active;
19987
+ const linkOpenRef = (0, import_react13.useRef)(false);
19988
+ linkOpenRef.current = linkOpen;
19607
19989
  (0, import_react13.useEffect)(() => {
19608
19990
  const onMove = (e) => {
19991
+ const ref = itemRefFromTarget(e.target);
19609
19992
  const t = e.target;
19610
- if (!(t instanceof HTMLElement)) return;
19611
- if (t.closest("[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review]")) {
19612
- return;
19613
- }
19614
- const itemEl = t.closest("[data-ohw-media-strip-item]");
19615
- if (!itemEl) {
19616
- setHover(null);
19617
- return;
19618
- }
19619
- const sectionEl2 = itemEl.closest("[data-ohw-section]");
19620
- const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
19621
- const sectionId = unit ? instanceIdOf(unit) || null : null;
19622
- const index = Number(itemEl.dataset.ohwMediaStripIndex);
19623
- if (!sectionId || Number.isNaN(index)) {
19624
- setHover(null);
19625
- return;
19626
- }
19627
- setHover({ sectionId, index });
19993
+ const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
19994
+ setHover((prev) => {
19995
+ const next = ref && !overEditable ? ref : null;
19996
+ return sameRef(prev, next) ? prev : next;
19997
+ });
19628
19998
  };
19629
19999
  const onLeave = () => setHover(null);
19630
20000
  document.addEventListener("mousemove", onMove, { passive: true });
@@ -19636,23 +20006,25 @@ function AiMediaStripOverlay({
19636
20006
  }, []);
19637
20007
  (0, import_react13.useEffect)(() => {
19638
20008
  const onClick = (e) => {
19639
- const current = activeRef.current;
19640
- if (!current) return;
19641
20009
  const t = e.target;
19642
- if (!(t instanceof HTMLElement)) return;
19643
- if (t.closest("[data-ohw-item-interaction]")) return;
19644
- const itemEl = findMediaStripItemElement(current.sectionId, current.index);
19645
- if (itemEl && itemEl.contains(t)) return;
19646
- setActive(null);
20010
+ if (!(t instanceof Element)) return;
20011
+ if (t.closest(CHROME_SELECTOR)) return;
20012
+ const ref = itemRefFromTarget(t);
20013
+ if (sameRef(activeRef.current, ref)) return;
20014
+ if (ref) clearInteractionChromeRef.current();
20015
+ setItemEditOn(false);
19647
20016
  setError(null);
20017
+ setActive(ref);
19648
20018
  };
19649
20019
  document.addEventListener("click", onClick, true);
19650
20020
  return () => document.removeEventListener("click", onClick, true);
19651
- }, []);
20021
+ }, [clearInteractionChromeRef]);
19652
20022
  (0, import_react13.useEffect)(() => {
19653
20023
  const onBlur = () => {
19654
20024
  if (!activeRef.current) return;
19655
20025
  setActive(null);
20026
+ setItemEditOn(false);
20027
+ setLinkOpen(false);
19656
20028
  setError(null);
19657
20029
  };
19658
20030
  window.addEventListener("blur", onBlur);
@@ -19662,7 +20034,10 @@ function AiMediaStripOverlay({
19662
20034
  const onKeyDown = (e) => {
19663
20035
  if (e.key !== "Escape") return;
19664
20036
  if (!activeRef.current) return;
20037
+ if (linkOpenRef.current) return;
20038
+ if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
19665
20039
  setActive(null);
20040
+ setItemEditOn(false);
19666
20041
  setError(null);
19667
20042
  };
19668
20043
  document.addEventListener("keydown", onKeyDown);
@@ -19696,137 +20071,133 @@ function AiMediaStripOverlay({
19696
20071
  tree: nextTree,
19697
20072
  label: entry.label,
19698
20073
  media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
19699
- ...entry.brand ? { brand: entry.brand } : {}
20074
+ ...entry.brand ? { brand: entry.brand } : {},
20075
+ // The user is already looking at the strip they just edited — recentering the viewport
20076
+ // on every edit reads as the section jumping around.
20077
+ skipScrollIntoView: true
19700
20078
  });
19701
20079
  return true;
19702
20080
  },
19703
20081
  [findEntry, postToParent2, applyTreeLocalRef]
19704
20082
  );
19705
20083
  const activeEntry = active ? findEntry(active.sectionId) : null;
19706
- const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
19707
20084
  const activeItemRect = useLiveItemRect(active);
19708
- const TOOLBAR_APPROX_H = 170;
19709
- const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
19710
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
19711
- hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19712
- "button",
19713
- {
19714
- type: "button",
19715
- "data-ohw-toolbar": "",
19716
- onClick: () => {
19717
- clearInteractionChromeRef.current();
19718
- setActive(hover);
19719
- },
19720
- "aria-label": "Configure media item",
19721
- style: {
19722
- position: "fixed",
19723
- top: hoverHandleRect.top + 8,
19724
- left: hoverHandleRect.left + hoverHandleRect.width - 36,
19725
- width: 28,
19726
- height: 28,
19727
- borderRadius: 8,
19728
- border: `1.5px dashed ${PRIMARY3}`,
19729
- background: "#ffffff",
19730
- color: PRIMARY3,
19731
- display: "flex",
19732
- alignItems: "center",
19733
- justifyContent: "center",
19734
- cursor: "pointer",
19735
- zIndex: 2147483643,
19736
- fontSize: 14,
19737
- fontWeight: 700
19738
- },
19739
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.Star, { size: 14, style: { pointerEvents: "none" } })
19740
- }
19741
- ),
19742
- activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19743
- ItemInteractionLayer,
19744
- {
19745
- rect: activeItemRect,
19746
- state: toolbarState,
19747
- toolbar: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19748
- MediaStripToolbar,
19749
- {
19750
- entry: activeEntry,
19751
- index: active.index,
19752
- pending,
19753
- error,
19754
- onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
19755
- onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
19756
- onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
19757
- onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
19758
- onResize: (delta) => {
19759
- const slots = findMediaStripSlots(activeEntry.tree);
19760
- const variant = slots?.variant === "reel" ? "reel" : "logos";
19761
- const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19762
- void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
19763
- },
19764
- onSetAlt: (alt) => {
19765
- void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
19766
- },
19767
- onSetLink: (href, linkTarget) => {
20085
+ const activeStripRect = useLiveItemRect(active, true);
20086
+ const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
20087
+ const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
20088
+ const activeItem = active ? activeItems[active.index] : void 0;
20089
+ const activeHref = activeItem?.href ?? "";
20090
+ const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
20091
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
20092
+ hoverRect && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20093
+ activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
20094
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
20095
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20096
+ MediaStripToolbar,
20097
+ {
20098
+ entry: activeEntry,
20099
+ index: active.index,
20100
+ pending,
20101
+ error,
20102
+ itemEditOn,
20103
+ onToggleItemEdit: () => setItemEditOn((on) => !on),
20104
+ onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
20105
+ onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
20106
+ onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
20107
+ onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
20108
+ onResize: (delta) => {
20109
+ const slots = findMediaStripSlots(activeEntry.tree);
20110
+ const variant = slots?.variant === "reel" ? "reel" : "logos";
20111
+ const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
20112
+ void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
20113
+ },
20114
+ onOpenLink: () => setLinkOpen(true),
20115
+ onAddItem: () => {
20116
+ void requestAssetPick(postToParent2).then((picked) => {
20117
+ if (!picked) return;
20118
+ const item = { assetId: picked.assetId, alt: "Logo" };
19768
20119
  void runMutation(
19769
20120
  active.sectionId,
19770
- (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
19771
- );
19772
- },
19773
- onAddItem: () => {
19774
- void requestAssetPick(postToParent2).then((picked) => {
19775
- if (!picked) return;
19776
- const item = { assetId: picked.assetId, alt: "Logo" };
19777
- void runMutation(
19778
- active.sectionId,
19779
- (tree) => addMediaStripItem(tree, item, active.index),
19780
- { [picked.assetId]: picked.url }
19781
- ).then((applied) => {
19782
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19783
- });
19784
- });
19785
- },
19786
- onChangeImage: () => {
19787
- void requestAssetPick(postToParent2).then((picked) => {
19788
- if (!picked) return;
19789
- void runMutation(
19790
- active.sectionId,
19791
- (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
19792
- { [picked.assetId]: picked.url }
19793
- );
20121
+ (tree) => addMediaStripItem(tree, item, active.index),
20122
+ { [picked.assetId]: picked.url }
20123
+ ).then((applied) => {
20124
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19794
20125
  });
19795
- },
19796
- onRemoveItem: () => {
19797
- void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
19798
- (applied) => {
19799
- if (applied) setActive(null);
19800
- }
19801
- );
19802
- },
19803
- onMoveLeft: () => {
19804
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
19805
- (applied) => {
19806
- if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
19807
- }
19808
- );
19809
- },
19810
- onMoveRight: () => {
19811
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
19812
- (applied) => {
19813
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19814
- }
20126
+ });
20127
+ },
20128
+ onChangeImage: () => {
20129
+ void requestAssetPick(postToParent2).then((picked) => {
20130
+ if (!picked) return;
20131
+ void runMutation(
20132
+ active.sectionId,
20133
+ (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
20134
+ { [picked.assetId]: picked.url }
19815
20135
  );
19816
- }
20136
+ });
20137
+ },
20138
+ onRemoveItem: () => {
20139
+ void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
20140
+ (applied) => {
20141
+ if (applied) setActive(null);
20142
+ }
20143
+ );
20144
+ },
20145
+ onMoveLeft: () => {
20146
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
20147
+ (applied) => {
20148
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
20149
+ }
20150
+ );
20151
+ },
20152
+ onMoveRight: () => {
20153
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
20154
+ (applied) => {
20155
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
20156
+ }
20157
+ );
19817
20158
  }
19818
- )
19819
- }
19820
- )
20159
+ }
20160
+ ) }),
20161
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20162
+ "div",
20163
+ {
20164
+ "data-ohw-bridge": "",
20165
+ "data-ohw-item-interaction": "",
20166
+ "aria-hidden": true,
20167
+ className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
20168
+ style: {
20169
+ top: activeItemRect.top + activeItemRect.height + 10,
20170
+ left: activeItemRect.left - 5,
20171
+ background: PRIMARY3,
20172
+ zIndex: 2147483644
20173
+ },
20174
+ children: "Media item"
20175
+ }
20176
+ ),
20177
+ linkOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20178
+ LinkModal,
20179
+ {
20180
+ href: activeHref,
20181
+ linkTarget: activeTarget,
20182
+ onClose: () => setLinkOpen(false),
20183
+ onSave: (href, linkTarget) => {
20184
+ void runMutation(
20185
+ active.sectionId,
20186
+ (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
20187
+ );
20188
+ }
20189
+ }
20190
+ )
20191
+ ] })
19821
20192
  ] });
19822
20193
  }
19823
20194
 
19824
20195
  // src/ui/ai-section/AiPricingCardOverlay.tsx
19825
20196
  var import_react14 = require("react");
19826
- var import_lucide_react9 = require("lucide-react");
19827
- var import_jsx_runtime21 = require("react/jsx-runtime");
20197
+ var import_lucide_react10 = require("lucide-react");
20198
+ var import_jsx_runtime22 = require("react/jsx-runtime");
19828
20199
  var PRIMARY4 = "var(--ohw-primary, #0885FE)";
19829
- var CHROME_SELECTOR = "[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review], [data-ohw-more-menu]";
20200
+ 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]";
19830
20201
  function findPricingCardElement(sectionId, index) {
19831
20202
  const sectionEl2 = findByInstanceId(sectionId);
19832
20203
  if (!sectionEl2) return null;
@@ -19838,7 +20209,7 @@ function findPricingCardElement(sectionId, index) {
19838
20209
  }
19839
20210
  function cardRefFromTarget(target) {
19840
20211
  if (!(target instanceof Element)) return null;
19841
- if (target.closest(CHROME_SELECTOR)) return null;
20212
+ if (target.closest(CHROME_SELECTOR2)) return null;
19842
20213
  const cardEl = target.closest("[data-ohw-pricing-card]");
19843
20214
  if (!cardEl) return null;
19844
20215
  const sectionEl2 = cardEl.closest("[data-ohw-section]");
@@ -19848,21 +20219,21 @@ function cardRefFromTarget(target) {
19848
20219
  if (!sectionId || Number.isNaN(index)) return null;
19849
20220
  return { sectionId, index };
19850
20221
  }
19851
- function sameRef(a, b) {
20222
+ function sameRef2(a, b) {
19852
20223
  return a?.sectionId === b?.sectionId && a?.index === b?.index;
19853
20224
  }
19854
- function rectOf(el) {
20225
+ function rectOf2(el) {
19855
20226
  if (!el) return null;
19856
20227
  const r2 = el.getBoundingClientRect();
19857
20228
  if (r2.width <= 0 || r2.height <= 0) return null;
19858
20229
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
19859
20230
  }
19860
20231
  function readRect3(ref) {
19861
- return rectOf(ref && findPricingCardElement(ref.sectionId, ref.index));
20232
+ return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
19862
20233
  }
19863
20234
  function readGridRect(ref) {
19864
20235
  const card = ref && findPricingCardElement(ref.sectionId, ref.index);
19865
- return rectOf(card?.closest("[data-ohw-pricing-collection]") ?? card);
20236
+ return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
19866
20237
  }
19867
20238
  function useLiveCardRect(ref, grid = false) {
19868
20239
  const [rect, setRect] = (0, import_react14.useState)(null);
@@ -19892,7 +20263,7 @@ function useLiveCardRect(ref, grid = false) {
19892
20263
  }
19893
20264
  var TOOLBAR_GRID_GAP = 52;
19894
20265
  var TOOLBAR_GRID_GAP_MOBILE = 42;
19895
- var TOOLBAR_EDGE_MARGIN2 = 4;
20266
+ var TOOLBAR_EDGE_MARGIN3 = 4;
19896
20267
  function GridToolbarSlot({ gridRect, children }) {
19897
20268
  const slotRef = (0, import_react14.useRef)(null);
19898
20269
  const [shift, setShift] = (0, import_react14.useState)(0);
@@ -19904,7 +20275,7 @@ function GridToolbarSlot({ gridRect, children }) {
19904
20275
  const w = slot.offsetWidth;
19905
20276
  if (w <= 0) return;
19906
20277
  const half = w / 2;
19907
- const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
20278
+ const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
19908
20279
  setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
19909
20280
  };
19910
20281
  clamp();
@@ -19913,7 +20284,7 @@ function GridToolbarSlot({ gridRect, children }) {
19913
20284
  return () => ro.disconnect();
19914
20285
  }, [centerX, children]);
19915
20286
  const mobile = window.innerWidth <= 480;
19916
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20287
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
19917
20288
  "div",
19918
20289
  {
19919
20290
  ref: slotRef,
@@ -19948,7 +20319,7 @@ function requestValidateTree2(postToParent2, tree) {
19948
20319
  });
19949
20320
  }
19950
20321
  function StyleSwatch({ style }) {
19951
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20322
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
19952
20323
  "span",
19953
20324
  {
19954
20325
  "aria-hidden": true,
@@ -19962,35 +20333,35 @@ function StyleSwatch({ style }) {
19962
20333
  );
19963
20334
  }
19964
20335
  function ButtonGlyph() {
19965
- 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: [
19966
- /* @__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" }),
19967
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
20336
+ 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: [
20337
+ /* @__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" }),
20338
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
19968
20339
  ] });
19969
20340
  }
19970
20341
  function FeatureGlyph({ mode }) {
19971
- 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: [
19972
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
19973
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
19974
- /* @__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" }),
19975
- /* @__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" }),
19976
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
19977
- mode === "add" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
20342
+ 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: [
20343
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
20344
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
20345
+ /* @__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" }),
20346
+ /* @__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" }),
20347
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
20348
+ mode === "add" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
19978
20349
  ] });
19979
20350
  }
19980
- function ToolbarAction({
20351
+ function ToolbarAction2({
19981
20352
  label,
19982
20353
  onClick,
19983
20354
  disabled = false,
19984
20355
  children
19985
20356
  }) {
19986
- const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
19987
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
19988
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: button }) : button }),
19989
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
20357
+ const button = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
20358
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
20359
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: button }) : button }),
20360
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
19990
20361
  ] });
19991
20362
  }
19992
- function ToolbarSeparator() {
19993
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
20363
+ function ToolbarSeparator2() {
20364
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
19994
20365
  }
19995
20366
  function CardStyleMenu({
19996
20367
  value,
@@ -19998,7 +20369,7 @@ function CardStyleMenu({
19998
20369
  disabled = false
19999
20370
  }) {
20000
20371
  const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
20001
- const trigger = /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20372
+ const trigger = /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
20002
20373
  "button",
20003
20374
  {
20004
20375
  type: "button",
@@ -20009,28 +20380,28 @@ function CardStyleMenu({
20009
20380
  disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
20010
20381
  ),
20011
20382
  children: [
20012
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StyleSwatch, { style: current.value }),
20013
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1 text-left", children: current.label }),
20014
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
20383
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: current.value }),
20384
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex-1 text-left", children: current.label }),
20385
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
20015
20386
  ]
20016
20387
  }
20017
20388
  );
20018
20389
  if (disabled) {
20019
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20020
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
20021
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
20022
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: trigger }) }),
20023
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
20390
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20391
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
20392
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
20393
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: trigger }) }),
20394
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
20024
20395
  ] })
20025
20396
  ] });
20026
20397
  }
20027
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20028
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
20029
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu, { modal: false, children: [
20030
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { asChild: true, children: trigger }),
20031
- /* @__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) => {
20398
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20399
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
20400
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenu, { modal: false, children: [
20401
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuTrigger, { asChild: true, children: trigger }),
20402
+ /* @__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) => {
20032
20403
  const selected = style.value === value;
20033
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20404
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
20034
20405
  DropdownMenuItem,
20035
20406
  {
20036
20407
  role: "menuitemradio",
@@ -20038,9 +20409,9 @@ function CardStyleMenu({
20038
20409
  onSelect: () => onChange(style.value),
20039
20410
  className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
20040
20411
  children: [
20041
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StyleSwatch, { style: style.value }),
20042
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: style.label }),
20043
- selected && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Check, { size: 16, className: "text-bridge-primary" })
20412
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: style.value }),
20413
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: style.label }),
20414
+ selected && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Check, { size: 16, className: "text-bridge-primary" })
20044
20415
  ]
20045
20416
  },
20046
20417
  style.value
@@ -20070,7 +20441,7 @@ function PricingCardToolbar({
20070
20441
  const style = pricingCardStyle(entry.tree, index);
20071
20442
  const featuredTag = pricingCardFeaturedTag(entry.tree, index);
20072
20443
  const mobile = window.innerWidth <= 480;
20073
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20444
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
20074
20445
  "div",
20075
20446
  {
20076
20447
  "data-ohw-bridge": "",
@@ -20082,7 +20453,7 @@ function PricingCardToolbar({
20082
20453
  ),
20083
20454
  style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
20084
20455
  children: [
20085
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20456
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
20086
20457
  "div",
20087
20458
  {
20088
20459
  className: cn(
@@ -20091,8 +20462,8 @@ function PricingCardToolbar({
20091
20462
  mobile ? "flex-wrap justify-center" : "flex-nowrap"
20092
20463
  ),
20093
20464
  children: [
20094
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
20095
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20465
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
20466
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20096
20467
  CustomToolbarButton,
20097
20468
  {
20098
20469
  type: "button",
@@ -20100,8 +20471,8 @@ function PricingCardToolbar({
20100
20471
  "aria-pressed": featuredTag,
20101
20472
  onClick: () => onSetFeaturedTag(!featuredTag),
20102
20473
  className: "group size-8",
20103
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20104
- import_lucide_react9.Star,
20474
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20475
+ import_lucide_react10.Star,
20105
20476
  {
20106
20477
  size: 16,
20107
20478
  fill: "currentColor",
@@ -20115,25 +20486,25 @@ function PricingCardToolbar({
20115
20486
  )
20116
20487
  }
20117
20488
  ) }),
20118
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
20489
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
20119
20490
  ] }),
20120
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
20121
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
20122
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
20123
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ButtonGlyph, {}) }),
20124
- /* @__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: [
20125
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ButtonGlyph, {}),
20126
- /* @__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" })
20491
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
20492
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
20493
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
20494
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}) }),
20495
+ /* @__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: [
20496
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}),
20497
+ /* @__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" })
20127
20498
  ] }) }),
20128
- /* @__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" }) }),
20129
- /* @__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" }) }),
20130
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
20131
- /* @__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" } }) }),
20132
- /* @__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" } }) })
20499
+ /* @__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" }) }),
20500
+ /* @__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" }) }),
20501
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
20502
+ /* @__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" } }) }),
20503
+ /* @__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" } }) })
20133
20504
  ]
20134
20505
  }
20135
20506
  ),
20136
- 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 })
20507
+ 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 })
20137
20508
  ]
20138
20509
  }
20139
20510
  ) });
@@ -20167,7 +20538,7 @@ function AiPricingCardOverlay({
20167
20538
  const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
20168
20539
  setHover((prev) => {
20169
20540
  const next = ref && !overEditable ? ref : null;
20170
- return sameRef(prev, next) ? prev : next;
20541
+ return sameRef2(prev, next) ? prev : next;
20171
20542
  });
20172
20543
  };
20173
20544
  const onLeave = () => setHover(null);
@@ -20182,10 +20553,10 @@ function AiPricingCardOverlay({
20182
20553
  const onClick = (e) => {
20183
20554
  const t = e.target;
20184
20555
  if (!(t instanceof Element)) return;
20185
- if (t.closest(CHROME_SELECTOR)) return;
20556
+ if (t.closest(CHROME_SELECTOR2)) return;
20186
20557
  const ref = cardRefFromTarget(t);
20187
- setActive((prev) => sameRef(prev, ref) ? prev : ref);
20188
- if (!ref || !sameRef(activeRef.current, ref)) setError(null);
20558
+ setActive((prev) => sameRef2(prev, ref) ? prev : ref);
20559
+ if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
20189
20560
  };
20190
20561
  document.addEventListener("click", onClick, true);
20191
20562
  return () => document.removeEventListener("click", onClick, true);
@@ -20250,12 +20621,12 @@ function AiPricingCardOverlay({
20250
20621
  const activeEntry = active ? findEntry(active.sectionId) : null;
20251
20622
  const activeCardRect = useLiveCardRect(active);
20252
20623
  const activeGridRect = useLiveCardRect(active, true);
20253
- const hoverRect = useLiveCardRect(hover && !sameRef(hover, active) ? hover : null);
20254
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
20255
- hoverRect && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20256
- activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
20257
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
20258
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20624
+ const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
20625
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
20626
+ hoverRect && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20627
+ activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
20628
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
20629
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20259
20630
  PricingCardToolbar,
20260
20631
  {
20261
20632
  entry: activeEntry,
@@ -20283,7 +20654,7 @@ function AiPricingCardOverlay({
20283
20654
  onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
20284
20655
  }
20285
20656
  ) }),
20286
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20657
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20287
20658
  "div",
20288
20659
  {
20289
20660
  "data-ohw-bridge": "",
@@ -20305,7 +20676,7 @@ function AiPricingCardOverlay({
20305
20676
 
20306
20677
  // src/ui/ai-section/AiVideoOverlay.tsx
20307
20678
  var import_react15 = require("react");
20308
- var import_lucide_react10 = require("lucide-react");
20679
+ var import_lucide_react11 = require("lucide-react");
20309
20680
 
20310
20681
  // src/lib/ai-video-tree.ts
20311
20682
  function resolveVideoBlock(tree, path) {
@@ -20347,39 +20718,11 @@ function clearVideo(tree, path) {
20347
20718
  });
20348
20719
  }
20349
20720
 
20350
- // src/lib/youtube.ts
20351
- var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
20352
- function extractYouTubeId(input) {
20353
- const trimmed = input.trim();
20354
- if (!trimmed) return null;
20355
- if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
20356
- let url;
20357
- try {
20358
- url = new URL(trimmed);
20359
- } catch {
20360
- return null;
20361
- }
20362
- const host = url.hostname.replace(/^www\./, "");
20363
- if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
20364
- return null;
20365
- }
20366
- let candidate = null;
20367
- if (host === "youtu.be") {
20368
- candidate = url.pathname.slice(1).split("/")[0] ?? null;
20369
- } else if (url.pathname === "/watch") {
20370
- candidate = url.searchParams.get("v");
20371
- } else {
20372
- const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
20373
- candidate = match ? match[1] : null;
20374
- }
20375
- return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
20376
- }
20377
-
20378
20721
  // src/ui/ai-section/AiVideoOverlay.tsx
20379
- var import_jsx_runtime22 = require("react/jsx-runtime");
20722
+ var import_jsx_runtime23 = require("react/jsx-runtime");
20380
20723
  var PRIMARY5 = "#0885FE";
20381
- var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY5})`;
20382
- var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20724
+ var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
20725
+ var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20383
20726
  function findVideoBlockElement(sectionId, path) {
20384
20727
  const sectionEl2 = findByInstanceId(sectionId);
20385
20728
  if (!sectionEl2) return null;
@@ -20439,12 +20782,12 @@ function requestValidateTree3(postToParent2, tree) {
20439
20782
  postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
20440
20783
  });
20441
20784
  }
20442
- function Pill2({
20785
+ function Pill({
20443
20786
  label,
20444
20787
  onClick,
20445
20788
  disabled
20446
20789
  }) {
20447
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20790
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20448
20791
  "button",
20449
20792
  {
20450
20793
  type: "button",
@@ -20460,7 +20803,7 @@ function Pill2({
20460
20803
  border: "none",
20461
20804
  cursor: disabled ? "default" : "pointer",
20462
20805
  background: "#ffffff",
20463
- color: OHW_BLUE_DARK2,
20806
+ color: OHW_BLUE_DARK,
20464
20807
  opacity: disabled ? 0.4 : 1,
20465
20808
  fontSize: 12,
20466
20809
  lineHeight: "16px",
@@ -20503,8 +20846,8 @@ function VideoUrlInput({ value, onCommit }) {
20503
20846
  onCommit(id);
20504
20847
  }
20505
20848
  };
20506
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
20507
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
20849
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
20850
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
20508
20851
  "div",
20509
20852
  {
20510
20853
  style: {
@@ -20520,12 +20863,12 @@ function VideoUrlInput({ value, onCommit }) {
20520
20863
  boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
20521
20864
  },
20522
20865
  children: [
20523
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20866
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20524
20867
  "span",
20525
20868
  {
20526
20869
  style: {
20527
20870
  flex: "0 0 auto",
20528
- color: OHW_BLUE_DARK2,
20871
+ color: OHW_BLUE_DARK,
20529
20872
  fontSize: 10,
20530
20873
  lineHeight: "16px",
20531
20874
  fontWeight: 700,
@@ -20535,7 +20878,7 @@ function VideoUrlInput({ value, onCommit }) {
20535
20878
  children: "Video"
20536
20879
  }
20537
20880
  ),
20538
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20881
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20539
20882
  "input",
20540
20883
  {
20541
20884
  type: "text",
@@ -20572,7 +20915,7 @@ function VideoUrlInput({ value, onCommit }) {
20572
20915
  ]
20573
20916
  }
20574
20917
  ),
20575
- 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." })
20918
+ 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." })
20576
20919
  ] });
20577
20920
  }
20578
20921
  function VideoToolbar({
@@ -20582,7 +20925,7 @@ function VideoToolbar({
20582
20925
  onSetVideoId,
20583
20926
  onRemove
20584
20927
  }) {
20585
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
20928
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
20586
20929
  "div",
20587
20930
  {
20588
20931
  "data-ohw-bridge": "",
@@ -20594,7 +20937,7 @@ function VideoToolbar({
20594
20937
  gap: 6,
20595
20938
  alignItems: "center",
20596
20939
  width: 280,
20597
- background: OHW_BLUE2,
20940
+ background: OHW_BLUE,
20598
20941
  padding: 8,
20599
20942
  borderRadius: 12,
20600
20943
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -20602,9 +20945,9 @@ function VideoToolbar({
20602
20945
  opacity: pending ? 0.6 : 1
20603
20946
  },
20604
20947
  children: [
20605
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
20606
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Pill2, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
20607
- error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20948
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
20949
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
20950
+ error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20608
20951
  ]
20609
20952
  }
20610
20953
  );
@@ -20724,8 +21067,8 @@ function AiVideoOverlay({
20724
21067
  const activeBlockRect = useLiveBlockRect(active);
20725
21068
  const TOOLBAR_APPROX_H = 90;
20726
21069
  const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
20727
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
20728
- hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
21070
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
21071
+ hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20729
21072
  "button",
20730
21073
  {
20731
21074
  type: "button",
@@ -20753,15 +21096,15 @@ function AiVideoOverlay({
20753
21096
  fontSize: 14,
20754
21097
  fontWeight: 700
20755
21098
  },
20756
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Star, { size: 14, style: { pointerEvents: "none" } })
21099
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Star, { size: 14, style: { pointerEvents: "none" } })
20757
21100
  }
20758
21101
  ),
20759
- activeBlockRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
21102
+ activeBlockRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20760
21103
  ItemInteractionLayer,
20761
21104
  {
20762
21105
  rect: activeBlockRect,
20763
21106
  state: toolbarState,
20764
- toolbar: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
21107
+ toolbar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20765
21108
  VideoToolbar,
20766
21109
  {
20767
21110
  videoId: videoIdAt(activeEntry.tree, active.path),
@@ -20785,7 +21128,7 @@ function AiVideoOverlay({
20785
21128
 
20786
21129
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
20787
21130
  var import_react16 = require("react");
20788
- var import_lucide_react11 = require("lucide-react");
21131
+ var import_lucide_react12 = require("lucide-react");
20789
21132
 
20790
21133
  // src/lib/ai-carousel-tree.ts
20791
21134
  function isCarouselBlock(node) {
@@ -20836,10 +21179,10 @@ function setCarouselAutoplay(tree, on) {
20836
21179
  }
20837
21180
 
20838
21181
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
20839
- var import_jsx_runtime23 = require("react/jsx-runtime");
21182
+ var import_jsx_runtime24 = require("react/jsx-runtime");
20840
21183
  var PRIMARY6 = "#0885FE";
20841
- var OHW_BLUE3 = `var(--ohw-primary, ${PRIMARY6})`;
20842
- var OHW_BLUE_DARK3 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
21184
+ var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
21185
+ var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
20843
21186
  function findCarouselItemElement(sectionId, index) {
20844
21187
  const sectionEl2 = findByInstanceId(sectionId);
20845
21188
  if (!sectionEl2) return null;
@@ -20918,8 +21261,8 @@ function requestAssetPick2(postToParent2) {
20918
21261
  postToParent2({ type: "ow:asset-pick", id });
20919
21262
  });
20920
21263
  }
20921
- function Pill3({ label, onClick, disabled }) {
20922
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21264
+ function Pill2({ label, onClick, disabled }) {
21265
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
20923
21266
  "button",
20924
21267
  {
20925
21268
  type: "button",
@@ -20935,7 +21278,7 @@ function Pill3({ label, onClick, disabled }) {
20935
21278
  border: "none",
20936
21279
  cursor: disabled ? "default" : "pointer",
20937
21280
  background: "#ffffff",
20938
- color: OHW_BLUE_DARK3,
21281
+ color: OHW_BLUE_DARK2,
20939
21282
  opacity: disabled ? 0.4 : 1,
20940
21283
  fontSize: 12,
20941
21284
  lineHeight: "16px",
@@ -20953,7 +21296,7 @@ function TogglePill({
20953
21296
  onToggle,
20954
21297
  disabled
20955
21298
  }) {
20956
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
21299
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
20957
21300
  "button",
20958
21301
  {
20959
21302
  type: "button",
@@ -20972,7 +21315,7 @@ function TogglePill({
20972
21315
  border: "none",
20973
21316
  cursor: disabled ? "default" : "pointer",
20974
21317
  background: "#ffffff",
20975
- color: OHW_BLUE_DARK3,
21318
+ color: OHW_BLUE_DARK2,
20976
21319
  opacity: disabled ? 0.4 : 1,
20977
21320
  fontSize: 12,
20978
21321
  lineHeight: "16px",
@@ -20982,7 +21325,7 @@ function TogglePill({
20982
21325
  },
20983
21326
  children: [
20984
21327
  label,
20985
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21328
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
20986
21329
  "span",
20987
21330
  {
20988
21331
  "aria-hidden": true,
@@ -20995,10 +21338,10 @@ function TogglePill({
20995
21338
  // Off is a grey track, not a washed-out blue: the pill's own white background already
20996
21339
  // carries the brand colour in the text, and a pale blue track next to it read as
20997
21340
  // "disabled control" rather than "switch that is off".
20998
- background: on ? OHW_BLUE_DARK3 : "#CBD5E1",
21341
+ background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
20999
21342
  transition: "background 120ms ease"
21000
21343
  },
21001
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21344
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21002
21345
  "span",
21003
21346
  {
21004
21347
  style: {
@@ -21027,7 +21370,7 @@ function CarouselSlideToolbar({
21027
21370
  onChangeImage,
21028
21371
  onToggleAutoplay
21029
21372
  }) {
21030
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
21373
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
21031
21374
  "div",
21032
21375
  {
21033
21376
  "data-ohw-bridge": "",
@@ -21038,7 +21381,7 @@ function CarouselSlideToolbar({
21038
21381
  flexDirection: "column",
21039
21382
  gap: 6,
21040
21383
  alignItems: "center",
21041
- background: OHW_BLUE3,
21384
+ background: OHW_BLUE2,
21042
21385
  padding: 8,
21043
21386
  borderRadius: 12,
21044
21387
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -21050,11 +21393,11 @@ function CarouselSlideToolbar({
21050
21393
  pointerEvents: pending ? "none" : "auto"
21051
21394
  },
21052
21395
  children: [
21053
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
21054
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pill3, { label: "Change Image", onClick: onChangeImage }),
21055
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
21396
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
21397
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Pill2, { label: "Change Image", onClick: onChangeImage }),
21398
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
21056
21399
  ] }),
21057
- error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
21400
+ error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
21058
21401
  ]
21059
21402
  }
21060
21403
  );
@@ -21194,8 +21537,8 @@ function AiFadeCarouselOverlay({
21194
21537
  const activeItemRect = useLiveItemRect2(active);
21195
21538
  const TOOLBAR_APPROX_H = 90;
21196
21539
  const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
21197
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
21198
- hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21540
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
21541
+ hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21199
21542
  "button",
21200
21543
  {
21201
21544
  type: "button",
@@ -21224,10 +21567,10 @@ function AiFadeCarouselOverlay({
21224
21567
  fontSize: 14,
21225
21568
  fontWeight: 700
21226
21569
  },
21227
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Star, { size: 14, style: { pointerEvents: "none" } })
21570
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Star, { size: 14, style: { pointerEvents: "none" } })
21228
21571
  }
21229
21572
  ),
21230
- swapping && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21573
+ swapping && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21231
21574
  "div",
21232
21575
  {
21233
21576
  ref: skeletonRef,
@@ -21245,15 +21588,15 @@ function AiFadeCarouselOverlay({
21245
21588
  zIndex: 2147483646,
21246
21589
  pointerEvents: "none"
21247
21590
  },
21248
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("style", { children: MEDIA_SKELETON_CSS })
21591
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("style", { children: MEDIA_SKELETON_CSS })
21249
21592
  }
21250
21593
  ),
21251
- activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21594
+ activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21252
21595
  ItemInteractionLayer,
21253
21596
  {
21254
21597
  rect: activeItemRect,
21255
21598
  state: toolbarState,
21256
- toolbar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21599
+ toolbar: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21257
21600
  CarouselSlideToolbar,
21258
21601
  {
21259
21602
  pending,
@@ -21444,113 +21787,6 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
21444
21787
  // src/ui/link-modal/LinkPopover.tsx
21445
21788
  var import_react20 = require("react");
21446
21789
 
21447
- // src/ui/dialog.tsx
21448
- var React9 = __toESM(require("react"), 1);
21449
- var import_radix_ui6 = require("radix-ui");
21450
- var import_lucide_react12 = require("lucide-react");
21451
- var import_jsx_runtime24 = require("react/jsx-runtime");
21452
- function Dialog2({
21453
- ...props
21454
- }) {
21455
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
21456
- }
21457
- function DialogPortal({
21458
- ...props
21459
- }) {
21460
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
21461
- }
21462
- function DialogOverlay({
21463
- className,
21464
- ...props
21465
- }) {
21466
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21467
- import_radix_ui6.Dialog.Overlay,
21468
- {
21469
- "data-slot": "dialog-overlay",
21470
- "data-ohw-link-modal-root": "",
21471
- className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
21472
- ...props
21473
- }
21474
- );
21475
- }
21476
- var DialogContent = React9.forwardRef(
21477
- ({ className, children, showCloseButton = true, container, ...props }, ref) => {
21478
- const positionMode = container ? "absolute" : "fixed";
21479
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(DialogPortal, { container: container ?? void 0, children: [
21480
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
21481
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
21482
- import_radix_ui6.Dialog.Content,
21483
- {
21484
- ref,
21485
- "data-slot": "dialog-content",
21486
- className: cn(
21487
- positionMode,
21488
- "left-1/2 top-1/2 z-[2147483647] flex w-full max-w-[448px] -translate-x-1/2 -translate-y-1/2 flex-col overflow-visible",
21489
- "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
21490
- container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
21491
- className
21492
- ),
21493
- onMouseDown: (e) => e.stopPropagation(),
21494
- ...props,
21495
- children: [
21496
- children,
21497
- showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21498
- import_radix_ui6.Dialog.Close,
21499
- {
21500
- type: "button",
21501
- className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
21502
- "aria-label": "Close",
21503
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.X, { size: 16, "aria-hidden": true })
21504
- }
21505
- ) : null
21506
- ]
21507
- }
21508
- )
21509
- ] });
21510
- }
21511
- );
21512
- DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
21513
- function DialogHeader({
21514
- className,
21515
- ...props
21516
- }) {
21517
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
21518
- }
21519
- function DialogFooter({
21520
- className,
21521
- ...props
21522
- }) {
21523
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21524
- "div",
21525
- {
21526
- className: cn("flex items-center justify-end gap-2", className),
21527
- ...props
21528
- }
21529
- );
21530
- }
21531
- var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21532
- import_radix_ui6.Dialog.Title,
21533
- {
21534
- ref,
21535
- className: cn(
21536
- "text-lg font-semibold leading-none tracking-tight text-card-foreground",
21537
- className
21538
- ),
21539
- ...props
21540
- }
21541
- ));
21542
- DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
21543
- var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21544
- import_radix_ui6.Dialog.Description,
21545
- {
21546
- ref,
21547
- className: cn("text-sm text-muted-foreground", className),
21548
- ...props
21549
- }
21550
- ));
21551
- DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
21552
- var DialogClose = import_radix_ui6.Dialog.Close;
21553
-
21554
21790
  // src/ui/link-modal/LinkEditorPanel.tsx
21555
21791
  var import_lucide_react16 = require("lucide-react");
21556
21792
 
@@ -22654,6 +22890,7 @@ function shouldUseDevFixtures() {
22654
22890
  function getLogoElement(el) {
22655
22891
  const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
22656
22892
  if (marked) return marked;
22893
+ if (el.closest('[data-ohw-editable="icon"]')) return null;
22657
22894
  const root = el.closest("nav, [data-ohw-nav-root], footer");
22658
22895
  if (!root) return null;
22659
22896
  const anchor = el.closest("a");
@@ -23990,12 +24227,19 @@ function useSectionDrag({
23990
24227
  clearSectionDragVisuals();
23991
24228
  return;
23992
24229
  }
24230
+ const previous = orderBeforeMove(editContentRef.current[SECTION_ORDER_KEY], window.location.pathname);
23993
24231
  const orderJson = JSON.stringify(
23994
24232
  mergePageSectionOrder(editContentRef.current[SECTION_ORDER_KEY], window.location.pathname, entries)
23995
24233
  );
23996
24234
  editContentRef.current = { ...editContentRef.current, [SECTION_ORDER_KEY]: orderJson };
23997
24235
  setAiSectionOrder(orderJson, window.location.pathname);
23998
- postToParentRef.current({ type: "ow:change", nodes: [{ key: SECTION_ORDER_KEY, text: orderJson }] });
24236
+ postToParentRef.current({
24237
+ type: "ow:change",
24238
+ nodes: [{ key: SECTION_ORDER_KEY, text: orderJson }],
24239
+ previous: { [SECTION_ORDER_KEY]: previous },
24240
+ // Undo scrolls to this section; a one-place move swaps two, so the order alone can't say which.
24241
+ moved: session.instanceId
24242
+ });
23999
24243
  applyPersistedOrder(getPageSectionOrderEntries(orderJson, window.location.pathname));
24000
24244
  clearSectionDragVisuals();
24001
24245
  requestAnimationFrame(() => {
@@ -25463,7 +25707,7 @@ function getNavigationSelectionParent(el) {
25463
25707
  if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
25464
25708
  return resolveFooterLinksContainerFrom(el);
25465
25709
  }
25466
- if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
25710
+ 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)) {
25467
25711
  return getNavigationRoot(el);
25468
25712
  }
25469
25713
  return null;
@@ -25685,7 +25929,6 @@ var ICONS = {
25685
25929
  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"/>',
25686
25930
  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"/>'
25687
25931
  };
25688
- var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
25689
25932
  var SELECTION_CHROME_GAP2 = 4;
25690
25933
  var TOOLBAR_STROKE_GAP2 = 4;
25691
25934
  var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
@@ -25783,7 +26026,7 @@ function applyVisibleViewport(el, parentScroll) {
25783
26026
  el.style.top = `${top}px`;
25784
26027
  el.style.height = `${height}px`;
25785
26028
  }
25786
- var TOOLBAR_EDGE_MARGIN3 = 4;
26029
+ var TOOLBAR_EDGE_MARGIN4 = 4;
25787
26030
  function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
25788
26031
  const isAbove = transform.includes("translateY(-100%)");
25789
26032
  let visualTop = isAbove ? top - approxH : top;
@@ -25810,8 +26053,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
25810
26053
  function clampToolbarLeft(centerX, toolbarWidth) {
25811
26054
  const half = toolbarWidth / 2;
25812
26055
  return Math.max(
25813
- TOOLBAR_EDGE_MARGIN3 + half,
25814
- Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half)
26056
+ TOOLBAR_EDGE_MARGIN4 + half,
26057
+ Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
25815
26058
  );
25816
26059
  }
25817
26060
  function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
@@ -26694,21 +26937,6 @@ function OhhwellsBridge() {
26694
26937
  const [isItemDragging, setIsItemDragging] = (0, import_react25.useState)(false);
26695
26938
  const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react25.useState)(false);
26696
26939
  isFooterFrameSelectionRef.current = isFooterFrameSelection;
26697
- const [floatingPanel, setFloatingPanel] = (0, import_react25.useState)(null);
26698
- const floatingPanelOpenRef = (0, import_react25.useRef)(false);
26699
- floatingPanelOpenRef.current = floatingPanel !== null;
26700
- const floatingPanelRef = (0, import_react25.useRef)(null);
26701
- floatingPanelRef.current = floatingPanel;
26702
- const [floatingPanelPos, setFloatingPanelPos] = (0, import_react25.useState)(null);
26703
- const buttonCollectionDragRef = (0, import_react25.useRef)(null);
26704
- const buttonDropInsertIndexRef = (0, import_react25.useRef)(null);
26705
- const [buttonDropSlots, setButtonDropSlots] = (0, import_react25.useState)([]);
26706
- const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react25.useState)(null);
26707
- const buttonPointerDragRef = (0, import_react25.useRef)(null);
26708
- const [buttonStyleTick, setButtonStyleTick] = (0, import_react25.useState)(0);
26709
- const [logoSizeDraft, setLogoSizeDraft] = (0, import_react25.useState)(null);
26710
- const [editorViewport, setEditorViewport] = (0, import_react25.useState)("desktop");
26711
- const [parentScrollSnap, setParentScrollSnap] = (0, import_react25.useState)(null);
26712
26940
  const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react25.useState)(null);
26713
26941
  const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react25.useState)(null);
26714
26942
  const footerDragRef = (0, import_react25.useRef)(null);
@@ -26735,6 +26963,21 @@ function OhhwellsBridge() {
26735
26963
  const stylesRef = (0, import_react25.useRef)("");
26736
26964
  const appliedDrawerRef = (0, import_react25.useRef)(null);
26737
26965
  const pendingDeleteUndoRef = (0, import_react25.useRef)(null);
26966
+ const [floatingPanel, setFloatingPanel] = (0, import_react25.useState)(null);
26967
+ const floatingPanelOpenRef = (0, import_react25.useRef)(false);
26968
+ const floatingPanelRef = (0, import_react25.useRef)(null);
26969
+ floatingPanelRef.current = floatingPanel;
26970
+ const setFloatingPanelRef = (0, import_react25.useRef)(setFloatingPanel);
26971
+ const [floatingPanelPos, setFloatingPanelPos] = (0, import_react25.useState)(null);
26972
+ const buttonCollectionDragRef = (0, import_react25.useRef)(null);
26973
+ const buttonDropInsertIndexRef = (0, import_react25.useRef)(null);
26974
+ const [buttonDropSlots, setButtonDropSlots] = (0, import_react25.useState)([]);
26975
+ const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react25.useState)(null);
26976
+ const buttonPointerDragRef = (0, import_react25.useRef)(null);
26977
+ const [buttonStyleTick, setButtonStyleTick] = (0, import_react25.useState)(0);
26978
+ const [logoSizeDraft, setLogoSizeDraft] = (0, import_react25.useState)(null);
26979
+ const [editorViewport, setEditorViewport] = (0, import_react25.useState)("desktop");
26980
+ const [parentScrollSnap, setParentScrollSnap] = (0, import_react25.useState)(null);
26738
26981
  const [sitePages, setSitePages] = (0, import_react25.useState)([]);
26739
26982
  const collectionItemsRef = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
26740
26983
  const [sectionsByPath, setSectionsByPath] = (0, import_react25.useState)({});
@@ -26744,7 +26987,18 @@ function OhhwellsBridge() {
26744
26987
  const linkPopoverOpenRef = (0, import_react25.useRef)(false);
26745
26988
  const linkPopoverGraceUntilRef = (0, import_react25.useRef)(0);
26746
26989
  setLinkPopoverRef.current = setLinkPopover;
26990
+ setFloatingPanelRef.current = setFloatingPanel;
26747
26991
  linkPopoverSessionRef.current = linkPopover;
26992
+ floatingPanelOpenRef.current = Boolean(floatingPanel);
26993
+ (0, import_react25.useEffect)(() => {
26994
+ const syncViewport = () => {
26995
+ const next = window.innerWidth <= 480 ? "mobile" : "desktop";
26996
+ setEditorViewport((prev) => prev === next ? prev : next);
26997
+ };
26998
+ syncViewport();
26999
+ window.addEventListener("resize", syncViewport);
27000
+ return () => window.removeEventListener("resize", syncViewport);
27001
+ }, []);
26748
27002
  (0, import_react25.useEffect)(() => {
26749
27003
  setSectionOrderPersistHandler((entries) => {
26750
27004
  const currentPath = window.location.pathname;
@@ -28478,6 +28732,7 @@ function OhhwellsBridge() {
28478
28732
  applyAiFooterFromContent(content);
28479
28733
  if (typeof content[STYLE_STORE_KEY] === "string") {
28480
28734
  stylesRef.current = content[STYLE_STORE_KEY];
28735
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28481
28736
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28482
28737
  }
28483
28738
  applyBrandChrome(content);
@@ -28488,15 +28743,16 @@ function OhhwellsBridge() {
28488
28743
  if (key === "__ohw_sections") continue;
28489
28744
  if (key === AI_SECTIONS_KEY) continue;
28490
28745
  if (key === AI_FOOTER_KEY) continue;
28746
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
28747
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28491
28748
  if (key === BRAND_KIT_KEY) continue;
28492
28749
  if (key === STYLE_STORE_KEY) continue;
28493
28750
  if (BRAND_CHROME_KEYS.has(key)) continue;
28494
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28495
28751
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
28496
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28497
28752
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28498
28753
  continue;
28499
28754
  }
28755
+ if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28500
28756
  if (applyVideoSettingNode(key, val)) continue;
28501
28757
  if (applyCarouselNode(key, val)) continue;
28502
28758
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28536,6 +28792,7 @@ function OhhwellsBridge() {
28536
28792
  });
28537
28793
  applyLinkByKey(key, val);
28538
28794
  }
28795
+ applySectionEmbeds(content);
28539
28796
  applyLogoFromContent(content);
28540
28797
  applyLogoSizes(content);
28541
28798
  reconcileNavbarItemsFromContent(content);
@@ -28724,20 +28981,22 @@ function OhhwellsBridge() {
28724
28981
  }
28725
28982
  applyAiFooterFromContent(content);
28726
28983
  if (typeof content[STYLE_STORE_KEY] === "string") {
28984
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28727
28985
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28728
28986
  }
28729
28987
  for (const [key, val] of Object.entries(content)) {
28730
28988
  if (key === "__ohw_sections") continue;
28731
28989
  if (key === AI_SECTIONS_KEY) continue;
28732
28990
  if (key === AI_FOOTER_KEY) continue;
28991
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
28992
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28733
28993
  if (key === BRAND_KIT_KEY) continue;
28734
28994
  if (key === STYLE_STORE_KEY) continue;
28735
28995
  if (BRAND_CHROME_KEYS.has(key)) continue;
28736
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28737
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28738
28996
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28739
28997
  continue;
28740
28998
  }
28999
+ if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28741
29000
  if (applyVideoSettingNode(key, val)) continue;
28742
29001
  if (applyCarouselNode(key, val)) continue;
28743
29002
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28762,6 +29021,7 @@ function OhhwellsBridge() {
28762
29021
  });
28763
29022
  applyLinkByKey(key, val);
28764
29023
  }
29024
+ applySectionEmbeds(content);
28765
29025
  applyLogoFromContent(content);
28766
29026
  reconcileNavbarItemsFromContent(content);
28767
29027
  reconcileFooterOrderFromContent(content);
@@ -29001,26 +29261,11 @@ function OhhwellsBridge() {
29001
29261
  const t2 = setTimeout(measure, 500);
29002
29262
  const ro = new ResizeObserver(schedule);
29003
29263
  ro.observe(document.body);
29004
- let lastWidth = window.innerWidth;
29005
- let resizeTimers = [];
29006
- const clearResizeTimers = () => {
29007
- resizeTimers.forEach(clearTimeout);
29008
- resizeTimers = [];
29009
- };
29010
- const handleResize = () => {
29011
- if (window.innerWidth === lastWidth) return;
29012
- lastWidth = window.innerWidth;
29013
- clearResizeTimers();
29014
- resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
29015
- };
29016
- window.addEventListener("resize", handleResize);
29017
29264
  return () => {
29018
29265
  clearTimeout(t1);
29019
29266
  clearTimeout(t2);
29020
29267
  if (raf != null) cancelAnimationFrame(raf);
29021
29268
  ro.disconnect();
29022
- clearResizeTimers();
29023
- window.removeEventListener("resize", handleResize);
29024
29269
  };
29025
29270
  }, [pathname, isEditMode, postToParent2]);
29026
29271
  (0, import_react25.useEffect)(() => {
@@ -29317,6 +29562,13 @@ function OhhwellsBridge() {
29317
29562
  if (target.closest("[data-ohw-state-toggle]")) return;
29318
29563
  if (target.closest("[data-ohw-max-badge]")) return;
29319
29564
  if (isInsideLinkEditor(target)) return;
29565
+ if (isInsideFloatingPanel(target)) return;
29566
+ if (target.closest("[data-ohw-form-toolbar]")) return;
29567
+ if (target.closest(
29568
+ '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
29569
+ )) {
29570
+ return;
29571
+ }
29320
29572
  if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
29321
29573
  clearMediaSelectionRef.current();
29322
29574
  }
@@ -29340,8 +29592,6 @@ function OhhwellsBridge() {
29340
29592
  return;
29341
29593
  }
29342
29594
  }
29343
- if (isInsideFloatingPanel(target)) return;
29344
- if (target.closest("[data-ohw-form-toolbar]")) return;
29345
29595
  const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
29346
29596
  if (collectionItem) {
29347
29597
  e.preventDefault();
@@ -29353,11 +29603,6 @@ function OhhwellsBridge() {
29353
29603
  });
29354
29604
  return;
29355
29605
  }
29356
- if (target.closest(
29357
- '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
29358
- )) {
29359
- return;
29360
- }
29361
29606
  {
29362
29607
  const formEl = getFormElement(target);
29363
29608
  const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
@@ -29511,9 +29756,13 @@ function OhhwellsBridge() {
29511
29756
  if (isIconEditable(editable) && !getSocialItem(editable)) {
29512
29757
  e.preventDefault();
29513
29758
  e.stopPropagation();
29514
- selectIconElementRef.current(editable);
29515
29759
  const aiIcon = editable.hasAttribute("data-ai-icon");
29516
29760
  const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
29761
+ if (aiIcon) {
29762
+ aiSectionApiRef.current?.selectFromElement(editable);
29763
+ } else {
29764
+ selectIconElementRef.current(editable);
29765
+ }
29517
29766
  postToParentRef.current({
29518
29767
  type: "ow:icon-pick",
29519
29768
  key: editable.dataset.ohwKey ?? "",
@@ -29741,6 +29990,9 @@ function OhhwellsBridge() {
29741
29990
  setHoveredItemRect(null);
29742
29991
  hoveredNavContainerRef.current = null;
29743
29992
  setHoveredNavContainerRect(null);
29993
+ siblingHintElRef.current = null;
29994
+ setSiblingHintRect(null);
29995
+ setSiblingHintRects([]);
29744
29996
  return;
29745
29997
  }
29746
29998
  {
@@ -29861,7 +30113,6 @@ function OhhwellsBridge() {
29861
30113
  hoveredNavContainerRef.current = null;
29862
30114
  setHoveredNavContainerRect(null);
29863
30115
  hoveredItemElRef.current = editable;
29864
- setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
29865
30116
  }
29866
30117
  }
29867
30118
  }
@@ -30571,7 +30822,11 @@ function OhhwellsBridge() {
30571
30822
  };
30572
30823
  const handleMouseMove = (e) => {
30573
30824
  const { clientX, clientY } = e;
30574
- if (pointOwnedByFloatingPanel(clientX, clientY)) return;
30825
+ if (pointOwnedByFloatingPanel(clientX, clientY)) {
30826
+ dismissImageHover();
30827
+ clearImageHover();
30828
+ return;
30829
+ }
30575
30830
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
30576
30831
  document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
30577
30832
  formHoverElRef.current = null;
@@ -30600,7 +30855,12 @@ function OhhwellsBridge() {
30600
30855
  setHoveredItemRect(null);
30601
30856
  hoveredNavContainerRef.current = null;
30602
30857
  setHoveredNavContainerRect(null);
30858
+ siblingHintElRef.current = null;
30859
+ setSiblingHintRect(null);
30860
+ setSiblingHintRects([]);
30603
30861
  dismissImageHover();
30862
+ clearImageHover();
30863
+ setSectionGap(null);
30604
30864
  return;
30605
30865
  }
30606
30866
  if (probeSocialsRowAt(clientX, clientY)) return;
@@ -30612,7 +30872,11 @@ function OhhwellsBridge() {
30612
30872
  if (e.data?.type !== "ow:pointer-sync") return;
30613
30873
  const { clientX, clientY } = e.data;
30614
30874
  if (typeof clientX !== "number" || typeof clientY !== "number") return;
30615
- if (pointOwnedByFloatingPanel(clientX, clientY)) return;
30875
+ if (pointOwnedByFloatingPanel(clientX, clientY)) {
30876
+ dismissImageHover();
30877
+ clearImageHover();
30878
+ return;
30879
+ }
30616
30880
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
30617
30881
  if (probeSocialsRowAt(clientX, clientY)) return;
30618
30882
  probeSectionGapAt(clientX, clientY);
@@ -30992,6 +31256,7 @@ function OhhwellsBridge() {
30992
31256
  applyAiFooterFromContent(content);
30993
31257
  if (typeof content[STYLE_STORE_KEY] === "string") {
30994
31258
  stylesRef.current = content[STYLE_STORE_KEY];
31259
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
30995
31260
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
30996
31261
  }
30997
31262
  applyBrandChrome(content);
@@ -31006,15 +31271,16 @@ function OhhwellsBridge() {
31006
31271
  }
31007
31272
  if (key === AI_SECTIONS_KEY) continue;
31008
31273
  if (key === AI_FOOTER_KEY) continue;
31274
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
31275
+ if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
31009
31276
  if (key === BRAND_KIT_KEY) continue;
31010
31277
  if (key === STYLE_STORE_KEY) continue;
31011
31278
  if (BRAND_CHROME_KEYS.has(key)) continue;
31012
- if (key === LOGO_PLACEHOLDER_KEY) continue;
31013
31279
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
31014
- if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
31015
31280
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
31016
31281
  continue;
31017
31282
  }
31283
+ if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
31018
31284
  if (applyVideoSettingNode(key, val)) continue;
31019
31285
  if (applyCarouselNode(key, val)) continue;
31020
31286
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -31040,6 +31306,7 @@ function OhhwellsBridge() {
31040
31306
  });
31041
31307
  applyLinkByKey(key, val);
31042
31308
  }
31309
+ applySectionEmbeds(content);
31043
31310
  applyLogoFromContent(content);
31044
31311
  applyLogoSizes(content);
31045
31312
  document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
@@ -31485,6 +31752,7 @@ function OhhwellsBridge() {
31485
31752
  const instanceId = typeof e.data.instanceId === "string" ? e.data.instanceId : "";
31486
31753
  const direction = e.data.direction === "up" || e.data.direction === "down" ? e.data.direction : null;
31487
31754
  if (!instanceId || !direction) return;
31755
+ const previous = orderBeforeMove(editContentRef.current[SECTION_ORDER_KEY], window.location.pathname);
31488
31756
  const entries = moveSectionInstance(instanceId, direction, window.location.pathname);
31489
31757
  if (!entries) return;
31490
31758
  const orderJson = JSON.stringify(
@@ -31493,7 +31761,12 @@ function OhhwellsBridge() {
31493
31761
  editContentRef.current = { ...editContentRef.current, [SECTION_ORDER_KEY]: orderJson };
31494
31762
  applyPersistedOrder(getPageSectionOrderEntries(orderJson, window.location.pathname));
31495
31763
  setAiSectionOrder(orderJson, window.location.pathname);
31496
- postToParentRef.current({ type: "ow:change", nodes: [{ key: SECTION_ORDER_KEY, text: orderJson }] });
31764
+ postToParentRef.current({
31765
+ type: "ow:change",
31766
+ nodes: [{ key: SECTION_ORDER_KEY, text: orderJson }],
31767
+ previous: { [SECTION_ORDER_KEY]: previous },
31768
+ moved: instanceId
31769
+ });
31497
31770
  window.dispatchEvent(new Event("resize"));
31498
31771
  };
31499
31772
  window.addEventListener("message", handleMoveSection);
@@ -31672,6 +31945,12 @@ function OhhwellsBridge() {
31672
31945
  closeLinkPopoverRef.current();
31673
31946
  return;
31674
31947
  }
31948
+ if (floatingPanelOpenRef.current) {
31949
+ setFloatingPanelRef.current(null);
31950
+ deselectRef.current();
31951
+ deactivateRef.current();
31952
+ return;
31953
+ }
31675
31954
  deselectRef.current();
31676
31955
  deactivateRef.current();
31677
31956
  clearMediaSelectionRef.current();
@@ -31856,12 +32135,6 @@ function OhhwellsBridge() {
31856
32135
  return;
31857
32136
  }
31858
32137
  }
31859
- if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "z" && !activeElRef.current) {
31860
- if (runPendingDeleteUndoRef.current()) {
31861
- e.preventDefault();
31862
- return;
31863
- }
31864
- }
31865
32138
  if (e.key !== "Escape") return;
31866
32139
  const el = activeElRef.current;
31867
32140
  if (el && originalContentRef.current !== null) {
@@ -32508,10 +32781,10 @@ function OhhwellsBridge() {
32508
32781
  window.removeEventListener("message", handleDuplicateSection);
32509
32782
  window.removeEventListener("message", handleDeactivate);
32510
32783
  window.removeEventListener("message", handleSelectNav);
32511
- document.documentElement.removeAttribute("data-ohw-panel-dragging");
32512
32784
  window.removeEventListener("message", handleToastAction);
32513
32785
  window.removeEventListener("message", handleFormCount);
32514
32786
  window.removeEventListener("message", handleUiEscape);
32787
+ document.documentElement.removeAttribute("data-ohw-panel-dragging");
32515
32788
  autoSaveTimers.current.forEach(clearTimeout);
32516
32789
  autoSaveTimers.current.clear();
32517
32790
  if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
@@ -32805,7 +33078,7 @@ function OhhwellsBridge() {
32805
33078
  postToParent2({
32806
33079
  type: "ow:ready",
32807
33080
  version: "1",
32808
- bridgeVersion: "0.1.168",
33081
+ bridgeVersion: "0.1.169-next.448",
32809
33082
  path: pathname,
32810
33083
  nodes: collectEditableNodes(editContentRef.current),
32811
33084
  sections