@ohhwells/bridge 0.1.167 → 0.1.168

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");
@@ -17608,7 +17608,7 @@ function apiBase() {
17608
17608
  function bridgeVersion() {
17609
17609
  try {
17610
17610
  if (true) {
17611
- return "0.1.167";
17611
+ return "0.1.168";
17612
17612
  }
17613
17613
  } catch {
17614
17614
  }
@@ -17622,7 +17622,7 @@ function stampBridgeVersionOnDocument() {
17622
17622
  return;
17623
17623
  }
17624
17624
  try {
17625
- const v = true ? "0.1.167" : "";
17625
+ const v = true ? "0.1.168" : "";
17626
17626
  if (v) {
17627
17627
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
17628
17628
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -18558,7 +18558,8 @@ function ensureStyleSheet2() {
18558
18558
  el.textContent = HIGHLIGHT_CSS;
18559
18559
  document.head.appendChild(el);
18560
18560
  }
18561
- function targetsFor(keys, item) {
18561
+ var sectionEl = (id) => document.querySelector(`[data-ohw-instance="${CSS.escape(id)}"]`) ?? document.querySelector(`[data-ohw-section="${CSS.escape(id)}"]`);
18562
+ function targetsFor(keys, item, sectionId) {
18562
18563
  const out = /* @__PURE__ */ new Set();
18563
18564
  for (const key of keys) {
18564
18565
  if (!key) continue;
@@ -18569,11 +18570,15 @@ function targetsFor(keys, item) {
18569
18570
  }
18570
18571
  }
18571
18572
  if (item) {
18572
- const section = document.querySelector(`[data-ohw-instance="${CSS.escape(item.sectionId)}"]`) ?? document.querySelector(`[data-ohw-section="${CSS.escape(item.sectionId)}"]`);
18573
+ const section = sectionEl(item.sectionId);
18573
18574
  const stamp = `${item.group}:${item.index}`;
18574
18575
  const el = section?.querySelector(`[data-ohw-item="${CSS.escape(stamp)}"]`);
18575
18576
  if (el) out.add(el);
18576
18577
  }
18578
+ if (out.size === 0 && sectionId) {
18579
+ const section = sectionEl(sectionId);
18580
+ if (section) out.add(section);
18581
+ }
18577
18582
  return [...out];
18578
18583
  }
18579
18584
  var clearTimer = null;
@@ -18586,9 +18591,9 @@ function clearChangeHighlight() {
18586
18591
  el.removeAttribute(MARK_ATTR);
18587
18592
  }
18588
18593
  }
18589
- function highlightChangedElements(keys, item) {
18594
+ function highlightChangedElements(keys, item, sectionId) {
18590
18595
  clearChangeHighlight();
18591
- const targets = targetsFor(keys, item);
18596
+ const targets = targetsFor(keys, item, sectionId);
18592
18597
  if (targets.length === 0) return 0;
18593
18598
  ensureStyleSheet2();
18594
18599
  for (const el of targets) el.setAttribute(MARK_ATTR, "");
@@ -18606,7 +18611,8 @@ function installAiChangeHighlight() {
18606
18611
  const keys = Array.isArray(data.keys) ? data.keys.filter((k) => typeof k === "string") : [];
18607
18612
  const raw = data.item;
18608
18613
  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;
18609
- const found = highlightChangedElements(keys, item);
18614
+ const sectionId = typeof data.sectionId === "string" ? data.sectionId : void 0;
18615
+ const found = highlightChangedElements(keys, item, sectionId);
18610
18616
  window.parent?.postMessage({ type: "ow:ai-highlight-done", found }, "*");
18611
18617
  };
18612
18618
  window.addEventListener("message", onMessage);
@@ -18806,12 +18812,12 @@ function AiSectionOverlay({
18806
18812
  const selectFromElement = (0, import_react12.useCallback)(
18807
18813
  (el, options) => {
18808
18814
  const inner = el?.closest("[data-ohw-section]") ?? null;
18809
- const sectionEl = inner ? movableUnit(inner) : null;
18810
- const id = sectionEl ? instanceIdOf(sectionEl) || null : null;
18815
+ const sectionEl2 = inner ? movableUnit(inner) : null;
18816
+ const id = sectionEl2 ? instanceIdOf(sectionEl2) || null : null;
18811
18817
  if (id === selectedIdRef.current) return;
18812
18818
  selectedIdRef.current = id;
18813
18819
  setSelectedId(id);
18814
- if (options?.report !== false) report(sectionEl);
18820
+ if (options?.report !== false) report(sectionEl2);
18815
18821
  },
18816
18822
  [report]
18817
18823
  );
@@ -18819,15 +18825,15 @@ function AiSectionOverlay({
18819
18825
  apiRef.current = {
18820
18826
  selectFromElement,
18821
18827
  handleBackgroundClick: (target, clientX, clientY) => {
18822
- let sectionEl = target?.closest("[data-ohw-section]") ?? null;
18823
- if (!sectionEl && clientX !== void 0 && clientY !== void 0) {
18828
+ let sectionEl2 = target?.closest("[data-ohw-section]") ?? null;
18829
+ if (!sectionEl2 && clientX !== void 0 && clientY !== void 0) {
18824
18830
  const beneath = document.elementsFromPoint(clientX, clientY).find(
18825
18831
  (el) => el instanceof HTMLElement && !el.closest("[data-ohw-bridge-root]") && el.closest("[data-ohw-section]") != null
18826
18832
  );
18827
- sectionEl = beneath?.closest("[data-ohw-section]") ?? null;
18833
+ sectionEl2 = beneath?.closest("[data-ohw-section]") ?? null;
18828
18834
  }
18829
- selectFromElement(sectionEl);
18830
- return sectionEl != null;
18835
+ selectFromElement(sectionEl2);
18836
+ return sectionEl2 != null;
18831
18837
  },
18832
18838
  clear: () => {
18833
18839
  selectedIdRef.current = null;
@@ -19201,9 +19207,9 @@ var PRIMARY3 = "#0885FE";
19201
19207
  var OHW_BLUE = `var(--ohw-primary, ${PRIMARY3})`;
19202
19208
  var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
19203
19209
  function findMediaStripItemElement(sectionId, index) {
19204
- const sectionEl = findByInstanceId(sectionId);
19205
- if (!sectionEl) return null;
19206
- const items = sectionEl.querySelectorAll("[data-ohw-media-strip-item]");
19210
+ const sectionEl2 = findByInstanceId(sectionId);
19211
+ if (!sectionEl2) return null;
19212
+ const items = sectionEl2.querySelectorAll("[data-ohw-media-strip-item]");
19207
19213
  for (const el of Array.from(items)) {
19208
19214
  if (Number(el.dataset.ohwMediaStripIndex) === index) return el;
19209
19215
  }
@@ -19610,8 +19616,8 @@ function AiMediaStripOverlay({
19610
19616
  setHover(null);
19611
19617
  return;
19612
19618
  }
19613
- const sectionEl = itemEl.closest("[data-ohw-section]");
19614
- const unit = sectionEl ? movableUnit(sectionEl) : null;
19619
+ const sectionEl2 = itemEl.closest("[data-ohw-section]");
19620
+ const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
19615
19621
  const sectionId = unit ? instanceIdOf(unit) || null : null;
19616
19622
  const index = Number(itemEl.dataset.ohwMediaStripIndex);
19617
19623
  if (!sectionId || Number.isNaN(index)) {
@@ -19822,9 +19828,9 @@ var import_jsx_runtime21 = require("react/jsx-runtime");
19822
19828
  var PRIMARY4 = "var(--ohw-primary, #0885FE)";
19823
19829
  var CHROME_SELECTOR = "[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review], [data-ohw-more-menu]";
19824
19830
  function findPricingCardElement(sectionId, index) {
19825
- const sectionEl = findByInstanceId(sectionId);
19826
- if (!sectionEl) return null;
19827
- const cards = sectionEl.querySelectorAll("[data-ohw-pricing-card]");
19831
+ const sectionEl2 = findByInstanceId(sectionId);
19832
+ if (!sectionEl2) return null;
19833
+ const cards = sectionEl2.querySelectorAll("[data-ohw-pricing-card]");
19828
19834
  for (const el of Array.from(cards)) {
19829
19835
  if (Number(el.dataset.ohwPricingIndex) === index) return el;
19830
19836
  }
@@ -19835,8 +19841,8 @@ function cardRefFromTarget(target) {
19835
19841
  if (target.closest(CHROME_SELECTOR)) return null;
19836
19842
  const cardEl = target.closest("[data-ohw-pricing-card]");
19837
19843
  if (!cardEl) return null;
19838
- const sectionEl = cardEl.closest("[data-ohw-section]");
19839
- const unit = sectionEl ? movableUnit(sectionEl) : null;
19844
+ const sectionEl2 = cardEl.closest("[data-ohw-section]");
19845
+ const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
19840
19846
  const sectionId = unit ? instanceIdOf(unit) || null : null;
19841
19847
  const index = Number(cardEl.dataset.ohwPricingIndex);
19842
19848
  if (!sectionId || Number.isNaN(index)) return null;
@@ -20375,9 +20381,9 @@ var PRIMARY5 = "#0885FE";
20375
20381
  var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY5})`;
20376
20382
  var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20377
20383
  function findVideoBlockElement(sectionId, path) {
20378
- const sectionEl = findByInstanceId(sectionId);
20379
- if (!sectionEl) return null;
20380
- const items = sectionEl.querySelectorAll("[data-ohw-video-block]");
20384
+ const sectionEl2 = findByInstanceId(sectionId);
20385
+ if (!sectionEl2) return null;
20386
+ const items = sectionEl2.querySelectorAll("[data-ohw-video-block]");
20381
20387
  for (const el of Array.from(items)) {
20382
20388
  if (el.dataset.ohwVideoPath === path) return el;
20383
20389
  }
@@ -20627,8 +20633,8 @@ function AiVideoOverlay({
20627
20633
  setHover(null);
20628
20634
  return;
20629
20635
  }
20630
- const sectionEl = blockEl.closest("[data-ohw-section]");
20631
- const unit = sectionEl ? movableUnit(sectionEl) : null;
20636
+ const sectionEl2 = blockEl.closest("[data-ohw-section]");
20637
+ const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
20632
20638
  const sectionId = unit ? instanceIdOf(unit) || null : null;
20633
20639
  const path = blockEl.dataset.ohwVideoPath;
20634
20640
  if (!sectionId || !path) {
@@ -20835,9 +20841,9 @@ var PRIMARY6 = "#0885FE";
20835
20841
  var OHW_BLUE3 = `var(--ohw-primary, ${PRIMARY6})`;
20836
20842
  var OHW_BLUE_DARK3 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
20837
20843
  function findCarouselItemElement(sectionId, index) {
20838
- const sectionEl = findByInstanceId(sectionId);
20839
- if (!sectionEl) return null;
20840
- const items = sectionEl.querySelectorAll("[data-ohw-fade-carousel-item]");
20844
+ const sectionEl2 = findByInstanceId(sectionId);
20845
+ if (!sectionEl2) return null;
20846
+ const items = sectionEl2.querySelectorAll("[data-ohw-fade-carousel-item]");
20841
20847
  for (const el of Array.from(items)) {
20842
20848
  if (Number(el.dataset.ohwFadeCarouselIndex) === index) return el;
20843
20849
  }
@@ -21097,8 +21103,8 @@ function AiFadeCarouselOverlay({
21097
21103
  setHover(null);
21098
21104
  return;
21099
21105
  }
21100
- const sectionEl = itemEl.closest("[data-ohw-section]");
21101
- const unit = sectionEl ? movableUnit(sectionEl) : null;
21106
+ const sectionEl2 = itemEl.closest("[data-ohw-section]");
21107
+ const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
21102
21108
  const sectionId = unit ? instanceIdOf(unit) || null : null;
21103
21109
  const index = Number(itemEl.dataset.ohwFadeCarouselIndex);
21104
21110
  if (!sectionId || Number.isNaN(index)) {
@@ -24029,9 +24035,9 @@ function useSectionDrag({
24029
24035
  if (target.closest(SECTION_DRAG_EXCLUDED_SELECTOR)) return;
24030
24036
  const inner = target.closest("[data-ohw-section]");
24031
24037
  if (!inner || isChromeSection(inner) || inner.dataset.ohwSection === "footer") return;
24032
- const sectionEl = movableUnit(inner);
24033
- if (!topLevelSections().includes(sectionEl)) return;
24034
- startSectionPressDrag(sectionEl, e.clientX, e.clientY, e.pointerId);
24038
+ const sectionEl2 = movableUnit(inner);
24039
+ if (!topLevelSections().includes(sectionEl2)) return;
24040
+ startSectionPressDrag(sectionEl2, e.clientX, e.clientY, e.pointerId);
24035
24041
  };
24036
24042
  const onPointerMove = (e) => {
24037
24043
  const pending = sectionPointerDragRef.current;
@@ -26301,9 +26307,9 @@ function OhhwellsBridge() {
26301
26307
  const selectedIconElRef = (0, import_react25.useRef)(null);
26302
26308
  const selectedSocialElRef = (0, import_react25.useRef)(null);
26303
26309
  const queueSectionKeyDrop = (0, import_react25.useCallback)((prev) => {
26304
- const sectionEl = prev?.closest("[data-ohw-section]") ?? null;
26305
- if (!sectionEl) return;
26306
- const sectionInstanceId = instanceIdOf(movableUnit(sectionEl)) || null;
26310
+ const sectionEl2 = prev?.closest("[data-ohw-section]") ?? null;
26311
+ if (!sectionEl2) return;
26312
+ const sectionInstanceId = instanceIdOf(movableUnit(sectionEl2)) || null;
26307
26313
  if (!sectionInstanceId) return;
26308
26314
  const token = ++mediaKeyDropTokenRef.current;
26309
26315
  const onQueueDrained = (e) => {
@@ -26313,8 +26319,8 @@ function OhhwellsBridge() {
26313
26319
  if (selectedMediaElRef.current || selectedIconElRef.current || selectedSocialElRef.current) return;
26314
26320
  postToParentRef.current({
26315
26321
  type: "ow:section-selected",
26316
- sectionId: sectionEl.dataset.ohwSection ?? null,
26317
- sectionLabel: sectionEl.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl.dataset.ohwSection ?? ""),
26322
+ sectionId: sectionEl2.dataset.ohwSection ?? null,
26323
+ sectionLabel: sectionEl2.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl2.dataset.ohwSection ?? ""),
26318
26324
  key: null
26319
26325
  });
26320
26326
  };
@@ -26348,12 +26354,12 @@ function OhhwellsBridge() {
26348
26354
  const selectIconElement = (0, import_react25.useCallback)((el) => {
26349
26355
  if (selectedMediaElRef.current) clearMediaSelectionRef.current();
26350
26356
  selectedIconElRef.current = el;
26351
- const sectionEl = el.closest("[data-ohw-section]");
26357
+ const sectionEl2 = el.closest("[data-ohw-section]");
26352
26358
  aiSectionApiRef.current?.selectFromElement(el, { report: false });
26353
26359
  postToParentRef.current({
26354
26360
  type: "ow:section-selected",
26355
- sectionId: sectionEl?.dataset.ohwSection ?? null,
26356
- sectionLabel: sectionEl ? sectionEl.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl.dataset.ohwSection ?? "") : null,
26361
+ sectionId: sectionEl2?.dataset.ohwSection ?? null,
26362
+ sectionLabel: sectionEl2 ? sectionEl2.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl2.dataset.ohwSection ?? "") : null,
26357
26363
  key: el.dataset.ohwKey ?? null,
26358
26364
  keyLabel: "Icon"
26359
26365
  });
@@ -26373,12 +26379,12 @@ function OhhwellsBridge() {
26373
26379
  isDragOver: false,
26374
26380
  ...video ? { videoAutoplay: video.autoplay, videoMuted: video.muted } : {}
26375
26381
  });
26376
- const sectionEl = el.closest("[data-ohw-section]");
26382
+ const sectionEl2 = el.closest("[data-ohw-section]");
26377
26383
  aiSectionApiRef.current?.selectFromElement(el, { report: false });
26378
26384
  postToParentRef.current({
26379
26385
  type: "ow:section-selected",
26380
- sectionId: sectionEl?.dataset.ohwSection ?? null,
26381
- sectionLabel: sectionEl ? sectionEl.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl.dataset.ohwSection ?? "") : null,
26386
+ sectionId: sectionEl2?.dataset.ohwSection ?? null,
26387
+ sectionLabel: sectionEl2 ? sectionEl2.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl2.dataset.ohwSection ?? "") : null,
26382
26388
  key: el.dataset.ohwKey ?? null,
26383
26389
  // Display name for the pill — the raw key prettifies into fragments ("Img"); the
26384
26390
  // bridge knows what the node IS, so it names it.
@@ -27964,12 +27970,12 @@ function OhhwellsBridge() {
27964
27970
  const socialItem = getSocialItem(anchor);
27965
27971
  if (socialItem) {
27966
27972
  selectedSocialElRef.current = socialItem;
27967
- const sectionEl = socialItem.closest("[data-ohw-section]");
27973
+ const sectionEl2 = socialItem.closest("[data-ohw-section]");
27968
27974
  aiSectionApiRef.current?.selectFromElement(anchor, { report: false });
27969
27975
  postToParentRef.current({
27970
27976
  type: "ow:section-selected",
27971
- sectionId: sectionEl?.dataset.ohwSection ?? null,
27972
- sectionLabel: sectionEl ? sectionEl.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl.dataset.ohwSection ?? "") : null,
27977
+ sectionId: sectionEl2?.dataset.ohwSection ?? null,
27978
+ sectionLabel: sectionEl2 ? sectionEl2.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl2.dataset.ohwSection ?? "") : null,
27973
27979
  key: socialIconKey(socialItem) ?? socialItem.getAttribute("data-ohw-href-key"),
27974
27980
  keyLabel: socialPlatformLabel(socialItem, editContentRef.current)
27975
27981
  });
@@ -28399,13 +28405,13 @@ function OhhwellsBridge() {
28399
28405
  setReorderDragDisabled(reorderDisabled);
28400
28406
  }
28401
28407
  setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
28402
- const sectionEl = el.closest("[data-ohw-section]");
28408
+ const sectionEl2 = el.closest("[data-ohw-section]");
28403
28409
  postToParent2({
28404
28410
  type: "ow:enter-edit",
28405
28411
  key: el.dataset.ohwKey,
28406
28412
  // Section the edited element belongs to, so the editor can scope AI prompts to it.
28407
- sectionId: sectionEl?.dataset.ohwSection ?? null,
28408
- sectionLabel: sectionEl?.dataset.ohwSectionLabel ?? null
28413
+ sectionId: sectionEl2?.dataset.ohwSection ?? null,
28414
+ sectionLabel: sectionEl2?.dataset.ohwSectionLabel ?? null
28409
28415
  });
28410
28416
  aiSectionApiRef.current?.selectFromElement(el, { report: false });
28411
28417
  requestAnimationFrame(() => refreshActiveCommandsRef.current());
@@ -32051,12 +32057,12 @@ function OhhwellsBridge() {
32051
32057
  `[data-ohw-instance="${escapedSectionId}"]`
32052
32058
  );
32053
32059
  const foundEl = instanceEl ? sectionElementOf(instanceEl) : document.querySelector(`[data-ohw-section="${escapedSectionId}"]`);
32054
- 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;
32055
- const nodes = sectionEl ? collectEditableNodes(void 0, sectionEl).filter(
32060
+ 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;
32061
+ const nodes = sectionEl2 ? collectEditableNodes(void 0, sectionEl2).filter(
32056
32062
  (n) => n.key && !n.key.startsWith("__ohw_") && !["meta", "sections", "video-setting"].includes(n.type)
32057
- ).map((n) => ({ ...n, text: n.text ?? "", type: normalizeAiNodeType(n.type) })).map((n) => withNodeFontSize(n, sectionEl)) : [];
32058
- const items = sectionEl ? collectItemGroups(sectionEl) : [];
32059
- const box = sectionEl?.getBoundingClientRect();
32063
+ ).map((n) => ({ ...n, text: n.text ?? "", type: normalizeAiNodeType(n.type) })).map((n) => withNodeFontSize(n, sectionEl2)) : [];
32064
+ const items = sectionEl2 ? collectItemGroups(sectionEl2) : [];
32065
+ const box = sectionEl2?.getBoundingClientRect();
32060
32066
  const rect = box ? {
32061
32067
  top: box.top + window.scrollY,
32062
32068
  left: box.left + window.scrollX,
@@ -32072,7 +32078,7 @@ function OhhwellsBridge() {
32072
32078
  postToParentRef.current({
32073
32079
  type: "ow:section-nodes",
32074
32080
  sectionId,
32075
- found: !!sectionEl,
32081
+ found: !!sectionEl2,
32076
32082
  nodes,
32077
32083
  rect,
32078
32084
  ...settings ? { settings } : {},
@@ -32080,7 +32086,7 @@ function OhhwellsBridge() {
32080
32086
  // The section's repeated-item groups (cards, rows, FAQ entries) — what lets a prompt add
32081
32087
  // or remove items on a template section without regenerating it. Empty for generated
32082
32088
  // sections, whose items live in the tree.
32083
- ...sectionEl && items.length ? { items } : {}
32089
+ ...sectionEl2 && items.length ? { items } : {}
32084
32090
  });
32085
32091
  };
32086
32092
  const handleCollectItems = (e) => {
@@ -32799,7 +32805,7 @@ function OhhwellsBridge() {
32799
32805
  postToParent2({
32800
32806
  type: "ow:ready",
32801
32807
  version: "1",
32802
- bridgeVersion: "0.1.167",
32808
+ bridgeVersion: "0.1.168",
32803
32809
  path: pathname,
32804
32810
  nodes: collectEditableNodes(editContentRef.current),
32805
32811
  sections