@ohhwells/bridge 0.1.166-next.442 → 0.1.167-next.444

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
@@ -5549,14 +5549,14 @@ function singleIndexSegment(key) {
5549
5549
  function indexFromKey(key, position) {
5550
5550
  return parseInt(baseKey(key).split("-")[position] ?? "", 10);
5551
5551
  }
5552
- function detectItemGroups(sectionEl) {
5553
- if (isGeneratedSection(sectionEl)) return detectGeneratedCards(sectionEl);
5552
+ function detectItemGroups(sectionEl2) {
5553
+ if (isGeneratedSection(sectionEl2)) return detectGeneratedCards(sectionEl2);
5554
5554
  const groups = [];
5555
5555
  const seenParents = /* @__PURE__ */ new Set();
5556
5556
  const parents = /* @__PURE__ */ new Set();
5557
- sectionEl.querySelectorAll("[data-ohw-key], [data-ohw-href-key]").forEach((keyedEl) => {
5557
+ sectionEl2.querySelectorAll("[data-ohw-key], [data-ohw-href-key]").forEach((keyedEl) => {
5558
5558
  let el = keyedEl;
5559
- while (el && el !== sectionEl) {
5559
+ while (el && el !== sectionEl2) {
5560
5560
  if (el.parentElement) parents.add(el.parentElement);
5561
5561
  el = el.parentElement;
5562
5562
  }
@@ -5646,8 +5646,8 @@ function detectItemGroups(sectionEl) {
5646
5646
  }
5647
5647
  return groups.sort((a, b) => a.nested === b.nested ? 0 : a.nested ? 1 : -1);
5648
5648
  }
5649
- function detectGeneratedCards(sectionEl) {
5650
- const cards = Array.from(sectionEl.querySelectorAll("[data-ohw-card]")).filter(
5649
+ function detectGeneratedCards(sectionEl2) {
5650
+ const cards = Array.from(sectionEl2.querySelectorAll("[data-ohw-card]")).filter(
5651
5651
  (el) => !el.parentElement?.closest("[data-ohw-card]")
5652
5652
  );
5653
5653
  if (cards.length === 0) return [];
@@ -5656,7 +5656,7 @@ function detectGeneratedCards(sectionEl) {
5656
5656
  item.el.setAttribute(ITEM_ATTR, `card:${item.index}`);
5657
5657
  item.el.setAttribute(ITEM_SURFACE_ATTR, "");
5658
5658
  }
5659
- return [{ group: "card", parent: cards[0].parentElement ?? sectionEl, nested: false, items, generated: true }];
5659
+ return [{ group: "card", parent: cards[0].parentElement ?? sectionEl2, nested: false, items, generated: true }];
5660
5660
  }
5661
5661
  function firstTextLabel(item) {
5662
5662
  for (const k of item.keyed) {
@@ -5672,13 +5672,13 @@ function findItemSection(sectionId) {
5672
5672
  const escaped = CSS.escape(sectionId);
5673
5673
  return document.querySelector(`[data-ohw-instance="${escaped}"]`) ?? document.querySelector(`[data-ohw-section="${escaped}"]`);
5674
5674
  }
5675
- function isGeneratedSection(sectionEl) {
5676
- return !!sectionEl.closest("[data-ohw-ai-generated]") || sectionEl.hasAttribute("data-ai-section");
5675
+ function isGeneratedSection(sectionEl2) {
5676
+ return !!sectionEl2.closest("[data-ohw-ai-generated]") || sectionEl2.hasAttribute("data-ai-section");
5677
5677
  }
5678
- function collectItemGroups(sectionEl) {
5679
- if (isChromeSection(sectionEl)) return [];
5680
- const sectionId = instanceIdOf(sectionEl);
5681
- return detectItemGroups(sectionEl).map((g) => ({
5678
+ function collectItemGroups(sectionEl2) {
5679
+ if (isChromeSection(sectionEl2)) return [];
5680
+ const sectionId = instanceIdOf(sectionEl2);
5681
+ return detectItemGroups(sectionEl2).map((g) => ({
5682
5682
  sectionId,
5683
5683
  group: g.group,
5684
5684
  nested: g.nested,
@@ -5847,11 +5847,11 @@ function initItemInstancesFromContent(content) {
5847
5847
  document.querySelectorAll(`[${ITEM_REMOVED_ATTR}]`).forEach((el) => setRemoved(el, false));
5848
5848
  if (!store) return;
5849
5849
  for (const [sectionId, groups] of Object.entries(store.sections)) {
5850
- const sectionEl = findItemSection(sectionId);
5851
- if (!sectionEl) continue;
5850
+ const sectionEl2 = findItemSection(sectionId);
5851
+ if (!sectionEl2) continue;
5852
5852
  const ordered = Object.entries(groups).sort(([a], [b]) => a.length - b.length);
5853
5853
  for (const [group, state] of ordered) {
5854
- const found = detectItemGroups(sectionEl).find((g) => g.group === group);
5854
+ const found = detectItemGroups(sectionEl2).find((g) => g.group === group);
5855
5855
  if (!found || found.generated) continue;
5856
5856
  syncGroup(found, state);
5857
5857
  }
@@ -5891,9 +5891,9 @@ function writeValue(el, attr, value) {
5891
5891
  }
5892
5892
  }
5893
5893
  function applyItemOps(store, ops, currentContent) {
5894
- const sectionEl = findItemSection(ops.sectionId);
5895
- if (!sectionEl) return null;
5896
- const detected = detectItemGroups(sectionEl).find((g) => g.group === ops.group);
5894
+ const sectionEl2 = findItemSection(ops.sectionId);
5895
+ if (!sectionEl2) return null;
5896
+ const detected = detectItemGroups(sectionEl2).find((g) => g.group === ops.group);
5897
5897
  if (!detected || detected.generated) return null;
5898
5898
  const next = { v: 1, sections: { ...store?.sections ?? {} } };
5899
5899
  const groups = { ...next.sections[ops.sectionId] ?? {} };
@@ -6303,10 +6303,10 @@ function applyStylesToDom(store) {
6303
6303
  if (bar === -1) continue;
6304
6304
  const sectionId = key.slice(0, bar);
6305
6305
  const stamp = key.slice(bar + 1);
6306
- const sectionEl = findItemSection(sectionId);
6307
- if (!sectionEl) continue;
6308
- detectItemGroups(sectionEl);
6309
- const item = sectionEl.querySelector(`[data-ohw-item="${CSS.escape(stamp)}"]`);
6306
+ const sectionEl2 = findItemSection(sectionId);
6307
+ if (!sectionEl2) continue;
6308
+ detectItemGroups(sectionEl2);
6309
+ const item = sectionEl2.querySelector(`[data-ohw-item="${CSS.escape(stamp)}"]`);
6310
6310
  if (!item) continue;
6311
6311
  saveInline(item, "background");
6312
6312
  item.style.setProperty("background", override.backgroundColor, "important");
@@ -17796,7 +17796,7 @@ function apiBase() {
17796
17796
  function bridgeVersion() {
17797
17797
  try {
17798
17798
  if (true) {
17799
- return "0.1.166-next.442";
17799
+ return "0.1.167-next.444";
17800
17800
  }
17801
17801
  } catch {
17802
17802
  }
@@ -17810,7 +17810,7 @@ function stampBridgeVersionOnDocument() {
17810
17810
  return;
17811
17811
  }
17812
17812
  try {
17813
- const v = true ? "0.1.166-next.442" : "";
17813
+ const v = true ? "0.1.167-next.444" : "";
17814
17814
  if (v) {
17815
17815
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
17816
17816
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -18746,7 +18746,8 @@ function ensureStyleSheet2() {
18746
18746
  el.textContent = HIGHLIGHT_CSS;
18747
18747
  document.head.appendChild(el);
18748
18748
  }
18749
- function targetsFor(keys, item) {
18749
+ var sectionEl = (id) => document.querySelector(`[data-ohw-instance="${CSS.escape(id)}"]`) ?? document.querySelector(`[data-ohw-section="${CSS.escape(id)}"]`);
18750
+ function targetsFor(keys, item, sectionId) {
18750
18751
  const out = /* @__PURE__ */ new Set();
18751
18752
  for (const key of keys) {
18752
18753
  if (!key) continue;
@@ -18757,11 +18758,15 @@ function targetsFor(keys, item) {
18757
18758
  }
18758
18759
  }
18759
18760
  if (item) {
18760
- const section = document.querySelector(`[data-ohw-instance="${CSS.escape(item.sectionId)}"]`) ?? document.querySelector(`[data-ohw-section="${CSS.escape(item.sectionId)}"]`);
18761
+ const section = sectionEl(item.sectionId);
18761
18762
  const stamp = `${item.group}:${item.index}`;
18762
18763
  const el = section?.querySelector(`[data-ohw-item="${CSS.escape(stamp)}"]`);
18763
18764
  if (el) out.add(el);
18764
18765
  }
18766
+ if (out.size === 0 && sectionId) {
18767
+ const section = sectionEl(sectionId);
18768
+ if (section) out.add(section);
18769
+ }
18765
18770
  return [...out];
18766
18771
  }
18767
18772
  var clearTimer = null;
@@ -18774,9 +18779,9 @@ function clearChangeHighlight() {
18774
18779
  el.removeAttribute(MARK_ATTR);
18775
18780
  }
18776
18781
  }
18777
- function highlightChangedElements(keys, item) {
18782
+ function highlightChangedElements(keys, item, sectionId) {
18778
18783
  clearChangeHighlight();
18779
- const targets = targetsFor(keys, item);
18784
+ const targets = targetsFor(keys, item, sectionId);
18780
18785
  if (targets.length === 0) return 0;
18781
18786
  ensureStyleSheet2();
18782
18787
  for (const el of targets) el.setAttribute(MARK_ATTR, "");
@@ -18794,7 +18799,8 @@ function installAiChangeHighlight() {
18794
18799
  const keys = Array.isArray(data.keys) ? data.keys.filter((k) => typeof k === "string") : [];
18795
18800
  const raw = data.item;
18796
18801
  const item = raw && typeof raw.sectionId === "string" && typeof raw.group === "string" && typeof raw.index === "number" ? { sectionId: raw.sectionId, group: raw.group, index: raw.index } : void 0;
18797
- const found = highlightChangedElements(keys, item);
18802
+ const sectionId = typeof data.sectionId === "string" ? data.sectionId : void 0;
18803
+ const found = highlightChangedElements(keys, item, sectionId);
18798
18804
  window.parent?.postMessage({ type: "ow:ai-highlight-done", found }, "*");
18799
18805
  };
18800
18806
  window.addEventListener("message", onMessage);
@@ -18994,12 +19000,12 @@ function AiSectionOverlay({
18994
19000
  const selectFromElement = (0, import_react12.useCallback)(
18995
19001
  (el, options) => {
18996
19002
  const inner = el?.closest("[data-ohw-section]") ?? null;
18997
- const sectionEl = inner ? movableUnit(inner) : null;
18998
- const id = sectionEl ? instanceIdOf(sectionEl) || null : null;
19003
+ const sectionEl2 = inner ? movableUnit(inner) : null;
19004
+ const id = sectionEl2 ? instanceIdOf(sectionEl2) || null : null;
18999
19005
  if (id === selectedIdRef.current) return;
19000
19006
  selectedIdRef.current = id;
19001
19007
  setSelectedId(id);
19002
- if (options?.report !== false) report(sectionEl);
19008
+ if (options?.report !== false) report(sectionEl2);
19003
19009
  },
19004
19010
  [report]
19005
19011
  );
@@ -19007,15 +19013,15 @@ function AiSectionOverlay({
19007
19013
  apiRef.current = {
19008
19014
  selectFromElement,
19009
19015
  handleBackgroundClick: (target, clientX, clientY) => {
19010
- let sectionEl = target?.closest("[data-ohw-section]") ?? null;
19011
- if (!sectionEl && clientX !== void 0 && clientY !== void 0) {
19016
+ let sectionEl2 = target?.closest("[data-ohw-section]") ?? null;
19017
+ if (!sectionEl2 && clientX !== void 0 && clientY !== void 0) {
19012
19018
  const beneath = document.elementsFromPoint(clientX, clientY).find(
19013
19019
  (el) => el instanceof HTMLElement && !el.closest("[data-ohw-bridge-root]") && el.closest("[data-ohw-section]") != null
19014
19020
  );
19015
- sectionEl = beneath?.closest("[data-ohw-section]") ?? null;
19021
+ sectionEl2 = beneath?.closest("[data-ohw-section]") ?? null;
19016
19022
  }
19017
- selectFromElement(sectionEl);
19018
- return sectionEl != null;
19023
+ selectFromElement(sectionEl2);
19024
+ return sectionEl2 != null;
19019
19025
  },
19020
19026
  clear: () => {
19021
19027
  selectedIdRef.current = null;
@@ -19487,9 +19493,9 @@ var import_jsx_runtime21 = require("react/jsx-runtime");
19487
19493
  var PRIMARY3 = "var(--ohw-primary, #0885FE)";
19488
19494
  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]";
19489
19495
  function findMediaStripItemElement(sectionId, index) {
19490
- const sectionEl = findByInstanceId(sectionId);
19491
- if (!sectionEl) return null;
19492
- const items = sectionEl.querySelectorAll("[data-ohw-media-strip-item]");
19496
+ const sectionEl2 = findByInstanceId(sectionId);
19497
+ if (!sectionEl2) return null;
19498
+ const items = sectionEl2.querySelectorAll("[data-ohw-media-strip-item]");
19493
19499
  for (const el of Array.from(items)) {
19494
19500
  if (Number(el.dataset.ohwMediaStripIndex) === index) return el;
19495
19501
  }
@@ -19500,8 +19506,8 @@ function itemRefFromTarget(target) {
19500
19506
  if (target.closest(CHROME_SELECTOR)) return null;
19501
19507
  const itemEl = target.closest("[data-ohw-media-strip-item]");
19502
19508
  if (!itemEl) return null;
19503
- const sectionEl = itemEl.closest("[data-ohw-section]");
19504
- const unit = sectionEl ? movableUnit(sectionEl) : null;
19509
+ const sectionEl2 = itemEl.closest("[data-ohw-section]");
19510
+ const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
19505
19511
  const sectionId = unit ? instanceIdOf(unit) || null : null;
19506
19512
  const index = Number(itemEl.dataset.ohwMediaStripIndex);
19507
19513
  if (!sectionId || Number.isNaN(index)) return null;
@@ -20139,9 +20145,9 @@ var import_jsx_runtime22 = require("react/jsx-runtime");
20139
20145
  var PRIMARY4 = "var(--ohw-primary, #0885FE)";
20140
20146
  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]";
20141
20147
  function findPricingCardElement(sectionId, index) {
20142
- const sectionEl = findByInstanceId(sectionId);
20143
- if (!sectionEl) return null;
20144
- const cards = sectionEl.querySelectorAll("[data-ohw-pricing-card]");
20148
+ const sectionEl2 = findByInstanceId(sectionId);
20149
+ if (!sectionEl2) return null;
20150
+ const cards = sectionEl2.querySelectorAll("[data-ohw-pricing-card]");
20145
20151
  for (const el of Array.from(cards)) {
20146
20152
  if (Number(el.dataset.ohwPricingIndex) === index) return el;
20147
20153
  }
@@ -20152,8 +20158,8 @@ function cardRefFromTarget(target) {
20152
20158
  if (target.closest(CHROME_SELECTOR2)) return null;
20153
20159
  const cardEl = target.closest("[data-ohw-pricing-card]");
20154
20160
  if (!cardEl) return null;
20155
- const sectionEl = cardEl.closest("[data-ohw-section]");
20156
- const unit = sectionEl ? movableUnit(sectionEl) : null;
20161
+ const sectionEl2 = cardEl.closest("[data-ohw-section]");
20162
+ const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
20157
20163
  const sectionId = unit ? instanceIdOf(unit) || null : null;
20158
20164
  const index = Number(cardEl.dataset.ohwPricingIndex);
20159
20165
  if (!sectionId || Number.isNaN(index)) return null;
@@ -20664,9 +20670,9 @@ var PRIMARY5 = "#0885FE";
20664
20670
  var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
20665
20671
  var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20666
20672
  function findVideoBlockElement(sectionId, path) {
20667
- const sectionEl = findByInstanceId(sectionId);
20668
- if (!sectionEl) return null;
20669
- const items = sectionEl.querySelectorAll("[data-ohw-video-block]");
20673
+ const sectionEl2 = findByInstanceId(sectionId);
20674
+ if (!sectionEl2) return null;
20675
+ const items = sectionEl2.querySelectorAll("[data-ohw-video-block]");
20670
20676
  for (const el of Array.from(items)) {
20671
20677
  if (el.dataset.ohwVideoPath === path) return el;
20672
20678
  }
@@ -20916,8 +20922,8 @@ function AiVideoOverlay({
20916
20922
  setHover(null);
20917
20923
  return;
20918
20924
  }
20919
- const sectionEl = blockEl.closest("[data-ohw-section]");
20920
- const unit = sectionEl ? movableUnit(sectionEl) : null;
20925
+ const sectionEl2 = blockEl.closest("[data-ohw-section]");
20926
+ const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
20921
20927
  const sectionId = unit ? instanceIdOf(unit) || null : null;
20922
20928
  const path = blockEl.dataset.ohwVideoPath;
20923
20929
  if (!sectionId || !path) {
@@ -21124,9 +21130,9 @@ var PRIMARY6 = "#0885FE";
21124
21130
  var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
21125
21131
  var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
21126
21132
  function findCarouselItemElement(sectionId, index) {
21127
- const sectionEl = findByInstanceId(sectionId);
21128
- if (!sectionEl) return null;
21129
- const items = sectionEl.querySelectorAll("[data-ohw-fade-carousel-item]");
21133
+ const sectionEl2 = findByInstanceId(sectionId);
21134
+ if (!sectionEl2) return null;
21135
+ const items = sectionEl2.querySelectorAll("[data-ohw-fade-carousel-item]");
21130
21136
  for (const el of Array.from(items)) {
21131
21137
  if (Number(el.dataset.ohwFadeCarouselIndex) === index) return el;
21132
21138
  }
@@ -21386,8 +21392,8 @@ function AiFadeCarouselOverlay({
21386
21392
  setHover(null);
21387
21393
  return;
21388
21394
  }
21389
- const sectionEl = itemEl.closest("[data-ohw-section]");
21390
- const unit = sectionEl ? movableUnit(sectionEl) : null;
21395
+ const sectionEl2 = itemEl.closest("[data-ohw-section]");
21396
+ const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
21391
21397
  const sectionId = unit ? instanceIdOf(unit) || null : null;
21392
21398
  const index = Number(itemEl.dataset.ohwFadeCarouselIndex);
21393
21399
  if (!sectionId || Number.isNaN(index)) {
@@ -24212,9 +24218,9 @@ function useSectionDrag({
24212
24218
  if (target.closest(SECTION_DRAG_EXCLUDED_SELECTOR)) return;
24213
24219
  const inner = target.closest("[data-ohw-section]");
24214
24220
  if (!inner || isChromeSection(inner) || inner.dataset.ohwSection === "footer") return;
24215
- const sectionEl = movableUnit(inner);
24216
- if (!topLevelSections().includes(sectionEl)) return;
24217
- startSectionPressDrag(sectionEl, e.clientX, e.clientY, e.pointerId);
24221
+ const sectionEl2 = movableUnit(inner);
24222
+ if (!topLevelSections().includes(sectionEl2)) return;
24223
+ startSectionPressDrag(sectionEl2, e.clientX, e.clientY, e.pointerId);
24218
24224
  };
24219
24225
  const onPointerMove = (e) => {
24220
24226
  const pending = sectionPointerDragRef.current;
@@ -26483,9 +26489,9 @@ function OhhwellsBridge() {
26483
26489
  const selectedIconElRef = (0, import_react25.useRef)(null);
26484
26490
  const selectedSocialElRef = (0, import_react25.useRef)(null);
26485
26491
  const queueSectionKeyDrop = (0, import_react25.useCallback)((prev) => {
26486
- const sectionEl = prev?.closest("[data-ohw-section]") ?? null;
26487
- if (!sectionEl) return;
26488
- const sectionInstanceId = instanceIdOf(movableUnit(sectionEl)) || null;
26492
+ const sectionEl2 = prev?.closest("[data-ohw-section]") ?? null;
26493
+ if (!sectionEl2) return;
26494
+ const sectionInstanceId = instanceIdOf(movableUnit(sectionEl2)) || null;
26489
26495
  if (!sectionInstanceId) return;
26490
26496
  const token = ++mediaKeyDropTokenRef.current;
26491
26497
  const onQueueDrained = (e) => {
@@ -26495,8 +26501,8 @@ function OhhwellsBridge() {
26495
26501
  if (selectedMediaElRef.current || selectedIconElRef.current || selectedSocialElRef.current) return;
26496
26502
  postToParentRef.current({
26497
26503
  type: "ow:section-selected",
26498
- sectionId: sectionEl.dataset.ohwSection ?? null,
26499
- sectionLabel: sectionEl.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl.dataset.ohwSection ?? ""),
26504
+ sectionId: sectionEl2.dataset.ohwSection ?? null,
26505
+ sectionLabel: sectionEl2.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl2.dataset.ohwSection ?? ""),
26500
26506
  key: null
26501
26507
  });
26502
26508
  };
@@ -26530,12 +26536,12 @@ function OhhwellsBridge() {
26530
26536
  const selectIconElement = (0, import_react25.useCallback)((el) => {
26531
26537
  if (selectedMediaElRef.current) clearMediaSelectionRef.current();
26532
26538
  selectedIconElRef.current = el;
26533
- const sectionEl = el.closest("[data-ohw-section]");
26539
+ const sectionEl2 = el.closest("[data-ohw-section]");
26534
26540
  aiSectionApiRef.current?.selectFromElement(el, { report: false });
26535
26541
  postToParentRef.current({
26536
26542
  type: "ow:section-selected",
26537
- sectionId: sectionEl?.dataset.ohwSection ?? null,
26538
- sectionLabel: sectionEl ? sectionEl.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl.dataset.ohwSection ?? "") : null,
26543
+ sectionId: sectionEl2?.dataset.ohwSection ?? null,
26544
+ sectionLabel: sectionEl2 ? sectionEl2.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl2.dataset.ohwSection ?? "") : null,
26539
26545
  key: el.dataset.ohwKey ?? null,
26540
26546
  keyLabel: "Icon"
26541
26547
  });
@@ -26555,12 +26561,12 @@ function OhhwellsBridge() {
26555
26561
  isDragOver: false,
26556
26562
  ...video ? { videoAutoplay: video.autoplay, videoMuted: video.muted } : {}
26557
26563
  });
26558
- const sectionEl = el.closest("[data-ohw-section]");
26564
+ const sectionEl2 = el.closest("[data-ohw-section]");
26559
26565
  aiSectionApiRef.current?.selectFromElement(el, { report: false });
26560
26566
  postToParentRef.current({
26561
26567
  type: "ow:section-selected",
26562
- sectionId: sectionEl?.dataset.ohwSection ?? null,
26563
- sectionLabel: sectionEl ? sectionEl.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl.dataset.ohwSection ?? "") : null,
26568
+ sectionId: sectionEl2?.dataset.ohwSection ?? null,
26569
+ sectionLabel: sectionEl2 ? sectionEl2.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl2.dataset.ohwSection ?? "") : null,
26564
26570
  key: el.dataset.ohwKey ?? null,
26565
26571
  // Display name for the pill — the raw key prettifies into fragments ("Img"); the
26566
26572
  // bridge knows what the node IS, so it names it.
@@ -28157,12 +28163,12 @@ function OhhwellsBridge() {
28157
28163
  const socialItem = getSocialItem(anchor);
28158
28164
  if (socialItem) {
28159
28165
  selectedSocialElRef.current = socialItem;
28160
- const sectionEl = socialItem.closest("[data-ohw-section]");
28166
+ const sectionEl2 = socialItem.closest("[data-ohw-section]");
28161
28167
  aiSectionApiRef.current?.selectFromElement(anchor, { report: false });
28162
28168
  postToParentRef.current({
28163
28169
  type: "ow:section-selected",
28164
- sectionId: sectionEl?.dataset.ohwSection ?? null,
28165
- sectionLabel: sectionEl ? sectionEl.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl.dataset.ohwSection ?? "") : null,
28170
+ sectionId: sectionEl2?.dataset.ohwSection ?? null,
28171
+ sectionLabel: sectionEl2 ? sectionEl2.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl2.dataset.ohwSection ?? "") : null,
28166
28172
  key: socialIconKey(socialItem) ?? socialItem.getAttribute("data-ohw-href-key"),
28167
28173
  keyLabel: socialPlatformLabel(socialItem, editContentRef.current)
28168
28174
  });
@@ -28592,13 +28598,13 @@ function OhhwellsBridge() {
28592
28598
  setReorderDragDisabled(reorderDisabled);
28593
28599
  }
28594
28600
  setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
28595
- const sectionEl = el.closest("[data-ohw-section]");
28601
+ const sectionEl2 = el.closest("[data-ohw-section]");
28596
28602
  postToParent2({
28597
28603
  type: "ow:enter-edit",
28598
28604
  key: el.dataset.ohwKey,
28599
28605
  // Section the edited element belongs to, so the editor can scope AI prompts to it.
28600
- sectionId: sectionEl?.dataset.ohwSection ?? null,
28601
- sectionLabel: sectionEl?.dataset.ohwSectionLabel ?? null
28606
+ sectionId: sectionEl2?.dataset.ohwSection ?? null,
28607
+ sectionLabel: sectionEl2?.dataset.ohwSectionLabel ?? null
28602
28608
  });
28603
28609
  aiSectionApiRef.current?.selectFromElement(el, { report: false });
28604
28610
  requestAnimationFrame(() => refreshActiveCommandsRef.current());
@@ -32263,12 +32269,12 @@ function OhhwellsBridge() {
32263
32269
  `[data-ohw-instance="${escapedSectionId}"]`
32264
32270
  );
32265
32271
  const foundEl = instanceEl ? sectionElementOf(instanceEl) : document.querySelector(`[data-ohw-section="${escapedSectionId}"]`);
32266
- const sectionEl = foundEl && !foundEl.hasAttribute("data-ohw-ai-template-hidden") && !foundEl.hasAttribute("data-ohw-ai-removed") && !foundEl.hasAttribute("data-ohw-ai-replaced-by") ? foundEl : null;
32267
- const nodes = sectionEl ? collectEditableNodes(void 0, sectionEl).filter(
32272
+ const sectionEl2 = foundEl && !foundEl.hasAttribute("data-ohw-ai-template-hidden") && !foundEl.hasAttribute("data-ohw-ai-removed") && !foundEl.hasAttribute("data-ohw-ai-replaced-by") ? foundEl : null;
32273
+ const nodes = sectionEl2 ? collectEditableNodes(void 0, sectionEl2).filter(
32268
32274
  (n) => n.key && !n.key.startsWith("__ohw_") && !["meta", "sections", "video-setting"].includes(n.type)
32269
- ).map((n) => ({ ...n, text: n.text ?? "", type: normalizeAiNodeType(n.type) })).map((n) => withNodeFontSize(n, sectionEl)) : [];
32270
- const items = sectionEl ? collectItemGroups(sectionEl) : [];
32271
- const box = sectionEl?.getBoundingClientRect();
32275
+ ).map((n) => ({ ...n, text: n.text ?? "", type: normalizeAiNodeType(n.type) })).map((n) => withNodeFontSize(n, sectionEl2)) : [];
32276
+ const items = sectionEl2 ? collectItemGroups(sectionEl2) : [];
32277
+ const box = sectionEl2?.getBoundingClientRect();
32272
32278
  const rect = box ? {
32273
32279
  top: box.top + window.scrollY,
32274
32280
  left: box.left + window.scrollX,
@@ -32284,7 +32290,7 @@ function OhhwellsBridge() {
32284
32290
  postToParentRef.current({
32285
32291
  type: "ow:section-nodes",
32286
32292
  sectionId,
32287
- found: !!sectionEl,
32293
+ found: !!sectionEl2,
32288
32294
  nodes,
32289
32295
  rect,
32290
32296
  ...settings ? { settings } : {},
@@ -32292,7 +32298,7 @@ function OhhwellsBridge() {
32292
32298
  // The section's repeated-item groups (cards, rows, FAQ entries) — what lets a prompt add
32293
32299
  // or remove items on a template section without regenerating it. Empty for generated
32294
32300
  // sections, whose items live in the tree.
32295
- ...sectionEl && items.length ? { items } : {}
32301
+ ...sectionEl2 && items.length ? { items } : {}
32296
32302
  });
32297
32303
  };
32298
32304
  const handleCollectItems = (e) => {
@@ -33011,7 +33017,7 @@ function OhhwellsBridge() {
33011
33017
  postToParent2({
33012
33018
  type: "ow:ready",
33013
33019
  version: "1",
33014
- bridgeVersion: "0.1.166-next.442",
33020
+ bridgeVersion: "0.1.167-next.444",
33015
33021
  path: pathname,
33016
33022
  nodes: collectEditableNodes(editContentRef.current),
33017
33023
  sections