@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.js CHANGED
@@ -5431,14 +5431,14 @@ function singleIndexSegment(key) {
5431
5431
  function indexFromKey(key, position) {
5432
5432
  return parseInt(baseKey(key).split("-")[position] ?? "", 10);
5433
5433
  }
5434
- function detectItemGroups(sectionEl) {
5435
- if (isGeneratedSection(sectionEl)) return detectGeneratedCards(sectionEl);
5434
+ function detectItemGroups(sectionEl2) {
5435
+ if (isGeneratedSection(sectionEl2)) return detectGeneratedCards(sectionEl2);
5436
5436
  const groups = [];
5437
5437
  const seenParents = /* @__PURE__ */ new Set();
5438
5438
  const parents = /* @__PURE__ */ new Set();
5439
- sectionEl.querySelectorAll("[data-ohw-key], [data-ohw-href-key]").forEach((keyedEl) => {
5439
+ sectionEl2.querySelectorAll("[data-ohw-key], [data-ohw-href-key]").forEach((keyedEl) => {
5440
5440
  let el = keyedEl;
5441
- while (el && el !== sectionEl) {
5441
+ while (el && el !== sectionEl2) {
5442
5442
  if (el.parentElement) parents.add(el.parentElement);
5443
5443
  el = el.parentElement;
5444
5444
  }
@@ -5528,8 +5528,8 @@ function detectItemGroups(sectionEl) {
5528
5528
  }
5529
5529
  return groups.sort((a, b) => a.nested === b.nested ? 0 : a.nested ? 1 : -1);
5530
5530
  }
5531
- function detectGeneratedCards(sectionEl) {
5532
- const cards = Array.from(sectionEl.querySelectorAll("[data-ohw-card]")).filter(
5531
+ function detectGeneratedCards(sectionEl2) {
5532
+ const cards = Array.from(sectionEl2.querySelectorAll("[data-ohw-card]")).filter(
5533
5533
  (el) => !el.parentElement?.closest("[data-ohw-card]")
5534
5534
  );
5535
5535
  if (cards.length === 0) return [];
@@ -5538,7 +5538,7 @@ function detectGeneratedCards(sectionEl) {
5538
5538
  item.el.setAttribute(ITEM_ATTR, `card:${item.index}`);
5539
5539
  item.el.setAttribute(ITEM_SURFACE_ATTR, "");
5540
5540
  }
5541
- return [{ group: "card", parent: cards[0].parentElement ?? sectionEl, nested: false, items, generated: true }];
5541
+ return [{ group: "card", parent: cards[0].parentElement ?? sectionEl2, nested: false, items, generated: true }];
5542
5542
  }
5543
5543
  function firstTextLabel(item) {
5544
5544
  for (const k of item.keyed) {
@@ -5554,13 +5554,13 @@ function findItemSection(sectionId) {
5554
5554
  const escaped = CSS.escape(sectionId);
5555
5555
  return document.querySelector(`[data-ohw-instance="${escaped}"]`) ?? document.querySelector(`[data-ohw-section="${escaped}"]`);
5556
5556
  }
5557
- function isGeneratedSection(sectionEl) {
5558
- return !!sectionEl.closest("[data-ohw-ai-generated]") || sectionEl.hasAttribute("data-ai-section");
5557
+ function isGeneratedSection(sectionEl2) {
5558
+ return !!sectionEl2.closest("[data-ohw-ai-generated]") || sectionEl2.hasAttribute("data-ai-section");
5559
5559
  }
5560
- function collectItemGroups(sectionEl) {
5561
- if (isChromeSection(sectionEl)) return [];
5562
- const sectionId = instanceIdOf(sectionEl);
5563
- return detectItemGroups(sectionEl).map((g) => ({
5560
+ function collectItemGroups(sectionEl2) {
5561
+ if (isChromeSection(sectionEl2)) return [];
5562
+ const sectionId = instanceIdOf(sectionEl2);
5563
+ return detectItemGroups(sectionEl2).map((g) => ({
5564
5564
  sectionId,
5565
5565
  group: g.group,
5566
5566
  nested: g.nested,
@@ -5729,11 +5729,11 @@ function initItemInstancesFromContent(content) {
5729
5729
  document.querySelectorAll(`[${ITEM_REMOVED_ATTR}]`).forEach((el) => setRemoved(el, false));
5730
5730
  if (!store) return;
5731
5731
  for (const [sectionId, groups] of Object.entries(store.sections)) {
5732
- const sectionEl = findItemSection(sectionId);
5733
- if (!sectionEl) continue;
5732
+ const sectionEl2 = findItemSection(sectionId);
5733
+ if (!sectionEl2) continue;
5734
5734
  const ordered = Object.entries(groups).sort(([a], [b]) => a.length - b.length);
5735
5735
  for (const [group, state] of ordered) {
5736
- const found = detectItemGroups(sectionEl).find((g) => g.group === group);
5736
+ const found = detectItemGroups(sectionEl2).find((g) => g.group === group);
5737
5737
  if (!found || found.generated) continue;
5738
5738
  syncGroup(found, state);
5739
5739
  }
@@ -5773,9 +5773,9 @@ function writeValue(el, attr, value) {
5773
5773
  }
5774
5774
  }
5775
5775
  function applyItemOps(store, ops, currentContent) {
5776
- const sectionEl = findItemSection(ops.sectionId);
5777
- if (!sectionEl) return null;
5778
- const detected = detectItemGroups(sectionEl).find((g) => g.group === ops.group);
5776
+ const sectionEl2 = findItemSection(ops.sectionId);
5777
+ if (!sectionEl2) return null;
5778
+ const detected = detectItemGroups(sectionEl2).find((g) => g.group === ops.group);
5779
5779
  if (!detected || detected.generated) return null;
5780
5780
  const next = { v: 1, sections: { ...store?.sections ?? {} } };
5781
5781
  const groups = { ...next.sections[ops.sectionId] ?? {} };
@@ -6185,10 +6185,10 @@ function applyStylesToDom(store) {
6185
6185
  if (bar === -1) continue;
6186
6186
  const sectionId = key.slice(0, bar);
6187
6187
  const stamp = key.slice(bar + 1);
6188
- const sectionEl = findItemSection(sectionId);
6189
- if (!sectionEl) continue;
6190
- detectItemGroups(sectionEl);
6191
- const item = sectionEl.querySelector(`[data-ohw-item="${CSS.escape(stamp)}"]`);
6188
+ const sectionEl2 = findItemSection(sectionId);
6189
+ if (!sectionEl2) continue;
6190
+ detectItemGroups(sectionEl2);
6191
+ const item = sectionEl2.querySelector(`[data-ohw-item="${CSS.escape(stamp)}"]`);
6192
6192
  if (!item) continue;
6193
6193
  saveInline(item, "background");
6194
6194
  item.style.setProperty("background", override.backgroundColor, "important");
@@ -17490,7 +17490,7 @@ function apiBase() {
17490
17490
  function bridgeVersion() {
17491
17491
  try {
17492
17492
  if (true) {
17493
- return "0.1.167";
17493
+ return "0.1.168";
17494
17494
  }
17495
17495
  } catch {
17496
17496
  }
@@ -17504,7 +17504,7 @@ function stampBridgeVersionOnDocument() {
17504
17504
  return;
17505
17505
  }
17506
17506
  try {
17507
- const v = true ? "0.1.167" : "";
17507
+ const v = true ? "0.1.168" : "";
17508
17508
  if (v) {
17509
17509
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
17510
17510
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -18440,7 +18440,8 @@ function ensureStyleSheet2() {
18440
18440
  el.textContent = HIGHLIGHT_CSS;
18441
18441
  document.head.appendChild(el);
18442
18442
  }
18443
- function targetsFor(keys, item) {
18443
+ var sectionEl = (id) => document.querySelector(`[data-ohw-instance="${CSS.escape(id)}"]`) ?? document.querySelector(`[data-ohw-section="${CSS.escape(id)}"]`);
18444
+ function targetsFor(keys, item, sectionId) {
18444
18445
  const out = /* @__PURE__ */ new Set();
18445
18446
  for (const key of keys) {
18446
18447
  if (!key) continue;
@@ -18451,11 +18452,15 @@ function targetsFor(keys, item) {
18451
18452
  }
18452
18453
  }
18453
18454
  if (item) {
18454
- const section = document.querySelector(`[data-ohw-instance="${CSS.escape(item.sectionId)}"]`) ?? document.querySelector(`[data-ohw-section="${CSS.escape(item.sectionId)}"]`);
18455
+ const section = sectionEl(item.sectionId);
18455
18456
  const stamp = `${item.group}:${item.index}`;
18456
18457
  const el = section?.querySelector(`[data-ohw-item="${CSS.escape(stamp)}"]`);
18457
18458
  if (el) out.add(el);
18458
18459
  }
18460
+ if (out.size === 0 && sectionId) {
18461
+ const section = sectionEl(sectionId);
18462
+ if (section) out.add(section);
18463
+ }
18459
18464
  return [...out];
18460
18465
  }
18461
18466
  var clearTimer = null;
@@ -18468,9 +18473,9 @@ function clearChangeHighlight() {
18468
18473
  el.removeAttribute(MARK_ATTR);
18469
18474
  }
18470
18475
  }
18471
- function highlightChangedElements(keys, item) {
18476
+ function highlightChangedElements(keys, item, sectionId) {
18472
18477
  clearChangeHighlight();
18473
- const targets = targetsFor(keys, item);
18478
+ const targets = targetsFor(keys, item, sectionId);
18474
18479
  if (targets.length === 0) return 0;
18475
18480
  ensureStyleSheet2();
18476
18481
  for (const el of targets) el.setAttribute(MARK_ATTR, "");
@@ -18488,7 +18493,8 @@ function installAiChangeHighlight() {
18488
18493
  const keys = Array.isArray(data.keys) ? data.keys.filter((k) => typeof k === "string") : [];
18489
18494
  const raw = data.item;
18490
18495
  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;
18491
- const found = highlightChangedElements(keys, item);
18496
+ const sectionId = typeof data.sectionId === "string" ? data.sectionId : void 0;
18497
+ const found = highlightChangedElements(keys, item, sectionId);
18492
18498
  window.parent?.postMessage({ type: "ow:ai-highlight-done", found }, "*");
18493
18499
  };
18494
18500
  window.addEventListener("message", onMessage);
@@ -18688,12 +18694,12 @@ function AiSectionOverlay({
18688
18694
  const selectFromElement = useCallback2(
18689
18695
  (el, options) => {
18690
18696
  const inner = el?.closest("[data-ohw-section]") ?? null;
18691
- const sectionEl = inner ? movableUnit(inner) : null;
18692
- const id = sectionEl ? instanceIdOf(sectionEl) || null : null;
18697
+ const sectionEl2 = inner ? movableUnit(inner) : null;
18698
+ const id = sectionEl2 ? instanceIdOf(sectionEl2) || null : null;
18693
18699
  if (id === selectedIdRef.current) return;
18694
18700
  selectedIdRef.current = id;
18695
18701
  setSelectedId(id);
18696
- if (options?.report !== false) report(sectionEl);
18702
+ if (options?.report !== false) report(sectionEl2);
18697
18703
  },
18698
18704
  [report]
18699
18705
  );
@@ -18701,15 +18707,15 @@ function AiSectionOverlay({
18701
18707
  apiRef.current = {
18702
18708
  selectFromElement,
18703
18709
  handleBackgroundClick: (target, clientX, clientY) => {
18704
- let sectionEl = target?.closest("[data-ohw-section]") ?? null;
18705
- if (!sectionEl && clientX !== void 0 && clientY !== void 0) {
18710
+ let sectionEl2 = target?.closest("[data-ohw-section]") ?? null;
18711
+ if (!sectionEl2 && clientX !== void 0 && clientY !== void 0) {
18706
18712
  const beneath = document.elementsFromPoint(clientX, clientY).find(
18707
18713
  (el) => el instanceof HTMLElement && !el.closest("[data-ohw-bridge-root]") && el.closest("[data-ohw-section]") != null
18708
18714
  );
18709
- sectionEl = beneath?.closest("[data-ohw-section]") ?? null;
18715
+ sectionEl2 = beneath?.closest("[data-ohw-section]") ?? null;
18710
18716
  }
18711
- selectFromElement(sectionEl);
18712
- return sectionEl != null;
18717
+ selectFromElement(sectionEl2);
18718
+ return sectionEl2 != null;
18713
18719
  },
18714
18720
  clear: () => {
18715
18721
  selectedIdRef.current = null;
@@ -19083,9 +19089,9 @@ var PRIMARY3 = "#0885FE";
19083
19089
  var OHW_BLUE = `var(--ohw-primary, ${PRIMARY3})`;
19084
19090
  var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
19085
19091
  function findMediaStripItemElement(sectionId, index) {
19086
- const sectionEl = findByInstanceId(sectionId);
19087
- if (!sectionEl) return null;
19088
- const items = sectionEl.querySelectorAll("[data-ohw-media-strip-item]");
19092
+ const sectionEl2 = findByInstanceId(sectionId);
19093
+ if (!sectionEl2) return null;
19094
+ const items = sectionEl2.querySelectorAll("[data-ohw-media-strip-item]");
19089
19095
  for (const el of Array.from(items)) {
19090
19096
  if (Number(el.dataset.ohwMediaStripIndex) === index) return el;
19091
19097
  }
@@ -19492,8 +19498,8 @@ function AiMediaStripOverlay({
19492
19498
  setHover(null);
19493
19499
  return;
19494
19500
  }
19495
- const sectionEl = itemEl.closest("[data-ohw-section]");
19496
- const unit = sectionEl ? movableUnit(sectionEl) : null;
19501
+ const sectionEl2 = itemEl.closest("[data-ohw-section]");
19502
+ const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
19497
19503
  const sectionId = unit ? instanceIdOf(unit) || null : null;
19498
19504
  const index = Number(itemEl.dataset.ohwMediaStripIndex);
19499
19505
  if (!sectionId || Number.isNaN(index)) {
@@ -19704,9 +19710,9 @@ import { Fragment as Fragment8, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-r
19704
19710
  var PRIMARY4 = "var(--ohw-primary, #0885FE)";
19705
19711
  var CHROME_SELECTOR = "[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review], [data-ohw-more-menu]";
19706
19712
  function findPricingCardElement(sectionId, index) {
19707
- const sectionEl = findByInstanceId(sectionId);
19708
- if (!sectionEl) return null;
19709
- const cards = sectionEl.querySelectorAll("[data-ohw-pricing-card]");
19713
+ const sectionEl2 = findByInstanceId(sectionId);
19714
+ if (!sectionEl2) return null;
19715
+ const cards = sectionEl2.querySelectorAll("[data-ohw-pricing-card]");
19710
19716
  for (const el of Array.from(cards)) {
19711
19717
  if (Number(el.dataset.ohwPricingIndex) === index) return el;
19712
19718
  }
@@ -19717,8 +19723,8 @@ function cardRefFromTarget(target) {
19717
19723
  if (target.closest(CHROME_SELECTOR)) return null;
19718
19724
  const cardEl = target.closest("[data-ohw-pricing-card]");
19719
19725
  if (!cardEl) return null;
19720
- const sectionEl = cardEl.closest("[data-ohw-section]");
19721
- const unit = sectionEl ? movableUnit(sectionEl) : null;
19726
+ const sectionEl2 = cardEl.closest("[data-ohw-section]");
19727
+ const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
19722
19728
  const sectionId = unit ? instanceIdOf(unit) || null : null;
19723
19729
  const index = Number(cardEl.dataset.ohwPricingIndex);
19724
19730
  if (!sectionId || Number.isNaN(index)) return null;
@@ -20257,9 +20263,9 @@ var PRIMARY5 = "#0885FE";
20257
20263
  var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY5})`;
20258
20264
  var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20259
20265
  function findVideoBlockElement(sectionId, path) {
20260
- const sectionEl = findByInstanceId(sectionId);
20261
- if (!sectionEl) return null;
20262
- const items = sectionEl.querySelectorAll("[data-ohw-video-block]");
20266
+ const sectionEl2 = findByInstanceId(sectionId);
20267
+ if (!sectionEl2) return null;
20268
+ const items = sectionEl2.querySelectorAll("[data-ohw-video-block]");
20263
20269
  for (const el of Array.from(items)) {
20264
20270
  if (el.dataset.ohwVideoPath === path) return el;
20265
20271
  }
@@ -20509,8 +20515,8 @@ function AiVideoOverlay({
20509
20515
  setHover(null);
20510
20516
  return;
20511
20517
  }
20512
- const sectionEl = blockEl.closest("[data-ohw-section]");
20513
- const unit = sectionEl ? movableUnit(sectionEl) : null;
20518
+ const sectionEl2 = blockEl.closest("[data-ohw-section]");
20519
+ const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
20514
20520
  const sectionId = unit ? instanceIdOf(unit) || null : null;
20515
20521
  const path = blockEl.dataset.ohwVideoPath;
20516
20522
  if (!sectionId || !path) {
@@ -20717,9 +20723,9 @@ var PRIMARY6 = "#0885FE";
20717
20723
  var OHW_BLUE3 = `var(--ohw-primary, ${PRIMARY6})`;
20718
20724
  var OHW_BLUE_DARK3 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
20719
20725
  function findCarouselItemElement(sectionId, index) {
20720
- const sectionEl = findByInstanceId(sectionId);
20721
- if (!sectionEl) return null;
20722
- const items = sectionEl.querySelectorAll("[data-ohw-fade-carousel-item]");
20726
+ const sectionEl2 = findByInstanceId(sectionId);
20727
+ if (!sectionEl2) return null;
20728
+ const items = sectionEl2.querySelectorAll("[data-ohw-fade-carousel-item]");
20723
20729
  for (const el of Array.from(items)) {
20724
20730
  if (Number(el.dataset.ohwFadeCarouselIndex) === index) return el;
20725
20731
  }
@@ -20979,8 +20985,8 @@ function AiFadeCarouselOverlay({
20979
20985
  setHover(null);
20980
20986
  return;
20981
20987
  }
20982
- const sectionEl = itemEl.closest("[data-ohw-section]");
20983
- const unit = sectionEl ? movableUnit(sectionEl) : null;
20988
+ const sectionEl2 = itemEl.closest("[data-ohw-section]");
20989
+ const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
20984
20990
  const sectionId = unit ? instanceIdOf(unit) || null : null;
20985
20991
  const index = Number(itemEl.dataset.ohwFadeCarouselIndex);
20986
20992
  if (!sectionId || Number.isNaN(index)) {
@@ -23917,9 +23923,9 @@ function useSectionDrag({
23917
23923
  if (target.closest(SECTION_DRAG_EXCLUDED_SELECTOR)) return;
23918
23924
  const inner = target.closest("[data-ohw-section]");
23919
23925
  if (!inner || isChromeSection(inner) || inner.dataset.ohwSection === "footer") return;
23920
- const sectionEl = movableUnit(inner);
23921
- if (!topLevelSections().includes(sectionEl)) return;
23922
- startSectionPressDrag(sectionEl, e.clientX, e.clientY, e.pointerId);
23926
+ const sectionEl2 = movableUnit(inner);
23927
+ if (!topLevelSections().includes(sectionEl2)) return;
23928
+ startSectionPressDrag(sectionEl2, e.clientX, e.clientY, e.pointerId);
23923
23929
  };
23924
23930
  const onPointerMove = (e) => {
23925
23931
  const pending = sectionPointerDragRef.current;
@@ -26189,9 +26195,9 @@ function OhhwellsBridge() {
26189
26195
  const selectedIconElRef = useRef14(null);
26190
26196
  const selectedSocialElRef = useRef14(null);
26191
26197
  const queueSectionKeyDrop = useCallback12((prev) => {
26192
- const sectionEl = prev?.closest("[data-ohw-section]") ?? null;
26193
- if (!sectionEl) return;
26194
- const sectionInstanceId = instanceIdOf(movableUnit(sectionEl)) || null;
26198
+ const sectionEl2 = prev?.closest("[data-ohw-section]") ?? null;
26199
+ if (!sectionEl2) return;
26200
+ const sectionInstanceId = instanceIdOf(movableUnit(sectionEl2)) || null;
26195
26201
  if (!sectionInstanceId) return;
26196
26202
  const token = ++mediaKeyDropTokenRef.current;
26197
26203
  const onQueueDrained = (e) => {
@@ -26201,8 +26207,8 @@ function OhhwellsBridge() {
26201
26207
  if (selectedMediaElRef.current || selectedIconElRef.current || selectedSocialElRef.current) return;
26202
26208
  postToParentRef.current({
26203
26209
  type: "ow:section-selected",
26204
- sectionId: sectionEl.dataset.ohwSection ?? null,
26205
- sectionLabel: sectionEl.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl.dataset.ohwSection ?? ""),
26210
+ sectionId: sectionEl2.dataset.ohwSection ?? null,
26211
+ sectionLabel: sectionEl2.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl2.dataset.ohwSection ?? ""),
26206
26212
  key: null
26207
26213
  });
26208
26214
  };
@@ -26236,12 +26242,12 @@ function OhhwellsBridge() {
26236
26242
  const selectIconElement = useCallback12((el) => {
26237
26243
  if (selectedMediaElRef.current) clearMediaSelectionRef.current();
26238
26244
  selectedIconElRef.current = el;
26239
- const sectionEl = el.closest("[data-ohw-section]");
26245
+ const sectionEl2 = el.closest("[data-ohw-section]");
26240
26246
  aiSectionApiRef.current?.selectFromElement(el, { report: false });
26241
26247
  postToParentRef.current({
26242
26248
  type: "ow:section-selected",
26243
- sectionId: sectionEl?.dataset.ohwSection ?? null,
26244
- sectionLabel: sectionEl ? sectionEl.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl.dataset.ohwSection ?? "") : null,
26249
+ sectionId: sectionEl2?.dataset.ohwSection ?? null,
26250
+ sectionLabel: sectionEl2 ? sectionEl2.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl2.dataset.ohwSection ?? "") : null,
26245
26251
  key: el.dataset.ohwKey ?? null,
26246
26252
  keyLabel: "Icon"
26247
26253
  });
@@ -26261,12 +26267,12 @@ function OhhwellsBridge() {
26261
26267
  isDragOver: false,
26262
26268
  ...video ? { videoAutoplay: video.autoplay, videoMuted: video.muted } : {}
26263
26269
  });
26264
- const sectionEl = el.closest("[data-ohw-section]");
26270
+ const sectionEl2 = el.closest("[data-ohw-section]");
26265
26271
  aiSectionApiRef.current?.selectFromElement(el, { report: false });
26266
26272
  postToParentRef.current({
26267
26273
  type: "ow:section-selected",
26268
- sectionId: sectionEl?.dataset.ohwSection ?? null,
26269
- sectionLabel: sectionEl ? sectionEl.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl.dataset.ohwSection ?? "") : null,
26274
+ sectionId: sectionEl2?.dataset.ohwSection ?? null,
26275
+ sectionLabel: sectionEl2 ? sectionEl2.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl2.dataset.ohwSection ?? "") : null,
26270
26276
  key: el.dataset.ohwKey ?? null,
26271
26277
  // Display name for the pill — the raw key prettifies into fragments ("Img"); the
26272
26278
  // bridge knows what the node IS, so it names it.
@@ -27852,12 +27858,12 @@ function OhhwellsBridge() {
27852
27858
  const socialItem = getSocialItem(anchor);
27853
27859
  if (socialItem) {
27854
27860
  selectedSocialElRef.current = socialItem;
27855
- const sectionEl = socialItem.closest("[data-ohw-section]");
27861
+ const sectionEl2 = socialItem.closest("[data-ohw-section]");
27856
27862
  aiSectionApiRef.current?.selectFromElement(anchor, { report: false });
27857
27863
  postToParentRef.current({
27858
27864
  type: "ow:section-selected",
27859
- sectionId: sectionEl?.dataset.ohwSection ?? null,
27860
- sectionLabel: sectionEl ? sectionEl.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl.dataset.ohwSection ?? "") : null,
27865
+ sectionId: sectionEl2?.dataset.ohwSection ?? null,
27866
+ sectionLabel: sectionEl2 ? sectionEl2.dataset.ohwSectionLabel ?? titleCaseSectionId(sectionEl2.dataset.ohwSection ?? "") : null,
27861
27867
  key: socialIconKey(socialItem) ?? socialItem.getAttribute("data-ohw-href-key"),
27862
27868
  keyLabel: socialPlatformLabel(socialItem, editContentRef.current)
27863
27869
  });
@@ -28287,13 +28293,13 @@ function OhhwellsBridge() {
28287
28293
  setReorderDragDisabled(reorderDisabled);
28288
28294
  }
28289
28295
  setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
28290
- const sectionEl = el.closest("[data-ohw-section]");
28296
+ const sectionEl2 = el.closest("[data-ohw-section]");
28291
28297
  postToParent2({
28292
28298
  type: "ow:enter-edit",
28293
28299
  key: el.dataset.ohwKey,
28294
28300
  // Section the edited element belongs to, so the editor can scope AI prompts to it.
28295
- sectionId: sectionEl?.dataset.ohwSection ?? null,
28296
- sectionLabel: sectionEl?.dataset.ohwSectionLabel ?? null
28301
+ sectionId: sectionEl2?.dataset.ohwSection ?? null,
28302
+ sectionLabel: sectionEl2?.dataset.ohwSectionLabel ?? null
28297
28303
  });
28298
28304
  aiSectionApiRef.current?.selectFromElement(el, { report: false });
28299
28305
  requestAnimationFrame(() => refreshActiveCommandsRef.current());
@@ -31939,12 +31945,12 @@ function OhhwellsBridge() {
31939
31945
  `[data-ohw-instance="${escapedSectionId}"]`
31940
31946
  );
31941
31947
  const foundEl = instanceEl ? sectionElementOf(instanceEl) : document.querySelector(`[data-ohw-section="${escapedSectionId}"]`);
31942
- 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;
31943
- const nodes = sectionEl ? collectEditableNodes(void 0, sectionEl).filter(
31948
+ 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;
31949
+ const nodes = sectionEl2 ? collectEditableNodes(void 0, sectionEl2).filter(
31944
31950
  (n) => n.key && !n.key.startsWith("__ohw_") && !["meta", "sections", "video-setting"].includes(n.type)
31945
- ).map((n) => ({ ...n, text: n.text ?? "", type: normalizeAiNodeType(n.type) })).map((n) => withNodeFontSize(n, sectionEl)) : [];
31946
- const items = sectionEl ? collectItemGroups(sectionEl) : [];
31947
- const box = sectionEl?.getBoundingClientRect();
31951
+ ).map((n) => ({ ...n, text: n.text ?? "", type: normalizeAiNodeType(n.type) })).map((n) => withNodeFontSize(n, sectionEl2)) : [];
31952
+ const items = sectionEl2 ? collectItemGroups(sectionEl2) : [];
31953
+ const box = sectionEl2?.getBoundingClientRect();
31948
31954
  const rect = box ? {
31949
31955
  top: box.top + window.scrollY,
31950
31956
  left: box.left + window.scrollX,
@@ -31960,7 +31966,7 @@ function OhhwellsBridge() {
31960
31966
  postToParentRef.current({
31961
31967
  type: "ow:section-nodes",
31962
31968
  sectionId,
31963
- found: !!sectionEl,
31969
+ found: !!sectionEl2,
31964
31970
  nodes,
31965
31971
  rect,
31966
31972
  ...settings ? { settings } : {},
@@ -31968,7 +31974,7 @@ function OhhwellsBridge() {
31968
31974
  // The section's repeated-item groups (cards, rows, FAQ entries) — what lets a prompt add
31969
31975
  // or remove items on a template section without regenerating it. Empty for generated
31970
31976
  // sections, whose items live in the tree.
31971
- ...sectionEl && items.length ? { items } : {}
31977
+ ...sectionEl2 && items.length ? { items } : {}
31972
31978
  });
31973
31979
  };
31974
31980
  const handleCollectItems = (e) => {
@@ -32687,7 +32693,7 @@ function OhhwellsBridge() {
32687
32693
  postToParent2({
32688
32694
  type: "ow:ready",
32689
32695
  version: "1",
32690
- bridgeVersion: "0.1.167",
32696
+ bridgeVersion: "0.1.168",
32691
32697
  path: pathname,
32692
32698
  nodes: collectEditableNodes(editContentRef.current),
32693
32699
  sections