@ohhwells/bridge 0.1.171 → 0.1.172-next.456

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -53,6 +53,7 @@ __export(index_exports, {
53
53
  FOOTER_COLUMN_BLOCKS: () => FOOTER_COLUMN_BLOCKS,
54
54
  FOOTER_COLUMN_SPANS: () => FOOTER_COLUMN_SPANS,
55
55
  FOOTER_SOCIAL_PLATFORMS: () => FOOTER_SOCIAL_PLATFORMS,
56
+ HIDDEN_EDITABLES_KEY: () => HIDDEN_EDITABLES_KEY,
56
57
  ItemActionToolbar: () => ItemActionToolbar,
57
58
  ItemInteractionLayer: () => ItemInteractionLayer,
58
59
  LinkEditorPanel: () => LinkEditorPanel,
@@ -75,9 +76,14 @@ __export(index_exports, {
75
76
  addFooterLinkColumn: () => addFooterLinkColumn,
76
77
  appendFooterSocial: () => appendFooterSocial,
77
78
  applyBrandChrome: () => applyBrandChrome,
79
+ applyHiddenEditablesToDom: () => applyHiddenEditablesToDom,
78
80
  applyStickySearchParams: () => applyStickySearchParams,
81
+ blockPathFromEditKey: () => blockPathFromEditKey,
79
82
  buildDefaultFooterTree: () => buildDefaultFooterTree,
80
83
  buildTarget: () => buildTarget,
84
+ canRemoveAiBlock: () => canRemoveAiBlock,
85
+ canRemoveAiTextBlock: () => canRemoveAiTextBlock,
86
+ canSoftHideEditable: () => canSoftHideEditable,
81
87
  dropIndicatorVariants: () => dropIndicatorVariants,
82
88
  ensureFooterTree: () => ensureFooterTree,
83
89
  filterAvailablePages: () => filterAvailablePages,
@@ -88,6 +94,7 @@ __export(index_exports, {
88
94
  insertFooterHours: () => insertFooterHours,
89
95
  isDeadPageHref: () => isDeadPageHref,
90
96
  isEditSessionActive: () => isEditSessionActive,
97
+ isEditableKeyHidden: () => isEditableKeyHidden,
91
98
  isPlainLeftClick: () => isPlainLeftClick,
92
99
  isRenderableFooterTree: () => isRenderableFooterTree,
93
100
  isRenderableTree: () => isRenderableTree,
@@ -98,15 +105,22 @@ __export(index_exports, {
98
105
  parseAiFooterState: () => parseAiFooterState,
99
106
  parseAiSectionsState: () => parseAiSectionsState,
100
107
  parseTarget: () => parseTarget,
108
+ planAiBlockRemoval: () => planAiBlockRemoval,
109
+ planAiTextBlockRemoval: () => planAiTextBlockRemoval,
101
110
  planBuildPageSync: () => planBuildPageSync,
111
+ readHiddenEditables: () => readHiddenEditables,
102
112
  recordOverriddenPaths: () => recordOverriddenPaths,
103
113
  releaseTemplateLogoIfReplaced: () => releaseTemplateLogoIfReplaced,
114
+ removeBlockAtPath: () => removeBlockAtPath,
104
115
  removeFooterBlock: () => removeFooterBlock,
105
116
  resetOverriddenPathsCache: () => resetOverriddenPathsCache,
106
117
  resolveFooterCopyright: () => resolveFooterCopyright,
118
+ resolveSoftHideTarget: () => resolveSoftHideTarget,
107
119
  resolveStickyNavigation: () => resolveStickyNavigation,
108
120
  serializeAiFooterState: () => serializeAiFooterState,
109
121
  shouldFetchContentForPath: () => shouldFetchContentForPath,
122
+ softHideEditableInDom: () => softHideEditableInDom,
123
+ softUnhideEditableInDom: () => softUnhideEditableInDom,
110
124
  stepViableSlide: () => stepViableSlide,
111
125
  stripPlaceholderText: () => stripPlaceholderText,
112
126
  stripPlaceholders: () => stripPlaceholders,
@@ -114,7 +128,9 @@ __export(index_exports, {
114
128
  toggleVariants: () => toggleVariants,
115
129
  useOhwCarousel: () => useOhwCarousel,
116
130
  validateUrlInput: () => validateUrlInput,
117
- viableSlides: () => viableSlides
131
+ viableSlides: () => viableSlides,
132
+ withHiddenEditable: () => withHiddenEditable,
133
+ withoutHiddenEditable: () => withoutHiddenEditable
118
134
  });
119
135
  module.exports = __toCommonJS(index_exports);
120
136
 
@@ -1245,21 +1261,21 @@ function chromeFrom(sample) {
1245
1261
  };
1246
1262
  }
1247
1263
  function filledPrimary(seed) {
1248
- const paint = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
1249
- const luminance = relativeLuminance(paint);
1264
+ const paint2 = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
1265
+ const luminance = relativeLuminance(paint2);
1250
1266
  return {
1251
- background: toCss({ ...paint, a: 1 }),
1267
+ background: toCss({ ...paint2, a: 1 }),
1252
1268
  color: luminance > 0.55 ? "rgb(15, 15, 15)" : "rgb(255, 255, 255)",
1253
1269
  borderColor: TRANSPARENT,
1254
1270
  borderWidth: "0px"
1255
1271
  };
1256
1272
  }
1257
1273
  function generatedSecondary(primary) {
1258
- const paint = accentColor(primary);
1274
+ const paint2 = accentColor(primary);
1259
1275
  return {
1260
1276
  background: TRANSPARENT,
1261
- color: paint,
1262
- borderColor: paint,
1277
+ color: paint2,
1278
+ borderColor: paint2,
1263
1279
  borderWidth: "1px"
1264
1280
  };
1265
1281
  }
@@ -1272,9 +1288,9 @@ function generatedGhost(primary) {
1272
1288
  };
1273
1289
  }
1274
1290
  function normalizeOutlineChrome(outline, primary) {
1275
- const paint = accentColor(primary);
1291
+ const paint2 = accentColor(primary);
1276
1292
  const text = parseColor(outline.color);
1277
- const paintRgb = parseColor(paint);
1293
+ const paintRgb = parseColor(paint2);
1278
1294
  const primaryLabel = parseColor(primary.color);
1279
1295
  const matchesOnPrimary = Boolean(text && primaryLabel) && colorKey(outline.color) === colorKey(primary.color);
1280
1296
  const textTooLight = text ? relativeLuminance(text) > 0.7 : false;
@@ -1283,8 +1299,8 @@ function normalizeOutlineChrome(outline, primary) {
1283
1299
  const hasBorder = parseFloat(outline.borderWidth) > 0;
1284
1300
  return {
1285
1301
  ...outline,
1286
- color: paint,
1287
- borderColor: hasBorder ? paint : outline.borderColor
1302
+ color: paint2,
1303
+ borderColor: hasBorder ? paint2 : outline.borderColor
1288
1304
  };
1289
1305
  }
1290
1306
  function generateButtonVariants(samples) {
@@ -5317,6 +5333,118 @@ function deleteNavbarItem(sourceAnchor) {
5317
5333
  };
5318
5334
  }
5319
5335
 
5336
+ // src/lib/hidden-editables.ts
5337
+ var HIDDEN_EDITABLES_KEY = "__ohw_hidden_editables";
5338
+ var HIDDEN_ATTR = "data-ohw-editable-hidden";
5339
+ var FORM_SELECTOR = '[data-ohw-editable="form"]';
5340
+ function parseJson3(raw) {
5341
+ if (!raw) return null;
5342
+ try {
5343
+ return JSON.parse(raw);
5344
+ } catch {
5345
+ return null;
5346
+ }
5347
+ }
5348
+ function readHiddenEditables(content) {
5349
+ const parsed = parseJson3(content?.[HIDDEN_EDITABLES_KEY]);
5350
+ if (!Array.isArray(parsed)) return [];
5351
+ return [...new Set(parsed.filter((key) => typeof key === "string" && key.length > 0))];
5352
+ }
5353
+ function isEditableKeyHidden(content, key) {
5354
+ if (!key) return false;
5355
+ return readHiddenEditables(content).includes(key);
5356
+ }
5357
+ function resolveSoftHideTarget(el) {
5358
+ const cta = el.closest(CTA_BUTTON_SELECTOR);
5359
+ if (cta) return cta;
5360
+ const form = el.closest(FORM_SELECTOR);
5361
+ if (form) return form;
5362
+ return el;
5363
+ }
5364
+ function canSoftHideEditable(el, opts) {
5365
+ if (!el) return false;
5366
+ const target = resolveSoftHideTarget(el);
5367
+ const key = target.dataset.ohwKey ?? el.dataset.ohwKey;
5368
+ if (!key) return false;
5369
+ if (key.startsWith("ai.")) return false;
5370
+ if (key.startsWith("__ohw_")) return false;
5371
+ if (el.hasAttribute("data-ohw-section") || target.hasAttribute("data-ohw-section")) return false;
5372
+ if (el.closest("[data-ohw-social-item]")) return false;
5373
+ if (target.matches(FORM_SELECTOR) || el.dataset.ohwEditable === "form") return true;
5374
+ const cta = el.closest(CTA_BUTTON_SELECTOR);
5375
+ if (cta) return !isLastNavbarButton(cta);
5376
+ if (opts?.isNavFooterItem) return false;
5377
+ if (el.closest("[data-ohw-nav-container], [data-ohw-nav-drawer], [data-ohw-nav-root], nav")) {
5378
+ if (el.closest("[data-ohw-href-key], [data-ohw-nav-item], [data-ohw-nav-group]")) return false;
5379
+ }
5380
+ if (el.closest("footer, [data-ai-footer]")) {
5381
+ if (el.closest("[data-ohw-href-key], [data-ohw-footer-item], [data-ohw-social-item]")) return false;
5382
+ }
5383
+ const kind = el.dataset.ohwEditable;
5384
+ return kind === "text" || kind === "plain" || kind === "image" || kind === "bg-image" || kind === "video" || kind === "icon" || kind === "link" || kind === "map";
5385
+ }
5386
+ function withHiddenEditable(content, key) {
5387
+ const hidden = readHiddenEditables(content);
5388
+ if (hidden.includes(key)) {
5389
+ return {
5390
+ content,
5391
+ nodes: [{ key: HIDDEN_EDITABLES_KEY, text: content[HIDDEN_EDITABLES_KEY] ?? "[]" }],
5392
+ added: false
5393
+ };
5394
+ }
5395
+ const nextHidden = [...hidden, key];
5396
+ const text = JSON.stringify(nextHidden);
5397
+ return {
5398
+ content: { ...content, [HIDDEN_EDITABLES_KEY]: text },
5399
+ nodes: [{ key: HIDDEN_EDITABLES_KEY, text }],
5400
+ added: true
5401
+ };
5402
+ }
5403
+ function withoutHiddenEditable(content, key) {
5404
+ const nextHidden = readHiddenEditables(content).filter((entry) => entry !== key);
5405
+ const text = JSON.stringify(nextHidden);
5406
+ return {
5407
+ content: { ...content, [HIDDEN_EDITABLES_KEY]: text },
5408
+ nodes: [{ key: HIDDEN_EDITABLES_KEY, text }]
5409
+ };
5410
+ }
5411
+ function escapeAttrValue(value) {
5412
+ return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
5413
+ }
5414
+ function markHidden(el) {
5415
+ softHide(el);
5416
+ el.setAttribute(HIDDEN_ATTR, "");
5417
+ }
5418
+ function markVisible(el) {
5419
+ softUnhide(el);
5420
+ el.removeAttribute(HIDDEN_ATTR);
5421
+ }
5422
+ function applyHiddenEditablesToDom(content, root = document) {
5423
+ const hidden = readHiddenEditables(content);
5424
+ root.querySelectorAll(`[${HIDDEN_ATTR}]`).forEach((el) => markVisible(el));
5425
+ for (const key of hidden) {
5426
+ root.querySelectorAll(`[data-ohw-key="${escapeAttrValue(key)}"]`).forEach((el) => {
5427
+ markHidden(resolveSoftHideTarget(el));
5428
+ });
5429
+ }
5430
+ }
5431
+ function softHideEditableInDom(el, content) {
5432
+ if (!canSoftHideEditable(el)) return null;
5433
+ const target = resolveSoftHideTarget(el);
5434
+ const key = target.dataset.ohwKey ?? el.dataset.ohwKey;
5435
+ if (!key) return null;
5436
+ const next = withHiddenEditable(content, key);
5437
+ markHidden(target);
5438
+ return { content: next.content, nodes: next.nodes, key, target };
5439
+ }
5440
+ function softUnhideEditableInDom(key, content, root = document) {
5441
+ const next = withoutHiddenEditable(content, key);
5442
+ root.querySelectorAll(`[data-ohw-key="${escapeAttrValue(key)}"]`).forEach((el) => {
5443
+ markVisible(resolveSoftHideTarget(el));
5444
+ });
5445
+ return next;
5446
+ }
5447
+
5320
5448
  // src/lib/collect-editable-nodes.ts
5321
5449
  var VIDEO_AUTOPLAY_SUFFIX = "__ohw_autoplay";
5322
5450
  var VIDEO_MUTED_SUFFIX = "__ohw_muted";
@@ -5395,7 +5523,9 @@ function collectEditableNodes(extraContent, root = document) {
5395
5523
  BUTTON_ASSIGNMENTS_KEY,
5396
5524
  BUTTON_COLLECTIONS_KEY,
5397
5525
  BUTTON_SNAPSHOTS_KEY,
5398
- BUTTON_HIDDEN_KEY
5526
+ BUTTON_HIDDEN_KEY,
5527
+ // Soft-hidden template slots (non-AI Delete) — no DOM marker when hidden.
5528
+ HIDDEN_EDITABLES_KEY
5399
5529
  ]) {
5400
5530
  const text = extraContent[key];
5401
5531
  if (typeof text === "string" && text.length > 0) {
@@ -6880,6 +7010,21 @@ function pricingCardFeatureCount(tree, index) {
6880
7010
  const target = findPricingCollection(tree)?.children?.[index];
6881
7011
  return target ? pricingFeatureList(target).length : 0;
6882
7012
  }
7013
+ function prevailingFeatureIcon(features) {
7014
+ const counts = /* @__PURE__ */ new Map();
7015
+ for (const row of features) {
7016
+ const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
7017
+ const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
7018
+ entry.count += 1;
7019
+ counts.set(key, entry);
7020
+ }
7021
+ let best = null;
7022
+ for (const entry of counts.values()) {
7023
+ if (!best || entry.count > best.count) best = entry;
7024
+ }
7025
+ if (!best) return {};
7026
+ return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
7027
+ }
6883
7028
  function addPricingCardFeature(tree, index, text) {
6884
7029
  return withPricingCollection(tree, (collection) => {
6885
7030
  const children = collection.children;
@@ -6888,7 +7033,7 @@ function addPricingCardFeature(tree, index, text) {
6888
7033
  const features = pricingFeatureList(target);
6889
7034
  if (features.length >= PRICING_FEATURES_MAX) return false;
6890
7035
  target.slots = target.slots ?? {};
6891
- target.slots.features = [...features, { text }];
7036
+ target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
6892
7037
  return true;
6893
7038
  });
6894
7039
  }
@@ -6955,6 +7100,127 @@ function rewriteIconSlot(tree, path, ref) {
6955
7100
  return next;
6956
7101
  }
6957
7102
 
7103
+ // src/lib/ai-remove-block.ts
7104
+ function blockPathFromEditKey(sectionId, key) {
7105
+ const prefix = aiSlotKeyPrefixFor(sectionId);
7106
+ if (!key.startsWith(prefix)) return void 0;
7107
+ const path = [];
7108
+ for (const part of key.slice(prefix.length).split(".")) {
7109
+ if (/^[rbc]\d+$/.test(part)) path.push(part);
7110
+ else break;
7111
+ }
7112
+ if (path.length < 2 || !/^r\d+$/.test(path[0]) || !/^b\d+$/.test(path[1])) return void 0;
7113
+ return path.join(".");
7114
+ }
7115
+ function parseBlockPath(path) {
7116
+ const segs = [];
7117
+ for (const part of path.split(".")) {
7118
+ const match = part.match(/^([rbc])(\d+)$/);
7119
+ if (!match) return void 0;
7120
+ segs.push({ kind: match[1], index: Number(match[2]) });
7121
+ }
7122
+ if (segs.length < 2 || segs[0].kind !== "r" || segs[1].kind !== "b") return void 0;
7123
+ return segs;
7124
+ }
7125
+ function cloneTree(tree) {
7126
+ return JSON.parse(JSON.stringify(tree));
7127
+ }
7128
+ function nodeAtPath2(tree, segs) {
7129
+ let node = tree.rows?.[segs[0].index]?.blocks?.[segs[1].index];
7130
+ for (let i = 2; i < segs.length; i += 1) {
7131
+ if (segs[i].kind !== "c") return null;
7132
+ node = node?.children?.[segs[i].index];
7133
+ }
7134
+ return node ?? null;
7135
+ }
7136
+ function unwrapPromoted(node) {
7137
+ if (node.promoted === true && node.slots?.layout === "stack" && (node.children?.length ?? 0) === 1) {
7138
+ const only = { ...node.children[0] };
7139
+ if (node.slot) only.slot = node.slot;
7140
+ only.span = node.span;
7141
+ return only;
7142
+ }
7143
+ return node;
7144
+ }
7145
+ function removeBlockAtPath(tree, path) {
7146
+ const segs = parseBlockPath(path);
7147
+ if (!segs) return { ok: false, reasons: [`invalid block path "${path}"`] };
7148
+ const next = cloneTree(tree);
7149
+ const rowIndex = segs[0].index;
7150
+ const row = next.rows[rowIndex];
7151
+ if (!row) return { ok: false, reasons: [`row ${rowIndex} not found`] };
7152
+ if (segs.length === 2) {
7153
+ const blockIndex = segs[1].index;
7154
+ if (!row.blocks[blockIndex]) return { ok: false, reasons: [`block ${path} not found`] };
7155
+ row.blocks.splice(blockIndex, 1);
7156
+ if (row.blocks.length === 0) {
7157
+ next.rows.splice(rowIndex, 1);
7158
+ } else if (row.blocks.length === 1) {
7159
+ row.blocks[0] = { ...row.blocks[0], span: 12 };
7160
+ delete row.blocks[0].slot;
7161
+ }
7162
+ } else {
7163
+ let parent = row.blocks[segs[1].index];
7164
+ for (let i = 2; i < segs.length - 1; i += 1) {
7165
+ if (!parent?.children || segs[i].kind !== "c") {
7166
+ return { ok: false, reasons: [`block ${path} not found`] };
7167
+ }
7168
+ parent = parent.children[segs[i].index];
7169
+ }
7170
+ const childIndex = segs[segs.length - 1].index;
7171
+ if (!parent?.children || segs[segs.length - 1].kind !== "c" || !parent.children[childIndex]) {
7172
+ return { ok: false, reasons: [`block ${path} not found`] };
7173
+ }
7174
+ parent.children.splice(childIndex, 1);
7175
+ if (segs.length === 3) {
7176
+ row.blocks[segs[1].index] = unwrapPromoted(parent);
7177
+ if (row.blocks[segs[1].index].type === "group" && (row.blocks[segs[1].index].children?.length ?? 0) === 0) {
7178
+ row.blocks.splice(segs[1].index, 1);
7179
+ if (row.blocks.length === 0) next.rows.splice(rowIndex, 1);
7180
+ }
7181
+ if (next.rows[rowIndex]?.blocks.length === 1) {
7182
+ next.rows[rowIndex].blocks[0] = { ...next.rows[rowIndex].blocks[0], span: 12 };
7183
+ delete next.rows[rowIndex].blocks[0].slot;
7184
+ }
7185
+ } else {
7186
+ const grand = row.blocks[segs[1].index];
7187
+ let cursor = grand;
7188
+ for (let i = 2; i < segs.length - 2; i += 1) {
7189
+ cursor = cursor?.children?.[segs[i].index];
7190
+ }
7191
+ const containerIndex = segs[segs.length - 2].index;
7192
+ if (cursor?.children?.[containerIndex]) {
7193
+ cursor.children[containerIndex] = unwrapPromoted(parent);
7194
+ }
7195
+ }
7196
+ }
7197
+ if (next.rows.length === 0) {
7198
+ return { ok: false, reasons: ["a section must keep at least one block"] };
7199
+ }
7200
+ return { ok: true, tree: next };
7201
+ }
7202
+ function planAiBlockRemoval(aiSectionsRaw, editKey) {
7203
+ if (!editKey || !editKey.startsWith("ai.")) return null;
7204
+ const state = parseAiSectionsState(aiSectionsRaw);
7205
+ const entry = state.sections.find((s) => editKey.startsWith(aiSlotKeyPrefixFor(s.id)));
7206
+ if (!entry) return null;
7207
+ const path = blockPathFromEditKey(entry.id, editKey);
7208
+ if (!path) return null;
7209
+ const segs = parseBlockPath(path);
7210
+ if (!segs) return null;
7211
+ const node = nodeAtPath2(entry.tree, segs);
7212
+ if (!node) return null;
7213
+ const removed = removeBlockAtPath(entry.tree, path);
7214
+ if (!removed.ok) return removed;
7215
+ return { ok: true, tree: removed.tree, path, entry };
7216
+ }
7217
+ var planAiTextBlockRemoval = planAiBlockRemoval;
7218
+ function canRemoveAiBlock(aiSectionsRaw, editKey) {
7219
+ const plan = planAiBlockRemoval(aiSectionsRaw, editKey);
7220
+ return plan?.ok === true;
7221
+ }
7222
+ var canRemoveAiTextBlock = canRemoveAiBlock;
7223
+
6958
7224
  // src/lib/ai-footer-tree.ts
6959
7225
  var FOOTER_COLUMN_SPANS = [12, 6, 4, 3];
6960
7226
  var FOOTER_COLUMN_BLOCKS = [
@@ -7532,6 +7798,120 @@ function findSelectableNavContainer(doc = document) {
7532
7798
  );
7533
7799
  }
7534
7800
 
7801
+ // src/lib/youtube.ts
7802
+ var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
7803
+ function extractYouTubeId(input) {
7804
+ const trimmed = input.trim();
7805
+ if (!trimmed) return null;
7806
+ if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
7807
+ let url;
7808
+ try {
7809
+ url = new URL(trimmed);
7810
+ } catch {
7811
+ return null;
7812
+ }
7813
+ const host = url.hostname.replace(/^www\./, "");
7814
+ if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
7815
+ return null;
7816
+ }
7817
+ let candidate = null;
7818
+ if (host === "youtu.be") {
7819
+ candidate = url.pathname.slice(1).split("/")[0] ?? null;
7820
+ } else if (url.pathname === "/watch") {
7821
+ candidate = url.searchParams.get("v");
7822
+ } else {
7823
+ const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
7824
+ candidate = match ? match[1] : null;
7825
+ }
7826
+ return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
7827
+ }
7828
+
7829
+ // src/lib/section-embed.ts
7830
+ var SECTION_EMBED_SUFFIX = "__ohw_embed";
7831
+ function readStoredEmbed(value) {
7832
+ if (value.startsWith("start\n")) {
7833
+ return { raw: value.slice("start\n".length), at: "start" };
7834
+ }
7835
+ return { raw: value, at: "end" };
7836
+ }
7837
+ function embedFrameSrc(value) {
7838
+ const videoId = extractYouTubeId(value);
7839
+ if (videoId) {
7840
+ return { src: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0`, title: "YouTube video" };
7841
+ }
7842
+ let url;
7843
+ try {
7844
+ url = new URL(value);
7845
+ } catch {
7846
+ return null;
7847
+ }
7848
+ const host = url.hostname.replace(/^www\./, "").toLowerCase();
7849
+ if (host === "google.com" && url.pathname.startsWith("/maps") || host === "maps.google.com") {
7850
+ const query = url.searchParams.get("q") || url.searchParams.get("query") || "";
7851
+ const src = query ? `https://maps.google.com/maps?q=${encodeURIComponent(query)}&output=embed` : `https://maps.google.com/maps?output=embed`;
7852
+ return { src, title: "Map" };
7853
+ }
7854
+ if (host === "maps.app.goo.gl") {
7855
+ return { src: value, title: "Map" };
7856
+ }
7857
+ if (host === "calendly.com" || host.endsWith(".calendly.com") || host === "calendar.google.com") {
7858
+ return { src: value, title: "Calendar" };
7859
+ }
7860
+ if (host === "docs.google.com" && url.pathname.includes("/forms/")) {
7861
+ return { src: value.replace(/\/edit(?:\?.*)?$/i, "/viewform"), title: "Form" };
7862
+ }
7863
+ if (host === "forms.gle") {
7864
+ return { src: value, title: "Form" };
7865
+ }
7866
+ return null;
7867
+ }
7868
+ function place(section, box, at) {
7869
+ if (at === "start") {
7870
+ section.insertBefore(box, section.firstChild);
7871
+ return;
7872
+ }
7873
+ section.appendChild(box);
7874
+ }
7875
+ function paint(section, key, src, title, at) {
7876
+ const existing = section.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`);
7877
+ const frame = existing?.querySelector("iframe");
7878
+ if (existing && frame) {
7879
+ if (frame.getAttribute("src") !== src) frame.setAttribute("src", src);
7880
+ frame.title = title;
7881
+ place(section, existing, at);
7882
+ return;
7883
+ }
7884
+ existing?.remove();
7885
+ const box = document.createElement("div");
7886
+ box.setAttribute("data-ohw-section-embed", key);
7887
+ 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;";
7888
+ const frameWrap = document.createElement("div");
7889
+ frameWrap.style.cssText = "position:relative;width:100%;aspect-ratio:16/9;min-height:250px;border-radius:12px;overflow:hidden;background:#0f172a;";
7890
+ const iframe = document.createElement("iframe");
7891
+ iframe.src = src;
7892
+ iframe.title = title;
7893
+ iframe.style.cssText = "position:absolute;inset:0;width:100%;height:100%;border:0;";
7894
+ iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture";
7895
+ iframe.setAttribute("allowfullscreen", "");
7896
+ frameWrap.appendChild(iframe);
7897
+ box.appendChild(frameWrap);
7898
+ place(section, box, at);
7899
+ }
7900
+ function applySectionEmbeds(content) {
7901
+ for (const [key, val] of Object.entries(content)) {
7902
+ if (!key.endsWith(SECTION_EMBED_SUFFIX)) continue;
7903
+ const sectionId = key.slice(0, -SECTION_EMBED_SUFFIX.length);
7904
+ const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
7905
+ const stored = typeof val === "string" ? readStoredEmbed(val) : null;
7906
+ const frame = stored ? embedFrameSrc(stored.raw) : null;
7907
+ if (!section || !stored || !frame) {
7908
+ section?.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`)?.remove();
7909
+ continue;
7910
+ }
7911
+ paint(section, key, frame.src, frame.title, stored.at);
7912
+ }
7913
+ }
7914
+
7535
7915
  // src/ui/ai-tree/aiSectionsManager.tsx
7536
7916
  var import_react_dom = require("react-dom");
7537
7917
  var import_client = require("react-dom/client");
@@ -8054,12 +8434,19 @@ function footerBodyStyle(fallbackFont, color, weight = 500) {
8054
8434
  }
8055
8435
  var str = (value) => typeof value === "string" ? value : "";
8056
8436
  var cardRadius = (slots) => slots.cornerStyle === "sharp" ? 0 : AI_TREE_TOKENS.radiusCard;
8057
- var blockAlignStyle = (blockAlign) => blockAlign ? {
8058
- display: "flex",
8059
- flexDirection: "column",
8060
- alignItems: blockAlign === "left" ? "flex-start" : blockAlign === "right" ? "flex-end" : "center",
8061
- textAlign: blockAlign
8062
- } : {};
8437
+ var HUG_ALIGN_TYPES = /* @__PURE__ */ new Set(["button", "button-row", "rating"]);
8438
+ var blockAlignStyle = (blockAlign, blockType) => {
8439
+ if (!blockAlign) return {};
8440
+ if (blockType && HUG_ALIGN_TYPES.has(blockType)) {
8441
+ return {
8442
+ display: "flex",
8443
+ flexDirection: "column",
8444
+ alignItems: blockAlign === "left" ? "flex-start" : blockAlign === "right" ? "flex-end" : "center",
8445
+ textAlign: blockAlign
8446
+ };
8447
+ }
8448
+ return { width: "100%", textAlign: blockAlign, boxSizing: "border-box" };
8449
+ };
8063
8450
  var fullBleedBlock = (block) => block.type === "carousel" || block.type === "group" && str(block.slots?.layout) === "overlap";
8064
8451
  var featureLines = (value) => value.split(/\n|<br\s*\/?>/i).map((line) => line.trim()).filter(Boolean);
8065
8452
  var AI_MOBILE_CSS = [
@@ -8105,7 +8492,7 @@ var AI_MOBILE_CSS = [
8105
8492
  // page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
8106
8493
  // template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
8107
8494
  // an exact figure from (no live measurement exists), so this is a safe approximation, not a
8108
- // pixel-exact fit. Horizontal spacing already comes from `data-ai-container`.
8495
+ // pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
8109
8496
  '[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
8110
8497
  // A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
8111
8498
  // window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
@@ -8121,8 +8508,10 @@ var AI_MOBILE_CSS = [
8121
8508
  "[data-ai-section]{overflow-x:hidden}",
8122
8509
  // `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
8123
8510
  // full-bleed section's container sets, so a carousel/media hero that is edge-to-edge on desktop
8124
- // still got a 20px band of section background down both sides on a phone.
8125
- "[data-ai-container]:not([data-ai-full-bleed]){padding:0 20px !important}",
8511
+ // still got a 20px band of section background down both sides on a phone. The footer's own
8512
+ // container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
8513
+ "[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
8514
+ "[data-ai-container]{padding:0 20px !important}",
8126
8515
  "[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
8127
8516
  "[data-ai-cell]{width:100%;min-width:0}",
8128
8517
  // The rule above turns every row into a COLUMN flex container on phones, which silently breaks
@@ -8327,6 +8716,31 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
8327
8716
  function textAttrs(ctx, path) {
8328
8717
  return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
8329
8718
  }
8719
+ var AI_RESPONSIVE_CSS = [
8720
+ "@media (max-width: 960px) {",
8721
+ " [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
8722
+ ' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
8723
+ "}",
8724
+ "@media (max-width: 640px) {",
8725
+ " [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
8726
+ " [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
8727
+ // Group containers flatten to a column on phones; span placements come along for free.
8728
+ // `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
8729
+ // the comment there. This sheet's copy is the narrower selector, so without the exemption it
8730
+ // flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
8731
+ // viewport with the heading/CTA in flow *under* the image, 219px of section background where the
8732
+ // layered text used to be.
8733
+ ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
8734
+ ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
8735
+ // `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
8736
+ // is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
8737
+ // a full-bleed hero gets its 20px side band back below 640px only — the one width where the
8738
+ // other rule had already been taught to stand down.
8739
+ " [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
8740
+ " [data-ai-responsive] { overflow-x: hidden; }",
8741
+ " [data-ai-responsive] img { max-width: 100%; }",
8742
+ "}"
8743
+ ].join("\n");
8330
8744
  var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
8331
8745
  function MediaBox({
8332
8746
  refValue,
@@ -8381,7 +8795,7 @@ function MediaBox({
8381
8795
  position: fill ? "absolute" : void 0,
8382
8796
  inset: fill ? 0 : void 0,
8383
8797
  width: fill ? "100%" : fixedSize ? "auto" : "100%",
8384
- height: fill ? "100%" : void 0,
8798
+ height: fill ? "100%" : fixedSize ? height : void 0,
8385
8799
  aspectRatio: fill ? void 0 : aspectRatio,
8386
8800
  minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
8387
8801
  borderRadius: radius,
@@ -8582,7 +8996,13 @@ function TextBlock({
8582
8996
  "div",
8583
8997
  {
8584
8998
  ...textAttrs(ctx, `${path}.content`),
8585
- style: { ...typeStyle(spec, font), color: ctx.brand.palette.dark, textAlign: align },
8999
+ style: {
9000
+ ...typeStyle(spec, font),
9001
+ color: ctx.brand.palette.dark,
9002
+ textAlign: align,
9003
+ width: "100%",
9004
+ boxSizing: "border-box"
9005
+ },
8586
9006
  dangerouslySetInnerHTML: { __html: str(slots.content) }
8587
9007
  }
8588
9008
  );
@@ -8593,7 +9013,7 @@ function SectionHeaderBlock({ node, ctx, path }) {
8593
9013
  const children = node.children ?? [];
8594
9014
  const buttonRowIdx = children.findIndex((c) => c.type === "button-row");
8595
9015
  const buttonRow = buttonRowIdx >= 0 ? children[buttonRowIdx] : void 0;
8596
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { textAlign: align }, children: [
9016
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { textAlign: align, width: "100%", boxSizing: "border-box" }, children: [
8597
9017
  str(slots.tagline) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
8598
9018
  "div",
8599
9019
  {
@@ -9877,7 +10297,7 @@ function CollectionBlock({ node, ctx, path }) {
9877
10297
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
9878
10298
  "div",
9879
10299
  {
9880
- "data-ai-grid": "",
10300
+ "data-ai-grid": String(itemsPerRow),
9881
10301
  "data-ohw-pricing-collection": isPricing ? "" : void 0,
9882
10302
  style: {
9883
10303
  display: "grid",
@@ -10179,7 +10599,7 @@ function renderNode(node, ctx, path, ambientAlign) {
10179
10599
  },
10180
10600
  children: [
10181
10601
  i > 0 && ctx.heroOverlapFullBleed ? (
10182
- // The section's `data-ai-container` gave up its max-width/gutter so the base
10602
+ // The section's `data-ai-section-inner` gave up its max-width/gutter so the base
10183
10603
  // layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
10184
10604
  // scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
10185
10605
  // the full section width instead of reading at the usual content width.
@@ -10212,10 +10632,10 @@ function renderNode(node, ctx, path, ambientAlign) {
10212
10632
  gridColumn: `span ${typeof child.span === "number" ? Math.min(12, Math.max(1, child.span)) : 12}`,
10213
10633
  minWidth: 0
10214
10634
  } : { minWidth: 0 },
10215
- // A child's own `align` (or the group's inherited `ambientAlign`, e.g. from an
10216
- // `overlap` overlay layer — see renderNode) positions it within this column; a stack
10217
- // child otherwise stretches full-width (unchanged pre-existing behaviour).
10218
- ...blockAlignStyle(child.align ?? ambientAlign)
10635
+ // Same ambient as renderNode below: child's own align, else the group's, else the
10636
+ // inherited ambient (overlap overlay / section). Copy fills the column; button-row
10637
+ // etc. still hug via flex alignItems.
10638
+ ...blockAlignStyle(child.align ?? node.align ?? ambientAlign, child.type)
10219
10639
  },
10220
10640
  children: renderNode(child, ctx, `${path}.c${i}`, node.align ?? ambientAlign)
10221
10641
  },
@@ -10584,12 +11004,7 @@ function AiTreeRenderer({
10584
11004
  if (fillHeight) return "stretch";
10585
11005
  return (distributed ?? settings.verticalPosition) === "top" ? "start" : "center";
10586
11006
  };
10587
- const cellAlignStyle = (blockAlign) => blockAlign ? {
10588
- display: "flex",
10589
- flexDirection: "column",
10590
- alignItems: blockAlign === "left" ? "flex-start" : blockAlign === "right" ? "flex-end" : "center",
10591
- textAlign: blockAlign
10592
- } : {};
11007
+ const cellAlignStyle = (blockAlign, blockType) => blockAlignStyle(blockAlign, blockType);
10593
11008
  const needsOverlayClearance = fillHeight && pad === 0;
10594
11009
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
10595
11010
  "section",
@@ -10598,6 +11013,7 @@ function AiTreeRenderer({
10598
11013
  ...fillHeight ? { "data-ai-fill-height": "" } : {},
10599
11014
  ...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
10600
11015
  ...bgAttrs,
11016
+ "data-ai-responsive": "",
10601
11017
  style: {
10602
11018
  position: "relative",
10603
11019
  padding: `${padCss} 0`,
@@ -10611,12 +11027,13 @@ function AiTreeRenderer({
10611
11027
  ...fillHeight ? { display: "grid" } : {}
10612
11028
  },
10613
11029
  children: [
10614
- isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
11030
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_RESPONSIVE_CSS }),
10615
11031
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_MOBILE_CSS }),
11032
+ isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
10616
11033
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
10617
11034
  "div",
10618
11035
  {
10619
- "data-ai-container": "",
11036
+ "data-ai-section-inner": "",
10620
11037
  ...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
10621
11038
  style: {
10622
11039
  position: "relative",
@@ -10633,7 +11050,7 @@ function AiTreeRenderer({
10633
11050
  children: tree.rows.map((row, r2) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
10634
11051
  "div",
10635
11052
  {
10636
- "data-ai-row": "",
11053
+ "data-ai-columns": "",
10637
11054
  style: {
10638
11055
  display: "grid",
10639
11056
  gridTemplateColumns: "repeat(12, 1fr)",
@@ -10649,11 +11066,11 @@ function AiTreeRenderer({
10649
11066
  gridColumn: `span ${Math.min(12, Math.max(1, block.span))}`,
10650
11067
  minWidth: 0,
10651
11068
  // Cascades the section's min-height stretch (see `fillHeight` above) down to
10652
- // this cell; `cellAlignStyle` below overrides to `flex` when the block also has
10653
- // its own horizontal `align`, which takes priority for that block.
11069
+ // this cell; `cellAlignStyle` below overrides when the block also has its own
11070
+ // horizontal `align` (flex hug for buttons; width 100% for text).
10654
11071
  ...fillHeight ? { display: "grid" } : {},
10655
11072
  // Horizontal placement of the block's content within its column.
10656
- ...fullBleedBlock(block) ? {} : cellAlignStyle(block.align),
11073
+ ...fullBleedBlock(block) ? {} : cellAlignStyle(block.align, block.type),
10657
11074
  // space-between: each column becomes a flex column whose content spreads over
10658
11075
  // the full row height instead of clumping at the top.
10659
11076
  ...distributed === "space-between" ? { display: "flex", flexDirection: "column", justifyContent: "space-between" } : {}
@@ -11295,9 +11712,10 @@ function applyAiSectionsToDom(state, options) {
11295
11712
  if (existing && existing.serialized === serialized && existing.container.isConnected) {
11296
11713
  continue;
11297
11714
  }
11298
- const isNewMount = !existing || !existing.container.isConnected;
11299
11715
  let container = existing?.container;
11716
+ let isNewMount = false;
11300
11717
  if (!container || !container.isConnected) {
11718
+ isNewMount = true;
11301
11719
  existing?.root.unmount();
11302
11720
  container?.remove();
11303
11721
  container = document.createElement("div");
@@ -11377,7 +11795,7 @@ var import_client2 = require("react-dom/client");
11377
11795
  var import_react_dom2 = require("react-dom");
11378
11796
  var import_jsx_runtime3 = require("react/jsx-runtime");
11379
11797
  var CONTAINER_ATTR2 = "data-ohw-ai-footer";
11380
- var HIDDEN_ATTR = "data-ohw-ai-footer-replaced";
11798
+ var HIDDEN_ATTR2 = "data-ohw-ai-footer-replaced";
11381
11799
  var mounted2 = null;
11382
11800
  var mountOptions = {};
11383
11801
  var capturedSurface;
@@ -11407,12 +11825,12 @@ function findTemplateFooter() {
11407
11825
  function hideTemplateFooter(footer) {
11408
11826
  if (!footer) return;
11409
11827
  footer.style.display = "none";
11410
- footer.setAttribute(HIDDEN_ATTR, "");
11828
+ footer.setAttribute(HIDDEN_ATTR2, "");
11411
11829
  }
11412
11830
  function showTemplateFooter() {
11413
- for (const el of document.querySelectorAll(`[${HIDDEN_ATTR}]`)) {
11831
+ for (const el of document.querySelectorAll(`[${HIDDEN_ATTR2}]`)) {
11414
11832
  el.style.removeProperty("display");
11415
- el.removeAttribute(HIDDEN_ATTR);
11833
+ el.removeAttribute(HIDDEN_ATTR2);
11416
11834
  }
11417
11835
  }
11418
11836
  function unmountAiFooter() {
@@ -11607,7 +12025,7 @@ function pickFooterColumnIndex(columnBlockCounts) {
11607
12025
  }
11608
12026
 
11609
12027
  // src/lib/ai-footer-edits.ts
11610
- function cloneTree(tree) {
12028
+ function cloneTree2(tree) {
11611
12029
  return JSON.parse(JSON.stringify(tree));
11612
12030
  }
11613
12031
  function rebalanceFooterColumnSpans(columns) {
@@ -11635,6 +12053,34 @@ function minSpanForFooterBlock(type) {
11635
12053
  return 3;
11636
12054
  }
11637
12055
  }
12056
+ function readLiveSocialItems() {
12057
+ const root = getFooterRoot();
12058
+ const row = root?.querySelector("[data-ohw-socials-row]");
12059
+ if (!row) return [];
12060
+ const items = [];
12061
+ for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
12062
+ const href = anchor.getAttribute("href")?.trim() ?? "";
12063
+ const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
12064
+ const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
12065
+ if (!platform || !/^https?:\/\//i.test(href)) continue;
12066
+ items.push({ platform, href });
12067
+ }
12068
+ return items;
12069
+ }
12070
+ function syncSocialRowsFromDom(tree) {
12071
+ const root = getFooterRoot();
12072
+ if (!root) return;
12073
+ const row = root.querySelector("[data-ohw-socials-row]");
12074
+ const live = readLiveSocialItems();
12075
+ if (row && live.length === 0) return;
12076
+ for (const col of tree.columns) {
12077
+ col.blocks = col.blocks.flatMap((block) => {
12078
+ if (block.type !== "social-row") return [block];
12079
+ if (!row) return [];
12080
+ return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
12081
+ });
12082
+ }
12083
+ }
11638
12084
  function collectBrandBlocks(tree) {
11639
12085
  const brand = [];
11640
12086
  for (const col of tree.columns) {
@@ -11657,7 +12103,7 @@ function countFooterLinkLists(tree) {
11657
12103
  return collectLinkListBlocks(tree).length;
11658
12104
  }
11659
12105
  function packFooterTreeBrand(tree) {
11660
- const next = cloneTree(tree);
12106
+ const next = cloneTree2(tree);
11661
12107
  const brand = collectBrandBlocks(next);
11662
12108
  const lists = collectLinkListBlocks(next);
11663
12109
  if (lists.length === 0) {
@@ -11742,7 +12188,7 @@ function ensureFooterTree(tree, opts) {
11742
12188
  return tree ?? buildDefaultFooterTree(opts);
11743
12189
  }
11744
12190
  function appendFooterSocial(tree, entry) {
11745
- const next = cloneTree(tree);
12191
+ const next = cloneTree2(tree);
11746
12192
  const platform = entry.platform.trim().toLowerCase();
11747
12193
  const href = entry.href.trim();
11748
12194
  for (const col2 of next.columns) {
@@ -11771,7 +12217,7 @@ function appendFooterSocial(tree, entry) {
11771
12217
  return next;
11772
12218
  }
11773
12219
  function insertFooterHours(tree, hours, title = "Hours") {
11774
- const next = cloneTree(tree);
12220
+ const next = cloneTree2(tree);
11775
12221
  const idx = pickFooterColumnIndex(next.columns.map((c) => c.blocks.length));
11776
12222
  const col = next.columns[idx] ?? next.columns[0];
11777
12223
  if (!col) return next;
@@ -11798,7 +12244,7 @@ function addFooterLinkColumn(tree, column) {
11798
12244
  return next;
11799
12245
  }
11800
12246
  function removeFooterBlock(tree, predicate) {
11801
- const next = cloneTree(tree);
12247
+ const next = cloneTree2(tree);
11802
12248
  for (let c = 0; c < next.columns.length; c++) {
11803
12249
  const col = next.columns[c];
11804
12250
  if (!col) continue;
@@ -11834,7 +12280,7 @@ function foldAiFooterSlotOverride(tree, key, value) {
11834
12280
  const path = key.slice(prefix.length);
11835
12281
  const brandMatch = path.match(/^brand\.b(\d+)\.(.+)$/);
11836
12282
  if (!brandMatch) return null;
11837
- const next = cloneTree(tree);
12283
+ const next = cloneTree2(tree);
11838
12284
  const brands = [];
11839
12285
  for (const col of next.columns) {
11840
12286
  for (const block2 of col.blocks) {
@@ -11879,7 +12325,8 @@ function textOf2(el) {
11879
12325
  return (el?.textContent ?? "").replace(/\s+/g, " ").trim();
11880
12326
  }
11881
12327
  function syncFooterTreeLinksFromDom(tree) {
11882
- const next = cloneTree(tree);
12328
+ const next = cloneTree2(tree);
12329
+ syncSocialRowsFromDom(next);
11883
12330
  const domCols = listFooterColumns().map((col) => {
11884
12331
  const heading = getFooterColumnHeadingEl(col);
11885
12332
  const title = heading ? textOf2(heading) : void 0;
@@ -12360,7 +12807,7 @@ var PLACEHOLDER_RE = /\[[A-Za-z][A-Za-z0-9 _/&#'.-]{0,30}\]-?/g;
12360
12807
  var HAS_PLACEHOLDER_RE = /\[[A-Za-z][A-Za-z0-9 _/&#'.-]{0,30}\]/;
12361
12808
  var SKIPPED_TAGS = /* @__PURE__ */ new Set(["SCRIPT", "STYLE", "NOSCRIPT", "TEXTAREA", "CODE", "PRE"]);
12362
12809
  var TEXT_ATTRS = ["alt", "title", "aria-label", "placeholder"];
12363
- var HIDDEN_ATTR2 = "data-ohw-placeholder-hidden";
12810
+ var HIDDEN_ATTR3 = "data-ohw-placeholder-hidden";
12364
12811
  function hasPlaceholder(text) {
12365
12812
  return HAS_PLACEHOLDER_RE.test(text);
12366
12813
  }
@@ -12379,10 +12826,10 @@ function skipped(el) {
12379
12826
  }
12380
12827
  function hideIfEmptied(el) {
12381
12828
  const control = el?.closest("a, button");
12382
- if (!control || control.hasAttribute(HIDDEN_ATTR2)) return;
12829
+ if (!control || control.hasAttribute(HIDDEN_ATTR3)) return;
12383
12830
  if ((control.textContent ?? "").trim()) return;
12384
12831
  if (control.querySelector("img, svg, picture, video")) return;
12385
- control.setAttribute(HIDDEN_ATTR2, "");
12832
+ control.setAttribute(HIDDEN_ATTR3, "");
12386
12833
  control.style.display = "none";
12387
12834
  }
12388
12835
  function stripElementAttrs(el) {
@@ -17531,10 +17978,10 @@ function ItemInteractionLayer({
17531
17978
  }
17532
17979
 
17533
17980
  // src/lib/forms.ts
17534
- var FORM_SELECTOR = '[data-ohw-editable="form"]';
17981
+ var FORM_SELECTOR2 = '[data-ohw-editable="form"]';
17535
17982
  function getFormElement(el) {
17536
17983
  if (!el) return null;
17537
- return el.closest(FORM_SELECTOR);
17984
+ return el.closest(FORM_SELECTOR2);
17538
17985
  }
17539
17986
  function formKeyOf(form) {
17540
17987
  return form.getAttribute("data-ohw-key");
@@ -17595,7 +18042,7 @@ function clearSubmitError(form) {
17595
18042
  if (note) note.style.display = "none";
17596
18043
  }
17597
18044
  var SUCCESS_TEXT_ATTR = "data-ohw-form-success-text";
17598
- var HIDDEN_ATTR3 = "data-ohw-form-hidden";
18045
+ var HIDDEN_ATTR4 = "data-ohw-form-hidden";
17599
18046
  var DEFAULT_SUCCESS_TEXT = "Thanks! We'll be in touch.";
17600
18047
  function formSuccessKey(formKey) {
17601
18048
  return `${formKey}-success`;
@@ -17621,13 +18068,13 @@ function setFormViewState(form, formKey, state, initialText) {
17621
18068
  Array.from(form.children).forEach((child) => {
17622
18069
  if (!(child instanceof HTMLElement) || child === success) return;
17623
18070
  if (state === "success") {
17624
- if (!child.hasAttribute(HIDDEN_ATTR3)) {
17625
- child.setAttribute(HIDDEN_ATTR3, child.style.display);
18071
+ if (!child.hasAttribute(HIDDEN_ATTR4)) {
18072
+ child.setAttribute(HIDDEN_ATTR4, child.style.display);
17626
18073
  child.style.display = "none";
17627
18074
  }
17628
- } else if (child.hasAttribute(HIDDEN_ATTR3)) {
17629
- child.style.display = child.getAttribute(HIDDEN_ATTR3) ?? "";
17630
- child.removeAttribute(HIDDEN_ATTR3);
18075
+ } else if (child.hasAttribute(HIDDEN_ATTR4)) {
18076
+ child.style.display = child.getAttribute(HIDDEN_ATTR4) ?? "";
18077
+ child.removeAttribute(HIDDEN_ATTR4);
17631
18078
  }
17632
18079
  });
17633
18080
  success.style.display = state === "success" ? "" : "none";
@@ -17646,7 +18093,7 @@ function bindPublishedForms(apiUrl, subdomain, content = {}) {
17646
18093
  "submit",
17647
18094
  async (e) => {
17648
18095
  const target = e.target;
17649
- const form = target?.closest(FORM_SELECTOR);
18096
+ const form = target?.closest(FORM_SELECTOR2);
17650
18097
  if (!form || !(form instanceof HTMLFormElement)) return;
17651
18098
  const formKey = formKeyOf(form);
17652
18099
  if (!formKey) return;
@@ -17692,7 +18139,7 @@ function apiBase() {
17692
18139
  function bridgeVersion() {
17693
18140
  try {
17694
18141
  if (true) {
17695
- return "0.1.171";
18142
+ return "0.1.172-next.456";
17696
18143
  }
17697
18144
  } catch {
17698
18145
  }
@@ -17706,7 +18153,7 @@ function stampBridgeVersionOnDocument() {
17706
18153
  return;
17707
18154
  }
17708
18155
  try {
17709
- const v = true ? "0.1.171" : "";
18156
+ const v = true ? "0.1.172-next.456" : "";
17710
18157
  if (v) {
17711
18158
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
17712
18159
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -18367,6 +18814,7 @@ function MediaOverlay({
18367
18814
  onFadeOutComplete,
18368
18815
  onReplace,
18369
18816
  onSelect,
18817
+ onDelete,
18370
18818
  onVideoSettingsChange
18371
18819
  }) {
18372
18820
  const { rect } = hover;
@@ -18386,6 +18834,7 @@ function MediaOverlay({
18386
18834
  (prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
18387
18835
  );
18388
18836
  }, [isVideo]);
18837
+ const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
18389
18838
  const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
18390
18839
  const box = {
18391
18840
  position: "fixed",
@@ -18484,11 +18933,10 @@ function MediaOverlay({
18484
18933
  className: "flex items-center justify-center cursor-pointer",
18485
18934
  style: {
18486
18935
  ...box,
18487
- // When text overlays this media, let clicks fall THROUGH to the text underneath. In the
18488
- // parent this needed a whole `ow:click-at` round-trip to re-hit-test inside the iframe;
18489
- // in-document, pointer-events does it natively. The button below opts back in, so
18490
- // Replace still works.
18491
- pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
18936
+ // Visual only. `pointer-events: auto` on this full-bleed rect covered the navbar
18937
+ // (hero bg includes the absolute TopNav) and swallowed CTA press-drag. Text overlay
18938
+ // and cueOnly also need clicks to fall through — Replace / video controls opt back in.
18939
+ pointerEvents: "none",
18492
18940
  // Selected: a firm component ring with no wash, so the image reads as chosen rather
18493
18941
  // than hovered. Hover keeps the existing tinted preview.
18494
18942
  boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
@@ -18515,40 +18963,74 @@ function MediaOverlay({
18515
18963
  },
18516
18964
  children: [
18517
18965
  isVideo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.Film, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.ImageIcon, { size: 14 }),
18518
- isVideo ? "Replace video" : "Replace image"
18966
+ replaceLabel
18519
18967
  ]
18520
18968
  }
18521
18969
  ),
18522
- replaceMode === "none" || cueOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
18523
- Button,
18970
+ showChrome && replaceMode !== "none" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
18971
+ "div",
18524
18972
  {
18525
- "data-ohw-media-overlay": "",
18526
- variant: "outline",
18527
- size: "sm",
18528
- "aria-label": isVideo ? "Replace video" : "Replace image",
18529
- className: "gap-1.5 cursor-pointer hover:bg-background",
18973
+ className: "flex items-center gap-1.5",
18530
18974
  style: {
18531
- ...OVERLAY_BUTTON_STYLE,
18532
- // Icon-only is a square of the same height, so the pair can never differ vertically.
18533
- // `minWidth` has to go too: the button's own size carries `min-w-[64px]`, and a
18534
- // minimum beats a width — the square came out wider than the avatar it sat on.
18535
- ...replaceMode === "icon" && buttonSize ? {
18536
- width: buttonSize.height,
18537
- minWidth: buttonSize.height,
18538
- padding: 0,
18539
- justifyContent: "center"
18540
- } : null,
18541
- // Don't let Replace steal clicks when text (e.g. nav) sits on top of this media.
18975
+ // Parent overlay is pointer-events:none; controls opt back in (unless text sits on top).
18542
18976
  pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto"
18543
18977
  },
18544
- onMouseDown: (e) => e.preventDefault(),
18545
- onClick: (e) => {
18546
- e.stopPropagation();
18547
- onReplace(hover.key);
18548
- },
18978
+ onClick: (e) => e.stopPropagation(),
18549
18979
  children: [
18550
- isVideo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.Film, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.ImageIcon, { size: 14 }),
18551
- replaceMode === "full" ? isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image" : null
18980
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
18981
+ Button,
18982
+ {
18983
+ "data-ohw-media-overlay": "",
18984
+ variant: "outline",
18985
+ size: "sm",
18986
+ "aria-label": replaceLabel,
18987
+ className: "gap-1.5 cursor-pointer hover:bg-background",
18988
+ style: {
18989
+ ...OVERLAY_BUTTON_STYLE,
18990
+ // Icon-only is a square of the same height, so the pair can never differ vertically.
18991
+ // `minWidth` has to go too: the button's own size carries `min-w-[64px]`, and a
18992
+ // minimum beats a width — the square came out wider than the avatar it sat on.
18993
+ ...replaceMode === "icon" && buttonSize ? {
18994
+ width: buttonSize.height,
18995
+ minWidth: buttonSize.height,
18996
+ padding: 0,
18997
+ justifyContent: "center"
18998
+ } : null
18999
+ },
19000
+ onMouseDown: (e) => e.preventDefault(),
19001
+ onClick: (e) => {
19002
+ e.stopPropagation();
19003
+ onReplace(hover.key);
19004
+ },
19005
+ children: [
19006
+ isVideo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.Film, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.ImageIcon, { size: 14 }),
19007
+ replaceMode === "full" ? replaceLabel : null
19008
+ ]
19009
+ }
19010
+ ),
19011
+ selected && onDelete ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
19012
+ Button,
19013
+ {
19014
+ "data-ohw-media-overlay": "",
19015
+ variant: "outline",
19016
+ size: "sm",
19017
+ "aria-label": "Delete",
19018
+ title: "Delete",
19019
+ className: "cursor-pointer hover:bg-background",
19020
+ style: {
19021
+ ...OVERLAY_BUTTON_STYLE,
19022
+ minWidth: 0,
19023
+ padding: buttonSize ? `0 ${(buttonSize.height - 14) / 2}px` : "0 8px",
19024
+ height: buttonSize?.height
19025
+ },
19026
+ onMouseDown: (e) => e.preventDefault(),
19027
+ onClick: (e) => {
19028
+ e.stopPropagation();
19029
+ onDelete(hover.key);
19030
+ },
19031
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.Trash2, { size: 14 })
19032
+ }
19033
+ ) : null
18552
19034
  ]
18553
19035
  }
18554
19036
  )
@@ -19180,7 +19662,7 @@ function AiSectionOverlay({
19180
19662
 
19181
19663
  // src/ui/ai-section/AiMediaStripOverlay.tsx
19182
19664
  var import_react13 = require("react");
19183
- var import_lucide_react8 = require("lucide-react");
19665
+ var import_lucide_react9 = require("lucide-react");
19184
19666
 
19185
19667
  // src/lib/ai-media-strip-tree.ts
19186
19668
  var MEDIA_STRIP_ITEM_MIN = 1;
@@ -19294,14 +19776,6 @@ function setMediaStripItemAsset(tree, index, assetId) {
19294
19776
  return true;
19295
19777
  });
19296
19778
  }
19297
- function setMediaStripItemAlt(tree, index, alt) {
19298
- return withMediaStrip(tree, (block) => {
19299
- const items = block.items;
19300
- if (index < 0 || index >= items.length) return false;
19301
- items[index] = { ...items[index], alt };
19302
- return true;
19303
- });
19304
- }
19305
19779
  function setMediaStripItemLink(tree, index, link) {
19306
19780
  return withMediaStrip(tree, (block) => {
19307
19781
  const items = block.items;
@@ -19319,11 +19793,117 @@ function setMediaStripItemLink(tree, index, link) {
19319
19793
  });
19320
19794
  }
19321
19795
 
19322
- // src/ui/ai-section/AiMediaStripOverlay.tsx
19796
+ // src/ui/dialog.tsx
19797
+ var React9 = __toESM(require("react"), 1);
19798
+ var import_radix_ui6 = require("radix-ui");
19799
+ var import_lucide_react8 = require("lucide-react");
19323
19800
  var import_jsx_runtime20 = require("react/jsx-runtime");
19324
- var PRIMARY3 = "#0885FE";
19325
- var OHW_BLUE = `var(--ohw-primary, ${PRIMARY3})`;
19326
- var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
19801
+ function Dialog2({
19802
+ ...props
19803
+ }) {
19804
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
19805
+ }
19806
+ function DialogPortal({
19807
+ ...props
19808
+ }) {
19809
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
19810
+ }
19811
+ function DialogOverlay({
19812
+ className,
19813
+ ...props
19814
+ }) {
19815
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19816
+ import_radix_ui6.Dialog.Overlay,
19817
+ {
19818
+ "data-slot": "dialog-overlay",
19819
+ "data-ohw-link-modal-root": "",
19820
+ className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
19821
+ ...props
19822
+ }
19823
+ );
19824
+ }
19825
+ var DialogContent = React9.forwardRef(
19826
+ ({ className, children, showCloseButton = true, container, ...props }, ref) => {
19827
+ const positionMode = container ? "absolute" : "fixed";
19828
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DialogPortal, { container: container ?? void 0, children: [
19829
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
19830
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
19831
+ import_radix_ui6.Dialog.Content,
19832
+ {
19833
+ ref,
19834
+ "data-slot": "dialog-content",
19835
+ className: cn(
19836
+ positionMode,
19837
+ "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",
19838
+ "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
19839
+ container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
19840
+ className
19841
+ ),
19842
+ onMouseDown: (e) => e.stopPropagation(),
19843
+ ...props,
19844
+ children: [
19845
+ children,
19846
+ showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19847
+ import_radix_ui6.Dialog.Close,
19848
+ {
19849
+ type: "button",
19850
+ className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
19851
+ "aria-label": "Close",
19852
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.X, { size: 16, "aria-hidden": true })
19853
+ }
19854
+ ) : null
19855
+ ]
19856
+ }
19857
+ )
19858
+ ] });
19859
+ }
19860
+ );
19861
+ DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
19862
+ function DialogHeader({
19863
+ className,
19864
+ ...props
19865
+ }) {
19866
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
19867
+ }
19868
+ function DialogFooter({
19869
+ className,
19870
+ ...props
19871
+ }) {
19872
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19873
+ "div",
19874
+ {
19875
+ className: cn("flex items-center justify-end gap-2", className),
19876
+ ...props
19877
+ }
19878
+ );
19879
+ }
19880
+ var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19881
+ import_radix_ui6.Dialog.Title,
19882
+ {
19883
+ ref,
19884
+ className: cn(
19885
+ "text-lg font-semibold leading-none tracking-tight text-card-foreground",
19886
+ className
19887
+ ),
19888
+ ...props
19889
+ }
19890
+ ));
19891
+ DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
19892
+ var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19893
+ import_radix_ui6.Dialog.Description,
19894
+ {
19895
+ ref,
19896
+ className: cn("text-sm text-muted-foreground", className),
19897
+ ...props
19898
+ }
19899
+ ));
19900
+ DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
19901
+ var DialogClose = import_radix_ui6.Dialog.Close;
19902
+
19903
+ // src/ui/ai-section/AiMediaStripOverlay.tsx
19904
+ var import_jsx_runtime21 = require("react/jsx-runtime");
19905
+ var PRIMARY3 = "var(--ohw-primary, #0885FE)";
19906
+ 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]";
19327
19907
  function findMediaStripItemElement(sectionId, index) {
19328
19908
  const sectionEl2 = findByInstanceId(sectionId);
19329
19909
  if (!sectionEl2) return null;
@@ -19333,14 +19913,35 @@ function findMediaStripItemElement(sectionId, index) {
19333
19913
  }
19334
19914
  return null;
19335
19915
  }
19336
- function readRect2(ref) {
19337
- const el = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19916
+ function itemRefFromTarget(target) {
19917
+ if (!(target instanceof Element)) return null;
19918
+ if (target.closest(CHROME_SELECTOR)) return null;
19919
+ const itemEl = target.closest("[data-ohw-media-strip-item]");
19920
+ if (!itemEl) return null;
19921
+ const sectionEl2 = itemEl.closest("[data-ohw-section]");
19922
+ const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
19923
+ const sectionId = unit ? instanceIdOf(unit) || null : null;
19924
+ const index = Number(itemEl.dataset.ohwMediaStripIndex);
19925
+ if (!sectionId || Number.isNaN(index)) return null;
19926
+ return { sectionId, index };
19927
+ }
19928
+ function sameRef(a, b) {
19929
+ return a?.sectionId === b?.sectionId && a?.index === b?.index;
19930
+ }
19931
+ function rectOf(el) {
19338
19932
  if (!el) return null;
19339
19933
  const r2 = el.getBoundingClientRect();
19340
19934
  if (r2.width <= 0 || r2.height <= 0) return null;
19341
19935
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
19342
19936
  }
19343
- function useLiveItemRect(ref) {
19937
+ function readRect2(ref) {
19938
+ return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
19939
+ }
19940
+ function readStripRect(ref) {
19941
+ const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19942
+ return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
19943
+ }
19944
+ function useLiveItemRect(ref, strip = false) {
19344
19945
  const [rect, setRect] = (0, import_react13.useState)(null);
19345
19946
  (0, import_react13.useEffect)(() => {
19346
19947
  if (!ref) {
@@ -19348,7 +19949,7 @@ function useLiveItemRect(ref) {
19348
19949
  return;
19349
19950
  }
19350
19951
  const update = () => {
19351
- const next = readRect2(ref);
19952
+ const next = strip ? readStripRect(ref) : readRect2(ref);
19352
19953
  setRect(
19353
19954
  (prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
19354
19955
  );
@@ -19363,9 +19964,49 @@ function useLiveItemRect(ref) {
19363
19964
  window.removeEventListener("resize", update);
19364
19965
  clearInterval(interval);
19365
19966
  };
19366
- }, [ref?.sectionId, ref?.index]);
19967
+ }, [ref?.sectionId, ref?.index, strip]);
19367
19968
  return rect;
19368
19969
  }
19970
+ var TOOLBAR_STRIP_GAP = 52;
19971
+ var TOOLBAR_STRIP_GAP_MOBILE = 42;
19972
+ var TOOLBAR_EDGE_MARGIN2 = 4;
19973
+ function StripToolbarSlot({ stripRect, children }) {
19974
+ const slotRef = (0, import_react13.useRef)(null);
19975
+ const [shift, setShift] = (0, import_react13.useState)(0);
19976
+ const centerX = stripRect.left + stripRect.width / 2;
19977
+ (0, import_react13.useLayoutEffect)(() => {
19978
+ const slot = slotRef.current;
19979
+ if (!slot) return;
19980
+ const clamp = () => {
19981
+ const w = slot.offsetWidth;
19982
+ if (w <= 0) return;
19983
+ const half = w / 2;
19984
+ const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
19985
+ setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
19986
+ };
19987
+ clamp();
19988
+ const ro = new ResizeObserver(clamp);
19989
+ ro.observe(slot);
19990
+ return () => ro.disconnect();
19991
+ }, [centerX, children]);
19992
+ const mobile = window.innerWidth <= 480;
19993
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19994
+ "div",
19995
+ {
19996
+ ref: slotRef,
19997
+ "data-ohw-bridge": "",
19998
+ "data-ohw-item-interaction": "",
19999
+ className: "pointer-events-auto fixed",
20000
+ style: {
20001
+ top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
20002
+ left: centerX + shift,
20003
+ transform: "translate(-50%, -100%)",
20004
+ zIndex: 2147483645
20005
+ },
20006
+ children
20007
+ }
20008
+ );
20009
+ }
19369
20010
  function requestValidateTree(postToParent2, tree) {
19370
20011
  return new Promise((resolve) => {
19371
20012
  const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
@@ -19402,116 +20043,72 @@ function requestAssetPick(postToParent2) {
19402
20043
  postToParent2({ type: "ow:asset-pick", id });
19403
20044
  });
19404
20045
  }
19405
- function Pill({
20046
+ function ToolbarAction({
19406
20047
  label,
19407
20048
  onClick,
19408
- disabled,
19409
- active
20049
+ disabled = false,
20050
+ active = false,
20051
+ children
19410
20052
  }) {
19411
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19412
- "button",
19413
- {
19414
- type: "button",
19415
- onClick,
19416
- disabled,
19417
- style: {
19418
- height: 28,
19419
- padding: "0 10px",
19420
- display: "inline-flex",
19421
- alignItems: "center",
19422
- gap: 4,
19423
- borderRadius: 999,
19424
- border: "none",
19425
- cursor: disabled ? "default" : "pointer",
19426
- background: active ? OHW_BLUE_DARK : "#ffffff",
19427
- color: active ? "#ffffff" : OHW_BLUE_DARK,
19428
- opacity: disabled ? 0.4 : 1,
19429
- fontSize: 12,
19430
- lineHeight: "16px",
19431
- fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19432
- whiteSpace: "nowrap",
19433
- flex: "0 0 auto"
19434
- },
19435
- children: label
19436
- }
19437
- );
20053
+ const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
20054
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
20055
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: button }) : button }),
20056
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
20057
+ ] });
19438
20058
  }
19439
- function AltInput({ value, onCommit }) {
19440
- const [draft, setDraft] = (0, import_react13.useState)(value);
19441
- (0, import_react13.useEffect)(() => setDraft(value), [value]);
19442
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
19443
- "div",
19444
- {
19445
- style: {
19446
- display: "flex",
19447
- alignItems: "center",
19448
- gap: 6,
19449
- height: 28,
19450
- padding: "0 12px",
19451
- borderRadius: 999,
19452
- background: "#ffffff",
19453
- width: "100%",
19454
- maxWidth: 260,
19455
- boxSizing: "border-box"
19456
- },
19457
- children: [
19458
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19459
- "span",
19460
- {
19461
- style: {
19462
- flex: "0 0 auto",
19463
- color: OHW_BLUE_DARK,
19464
- fontSize: 10,
19465
- fontWeight: 700,
19466
- textTransform: "uppercase",
19467
- letterSpacing: 0.4
19468
- },
19469
- children: "Alt"
19470
- }
19471
- ),
19472
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19473
- "input",
20059
+ function ToolbarSeparator() {
20060
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
20061
+ }
20062
+ function OptionMenu({
20063
+ label,
20064
+ value,
20065
+ options,
20066
+ onChange
20067
+ }) {
20068
+ const current = options.find((o) => o.value === value) ?? options[0];
20069
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20070
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground", children: label }),
20071
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu, { modal: false, children: [
20072
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20073
+ "button",
20074
+ {
20075
+ type: "button",
20076
+ "aria-label": label,
20077
+ 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",
20078
+ children: [
20079
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1 text-left", children: current.label }),
20080
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
20081
+ ]
20082
+ }
20083
+ ) }),
20084
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
20085
+ const selected = option.value === value;
20086
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20087
+ DropdownMenuItem,
19474
20088
  {
19475
- type: "text",
19476
- value: draft,
19477
- onChange: (e) => setDraft(e.target.value),
19478
- onBlur: () => {
19479
- if (draft !== value) onCommit(draft);
19480
- },
19481
- onKeyDown: (e) => {
19482
- if (e.key === "Enter") e.currentTarget.blur();
19483
- if (e.key === "Escape") {
19484
- setDraft(value);
19485
- e.currentTarget.blur();
19486
- }
19487
- },
19488
- placeholder: "Describe this image",
19489
- "aria-label": "Image alt text",
19490
- style: {
19491
- flex: 1,
19492
- minWidth: 0,
19493
- border: "none",
19494
- outline: "none",
19495
- background: "transparent",
19496
- fontSize: 12,
19497
- lineHeight: "16px",
19498
- fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19499
- color: "#1f2937"
19500
- }
19501
- }
19502
- )
19503
- ]
19504
- }
19505
- );
20089
+ role: "menuitemradio",
20090
+ "aria-checked": selected,
20091
+ onSelect: () => onChange(option.value),
20092
+ className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
20093
+ children: [
20094
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: option.label }),
20095
+ selected && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Check, { size: 16, className: "text-bridge-primary" })
20096
+ ]
20097
+ },
20098
+ option.value
20099
+ );
20100
+ }) })
20101
+ ] })
20102
+ ] });
19506
20103
  }
19507
20104
  var VARIANTS = [
19508
20105
  { value: "logos", label: "Logos" },
19509
20106
  { value: "reel", label: "Reel" }
19510
20107
  ];
19511
20108
  var ALIGNS = [
19512
- { value: "left", label: "Left" },
19513
- { value: "center", label: "Center" },
19514
- { value: "right", label: "Right" }
20109
+ { value: "left", label: "Align left", Icon: import_lucide_react9.AlignLeft },
20110
+ { value: "center", label: "Align center", Icon: import_lucide_react9.AlignCenter },
20111
+ { value: "right", label: "Align right", Icon: import_lucide_react9.AlignRight }
19515
20112
  ];
19516
20113
  var HOVERS = [
19517
20114
  { value: "none", label: "None" },
@@ -19519,104 +20116,104 @@ var HOVERS = [
19519
20116
  { value: "zoom", label: "Zoom" },
19520
20117
  { value: "fade", label: "Fade" }
19521
20118
  ];
19522
- var TREATMENTS = [
19523
- { value: "color", label: "Color" },
19524
- { value: "grayscale", label: "Grayscale" }
19525
- ];
19526
20119
  var HTTP_URL_RE = /^https?:\/\/\S+$/i;
19527
- function LinkInput({ value, onCommit }) {
19528
- const [draft, setDraft] = (0, import_react13.useState)(value);
20120
+ function LinkModal({
20121
+ href,
20122
+ linkTarget,
20123
+ onClose,
20124
+ onSave
20125
+ }) {
20126
+ const [draft, setDraft] = (0, import_react13.useState)(href);
20127
+ const [newTab, setNewTab] = (0, import_react13.useState)(linkTarget !== "same-tab");
19529
20128
  const [invalid, setInvalid] = (0, import_react13.useState)(false);
19530
- (0, import_react13.useEffect)(() => {
19531
- setDraft(value);
19532
- setInvalid(false);
19533
- }, [value]);
19534
- const commit2 = () => {
20129
+ const save = () => {
19535
20130
  const next = draft.trim();
19536
- if (next === value) return setInvalid(false);
19537
- if (next && !HTTP_URL_RE.test(next)) return setInvalid(true);
19538
- setInvalid(false);
19539
- onCommit(next);
19540
- };
19541
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
19542
- "div",
19543
- {
19544
- style: {
19545
- display: "flex",
19546
- alignItems: "center",
19547
- gap: 6,
19548
- height: 28,
19549
- padding: "0 12px",
19550
- borderRadius: 999,
19551
- background: "#ffffff",
19552
- width: "100%",
19553
- maxWidth: 260,
19554
- boxSizing: "border-box",
19555
- boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
19556
- },
19557
- children: [
19558
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19559
- "span",
19560
- {
19561
- style: {
19562
- flex: "0 0 auto",
19563
- color: OHW_BLUE_DARK,
19564
- fontSize: 10,
19565
- fontWeight: 700,
19566
- textTransform: "uppercase",
19567
- letterSpacing: 0.4
19568
- },
19569
- children: "Link"
19570
- }
19571
- ),
19572
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19573
- "input",
19574
- {
19575
- type: "text",
19576
- inputMode: "url",
19577
- value: draft,
19578
- onChange: (e) => setDraft(e.target.value),
19579
- onBlur: commit2,
19580
- onKeyDown: (e) => {
19581
- if (e.key === "Enter") e.currentTarget.blur();
19582
- if (e.key === "Escape") {
19583
- setDraft(value);
19584
- setInvalid(false);
19585
- e.currentTarget.blur();
19586
- }
19587
- },
19588
- placeholder: "https://example.com",
19589
- "aria-label": "Image link URL",
19590
- "aria-invalid": invalid,
19591
- style: {
19592
- flex: 1,
19593
- minWidth: 0,
19594
- border: "none",
19595
- outline: "none",
19596
- background: "transparent",
19597
- fontSize: 12,
19598
- lineHeight: "16px",
19599
- fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19600
- color: "#1f2937"
19601
- }
19602
- }
19603
- )
19604
- ]
20131
+ if (next && !HTTP_URL_RE.test(next)) {
20132
+ setInvalid(true);
20133
+ return;
19605
20134
  }
19606
- );
20135
+ onSave(next, newTab ? "new-tab" : "same-tab");
20136
+ onClose();
20137
+ };
20138
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Dialog2, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogContent, { "data-ohw-link-modal-root": "", className: "max-w-[400px] gap-4 p-5", children: [
20139
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogTitle, { className: "text-base", children: "Image link" }) }),
20140
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-3", children: [
20141
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20142
+ "input",
20143
+ {
20144
+ autoFocus: true,
20145
+ type: "text",
20146
+ inputMode: "url",
20147
+ value: draft,
20148
+ onChange: (e) => {
20149
+ setDraft(e.target.value);
20150
+ setInvalid(false);
20151
+ },
20152
+ onKeyDown: (e) => {
20153
+ if (e.key === "Enter") save();
20154
+ },
20155
+ placeholder: "https://example.com",
20156
+ "aria-label": "Image link URL",
20157
+ "aria-invalid": invalid,
20158
+ className: cn(
20159
+ "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",
20160
+ invalid && "border-destructive focus:border-destructive"
20161
+ )
20162
+ }
20163
+ ),
20164
+ invalid && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
20165
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
20166
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
20167
+ "Open in new tab"
20168
+ ] })
20169
+ ] }),
20170
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogFooter, { children: [
20171
+ href && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20172
+ "button",
20173
+ {
20174
+ type: "button",
20175
+ onClick: () => {
20176
+ onSave("", "new-tab");
20177
+ onClose();
20178
+ },
20179
+ className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
20180
+ children: "Remove link"
20181
+ }
20182
+ ),
20183
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20184
+ "button",
20185
+ {
20186
+ type: "button",
20187
+ onClick: onClose,
20188
+ className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
20189
+ children: "Cancel"
20190
+ }
20191
+ ),
20192
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20193
+ "button",
20194
+ {
20195
+ type: "button",
20196
+ onClick: save,
20197
+ className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
20198
+ children: "Save"
20199
+ }
20200
+ )
20201
+ ] })
20202
+ ] }) });
19607
20203
  }
19608
20204
  function MediaStripToolbar({
19609
20205
  entry,
19610
20206
  index,
19611
20207
  pending,
19612
20208
  error,
20209
+ itemEditOn,
20210
+ onToggleItemEdit,
19613
20211
  onSetVariant,
19614
20212
  onSetAlign,
19615
20213
  onSetHover,
19616
20214
  onSetTreatment,
19617
20215
  onResize,
19618
- onSetAlt,
19619
- onSetLink,
20216
+ onOpenLink,
19620
20217
  onAddItem,
19621
20218
  onRemoveItem,
19622
20219
  onChangeImage,
@@ -19625,81 +20222,102 @@ function MediaStripToolbar({
19625
20222
  }) {
19626
20223
  const items = mediaStripItems(entry.tree);
19627
20224
  const itemCount = items.length;
19628
- const currentAlt = items[index]?.alt ?? "";
19629
- const currentHref2 = items[index]?.href ?? "";
19630
- const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
19631
20225
  const slots = findMediaStripSlots(entry.tree);
19632
20226
  const variant = slots?.variant === "reel" ? "reel" : "logos";
19633
20227
  const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
19634
20228
  const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
19635
20229
  const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
19636
20230
  const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19637
- const isMobile = window.innerWidth <= 480;
19638
- const rowStyle = isMobile ? {
19639
- display: "flex",
19640
- gap: 6,
19641
- flexWrap: "nowrap",
19642
- justifyContent: "center",
19643
- overflowX: "auto",
19644
- WebkitOverflowScrolling: "touch",
19645
- width: "100%",
19646
- scrollbarWidth: "none"
19647
- } : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
19648
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
20231
+ const mobile = window.innerWidth <= 480;
20232
+ const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
20233
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
19649
20234
  "div",
19650
20235
  {
19651
20236
  "data-ohw-bridge": "",
19652
20237
  "data-ohw-toolbar": "",
19653
20238
  onMouseDown: (e) => e.stopPropagation(),
19654
- style: {
19655
- display: "flex",
19656
- flexDirection: "column",
19657
- gap: 6,
19658
- alignItems: "center",
19659
- background: OHW_BLUE,
19660
- padding: 8,
19661
- borderRadius: 12,
19662
- boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
19663
- pointerEvents: pending ? "none" : "auto",
19664
- opacity: pending ? 0.6 : 1,
19665
- maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
19666
- },
20239
+ className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
20240
+ style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
19667
20241
  children: [
19668
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19669
- VARIANTS.map((v) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: v.label, active: variant === v.value, onClick: () => onSetVariant(v.value) }, v.value)),
19670
- ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: a.label, active: align === a.value, onClick: () => onSetAlign(a.value) }, a.value))
19671
- ] }),
19672
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19673
- HOVERS.map((h) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: h.label, active: hover === h.value, onClick: () => onSetHover(h.value) }, h.value)),
19674
- TREATMENTS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: t.label, active: treatment === t.value, onClick: () => onSetTreatment(t.value) }, t.value))
19675
- ] }),
19676
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
19677
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2212", onClick: () => onResize(-8) }),
19678
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { style: { color: "#ffffff", fontSize: 12, minWidth: 34, textAlign: "center" }, children: [
19679
- sizeValue,
19680
- "px"
19681
- ] }),
19682
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "+", onClick: () => onResize(8) })
19683
- ] }),
19684
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AltInput, { value: currentAlt, onCommit: onSetAlt }) }),
19685
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(LinkInput, { value: currentHref2, onCommit: (href) => onSetLink(href, currentTarget) }) }),
19686
- currentHref2 && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19687
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "New tab", active: currentTarget === "new-tab", onClick: () => onSetLink(currentHref2, "new-tab") }),
19688
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "Same tab", active: currentTarget === "same-tab", onClick: () => onSetLink(currentHref2, "same-tab") })
19689
- ] }),
19690
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19691
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "Change Image", onClick: onChangeImage }),
19692
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "+ Item", onClick: onAddItem }),
19693
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2212 Item", onClick: onRemoveItem, disabled: itemCount <= 1 })
19694
- ] }),
19695
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19696
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2190 Move", onClick: onMoveLeft, disabled: index <= 0 }),
19697
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2192 Move", onClick: onMoveRight, disabled: index >= itemCount - 1 })
19698
- ] }),
19699
- error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20242
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20243
+ "div",
20244
+ {
20245
+ className: cn(
20246
+ "flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
20247
+ "shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
20248
+ mobile ? "flex-wrap justify-center" : "flex-nowrap"
20249
+ ),
20250
+ children: [
20251
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
20252
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20253
+ CustomToolbarButton,
20254
+ {
20255
+ type: "button",
20256
+ "aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
20257
+ "aria-pressed": itemEditOn,
20258
+ onClick: onToggleItemEdit,
20259
+ className: "group size-8",
20260
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20261
+ import_lucide_react9.Star,
20262
+ {
20263
+ size: 16,
20264
+ fill: "currentColor",
20265
+ strokeWidth: 0,
20266
+ className: cn(
20267
+ "transition-colors",
20268
+ itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
20269
+ ),
20270
+ style: { pointerEvents: "none" }
20271
+ }
20272
+ )
20273
+ }
20274
+ ) }),
20275
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
20276
+ ] }),
20277
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
20278
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Image, { size: 16, style: { pointerEvents: "none" } }) }),
20279
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Link, { size: 16, style: { pointerEvents: "none" } }) }),
20280
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ArrowLeft, { size: 16, style: { pointerEvents: "none" } }) }),
20281
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20282
+ ToolbarAction,
20283
+ {
20284
+ label: gatedLabel("Move right"),
20285
+ onClick: onMoveRight,
20286
+ disabled: !itemEditOn || index >= itemCount - 1,
20287
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ArrowRight, { size: 16, style: { pointerEvents: "none" } })
20288
+ }
20289
+ ),
20290
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
20291
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
20292
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
20293
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
20294
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20295
+ ToolbarAction,
20296
+ {
20297
+ label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
20298
+ active: treatment === "grayscale",
20299
+ onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
20300
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Palette, { size: 16, style: { pointerEvents: "none" } })
20301
+ }
20302
+ ),
20303
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
20304
+ ALIGNS.map(({ value, label, Icon }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label, active: align === value, onClick: () => onSetAlign(value), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon, { size: 16, style: { pointerEvents: "none" } }) }, value)),
20305
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
20306
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Minus, { size: 16, style: { pointerEvents: "none" } }) }),
20307
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
20308
+ sizeValue,
20309
+ "px"
20310
+ ] }),
20311
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
20312
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
20313
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
20314
+ ]
20315
+ }
20316
+ ),
20317
+ error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
19700
20318
  ]
19701
20319
  }
19702
- );
20320
+ ) });
19703
20321
  }
19704
20322
  function findMediaStripSlots(tree) {
19705
20323
  const stack = tree.rows.flatMap((row) => row.blocks);
@@ -19718,31 +20336,23 @@ function AiMediaStripOverlay({
19718
20336
  }) {
19719
20337
  const [hover, setHover] = (0, import_react13.useState)(null);
19720
20338
  const [active, setActive] = (0, import_react13.useState)(null);
20339
+ const [itemEditOn, setItemEditOn] = (0, import_react13.useState)(false);
20340
+ const [linkOpen, setLinkOpen] = (0, import_react13.useState)(false);
19721
20341
  const [pending, setPending] = (0, import_react13.useState)(false);
19722
20342
  const [error, setError] = (0, import_react13.useState)(null);
19723
20343
  const activeRef = (0, import_react13.useRef)(null);
19724
20344
  activeRef.current = active;
20345
+ const linkOpenRef = (0, import_react13.useRef)(false);
20346
+ linkOpenRef.current = linkOpen;
19725
20347
  (0, import_react13.useEffect)(() => {
19726
20348
  const onMove = (e) => {
20349
+ const ref = itemRefFromTarget(e.target);
19727
20350
  const t = e.target;
19728
- if (!(t instanceof HTMLElement)) return;
19729
- 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]")) {
19730
- return;
19731
- }
19732
- const itemEl = t.closest("[data-ohw-media-strip-item]");
19733
- if (!itemEl) {
19734
- setHover(null);
19735
- return;
19736
- }
19737
- const sectionEl2 = itemEl.closest("[data-ohw-section]");
19738
- const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
19739
- const sectionId = unit ? instanceIdOf(unit) || null : null;
19740
- const index = Number(itemEl.dataset.ohwMediaStripIndex);
19741
- if (!sectionId || Number.isNaN(index)) {
19742
- setHover(null);
19743
- return;
19744
- }
19745
- setHover({ sectionId, index });
20351
+ const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
20352
+ setHover((prev) => {
20353
+ const next = ref && !overEditable ? ref : null;
20354
+ return sameRef(prev, next) ? prev : next;
20355
+ });
19746
20356
  };
19747
20357
  const onLeave = () => setHover(null);
19748
20358
  document.addEventListener("mousemove", onMove, { passive: true });
@@ -19754,23 +20364,25 @@ function AiMediaStripOverlay({
19754
20364
  }, []);
19755
20365
  (0, import_react13.useEffect)(() => {
19756
20366
  const onClick = (e) => {
19757
- const current = activeRef.current;
19758
- if (!current) return;
19759
20367
  const t = e.target;
19760
- if (!(t instanceof HTMLElement)) return;
19761
- if (t.closest("[data-ohw-item-interaction]")) return;
19762
- const itemEl = findMediaStripItemElement(current.sectionId, current.index);
19763
- if (itemEl && itemEl.contains(t)) return;
19764
- setActive(null);
20368
+ if (!(t instanceof Element)) return;
20369
+ if (t.closest(CHROME_SELECTOR)) return;
20370
+ const ref = itemRefFromTarget(t);
20371
+ if (sameRef(activeRef.current, ref)) return;
20372
+ if (ref) clearInteractionChromeRef.current();
20373
+ setItemEditOn(false);
19765
20374
  setError(null);
20375
+ setActive(ref);
19766
20376
  };
19767
20377
  document.addEventListener("click", onClick, true);
19768
20378
  return () => document.removeEventListener("click", onClick, true);
19769
- }, []);
20379
+ }, [clearInteractionChromeRef]);
19770
20380
  (0, import_react13.useEffect)(() => {
19771
20381
  const onBlur = () => {
19772
20382
  if (!activeRef.current) return;
19773
20383
  setActive(null);
20384
+ setItemEditOn(false);
20385
+ setLinkOpen(false);
19774
20386
  setError(null);
19775
20387
  };
19776
20388
  window.addEventListener("blur", onBlur);
@@ -19780,7 +20392,10 @@ function AiMediaStripOverlay({
19780
20392
  const onKeyDown = (e) => {
19781
20393
  if (e.key !== "Escape") return;
19782
20394
  if (!activeRef.current) return;
20395
+ if (linkOpenRef.current) return;
20396
+ if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
19783
20397
  setActive(null);
20398
+ setItemEditOn(false);
19784
20399
  setError(null);
19785
20400
  };
19786
20401
  document.addEventListener("keydown", onKeyDown);
@@ -19814,137 +20429,133 @@ function AiMediaStripOverlay({
19814
20429
  tree: nextTree,
19815
20430
  label: entry.label,
19816
20431
  media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
19817
- ...entry.brand ? { brand: entry.brand } : {}
20432
+ ...entry.brand ? { brand: entry.brand } : {},
20433
+ // The user is already looking at the strip they just edited — recentering the viewport
20434
+ // on every edit reads as the section jumping around.
20435
+ skipScrollIntoView: true
19818
20436
  });
19819
20437
  return true;
19820
20438
  },
19821
20439
  [findEntry, postToParent2, applyTreeLocalRef]
19822
20440
  );
19823
20441
  const activeEntry = active ? findEntry(active.sectionId) : null;
19824
- const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
19825
20442
  const activeItemRect = useLiveItemRect(active);
19826
- const TOOLBAR_APPROX_H = 170;
19827
- const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
19828
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
19829
- hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19830
- "button",
19831
- {
19832
- type: "button",
19833
- "data-ohw-toolbar": "",
19834
- onClick: () => {
19835
- clearInteractionChromeRef.current();
19836
- setActive(hover);
19837
- },
19838
- "aria-label": "Configure media item",
19839
- style: {
19840
- position: "fixed",
19841
- top: hoverHandleRect.top + 8,
19842
- left: hoverHandleRect.left + hoverHandleRect.width - 36,
19843
- width: 28,
19844
- height: 28,
19845
- borderRadius: 8,
19846
- border: `1.5px dashed ${PRIMARY3}`,
19847
- background: "#ffffff",
19848
- color: PRIMARY3,
19849
- display: "flex",
19850
- alignItems: "center",
19851
- justifyContent: "center",
19852
- cursor: "pointer",
19853
- zIndex: 2147483643,
19854
- fontSize: 14,
19855
- fontWeight: 700
19856
- },
19857
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.Star, { size: 14, style: { pointerEvents: "none" } })
19858
- }
19859
- ),
19860
- activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19861
- ItemInteractionLayer,
19862
- {
19863
- rect: activeItemRect,
19864
- state: toolbarState,
19865
- toolbar: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19866
- MediaStripToolbar,
19867
- {
19868
- entry: activeEntry,
19869
- index: active.index,
19870
- pending,
19871
- error,
19872
- onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
19873
- onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
19874
- onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
19875
- onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
19876
- onResize: (delta) => {
19877
- const slots = findMediaStripSlots(activeEntry.tree);
19878
- const variant = slots?.variant === "reel" ? "reel" : "logos";
19879
- const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19880
- void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
19881
- },
19882
- onSetAlt: (alt) => {
19883
- void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
19884
- },
19885
- onSetLink: (href, linkTarget) => {
20443
+ const activeStripRect = useLiveItemRect(active, true);
20444
+ const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
20445
+ const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
20446
+ const activeItem = active ? activeItems[active.index] : void 0;
20447
+ const activeHref = activeItem?.href ?? "";
20448
+ const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
20449
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
20450
+ hoverRect && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20451
+ activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
20452
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
20453
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20454
+ MediaStripToolbar,
20455
+ {
20456
+ entry: activeEntry,
20457
+ index: active.index,
20458
+ pending,
20459
+ error,
20460
+ itemEditOn,
20461
+ onToggleItemEdit: () => setItemEditOn((on) => !on),
20462
+ onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
20463
+ onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
20464
+ onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
20465
+ onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
20466
+ onResize: (delta) => {
20467
+ const slots = findMediaStripSlots(activeEntry.tree);
20468
+ const variant = slots?.variant === "reel" ? "reel" : "logos";
20469
+ const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
20470
+ void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
20471
+ },
20472
+ onOpenLink: () => setLinkOpen(true),
20473
+ onAddItem: () => {
20474
+ void requestAssetPick(postToParent2).then((picked) => {
20475
+ if (!picked) return;
20476
+ const item = { assetId: picked.assetId, alt: "Logo" };
19886
20477
  void runMutation(
19887
20478
  active.sectionId,
19888
- (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
19889
- );
19890
- },
19891
- onAddItem: () => {
19892
- void requestAssetPick(postToParent2).then((picked) => {
19893
- if (!picked) return;
19894
- const item = { assetId: picked.assetId, alt: "Logo" };
19895
- void runMutation(
19896
- active.sectionId,
19897
- (tree) => addMediaStripItem(tree, item, active.index),
19898
- { [picked.assetId]: picked.url }
19899
- ).then((applied) => {
19900
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19901
- });
20479
+ (tree) => addMediaStripItem(tree, item, active.index),
20480
+ { [picked.assetId]: picked.url }
20481
+ ).then((applied) => {
20482
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19902
20483
  });
19903
- },
19904
- onChangeImage: () => {
19905
- void requestAssetPick(postToParent2).then((picked) => {
19906
- if (!picked) return;
19907
- void runMutation(
19908
- active.sectionId,
19909
- (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
19910
- { [picked.assetId]: picked.url }
19911
- );
19912
- });
19913
- },
19914
- onRemoveItem: () => {
19915
- void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
19916
- (applied) => {
19917
- if (applied) setActive(null);
19918
- }
19919
- );
19920
- },
19921
- onMoveLeft: () => {
19922
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
19923
- (applied) => {
19924
- if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
19925
- }
19926
- );
19927
- },
19928
- onMoveRight: () => {
19929
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
19930
- (applied) => {
19931
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19932
- }
20484
+ });
20485
+ },
20486
+ onChangeImage: () => {
20487
+ void requestAssetPick(postToParent2).then((picked) => {
20488
+ if (!picked) return;
20489
+ void runMutation(
20490
+ active.sectionId,
20491
+ (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
20492
+ { [picked.assetId]: picked.url }
19933
20493
  );
19934
- }
20494
+ });
20495
+ },
20496
+ onRemoveItem: () => {
20497
+ void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
20498
+ (applied) => {
20499
+ if (applied) setActive(null);
20500
+ }
20501
+ );
20502
+ },
20503
+ onMoveLeft: () => {
20504
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
20505
+ (applied) => {
20506
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
20507
+ }
20508
+ );
20509
+ },
20510
+ onMoveRight: () => {
20511
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
20512
+ (applied) => {
20513
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
20514
+ }
20515
+ );
19935
20516
  }
19936
- )
19937
- }
19938
- )
20517
+ }
20518
+ ) }),
20519
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20520
+ "div",
20521
+ {
20522
+ "data-ohw-bridge": "",
20523
+ "data-ohw-item-interaction": "",
20524
+ "aria-hidden": true,
20525
+ className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
20526
+ style: {
20527
+ top: activeItemRect.top + activeItemRect.height + 10,
20528
+ left: activeItemRect.left - 5,
20529
+ background: PRIMARY3,
20530
+ zIndex: 2147483644
20531
+ },
20532
+ children: "Media item"
20533
+ }
20534
+ ),
20535
+ linkOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20536
+ LinkModal,
20537
+ {
20538
+ href: activeHref,
20539
+ linkTarget: activeTarget,
20540
+ onClose: () => setLinkOpen(false),
20541
+ onSave: (href, linkTarget) => {
20542
+ void runMutation(
20543
+ active.sectionId,
20544
+ (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
20545
+ );
20546
+ }
20547
+ }
20548
+ )
20549
+ ] })
19939
20550
  ] });
19940
20551
  }
19941
20552
 
19942
20553
  // src/ui/ai-section/AiPricingCardOverlay.tsx
19943
20554
  var import_react14 = require("react");
19944
- var import_lucide_react9 = require("lucide-react");
19945
- var import_jsx_runtime21 = require("react/jsx-runtime");
20555
+ var import_lucide_react10 = require("lucide-react");
20556
+ var import_jsx_runtime22 = require("react/jsx-runtime");
19946
20557
  var PRIMARY4 = "var(--ohw-primary, #0885FE)";
19947
- 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]";
20558
+ 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]";
19948
20559
  function findPricingCardElement(sectionId, index) {
19949
20560
  const sectionEl2 = findByInstanceId(sectionId);
19950
20561
  if (!sectionEl2) return null;
@@ -19956,7 +20567,7 @@ function findPricingCardElement(sectionId, index) {
19956
20567
  }
19957
20568
  function cardRefFromTarget(target) {
19958
20569
  if (!(target instanceof Element)) return null;
19959
- if (target.closest(CHROME_SELECTOR)) return null;
20570
+ if (target.closest(CHROME_SELECTOR2)) return null;
19960
20571
  const cardEl = target.closest("[data-ohw-pricing-card]");
19961
20572
  if (!cardEl) return null;
19962
20573
  const sectionEl2 = cardEl.closest("[data-ohw-section]");
@@ -19966,21 +20577,21 @@ function cardRefFromTarget(target) {
19966
20577
  if (!sectionId || Number.isNaN(index)) return null;
19967
20578
  return { sectionId, index };
19968
20579
  }
19969
- function sameRef(a, b) {
20580
+ function sameRef2(a, b) {
19970
20581
  return a?.sectionId === b?.sectionId && a?.index === b?.index;
19971
20582
  }
19972
- function rectOf(el) {
20583
+ function rectOf2(el) {
19973
20584
  if (!el) return null;
19974
20585
  const r2 = el.getBoundingClientRect();
19975
20586
  if (r2.width <= 0 || r2.height <= 0) return null;
19976
20587
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
19977
20588
  }
19978
20589
  function readRect3(ref) {
19979
- return rectOf(ref && findPricingCardElement(ref.sectionId, ref.index));
20590
+ return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
19980
20591
  }
19981
20592
  function readGridRect(ref) {
19982
20593
  const card = ref && findPricingCardElement(ref.sectionId, ref.index);
19983
- return rectOf(card?.closest("[data-ohw-pricing-collection]") ?? card);
20594
+ return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
19984
20595
  }
19985
20596
  function useLiveCardRect(ref, grid = false) {
19986
20597
  const [rect, setRect] = (0, import_react14.useState)(null);
@@ -20010,7 +20621,7 @@ function useLiveCardRect(ref, grid = false) {
20010
20621
  }
20011
20622
  var TOOLBAR_GRID_GAP = 52;
20012
20623
  var TOOLBAR_GRID_GAP_MOBILE = 42;
20013
- var TOOLBAR_EDGE_MARGIN2 = 4;
20624
+ var TOOLBAR_EDGE_MARGIN3 = 4;
20014
20625
  function GridToolbarSlot({ gridRect, children }) {
20015
20626
  const slotRef = (0, import_react14.useRef)(null);
20016
20627
  const [shift, setShift] = (0, import_react14.useState)(0);
@@ -20022,7 +20633,7 @@ function GridToolbarSlot({ gridRect, children }) {
20022
20633
  const w = slot.offsetWidth;
20023
20634
  if (w <= 0) return;
20024
20635
  const half = w / 2;
20025
- const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
20636
+ const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
20026
20637
  setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
20027
20638
  };
20028
20639
  clamp();
@@ -20031,7 +20642,7 @@ function GridToolbarSlot({ gridRect, children }) {
20031
20642
  return () => ro.disconnect();
20032
20643
  }, [centerX, children]);
20033
20644
  const mobile = window.innerWidth <= 480;
20034
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20645
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20035
20646
  "div",
20036
20647
  {
20037
20648
  ref: slotRef,
@@ -20066,7 +20677,7 @@ function requestValidateTree2(postToParent2, tree) {
20066
20677
  });
20067
20678
  }
20068
20679
  function StyleSwatch({ style }) {
20069
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20680
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20070
20681
  "span",
20071
20682
  {
20072
20683
  "aria-hidden": true,
@@ -20080,35 +20691,35 @@ function StyleSwatch({ style }) {
20080
20691
  );
20081
20692
  }
20082
20693
  function ButtonGlyph() {
20083
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20084
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
20085
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
20694
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20695
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
20696
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
20086
20697
  ] });
20087
20698
  }
20088
20699
  function FeatureGlyph({ mode }) {
20089
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20090
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
20091
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
20092
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
20093
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
20094
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
20095
- mode === "add" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
20700
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20701
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
20702
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
20703
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
20704
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
20705
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
20706
+ mode === "add" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
20096
20707
  ] });
20097
20708
  }
20098
- function ToolbarAction({
20709
+ function ToolbarAction2({
20099
20710
  label,
20100
20711
  onClick,
20101
20712
  disabled = false,
20102
20713
  children
20103
20714
  }) {
20104
- const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
20105
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
20106
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: button }) : button }),
20107
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
20715
+ const button = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
20716
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
20717
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: button }) : button }),
20718
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
20108
20719
  ] });
20109
20720
  }
20110
- function ToolbarSeparator() {
20111
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
20721
+ function ToolbarSeparator2() {
20722
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
20112
20723
  }
20113
20724
  function CardStyleMenu({
20114
20725
  value,
@@ -20116,7 +20727,7 @@ function CardStyleMenu({
20116
20727
  disabled = false
20117
20728
  }) {
20118
20729
  const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
20119
- const trigger = /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20730
+ const trigger = /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
20120
20731
  "button",
20121
20732
  {
20122
20733
  type: "button",
@@ -20127,28 +20738,28 @@ function CardStyleMenu({
20127
20738
  disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
20128
20739
  ),
20129
20740
  children: [
20130
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StyleSwatch, { style: current.value }),
20131
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1 text-left", children: current.label }),
20132
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
20741
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: current.value }),
20742
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex-1 text-left", children: current.label }),
20743
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
20133
20744
  ]
20134
20745
  }
20135
20746
  );
20136
20747
  if (disabled) {
20137
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20138
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
20139
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
20140
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: trigger }) }),
20141
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
20748
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20749
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
20750
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
20751
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: trigger }) }),
20752
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
20142
20753
  ] })
20143
20754
  ] });
20144
20755
  }
20145
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20146
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
20147
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu, { modal: false, children: [
20148
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { asChild: true, children: trigger }),
20149
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
20756
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20757
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
20758
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenu, { modal: false, children: [
20759
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuTrigger, { asChild: true, children: trigger }),
20760
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
20150
20761
  const selected = style.value === value;
20151
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20762
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
20152
20763
  DropdownMenuItem,
20153
20764
  {
20154
20765
  role: "menuitemradio",
@@ -20156,9 +20767,9 @@ function CardStyleMenu({
20156
20767
  onSelect: () => onChange(style.value),
20157
20768
  className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
20158
20769
  children: [
20159
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StyleSwatch, { style: style.value }),
20160
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: style.label }),
20161
- selected && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Check, { size: 16, className: "text-bridge-primary" })
20770
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: style.value }),
20771
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: style.label }),
20772
+ selected && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Check, { size: 16, className: "text-bridge-primary" })
20162
20773
  ]
20163
20774
  },
20164
20775
  style.value
@@ -20188,7 +20799,7 @@ function PricingCardToolbar({
20188
20799
  const style = pricingCardStyle(entry.tree, index);
20189
20800
  const featuredTag = pricingCardFeaturedTag(entry.tree, index);
20190
20801
  const mobile = window.innerWidth <= 480;
20191
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20802
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
20192
20803
  "div",
20193
20804
  {
20194
20805
  "data-ohw-bridge": "",
@@ -20200,7 +20811,7 @@ function PricingCardToolbar({
20200
20811
  ),
20201
20812
  style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
20202
20813
  children: [
20203
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20814
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
20204
20815
  "div",
20205
20816
  {
20206
20817
  className: cn(
@@ -20209,8 +20820,8 @@ function PricingCardToolbar({
20209
20820
  mobile ? "flex-wrap justify-center" : "flex-nowrap"
20210
20821
  ),
20211
20822
  children: [
20212
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
20213
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20823
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
20824
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20214
20825
  CustomToolbarButton,
20215
20826
  {
20216
20827
  type: "button",
@@ -20218,8 +20829,8 @@ function PricingCardToolbar({
20218
20829
  "aria-pressed": featuredTag,
20219
20830
  onClick: () => onSetFeaturedTag(!featuredTag),
20220
20831
  className: "group size-8",
20221
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20222
- import_lucide_react9.Star,
20832
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20833
+ import_lucide_react10.Star,
20223
20834
  {
20224
20835
  size: 16,
20225
20836
  fill: "currentColor",
@@ -20233,25 +20844,25 @@ function PricingCardToolbar({
20233
20844
  )
20234
20845
  }
20235
20846
  ) }),
20236
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
20847
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
20237
20848
  ] }),
20238
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
20239
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
20240
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
20241
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ButtonGlyph, {}) }),
20242
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "relative inline-flex", children: [
20243
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ButtonGlyph, {}),
20244
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Minus, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
20849
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
20850
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
20851
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
20852
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}) }),
20853
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "relative inline-flex", children: [
20854
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}),
20855
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Minus, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
20245
20856
  ] }) }),
20246
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FeatureGlyph, { mode: "add" }) }),
20247
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FeatureGlyph, { mode: "remove" }) }),
20248
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
20249
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
20250
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Minus, { size: 16, style: { pointerEvents: "none" } }) })
20857
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FeatureGlyph, { mode: "add" }) }),
20858
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FeatureGlyph, { mode: "remove" }) }),
20859
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
20860
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
20861
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Minus, { size: 16, style: { pointerEvents: "none" } }) })
20251
20862
  ]
20252
20863
  }
20253
20864
  ),
20254
- error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
20865
+ error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
20255
20866
  ]
20256
20867
  }
20257
20868
  ) });
@@ -20285,7 +20896,7 @@ function AiPricingCardOverlay({
20285
20896
  const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
20286
20897
  setHover((prev) => {
20287
20898
  const next = ref && !overEditable ? ref : null;
20288
- return sameRef(prev, next) ? prev : next;
20899
+ return sameRef2(prev, next) ? prev : next;
20289
20900
  });
20290
20901
  };
20291
20902
  const onLeave = () => setHover(null);
@@ -20300,10 +20911,10 @@ function AiPricingCardOverlay({
20300
20911
  const onClick = (e) => {
20301
20912
  const t = e.target;
20302
20913
  if (!(t instanceof Element)) return;
20303
- if (t.closest(CHROME_SELECTOR)) return;
20914
+ if (t.closest(CHROME_SELECTOR2)) return;
20304
20915
  const ref = cardRefFromTarget(t);
20305
- setActive((prev) => sameRef(prev, ref) ? prev : ref);
20306
- if (!ref || !sameRef(activeRef.current, ref)) setError(null);
20916
+ setActive((prev) => sameRef2(prev, ref) ? prev : ref);
20917
+ if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
20307
20918
  };
20308
20919
  document.addEventListener("click", onClick, true);
20309
20920
  return () => document.removeEventListener("click", onClick, true);
@@ -20368,12 +20979,12 @@ function AiPricingCardOverlay({
20368
20979
  const activeEntry = active ? findEntry(active.sectionId) : null;
20369
20980
  const activeCardRect = useLiveCardRect(active);
20370
20981
  const activeGridRect = useLiveCardRect(active, true);
20371
- const hoverRect = useLiveCardRect(hover && !sameRef(hover, active) ? hover : null);
20372
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
20373
- hoverRect && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20374
- activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
20375
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
20376
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20982
+ const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
20983
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
20984
+ hoverRect && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20985
+ activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
20986
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
20987
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20377
20988
  PricingCardToolbar,
20378
20989
  {
20379
20990
  entry: activeEntry,
@@ -20401,7 +21012,7 @@ function AiPricingCardOverlay({
20401
21012
  onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
20402
21013
  }
20403
21014
  ) }),
20404
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21015
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20405
21016
  "div",
20406
21017
  {
20407
21018
  "data-ohw-bridge": "",
@@ -20423,7 +21034,7 @@ function AiPricingCardOverlay({
20423
21034
 
20424
21035
  // src/ui/ai-section/AiVideoOverlay.tsx
20425
21036
  var import_react15 = require("react");
20426
- var import_lucide_react10 = require("lucide-react");
21037
+ var import_lucide_react11 = require("lucide-react");
20427
21038
 
20428
21039
  // src/lib/ai-video-tree.ts
20429
21040
  function resolveVideoBlock(tree, path) {
@@ -20465,39 +21076,11 @@ function clearVideo(tree, path) {
20465
21076
  });
20466
21077
  }
20467
21078
 
20468
- // src/lib/youtube.ts
20469
- var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
20470
- function extractYouTubeId(input) {
20471
- const trimmed = input.trim();
20472
- if (!trimmed) return null;
20473
- if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
20474
- let url;
20475
- try {
20476
- url = new URL(trimmed);
20477
- } catch {
20478
- return null;
20479
- }
20480
- const host = url.hostname.replace(/^www\./, "");
20481
- if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
20482
- return null;
20483
- }
20484
- let candidate = null;
20485
- if (host === "youtu.be") {
20486
- candidate = url.pathname.slice(1).split("/")[0] ?? null;
20487
- } else if (url.pathname === "/watch") {
20488
- candidate = url.searchParams.get("v");
20489
- } else {
20490
- const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
20491
- candidate = match ? match[1] : null;
20492
- }
20493
- return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
20494
- }
20495
-
20496
21079
  // src/ui/ai-section/AiVideoOverlay.tsx
20497
- var import_jsx_runtime22 = require("react/jsx-runtime");
21080
+ var import_jsx_runtime23 = require("react/jsx-runtime");
20498
21081
  var PRIMARY5 = "#0885FE";
20499
- var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY5})`;
20500
- var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
21082
+ var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
21083
+ var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20501
21084
  function findVideoBlockElement(sectionId, path) {
20502
21085
  const sectionEl2 = findByInstanceId(sectionId);
20503
21086
  if (!sectionEl2) return null;
@@ -20557,12 +21140,12 @@ function requestValidateTree3(postToParent2, tree) {
20557
21140
  postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
20558
21141
  });
20559
21142
  }
20560
- function Pill2({
21143
+ function Pill({
20561
21144
  label,
20562
21145
  onClick,
20563
21146
  disabled
20564
21147
  }) {
20565
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
21148
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20566
21149
  "button",
20567
21150
  {
20568
21151
  type: "button",
@@ -20578,7 +21161,7 @@ function Pill2({
20578
21161
  border: "none",
20579
21162
  cursor: disabled ? "default" : "pointer",
20580
21163
  background: "#ffffff",
20581
- color: OHW_BLUE_DARK2,
21164
+ color: OHW_BLUE_DARK,
20582
21165
  opacity: disabled ? 0.4 : 1,
20583
21166
  fontSize: 12,
20584
21167
  lineHeight: "16px",
@@ -20621,8 +21204,8 @@ function VideoUrlInput({ value, onCommit }) {
20621
21204
  onCommit(id);
20622
21205
  }
20623
21206
  };
20624
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
20625
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
21207
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
21208
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
20626
21209
  "div",
20627
21210
  {
20628
21211
  style: {
@@ -20638,12 +21221,12 @@ function VideoUrlInput({ value, onCommit }) {
20638
21221
  boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
20639
21222
  },
20640
21223
  children: [
20641
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
21224
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20642
21225
  "span",
20643
21226
  {
20644
21227
  style: {
20645
21228
  flex: "0 0 auto",
20646
- color: OHW_BLUE_DARK2,
21229
+ color: OHW_BLUE_DARK,
20647
21230
  fontSize: 10,
20648
21231
  lineHeight: "16px",
20649
21232
  fontWeight: 700,
@@ -20653,7 +21236,7 @@ function VideoUrlInput({ value, onCommit }) {
20653
21236
  children: "Video"
20654
21237
  }
20655
21238
  ),
20656
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
21239
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20657
21240
  "input",
20658
21241
  {
20659
21242
  type: "text",
@@ -20690,7 +21273,7 @@ function VideoUrlInput({ value, onCommit }) {
20690
21273
  ]
20691
21274
  }
20692
21275
  ),
20693
- invalid && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
21276
+ invalid && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
20694
21277
  ] });
20695
21278
  }
20696
21279
  function VideoToolbar({
@@ -20700,7 +21283,7 @@ function VideoToolbar({
20700
21283
  onSetVideoId,
20701
21284
  onRemove
20702
21285
  }) {
20703
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
21286
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
20704
21287
  "div",
20705
21288
  {
20706
21289
  "data-ohw-bridge": "",
@@ -20712,7 +21295,7 @@ function VideoToolbar({
20712
21295
  gap: 6,
20713
21296
  alignItems: "center",
20714
21297
  width: 280,
20715
- background: OHW_BLUE2,
21298
+ background: OHW_BLUE,
20716
21299
  padding: 8,
20717
21300
  borderRadius: 12,
20718
21301
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -20720,9 +21303,9 @@ function VideoToolbar({
20720
21303
  opacity: pending ? 0.6 : 1
20721
21304
  },
20722
21305
  children: [
20723
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
20724
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Pill2, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
20725
- error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
21306
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
21307
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
21308
+ error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20726
21309
  ]
20727
21310
  }
20728
21311
  );
@@ -20842,8 +21425,8 @@ function AiVideoOverlay({
20842
21425
  const activeBlockRect = useLiveBlockRect(active);
20843
21426
  const TOOLBAR_APPROX_H = 90;
20844
21427
  const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
20845
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
20846
- hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
21428
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
21429
+ hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20847
21430
  "button",
20848
21431
  {
20849
21432
  type: "button",
@@ -20871,15 +21454,15 @@ function AiVideoOverlay({
20871
21454
  fontSize: 14,
20872
21455
  fontWeight: 700
20873
21456
  },
20874
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Star, { size: 14, style: { pointerEvents: "none" } })
21457
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Star, { size: 14, style: { pointerEvents: "none" } })
20875
21458
  }
20876
21459
  ),
20877
- activeBlockRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
21460
+ activeBlockRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20878
21461
  ItemInteractionLayer,
20879
21462
  {
20880
21463
  rect: activeBlockRect,
20881
21464
  state: toolbarState,
20882
- toolbar: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
21465
+ toolbar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20883
21466
  VideoToolbar,
20884
21467
  {
20885
21468
  videoId: videoIdAt(activeEntry.tree, active.path),
@@ -20903,7 +21486,7 @@ function AiVideoOverlay({
20903
21486
 
20904
21487
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
20905
21488
  var import_react16 = require("react");
20906
- var import_lucide_react11 = require("lucide-react");
21489
+ var import_lucide_react12 = require("lucide-react");
20907
21490
 
20908
21491
  // src/lib/ai-carousel-tree.ts
20909
21492
  function isCarouselBlock(node) {
@@ -20954,10 +21537,10 @@ function setCarouselAutoplay(tree, on) {
20954
21537
  }
20955
21538
 
20956
21539
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
20957
- var import_jsx_runtime23 = require("react/jsx-runtime");
21540
+ var import_jsx_runtime24 = require("react/jsx-runtime");
20958
21541
  var PRIMARY6 = "#0885FE";
20959
- var OHW_BLUE3 = `var(--ohw-primary, ${PRIMARY6})`;
20960
- var OHW_BLUE_DARK3 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
21542
+ var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
21543
+ var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
20961
21544
  function findCarouselItemElement(sectionId, index) {
20962
21545
  const sectionEl2 = findByInstanceId(sectionId);
20963
21546
  if (!sectionEl2) return null;
@@ -21036,8 +21619,8 @@ function requestAssetPick2(postToParent2) {
21036
21619
  postToParent2({ type: "ow:asset-pick", id });
21037
21620
  });
21038
21621
  }
21039
- function Pill3({ label, onClick, disabled }) {
21040
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21622
+ function Pill2({ label, onClick, disabled }) {
21623
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21041
21624
  "button",
21042
21625
  {
21043
21626
  type: "button",
@@ -21053,7 +21636,7 @@ function Pill3({ label, onClick, disabled }) {
21053
21636
  border: "none",
21054
21637
  cursor: disabled ? "default" : "pointer",
21055
21638
  background: "#ffffff",
21056
- color: OHW_BLUE_DARK3,
21639
+ color: OHW_BLUE_DARK2,
21057
21640
  opacity: disabled ? 0.4 : 1,
21058
21641
  fontSize: 12,
21059
21642
  lineHeight: "16px",
@@ -21071,7 +21654,7 @@ function TogglePill({
21071
21654
  onToggle,
21072
21655
  disabled
21073
21656
  }) {
21074
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
21657
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
21075
21658
  "button",
21076
21659
  {
21077
21660
  type: "button",
@@ -21090,7 +21673,7 @@ function TogglePill({
21090
21673
  border: "none",
21091
21674
  cursor: disabled ? "default" : "pointer",
21092
21675
  background: "#ffffff",
21093
- color: OHW_BLUE_DARK3,
21676
+ color: OHW_BLUE_DARK2,
21094
21677
  opacity: disabled ? 0.4 : 1,
21095
21678
  fontSize: 12,
21096
21679
  lineHeight: "16px",
@@ -21100,7 +21683,7 @@ function TogglePill({
21100
21683
  },
21101
21684
  children: [
21102
21685
  label,
21103
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21686
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21104
21687
  "span",
21105
21688
  {
21106
21689
  "aria-hidden": true,
@@ -21113,10 +21696,10 @@ function TogglePill({
21113
21696
  // Off is a grey track, not a washed-out blue: the pill's own white background already
21114
21697
  // carries the brand colour in the text, and a pale blue track next to it read as
21115
21698
  // "disabled control" rather than "switch that is off".
21116
- background: on ? OHW_BLUE_DARK3 : "#CBD5E1",
21699
+ background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
21117
21700
  transition: "background 120ms ease"
21118
21701
  },
21119
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21702
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21120
21703
  "span",
21121
21704
  {
21122
21705
  style: {
@@ -21145,7 +21728,7 @@ function CarouselSlideToolbar({
21145
21728
  onChangeImage,
21146
21729
  onToggleAutoplay
21147
21730
  }) {
21148
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
21731
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
21149
21732
  "div",
21150
21733
  {
21151
21734
  "data-ohw-bridge": "",
@@ -21156,7 +21739,7 @@ function CarouselSlideToolbar({
21156
21739
  flexDirection: "column",
21157
21740
  gap: 6,
21158
21741
  alignItems: "center",
21159
- background: OHW_BLUE3,
21742
+ background: OHW_BLUE2,
21160
21743
  padding: 8,
21161
21744
  borderRadius: 12,
21162
21745
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -21168,11 +21751,11 @@ function CarouselSlideToolbar({
21168
21751
  pointerEvents: pending ? "none" : "auto"
21169
21752
  },
21170
21753
  children: [
21171
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
21172
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pill3, { label: "Change Image", onClick: onChangeImage }),
21173
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
21754
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
21755
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Pill2, { label: "Change Image", onClick: onChangeImage }),
21756
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
21174
21757
  ] }),
21175
- error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
21758
+ error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
21176
21759
  ]
21177
21760
  }
21178
21761
  );
@@ -21312,8 +21895,8 @@ function AiFadeCarouselOverlay({
21312
21895
  const activeItemRect = useLiveItemRect2(active);
21313
21896
  const TOOLBAR_APPROX_H = 90;
21314
21897
  const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
21315
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
21316
- hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21898
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
21899
+ hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21317
21900
  "button",
21318
21901
  {
21319
21902
  type: "button",
@@ -21342,10 +21925,10 @@ function AiFadeCarouselOverlay({
21342
21925
  fontSize: 14,
21343
21926
  fontWeight: 700
21344
21927
  },
21345
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Star, { size: 14, style: { pointerEvents: "none" } })
21928
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Star, { size: 14, style: { pointerEvents: "none" } })
21346
21929
  }
21347
21930
  ),
21348
- swapping && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21931
+ swapping && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21349
21932
  "div",
21350
21933
  {
21351
21934
  ref: skeletonRef,
@@ -21363,15 +21946,15 @@ function AiFadeCarouselOverlay({
21363
21946
  zIndex: 2147483646,
21364
21947
  pointerEvents: "none"
21365
21948
  },
21366
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("style", { children: MEDIA_SKELETON_CSS })
21949
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("style", { children: MEDIA_SKELETON_CSS })
21367
21950
  }
21368
21951
  ),
21369
- activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21952
+ activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21370
21953
  ItemInteractionLayer,
21371
21954
  {
21372
21955
  rect: activeItemRect,
21373
21956
  state: toolbarState,
21374
- toolbar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21957
+ toolbar: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21375
21958
  CarouselSlideToolbar,
21376
21959
  {
21377
21960
  pending,
@@ -21562,113 +22145,6 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
21562
22145
  // src/ui/link-modal/LinkPopover.tsx
21563
22146
  var import_react20 = require("react");
21564
22147
 
21565
- // src/ui/dialog.tsx
21566
- var React9 = __toESM(require("react"), 1);
21567
- var import_radix_ui6 = require("radix-ui");
21568
- var import_lucide_react12 = require("lucide-react");
21569
- var import_jsx_runtime24 = require("react/jsx-runtime");
21570
- function Dialog2({
21571
- ...props
21572
- }) {
21573
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
21574
- }
21575
- function DialogPortal({
21576
- ...props
21577
- }) {
21578
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
21579
- }
21580
- function DialogOverlay({
21581
- className,
21582
- ...props
21583
- }) {
21584
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21585
- import_radix_ui6.Dialog.Overlay,
21586
- {
21587
- "data-slot": "dialog-overlay",
21588
- "data-ohw-link-modal-root": "",
21589
- className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
21590
- ...props
21591
- }
21592
- );
21593
- }
21594
- var DialogContent = React9.forwardRef(
21595
- ({ className, children, showCloseButton = true, container, ...props }, ref) => {
21596
- const positionMode = container ? "absolute" : "fixed";
21597
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(DialogPortal, { container: container ?? void 0, children: [
21598
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
21599
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
21600
- import_radix_ui6.Dialog.Content,
21601
- {
21602
- ref,
21603
- "data-slot": "dialog-content",
21604
- className: cn(
21605
- positionMode,
21606
- "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",
21607
- "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
21608
- container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
21609
- className
21610
- ),
21611
- onMouseDown: (e) => e.stopPropagation(),
21612
- ...props,
21613
- children: [
21614
- children,
21615
- showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21616
- import_radix_ui6.Dialog.Close,
21617
- {
21618
- type: "button",
21619
- className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
21620
- "aria-label": "Close",
21621
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.X, { size: 16, "aria-hidden": true })
21622
- }
21623
- ) : null
21624
- ]
21625
- }
21626
- )
21627
- ] });
21628
- }
21629
- );
21630
- DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
21631
- function DialogHeader({
21632
- className,
21633
- ...props
21634
- }) {
21635
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
21636
- }
21637
- function DialogFooter({
21638
- className,
21639
- ...props
21640
- }) {
21641
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21642
- "div",
21643
- {
21644
- className: cn("flex items-center justify-end gap-2", className),
21645
- ...props
21646
- }
21647
- );
21648
- }
21649
- var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21650
- import_radix_ui6.Dialog.Title,
21651
- {
21652
- ref,
21653
- className: cn(
21654
- "text-lg font-semibold leading-none tracking-tight text-card-foreground",
21655
- className
21656
- ),
21657
- ...props
21658
- }
21659
- ));
21660
- DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
21661
- var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21662
- import_radix_ui6.Dialog.Description,
21663
- {
21664
- ref,
21665
- className: cn("text-sm text-muted-foreground", className),
21666
- ...props
21667
- }
21668
- ));
21669
- DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
21670
- var DialogClose = import_radix_ui6.Dialog.Close;
21671
-
21672
22148
  // src/ui/link-modal/LinkEditorPanel.tsx
21673
22149
  var import_lucide_react16 = require("lucide-react");
21674
22150
 
@@ -22772,6 +23248,7 @@ function shouldUseDevFixtures() {
22772
23248
  function getLogoElement(el) {
22773
23249
  const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
22774
23250
  if (marked) return marked;
23251
+ if (el.closest('[data-ohw-editable="icon"]')) return null;
22775
23252
  const root = el.closest("nav, [data-ohw-nav-root], footer");
22776
23253
  if (!root) return null;
22777
23254
  const anchor = el.closest("a");
@@ -25588,7 +26065,7 @@ function getNavigationSelectionParent(el) {
25588
26065
  if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
25589
26066
  return resolveFooterLinksContainerFrom(el);
25590
26067
  }
25591
- if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
26068
+ 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)) {
25592
26069
  return getNavigationRoot(el);
25593
26070
  }
25594
26071
  return null;
@@ -25810,7 +26287,6 @@ var ICONS = {
25810
26287
  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"/>',
25811
26288
  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"/>'
25812
26289
  };
25813
- var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
25814
26290
  var SELECTION_CHROME_GAP2 = 4;
25815
26291
  var TOOLBAR_STROKE_GAP2 = 4;
25816
26292
  var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
@@ -25908,7 +26384,7 @@ function applyVisibleViewport(el, parentScroll) {
25908
26384
  el.style.top = `${top}px`;
25909
26385
  el.style.height = `${height}px`;
25910
26386
  }
25911
- var TOOLBAR_EDGE_MARGIN3 = 4;
26387
+ var TOOLBAR_EDGE_MARGIN4 = 4;
25912
26388
  function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
25913
26389
  const isAbove = transform.includes("translateY(-100%)");
25914
26390
  let visualTop = isAbove ? top - approxH : top;
@@ -25935,8 +26411,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
25935
26411
  function clampToolbarLeft(centerX, toolbarWidth) {
25936
26412
  const half = toolbarWidth / 2;
25937
26413
  return Math.max(
25938
- TOOLBAR_EDGE_MARGIN3 + half,
25939
- Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half)
26414
+ TOOLBAR_EDGE_MARGIN4 + half,
26415
+ Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
25940
26416
  );
25941
26417
  }
25942
26418
  function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
@@ -26058,7 +26534,10 @@ function FloatingToolbar({
26058
26534
  onCommand,
26059
26535
  activeCommands,
26060
26536
  showEditLink,
26061
- onEditLink
26537
+ onEditLink,
26538
+ showDelete,
26539
+ onDelete,
26540
+ deleteDisabled
26062
26541
  }) {
26063
26542
  const localRef = import_react25.default.useRef(null);
26064
26543
  const [measuredW, setMeasuredW] = import_react25.default.useState(330);
@@ -26085,7 +26564,7 @@ function FloatingToolbar({
26085
26564
  const ro = new ResizeObserver(update);
26086
26565
  ro.observe(node);
26087
26566
  return () => ro.disconnect();
26088
- }, [showEditLink, activeCommands]);
26567
+ }, [showEditLink, showDelete, activeCommands]);
26089
26568
  const { top, left, transform } = calcToolbarPos(rect, parentScroll, measuredW);
26090
26569
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
26091
26570
  "div",
@@ -26150,7 +26629,28 @@ function FloatingToolbar({
26150
26629
  },
26151
26630
  children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_lucide_react22.Link, { className: "size-4 shrink-0", "aria-hidden": true })
26152
26631
  }
26153
- ) : null
26632
+ ) : null,
26633
+ showDelete ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
26634
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CustomToolbarDivider, {}),
26635
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
26636
+ CustomToolbarButton,
26637
+ {
26638
+ type: "button",
26639
+ title: "Delete",
26640
+ disabled: deleteDisabled,
26641
+ onMouseDown: (e) => {
26642
+ e.preventDefault();
26643
+ e.stopPropagation();
26644
+ if (!deleteDisabled) onDelete?.();
26645
+ },
26646
+ onClick: (e) => {
26647
+ e.preventDefault();
26648
+ e.stopPropagation();
26649
+ },
26650
+ children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_lucide_react22.Trash2, { className: "size-4 shrink-0", "aria-hidden": true })
26651
+ }
26652
+ )
26653
+ ] }) : null
26154
26654
  ] })
26155
26655
  }
26156
26656
  );
@@ -26764,6 +27264,8 @@ function OhhwellsBridge() {
26764
27264
  const [activeCommands, setActiveCommands] = (0, import_react25.useState)(/* @__PURE__ */ new Set());
26765
27265
  const [sectionGap, setSectionGap] = (0, import_react25.useState)(null);
26766
27266
  const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react25.useState)(false);
27267
+ const [toolbarShowAiBlockDelete, setToolbarShowAiBlockDelete] = (0, import_react25.useState)(false);
27268
+ const deletingAiBlockRef = (0, import_react25.useRef)(false);
26767
27269
  const hoveredNavContainerRef = (0, import_react25.useRef)(null);
26768
27270
  const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react25.useState)(null);
26769
27271
  const hoveredItemElRef = (0, import_react25.useRef)(null);
@@ -26819,21 +27321,6 @@ function OhhwellsBridge() {
26819
27321
  const [isItemDragging, setIsItemDragging] = (0, import_react25.useState)(false);
26820
27322
  const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react25.useState)(false);
26821
27323
  isFooterFrameSelectionRef.current = isFooterFrameSelection;
26822
- const [floatingPanel, setFloatingPanel] = (0, import_react25.useState)(null);
26823
- const floatingPanelOpenRef = (0, import_react25.useRef)(false);
26824
- floatingPanelOpenRef.current = floatingPanel !== null;
26825
- const floatingPanelRef = (0, import_react25.useRef)(null);
26826
- floatingPanelRef.current = floatingPanel;
26827
- const [floatingPanelPos, setFloatingPanelPos] = (0, import_react25.useState)(null);
26828
- const buttonCollectionDragRef = (0, import_react25.useRef)(null);
26829
- const buttonDropInsertIndexRef = (0, import_react25.useRef)(null);
26830
- const [buttonDropSlots, setButtonDropSlots] = (0, import_react25.useState)([]);
26831
- const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react25.useState)(null);
26832
- const buttonPointerDragRef = (0, import_react25.useRef)(null);
26833
- const [buttonStyleTick, setButtonStyleTick] = (0, import_react25.useState)(0);
26834
- const [logoSizeDraft, setLogoSizeDraft] = (0, import_react25.useState)(null);
26835
- const [editorViewport, setEditorViewport] = (0, import_react25.useState)("desktop");
26836
- const [parentScrollSnap, setParentScrollSnap] = (0, import_react25.useState)(null);
26837
27324
  const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react25.useState)(null);
26838
27325
  const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react25.useState)(null);
26839
27326
  const footerDragRef = (0, import_react25.useRef)(null);
@@ -26860,6 +27347,21 @@ function OhhwellsBridge() {
26860
27347
  const stylesRef = (0, import_react25.useRef)("");
26861
27348
  const appliedDrawerRef = (0, import_react25.useRef)(null);
26862
27349
  const pendingDeleteUndoRef = (0, import_react25.useRef)(null);
27350
+ const [floatingPanel, setFloatingPanel] = (0, import_react25.useState)(null);
27351
+ const floatingPanelOpenRef = (0, import_react25.useRef)(false);
27352
+ const floatingPanelRef = (0, import_react25.useRef)(null);
27353
+ floatingPanelRef.current = floatingPanel;
27354
+ const setFloatingPanelRef = (0, import_react25.useRef)(setFloatingPanel);
27355
+ const [floatingPanelPos, setFloatingPanelPos] = (0, import_react25.useState)(null);
27356
+ const buttonCollectionDragRef = (0, import_react25.useRef)(null);
27357
+ const buttonDropInsertIndexRef = (0, import_react25.useRef)(null);
27358
+ const [buttonDropSlots, setButtonDropSlots] = (0, import_react25.useState)([]);
27359
+ const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react25.useState)(null);
27360
+ const buttonPointerDragRef = (0, import_react25.useRef)(null);
27361
+ const [buttonStyleTick, setButtonStyleTick] = (0, import_react25.useState)(0);
27362
+ const [logoSizeDraft, setLogoSizeDraft] = (0, import_react25.useState)(null);
27363
+ const [editorViewport, setEditorViewport] = (0, import_react25.useState)("desktop");
27364
+ const [parentScrollSnap, setParentScrollSnap] = (0, import_react25.useState)(null);
26863
27365
  const [sitePages, setSitePages] = (0, import_react25.useState)([]);
26864
27366
  const collectionItemsRef = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
26865
27367
  const [sectionsByPath, setSectionsByPath] = (0, import_react25.useState)({});
@@ -26869,7 +27371,18 @@ function OhhwellsBridge() {
26869
27371
  const linkPopoverOpenRef = (0, import_react25.useRef)(false);
26870
27372
  const linkPopoverGraceUntilRef = (0, import_react25.useRef)(0);
26871
27373
  setLinkPopoverRef.current = setLinkPopover;
27374
+ setFloatingPanelRef.current = setFloatingPanel;
26872
27375
  linkPopoverSessionRef.current = linkPopover;
27376
+ floatingPanelOpenRef.current = Boolean(floatingPanel);
27377
+ (0, import_react25.useEffect)(() => {
27378
+ const syncViewport = () => {
27379
+ const next = window.innerWidth <= 480 ? "mobile" : "desktop";
27380
+ setEditorViewport((prev) => prev === next ? prev : next);
27381
+ };
27382
+ syncViewport();
27383
+ window.addEventListener("resize", syncViewport);
27384
+ return () => window.removeEventListener("resize", syncViewport);
27385
+ }, []);
26873
27386
  (0, import_react25.useEffect)(() => {
26874
27387
  setSectionOrderPersistHandler((entries) => {
26875
27388
  const currentPath = window.location.pathname;
@@ -27176,6 +27689,7 @@ function OhhwellsBridge() {
27176
27689
  setMaxBadge(null);
27177
27690
  setActiveCommands(/* @__PURE__ */ new Set());
27178
27691
  setToolbarShowEditLink(false);
27692
+ setToolbarShowAiBlockDelete(false);
27179
27693
  postToParent2({ type: "ow:exit-edit" });
27180
27694
  }, [postToParent2]);
27181
27695
  const clearSelectedAttr = (0, import_react25.useCallback)(() => {
@@ -27346,6 +27860,7 @@ function OhhwellsBridge() {
27346
27860
  setMaxBadge(null);
27347
27861
  setActiveCommands(/* @__PURE__ */ new Set());
27348
27862
  setToolbarShowEditLink(false);
27863
+ setToolbarShowAiBlockDelete(false);
27349
27864
  postToParent2({ type: "ow:exit-edit" });
27350
27865
  reselectNavigationItem(navAnchor);
27351
27866
  }, [postToParent2, reselectNavigationItem]);
@@ -28516,6 +29031,13 @@ function OhhwellsBridge() {
28516
29031
  }
28517
29032
  }
28518
29033
  setToolbarShowEditLink(Boolean(getHrefKeyFromElement(el)));
29034
+ setToolbarShowAiBlockDelete(
29035
+ canRemoveAiBlock(aiSectionsRef.current, el.dataset.ohwKey ?? null) || canSoftHideEditable(el, {
29036
+ isNavFooterItem: Boolean(
29037
+ getNavigationItemAnchor(el) && isNavFooterScopedNavigationItem(el) && !isCtaButton(el)
29038
+ )
29039
+ })
29040
+ );
28519
29041
  const navAnchor = getNavigationItemAnchor(el);
28520
29042
  if (navAnchor) {
28521
29043
  if (isNestedNavChild(navAnchor)) {
@@ -28603,6 +29125,7 @@ function OhhwellsBridge() {
28603
29125
  applyAiFooterFromContent(content);
28604
29126
  if (typeof content[STYLE_STORE_KEY] === "string") {
28605
29127
  stylesRef.current = content[STYLE_STORE_KEY];
29128
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28606
29129
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28607
29130
  }
28608
29131
  applyBrandChrome(content);
@@ -28613,15 +29136,16 @@ function OhhwellsBridge() {
28613
29136
  if (key === "__ohw_sections") continue;
28614
29137
  if (key === AI_SECTIONS_KEY) continue;
28615
29138
  if (key === AI_FOOTER_KEY) continue;
29139
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
29140
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28616
29141
  if (key === BRAND_KIT_KEY) continue;
28617
29142
  if (key === STYLE_STORE_KEY) continue;
28618
29143
  if (BRAND_CHROME_KEYS.has(key)) continue;
28619
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28620
29144
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
28621
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28622
29145
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28623
29146
  continue;
28624
29147
  }
29148
+ if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28625
29149
  if (applyVideoSettingNode(key, val)) continue;
28626
29150
  if (applyCarouselNode(key, val)) continue;
28627
29151
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28661,6 +29185,7 @@ function OhhwellsBridge() {
28661
29185
  });
28662
29186
  applyLinkByKey(key, val);
28663
29187
  }
29188
+ applySectionEmbeds(content);
28664
29189
  applyLogoFromContent(content);
28665
29190
  applyLogoSizes(content);
28666
29191
  reconcileNavbarItemsFromContent(content);
@@ -28669,6 +29194,7 @@ function OhhwellsBridge() {
28669
29194
  applySocialsDisplayFromContent(content);
28670
29195
  applySocialsLabelsFromContent(content, document, { fillEmptyOnly: isEditModeRef.current });
28671
29196
  syncButtonsFromContent(document, content);
29197
+ applyHiddenEditablesToDom(content);
28672
29198
  if (isEditModeRef.current) requestMissingSocialIconsRef.current();
28673
29199
  if (typeof content[STYLE_STORE_KEY] === "string") {
28674
29200
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
@@ -28849,20 +29375,22 @@ function OhhwellsBridge() {
28849
29375
  }
28850
29376
  applyAiFooterFromContent(content);
28851
29377
  if (typeof content[STYLE_STORE_KEY] === "string") {
29378
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28852
29379
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28853
29380
  }
28854
29381
  for (const [key, val] of Object.entries(content)) {
28855
29382
  if (key === "__ohw_sections") continue;
28856
29383
  if (key === AI_SECTIONS_KEY) continue;
28857
29384
  if (key === AI_FOOTER_KEY) continue;
29385
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
29386
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28858
29387
  if (key === BRAND_KIT_KEY) continue;
28859
29388
  if (key === STYLE_STORE_KEY) continue;
28860
29389
  if (BRAND_CHROME_KEYS.has(key)) continue;
28861
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28862
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28863
29390
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28864
29391
  continue;
28865
29392
  }
29393
+ if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28866
29394
  if (applyVideoSettingNode(key, val)) continue;
28867
29395
  if (applyCarouselNode(key, val)) continue;
28868
29396
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28887,6 +29415,7 @@ function OhhwellsBridge() {
28887
29415
  });
28888
29416
  applyLinkByKey(key, val);
28889
29417
  }
29418
+ applySectionEmbeds(content);
28890
29419
  applyLogoFromContent(content);
28891
29420
  reconcileNavbarItemsFromContent(content);
28892
29421
  reconcileFooterOrderFromContent(content);
@@ -28894,6 +29423,7 @@ function OhhwellsBridge() {
28894
29423
  applySocialsDisplayFromContent(content);
28895
29424
  applySocialsLabelsFromContent(content, document, { fillEmptyOnly: isEditModeRef.current });
28896
29425
  syncButtonsFromContent(document, content);
29426
+ applyHiddenEditablesToDom(content);
28897
29427
  if (isEditModeRef.current) requestMissingSocialIconsRef.current();
28898
29428
  if (typeof content[STYLE_STORE_KEY] === "string") {
28899
29429
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
@@ -29032,6 +29562,7 @@ function OhhwellsBridge() {
29032
29562
  applySocialsDisplayFromContent(content);
29033
29563
  applySocialsLabelsFromContent(content, document, { fillEmptyOnly: isEditModeRef.current });
29034
29564
  syncButtonsFromContent(document, content);
29565
+ applyHiddenEditablesToDom(content);
29035
29566
  if (isEditModeRef.current) requestMissingSocialIconsRef.current();
29036
29567
  document.querySelectorAll("footer [data-ohw-href-key]").forEach((el) => {
29037
29568
  if (isFooterHrefKey(el.getAttribute("data-ohw-href-key")) || getSocialItem(el)) {
@@ -29126,26 +29657,11 @@ function OhhwellsBridge() {
29126
29657
  const t2 = setTimeout(measure, 500);
29127
29658
  const ro = new ResizeObserver(schedule);
29128
29659
  ro.observe(document.body);
29129
- let lastWidth = window.innerWidth;
29130
- let resizeTimers = [];
29131
- const clearResizeTimers = () => {
29132
- resizeTimers.forEach(clearTimeout);
29133
- resizeTimers = [];
29134
- };
29135
- const handleResize = () => {
29136
- if (window.innerWidth === lastWidth) return;
29137
- lastWidth = window.innerWidth;
29138
- clearResizeTimers();
29139
- resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
29140
- };
29141
- window.addEventListener("resize", handleResize);
29142
29660
  return () => {
29143
29661
  clearTimeout(t1);
29144
29662
  clearTimeout(t2);
29145
29663
  if (raf != null) cancelAnimationFrame(raf);
29146
29664
  ro.disconnect();
29147
- clearResizeTimers();
29148
- window.removeEventListener("resize", handleResize);
29149
29665
  };
29150
29666
  }, [pathname, isEditMode, postToParent2]);
29151
29667
  (0, import_react25.useEffect)(() => {
@@ -29442,6 +29958,13 @@ function OhhwellsBridge() {
29442
29958
  if (target.closest("[data-ohw-state-toggle]")) return;
29443
29959
  if (target.closest("[data-ohw-max-badge]")) return;
29444
29960
  if (isInsideLinkEditor(target)) return;
29961
+ if (isInsideFloatingPanel(target)) return;
29962
+ if (target.closest("[data-ohw-form-toolbar]")) return;
29963
+ if (target.closest(
29964
+ '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
29965
+ )) {
29966
+ return;
29967
+ }
29445
29968
  if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
29446
29969
  clearMediaSelectionRef.current();
29447
29970
  }
@@ -29465,8 +29988,6 @@ function OhhwellsBridge() {
29465
29988
  return;
29466
29989
  }
29467
29990
  }
29468
- if (isInsideFloatingPanel(target)) return;
29469
- if (target.closest("[data-ohw-form-toolbar]")) return;
29470
29991
  const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
29471
29992
  if (collectionItem) {
29472
29993
  e.preventDefault();
@@ -29478,11 +29999,6 @@ function OhhwellsBridge() {
29478
29999
  });
29479
30000
  return;
29480
30001
  }
29481
- if (target.closest(
29482
- '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
29483
- )) {
29484
- return;
29485
- }
29486
30002
  {
29487
30003
  const formEl = getFormElement(target);
29488
30004
  const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
@@ -29636,9 +30152,13 @@ function OhhwellsBridge() {
29636
30152
  if (isIconEditable(editable) && !getSocialItem(editable)) {
29637
30153
  e.preventDefault();
29638
30154
  e.stopPropagation();
29639
- selectIconElementRef.current(editable);
29640
30155
  const aiIcon = editable.hasAttribute("data-ai-icon");
29641
30156
  const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
30157
+ if (aiIcon) {
30158
+ aiSectionApiRef.current?.selectFromElement(editable);
30159
+ } else {
30160
+ selectIconElementRef.current(editable);
30161
+ }
29642
30162
  postToParentRef.current({
29643
30163
  type: "ow:icon-pick",
29644
30164
  key: editable.dataset.ohwKey ?? "",
@@ -29866,6 +30386,9 @@ function OhhwellsBridge() {
29866
30386
  setHoveredItemRect(null);
29867
30387
  hoveredNavContainerRef.current = null;
29868
30388
  setHoveredNavContainerRect(null);
30389
+ siblingHintElRef.current = null;
30390
+ setSiblingHintRect(null);
30391
+ setSiblingHintRects([]);
29869
30392
  return;
29870
30393
  }
29871
30394
  {
@@ -29986,7 +30509,6 @@ function OhhwellsBridge() {
29986
30509
  hoveredNavContainerRef.current = null;
29987
30510
  setHoveredNavContainerRect(null);
29988
30511
  hoveredItemElRef.current = editable;
29989
- setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
29990
30512
  }
29991
30513
  }
29992
30514
  }
@@ -30696,7 +31218,11 @@ function OhhwellsBridge() {
30696
31218
  };
30697
31219
  const handleMouseMove = (e) => {
30698
31220
  const { clientX, clientY } = e;
30699
- if (pointOwnedByFloatingPanel(clientX, clientY)) return;
31221
+ if (pointOwnedByFloatingPanel(clientX, clientY)) {
31222
+ dismissImageHover();
31223
+ clearImageHover();
31224
+ return;
31225
+ }
30700
31226
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
30701
31227
  document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
30702
31228
  formHoverElRef.current = null;
@@ -30725,7 +31251,12 @@ function OhhwellsBridge() {
30725
31251
  setHoveredItemRect(null);
30726
31252
  hoveredNavContainerRef.current = null;
30727
31253
  setHoveredNavContainerRect(null);
31254
+ siblingHintElRef.current = null;
31255
+ setSiblingHintRect(null);
31256
+ setSiblingHintRects([]);
30728
31257
  dismissImageHover();
31258
+ clearImageHover();
31259
+ setSectionGap(null);
30729
31260
  return;
30730
31261
  }
30731
31262
  if (probeSocialsRowAt(clientX, clientY)) return;
@@ -30737,7 +31268,11 @@ function OhhwellsBridge() {
30737
31268
  if (e.data?.type !== "ow:pointer-sync") return;
30738
31269
  const { clientX, clientY } = e.data;
30739
31270
  if (typeof clientX !== "number" || typeof clientY !== "number") return;
30740
- if (pointOwnedByFloatingPanel(clientX, clientY)) return;
31271
+ if (pointOwnedByFloatingPanel(clientX, clientY)) {
31272
+ dismissImageHover();
31273
+ clearImageHover();
31274
+ return;
31275
+ }
30741
31276
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
30742
31277
  if (probeSocialsRowAt(clientX, clientY)) return;
30743
31278
  probeSectionGapAt(clientX, clientY);
@@ -31117,6 +31652,7 @@ function OhhwellsBridge() {
31117
31652
  applyAiFooterFromContent(content);
31118
31653
  if (typeof content[STYLE_STORE_KEY] === "string") {
31119
31654
  stylesRef.current = content[STYLE_STORE_KEY];
31655
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
31120
31656
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
31121
31657
  }
31122
31658
  applyBrandChrome(content);
@@ -31131,15 +31667,16 @@ function OhhwellsBridge() {
31131
31667
  }
31132
31668
  if (key === AI_SECTIONS_KEY) continue;
31133
31669
  if (key === AI_FOOTER_KEY) continue;
31670
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
31671
+ if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
31134
31672
  if (key === BRAND_KIT_KEY) continue;
31135
31673
  if (key === STYLE_STORE_KEY) continue;
31136
31674
  if (BRAND_CHROME_KEYS.has(key)) continue;
31137
- if (key === LOGO_PLACEHOLDER_KEY) continue;
31138
31675
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
31139
- if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
31140
31676
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
31141
31677
  continue;
31142
31678
  }
31679
+ if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
31143
31680
  if (applyVideoSettingNode(key, val)) continue;
31144
31681
  if (applyCarouselNode(key, val)) continue;
31145
31682
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -31165,6 +31702,7 @@ function OhhwellsBridge() {
31165
31702
  });
31166
31703
  applyLinkByKey(key, val);
31167
31704
  }
31705
+ applySectionEmbeds(content);
31168
31706
  applyLogoFromContent(content);
31169
31707
  applyLogoSizes(content);
31170
31708
  document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
@@ -31179,6 +31717,7 @@ function OhhwellsBridge() {
31179
31717
  reconcileNavbarItemsFromContent(editContentRef.current);
31180
31718
  reconcileFooterOrderFromContent(editContentRef.current);
31181
31719
  syncButtonsFromContent(document, editContentRef.current);
31720
+ applyHiddenEditablesToDom(editContentRef.current);
31182
31721
  if (selectedElRef.current && !selectedElRef.current.isConnected) deselectRef.current();
31183
31722
  syncNavigationDragCursorAttrs();
31184
31723
  if (typeof content[STYLE_STORE_KEY] === "string") {
@@ -31804,6 +32343,12 @@ function OhhwellsBridge() {
31804
32343
  closeLinkPopoverRef.current();
31805
32344
  return;
31806
32345
  }
32346
+ if (floatingPanelOpenRef.current) {
32347
+ setFloatingPanelRef.current(null);
32348
+ deselectRef.current();
32349
+ deactivateRef.current();
32350
+ return;
32351
+ }
31807
32352
  deselectRef.current();
31808
32353
  deactivateRef.current();
31809
32354
  clearMediaSelectionRef.current();
@@ -31982,7 +32527,7 @@ function OhhwellsBridge() {
31982
32527
  return;
31983
32528
  }
31984
32529
  }
31985
- if ((e.key === "Delete" || e.key === "Backspace") && selectedElRef.current && !activeElRef.current && !linkPopoverOpenRef.current) {
32530
+ if ((e.key === "Delete" || e.key === "Backspace") && !activeElRef.current && !linkPopoverOpenRef.current && (selectedElRef.current || selectedMediaElRef.current || selectedIconElRef.current)) {
31986
32531
  if (handleDeleteSelectedRef.current()) {
31987
32532
  e.preventDefault();
31988
32533
  return;
@@ -32634,10 +33179,10 @@ function OhhwellsBridge() {
32634
33179
  window.removeEventListener("message", handleDuplicateSection);
32635
33180
  window.removeEventListener("message", handleDeactivate);
32636
33181
  window.removeEventListener("message", handleSelectNav);
32637
- document.documentElement.removeAttribute("data-ohw-panel-dragging");
32638
33182
  window.removeEventListener("message", handleToastAction);
32639
33183
  window.removeEventListener("message", handleFormCount);
32640
33184
  window.removeEventListener("message", handleUiEscape);
33185
+ document.documentElement.removeAttribute("data-ohw-panel-dragging");
32641
33186
  autoSaveTimers.current.forEach(clearTimeout);
32642
33187
  autoSaveTimers.current.clear();
32643
33188
  if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
@@ -32931,7 +33476,7 @@ function OhhwellsBridge() {
32931
33476
  postToParent2({
32932
33477
  type: "ow:ready",
32933
33478
  version: "1",
32934
- bridgeVersion: "0.1.171",
33479
+ bridgeVersion: "0.1.172-next.456",
32935
33480
  path: pathname,
32936
33481
  nodes: collectEditableNodes(editContentRef.current),
32937
33482
  sections
@@ -33288,7 +33833,154 @@ function OhhwellsBridge() {
33288
33833
  enforceLinkHrefs();
33289
33834
  return true;
33290
33835
  }, []);
33836
+ const deleteAiBlock = (0, import_react25.useCallback)(
33837
+ (editKey, opts) => {
33838
+ if (!opts?.fromToolbar && activeElRef.current) return false;
33839
+ if (deletingAiBlockRef.current) return false;
33840
+ const plan = planAiBlockRemoval(aiSectionsRef.current, editKey);
33841
+ if (!plan) return false;
33842
+ if (!plan.ok) {
33843
+ postToParent2({
33844
+ type: "ow:toast",
33845
+ title: plan.reasons[0] ?? "That block cannot be deleted",
33846
+ toastType: "error"
33847
+ });
33848
+ return true;
33849
+ }
33850
+ const { tree: nextTree, entry } = plan;
33851
+ const previous = aiSectionsRef.current;
33852
+ deletingAiBlockRef.current = true;
33853
+ void requestValidateTree5(postToParent2, nextTree).then(({ ok, reasons }) => {
33854
+ deletingAiBlockRef.current = false;
33855
+ if (!ok) {
33856
+ postToParent2({
33857
+ type: "ow:toast",
33858
+ title: reasons[0] ?? "That change is not allowed.",
33859
+ toastType: "error"
33860
+ });
33861
+ return;
33862
+ }
33863
+ clearMediaSelectionRef.current();
33864
+ clearIconSelectionRef.current();
33865
+ applyTreeLocalRef.current?.({
33866
+ id: entry.id,
33867
+ mode: "replace",
33868
+ targetSectionId: entry.id,
33869
+ tree: nextTree,
33870
+ label: entry.label,
33871
+ media: entry.media,
33872
+ ...entry.brand ? { brand: entry.brand } : {},
33873
+ skipScrollIntoView: true
33874
+ });
33875
+ const actionId = typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `delete-block-${Date.now()}`;
33876
+ pendingDeleteUndoRef.current = {
33877
+ actionId,
33878
+ restore: () => {
33879
+ clearInteractionChromeRef.current();
33880
+ aiSectionsRef.current = previous;
33881
+ applyAiSectionsToDom(parseAiSectionsState(previous));
33882
+ const restoreHeight = document.body.scrollHeight;
33883
+ if (restoreHeight > 50) postToParent2({ type: "ow:height", height: restoreHeight });
33884
+ postToParent2({ type: "ow:change", nodes: [{ key: AI_SECTIONS_KEY, text: previous }] });
33885
+ postToParent2({
33886
+ type: "ow:ai-sections-changed",
33887
+ sections: collectSections(),
33888
+ nodes: collectEditableNodes(editContentRef.current)
33889
+ });
33890
+ }
33891
+ };
33892
+ postToParent2({
33893
+ type: "ow:toast",
33894
+ title: "Block deleted",
33895
+ toastType: "success",
33896
+ actionLabel: "Undo",
33897
+ actionId,
33898
+ duration: 6e3
33899
+ });
33900
+ });
33901
+ return true;
33902
+ },
33903
+ [postToParent2]
33904
+ );
33905
+ const softHideTemplateEditable = (0, import_react25.useCallback)(
33906
+ (el, opts) => {
33907
+ if (!opts?.fromToolbar && activeElRef.current) return false;
33908
+ if (!canSoftHideEditable(el, {
33909
+ isNavFooterItem: Boolean(
33910
+ getNavigationItemAnchor(el) && isNavFooterScopedNavigationItem(el) && !isCtaButton(el)
33911
+ )
33912
+ })) {
33913
+ return false;
33914
+ }
33915
+ const previousContent = editContentRef.current;
33916
+ const result = softHideEditableInDom(el, previousContent);
33917
+ if (!result) return false;
33918
+ editContentRef.current = result.content;
33919
+ postToParent2({ type: "ow:change", nodes: result.nodes });
33920
+ clearMediaSelectionRef.current();
33921
+ clearIconSelectionRef.current();
33922
+ clearInteractionChromeRef.current();
33923
+ clearFormPickRef.current?.();
33924
+ deselectRef.current();
33925
+ const actionId = typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `hide-editable-${Date.now()}`;
33926
+ const hiddenKey = result.key;
33927
+ pendingDeleteUndoRef.current = {
33928
+ actionId,
33929
+ restore: () => {
33930
+ clearInteractionChromeRef.current();
33931
+ const restored = softUnhideEditableInDom(hiddenKey, editContentRef.current);
33932
+ editContentRef.current = restored.content;
33933
+ postToParent2({ type: "ow:change", nodes: restored.nodes });
33934
+ const restoreHeight = document.body.scrollHeight;
33935
+ if (restoreHeight > 50) postToParent2({ type: "ow:height", height: restoreHeight });
33936
+ }
33937
+ };
33938
+ postToParent2({
33939
+ type: "ow:toast",
33940
+ title: "Block deleted",
33941
+ toastType: "success",
33942
+ actionLabel: "Undo",
33943
+ actionId,
33944
+ duration: 6e3
33945
+ });
33946
+ return true;
33947
+ },
33948
+ [postToParent2]
33949
+ );
33950
+ const deleteFromToolbar = (0, import_react25.useCallback)(
33951
+ (editKey, el) => {
33952
+ if (!editKey && !el) return false;
33953
+ if (editKey && canRemoveAiBlock(aiSectionsRef.current, editKey)) {
33954
+ return deleteAiBlock(editKey, { fromToolbar: true });
33955
+ }
33956
+ const target = el ?? (editKey ? document.querySelector(`[data-ohw-key="${editKey.replace(/"/g, '\\"')}"]`) : null);
33957
+ if (target) return softHideTemplateEditable(target, { fromToolbar: true });
33958
+ return false;
33959
+ },
33960
+ [deleteAiBlock, softHideTemplateEditable]
33961
+ );
33962
+ const resolveSelectedAiBlockKey = (0, import_react25.useCallback)(() => {
33963
+ const candidates = [
33964
+ activeElRef.current?.dataset.ohwKey,
33965
+ selectedMediaElRef.current?.dataset.ohwKey,
33966
+ selectedMedia?.key,
33967
+ selectedIconElRef.current?.dataset.ohwKey,
33968
+ selectedElRef.current?.getAttribute("data-ohw-href-key"),
33969
+ selectedElRef.current?.dataset.ohwKey,
33970
+ selectedElRef.current?.querySelector("[data-ohw-key]")?.dataset.ohwKey
33971
+ ];
33972
+ for (const key of candidates) {
33973
+ if (key && canRemoveAiBlock(aiSectionsRef.current, key)) return key;
33974
+ }
33975
+ return null;
33976
+ }, [selectedMedia]);
33291
33977
  const handleDeleteSelected = (0, import_react25.useCallback)(() => {
33978
+ if (!activeElRef.current) {
33979
+ const aiKey = resolveSelectedAiBlockKey();
33980
+ if (aiKey && deleteAiBlock(aiKey)) return true;
33981
+ const mediaEl = selectedMediaElRef.current;
33982
+ if (mediaEl && softHideTemplateEditable(mediaEl, { fromToolbar: true })) return true;
33983
+ }
33292
33984
  const selected = selectedElRef.current;
33293
33985
  if (!selected) return false;
33294
33986
  if (isCtaButton(selected)) {
@@ -33347,7 +34039,7 @@ function OhhwellsBridge() {
33347
34039
  }
33348
34040
  }
33349
34041
  return deleted;
33350
- }, [postToParent2]);
34042
+ }, [postToParent2, deleteAiBlock, softHideTemplateEditable, resolveSelectedAiBlockKey]);
33351
34043
  handleDeleteSelectedRef.current = handleDeleteSelected;
33352
34044
  runPendingDeleteUndoRef.current = runPendingDeleteUndo;
33353
34045
  const handleLinkPopoverSubmit = (0, import_react25.useCallback)(
@@ -33565,6 +34257,13 @@ function OhhwellsBridge() {
33565
34257
  isUploading: false,
33566
34258
  onReplace: handleMediaReplace,
33567
34259
  onSelect: handleMediaSelect,
34260
+ onDelete: canRemoveAiBlock(aiSectionsRef.current, selectedMedia.key) || selectedMediaElRef.current != null && canSoftHideEditable(selectedMediaElRef.current, {
34261
+ isNavFooterItem: Boolean(
34262
+ getNavigationItemAnchor(selectedMediaElRef.current) && isNavFooterScopedNavigationItem(selectedMediaElRef.current) && !isCtaButton(selectedMediaElRef.current)
34263
+ )
34264
+ }) ? (key) => {
34265
+ deleteFromToolbar(key, selectedMediaElRef.current);
34266
+ } : void 0,
33568
34267
  onVideoSettingsChange: handleVideoSettingsChange
33569
34268
  }
33570
34269
  ),
@@ -33729,7 +34428,24 @@ function OhhwellsBridge() {
33729
34428
  children: state
33730
34429
  },
33731
34430
  state
33732
- )) })
34431
+ )) }),
34432
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "mx-0.5 h-5 w-px bg-border" }),
34433
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
34434
+ "button",
34435
+ {
34436
+ type: "button",
34437
+ "aria-label": "Delete form",
34438
+ title: "Delete",
34439
+ className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/80",
34440
+ onClick: () => {
34441
+ setFieldTypePickerOpen(false);
34442
+ const form = formPickElRef.current;
34443
+ if (!form) return;
34444
+ softHideTemplateEditable(form, { fromToolbar: true });
34445
+ },
34446
+ children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_lucide_react22.Trash2, { size: 15, "aria-hidden": true })
34447
+ }
34448
+ )
33733
34449
  ]
33734
34450
  }
33735
34451
  )
@@ -33898,7 +34614,15 @@ function OhhwellsBridge() {
33898
34614
  onCommand: handleCommand,
33899
34615
  activeCommands,
33900
34616
  showEditLink,
33901
- onEditLink: openLinkPopoverForActive
34617
+ onEditLink: openLinkPopoverForActive,
34618
+ showDelete: toolbarShowAiBlockDelete,
34619
+ deleteDisabled: deletingAiBlockRef.current,
34620
+ onDelete: () => {
34621
+ const el = activeElRef.current;
34622
+ const key = el?.dataset.ohwKey;
34623
+ if (!key) return;
34624
+ deleteFromToolbar(key, el);
34625
+ }
33902
34626
  }
33903
34627
  )
33904
34628
  ] }),
@@ -34128,6 +34852,7 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
34128
34852
  FOOTER_COLUMN_BLOCKS,
34129
34853
  FOOTER_COLUMN_SPANS,
34130
34854
  FOOTER_SOCIAL_PLATFORMS,
34855
+ HIDDEN_EDITABLES_KEY,
34131
34856
  ItemActionToolbar,
34132
34857
  ItemInteractionLayer,
34133
34858
  LinkEditorPanel,
@@ -34150,9 +34875,14 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
34150
34875
  addFooterLinkColumn,
34151
34876
  appendFooterSocial,
34152
34877
  applyBrandChrome,
34878
+ applyHiddenEditablesToDom,
34153
34879
  applyStickySearchParams,
34880
+ blockPathFromEditKey,
34154
34881
  buildDefaultFooterTree,
34155
34882
  buildTarget,
34883
+ canRemoveAiBlock,
34884
+ canRemoveAiTextBlock,
34885
+ canSoftHideEditable,
34156
34886
  dropIndicatorVariants,
34157
34887
  ensureFooterTree,
34158
34888
  filterAvailablePages,
@@ -34163,6 +34893,7 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
34163
34893
  insertFooterHours,
34164
34894
  isDeadPageHref,
34165
34895
  isEditSessionActive,
34896
+ isEditableKeyHidden,
34166
34897
  isPlainLeftClick,
34167
34898
  isRenderableFooterTree,
34168
34899
  isRenderableTree,
@@ -34173,15 +34904,22 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
34173
34904
  parseAiFooterState,
34174
34905
  parseAiSectionsState,
34175
34906
  parseTarget,
34907
+ planAiBlockRemoval,
34908
+ planAiTextBlockRemoval,
34176
34909
  planBuildPageSync,
34910
+ readHiddenEditables,
34177
34911
  recordOverriddenPaths,
34178
34912
  releaseTemplateLogoIfReplaced,
34913
+ removeBlockAtPath,
34179
34914
  removeFooterBlock,
34180
34915
  resetOverriddenPathsCache,
34181
34916
  resolveFooterCopyright,
34917
+ resolveSoftHideTarget,
34182
34918
  resolveStickyNavigation,
34183
34919
  serializeAiFooterState,
34184
34920
  shouldFetchContentForPath,
34921
+ softHideEditableInDom,
34922
+ softUnhideEditableInDom,
34185
34923
  stepViableSlide,
34186
34924
  stripPlaceholderText,
34187
34925
  stripPlaceholders,
@@ -34189,6 +34927,8 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
34189
34927
  toggleVariants,
34190
34928
  useOhwCarousel,
34191
34929
  validateUrlInput,
34192
- viableSlides
34930
+ viableSlides,
34931
+ withHiddenEditable,
34932
+ withoutHiddenEditable
34193
34933
  });
34194
34934
  //# sourceMappingURL=index.cjs.map