@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.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  // src/OhhwellsBridge.tsx
4
- import React12, { useCallback as useCallback12, useEffect as useEffect21, useLayoutEffect as useLayoutEffect6, useRef as useRef14, useState as useState18 } from "react";
4
+ import React12, { useCallback as useCallback12, useEffect as useEffect21, useLayoutEffect as useLayoutEffect7, useRef as useRef14, useState as useState18 } from "react";
5
5
  import { createRoot as createRoot3 } from "react-dom/client";
6
6
  import { flushSync as flushSync3 } from "react-dom";
7
7
 
@@ -189,6 +189,19 @@ function parseSectionsFromHtml(html) {
189
189
  return parseSectionsFromRoot(doc);
190
190
  }
191
191
 
192
+ // src/lib/soft-hide.ts
193
+ var PREV_DISPLAY_ATTR = "data-ohw-prev-display";
194
+ function softHide(el) {
195
+ if (!el.hasAttribute(PREV_DISPLAY_ATTR)) el.setAttribute(PREV_DISPLAY_ATTR, el.style.display);
196
+ el.style.display = "none";
197
+ }
198
+ function softUnhide(el) {
199
+ const prev = el.getAttribute(PREV_DISPLAY_ATTR);
200
+ el.removeAttribute(PREV_DISPLAY_ATTR);
201
+ if (prev) el.style.display = prev;
202
+ else el.style.removeProperty("display");
203
+ }
204
+
192
205
  // src/lib/section-instances.ts
193
206
  var SECTION_ORDER_KEY = "__ohw_section_order";
194
207
  var REMOVED_ATTR = "data-ohw-section-removed";
@@ -260,14 +273,14 @@ function syncRemovedFlags(entries) {
260
273
  const removedIds = new Set(entries.filter((e) => e.removed).map((e) => e.instanceId));
261
274
  document.querySelectorAll(`[${REMOVED_ATTR}]`).forEach((el) => {
262
275
  if (!removedIds.has(instanceIdOf(el))) {
263
- el.style.removeProperty("display");
276
+ softUnhide(el);
264
277
  el.removeAttribute(REMOVED_ATTR);
265
278
  }
266
279
  });
267
280
  for (const id of removedIds) {
268
281
  const el = findByInstanceId(id);
269
282
  if (el) {
270
- el.style.display = "none";
283
+ softHide(el);
271
284
  el.setAttribute(REMOVED_ATTR, "");
272
285
  }
273
286
  }
@@ -339,6 +352,15 @@ function duplicateSectionInstance(instanceId, newId, currentPath, existingEntrie
339
352
  function newInstanceId() {
340
353
  return typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `instance-${Date.now()}-${Math.random().toString(36).slice(2)}`;
341
354
  }
355
+ function orderBeforeMove(raw, currentPath) {
356
+ const entries = topLevelSections().map((el, order) => ({
357
+ instanceId: instanceIdOf(el),
358
+ type: sectionTypeOf(el),
359
+ order,
360
+ pagePath: currentPath
361
+ }));
362
+ return JSON.stringify(mergePageSectionOrder(raw, currentPath, entries));
363
+ }
342
364
  function getPageSectionOrderEntries(raw, currentPath) {
343
365
  if (!raw) return [];
344
366
  try {
@@ -1098,21 +1120,21 @@ function chromeFrom(sample) {
1098
1120
  };
1099
1121
  }
1100
1122
  function filledPrimary(seed) {
1101
- const paint = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
1102
- const luminance = relativeLuminance(paint);
1123
+ const paint2 = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
1124
+ const luminance = relativeLuminance(paint2);
1103
1125
  return {
1104
- background: toCss({ ...paint, a: 1 }),
1126
+ background: toCss({ ...paint2, a: 1 }),
1105
1127
  color: luminance > 0.55 ? "rgb(15, 15, 15)" : "rgb(255, 255, 255)",
1106
1128
  borderColor: TRANSPARENT,
1107
1129
  borderWidth: "0px"
1108
1130
  };
1109
1131
  }
1110
1132
  function generatedSecondary(primary) {
1111
- const paint = accentColor(primary);
1133
+ const paint2 = accentColor(primary);
1112
1134
  return {
1113
1135
  background: TRANSPARENT,
1114
- color: paint,
1115
- borderColor: paint,
1136
+ color: paint2,
1137
+ borderColor: paint2,
1116
1138
  borderWidth: "1px"
1117
1139
  };
1118
1140
  }
@@ -1125,9 +1147,9 @@ function generatedGhost(primary) {
1125
1147
  };
1126
1148
  }
1127
1149
  function normalizeOutlineChrome(outline, primary) {
1128
- const paint = accentColor(primary);
1150
+ const paint2 = accentColor(primary);
1129
1151
  const text = parseColor(outline.color);
1130
- const paintRgb = parseColor(paint);
1152
+ const paintRgb = parseColor(paint2);
1131
1153
  const primaryLabel = parseColor(primary.color);
1132
1154
  const matchesOnPrimary = Boolean(text && primaryLabel) && colorKey(outline.color) === colorKey(primary.color);
1133
1155
  const textTooLight = text ? relativeLuminance(text) > 0.7 : false;
@@ -1136,8 +1158,8 @@ function normalizeOutlineChrome(outline, primary) {
1136
1158
  const hasBorder = parseFloat(outline.borderWidth) > 0;
1137
1159
  return {
1138
1160
  ...outline,
1139
- color: paint,
1140
- borderColor: hasBorder ? paint : outline.borderColor
1161
+ color: paint2,
1162
+ borderColor: hasBorder ? paint2 : outline.borderColor
1141
1163
  };
1142
1164
  }
1143
1165
  function generateButtonVariants(samples) {
@@ -5665,10 +5687,10 @@ function rekeyItemClone(clone, source, sibling, group, newIndex) {
5665
5687
  function setRemoved(el, removed) {
5666
5688
  if (removed) {
5667
5689
  el.setAttribute(ITEM_REMOVED_ATTR, "");
5668
- el.style.display = "none";
5690
+ softHide(el);
5669
5691
  } else if (el.hasAttribute(ITEM_REMOVED_ATTR)) {
5670
5692
  el.removeAttribute(ITEM_REMOVED_ATTR);
5671
- el.style.removeProperty("display");
5693
+ softUnhide(el);
5672
5694
  }
5673
5695
  }
5674
5696
  function seedState(group) {
@@ -6678,6 +6700,21 @@ function pricingCardFeatureCount(tree, index) {
6678
6700
  const target = findPricingCollection(tree)?.children?.[index];
6679
6701
  return target ? pricingFeatureList(target).length : 0;
6680
6702
  }
6703
+ function prevailingFeatureIcon(features) {
6704
+ const counts = /* @__PURE__ */ new Map();
6705
+ for (const row of features) {
6706
+ const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
6707
+ const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
6708
+ entry.count += 1;
6709
+ counts.set(key, entry);
6710
+ }
6711
+ let best = null;
6712
+ for (const entry of counts.values()) {
6713
+ if (!best || entry.count > best.count) best = entry;
6714
+ }
6715
+ if (!best) return {};
6716
+ return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
6717
+ }
6681
6718
  function addPricingCardFeature(tree, index, text) {
6682
6719
  return withPricingCollection(tree, (collection) => {
6683
6720
  const children = collection.children;
@@ -6686,7 +6723,7 @@ function addPricingCardFeature(tree, index, text) {
6686
6723
  const features = pricingFeatureList(target);
6687
6724
  if (features.length >= PRICING_FEATURES_MAX) return false;
6688
6725
  target.slots = target.slots ?? {};
6689
- target.slots.features = [...features, { text }];
6726
+ target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
6690
6727
  return true;
6691
6728
  });
6692
6729
  }
@@ -7330,6 +7367,120 @@ function findSelectableNavContainer(doc = document) {
7330
7367
  );
7331
7368
  }
7332
7369
 
7370
+ // src/lib/youtube.ts
7371
+ var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
7372
+ function extractYouTubeId(input) {
7373
+ const trimmed = input.trim();
7374
+ if (!trimmed) return null;
7375
+ if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
7376
+ let url;
7377
+ try {
7378
+ url = new URL(trimmed);
7379
+ } catch {
7380
+ return null;
7381
+ }
7382
+ const host = url.hostname.replace(/^www\./, "");
7383
+ if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
7384
+ return null;
7385
+ }
7386
+ let candidate = null;
7387
+ if (host === "youtu.be") {
7388
+ candidate = url.pathname.slice(1).split("/")[0] ?? null;
7389
+ } else if (url.pathname === "/watch") {
7390
+ candidate = url.searchParams.get("v");
7391
+ } else {
7392
+ const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
7393
+ candidate = match ? match[1] : null;
7394
+ }
7395
+ return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
7396
+ }
7397
+
7398
+ // src/lib/section-embed.ts
7399
+ var SECTION_EMBED_SUFFIX = "__ohw_embed";
7400
+ function readStoredEmbed(value) {
7401
+ if (value.startsWith("start\n")) {
7402
+ return { raw: value.slice("start\n".length), at: "start" };
7403
+ }
7404
+ return { raw: value, at: "end" };
7405
+ }
7406
+ function embedFrameSrc(value) {
7407
+ const videoId = extractYouTubeId(value);
7408
+ if (videoId) {
7409
+ return { src: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0`, title: "YouTube video" };
7410
+ }
7411
+ let url;
7412
+ try {
7413
+ url = new URL(value);
7414
+ } catch {
7415
+ return null;
7416
+ }
7417
+ const host = url.hostname.replace(/^www\./, "").toLowerCase();
7418
+ if (host === "google.com" && url.pathname.startsWith("/maps") || host === "maps.google.com") {
7419
+ const query = url.searchParams.get("q") || url.searchParams.get("query") || "";
7420
+ const src = query ? `https://maps.google.com/maps?q=${encodeURIComponent(query)}&output=embed` : `https://maps.google.com/maps?output=embed`;
7421
+ return { src, title: "Map" };
7422
+ }
7423
+ if (host === "maps.app.goo.gl") {
7424
+ return { src: value, title: "Map" };
7425
+ }
7426
+ if (host === "calendly.com" || host.endsWith(".calendly.com") || host === "calendar.google.com") {
7427
+ return { src: value, title: "Calendar" };
7428
+ }
7429
+ if (host === "docs.google.com" && url.pathname.includes("/forms/")) {
7430
+ return { src: value.replace(/\/edit(?:\?.*)?$/i, "/viewform"), title: "Form" };
7431
+ }
7432
+ if (host === "forms.gle") {
7433
+ return { src: value, title: "Form" };
7434
+ }
7435
+ return null;
7436
+ }
7437
+ function place(section, box, at) {
7438
+ if (at === "start") {
7439
+ section.insertBefore(box, section.firstChild);
7440
+ return;
7441
+ }
7442
+ section.appendChild(box);
7443
+ }
7444
+ function paint(section, key, src, title, at) {
7445
+ const existing = section.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`);
7446
+ const frame = existing?.querySelector("iframe");
7447
+ if (existing && frame) {
7448
+ if (frame.getAttribute("src") !== src) frame.setAttribute("src", src);
7449
+ frame.title = title;
7450
+ place(section, existing, at);
7451
+ return;
7452
+ }
7453
+ existing?.remove();
7454
+ const box = document.createElement("div");
7455
+ box.setAttribute("data-ohw-section-embed", key);
7456
+ 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;";
7457
+ const frameWrap = document.createElement("div");
7458
+ frameWrap.style.cssText = "position:relative;width:100%;aspect-ratio:16/9;min-height:250px;border-radius:12px;overflow:hidden;background:#0f172a;";
7459
+ const iframe = document.createElement("iframe");
7460
+ iframe.src = src;
7461
+ iframe.title = title;
7462
+ iframe.style.cssText = "position:absolute;inset:0;width:100%;height:100%;border:0;";
7463
+ iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture";
7464
+ iframe.setAttribute("allowfullscreen", "");
7465
+ frameWrap.appendChild(iframe);
7466
+ box.appendChild(frameWrap);
7467
+ place(section, box, at);
7468
+ }
7469
+ function applySectionEmbeds(content) {
7470
+ for (const [key, val] of Object.entries(content)) {
7471
+ if (!key.endsWith(SECTION_EMBED_SUFFIX)) continue;
7472
+ const sectionId = key.slice(0, -SECTION_EMBED_SUFFIX.length);
7473
+ const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
7474
+ const stored = typeof val === "string" ? readStoredEmbed(val) : null;
7475
+ const frame = stored ? embedFrameSrc(stored.raw) : null;
7476
+ if (!section || !stored || !frame) {
7477
+ section?.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`)?.remove();
7478
+ continue;
7479
+ }
7480
+ paint(section, key, frame.src, frame.title, stored.at);
7481
+ }
7482
+ }
7483
+
7333
7484
  // src/ui/ai-tree/aiSectionsManager.tsx
7334
7485
  import { flushSync } from "react-dom";
7335
7486
  import { createRoot } from "react-dom/client";
@@ -7903,7 +8054,7 @@ var AI_MOBILE_CSS = [
7903
8054
  // page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
7904
8055
  // template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
7905
8056
  // an exact figure from (no live measurement exists), so this is a safe approximation, not a
7906
- // pixel-exact fit. Horizontal spacing already comes from `data-ai-container`.
8057
+ // pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
7907
8058
  '[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
7908
8059
  // A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
7909
8060
  // window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
@@ -7919,8 +8070,10 @@ var AI_MOBILE_CSS = [
7919
8070
  "[data-ai-section]{overflow-x:hidden}",
7920
8071
  // `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
7921
8072
  // full-bleed section's container sets, so a carousel/media hero that is edge-to-edge on desktop
7922
- // still got a 20px band of section background down both sides on a phone.
7923
- "[data-ai-container]:not([data-ai-full-bleed]){padding:0 20px !important}",
8073
+ // still got a 20px band of section background down both sides on a phone. The footer's own
8074
+ // container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
8075
+ "[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
8076
+ "[data-ai-container]{padding:0 20px !important}",
7924
8077
  "[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
7925
8078
  "[data-ai-cell]{width:100%;min-width:0}",
7926
8079
  // The rule above turns every row into a COLUMN flex container on phones, which silently breaks
@@ -8125,6 +8278,31 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
8125
8278
  function textAttrs(ctx, path) {
8126
8279
  return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
8127
8280
  }
8281
+ var AI_RESPONSIVE_CSS = [
8282
+ "@media (max-width: 960px) {",
8283
+ " [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
8284
+ ' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
8285
+ "}",
8286
+ "@media (max-width: 640px) {",
8287
+ " [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
8288
+ " [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
8289
+ // Group containers flatten to a column on phones; span placements come along for free.
8290
+ // `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
8291
+ // the comment there. This sheet's copy is the narrower selector, so without the exemption it
8292
+ // flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
8293
+ // viewport with the heading/CTA in flow *under* the image, 219px of section background where the
8294
+ // layered text used to be.
8295
+ ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
8296
+ ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
8297
+ // `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
8298
+ // is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
8299
+ // a full-bleed hero gets its 20px side band back below 640px only — the one width where the
8300
+ // other rule had already been taught to stand down.
8301
+ " [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
8302
+ " [data-ai-responsive] { overflow-x: hidden; }",
8303
+ " [data-ai-responsive] img { max-width: 100%; }",
8304
+ "}"
8305
+ ].join("\n");
8128
8306
  var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
8129
8307
  function MediaBox({
8130
8308
  refValue,
@@ -8179,7 +8357,7 @@ function MediaBox({
8179
8357
  position: fill ? "absolute" : void 0,
8180
8358
  inset: fill ? 0 : void 0,
8181
8359
  width: fill ? "100%" : fixedSize ? "auto" : "100%",
8182
- height: fill ? "100%" : void 0,
8360
+ height: fill ? "100%" : fixedSize ? height : void 0,
8183
8361
  aspectRatio: fill ? void 0 : aspectRatio,
8184
8362
  minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
8185
8363
  borderRadius: radius,
@@ -9675,7 +9853,7 @@ function CollectionBlock({ node, ctx, path }) {
9675
9853
  return /* @__PURE__ */ jsx(
9676
9854
  "div",
9677
9855
  {
9678
- "data-ai-grid": "",
9856
+ "data-ai-grid": String(itemsPerRow),
9679
9857
  "data-ohw-pricing-collection": isPricing ? "" : void 0,
9680
9858
  style: {
9681
9859
  display: "grid",
@@ -9977,7 +10155,7 @@ function renderNode(node, ctx, path, ambientAlign) {
9977
10155
  },
9978
10156
  children: [
9979
10157
  i > 0 && ctx.heroOverlapFullBleed ? (
9980
- // The section's `data-ai-container` gave up its max-width/gutter so the base
10158
+ // The section's `data-ai-section-inner` gave up its max-width/gutter so the base
9981
10159
  // layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
9982
10160
  // scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
9983
10161
  // the full section width instead of reading at the usual content width.
@@ -10396,6 +10574,7 @@ function AiTreeRenderer({
10396
10574
  ...fillHeight ? { "data-ai-fill-height": "" } : {},
10397
10575
  ...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
10398
10576
  ...bgAttrs,
10577
+ "data-ai-responsive": "",
10399
10578
  style: {
10400
10579
  position: "relative",
10401
10580
  padding: `${padCss} 0`,
@@ -10409,12 +10588,13 @@ function AiTreeRenderer({
10409
10588
  ...fillHeight ? { display: "grid" } : {}
10410
10589
  },
10411
10590
  children: [
10412
- isOverlay && backgroundUrl && /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
10591
+ /* @__PURE__ */ jsx("style", { children: AI_RESPONSIVE_CSS }),
10413
10592
  /* @__PURE__ */ jsx("style", { children: AI_MOBILE_CSS }),
10593
+ isOverlay && backgroundUrl && /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
10414
10594
  /* @__PURE__ */ jsx(
10415
10595
  "div",
10416
10596
  {
10417
- "data-ai-container": "",
10597
+ "data-ai-section-inner": "",
10418
10598
  ...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
10419
10599
  style: {
10420
10600
  position: "relative",
@@ -10431,7 +10611,7 @@ function AiTreeRenderer({
10431
10611
  children: tree.rows.map((row, r2) => /* @__PURE__ */ jsx(
10432
10612
  "div",
10433
10613
  {
10434
- "data-ai-row": "",
10614
+ "data-ai-columns": "",
10435
10615
  style: {
10436
10616
  display: "grid",
10437
10617
  gridTemplateColumns: "repeat(12, 1fr)",
@@ -11093,9 +11273,10 @@ function applyAiSectionsToDom(state, options) {
11093
11273
  if (existing && existing.serialized === serialized && existing.container.isConnected) {
11094
11274
  continue;
11095
11275
  }
11096
- const isNewMount = !existing || !existing.container.isConnected;
11097
11276
  let container = existing?.container;
11277
+ let isNewMount = false;
11098
11278
  if (!container || !container.isConnected) {
11279
+ isNewMount = true;
11099
11280
  existing?.root.unmount();
11100
11281
  container?.remove();
11101
11282
  container = document.createElement("div");
@@ -11433,6 +11614,34 @@ function minSpanForFooterBlock(type) {
11433
11614
  return 3;
11434
11615
  }
11435
11616
  }
11617
+ function readLiveSocialItems() {
11618
+ const root = getFooterRoot();
11619
+ const row = root?.querySelector("[data-ohw-socials-row]");
11620
+ if (!row) return [];
11621
+ const items = [];
11622
+ for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
11623
+ const href = anchor.getAttribute("href")?.trim() ?? "";
11624
+ const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
11625
+ const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
11626
+ if (!platform || !/^https?:\/\//i.test(href)) continue;
11627
+ items.push({ platform, href });
11628
+ }
11629
+ return items;
11630
+ }
11631
+ function syncSocialRowsFromDom(tree) {
11632
+ const root = getFooterRoot();
11633
+ if (!root) return;
11634
+ const row = root.querySelector("[data-ohw-socials-row]");
11635
+ const live = readLiveSocialItems();
11636
+ if (row && live.length === 0) return;
11637
+ for (const col of tree.columns) {
11638
+ col.blocks = col.blocks.flatMap((block) => {
11639
+ if (block.type !== "social-row") return [block];
11640
+ if (!row) return [];
11641
+ return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
11642
+ });
11643
+ }
11644
+ }
11436
11645
  function collectBrandBlocks(tree) {
11437
11646
  const brand = [];
11438
11647
  for (const col of tree.columns) {
@@ -11678,6 +11887,7 @@ function textOf2(el) {
11678
11887
  }
11679
11888
  function syncFooterTreeLinksFromDom(tree) {
11680
11889
  const next = cloneTree(tree);
11890
+ syncSocialRowsFromDom(next);
11681
11891
  const domCols = listFooterColumns().map((col) => {
11682
11892
  const heading = getFooterColumnHeadingEl(col);
11683
11893
  const title = heading ? textOf2(heading) : void 0;
@@ -17490,7 +17700,7 @@ function apiBase() {
17490
17700
  function bridgeVersion() {
17491
17701
  try {
17492
17702
  if (true) {
17493
- return "0.1.168";
17703
+ return "0.1.169-next.448";
17494
17704
  }
17495
17705
  } catch {
17496
17706
  }
@@ -17504,7 +17714,7 @@ function stampBridgeVersionOnDocument() {
17504
17714
  return;
17505
17715
  }
17506
17716
  try {
17507
- const v = true ? "0.1.168" : "";
17717
+ const v = true ? "0.1.169-next.448" : "";
17508
17718
  if (v) {
17509
17719
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
17510
17720
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -18182,6 +18392,7 @@ function MediaOverlay({
18182
18392
  (prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
18183
18393
  );
18184
18394
  }, [isVideo]);
18395
+ const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
18185
18396
  const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
18186
18397
  const box = {
18187
18398
  position: "fixed",
@@ -18280,11 +18491,10 @@ function MediaOverlay({
18280
18491
  className: "flex items-center justify-center cursor-pointer",
18281
18492
  style: {
18282
18493
  ...box,
18283
- // When text overlays this media, let clicks fall THROUGH to the text underneath. In the
18284
- // parent this needed a whole `ow:click-at` round-trip to re-hit-test inside the iframe;
18285
- // in-document, pointer-events does it natively. The button below opts back in, so
18286
- // Replace still works.
18287
- pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
18494
+ // Visual only. `pointer-events: auto` on this full-bleed rect covered the navbar
18495
+ // (hero bg includes the absolute TopNav) and swallowed CTA press-drag. Text overlay
18496
+ // and cueOnly also need clicks to fall through — Replace / video controls opt back in.
18497
+ pointerEvents: "none",
18288
18498
  // Selected: a firm component ring with no wash, so the image reads as chosen rather
18289
18499
  // than hovered. Hover keeps the existing tinted preview.
18290
18500
  boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
@@ -18311,17 +18521,17 @@ function MediaOverlay({
18311
18521
  },
18312
18522
  children: [
18313
18523
  isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
18314
- isVideo ? "Replace video" : "Replace image"
18524
+ replaceLabel
18315
18525
  ]
18316
18526
  }
18317
18527
  ),
18318
- replaceMode === "none" || cueOnly ? null : /* @__PURE__ */ jsxs8(
18528
+ showChrome && replaceMode !== "none" && /* @__PURE__ */ jsxs8(
18319
18529
  Button,
18320
18530
  {
18321
18531
  "data-ohw-media-overlay": "",
18322
18532
  variant: "outline",
18323
18533
  size: "sm",
18324
- "aria-label": isVideo ? "Replace video" : "Replace image",
18534
+ "aria-label": replaceLabel,
18325
18535
  className: "gap-1.5 cursor-pointer hover:bg-background",
18326
18536
  style: {
18327
18537
  ...OVERLAY_BUTTON_STYLE,
@@ -18344,7 +18554,7 @@ function MediaOverlay({
18344
18554
  },
18345
18555
  children: [
18346
18556
  isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
18347
- replaceMode === "full" ? isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image" : null
18557
+ replaceMode === "full" ? replaceLabel : null
18348
18558
  ]
18349
18559
  }
18350
18560
  )
@@ -18486,7 +18696,13 @@ function highlightChangedElements(keys, item, sectionId) {
18486
18696
  clearTimer = setTimeout(clearChangeHighlight, HIGHLIGHT_MS);
18487
18697
  return targets.length;
18488
18698
  }
18489
- function installAiChangeHighlight() {
18699
+ function highlightedRect() {
18700
+ const first = document.querySelector(`[${MARK_ATTR}]`);
18701
+ if (!first) return null;
18702
+ const rect = first.getBoundingClientRect();
18703
+ return { top: rect.top + window.scrollY, bottom: rect.bottom + window.scrollY };
18704
+ }
18705
+ function installAiChangeHighlight(select) {
18490
18706
  const onMessage = (e) => {
18491
18707
  const data = e.data;
18492
18708
  if (data?.type !== "ow:ai-highlight") return;
@@ -18495,12 +18711,37 @@ function installAiChangeHighlight() {
18495
18711
  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;
18496
18712
  const sectionId = typeof data.sectionId === "string" ? data.sectionId : void 0;
18497
18713
  const found = highlightChangedElements(keys, item, sectionId);
18498
- window.parent?.postMessage({ type: "ow:ai-highlight-done", found }, "*");
18714
+ const first = data.select === true ? document.querySelector(`[${MARK_ATTR}]`) : null;
18715
+ if (first) select?.(first);
18716
+ const rect = data.reveal === true && found > 0 ? highlightedRect() : null;
18717
+ window.parent?.postMessage({ type: "ow:ai-highlight-done", found, ...rect ? { rect } : {} }, "*");
18499
18718
  };
18500
18719
  window.addEventListener("message", onMessage);
18501
18720
  return () => window.removeEventListener("message", onMessage);
18502
18721
  }
18503
18722
 
18723
+ // src/lib/history-key-relay.ts
18724
+ var isMac = () => typeof navigator !== "undefined" && /Mac|iPhone|iPad/i.test(navigator.platform || navigator.userAgent);
18725
+ function historyActionFor(e, mac = isMac()) {
18726
+ const mod = mac ? e.metaKey : e.ctrlKey;
18727
+ if (!mod || e.altKey) return null;
18728
+ const key = e.key.toLowerCase();
18729
+ if (key === "z") return e.shiftKey ? "redo" : "undo";
18730
+ if (key === "y" && !mac) return "redo";
18731
+ return null;
18732
+ }
18733
+ var isEditingText = (el) => !!el && (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement || el instanceof HTMLElement && el.isContentEditable);
18734
+ function installHistoryKeyRelay() {
18735
+ const onKeyDown = (e) => {
18736
+ const action = historyActionFor(e);
18737
+ if (!action || isEditingText(document.activeElement)) return;
18738
+ e.preventDefault();
18739
+ window.parent?.postMessage({ type: "ow:history-key", action }, "*");
18740
+ };
18741
+ window.addEventListener("keydown", onKeyDown);
18742
+ return () => window.removeEventListener("keydown", onKeyDown);
18743
+ }
18744
+
18504
18745
  // src/ui/ai-section/AiSectionOverlay.tsx
18505
18746
  import { Fragment as Fragment6, jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
18506
18747
  var findSectionElement = findByInstanceId;
@@ -18753,7 +18994,8 @@ function AiSectionOverlay({
18753
18994
  window.addEventListener("message", onMessage);
18754
18995
  return () => window.removeEventListener("message", onMessage);
18755
18996
  }, [postToParent2]);
18756
- useEffect8(() => installAiChangeHighlight(), []);
18997
+ useEffect8(() => installAiChangeHighlight((el) => selectFromElement(el)), [selectFromElement]);
18998
+ useEffect8(() => installHistoryKeyRelay(), []);
18757
18999
  const [hoveredId, setHoveredId] = useState7(null);
18758
19000
  useEffect8(() => {
18759
19001
  const onMove = (e) => {
@@ -18943,8 +19185,24 @@ function AiSectionOverlay({
18943
19185
  }
18944
19186
 
18945
19187
  // src/ui/ai-section/AiMediaStripOverlay.tsx
18946
- import { useCallback as useCallback3, useEffect as useEffect9, useRef as useRef5, useState as useState8 } from "react";
18947
- import { Star } from "lucide-react";
19188
+ import { useCallback as useCallback3, useEffect as useEffect9, useLayoutEffect as useLayoutEffect4, useRef as useRef5, useState as useState8 } from "react";
19189
+ import {
19190
+ AlignCenter,
19191
+ AlignLeft,
19192
+ AlignRight,
19193
+ ArrowLeft as ArrowLeft2,
19194
+ ArrowRight as ArrowRight2,
19195
+ Check as Check2,
19196
+ ChevronDown as ChevronDown3,
19197
+ Image as ImageIcon2,
19198
+ ImageMinus,
19199
+ ImagePlus,
19200
+ Link as LinkIcon,
19201
+ Minus,
19202
+ Palette,
19203
+ Plus as Plus2,
19204
+ Star
19205
+ } from "lucide-react";
18948
19206
 
18949
19207
  // src/lib/ai-media-strip-tree.ts
18950
19208
  var MEDIA_STRIP_ITEM_MIN = 1;
@@ -19058,14 +19316,6 @@ function setMediaStripItemAsset(tree, index, assetId) {
19058
19316
  return true;
19059
19317
  });
19060
19318
  }
19061
- function setMediaStripItemAlt(tree, index, alt) {
19062
- return withMediaStrip(tree, (block) => {
19063
- const items = block.items;
19064
- if (index < 0 || index >= items.length) return false;
19065
- items[index] = { ...items[index], alt };
19066
- return true;
19067
- });
19068
- }
19069
19319
  function setMediaStripItemLink(tree, index, link) {
19070
19320
  return withMediaStrip(tree, (block) => {
19071
19321
  const items = block.items;
@@ -19083,11 +19333,117 @@ function setMediaStripItemLink(tree, index, link) {
19083
19333
  });
19084
19334
  }
19085
19335
 
19336
+ // src/ui/dialog.tsx
19337
+ import * as React9 from "react";
19338
+ import { Dialog as DialogPrimitive } from "radix-ui";
19339
+ import { X as X2 } from "lucide-react";
19340
+ import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
19341
+ function Dialog2({
19342
+ ...props
19343
+ }) {
19344
+ return /* @__PURE__ */ jsx20(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
19345
+ }
19346
+ function DialogPortal({
19347
+ ...props
19348
+ }) {
19349
+ return /* @__PURE__ */ jsx20(DialogPrimitive.Portal, { ...props });
19350
+ }
19351
+ function DialogOverlay({
19352
+ className,
19353
+ ...props
19354
+ }) {
19355
+ return /* @__PURE__ */ jsx20(
19356
+ DialogPrimitive.Overlay,
19357
+ {
19358
+ "data-slot": "dialog-overlay",
19359
+ "data-ohw-link-modal-root": "",
19360
+ className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
19361
+ ...props
19362
+ }
19363
+ );
19364
+ }
19365
+ var DialogContent = React9.forwardRef(
19366
+ ({ className, children, showCloseButton = true, container, ...props }, ref) => {
19367
+ const positionMode = container ? "absolute" : "fixed";
19368
+ return /* @__PURE__ */ jsxs11(DialogPortal, { container: container ?? void 0, children: [
19369
+ /* @__PURE__ */ jsx20(DialogOverlay, { className: cn(positionMode, "inset-0") }),
19370
+ /* @__PURE__ */ jsxs11(
19371
+ DialogPrimitive.Content,
19372
+ {
19373
+ ref,
19374
+ "data-slot": "dialog-content",
19375
+ className: cn(
19376
+ positionMode,
19377
+ "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",
19378
+ "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
19379
+ container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
19380
+ className
19381
+ ),
19382
+ onMouseDown: (e) => e.stopPropagation(),
19383
+ ...props,
19384
+ children: [
19385
+ children,
19386
+ showCloseButton ? /* @__PURE__ */ jsx20(
19387
+ DialogPrimitive.Close,
19388
+ {
19389
+ type: "button",
19390
+ className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
19391
+ "aria-label": "Close",
19392
+ children: /* @__PURE__ */ jsx20(X2, { size: 16, "aria-hidden": true })
19393
+ }
19394
+ ) : null
19395
+ ]
19396
+ }
19397
+ )
19398
+ ] });
19399
+ }
19400
+ );
19401
+ DialogContent.displayName = DialogPrimitive.Content.displayName;
19402
+ function DialogHeader({
19403
+ className,
19404
+ ...props
19405
+ }) {
19406
+ return /* @__PURE__ */ jsx20("div", { className: cn("flex flex-col gap-1.5", className), ...props });
19407
+ }
19408
+ function DialogFooter({
19409
+ className,
19410
+ ...props
19411
+ }) {
19412
+ return /* @__PURE__ */ jsx20(
19413
+ "div",
19414
+ {
19415
+ className: cn("flex items-center justify-end gap-2", className),
19416
+ ...props
19417
+ }
19418
+ );
19419
+ }
19420
+ var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
19421
+ DialogPrimitive.Title,
19422
+ {
19423
+ ref,
19424
+ className: cn(
19425
+ "text-lg font-semibold leading-none tracking-tight text-card-foreground",
19426
+ className
19427
+ ),
19428
+ ...props
19429
+ }
19430
+ ));
19431
+ DialogTitle.displayName = DialogPrimitive.Title.displayName;
19432
+ var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
19433
+ DialogPrimitive.Description,
19434
+ {
19435
+ ref,
19436
+ className: cn("text-sm text-muted-foreground", className),
19437
+ ...props
19438
+ }
19439
+ ));
19440
+ DialogDescription.displayName = DialogPrimitive.Description.displayName;
19441
+ var DialogClose = DialogPrimitive.Close;
19442
+
19086
19443
  // src/ui/ai-section/AiMediaStripOverlay.tsx
19087
- import { Fragment as Fragment7, jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
19088
- var PRIMARY3 = "#0885FE";
19089
- var OHW_BLUE = `var(--ohw-primary, ${PRIMARY3})`;
19090
- var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
19444
+ import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
19445
+ var PRIMARY3 = "var(--ohw-primary, #0885FE)";
19446
+ 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]";
19091
19447
  function findMediaStripItemElement(sectionId, index) {
19092
19448
  const sectionEl2 = findByInstanceId(sectionId);
19093
19449
  if (!sectionEl2) return null;
@@ -19097,14 +19453,35 @@ function findMediaStripItemElement(sectionId, index) {
19097
19453
  }
19098
19454
  return null;
19099
19455
  }
19100
- function readRect2(ref) {
19101
- const el = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19456
+ function itemRefFromTarget(target) {
19457
+ if (!(target instanceof Element)) return null;
19458
+ if (target.closest(CHROME_SELECTOR)) return null;
19459
+ const itemEl = target.closest("[data-ohw-media-strip-item]");
19460
+ if (!itemEl) return null;
19461
+ const sectionEl2 = itemEl.closest("[data-ohw-section]");
19462
+ const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
19463
+ const sectionId = unit ? instanceIdOf(unit) || null : null;
19464
+ const index = Number(itemEl.dataset.ohwMediaStripIndex);
19465
+ if (!sectionId || Number.isNaN(index)) return null;
19466
+ return { sectionId, index };
19467
+ }
19468
+ function sameRef(a, b) {
19469
+ return a?.sectionId === b?.sectionId && a?.index === b?.index;
19470
+ }
19471
+ function rectOf(el) {
19102
19472
  if (!el) return null;
19103
19473
  const r2 = el.getBoundingClientRect();
19104
19474
  if (r2.width <= 0 || r2.height <= 0) return null;
19105
19475
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
19106
19476
  }
19107
- function useLiveItemRect(ref) {
19477
+ function readRect2(ref) {
19478
+ return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
19479
+ }
19480
+ function readStripRect(ref) {
19481
+ const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19482
+ return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
19483
+ }
19484
+ function useLiveItemRect(ref, strip = false) {
19108
19485
  const [rect, setRect] = useState8(null);
19109
19486
  useEffect9(() => {
19110
19487
  if (!ref) {
@@ -19112,7 +19489,7 @@ function useLiveItemRect(ref) {
19112
19489
  return;
19113
19490
  }
19114
19491
  const update = () => {
19115
- const next = readRect2(ref);
19492
+ const next = strip ? readStripRect(ref) : readRect2(ref);
19116
19493
  setRect(
19117
19494
  (prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
19118
19495
  );
@@ -19127,9 +19504,49 @@ function useLiveItemRect(ref) {
19127
19504
  window.removeEventListener("resize", update);
19128
19505
  clearInterval(interval);
19129
19506
  };
19130
- }, [ref?.sectionId, ref?.index]);
19507
+ }, [ref?.sectionId, ref?.index, strip]);
19131
19508
  return rect;
19132
19509
  }
19510
+ var TOOLBAR_STRIP_GAP = 52;
19511
+ var TOOLBAR_STRIP_GAP_MOBILE = 42;
19512
+ var TOOLBAR_EDGE_MARGIN2 = 4;
19513
+ function StripToolbarSlot({ stripRect, children }) {
19514
+ const slotRef = useRef5(null);
19515
+ const [shift, setShift] = useState8(0);
19516
+ const centerX = stripRect.left + stripRect.width / 2;
19517
+ useLayoutEffect4(() => {
19518
+ const slot = slotRef.current;
19519
+ if (!slot) return;
19520
+ const clamp = () => {
19521
+ const w = slot.offsetWidth;
19522
+ if (w <= 0) return;
19523
+ const half = w / 2;
19524
+ const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
19525
+ setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
19526
+ };
19527
+ clamp();
19528
+ const ro = new ResizeObserver(clamp);
19529
+ ro.observe(slot);
19530
+ return () => ro.disconnect();
19531
+ }, [centerX, children]);
19532
+ const mobile = window.innerWidth <= 480;
19533
+ return /* @__PURE__ */ jsx21(
19534
+ "div",
19535
+ {
19536
+ ref: slotRef,
19537
+ "data-ohw-bridge": "",
19538
+ "data-ohw-item-interaction": "",
19539
+ className: "pointer-events-auto fixed",
19540
+ style: {
19541
+ top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
19542
+ left: centerX + shift,
19543
+ transform: "translate(-50%, -100%)",
19544
+ zIndex: 2147483645
19545
+ },
19546
+ children
19547
+ }
19548
+ );
19549
+ }
19133
19550
  function requestValidateTree(postToParent2, tree) {
19134
19551
  return new Promise((resolve) => {
19135
19552
  const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
@@ -19166,116 +19583,72 @@ function requestAssetPick(postToParent2) {
19166
19583
  postToParent2({ type: "ow:asset-pick", id });
19167
19584
  });
19168
19585
  }
19169
- function Pill({
19586
+ function ToolbarAction({
19170
19587
  label,
19171
19588
  onClick,
19172
- disabled,
19173
- active
19589
+ disabled = false,
19590
+ active = false,
19591
+ children
19174
19592
  }) {
19175
- return /* @__PURE__ */ jsx20(
19176
- "button",
19177
- {
19178
- type: "button",
19179
- onClick,
19180
- disabled,
19181
- style: {
19182
- height: 28,
19183
- padding: "0 10px",
19184
- display: "inline-flex",
19185
- alignItems: "center",
19186
- gap: 4,
19187
- borderRadius: 999,
19188
- border: "none",
19189
- cursor: disabled ? "default" : "pointer",
19190
- background: active ? OHW_BLUE_DARK : "#ffffff",
19191
- color: active ? "#ffffff" : OHW_BLUE_DARK,
19192
- opacity: disabled ? 0.4 : 1,
19193
- fontSize: 12,
19194
- lineHeight: "16px",
19195
- fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19196
- whiteSpace: "nowrap",
19197
- flex: "0 0 auto"
19198
- },
19199
- children: label
19200
- }
19201
- );
19593
+ const button = /* @__PURE__ */ jsx21(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
19594
+ return /* @__PURE__ */ jsxs12(Tooltip, { children: [
19595
+ /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: button }) : button }),
19596
+ /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
19597
+ ] });
19202
19598
  }
19203
- function AltInput({ value, onCommit }) {
19204
- const [draft, setDraft] = useState8(value);
19205
- useEffect9(() => setDraft(value), [value]);
19206
- return /* @__PURE__ */ jsxs11(
19207
- "div",
19208
- {
19209
- style: {
19210
- display: "flex",
19211
- alignItems: "center",
19212
- gap: 6,
19213
- height: 28,
19214
- padding: "0 12px",
19215
- borderRadius: 999,
19216
- background: "#ffffff",
19217
- width: "100%",
19218
- maxWidth: 260,
19219
- boxSizing: "border-box"
19220
- },
19221
- children: [
19222
- /* @__PURE__ */ jsx20(
19223
- "span",
19224
- {
19225
- style: {
19226
- flex: "0 0 auto",
19227
- color: OHW_BLUE_DARK,
19228
- fontSize: 10,
19229
- fontWeight: 700,
19230
- textTransform: "uppercase",
19231
- letterSpacing: 0.4
19232
- },
19233
- children: "Alt"
19234
- }
19235
- ),
19236
- /* @__PURE__ */ jsx20(
19237
- "input",
19599
+ function ToolbarSeparator() {
19600
+ return /* @__PURE__ */ jsx21("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
19601
+ }
19602
+ function OptionMenu({
19603
+ label,
19604
+ value,
19605
+ options,
19606
+ onChange
19607
+ }) {
19608
+ const current = options.find((o) => o.value === value) ?? options[0];
19609
+ return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
19610
+ /* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground", children: label }),
19611
+ /* @__PURE__ */ jsxs12(DropdownMenu, { modal: false, children: [
19612
+ /* @__PURE__ */ jsx21(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs12(
19613
+ "button",
19614
+ {
19615
+ type: "button",
19616
+ "aria-label": label,
19617
+ 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",
19618
+ children: [
19619
+ /* @__PURE__ */ jsx21("span", { className: "flex-1 text-left", children: current.label }),
19620
+ /* @__PURE__ */ jsx21(ChevronDown3, { size: 16, style: { pointerEvents: "none" } })
19621
+ ]
19622
+ }
19623
+ ) }),
19624
+ /* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
19625
+ const selected = option.value === value;
19626
+ return /* @__PURE__ */ jsxs12(
19627
+ DropdownMenuItem,
19238
19628
  {
19239
- type: "text",
19240
- value: draft,
19241
- onChange: (e) => setDraft(e.target.value),
19242
- onBlur: () => {
19243
- if (draft !== value) onCommit(draft);
19244
- },
19245
- onKeyDown: (e) => {
19246
- if (e.key === "Enter") e.currentTarget.blur();
19247
- if (e.key === "Escape") {
19248
- setDraft(value);
19249
- e.currentTarget.blur();
19250
- }
19251
- },
19252
- placeholder: "Describe this image",
19253
- "aria-label": "Image alt text",
19254
- style: {
19255
- flex: 1,
19256
- minWidth: 0,
19257
- border: "none",
19258
- outline: "none",
19259
- background: "transparent",
19260
- fontSize: 12,
19261
- lineHeight: "16px",
19262
- fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19263
- color: "#1f2937"
19264
- }
19265
- }
19266
- )
19267
- ]
19268
- }
19269
- );
19629
+ role: "menuitemradio",
19630
+ "aria-checked": selected,
19631
+ onSelect: () => onChange(option.value),
19632
+ className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
19633
+ children: [
19634
+ /* @__PURE__ */ jsx21("span", { children: option.label }),
19635
+ selected && /* @__PURE__ */ jsx21(Check2, { size: 16, className: "text-bridge-primary" })
19636
+ ]
19637
+ },
19638
+ option.value
19639
+ );
19640
+ }) })
19641
+ ] })
19642
+ ] });
19270
19643
  }
19271
19644
  var VARIANTS = [
19272
19645
  { value: "logos", label: "Logos" },
19273
19646
  { value: "reel", label: "Reel" }
19274
19647
  ];
19275
19648
  var ALIGNS = [
19276
- { value: "left", label: "Left" },
19277
- { value: "center", label: "Center" },
19278
- { value: "right", label: "Right" }
19649
+ { value: "left", label: "Align left", Icon: AlignLeft },
19650
+ { value: "center", label: "Align center", Icon: AlignCenter },
19651
+ { value: "right", label: "Align right", Icon: AlignRight }
19279
19652
  ];
19280
19653
  var HOVERS = [
19281
19654
  { value: "none", label: "None" },
@@ -19283,104 +19656,104 @@ var HOVERS = [
19283
19656
  { value: "zoom", label: "Zoom" },
19284
19657
  { value: "fade", label: "Fade" }
19285
19658
  ];
19286
- var TREATMENTS = [
19287
- { value: "color", label: "Color" },
19288
- { value: "grayscale", label: "Grayscale" }
19289
- ];
19290
19659
  var HTTP_URL_RE = /^https?:\/\/\S+$/i;
19291
- function LinkInput({ value, onCommit }) {
19292
- const [draft, setDraft] = useState8(value);
19660
+ function LinkModal({
19661
+ href,
19662
+ linkTarget,
19663
+ onClose,
19664
+ onSave
19665
+ }) {
19666
+ const [draft, setDraft] = useState8(href);
19667
+ const [newTab, setNewTab] = useState8(linkTarget !== "same-tab");
19293
19668
  const [invalid, setInvalid] = useState8(false);
19294
- useEffect9(() => {
19295
- setDraft(value);
19296
- setInvalid(false);
19297
- }, [value]);
19298
- const commit2 = () => {
19669
+ const save = () => {
19299
19670
  const next = draft.trim();
19300
- if (next === value) return setInvalid(false);
19301
- if (next && !HTTP_URL_RE.test(next)) return setInvalid(true);
19302
- setInvalid(false);
19303
- onCommit(next);
19304
- };
19305
- return /* @__PURE__ */ jsxs11(
19306
- "div",
19307
- {
19308
- style: {
19309
- display: "flex",
19310
- alignItems: "center",
19311
- gap: 6,
19312
- height: 28,
19313
- padding: "0 12px",
19314
- borderRadius: 999,
19315
- background: "#ffffff",
19316
- width: "100%",
19317
- maxWidth: 260,
19318
- boxSizing: "border-box",
19319
- boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
19320
- },
19321
- children: [
19322
- /* @__PURE__ */ jsx20(
19323
- "span",
19324
- {
19325
- style: {
19326
- flex: "0 0 auto",
19327
- color: OHW_BLUE_DARK,
19328
- fontSize: 10,
19329
- fontWeight: 700,
19330
- textTransform: "uppercase",
19331
- letterSpacing: 0.4
19332
- },
19333
- children: "Link"
19334
- }
19335
- ),
19336
- /* @__PURE__ */ jsx20(
19337
- "input",
19338
- {
19339
- type: "text",
19340
- inputMode: "url",
19341
- value: draft,
19342
- onChange: (e) => setDraft(e.target.value),
19343
- onBlur: commit2,
19344
- onKeyDown: (e) => {
19345
- if (e.key === "Enter") e.currentTarget.blur();
19346
- if (e.key === "Escape") {
19347
- setDraft(value);
19348
- setInvalid(false);
19349
- e.currentTarget.blur();
19350
- }
19351
- },
19352
- placeholder: "https://example.com",
19353
- "aria-label": "Image link URL",
19354
- "aria-invalid": invalid,
19355
- style: {
19356
- flex: 1,
19357
- minWidth: 0,
19358
- border: "none",
19359
- outline: "none",
19360
- background: "transparent",
19361
- fontSize: 12,
19362
- lineHeight: "16px",
19363
- fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19364
- color: "#1f2937"
19365
- }
19366
- }
19367
- )
19368
- ]
19671
+ if (next && !HTTP_URL_RE.test(next)) {
19672
+ setInvalid(true);
19673
+ return;
19369
19674
  }
19370
- );
19675
+ onSave(next, newTab ? "new-tab" : "same-tab");
19676
+ onClose();
19677
+ };
19678
+ return /* @__PURE__ */ jsx21(Dialog2, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs12(DialogContent, { "data-ohw-link-modal-root": "", className: "max-w-[400px] gap-4 p-5", children: [
19679
+ /* @__PURE__ */ jsx21(DialogHeader, { children: /* @__PURE__ */ jsx21(DialogTitle, { className: "text-base", children: "Image link" }) }),
19680
+ /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-3", children: [
19681
+ /* @__PURE__ */ jsx21(
19682
+ "input",
19683
+ {
19684
+ autoFocus: true,
19685
+ type: "text",
19686
+ inputMode: "url",
19687
+ value: draft,
19688
+ onChange: (e) => {
19689
+ setDraft(e.target.value);
19690
+ setInvalid(false);
19691
+ },
19692
+ onKeyDown: (e) => {
19693
+ if (e.key === "Enter") save();
19694
+ },
19695
+ placeholder: "https://example.com",
19696
+ "aria-label": "Image link URL",
19697
+ "aria-invalid": invalid,
19698
+ className: cn(
19699
+ "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",
19700
+ invalid && "border-destructive focus:border-destructive"
19701
+ )
19702
+ }
19703
+ ),
19704
+ invalid && /* @__PURE__ */ jsx21("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
19705
+ /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
19706
+ /* @__PURE__ */ jsx21("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
19707
+ "Open in new tab"
19708
+ ] })
19709
+ ] }),
19710
+ /* @__PURE__ */ jsxs12(DialogFooter, { children: [
19711
+ href && /* @__PURE__ */ jsx21(
19712
+ "button",
19713
+ {
19714
+ type: "button",
19715
+ onClick: () => {
19716
+ onSave("", "new-tab");
19717
+ onClose();
19718
+ },
19719
+ className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
19720
+ children: "Remove link"
19721
+ }
19722
+ ),
19723
+ /* @__PURE__ */ jsx21(
19724
+ "button",
19725
+ {
19726
+ type: "button",
19727
+ onClick: onClose,
19728
+ className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
19729
+ children: "Cancel"
19730
+ }
19731
+ ),
19732
+ /* @__PURE__ */ jsx21(
19733
+ "button",
19734
+ {
19735
+ type: "button",
19736
+ onClick: save,
19737
+ className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
19738
+ children: "Save"
19739
+ }
19740
+ )
19741
+ ] })
19742
+ ] }) });
19371
19743
  }
19372
19744
  function MediaStripToolbar({
19373
19745
  entry,
19374
19746
  index,
19375
19747
  pending,
19376
19748
  error,
19749
+ itemEditOn,
19750
+ onToggleItemEdit,
19377
19751
  onSetVariant,
19378
19752
  onSetAlign,
19379
19753
  onSetHover,
19380
19754
  onSetTreatment,
19381
19755
  onResize,
19382
- onSetAlt,
19383
- onSetLink,
19756
+ onOpenLink,
19384
19757
  onAddItem,
19385
19758
  onRemoveItem,
19386
19759
  onChangeImage,
@@ -19389,81 +19762,102 @@ function MediaStripToolbar({
19389
19762
  }) {
19390
19763
  const items = mediaStripItems(entry.tree);
19391
19764
  const itemCount = items.length;
19392
- const currentAlt = items[index]?.alt ?? "";
19393
- const currentHref2 = items[index]?.href ?? "";
19394
- const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
19395
19765
  const slots = findMediaStripSlots(entry.tree);
19396
19766
  const variant = slots?.variant === "reel" ? "reel" : "logos";
19397
19767
  const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
19398
19768
  const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
19399
19769
  const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
19400
19770
  const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19401
- const isMobile = window.innerWidth <= 480;
19402
- const rowStyle = isMobile ? {
19403
- display: "flex",
19404
- gap: 6,
19405
- flexWrap: "nowrap",
19406
- justifyContent: "center",
19407
- overflowX: "auto",
19408
- WebkitOverflowScrolling: "touch",
19409
- width: "100%",
19410
- scrollbarWidth: "none"
19411
- } : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
19412
- return /* @__PURE__ */ jsxs11(
19771
+ const mobile = window.innerWidth <= 480;
19772
+ const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
19773
+ return /* @__PURE__ */ jsx21(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs12(
19413
19774
  "div",
19414
19775
  {
19415
19776
  "data-ohw-bridge": "",
19416
19777
  "data-ohw-toolbar": "",
19417
19778
  onMouseDown: (e) => e.stopPropagation(),
19418
- style: {
19419
- display: "flex",
19420
- flexDirection: "column",
19421
- gap: 6,
19422
- alignItems: "center",
19423
- background: OHW_BLUE,
19424
- padding: 8,
19425
- borderRadius: 12,
19426
- boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
19427
- pointerEvents: pending ? "none" : "auto",
19428
- opacity: pending ? 0.6 : 1,
19429
- maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
19430
- },
19779
+ className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
19780
+ style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
19431
19781
  children: [
19432
- /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19433
- VARIANTS.map((v) => /* @__PURE__ */ jsx20(Pill, { label: v.label, active: variant === v.value, onClick: () => onSetVariant(v.value) }, v.value)),
19434
- ALIGNS.map((a) => /* @__PURE__ */ jsx20(Pill, { label: a.label, active: align === a.value, onClick: () => onSetAlign(a.value) }, a.value))
19435
- ] }),
19436
- /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19437
- HOVERS.map((h) => /* @__PURE__ */ jsx20(Pill, { label: h.label, active: hover === h.value, onClick: () => onSetHover(h.value) }, h.value)),
19438
- TREATMENTS.map((t) => /* @__PURE__ */ jsx20(Pill, { label: t.label, active: treatment === t.value, onClick: () => onSetTreatment(t.value) }, t.value))
19439
- ] }),
19440
- /* @__PURE__ */ jsxs11("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
19441
- /* @__PURE__ */ jsx20(Pill, { label: "\u2212", onClick: () => onResize(-8) }),
19442
- /* @__PURE__ */ jsxs11("span", { style: { color: "#ffffff", fontSize: 12, minWidth: 34, textAlign: "center" }, children: [
19443
- sizeValue,
19444
- "px"
19445
- ] }),
19446
- /* @__PURE__ */ jsx20(Pill, { label: "+", onClick: () => onResize(8) })
19447
- ] }),
19448
- /* @__PURE__ */ jsx20("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ jsx20(AltInput, { value: currentAlt, onCommit: onSetAlt }) }),
19449
- /* @__PURE__ */ jsx20("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ jsx20(LinkInput, { value: currentHref2, onCommit: (href) => onSetLink(href, currentTarget) }) }),
19450
- currentHref2 && /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19451
- /* @__PURE__ */ jsx20(Pill, { label: "New tab", active: currentTarget === "new-tab", onClick: () => onSetLink(currentHref2, "new-tab") }),
19452
- /* @__PURE__ */ jsx20(Pill, { label: "Same tab", active: currentTarget === "same-tab", onClick: () => onSetLink(currentHref2, "same-tab") })
19453
- ] }),
19454
- /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19455
- /* @__PURE__ */ jsx20(Pill, { label: "Change Image", onClick: onChangeImage }),
19456
- /* @__PURE__ */ jsx20(Pill, { label: "+ Item", onClick: onAddItem }),
19457
- /* @__PURE__ */ jsx20(Pill, { label: "\u2212 Item", onClick: onRemoveItem, disabled: itemCount <= 1 })
19458
- ] }),
19459
- /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19460
- /* @__PURE__ */ jsx20(Pill, { label: "\u2190 Move", onClick: onMoveLeft, disabled: index <= 0 }),
19461
- /* @__PURE__ */ jsx20(Pill, { label: "\u2192 Move", onClick: onMoveRight, disabled: index >= itemCount - 1 })
19462
- ] }),
19463
- error && /* @__PURE__ */ jsx20("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
19782
+ /* @__PURE__ */ jsxs12(
19783
+ "div",
19784
+ {
19785
+ className: cn(
19786
+ "flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
19787
+ "shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
19788
+ mobile ? "flex-wrap justify-center" : "flex-nowrap"
19789
+ ),
19790
+ children: [
19791
+ /* @__PURE__ */ jsxs12(Tooltip, { children: [
19792
+ /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
19793
+ CustomToolbarButton,
19794
+ {
19795
+ type: "button",
19796
+ "aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
19797
+ "aria-pressed": itemEditOn,
19798
+ onClick: onToggleItemEdit,
19799
+ className: "group size-8",
19800
+ children: /* @__PURE__ */ jsx21(
19801
+ Star,
19802
+ {
19803
+ size: 16,
19804
+ fill: "currentColor",
19805
+ strokeWidth: 0,
19806
+ className: cn(
19807
+ "transition-colors",
19808
+ itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
19809
+ ),
19810
+ style: { pointerEvents: "none" }
19811
+ }
19812
+ )
19813
+ }
19814
+ ) }),
19815
+ /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
19816
+ ] }),
19817
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19818
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(ImageIcon2, { size: 16, style: { pointerEvents: "none" } }) }),
19819
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(LinkIcon, { size: 16, style: { pointerEvents: "none" } }) }),
19820
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ jsx21(ArrowLeft2, { size: 16, style: { pointerEvents: "none" } }) }),
19821
+ /* @__PURE__ */ jsx21(
19822
+ ToolbarAction,
19823
+ {
19824
+ label: gatedLabel("Move right"),
19825
+ onClick: onMoveRight,
19826
+ disabled: !itemEditOn || index >= itemCount - 1,
19827
+ children: /* @__PURE__ */ jsx21(ArrowRight2, { size: 16, style: { pointerEvents: "none" } })
19828
+ }
19829
+ ),
19830
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ jsx21(ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
19831
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19832
+ /* @__PURE__ */ jsx21(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
19833
+ /* @__PURE__ */ jsx21(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
19834
+ /* @__PURE__ */ jsx21(
19835
+ ToolbarAction,
19836
+ {
19837
+ label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
19838
+ active: treatment === "grayscale",
19839
+ onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
19840
+ children: /* @__PURE__ */ jsx21(Palette, { size: 16, style: { pointerEvents: "none" } })
19841
+ }
19842
+ ),
19843
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19844
+ ALIGNS.map(({ value, label, Icon }) => /* @__PURE__ */ jsx21(ToolbarAction, { label, active: align === value, onClick: () => onSetAlign(value), children: /* @__PURE__ */ jsx21(Icon, { size: 16, style: { pointerEvents: "none" } }) }, value)),
19845
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19846
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ jsx21(Minus, { size: 16, style: { pointerEvents: "none" } }) }),
19847
+ /* @__PURE__ */ jsxs12("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
19848
+ sizeValue,
19849
+ "px"
19850
+ ] }),
19851
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ jsx21(Plus2, { size: 16, style: { pointerEvents: "none" } }) }),
19852
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19853
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ jsx21(ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
19854
+ ]
19855
+ }
19856
+ ),
19857
+ error && /* @__PURE__ */ jsx21("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
19464
19858
  ]
19465
19859
  }
19466
- );
19860
+ ) });
19467
19861
  }
19468
19862
  function findMediaStripSlots(tree) {
19469
19863
  const stack = tree.rows.flatMap((row) => row.blocks);
@@ -19482,31 +19876,23 @@ function AiMediaStripOverlay({
19482
19876
  }) {
19483
19877
  const [hover, setHover] = useState8(null);
19484
19878
  const [active, setActive] = useState8(null);
19879
+ const [itemEditOn, setItemEditOn] = useState8(false);
19880
+ const [linkOpen, setLinkOpen] = useState8(false);
19485
19881
  const [pending, setPending] = useState8(false);
19486
19882
  const [error, setError] = useState8(null);
19487
19883
  const activeRef = useRef5(null);
19488
19884
  activeRef.current = active;
19885
+ const linkOpenRef = useRef5(false);
19886
+ linkOpenRef.current = linkOpen;
19489
19887
  useEffect9(() => {
19490
19888
  const onMove = (e) => {
19889
+ const ref = itemRefFromTarget(e.target);
19491
19890
  const t = e.target;
19492
- if (!(t instanceof HTMLElement)) return;
19493
- if (t.closest("[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review]")) {
19494
- return;
19495
- }
19496
- const itemEl = t.closest("[data-ohw-media-strip-item]");
19497
- if (!itemEl) {
19498
- setHover(null);
19499
- return;
19500
- }
19501
- const sectionEl2 = itemEl.closest("[data-ohw-section]");
19502
- const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
19503
- const sectionId = unit ? instanceIdOf(unit) || null : null;
19504
- const index = Number(itemEl.dataset.ohwMediaStripIndex);
19505
- if (!sectionId || Number.isNaN(index)) {
19506
- setHover(null);
19507
- return;
19508
- }
19509
- setHover({ sectionId, index });
19891
+ const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
19892
+ setHover((prev) => {
19893
+ const next = ref && !overEditable ? ref : null;
19894
+ return sameRef(prev, next) ? prev : next;
19895
+ });
19510
19896
  };
19511
19897
  const onLeave = () => setHover(null);
19512
19898
  document.addEventListener("mousemove", onMove, { passive: true });
@@ -19518,23 +19904,25 @@ function AiMediaStripOverlay({
19518
19904
  }, []);
19519
19905
  useEffect9(() => {
19520
19906
  const onClick = (e) => {
19521
- const current = activeRef.current;
19522
- if (!current) return;
19523
19907
  const t = e.target;
19524
- if (!(t instanceof HTMLElement)) return;
19525
- if (t.closest("[data-ohw-item-interaction]")) return;
19526
- const itemEl = findMediaStripItemElement(current.sectionId, current.index);
19527
- if (itemEl && itemEl.contains(t)) return;
19528
- setActive(null);
19908
+ if (!(t instanceof Element)) return;
19909
+ if (t.closest(CHROME_SELECTOR)) return;
19910
+ const ref = itemRefFromTarget(t);
19911
+ if (sameRef(activeRef.current, ref)) return;
19912
+ if (ref) clearInteractionChromeRef.current();
19913
+ setItemEditOn(false);
19529
19914
  setError(null);
19915
+ setActive(ref);
19530
19916
  };
19531
19917
  document.addEventListener("click", onClick, true);
19532
19918
  return () => document.removeEventListener("click", onClick, true);
19533
- }, []);
19919
+ }, [clearInteractionChromeRef]);
19534
19920
  useEffect9(() => {
19535
19921
  const onBlur = () => {
19536
19922
  if (!activeRef.current) return;
19537
19923
  setActive(null);
19924
+ setItemEditOn(false);
19925
+ setLinkOpen(false);
19538
19926
  setError(null);
19539
19927
  };
19540
19928
  window.addEventListener("blur", onBlur);
@@ -19544,7 +19932,10 @@ function AiMediaStripOverlay({
19544
19932
  const onKeyDown = (e) => {
19545
19933
  if (e.key !== "Escape") return;
19546
19934
  if (!activeRef.current) return;
19935
+ if (linkOpenRef.current) return;
19936
+ if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
19547
19937
  setActive(null);
19938
+ setItemEditOn(false);
19548
19939
  setError(null);
19549
19940
  };
19550
19941
  document.addEventListener("keydown", onKeyDown);
@@ -19578,137 +19969,133 @@ function AiMediaStripOverlay({
19578
19969
  tree: nextTree,
19579
19970
  label: entry.label,
19580
19971
  media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
19581
- ...entry.brand ? { brand: entry.brand } : {}
19972
+ ...entry.brand ? { brand: entry.brand } : {},
19973
+ // The user is already looking at the strip they just edited — recentering the viewport
19974
+ // on every edit reads as the section jumping around.
19975
+ skipScrollIntoView: true
19582
19976
  });
19583
19977
  return true;
19584
19978
  },
19585
19979
  [findEntry, postToParent2, applyTreeLocalRef]
19586
19980
  );
19587
19981
  const activeEntry = active ? findEntry(active.sectionId) : null;
19588
- const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
19589
19982
  const activeItemRect = useLiveItemRect(active);
19590
- const TOOLBAR_APPROX_H = 170;
19591
- const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
19592
- return /* @__PURE__ */ jsxs11(Fragment7, { children: [
19593
- hoverHandleRect && hover && /* @__PURE__ */ jsx20(
19594
- "button",
19595
- {
19596
- type: "button",
19597
- "data-ohw-toolbar": "",
19598
- onClick: () => {
19599
- clearInteractionChromeRef.current();
19600
- setActive(hover);
19601
- },
19602
- "aria-label": "Configure media item",
19603
- style: {
19604
- position: "fixed",
19605
- top: hoverHandleRect.top + 8,
19606
- left: hoverHandleRect.left + hoverHandleRect.width - 36,
19607
- width: 28,
19608
- height: 28,
19609
- borderRadius: 8,
19610
- border: `1.5px dashed ${PRIMARY3}`,
19611
- background: "#ffffff",
19612
- color: PRIMARY3,
19613
- display: "flex",
19614
- alignItems: "center",
19615
- justifyContent: "center",
19616
- cursor: "pointer",
19617
- zIndex: 2147483643,
19618
- fontSize: 14,
19619
- fontWeight: 700
19620
- },
19621
- children: /* @__PURE__ */ jsx20(Star, { size: 14, style: { pointerEvents: "none" } })
19622
- }
19623
- ),
19624
- activeItemRect && active && activeEntry && /* @__PURE__ */ jsx20(
19625
- ItemInteractionLayer,
19626
- {
19627
- rect: activeItemRect,
19628
- state: toolbarState,
19629
- toolbar: /* @__PURE__ */ jsx20(
19630
- MediaStripToolbar,
19631
- {
19632
- entry: activeEntry,
19633
- index: active.index,
19634
- pending,
19635
- error,
19636
- onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
19637
- onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
19638
- onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
19639
- onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
19640
- onResize: (delta) => {
19641
- const slots = findMediaStripSlots(activeEntry.tree);
19642
- const variant = slots?.variant === "reel" ? "reel" : "logos";
19643
- const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19644
- void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
19645
- },
19646
- onSetAlt: (alt) => {
19647
- void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
19648
- },
19649
- onSetLink: (href, linkTarget) => {
19983
+ const activeStripRect = useLiveItemRect(active, true);
19984
+ const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
19985
+ const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
19986
+ const activeItem = active ? activeItems[active.index] : void 0;
19987
+ const activeHref = activeItem?.href ?? "";
19988
+ const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
19989
+ return /* @__PURE__ */ jsxs12(Fragment7, { children: [
19990
+ hoverRect && /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
19991
+ activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ jsxs12(Fragment7, { children: [
19992
+ /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
19993
+ /* @__PURE__ */ jsx21(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ jsx21(
19994
+ MediaStripToolbar,
19995
+ {
19996
+ entry: activeEntry,
19997
+ index: active.index,
19998
+ pending,
19999
+ error,
20000
+ itemEditOn,
20001
+ onToggleItemEdit: () => setItemEditOn((on) => !on),
20002
+ onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
20003
+ onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
20004
+ onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
20005
+ onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
20006
+ onResize: (delta) => {
20007
+ const slots = findMediaStripSlots(activeEntry.tree);
20008
+ const variant = slots?.variant === "reel" ? "reel" : "logos";
20009
+ const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
20010
+ void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
20011
+ },
20012
+ onOpenLink: () => setLinkOpen(true),
20013
+ onAddItem: () => {
20014
+ void requestAssetPick(postToParent2).then((picked) => {
20015
+ if (!picked) return;
20016
+ const item = { assetId: picked.assetId, alt: "Logo" };
19650
20017
  void runMutation(
19651
20018
  active.sectionId,
19652
- (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
19653
- );
19654
- },
19655
- onAddItem: () => {
19656
- void requestAssetPick(postToParent2).then((picked) => {
19657
- if (!picked) return;
19658
- const item = { assetId: picked.assetId, alt: "Logo" };
19659
- void runMutation(
19660
- active.sectionId,
19661
- (tree) => addMediaStripItem(tree, item, active.index),
19662
- { [picked.assetId]: picked.url }
19663
- ).then((applied) => {
19664
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19665
- });
20019
+ (tree) => addMediaStripItem(tree, item, active.index),
20020
+ { [picked.assetId]: picked.url }
20021
+ ).then((applied) => {
20022
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19666
20023
  });
19667
- },
19668
- onChangeImage: () => {
19669
- void requestAssetPick(postToParent2).then((picked) => {
19670
- if (!picked) return;
19671
- void runMutation(
19672
- active.sectionId,
19673
- (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
19674
- { [picked.assetId]: picked.url }
19675
- );
19676
- });
19677
- },
19678
- onRemoveItem: () => {
19679
- void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
19680
- (applied) => {
19681
- if (applied) setActive(null);
19682
- }
19683
- );
19684
- },
19685
- onMoveLeft: () => {
19686
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
19687
- (applied) => {
19688
- if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
19689
- }
19690
- );
19691
- },
19692
- onMoveRight: () => {
19693
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
19694
- (applied) => {
19695
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19696
- }
20024
+ });
20025
+ },
20026
+ onChangeImage: () => {
20027
+ void requestAssetPick(postToParent2).then((picked) => {
20028
+ if (!picked) return;
20029
+ void runMutation(
20030
+ active.sectionId,
20031
+ (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
20032
+ { [picked.assetId]: picked.url }
19697
20033
  );
19698
- }
20034
+ });
20035
+ },
20036
+ onRemoveItem: () => {
20037
+ void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
20038
+ (applied) => {
20039
+ if (applied) setActive(null);
20040
+ }
20041
+ );
20042
+ },
20043
+ onMoveLeft: () => {
20044
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
20045
+ (applied) => {
20046
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
20047
+ }
20048
+ );
20049
+ },
20050
+ onMoveRight: () => {
20051
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
20052
+ (applied) => {
20053
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
20054
+ }
20055
+ );
19699
20056
  }
19700
- )
19701
- }
19702
- )
20057
+ }
20058
+ ) }),
20059
+ /* @__PURE__ */ jsx21(
20060
+ "div",
20061
+ {
20062
+ "data-ohw-bridge": "",
20063
+ "data-ohw-item-interaction": "",
20064
+ "aria-hidden": true,
20065
+ className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
20066
+ style: {
20067
+ top: activeItemRect.top + activeItemRect.height + 10,
20068
+ left: activeItemRect.left - 5,
20069
+ background: PRIMARY3,
20070
+ zIndex: 2147483644
20071
+ },
20072
+ children: "Media item"
20073
+ }
20074
+ ),
20075
+ linkOpen && /* @__PURE__ */ jsx21(
20076
+ LinkModal,
20077
+ {
20078
+ href: activeHref,
20079
+ linkTarget: activeTarget,
20080
+ onClose: () => setLinkOpen(false),
20081
+ onSave: (href, linkTarget) => {
20082
+ void runMutation(
20083
+ active.sectionId,
20084
+ (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
20085
+ );
20086
+ }
20087
+ }
20088
+ )
20089
+ ] })
19703
20090
  ] });
19704
20091
  }
19705
20092
 
19706
20093
  // src/ui/ai-section/AiPricingCardOverlay.tsx
19707
- import { useCallback as useCallback4, useEffect as useEffect10, useLayoutEffect as useLayoutEffect4, useRef as useRef6, useState as useState9 } from "react";
19708
- import { Check as Check2, ChevronDown as ChevronDown3, Minus, Plus as Plus2, Star as Star2 } from "lucide-react";
19709
- import { Fragment as Fragment8, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
20094
+ import { useCallback as useCallback4, useEffect as useEffect10, useLayoutEffect as useLayoutEffect5, useRef as useRef6, useState as useState9 } from "react";
20095
+ import { Check as Check3, ChevronDown as ChevronDown4, Minus as Minus2, Plus as Plus3, Star as Star2 } from "lucide-react";
20096
+ import { Fragment as Fragment8, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
19710
20097
  var PRIMARY4 = "var(--ohw-primary, #0885FE)";
19711
- var CHROME_SELECTOR = "[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review], [data-ohw-more-menu]";
20098
+ 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]";
19712
20099
  function findPricingCardElement(sectionId, index) {
19713
20100
  const sectionEl2 = findByInstanceId(sectionId);
19714
20101
  if (!sectionEl2) return null;
@@ -19720,7 +20107,7 @@ function findPricingCardElement(sectionId, index) {
19720
20107
  }
19721
20108
  function cardRefFromTarget(target) {
19722
20109
  if (!(target instanceof Element)) return null;
19723
- if (target.closest(CHROME_SELECTOR)) return null;
20110
+ if (target.closest(CHROME_SELECTOR2)) return null;
19724
20111
  const cardEl = target.closest("[data-ohw-pricing-card]");
19725
20112
  if (!cardEl) return null;
19726
20113
  const sectionEl2 = cardEl.closest("[data-ohw-section]");
@@ -19730,21 +20117,21 @@ function cardRefFromTarget(target) {
19730
20117
  if (!sectionId || Number.isNaN(index)) return null;
19731
20118
  return { sectionId, index };
19732
20119
  }
19733
- function sameRef(a, b) {
20120
+ function sameRef2(a, b) {
19734
20121
  return a?.sectionId === b?.sectionId && a?.index === b?.index;
19735
20122
  }
19736
- function rectOf(el) {
20123
+ function rectOf2(el) {
19737
20124
  if (!el) return null;
19738
20125
  const r2 = el.getBoundingClientRect();
19739
20126
  if (r2.width <= 0 || r2.height <= 0) return null;
19740
20127
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
19741
20128
  }
19742
20129
  function readRect3(ref) {
19743
- return rectOf(ref && findPricingCardElement(ref.sectionId, ref.index));
20130
+ return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
19744
20131
  }
19745
20132
  function readGridRect(ref) {
19746
20133
  const card = ref && findPricingCardElement(ref.sectionId, ref.index);
19747
- return rectOf(card?.closest("[data-ohw-pricing-collection]") ?? card);
20134
+ return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
19748
20135
  }
19749
20136
  function useLiveCardRect(ref, grid = false) {
19750
20137
  const [rect, setRect] = useState9(null);
@@ -19774,19 +20161,19 @@ function useLiveCardRect(ref, grid = false) {
19774
20161
  }
19775
20162
  var TOOLBAR_GRID_GAP = 52;
19776
20163
  var TOOLBAR_GRID_GAP_MOBILE = 42;
19777
- var TOOLBAR_EDGE_MARGIN2 = 4;
20164
+ var TOOLBAR_EDGE_MARGIN3 = 4;
19778
20165
  function GridToolbarSlot({ gridRect, children }) {
19779
20166
  const slotRef = useRef6(null);
19780
20167
  const [shift, setShift] = useState9(0);
19781
20168
  const centerX = gridRect.left + gridRect.width / 2;
19782
- useLayoutEffect4(() => {
20169
+ useLayoutEffect5(() => {
19783
20170
  const slot = slotRef.current;
19784
20171
  if (!slot) return;
19785
20172
  const clamp = () => {
19786
20173
  const w = slot.offsetWidth;
19787
20174
  if (w <= 0) return;
19788
20175
  const half = w / 2;
19789
- const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
20176
+ const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
19790
20177
  setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
19791
20178
  };
19792
20179
  clamp();
@@ -19795,7 +20182,7 @@ function GridToolbarSlot({ gridRect, children }) {
19795
20182
  return () => ro.disconnect();
19796
20183
  }, [centerX, children]);
19797
20184
  const mobile = window.innerWidth <= 480;
19798
- return /* @__PURE__ */ jsx21(
20185
+ return /* @__PURE__ */ jsx22(
19799
20186
  "div",
19800
20187
  {
19801
20188
  ref: slotRef,
@@ -19830,7 +20217,7 @@ function requestValidateTree2(postToParent2, tree) {
19830
20217
  });
19831
20218
  }
19832
20219
  function StyleSwatch({ style }) {
19833
- return /* @__PURE__ */ jsx21(
20220
+ return /* @__PURE__ */ jsx22(
19834
20221
  "span",
19835
20222
  {
19836
20223
  "aria-hidden": true,
@@ -19844,35 +20231,35 @@ function StyleSwatch({ style }) {
19844
20231
  );
19845
20232
  }
19846
20233
  function ButtonGlyph() {
19847
- return /* @__PURE__ */ jsxs12("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
19848
- /* @__PURE__ */ jsx21("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
19849
- /* @__PURE__ */ jsx21("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
20234
+ return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20235
+ /* @__PURE__ */ jsx22("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
20236
+ /* @__PURE__ */ jsx22("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
19850
20237
  ] });
19851
20238
  }
19852
20239
  function FeatureGlyph({ mode }) {
19853
- return /* @__PURE__ */ jsxs12("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
19854
- /* @__PURE__ */ jsx21("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
19855
- /* @__PURE__ */ jsx21("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
19856
- /* @__PURE__ */ jsx21("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
19857
- /* @__PURE__ */ jsx21("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
19858
- /* @__PURE__ */ jsx21("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
19859
- mode === "add" && /* @__PURE__ */ jsx21("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
20240
+ return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20241
+ /* @__PURE__ */ jsx22("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
20242
+ /* @__PURE__ */ jsx22("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
20243
+ /* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
20244
+ /* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
20245
+ /* @__PURE__ */ jsx22("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
20246
+ mode === "add" && /* @__PURE__ */ jsx22("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
19860
20247
  ] });
19861
20248
  }
19862
- function ToolbarAction({
20249
+ function ToolbarAction2({
19863
20250
  label,
19864
20251
  onClick,
19865
20252
  disabled = false,
19866
20253
  children
19867
20254
  }) {
19868
- const button = /* @__PURE__ */ jsx21(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
19869
- return /* @__PURE__ */ jsxs12(Tooltip, { children: [
19870
- /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: button }) : button }),
19871
- /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
20255
+ const button = /* @__PURE__ */ jsx22(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
20256
+ return /* @__PURE__ */ jsxs13(Tooltip, { children: [
20257
+ /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: button }) : button }),
20258
+ /* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
19872
20259
  ] });
19873
20260
  }
19874
- function ToolbarSeparator() {
19875
- return /* @__PURE__ */ jsx21("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
20261
+ function ToolbarSeparator2() {
20262
+ return /* @__PURE__ */ jsx22("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
19876
20263
  }
19877
20264
  function CardStyleMenu({
19878
20265
  value,
@@ -19880,7 +20267,7 @@ function CardStyleMenu({
19880
20267
  disabled = false
19881
20268
  }) {
19882
20269
  const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
19883
- const trigger = /* @__PURE__ */ jsxs12(
20270
+ const trigger = /* @__PURE__ */ jsxs13(
19884
20271
  "button",
19885
20272
  {
19886
20273
  type: "button",
@@ -19891,28 +20278,28 @@ function CardStyleMenu({
19891
20278
  disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
19892
20279
  ),
19893
20280
  children: [
19894
- /* @__PURE__ */ jsx21(StyleSwatch, { style: current.value }),
19895
- /* @__PURE__ */ jsx21("span", { className: "flex-1 text-left", children: current.label }),
19896
- /* @__PURE__ */ jsx21(ChevronDown3, { size: 16, style: { pointerEvents: "none" } })
20281
+ /* @__PURE__ */ jsx22(StyleSwatch, { style: current.value }),
20282
+ /* @__PURE__ */ jsx22("span", { className: "flex-1 text-left", children: current.label }),
20283
+ /* @__PURE__ */ jsx22(ChevronDown4, { size: 16, style: { pointerEvents: "none" } })
19897
20284
  ]
19898
20285
  }
19899
20286
  );
19900
20287
  if (disabled) {
19901
- return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
19902
- /* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
19903
- /* @__PURE__ */ jsxs12(Tooltip, { children: [
19904
- /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: trigger }) }),
19905
- /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
20288
+ return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20289
+ /* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
20290
+ /* @__PURE__ */ jsxs13(Tooltip, { children: [
20291
+ /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: trigger }) }),
20292
+ /* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
19906
20293
  ] })
19907
20294
  ] });
19908
20295
  }
19909
- return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
19910
- /* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
19911
- /* @__PURE__ */ jsxs12(DropdownMenu, { modal: false, children: [
19912
- /* @__PURE__ */ jsx21(DropdownMenuTrigger, { asChild: true, children: trigger }),
19913
- /* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
20296
+ return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20297
+ /* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
20298
+ /* @__PURE__ */ jsxs13(DropdownMenu, { modal: false, children: [
20299
+ /* @__PURE__ */ jsx22(DropdownMenuTrigger, { asChild: true, children: trigger }),
20300
+ /* @__PURE__ */ jsx22(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
19914
20301
  const selected = style.value === value;
19915
- return /* @__PURE__ */ jsxs12(
20302
+ return /* @__PURE__ */ jsxs13(
19916
20303
  DropdownMenuItem,
19917
20304
  {
19918
20305
  role: "menuitemradio",
@@ -19920,9 +20307,9 @@ function CardStyleMenu({
19920
20307
  onSelect: () => onChange(style.value),
19921
20308
  className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
19922
20309
  children: [
19923
- /* @__PURE__ */ jsx21(StyleSwatch, { style: style.value }),
19924
- /* @__PURE__ */ jsx21("span", { children: style.label }),
19925
- selected && /* @__PURE__ */ jsx21(Check2, { size: 16, className: "text-bridge-primary" })
20310
+ /* @__PURE__ */ jsx22(StyleSwatch, { style: style.value }),
20311
+ /* @__PURE__ */ jsx22("span", { children: style.label }),
20312
+ selected && /* @__PURE__ */ jsx22(Check3, { size: 16, className: "text-bridge-primary" })
19926
20313
  ]
19927
20314
  },
19928
20315
  style.value
@@ -19952,7 +20339,7 @@ function PricingCardToolbar({
19952
20339
  const style = pricingCardStyle(entry.tree, index);
19953
20340
  const featuredTag = pricingCardFeaturedTag(entry.tree, index);
19954
20341
  const mobile = window.innerWidth <= 480;
19955
- return /* @__PURE__ */ jsx21(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs12(
20342
+ return /* @__PURE__ */ jsx22(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs13(
19956
20343
  "div",
19957
20344
  {
19958
20345
  "data-ohw-bridge": "",
@@ -19964,7 +20351,7 @@ function PricingCardToolbar({
19964
20351
  ),
19965
20352
  style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
19966
20353
  children: [
19967
- /* @__PURE__ */ jsxs12(
20354
+ /* @__PURE__ */ jsxs13(
19968
20355
  "div",
19969
20356
  {
19970
20357
  className: cn(
@@ -19973,8 +20360,8 @@ function PricingCardToolbar({
19973
20360
  mobile ? "flex-wrap justify-center" : "flex-nowrap"
19974
20361
  ),
19975
20362
  children: [
19976
- /* @__PURE__ */ jsxs12(Tooltip, { children: [
19977
- /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
20363
+ /* @__PURE__ */ jsxs13(Tooltip, { children: [
20364
+ /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22(
19978
20365
  CustomToolbarButton,
19979
20366
  {
19980
20367
  type: "button",
@@ -19982,7 +20369,7 @@ function PricingCardToolbar({
19982
20369
  "aria-pressed": featuredTag,
19983
20370
  onClick: () => onSetFeaturedTag(!featuredTag),
19984
20371
  className: "group size-8",
19985
- children: /* @__PURE__ */ jsx21(
20372
+ children: /* @__PURE__ */ jsx22(
19986
20373
  Star2,
19987
20374
  {
19988
20375
  size: 16,
@@ -19997,25 +20384,25 @@ function PricingCardToolbar({
19997
20384
  )
19998
20385
  }
19999
20386
  ) }),
20000
- /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
20387
+ /* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
20001
20388
  ] }),
20002
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
20003
- /* @__PURE__ */ jsx21(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
20004
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
20005
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ jsx21(ButtonGlyph, {}) }),
20006
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ jsxs12("span", { className: "relative inline-flex", children: [
20007
- /* @__PURE__ */ jsx21(ButtonGlyph, {}),
20008
- /* @__PURE__ */ jsx21(Minus, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
20389
+ /* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
20390
+ /* @__PURE__ */ jsx22(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
20391
+ /* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
20392
+ /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ jsx22(ButtonGlyph, {}) }),
20393
+ /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ jsxs13("span", { className: "relative inline-flex", children: [
20394
+ /* @__PURE__ */ jsx22(ButtonGlyph, {}),
20395
+ /* @__PURE__ */ jsx22(Minus2, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
20009
20396
  ] }) }),
20010
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ jsx21(FeatureGlyph, { mode: "add" }) }),
20011
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ jsx21(FeatureGlyph, { mode: "remove" }) }),
20012
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
20013
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ jsx21(Plus2, { size: 16, style: { pointerEvents: "none" } }) }),
20014
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ jsx21(Minus, { size: 16, style: { pointerEvents: "none" } }) })
20397
+ /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "add" }) }),
20398
+ /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "remove" }) }),
20399
+ /* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
20400
+ /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ jsx22(Plus3, { size: 16, style: { pointerEvents: "none" } }) }),
20401
+ /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ jsx22(Minus2, { size: 16, style: { pointerEvents: "none" } }) })
20015
20402
  ]
20016
20403
  }
20017
20404
  ),
20018
- error && /* @__PURE__ */ jsx21("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
20405
+ error && /* @__PURE__ */ jsx22("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
20019
20406
  ]
20020
20407
  }
20021
20408
  ) });
@@ -20049,7 +20436,7 @@ function AiPricingCardOverlay({
20049
20436
  const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
20050
20437
  setHover((prev) => {
20051
20438
  const next = ref && !overEditable ? ref : null;
20052
- return sameRef(prev, next) ? prev : next;
20439
+ return sameRef2(prev, next) ? prev : next;
20053
20440
  });
20054
20441
  };
20055
20442
  const onLeave = () => setHover(null);
@@ -20064,10 +20451,10 @@ function AiPricingCardOverlay({
20064
20451
  const onClick = (e) => {
20065
20452
  const t = e.target;
20066
20453
  if (!(t instanceof Element)) return;
20067
- if (t.closest(CHROME_SELECTOR)) return;
20454
+ if (t.closest(CHROME_SELECTOR2)) return;
20068
20455
  const ref = cardRefFromTarget(t);
20069
- setActive((prev) => sameRef(prev, ref) ? prev : ref);
20070
- if (!ref || !sameRef(activeRef.current, ref)) setError(null);
20456
+ setActive((prev) => sameRef2(prev, ref) ? prev : ref);
20457
+ if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
20071
20458
  };
20072
20459
  document.addEventListener("click", onClick, true);
20073
20460
  return () => document.removeEventListener("click", onClick, true);
@@ -20132,12 +20519,12 @@ function AiPricingCardOverlay({
20132
20519
  const activeEntry = active ? findEntry(active.sectionId) : null;
20133
20520
  const activeCardRect = useLiveCardRect(active);
20134
20521
  const activeGridRect = useLiveCardRect(active, true);
20135
- const hoverRect = useLiveCardRect(hover && !sameRef(hover, active) ? hover : null);
20136
- return /* @__PURE__ */ jsxs12(Fragment8, { children: [
20137
- hoverRect && /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20138
- activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ jsxs12(Fragment8, { children: [
20139
- /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
20140
- /* @__PURE__ */ jsx21(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ jsx21(
20522
+ const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
20523
+ return /* @__PURE__ */ jsxs13(Fragment8, { children: [
20524
+ hoverRect && /* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20525
+ activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ jsxs13(Fragment8, { children: [
20526
+ /* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
20527
+ /* @__PURE__ */ jsx22(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ jsx22(
20141
20528
  PricingCardToolbar,
20142
20529
  {
20143
20530
  entry: activeEntry,
@@ -20165,7 +20552,7 @@ function AiPricingCardOverlay({
20165
20552
  onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
20166
20553
  }
20167
20554
  ) }),
20168
- /* @__PURE__ */ jsx21(
20555
+ /* @__PURE__ */ jsx22(
20169
20556
  "div",
20170
20557
  {
20171
20558
  "data-ohw-bridge": "",
@@ -20229,39 +20616,11 @@ function clearVideo(tree, path) {
20229
20616
  });
20230
20617
  }
20231
20618
 
20232
- // src/lib/youtube.ts
20233
- var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
20234
- function extractYouTubeId(input) {
20235
- const trimmed = input.trim();
20236
- if (!trimmed) return null;
20237
- if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
20238
- let url;
20239
- try {
20240
- url = new URL(trimmed);
20241
- } catch {
20242
- return null;
20243
- }
20244
- const host = url.hostname.replace(/^www\./, "");
20245
- if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
20246
- return null;
20247
- }
20248
- let candidate = null;
20249
- if (host === "youtu.be") {
20250
- candidate = url.pathname.slice(1).split("/")[0] ?? null;
20251
- } else if (url.pathname === "/watch") {
20252
- candidate = url.searchParams.get("v");
20253
- } else {
20254
- const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
20255
- candidate = match ? match[1] : null;
20256
- }
20257
- return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
20258
- }
20259
-
20260
20619
  // src/ui/ai-section/AiVideoOverlay.tsx
20261
- import { Fragment as Fragment9, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
20620
+ import { Fragment as Fragment9, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
20262
20621
  var PRIMARY5 = "#0885FE";
20263
- var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY5})`;
20264
- var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20622
+ var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
20623
+ var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20265
20624
  function findVideoBlockElement(sectionId, path) {
20266
20625
  const sectionEl2 = findByInstanceId(sectionId);
20267
20626
  if (!sectionEl2) return null;
@@ -20321,12 +20680,12 @@ function requestValidateTree3(postToParent2, tree) {
20321
20680
  postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
20322
20681
  });
20323
20682
  }
20324
- function Pill2({
20683
+ function Pill({
20325
20684
  label,
20326
20685
  onClick,
20327
20686
  disabled
20328
20687
  }) {
20329
- return /* @__PURE__ */ jsx22(
20688
+ return /* @__PURE__ */ jsx23(
20330
20689
  "button",
20331
20690
  {
20332
20691
  type: "button",
@@ -20342,7 +20701,7 @@ function Pill2({
20342
20701
  border: "none",
20343
20702
  cursor: disabled ? "default" : "pointer",
20344
20703
  background: "#ffffff",
20345
- color: OHW_BLUE_DARK2,
20704
+ color: OHW_BLUE_DARK,
20346
20705
  opacity: disabled ? 0.4 : 1,
20347
20706
  fontSize: 12,
20348
20707
  lineHeight: "16px",
@@ -20385,8 +20744,8 @@ function VideoUrlInput({ value, onCommit }) {
20385
20744
  onCommit(id);
20386
20745
  }
20387
20746
  };
20388
- return /* @__PURE__ */ jsxs13("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
20389
- /* @__PURE__ */ jsxs13(
20747
+ return /* @__PURE__ */ jsxs14("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
20748
+ /* @__PURE__ */ jsxs14(
20390
20749
  "div",
20391
20750
  {
20392
20751
  style: {
@@ -20402,12 +20761,12 @@ function VideoUrlInput({ value, onCommit }) {
20402
20761
  boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
20403
20762
  },
20404
20763
  children: [
20405
- /* @__PURE__ */ jsx22(
20764
+ /* @__PURE__ */ jsx23(
20406
20765
  "span",
20407
20766
  {
20408
20767
  style: {
20409
20768
  flex: "0 0 auto",
20410
- color: OHW_BLUE_DARK2,
20769
+ color: OHW_BLUE_DARK,
20411
20770
  fontSize: 10,
20412
20771
  lineHeight: "16px",
20413
20772
  fontWeight: 700,
@@ -20417,7 +20776,7 @@ function VideoUrlInput({ value, onCommit }) {
20417
20776
  children: "Video"
20418
20777
  }
20419
20778
  ),
20420
- /* @__PURE__ */ jsx22(
20779
+ /* @__PURE__ */ jsx23(
20421
20780
  "input",
20422
20781
  {
20423
20782
  type: "text",
@@ -20454,7 +20813,7 @@ function VideoUrlInput({ value, onCommit }) {
20454
20813
  ]
20455
20814
  }
20456
20815
  ),
20457
- invalid && /* @__PURE__ */ jsx22("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
20816
+ invalid && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
20458
20817
  ] });
20459
20818
  }
20460
20819
  function VideoToolbar({
@@ -20464,7 +20823,7 @@ function VideoToolbar({
20464
20823
  onSetVideoId,
20465
20824
  onRemove
20466
20825
  }) {
20467
- return /* @__PURE__ */ jsxs13(
20826
+ return /* @__PURE__ */ jsxs14(
20468
20827
  "div",
20469
20828
  {
20470
20829
  "data-ohw-bridge": "",
@@ -20476,7 +20835,7 @@ function VideoToolbar({
20476
20835
  gap: 6,
20477
20836
  alignItems: "center",
20478
20837
  width: 280,
20479
- background: OHW_BLUE2,
20838
+ background: OHW_BLUE,
20480
20839
  padding: 8,
20481
20840
  borderRadius: 12,
20482
20841
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -20484,9 +20843,9 @@ function VideoToolbar({
20484
20843
  opacity: pending ? 0.6 : 1
20485
20844
  },
20486
20845
  children: [
20487
- /* @__PURE__ */ jsx22(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
20488
- /* @__PURE__ */ jsx22(Pill2, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
20489
- error && /* @__PURE__ */ jsx22("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20846
+ /* @__PURE__ */ jsx23(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
20847
+ /* @__PURE__ */ jsx23(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
20848
+ error && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20490
20849
  ]
20491
20850
  }
20492
20851
  );
@@ -20606,8 +20965,8 @@ function AiVideoOverlay({
20606
20965
  const activeBlockRect = useLiveBlockRect(active);
20607
20966
  const TOOLBAR_APPROX_H = 90;
20608
20967
  const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
20609
- return /* @__PURE__ */ jsxs13(Fragment9, { children: [
20610
- hoverHandleRect && hover && /* @__PURE__ */ jsx22(
20968
+ return /* @__PURE__ */ jsxs14(Fragment9, { children: [
20969
+ hoverHandleRect && hover && /* @__PURE__ */ jsx23(
20611
20970
  "button",
20612
20971
  {
20613
20972
  type: "button",
@@ -20635,15 +20994,15 @@ function AiVideoOverlay({
20635
20994
  fontSize: 14,
20636
20995
  fontWeight: 700
20637
20996
  },
20638
- children: /* @__PURE__ */ jsx22(Star3, { size: 14, style: { pointerEvents: "none" } })
20997
+ children: /* @__PURE__ */ jsx23(Star3, { size: 14, style: { pointerEvents: "none" } })
20639
20998
  }
20640
20999
  ),
20641
- activeBlockRect && active && activeEntry && /* @__PURE__ */ jsx22(
21000
+ activeBlockRect && active && activeEntry && /* @__PURE__ */ jsx23(
20642
21001
  ItemInteractionLayer,
20643
21002
  {
20644
21003
  rect: activeBlockRect,
20645
21004
  state: toolbarState,
20646
- toolbar: /* @__PURE__ */ jsx22(
21005
+ toolbar: /* @__PURE__ */ jsx23(
20647
21006
  VideoToolbar,
20648
21007
  {
20649
21008
  videoId: videoIdAt(activeEntry.tree, active.path),
@@ -20718,10 +21077,10 @@ function setCarouselAutoplay(tree, on) {
20718
21077
  }
20719
21078
 
20720
21079
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
20721
- import { Fragment as Fragment10, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
21080
+ import { Fragment as Fragment10, jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
20722
21081
  var PRIMARY6 = "#0885FE";
20723
- var OHW_BLUE3 = `var(--ohw-primary, ${PRIMARY6})`;
20724
- var OHW_BLUE_DARK3 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
21082
+ var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
21083
+ var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
20725
21084
  function findCarouselItemElement(sectionId, index) {
20726
21085
  const sectionEl2 = findByInstanceId(sectionId);
20727
21086
  if (!sectionEl2) return null;
@@ -20800,8 +21159,8 @@ function requestAssetPick2(postToParent2) {
20800
21159
  postToParent2({ type: "ow:asset-pick", id });
20801
21160
  });
20802
21161
  }
20803
- function Pill3({ label, onClick, disabled }) {
20804
- return /* @__PURE__ */ jsx23(
21162
+ function Pill2({ label, onClick, disabled }) {
21163
+ return /* @__PURE__ */ jsx24(
20805
21164
  "button",
20806
21165
  {
20807
21166
  type: "button",
@@ -20817,7 +21176,7 @@ function Pill3({ label, onClick, disabled }) {
20817
21176
  border: "none",
20818
21177
  cursor: disabled ? "default" : "pointer",
20819
21178
  background: "#ffffff",
20820
- color: OHW_BLUE_DARK3,
21179
+ color: OHW_BLUE_DARK2,
20821
21180
  opacity: disabled ? 0.4 : 1,
20822
21181
  fontSize: 12,
20823
21182
  lineHeight: "16px",
@@ -20835,7 +21194,7 @@ function TogglePill({
20835
21194
  onToggle,
20836
21195
  disabled
20837
21196
  }) {
20838
- return /* @__PURE__ */ jsxs14(
21197
+ return /* @__PURE__ */ jsxs15(
20839
21198
  "button",
20840
21199
  {
20841
21200
  type: "button",
@@ -20854,7 +21213,7 @@ function TogglePill({
20854
21213
  border: "none",
20855
21214
  cursor: disabled ? "default" : "pointer",
20856
21215
  background: "#ffffff",
20857
- color: OHW_BLUE_DARK3,
21216
+ color: OHW_BLUE_DARK2,
20858
21217
  opacity: disabled ? 0.4 : 1,
20859
21218
  fontSize: 12,
20860
21219
  lineHeight: "16px",
@@ -20864,7 +21223,7 @@ function TogglePill({
20864
21223
  },
20865
21224
  children: [
20866
21225
  label,
20867
- /* @__PURE__ */ jsx23(
21226
+ /* @__PURE__ */ jsx24(
20868
21227
  "span",
20869
21228
  {
20870
21229
  "aria-hidden": true,
@@ -20877,10 +21236,10 @@ function TogglePill({
20877
21236
  // Off is a grey track, not a washed-out blue: the pill's own white background already
20878
21237
  // carries the brand colour in the text, and a pale blue track next to it read as
20879
21238
  // "disabled control" rather than "switch that is off".
20880
- background: on ? OHW_BLUE_DARK3 : "#CBD5E1",
21239
+ background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
20881
21240
  transition: "background 120ms ease"
20882
21241
  },
20883
- children: /* @__PURE__ */ jsx23(
21242
+ children: /* @__PURE__ */ jsx24(
20884
21243
  "span",
20885
21244
  {
20886
21245
  style: {
@@ -20909,7 +21268,7 @@ function CarouselSlideToolbar({
20909
21268
  onChangeImage,
20910
21269
  onToggleAutoplay
20911
21270
  }) {
20912
- return /* @__PURE__ */ jsxs14(
21271
+ return /* @__PURE__ */ jsxs15(
20913
21272
  "div",
20914
21273
  {
20915
21274
  "data-ohw-bridge": "",
@@ -20920,7 +21279,7 @@ function CarouselSlideToolbar({
20920
21279
  flexDirection: "column",
20921
21280
  gap: 6,
20922
21281
  alignItems: "center",
20923
- background: OHW_BLUE3,
21282
+ background: OHW_BLUE2,
20924
21283
  padding: 8,
20925
21284
  borderRadius: 12,
20926
21285
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -20932,11 +21291,11 @@ function CarouselSlideToolbar({
20932
21291
  pointerEvents: pending ? "none" : "auto"
20933
21292
  },
20934
21293
  children: [
20935
- /* @__PURE__ */ jsxs14("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
20936
- /* @__PURE__ */ jsx23(Pill3, { label: "Change Image", onClick: onChangeImage }),
20937
- /* @__PURE__ */ jsx23(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
21294
+ /* @__PURE__ */ jsxs15("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
21295
+ /* @__PURE__ */ jsx24(Pill2, { label: "Change Image", onClick: onChangeImage }),
21296
+ /* @__PURE__ */ jsx24(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
20938
21297
  ] }),
20939
- error && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
21298
+ error && /* @__PURE__ */ jsx24("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20940
21299
  ]
20941
21300
  }
20942
21301
  );
@@ -21076,8 +21435,8 @@ function AiFadeCarouselOverlay({
21076
21435
  const activeItemRect = useLiveItemRect2(active);
21077
21436
  const TOOLBAR_APPROX_H = 90;
21078
21437
  const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
21079
- return /* @__PURE__ */ jsxs14(Fragment10, { children: [
21080
- hoverHandleRect && hover && /* @__PURE__ */ jsx23(
21438
+ return /* @__PURE__ */ jsxs15(Fragment10, { children: [
21439
+ hoverHandleRect && hover && /* @__PURE__ */ jsx24(
21081
21440
  "button",
21082
21441
  {
21083
21442
  type: "button",
@@ -21106,10 +21465,10 @@ function AiFadeCarouselOverlay({
21106
21465
  fontSize: 14,
21107
21466
  fontWeight: 700
21108
21467
  },
21109
- children: /* @__PURE__ */ jsx23(Star4, { size: 14, style: { pointerEvents: "none" } })
21468
+ children: /* @__PURE__ */ jsx24(Star4, { size: 14, style: { pointerEvents: "none" } })
21110
21469
  }
21111
21470
  ),
21112
- swapping && /* @__PURE__ */ jsx23(
21471
+ swapping && /* @__PURE__ */ jsx24(
21113
21472
  "div",
21114
21473
  {
21115
21474
  ref: skeletonRef,
@@ -21127,15 +21486,15 @@ function AiFadeCarouselOverlay({
21127
21486
  zIndex: 2147483646,
21128
21487
  pointerEvents: "none"
21129
21488
  },
21130
- children: /* @__PURE__ */ jsx23("style", { children: MEDIA_SKELETON_CSS })
21489
+ children: /* @__PURE__ */ jsx24("style", { children: MEDIA_SKELETON_CSS })
21131
21490
  }
21132
21491
  ),
21133
- activeItemRect && active && activeEntry && /* @__PURE__ */ jsx23(
21492
+ activeItemRect && active && activeEntry && /* @__PURE__ */ jsx24(
21134
21493
  ItemInteractionLayer,
21135
21494
  {
21136
21495
  rect: activeItemRect,
21137
21496
  state: toolbarState,
21138
- toolbar: /* @__PURE__ */ jsx23(
21497
+ toolbar: /* @__PURE__ */ jsx24(
21139
21498
  CarouselSlideToolbar,
21140
21499
  {
21141
21500
  pending,
@@ -21326,118 +21685,11 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
21326
21685
  // src/ui/link-modal/LinkPopover.tsx
21327
21686
  import { useEffect as useEffect16 } from "react";
21328
21687
 
21329
- // src/ui/dialog.tsx
21330
- import * as React9 from "react";
21331
- import { Dialog as DialogPrimitive } from "radix-ui";
21332
- import { X as X2 } from "lucide-react";
21333
- import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
21334
- function Dialog2({
21335
- ...props
21336
- }) {
21337
- return /* @__PURE__ */ jsx24(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
21338
- }
21339
- function DialogPortal({
21340
- ...props
21341
- }) {
21342
- return /* @__PURE__ */ jsx24(DialogPrimitive.Portal, { ...props });
21343
- }
21344
- function DialogOverlay({
21345
- className,
21346
- ...props
21347
- }) {
21348
- return /* @__PURE__ */ jsx24(
21349
- DialogPrimitive.Overlay,
21350
- {
21351
- "data-slot": "dialog-overlay",
21352
- "data-ohw-link-modal-root": "",
21353
- className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
21354
- ...props
21355
- }
21356
- );
21357
- }
21358
- var DialogContent = React9.forwardRef(
21359
- ({ className, children, showCloseButton = true, container, ...props }, ref) => {
21360
- const positionMode = container ? "absolute" : "fixed";
21361
- return /* @__PURE__ */ jsxs15(DialogPortal, { container: container ?? void 0, children: [
21362
- /* @__PURE__ */ jsx24(DialogOverlay, { className: cn(positionMode, "inset-0") }),
21363
- /* @__PURE__ */ jsxs15(
21364
- DialogPrimitive.Content,
21365
- {
21366
- ref,
21367
- "data-slot": "dialog-content",
21368
- className: cn(
21369
- positionMode,
21370
- "left-1/2 top-1/2 z-[2147483647] flex w-full max-w-[448px] -translate-x-1/2 -translate-y-1/2 flex-col overflow-visible",
21371
- "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
21372
- container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
21373
- className
21374
- ),
21375
- onMouseDown: (e) => e.stopPropagation(),
21376
- ...props,
21377
- children: [
21378
- children,
21379
- showCloseButton ? /* @__PURE__ */ jsx24(
21380
- DialogPrimitive.Close,
21381
- {
21382
- type: "button",
21383
- className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
21384
- "aria-label": "Close",
21385
- children: /* @__PURE__ */ jsx24(X2, { size: 16, "aria-hidden": true })
21386
- }
21387
- ) : null
21388
- ]
21389
- }
21390
- )
21391
- ] });
21392
- }
21393
- );
21394
- DialogContent.displayName = DialogPrimitive.Content.displayName;
21395
- function DialogHeader({
21396
- className,
21397
- ...props
21398
- }) {
21399
- return /* @__PURE__ */ jsx24("div", { className: cn("flex flex-col gap-1.5", className), ...props });
21400
- }
21401
- function DialogFooter({
21402
- className,
21403
- ...props
21404
- }) {
21405
- return /* @__PURE__ */ jsx24(
21406
- "div",
21407
- {
21408
- className: cn("flex items-center justify-end gap-2", className),
21409
- ...props
21410
- }
21411
- );
21412
- }
21413
- var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
21414
- DialogPrimitive.Title,
21415
- {
21416
- ref,
21417
- className: cn(
21418
- "text-lg font-semibold leading-none tracking-tight text-card-foreground",
21419
- className
21420
- ),
21421
- ...props
21422
- }
21423
- ));
21424
- DialogTitle.displayName = DialogPrimitive.Title.displayName;
21425
- var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
21426
- DialogPrimitive.Description,
21427
- {
21428
- ref,
21429
- className: cn("text-sm text-muted-foreground", className),
21430
- ...props
21431
- }
21432
- ));
21433
- DialogDescription.displayName = DialogPrimitive.Description.displayName;
21434
- var DialogClose = DialogPrimitive.Close;
21435
-
21436
21688
  // src/ui/link-modal/LinkEditorPanel.tsx
21437
21689
  import { Info, X as X4 } from "lucide-react";
21438
21690
 
21439
21691
  // src/ui/link-modal/DestinationBreadcrumb.tsx
21440
- import { ArrowRight as ArrowRight2, File, GalleryVertical } from "lucide-react";
21692
+ import { ArrowRight as ArrowRight3, File, GalleryVertical } from "lucide-react";
21441
21693
  import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
21442
21694
  function DestinationBreadcrumb({
21443
21695
  pageTitle,
@@ -21451,7 +21703,7 @@ function DestinationBreadcrumb({
21451
21703
  /* @__PURE__ */ jsx25("span", { className: "text-sm font-medium leading-none text-foreground!", children: pageTitle })
21452
21704
  ] }),
21453
21705
  /* @__PURE__ */ jsx25(
21454
- ArrowRight2,
21706
+ ArrowRight3,
21455
21707
  {
21456
21708
  size: 16,
21457
21709
  className: "shrink-0 text-muted-foreground",
@@ -21563,7 +21815,7 @@ function Label({ className, ...props }) {
21563
21815
  }
21564
21816
 
21565
21817
  // src/ui/link-modal/UrlOrPageInput.tsx
21566
- import { ChevronDown as ChevronDown4, File as File2, X as X3 } from "lucide-react";
21818
+ import { ChevronDown as ChevronDown5, File as File2, X as X3 } from "lucide-react";
21567
21819
  import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
21568
21820
  function FieldChevron({
21569
21821
  onClick
@@ -21576,7 +21828,7 @@ function FieldChevron({
21576
21828
  onClick,
21577
21829
  "aria-label": "Open page list",
21578
21830
  tabIndex: -1,
21579
- children: /* @__PURE__ */ jsx29(ChevronDown4, { size: 16 })
21831
+ children: /* @__PURE__ */ jsx29(ChevronDown5, { size: 16 })
21580
21832
  }
21581
21833
  );
21582
21834
  }
@@ -21806,7 +22058,7 @@ function LinkEditorPanel({ state, onClose }) {
21806
22058
  // src/ui/link-modal/SectionPickerOverlay.tsx
21807
22059
  import { useCallback as useCallback7, useEffect as useEffect14, useMemo as useMemo2, useRef as useRef10, useState as useState13 } from "react";
21808
22060
  import { createPortal as createPortal2 } from "react-dom";
21809
- import { ArrowLeft as ArrowLeft2, Check as Check3 } from "lucide-react";
22061
+ import { ArrowLeft as ArrowLeft3, Check as Check4 } from "lucide-react";
21810
22062
  import { usePathname as usePathname2, useRouter as useRouter2 } from "next/navigation";
21811
22063
 
21812
22064
  // src/lib/parent-scroll.ts
@@ -22083,7 +22335,7 @@ function SectionPickerOverlay({
22083
22335
  className: "h-8 min-w-0 gap-1 border-border bg-background px-2 py-1.5 shadow-sm hover:bg-muted cursor-pointer",
22084
22336
  onClick: onBack,
22085
22337
  children: [
22086
- /* @__PURE__ */ jsx31(ArrowLeft2, { className: "size-4 shrink-0", "aria-hidden": true }),
22338
+ /* @__PURE__ */ jsx31(ArrowLeft3, { className: "size-4 shrink-0", "aria-hidden": true }),
22087
22339
  "Back"
22088
22340
  ]
22089
22341
  }
@@ -22152,7 +22404,7 @@ function SectionPickerOverlay({
22152
22404
  className: "absolute right-3 top-3 flex size-8 items-center justify-center rounded-full text-white",
22153
22405
  style: { backgroundColor: "var(--ohw-primary, #0885fe)" },
22154
22406
  "aria-hidden": true,
22155
- children: /* @__PURE__ */ jsx31(Check3, { className: "size-5" })
22407
+ children: /* @__PURE__ */ jsx31(Check4, { className: "size-5" })
22156
22408
  }
22157
22409
  ) : null
22158
22410
  ]
@@ -22536,6 +22788,7 @@ function shouldUseDevFixtures() {
22536
22788
  function getLogoElement(el) {
22537
22789
  const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
22538
22790
  if (marked) return marked;
22791
+ if (el.closest('[data-ohw-editable="icon"]')) return null;
22539
22792
  const root = el.closest("nav, [data-ohw-nav-root], footer");
22540
22793
  if (!root) return null;
22541
22794
  const anchor = el.closest("a");
@@ -22605,7 +22858,7 @@ function addFooterColumnWithPersist({
22605
22858
  import {
22606
22859
  useCallback as useCallback9,
22607
22860
  useEffect as useEffect17,
22608
- useLayoutEffect as useLayoutEffect5,
22861
+ useLayoutEffect as useLayoutEffect6,
22609
22862
  useRef as useRef11,
22610
22863
  useState as useState15
22611
22864
  } from "react";
@@ -22702,7 +22955,7 @@ function FloatingPanel({
22702
22955
  return () => window.removeEventListener("message", onParentScroll);
22703
22956
  }, [open]);
22704
22957
  const positionRef = useRef11(position);
22705
- useLayoutEffect5(() => {
22958
+ useLayoutEffect6(() => {
22706
22959
  if (!open) {
22707
22960
  positionRef.current = position;
22708
22961
  return;
@@ -22712,7 +22965,7 @@ function FloatingPanel({
22712
22965
  }
22713
22966
  positionRef.current = position;
22714
22967
  }, [open, position, liveScroll, parentScroll]);
22715
- useLayoutEffect5(() => {
22968
+ useLayoutEffect6(() => {
22716
22969
  if (!open || !panelRef.current) return;
22717
22970
  const el = panelRef.current;
22718
22971
  const header = el.querySelector("[data-ohw-floating-panel-header]");
@@ -22921,7 +23174,7 @@ function SocialsDisplayPanel({ display, onChange, className }) {
22921
23174
  }
22922
23175
 
22923
23176
  // src/ui/button-style-panel.tsx
22924
- import { Check as Check4 } from "lucide-react";
23177
+ import { Check as Check5 } from "lucide-react";
22925
23178
  import { jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
22926
23179
  var SIZE_LABEL = { s: "S", m: "M", l: "L" };
22927
23180
  function ButtonStylePanel({
@@ -22992,7 +23245,7 @@ function ButtonStylePanel({
22992
23245
  {
22993
23246
  className: "absolute right-0.5 top-0.5 flex size-5 items-center justify-center rounded-full bg-primary text-primary-foreground",
22994
23247
  "aria-hidden": true,
22995
- children: /* @__PURE__ */ jsx35(Check4, { className: "size-3", strokeWidth: 3 })
23248
+ children: /* @__PURE__ */ jsx35(Check5, { className: "size-3", strokeWidth: 3 })
22996
23249
  }
22997
23250
  ) : null
22998
23251
  ]
@@ -23878,12 +24131,19 @@ function useSectionDrag({
23878
24131
  clearSectionDragVisuals();
23879
24132
  return;
23880
24133
  }
24134
+ const previous = orderBeforeMove(editContentRef.current[SECTION_ORDER_KEY], window.location.pathname);
23881
24135
  const orderJson = JSON.stringify(
23882
24136
  mergePageSectionOrder(editContentRef.current[SECTION_ORDER_KEY], window.location.pathname, entries)
23883
24137
  );
23884
24138
  editContentRef.current = { ...editContentRef.current, [SECTION_ORDER_KEY]: orderJson };
23885
24139
  setAiSectionOrder(orderJson, window.location.pathname);
23886
- postToParentRef.current({ type: "ow:change", nodes: [{ key: SECTION_ORDER_KEY, text: orderJson }] });
24140
+ postToParentRef.current({
24141
+ type: "ow:change",
24142
+ nodes: [{ key: SECTION_ORDER_KEY, text: orderJson }],
24143
+ previous: { [SECTION_ORDER_KEY]: previous },
24144
+ // Undo scrolls to this section; a one-place move swaps two, so the order alone can't say which.
24145
+ moved: session.instanceId
24146
+ });
23887
24147
  applyPersistedOrder(getPageSectionOrderEntries(orderJson, window.location.pathname));
23888
24148
  clearSectionDragVisuals();
23889
24149
  requestAnimationFrame(() => {
@@ -24017,7 +24277,7 @@ function useSectionDrag({
24017
24277
  }
24018
24278
 
24019
24279
  // src/ui/footer-container-chrome.tsx
24020
- import { Plus as Plus3 } from "lucide-react";
24280
+ import { Plus as Plus4 } from "lucide-react";
24021
24281
  import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
24022
24282
  function FooterContainerChrome({
24023
24283
  rect,
@@ -24058,7 +24318,7 @@ function FooterContainerChrome({
24058
24318
  if (addDisabled) return;
24059
24319
  onAdd();
24060
24320
  },
24061
- children: /* @__PURE__ */ jsx36(Plus3, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24321
+ children: /* @__PURE__ */ jsx36(Plus4, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24062
24322
  }
24063
24323
  ) }),
24064
24324
  /* @__PURE__ */ jsx36(TooltipContent, { side: "bottom", sideOffset: 9, children: addDisabled ? "Maximum columns reached" : "Add item" })
@@ -24465,7 +24725,7 @@ function retargetPageLinks(change, deps) {
24465
24725
  }
24466
24726
 
24467
24727
  // src/ui/navbar-container-chrome.tsx
24468
- import { Plus as Plus4 } from "lucide-react";
24728
+ import { Plus as Plus5 } from "lucide-react";
24469
24729
  import { jsx as jsx37 } from "react/jsx-runtime";
24470
24730
  function NavbarContainerChrome({
24471
24731
  rect,
@@ -24501,7 +24761,7 @@ function NavbarContainerChrome({
24501
24761
  e.stopPropagation();
24502
24762
  onAdd();
24503
24763
  },
24504
- children: /* @__PURE__ */ jsx37(Plus4, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24764
+ children: /* @__PURE__ */ jsx37(Plus5, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24505
24765
  }
24506
24766
  )
24507
24767
  }
@@ -24573,7 +24833,7 @@ function Badge({ className, variant, ...props }) {
24573
24833
  }
24574
24834
 
24575
24835
  // src/OhhwellsBridge.tsx
24576
- import { Brush as Brush2, Link as Link2, Plus as Plus5, Settings } from "lucide-react";
24836
+ import { Brush as Brush2, Link as Link2, Plus as Plus6, Settings } from "lucide-react";
24577
24837
  import { Fragment as Fragment13, jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
24578
24838
  var PRIMARY7 = "#0885FE";
24579
24839
  var IMAGE_FADE_MS = 300;
@@ -25351,7 +25611,7 @@ function getNavigationSelectionParent(el) {
25351
25611
  if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
25352
25612
  return resolveFooterLinksContainerFrom(el);
25353
25613
  }
25354
- if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
25614
+ 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)) {
25355
25615
  return getNavigationRoot(el);
25356
25616
  }
25357
25617
  return null;
@@ -25573,7 +25833,6 @@ var ICONS = {
25573
25833
  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"/>',
25574
25834
  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"/>'
25575
25835
  };
25576
- var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
25577
25836
  var SELECTION_CHROME_GAP2 = 4;
25578
25837
  var TOOLBAR_STROKE_GAP2 = 4;
25579
25838
  var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
@@ -25671,7 +25930,7 @@ function applyVisibleViewport(el, parentScroll) {
25671
25930
  el.style.top = `${top}px`;
25672
25931
  el.style.height = `${height}px`;
25673
25932
  }
25674
- var TOOLBAR_EDGE_MARGIN3 = 4;
25933
+ var TOOLBAR_EDGE_MARGIN4 = 4;
25675
25934
  function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
25676
25935
  const isAbove = transform.includes("translateY(-100%)");
25677
25936
  let visualTop = isAbove ? top - approxH : top;
@@ -25698,8 +25957,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
25698
25957
  function clampToolbarLeft(centerX, toolbarWidth) {
25699
25958
  const half = toolbarWidth / 2;
25700
25959
  return Math.max(
25701
- TOOLBAR_EDGE_MARGIN3 + half,
25702
- Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half)
25960
+ TOOLBAR_EDGE_MARGIN4 + half,
25961
+ Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
25703
25962
  );
25704
25963
  }
25705
25964
  function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
@@ -26100,7 +26359,7 @@ function OhhwellsBridge() {
26100
26359
  }, []);
26101
26360
  const subdomainFromQuery = searchParams.get("subdomain");
26102
26361
  const [subdomain, setSubdomain] = useState18(() => resolveSubdomain(subdomainFromQuery));
26103
- useLayoutEffect6(() => {
26362
+ useLayoutEffect7(() => {
26104
26363
  const next = resolveSubdomain(subdomainFromQuery);
26105
26364
  if (next !== subdomain) setSubdomain(next);
26106
26365
  if (next) return;
@@ -26582,21 +26841,6 @@ function OhhwellsBridge() {
26582
26841
  const [isItemDragging, setIsItemDragging] = useState18(false);
26583
26842
  const [isFooterFrameSelection, setIsFooterFrameSelection] = useState18(false);
26584
26843
  isFooterFrameSelectionRef.current = isFooterFrameSelection;
26585
- const [floatingPanel, setFloatingPanel] = useState18(null);
26586
- const floatingPanelOpenRef = useRef14(false);
26587
- floatingPanelOpenRef.current = floatingPanel !== null;
26588
- const floatingPanelRef = useRef14(null);
26589
- floatingPanelRef.current = floatingPanel;
26590
- const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
26591
- const buttonCollectionDragRef = useRef14(null);
26592
- const buttonDropInsertIndexRef = useRef14(null);
26593
- const [buttonDropSlots, setButtonDropSlots] = useState18([]);
26594
- const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
26595
- const buttonPointerDragRef = useRef14(null);
26596
- const [buttonStyleTick, setButtonStyleTick] = useState18(0);
26597
- const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
26598
- const [editorViewport, setEditorViewport] = useState18("desktop");
26599
- const [parentScrollSnap, setParentScrollSnap] = useState18(null);
26600
26844
  const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = useState18(null);
26601
26845
  const [footerHeadingVisible, setFooterHeadingVisible] = useState18(null);
26602
26846
  const footerDragRef = useRef14(null);
@@ -26623,6 +26867,21 @@ function OhhwellsBridge() {
26623
26867
  const stylesRef = useRef14("");
26624
26868
  const appliedDrawerRef = useRef14(null);
26625
26869
  const pendingDeleteUndoRef = useRef14(null);
26870
+ const [floatingPanel, setFloatingPanel] = useState18(null);
26871
+ const floatingPanelOpenRef = useRef14(false);
26872
+ const floatingPanelRef = useRef14(null);
26873
+ floatingPanelRef.current = floatingPanel;
26874
+ const setFloatingPanelRef = useRef14(setFloatingPanel);
26875
+ const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
26876
+ const buttonCollectionDragRef = useRef14(null);
26877
+ const buttonDropInsertIndexRef = useRef14(null);
26878
+ const [buttonDropSlots, setButtonDropSlots] = useState18([]);
26879
+ const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
26880
+ const buttonPointerDragRef = useRef14(null);
26881
+ const [buttonStyleTick, setButtonStyleTick] = useState18(0);
26882
+ const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
26883
+ const [editorViewport, setEditorViewport] = useState18("desktop");
26884
+ const [parentScrollSnap, setParentScrollSnap] = useState18(null);
26626
26885
  const [sitePages, setSitePages] = useState18([]);
26627
26886
  const collectionItemsRef = useRef14(/* @__PURE__ */ new Map());
26628
26887
  const [sectionsByPath, setSectionsByPath] = useState18({});
@@ -26632,7 +26891,18 @@ function OhhwellsBridge() {
26632
26891
  const linkPopoverOpenRef = useRef14(false);
26633
26892
  const linkPopoverGraceUntilRef = useRef14(0);
26634
26893
  setLinkPopoverRef.current = setLinkPopover;
26894
+ setFloatingPanelRef.current = setFloatingPanel;
26635
26895
  linkPopoverSessionRef.current = linkPopover;
26896
+ floatingPanelOpenRef.current = Boolean(floatingPanel);
26897
+ useEffect21(() => {
26898
+ const syncViewport = () => {
26899
+ const next = window.innerWidth <= 480 ? "mobile" : "desktop";
26900
+ setEditorViewport((prev) => prev === next ? prev : next);
26901
+ };
26902
+ syncViewport();
26903
+ window.addEventListener("resize", syncViewport);
26904
+ return () => window.removeEventListener("resize", syncViewport);
26905
+ }, []);
26636
26906
  useEffect21(() => {
26637
26907
  setSectionOrderPersistHandler((entries) => {
26638
26908
  const currentPath = window.location.pathname;
@@ -28339,7 +28609,7 @@ function OhhwellsBridge() {
28339
28609
  isFooterFrameSelection,
28340
28610
  postToParent2
28341
28611
  ]);
28342
- useLayoutEffect6(() => {
28612
+ useLayoutEffect7(() => {
28343
28613
  if (!subdomain || isEditMode) {
28344
28614
  setFetchState("done");
28345
28615
  return;
@@ -28366,6 +28636,7 @@ function OhhwellsBridge() {
28366
28636
  applyAiFooterFromContent(content);
28367
28637
  if (typeof content[STYLE_STORE_KEY] === "string") {
28368
28638
  stylesRef.current = content[STYLE_STORE_KEY];
28639
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28369
28640
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28370
28641
  }
28371
28642
  applyBrandChrome(content);
@@ -28376,15 +28647,16 @@ function OhhwellsBridge() {
28376
28647
  if (key === "__ohw_sections") continue;
28377
28648
  if (key === AI_SECTIONS_KEY) continue;
28378
28649
  if (key === AI_FOOTER_KEY) continue;
28650
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
28651
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28379
28652
  if (key === BRAND_KIT_KEY) continue;
28380
28653
  if (key === STYLE_STORE_KEY) continue;
28381
28654
  if (BRAND_CHROME_KEYS.has(key)) continue;
28382
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28383
28655
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
28384
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28385
28656
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28386
28657
  continue;
28387
28658
  }
28659
+ if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28388
28660
  if (applyVideoSettingNode(key, val)) continue;
28389
28661
  if (applyCarouselNode(key, val)) continue;
28390
28662
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28424,6 +28696,7 @@ function OhhwellsBridge() {
28424
28696
  });
28425
28697
  applyLinkByKey(key, val);
28426
28698
  }
28699
+ applySectionEmbeds(content);
28427
28700
  applyLogoFromContent(content);
28428
28701
  applyLogoSizes(content);
28429
28702
  reconcileNavbarItemsFromContent(content);
@@ -28612,20 +28885,22 @@ function OhhwellsBridge() {
28612
28885
  }
28613
28886
  applyAiFooterFromContent(content);
28614
28887
  if (typeof content[STYLE_STORE_KEY] === "string") {
28888
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28615
28889
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28616
28890
  }
28617
28891
  for (const [key, val] of Object.entries(content)) {
28618
28892
  if (key === "__ohw_sections") continue;
28619
28893
  if (key === AI_SECTIONS_KEY) continue;
28620
28894
  if (key === AI_FOOTER_KEY) continue;
28895
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
28896
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28621
28897
  if (key === BRAND_KIT_KEY) continue;
28622
28898
  if (key === STYLE_STORE_KEY) continue;
28623
28899
  if (BRAND_CHROME_KEYS.has(key)) continue;
28624
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28625
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28626
28900
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28627
28901
  continue;
28628
28902
  }
28903
+ if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28629
28904
  if (applyVideoSettingNode(key, val)) continue;
28630
28905
  if (applyCarouselNode(key, val)) continue;
28631
28906
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28650,6 +28925,7 @@ function OhhwellsBridge() {
28650
28925
  });
28651
28926
  applyLinkByKey(key, val);
28652
28927
  }
28928
+ applySectionEmbeds(content);
28653
28929
  applyLogoFromContent(content);
28654
28930
  reconcileNavbarItemsFromContent(content);
28655
28931
  reconcileFooterOrderFromContent(content);
@@ -28705,7 +28981,7 @@ function OhhwellsBridge() {
28705
28981
  if (debounceTimer) clearTimeout(debounceTimer);
28706
28982
  };
28707
28983
  }, [subdomain, isEditMode, pathname]);
28708
- useLayoutEffect6(() => {
28984
+ useLayoutEffect7(() => {
28709
28985
  const el = document.getElementById("ohw-loader");
28710
28986
  if (!el) return;
28711
28987
  const visible = Boolean(subdomain) && fetchState !== "done";
@@ -28889,26 +29165,11 @@ function OhhwellsBridge() {
28889
29165
  const t2 = setTimeout(measure, 500);
28890
29166
  const ro = new ResizeObserver(schedule);
28891
29167
  ro.observe(document.body);
28892
- let lastWidth = window.innerWidth;
28893
- let resizeTimers = [];
28894
- const clearResizeTimers = () => {
28895
- resizeTimers.forEach(clearTimeout);
28896
- resizeTimers = [];
28897
- };
28898
- const handleResize = () => {
28899
- if (window.innerWidth === lastWidth) return;
28900
- lastWidth = window.innerWidth;
28901
- clearResizeTimers();
28902
- resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
28903
- };
28904
- window.addEventListener("resize", handleResize);
28905
29168
  return () => {
28906
29169
  clearTimeout(t1);
28907
29170
  clearTimeout(t2);
28908
29171
  if (raf != null) cancelAnimationFrame(raf);
28909
29172
  ro.disconnect();
28910
- clearResizeTimers();
28911
- window.removeEventListener("resize", handleResize);
28912
29173
  };
28913
29174
  }, [pathname, isEditMode, postToParent2]);
28914
29175
  useEffect21(() => {
@@ -29205,6 +29466,13 @@ function OhhwellsBridge() {
29205
29466
  if (target.closest("[data-ohw-state-toggle]")) return;
29206
29467
  if (target.closest("[data-ohw-max-badge]")) return;
29207
29468
  if (isInsideLinkEditor(target)) return;
29469
+ if (isInsideFloatingPanel(target)) return;
29470
+ if (target.closest("[data-ohw-form-toolbar]")) return;
29471
+ if (target.closest(
29472
+ '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
29473
+ )) {
29474
+ return;
29475
+ }
29208
29476
  if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
29209
29477
  clearMediaSelectionRef.current();
29210
29478
  }
@@ -29228,8 +29496,6 @@ function OhhwellsBridge() {
29228
29496
  return;
29229
29497
  }
29230
29498
  }
29231
- if (isInsideFloatingPanel(target)) return;
29232
- if (target.closest("[data-ohw-form-toolbar]")) return;
29233
29499
  const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
29234
29500
  if (collectionItem) {
29235
29501
  e.preventDefault();
@@ -29241,11 +29507,6 @@ function OhhwellsBridge() {
29241
29507
  });
29242
29508
  return;
29243
29509
  }
29244
- if (target.closest(
29245
- '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
29246
- )) {
29247
- return;
29248
- }
29249
29510
  {
29250
29511
  const formEl = getFormElement(target);
29251
29512
  const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
@@ -29399,9 +29660,13 @@ function OhhwellsBridge() {
29399
29660
  if (isIconEditable(editable) && !getSocialItem(editable)) {
29400
29661
  e.preventDefault();
29401
29662
  e.stopPropagation();
29402
- selectIconElementRef.current(editable);
29403
29663
  const aiIcon = editable.hasAttribute("data-ai-icon");
29404
29664
  const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
29665
+ if (aiIcon) {
29666
+ aiSectionApiRef.current?.selectFromElement(editable);
29667
+ } else {
29668
+ selectIconElementRef.current(editable);
29669
+ }
29405
29670
  postToParentRef.current({
29406
29671
  type: "ow:icon-pick",
29407
29672
  key: editable.dataset.ohwKey ?? "",
@@ -29629,6 +29894,9 @@ function OhhwellsBridge() {
29629
29894
  setHoveredItemRect(null);
29630
29895
  hoveredNavContainerRef.current = null;
29631
29896
  setHoveredNavContainerRect(null);
29897
+ siblingHintElRef.current = null;
29898
+ setSiblingHintRect(null);
29899
+ setSiblingHintRects([]);
29632
29900
  return;
29633
29901
  }
29634
29902
  {
@@ -29749,7 +30017,6 @@ function OhhwellsBridge() {
29749
30017
  hoveredNavContainerRef.current = null;
29750
30018
  setHoveredNavContainerRect(null);
29751
30019
  hoveredItemElRef.current = editable;
29752
- setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
29753
30020
  }
29754
30021
  }
29755
30022
  }
@@ -30459,7 +30726,11 @@ function OhhwellsBridge() {
30459
30726
  };
30460
30727
  const handleMouseMove = (e) => {
30461
30728
  const { clientX, clientY } = e;
30462
- if (pointOwnedByFloatingPanel(clientX, clientY)) return;
30729
+ if (pointOwnedByFloatingPanel(clientX, clientY)) {
30730
+ dismissImageHover();
30731
+ clearImageHover();
30732
+ return;
30733
+ }
30463
30734
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
30464
30735
  document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
30465
30736
  formHoverElRef.current = null;
@@ -30488,7 +30759,12 @@ function OhhwellsBridge() {
30488
30759
  setHoveredItemRect(null);
30489
30760
  hoveredNavContainerRef.current = null;
30490
30761
  setHoveredNavContainerRect(null);
30762
+ siblingHintElRef.current = null;
30763
+ setSiblingHintRect(null);
30764
+ setSiblingHintRects([]);
30491
30765
  dismissImageHover();
30766
+ clearImageHover();
30767
+ setSectionGap(null);
30492
30768
  return;
30493
30769
  }
30494
30770
  if (probeSocialsRowAt(clientX, clientY)) return;
@@ -30500,7 +30776,11 @@ function OhhwellsBridge() {
30500
30776
  if (e.data?.type !== "ow:pointer-sync") return;
30501
30777
  const { clientX, clientY } = e.data;
30502
30778
  if (typeof clientX !== "number" || typeof clientY !== "number") return;
30503
- if (pointOwnedByFloatingPanel(clientX, clientY)) return;
30779
+ if (pointOwnedByFloatingPanel(clientX, clientY)) {
30780
+ dismissImageHover();
30781
+ clearImageHover();
30782
+ return;
30783
+ }
30504
30784
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
30505
30785
  if (probeSocialsRowAt(clientX, clientY)) return;
30506
30786
  probeSectionGapAt(clientX, clientY);
@@ -30880,6 +31160,7 @@ function OhhwellsBridge() {
30880
31160
  applyAiFooterFromContent(content);
30881
31161
  if (typeof content[STYLE_STORE_KEY] === "string") {
30882
31162
  stylesRef.current = content[STYLE_STORE_KEY];
31163
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
30883
31164
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
30884
31165
  }
30885
31166
  applyBrandChrome(content);
@@ -30894,15 +31175,16 @@ function OhhwellsBridge() {
30894
31175
  }
30895
31176
  if (key === AI_SECTIONS_KEY) continue;
30896
31177
  if (key === AI_FOOTER_KEY) continue;
31178
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
31179
+ if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
30897
31180
  if (key === BRAND_KIT_KEY) continue;
30898
31181
  if (key === STYLE_STORE_KEY) continue;
30899
31182
  if (BRAND_CHROME_KEYS.has(key)) continue;
30900
- if (key === LOGO_PLACEHOLDER_KEY) continue;
30901
31183
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
30902
- if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
30903
31184
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
30904
31185
  continue;
30905
31186
  }
31187
+ if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
30906
31188
  if (applyVideoSettingNode(key, val)) continue;
30907
31189
  if (applyCarouselNode(key, val)) continue;
30908
31190
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -30928,6 +31210,7 @@ function OhhwellsBridge() {
30928
31210
  });
30929
31211
  applyLinkByKey(key, val);
30930
31212
  }
31213
+ applySectionEmbeds(content);
30931
31214
  applyLogoFromContent(content);
30932
31215
  applyLogoSizes(content);
30933
31216
  document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
@@ -31373,6 +31656,7 @@ function OhhwellsBridge() {
31373
31656
  const instanceId = typeof e.data.instanceId === "string" ? e.data.instanceId : "";
31374
31657
  const direction = e.data.direction === "up" || e.data.direction === "down" ? e.data.direction : null;
31375
31658
  if (!instanceId || !direction) return;
31659
+ const previous = orderBeforeMove(editContentRef.current[SECTION_ORDER_KEY], window.location.pathname);
31376
31660
  const entries = moveSectionInstance(instanceId, direction, window.location.pathname);
31377
31661
  if (!entries) return;
31378
31662
  const orderJson = JSON.stringify(
@@ -31381,7 +31665,12 @@ function OhhwellsBridge() {
31381
31665
  editContentRef.current = { ...editContentRef.current, [SECTION_ORDER_KEY]: orderJson };
31382
31666
  applyPersistedOrder(getPageSectionOrderEntries(orderJson, window.location.pathname));
31383
31667
  setAiSectionOrder(orderJson, window.location.pathname);
31384
- postToParentRef.current({ type: "ow:change", nodes: [{ key: SECTION_ORDER_KEY, text: orderJson }] });
31668
+ postToParentRef.current({
31669
+ type: "ow:change",
31670
+ nodes: [{ key: SECTION_ORDER_KEY, text: orderJson }],
31671
+ previous: { [SECTION_ORDER_KEY]: previous },
31672
+ moved: instanceId
31673
+ });
31385
31674
  window.dispatchEvent(new Event("resize"));
31386
31675
  };
31387
31676
  window.addEventListener("message", handleMoveSection);
@@ -31560,6 +31849,12 @@ function OhhwellsBridge() {
31560
31849
  closeLinkPopoverRef.current();
31561
31850
  return;
31562
31851
  }
31852
+ if (floatingPanelOpenRef.current) {
31853
+ setFloatingPanelRef.current(null);
31854
+ deselectRef.current();
31855
+ deactivateRef.current();
31856
+ return;
31857
+ }
31563
31858
  deselectRef.current();
31564
31859
  deactivateRef.current();
31565
31860
  clearMediaSelectionRef.current();
@@ -31744,12 +32039,6 @@ function OhhwellsBridge() {
31744
32039
  return;
31745
32040
  }
31746
32041
  }
31747
- if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "z" && !activeElRef.current) {
31748
- if (runPendingDeleteUndoRef.current()) {
31749
- e.preventDefault();
31750
- return;
31751
- }
31752
- }
31753
32042
  if (e.key !== "Escape") return;
31754
32043
  const el = activeElRef.current;
31755
32044
  if (el && originalContentRef.current !== null) {
@@ -32396,10 +32685,10 @@ function OhhwellsBridge() {
32396
32685
  window.removeEventListener("message", handleDuplicateSection);
32397
32686
  window.removeEventListener("message", handleDeactivate);
32398
32687
  window.removeEventListener("message", handleSelectNav);
32399
- document.documentElement.removeAttribute("data-ohw-panel-dragging");
32400
32688
  window.removeEventListener("message", handleToastAction);
32401
32689
  window.removeEventListener("message", handleFormCount);
32402
32690
  window.removeEventListener("message", handleUiEscape);
32691
+ document.documentElement.removeAttribute("data-ohw-panel-dragging");
32403
32692
  autoSaveTimers.current.forEach(clearTimeout);
32404
32693
  autoSaveTimers.current.clear();
32405
32694
  if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
@@ -32693,7 +32982,7 @@ function OhhwellsBridge() {
32693
32982
  postToParent2({
32694
32983
  type: "ow:ready",
32695
32984
  version: "1",
32696
- bridgeVersion: "0.1.168",
32985
+ bridgeVersion: "0.1.169-next.448",
32697
32986
  path: pathname,
32698
32987
  nodes: collectEditableNodes(editContentRef.current),
32699
32988
  sections
@@ -33428,7 +33717,7 @@ function OhhwellsBridge() {
33428
33717
  className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/80",
33429
33718
  onClick: () => setFieldTypePickerOpen((open) => !open),
33430
33719
  "data-ohw-add-field": "",
33431
- children: /* @__PURE__ */ jsx40(Plus5, { size: 15, "aria-hidden": true })
33720
+ children: /* @__PURE__ */ jsx40(Plus6, { size: 15, "aria-hidden": true })
33432
33721
  }
33433
33722
  ),
33434
33723
  /* @__PURE__ */ jsx40("div", { className: "mx-0.5 h-5 w-px bg-border" }),