@ohhwells/bridge 0.1.164 → 0.1.166

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
@@ -86,6 +86,7 @@ __export(index_exports, {
86
86
  hasMountedContentNodes: () => hasMountedContentNodes,
87
87
  indexCollectionItems: () => indexCollectionItems,
88
88
  insertFooterHours: () => insertFooterHours,
89
+ isDeadPageHref: () => isDeadPageHref,
89
90
  isEditSessionActive: () => isEditSessionActive,
90
91
  isPlainLeftClick: () => isPlainLeftClick,
91
92
  isRenderableFooterTree: () => isRenderableFooterTree,
@@ -97,6 +98,7 @@ __export(index_exports, {
97
98
  parseAiFooterState: () => parseAiFooterState,
98
99
  parseAiSectionsState: () => parseAiSectionsState,
99
100
  parseTarget: () => parseTarget,
101
+ planBuildPageSync: () => planBuildPageSync,
100
102
  recordOverriddenPaths: () => recordOverriddenPaths,
101
103
  releaseTemplateLogoIfReplaced: () => releaseTemplateLogoIfReplaced,
102
104
  removeFooterBlock: () => removeFooterBlock,
@@ -115,7 +117,7 @@ __export(index_exports, {
115
117
  module.exports = __toCommonJS(index_exports);
116
118
 
117
119
  // src/OhhwellsBridge.tsx
118
- var import_react23 = __toESM(require("react"), 1);
120
+ var import_react24 = __toESM(require("react"), 1);
119
121
  var import_client3 = require("react-dom/client");
120
122
  var import_react_dom5 = require("react-dom");
121
123
 
@@ -954,6 +956,10 @@ function useOhwCarousel(key, initial) {
954
956
  if (Array.isArray(detail?.images)) setImages(detail.images);
955
957
  };
956
958
  el.addEventListener(CAROUSEL_EVENT, onChange);
959
+ const pending = parseSlides(el.getAttribute(CAROUSEL_VALUE_ATTR));
960
+ if (pending.length > 0) {
961
+ setImages((prev) => JSON.stringify(prev) === JSON.stringify(pending) ? prev : pending);
962
+ }
957
963
  return () => el.removeEventListener(CAROUSEL_EVENT, onChange);
958
964
  }, [key]);
959
965
  const bind = {
@@ -2638,6 +2644,14 @@ function socialHrefKey(item) {
2638
2644
  function socialIconKey(item) {
2639
2645
  return item.querySelector(ICON_SELECTOR)?.dataset.ohwKey ?? null;
2640
2646
  }
2647
+ function pendingIconKey(item) {
2648
+ const existing = socialIconKey(item);
2649
+ if (existing) return existing;
2650
+ const base = socialHrefKey(item)?.replace(/-href$/, "");
2651
+ if (!base) return null;
2652
+ const taken = item.ownerDocument.querySelector(`[data-ohw-key="${base}"]`);
2653
+ return taken && taken !== item ? `${base}-icon` : base;
2654
+ }
2641
2655
  var SOCIAL_PLATFORM_LABELS = {
2642
2656
  instagram: "Instagram",
2643
2657
  facebook: "Facebook",
@@ -2835,9 +2849,9 @@ function reconcileSocialsFromContent(content, root = document) {
2835
2849
  listSocialsRows(root).forEach((row) => {
2836
2850
  const rowDisplay = socialsDisplayFor(row, content);
2837
2851
  listSocialItems(row).forEach((item) => {
2838
- const key = socialIconKey(item) ?? socialHrefKey(item)?.replace(/-href$/, "");
2852
+ const key = pendingIconKey(item);
2839
2853
  const stored2 = key ? content[key] : void 0;
2840
- if (!stored2?.trim()) return;
2854
+ if (!stored2?.trim().startsWith("<")) return;
2841
2855
  const existing = item.querySelector(ICON_SELECTOR);
2842
2856
  if (existing && existing.innerHTML.trim() && !existing.hasAttribute(SOCIALS_ICON_PLACEHOLDER_ATTR)) return;
2843
2857
  ensureIconSlot(item);
@@ -3097,8 +3111,7 @@ function ensureIconSlot(item) {
3097
3111
  const adopted = adoptAsIconSlot(drawn, base);
3098
3112
  if (adopted) return adopted;
3099
3113
  }
3100
- const taken = document.querySelector(`[data-ohw-key="${base}"]`);
3101
- const iconKey = taken && taken !== item ? `${base}-icon` : base;
3114
+ const iconKey = pendingIconKey(item) ?? base;
3102
3115
  const slot = document.createElement("span");
3103
3116
  slot.setAttribute("data-ohw-key", iconKey);
3104
3117
  slot.setAttribute("data-ohw-editable", "icon");
@@ -3610,11 +3623,11 @@ function insertFooterColumnDom(colIndex, heading, items) {
3610
3623
  container.appendChild(column);
3611
3624
  return { column, firstLink };
3612
3625
  }
3613
- function insertFooterColumn(heading = DEFAULT_FOOTER_COLUMN_HEADING, linkLabel = DEFAULT_FOOTER_COLUMN_LINK_LABEL, linkHref = DEFAULT_FOOTER_COLUMN_LINK_HREF) {
3626
+ function insertFooterColumn(heading = DEFAULT_FOOTER_COLUMN_HEADING, linkLabel = DEFAULT_FOOTER_COLUMN_LINK_LABEL, linkHref2 = DEFAULT_FOOTER_COLUMN_LINK_HREF) {
3614
3627
  if (!canAddFooterColumn()) {
3615
3628
  throw new Error(`Footer column limit reached (${MAX_FOOTER_COLUMNS})`);
3616
3629
  }
3617
- const resolvedHref = linkHref || (document.querySelector("[data-ai-footer], [data-ohw-ai-footer]") ? "/" : DEFAULT_FOOTER_COLUMN_LINK_HREF);
3630
+ const resolvedHref = linkHref2 || (document.querySelector("[data-ai-footer], [data-ohw-ai-footer]") ? "/" : DEFAULT_FOOTER_COLUMN_LINK_HREF);
3618
3631
  const colIndex = getNextFooterColumnIndex();
3619
3632
  const inserted = insertFooterColumnDom(colIndex, heading, [{ href: resolvedHref, label: linkLabel }]);
3620
3633
  if (!inserted?.firstLink) throw new Error("Failed to insert footer column");
@@ -3993,8 +4006,8 @@ function duplicateFooterItem(sourceAnchor) {
3993
4006
  const column = findFooterColumnForLink(sourceAnchor);
3994
4007
  if (!column) return null;
3995
4008
  const href = getLinkHref(sourceAnchor);
3996
- const labelEl = sourceAnchor.querySelector('[data-ohw-editable="text"]');
3997
- const label = (labelEl?.textContent ?? "").trim() || "Untitled";
4009
+ const labelEl2 = sourceAnchor.querySelector('[data-ohw-editable="text"]');
4010
+ const label = (labelEl2?.textContent ?? "").trim() || "Untitled";
3998
4011
  return insertFooterItem(column, href || "/", label, sourceAnchor);
3999
4012
  }
4000
4013
  function footerLabelKeyFromHrefKey(hrefKey) {
@@ -4004,8 +4017,8 @@ function deleteFooterItem(sourceAnchor) {
4004
4017
  if (!isFooterLinkAnchor(sourceAnchor)) return null;
4005
4018
  const hrefKey = sourceAnchor.getAttribute("data-ohw-href-key");
4006
4019
  if (!hrefKey || !isFooterHrefKey(hrefKey)) return null;
4007
- const labelEl = sourceAnchor.querySelector('[data-ohw-editable="text"]');
4008
- const label = (labelEl?.textContent ?? "").trim() || "Untitled";
4020
+ const labelEl2 = sourceAnchor.querySelector('[data-ohw-editable="text"]');
4021
+ const label = (labelEl2?.textContent ?? "").trim() || "Untitled";
4009
4022
  const labelKey = footerLabelKeyFromHrefKey(hrefKey);
4010
4023
  const previousOrder = getFooterOrderFromDom();
4011
4024
  const previousOrderJson = JSON.stringify(previousOrder);
@@ -4973,8 +4986,8 @@ function remapNavKeysInSubtree(root, keyMap) {
4973
4986
  const mapped = keyMap.get(oldHrefKey);
4974
4987
  if (!mapped) return;
4975
4988
  el.setAttribute("data-ohw-href-key", mapped.hrefKey);
4976
- const labelEl = el.querySelector(':scope > [data-ohw-editable="text"][data-ohw-key]') ?? el.querySelector('[data-ohw-editable="text"][data-ohw-key]');
4977
- if (labelEl) labelEl.setAttribute("data-ohw-key", mapped.labelKey);
4989
+ const labelEl2 = el.querySelector(':scope > [data-ohw-editable="text"][data-ohw-key]') ?? el.querySelector('[data-ohw-editable="text"][data-ohw-key]');
4990
+ if (labelEl2) labelEl2.setAttribute("data-ohw-key", mapped.labelKey);
4978
4991
  };
4979
4992
  if (root.matches("[data-ohw-href-key]")) remapAnchor(root);
4980
4993
  root.querySelectorAll("[data-ohw-href-key]").forEach(remapAnchor);
@@ -4982,10 +4995,10 @@ function remapNavKeysInSubtree(root, keyMap) {
4982
4995
  function readNavLinkSnapshot(hrefKey) {
4983
4996
  const el = findCounterpartByHrefKey(hrefKey, document) ?? document.querySelector(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`);
4984
4997
  if (!el) return { href: "/", label: "Untitled" };
4985
- const labelEl = el.querySelector('[data-ohw-editable="text"]');
4998
+ const labelEl2 = el.querySelector('[data-ohw-editable="text"]');
4986
4999
  return {
4987
5000
  href: getLinkHref2(el),
4988
- label: (labelEl?.textContent ?? "").trim() || "Untitled"
5001
+ label: (labelEl2?.textContent ?? "").trim() || "Untitled"
4989
5002
  };
4990
5003
  }
4991
5004
  function findClonedNavAnchor(unit, hrefKey) {
@@ -5159,8 +5172,8 @@ function deleteNavbarItem(sourceAnchor) {
5159
5172
  if (!isNavbarLinkItem(sourceAnchor)) return null;
5160
5173
  const sourceHrefKey = sourceAnchor.getAttribute("data-ohw-href-key");
5161
5174
  if (!sourceHrefKey || !isNavbarHrefKey(sourceHrefKey)) return null;
5162
- const labelEl = sourceAnchor.querySelector('[data-ohw-editable="text"]');
5163
- const label = (labelEl?.textContent ?? "").trim() || "Untitled";
5175
+ const labelEl2 = sourceAnchor.querySelector('[data-ohw-editable="text"]');
5176
+ const label = (labelEl2?.textContent ?? "").trim() || "Untitled";
5164
5177
  const previousForest = getNavForestFromDom();
5165
5178
  const previousOrderJson = serializeNavOrder(previousForest);
5166
5179
  const parentHrefKey = previousForest.find((n) => n.children.some((c) => c.id === sourceHrefKey))?.id ?? null;
@@ -6535,6 +6548,24 @@ function deleteSectionFromState(state, sectionId) {
6535
6548
  if (removed.includes(sectionId)) return state;
6536
6549
  return { ...state, v: 1, sections: state.sections, removed: [...removed, sectionId] };
6537
6550
  }
6551
+ function moveSectionInState(state, sectionId, targetPath) {
6552
+ const entry = state.sections.find((section) => section.id === sectionId);
6553
+ if (!entry) return null;
6554
+ const moved = {
6555
+ id: entry.id,
6556
+ label: entry.label,
6557
+ path: targetPath,
6558
+ afterSection: null,
6559
+ tree: entry.tree,
6560
+ media: entry.media,
6561
+ ...entry.brand ? { brand: entry.brand } : {}
6562
+ };
6563
+ return {
6564
+ ...state,
6565
+ v: 1,
6566
+ sections: state.sections.map((section) => section.id === sectionId ? moved : section)
6567
+ };
6568
+ }
6538
6569
  function reapRemovedAiSections(state, store, removedIds, excludeIds = /* @__PURE__ */ new Set()) {
6539
6570
  const generated = new Set(state.sections.map((entry) => entry.id));
6540
6571
  const reapedIds = [...new Set(removedIds)].filter((id) => generated.has(id) && !excludeIds.has(id));
@@ -11767,8 +11798,8 @@ function syncFooterTreeLinksFromDom(tree) {
11767
11798
  const heading = getFooterColumnHeadingEl(col);
11768
11799
  const title = heading ? textOf2(heading) : void 0;
11769
11800
  const items = listFooterLinksInColumn(col).map((anchor) => {
11770
- const labelEl = anchor.querySelector('[data-ohw-editable="text"]');
11771
- const label = textOf2(labelEl) || textOf2(anchor);
11801
+ const labelEl2 = anchor.querySelector('[data-ohw-editable="text"]');
11802
+ const label = textOf2(labelEl2) || textOf2(anchor);
11772
11803
  const href = hrefToFooterTreeRef(anchor.getAttribute("href"));
11773
11804
  return label ? { label, href: href || "home" } : null;
11774
11805
  }).filter((x) => Boolean(x));
@@ -17467,7 +17498,7 @@ function apiBase() {
17467
17498
  function bridgeVersion() {
17468
17499
  try {
17469
17500
  if (true) {
17470
- return "0.1.164";
17501
+ return "0.1.166";
17471
17502
  }
17472
17503
  } catch {
17473
17504
  }
@@ -17481,7 +17512,7 @@ function stampBridgeVersionOnDocument() {
17481
17512
  return;
17482
17513
  }
17483
17514
  try {
17484
- const v = true ? "0.1.164" : "";
17515
+ const v = true ? "0.1.166" : "";
17485
17516
  if (v) {
17486
17517
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
17487
17518
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -24201,6 +24232,138 @@ function deleteSelectedNavFooterItem(deps) {
24201
24232
  return false;
24202
24233
  }
24203
24234
 
24235
+ // src/lib/build-page-sync.ts
24236
+ var import_react23 = require("react");
24237
+ var CHROME_KEY_RE = /^(nav|footer|header|navbar)[-_]/u;
24238
+ function normalisePath(path) {
24239
+ const trimmed = path.trim().replace(/[?#].*$/u, "");
24240
+ if (!trimmed || trimmed === "/") return "/";
24241
+ return `/${trimmed.replace(/^\/+|\/+$/gu, "")}`;
24242
+ }
24243
+ function isDeadPageHref(href, livePaths) {
24244
+ const value = href.trim();
24245
+ if (!value.startsWith("/") || value.startsWith("//")) return false;
24246
+ const path = normalisePath(value);
24247
+ if (path === "/") return false;
24248
+ return !livePaths.some((live) => {
24249
+ const p = normalisePath(live);
24250
+ return p === path || p !== "/" && path.startsWith(`${p}/`);
24251
+ });
24252
+ }
24253
+ var sameWords = (a, b) => a.trim().toLowerCase() === b.trim().toLowerCase();
24254
+ function planBuildPageSync(links, msg) {
24255
+ const live = Array.isArray(msg.livePaths) ? msg.livePaths : [];
24256
+ const removed = new Set((msg.removed ?? []).map(normalisePath));
24257
+ const remove = [];
24258
+ const relabel = [];
24259
+ const retarget = [];
24260
+ const fallback = live.some((p) => normalisePath(p) === "/contact") ? "/contact" : "/";
24261
+ for (const link of links) {
24262
+ const href = link.href.trim();
24263
+ const isPage = href.startsWith("/") && !href.startsWith("//");
24264
+ if (isPage && (removed.has(normalisePath(href)) || live.length > 0 && isDeadPageHref(href, live))) {
24265
+ if (link.area === "chrome") retarget.push({ hrefKey: link.hrefKey, href: fallback });
24266
+ else remove.push(link.hrefKey);
24267
+ continue;
24268
+ }
24269
+ if (isPage) {
24270
+ const path = normalisePath(href);
24271
+ const rename = (msg.relabel ?? []).find((r2) => normalisePath(r2.path) === path);
24272
+ if (rename && sameWords(link.label, rename.oldTitle) && !sameWords(link.label, rename.label)) {
24273
+ relabel.push({ hrefKey: link.hrefKey, label: rename.label });
24274
+ }
24275
+ continue;
24276
+ }
24277
+ if (href.startsWith("#") || href.startsWith("/#")) {
24278
+ const anchor = href.replace(/^\/?#/u, "").toLowerCase();
24279
+ const target = (msg.anchorLabels ?? []).find((a) => a.anchors.some((id) => id.toLowerCase() === anchor));
24280
+ if (target && sameWords(link.label.replace(/\s+/gu, "-"), anchor) && !sameWords(link.label, target.label)) {
24281
+ relabel.push({ hrefKey: link.hrefKey, label: target.label });
24282
+ }
24283
+ }
24284
+ }
24285
+ return { remove, relabel, retarget };
24286
+ }
24287
+ function linkHref(el) {
24288
+ const key = el.getAttribute("data-ohw-href-key");
24289
+ const stored = key ? getStoredLinkHref(key) : void 0;
24290
+ return stored ?? el.getAttribute("href") ?? "";
24291
+ }
24292
+ function labelEl(anchor) {
24293
+ return anchor.querySelector('[data-ohw-editable="text"]');
24294
+ }
24295
+ function collectLinks() {
24296
+ const seen = /* @__PURE__ */ new Set();
24297
+ const links = [];
24298
+ document.querySelectorAll("[data-ohw-href-key]").forEach((el) => {
24299
+ const hrefKey = el.getAttribute("data-ohw-href-key") ?? "";
24300
+ if (seen.has(hrefKey)) return;
24301
+ const area = isNavbarHrefKey(hrefKey) ? "nav" : isFooterHrefKey(hrefKey) ? "footer" : CHROME_KEY_RE.test(hrefKey) ? "chrome" : null;
24302
+ if (!area) return;
24303
+ const label = labelEl(el);
24304
+ if (!label && area !== "chrome") return;
24305
+ seen.add(hrefKey);
24306
+ links.push({ hrefKey, href: linkHref(el), label: label?.textContent ?? el.textContent ?? "", area });
24307
+ });
24308
+ return links;
24309
+ }
24310
+ function applyBuildPageSync(msg, deps) {
24311
+ const plan = planBuildPageSync(collectLinks(), msg);
24312
+ const nodes = /* @__PURE__ */ new Map();
24313
+ for (const hrefKey of plan.remove) {
24314
+ const anchor = document.querySelector(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`);
24315
+ if (!anchor) continue;
24316
+ const nav = isNavbarHrefKey(hrefKey);
24317
+ const result = nav ? deleteNavbarItem(anchor) : deleteFooterItem(anchor);
24318
+ if (!result) continue;
24319
+ for (const key of result.removedKeys) {
24320
+ nodes.set(key, "");
24321
+ clearStoredLinkHref(key);
24322
+ }
24323
+ nodes.set(nav ? NAV_ORDER_KEY : FOOTER_ORDER_KEY, result.orderJson);
24324
+ }
24325
+ for (const { hrefKey, label } of plan.relabel) {
24326
+ const labelKey = hrefKey.replace(/-href$/u, "-label");
24327
+ document.querySelectorAll(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`).forEach((anchor) => {
24328
+ const el = labelEl(anchor);
24329
+ if (el) el.textContent = label;
24330
+ });
24331
+ nodes.set(labelKey, label);
24332
+ }
24333
+ for (const { hrefKey, href } of plan.retarget) {
24334
+ setStoredLinkHref(hrefKey, href);
24335
+ document.querySelectorAll(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`).forEach((anchor) => {
24336
+ if (anchor instanceof HTMLAnchorElement) anchor.setAttribute("href", href);
24337
+ });
24338
+ nodes.set(hrefKey, href);
24339
+ }
24340
+ if (nodes.size === 0) return 0;
24341
+ deps.setEditContent({ ...deps.getEditContent(), ...Object.fromEntries(nodes) });
24342
+ deps.postToParent({
24343
+ type: "ow:change",
24344
+ nodes: [...nodes].map(([key, text]) => ({ key, text }))
24345
+ });
24346
+ return plan.remove.length + plan.relabel.length + plan.retarget.length;
24347
+ }
24348
+ function useBuildPageSync(isEditMode, editContentRef, postToParent2) {
24349
+ (0, import_react23.useEffect)(() => {
24350
+ if (!isEditMode) return;
24351
+ const onMessage = (e) => {
24352
+ if (e.source !== window.parent || e.data?.type !== "ow:pages-sync") return;
24353
+ const changed = applyBuildPageSync(e.data, {
24354
+ getEditContent: () => editContentRef.current,
24355
+ setEditContent: (next) => {
24356
+ editContentRef.current = next;
24357
+ },
24358
+ postToParent: postToParent2
24359
+ });
24360
+ postToParent2({ type: "ow:pages-synced", changed });
24361
+ };
24362
+ window.addEventListener("message", onMessage);
24363
+ return () => window.removeEventListener("message", onMessage);
24364
+ }, [isEditMode, editContentRef, postToParent2]);
24365
+ }
24366
+
24204
24367
  // src/lib/nav-page-sync.ts
24205
24368
  function labelKeyFor(hrefKey) {
24206
24369
  return hrefKey.replace(/-href$/, "-label");
@@ -25656,9 +25819,9 @@ function FloatingToolbar({
25656
25819
  showEditLink,
25657
25820
  onEditLink
25658
25821
  }) {
25659
- const localRef = import_react23.default.useRef(null);
25660
- const [measuredW, setMeasuredW] = import_react23.default.useState(330);
25661
- const setRefs = import_react23.default.useCallback(
25822
+ const localRef = import_react24.default.useRef(null);
25823
+ const [measuredW, setMeasuredW] = import_react24.default.useState(330);
25824
+ const setRefs = import_react24.default.useCallback(
25662
25825
  (node) => {
25663
25826
  localRef.current = node;
25664
25827
  if (typeof elRef === "function") elRef(node);
@@ -25670,7 +25833,7 @@ function FloatingToolbar({
25670
25833
  },
25671
25834
  [elRef]
25672
25835
  );
25673
- import_react23.default.useLayoutEffect(() => {
25836
+ import_react24.default.useLayoutEffect(() => {
25674
25837
  const node = localRef.current;
25675
25838
  if (!node) return;
25676
25839
  const update = () => {
@@ -25696,7 +25859,7 @@ function FloatingToolbar({
25696
25859
  pointerEvents: "auto"
25697
25860
  },
25698
25861
  children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(CustomToolbar, { children: [
25699
- TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react23.default.Fragment, { children: [
25862
+ TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react24.default.Fragment, { children: [
25700
25863
  gi > 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CustomToolbarDivider, {}),
25701
25864
  btns.map((btn) => {
25702
25865
  const isActive = activeCommands.has(btn.cmd);
@@ -25905,8 +26068,8 @@ function OhhwellsBridge() {
25905
26068
  const router = (0, import_navigation4.useRouter)();
25906
26069
  const searchParams = (0, import_navigation4.useSearchParams)();
25907
26070
  const isEditMode = isEditSessionActive();
25908
- const [bridgeRoot, setBridgeRoot] = (0, import_react23.useState)(null);
25909
- (0, import_react23.useEffect)(() => {
26071
+ const [bridgeRoot, setBridgeRoot] = (0, import_react24.useState)(null);
26072
+ (0, import_react24.useEffect)(() => {
25910
26073
  const figtreeFontId = "ohw-figtree-font";
25911
26074
  if (!document.getElementById(figtreeFontId)) {
25912
26075
  const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
@@ -25932,8 +26095,8 @@ function OhhwellsBridge() {
25932
26095
  };
25933
26096
  }, []);
25934
26097
  const subdomainFromQuery = searchParams.get("subdomain");
25935
- const [subdomain, setSubdomain] = (0, import_react23.useState)(() => resolveSubdomain(subdomainFromQuery));
25936
- (0, import_react23.useLayoutEffect)(() => {
26098
+ const [subdomain, setSubdomain] = (0, import_react24.useState)(() => resolveSubdomain(subdomainFromQuery));
26099
+ (0, import_react24.useLayoutEffect)(() => {
25937
26100
  const next = resolveSubdomain(subdomainFromQuery);
25938
26101
  if (next !== subdomain) setSubdomain(next);
25939
26102
  if (next) return;
@@ -25945,7 +26108,7 @@ function OhhwellsBridge() {
25945
26108
  }, 0);
25946
26109
  return () => window.clearTimeout(t);
25947
26110
  }, [subdomainFromQuery, subdomain]);
25948
- (0, import_react23.useEffect)(() => {
26111
+ (0, import_react24.useEffect)(() => {
25949
26112
  if (!subdomainFromQuery || typeof window === "undefined") return;
25950
26113
  const url = new URL(window.location.href);
25951
26114
  if (!url.searchParams.has("subdomain")) return;
@@ -25957,22 +26120,22 @@ function OhhwellsBridge() {
25957
26120
  useSavedLinkNavigation(isEditMode);
25958
26121
  useNavDropdownToggle(isEditMode);
25959
26122
  useHashLinkScroll(isEditMode);
25960
- const postToParent2 = (0, import_react23.useCallback)((data) => {
26123
+ const postToParent2 = (0, import_react24.useCallback)((data) => {
25961
26124
  if (typeof window !== "undefined" && window.parent !== window) {
25962
26125
  window.parent.postMessage(data, "*");
25963
26126
  }
25964
26127
  }, []);
25965
- const [fetchState, setFetchState] = (0, import_react23.useState)("idle");
25966
- const [showBranding, setShowBranding] = (0, import_react23.useState)(false);
25967
- const autoSaveTimers = (0, import_react23.useRef)(/* @__PURE__ */ new Map());
25968
- (0, import_react23.useEffect)(() => {
26128
+ const [fetchState, setFetchState] = (0, import_react24.useState)("idle");
26129
+ const [showBranding, setShowBranding] = (0, import_react24.useState)(false);
26130
+ const autoSaveTimers = (0, import_react24.useRef)(/* @__PURE__ */ new Map());
26131
+ (0, import_react24.useEffect)(() => {
25969
26132
  stampBridgeVersionOnDocument();
25970
26133
  }, []);
25971
- (0, import_react23.useEffect)(() => {
26134
+ (0, import_react24.useEffect)(() => {
25972
26135
  if (isEditMode) return;
25973
26136
  return armLoaderHangBeacon(subdomain, fetchState);
25974
26137
  }, [isEditMode, subdomain, fetchState]);
25975
- (0, import_react23.useEffect)(() => {
26138
+ (0, import_react24.useEffect)(() => {
25976
26139
  if (isEditMode || !subdomain) return;
25977
26140
  const onError = (event) => {
25978
26141
  reportOutageBeacon({
@@ -25993,40 +26156,40 @@ function OhhwellsBridge() {
25993
26156
  window.removeEventListener("unhandledrejection", onRejection);
25994
26157
  };
25995
26158
  }, [isEditMode, subdomain]);
25996
- const activeElRef = (0, import_react23.useRef)(null);
25997
- const pointerHeldRef = (0, import_react23.useRef)(false);
25998
- const selectedElRef = (0, import_react23.useRef)(null);
25999
- const selectedHrefKeyRef = (0, import_react23.useRef)(null);
26000
- const selectedFooterColAttrRef = (0, import_react23.useRef)(null);
26001
- const footerHeadingTitleCacheRef = (0, import_react23.useRef)(/* @__PURE__ */ new Map());
26002
- const originalContentRef = (0, import_react23.useRef)(null);
26003
- const activeStateElRef = (0, import_react23.useRef)(null);
26004
- const parentScrollRef = (0, import_react23.useRef)(null);
26005
- const visibleViewportRef = (0, import_react23.useRef)(null);
26006
- const [dialogPortalContainer, setDialogPortalContainer] = (0, import_react23.useState)(null);
26007
- const attachVisibleViewport = (0, import_react23.useCallback)((node) => {
26159
+ const activeElRef = (0, import_react24.useRef)(null);
26160
+ const pointerHeldRef = (0, import_react24.useRef)(false);
26161
+ const selectedElRef = (0, import_react24.useRef)(null);
26162
+ const selectedHrefKeyRef = (0, import_react24.useRef)(null);
26163
+ const selectedFooterColAttrRef = (0, import_react24.useRef)(null);
26164
+ const footerHeadingTitleCacheRef = (0, import_react24.useRef)(/* @__PURE__ */ new Map());
26165
+ const originalContentRef = (0, import_react24.useRef)(null);
26166
+ const activeStateElRef = (0, import_react24.useRef)(null);
26167
+ const parentScrollRef = (0, import_react24.useRef)(null);
26168
+ const visibleViewportRef = (0, import_react24.useRef)(null);
26169
+ const [dialogPortalContainer, setDialogPortalContainer] = (0, import_react24.useState)(null);
26170
+ const attachVisibleViewport = (0, import_react24.useCallback)((node) => {
26008
26171
  visibleViewportRef.current = node;
26009
26172
  setDialogPortalContainer(node);
26010
26173
  if (node) applyVisibleViewport(node, parentScrollRef.current);
26011
26174
  }, []);
26012
- const toolbarElRef = (0, import_react23.useRef)(null);
26013
- const glowElRef = (0, import_react23.useRef)(null);
26014
- const hoveredImageRef = (0, import_react23.useRef)(null);
26015
- const hoveredImageHasTextOverlapRef = (0, import_react23.useRef)(false);
26016
- const dragOverElRef = (0, import_react23.useRef)(null);
26017
- const [mediaHover, setMediaHover] = (0, import_react23.useState)(null);
26018
- const [selectedAiSectionId, setSelectedAiSectionId] = (0, import_react23.useState)(null);
26019
- const selectedAiSectionIdRef = (0, import_react23.useRef)(null);
26020
- const handleAiSectionSelectionChange = (0, import_react23.useCallback)((id) => {
26175
+ const toolbarElRef = (0, import_react24.useRef)(null);
26176
+ const glowElRef = (0, import_react24.useRef)(null);
26177
+ const hoveredImageRef = (0, import_react24.useRef)(null);
26178
+ const hoveredImageHasTextOverlapRef = (0, import_react24.useRef)(false);
26179
+ const dragOverElRef = (0, import_react24.useRef)(null);
26180
+ const [mediaHover, setMediaHover] = (0, import_react24.useState)(null);
26181
+ const [selectedAiSectionId, setSelectedAiSectionId] = (0, import_react24.useState)(null);
26182
+ const selectedAiSectionIdRef = (0, import_react24.useRef)(null);
26183
+ const handleAiSectionSelectionChange = (0, import_react24.useCallback)((id) => {
26021
26184
  selectedAiSectionIdRef.current = id;
26022
26185
  setSelectedAiSectionId(id);
26023
26186
  }, []);
26024
- const [selectedMedia, setSelectedMedia] = (0, import_react23.useState)(null);
26025
- const selectedMediaElRef = (0, import_react23.useRef)(null);
26026
- const mediaKeyDropTokenRef = (0, import_react23.useRef)(0);
26027
- const selectedIconElRef = (0, import_react23.useRef)(null);
26028
- const selectedSocialElRef = (0, import_react23.useRef)(null);
26029
- const queueSectionKeyDrop = (0, import_react23.useCallback)((prev) => {
26187
+ const [selectedMedia, setSelectedMedia] = (0, import_react24.useState)(null);
26188
+ const selectedMediaElRef = (0, import_react24.useRef)(null);
26189
+ const mediaKeyDropTokenRef = (0, import_react24.useRef)(0);
26190
+ const selectedIconElRef = (0, import_react24.useRef)(null);
26191
+ const selectedSocialElRef = (0, import_react24.useRef)(null);
26192
+ const queueSectionKeyDrop = (0, import_react24.useCallback)((prev) => {
26030
26193
  const sectionEl = prev?.closest("[data-ohw-section]") ?? null;
26031
26194
  if (!sectionEl) return;
26032
26195
  const sectionInstanceId = instanceIdOf(movableUnit(sectionEl)) || null;
@@ -26047,31 +26210,31 @@ function OhhwellsBridge() {
26047
26210
  window.addEventListener("message", onQueueDrained);
26048
26211
  window.postMessage({ type: "ow:media-key-drop", token }, "*");
26049
26212
  }, []);
26050
- const clearMediaSelection = (0, import_react23.useCallback)(() => {
26213
+ const clearMediaSelection = (0, import_react24.useCallback)(() => {
26051
26214
  const prev = selectedMediaElRef.current;
26052
26215
  selectedMediaElRef.current = null;
26053
26216
  setSelectedMedia(null);
26054
26217
  queueSectionKeyDrop(prev);
26055
26218
  }, [queueSectionKeyDrop]);
26056
- const clearMediaSelectionRef = (0, import_react23.useRef)(clearMediaSelection);
26219
+ const clearMediaSelectionRef = (0, import_react24.useRef)(clearMediaSelection);
26057
26220
  clearMediaSelectionRef.current = clearMediaSelection;
26058
- const clearIconSelection = (0, import_react23.useCallback)(() => {
26221
+ const clearIconSelection = (0, import_react24.useCallback)(() => {
26059
26222
  const prev = selectedIconElRef.current;
26060
26223
  if (!prev) return;
26061
26224
  selectedIconElRef.current = null;
26062
26225
  queueSectionKeyDrop(prev);
26063
26226
  }, [queueSectionKeyDrop]);
26064
- const clearIconSelectionRef = (0, import_react23.useRef)(clearIconSelection);
26227
+ const clearIconSelectionRef = (0, import_react24.useRef)(clearIconSelection);
26065
26228
  clearIconSelectionRef.current = clearIconSelection;
26066
- const clearSocialSelection = (0, import_react23.useCallback)(() => {
26229
+ const clearSocialSelection = (0, import_react24.useCallback)(() => {
26067
26230
  const prev = selectedSocialElRef.current;
26068
26231
  if (!prev) return;
26069
26232
  selectedSocialElRef.current = null;
26070
26233
  queueSectionKeyDrop(prev);
26071
26234
  }, [queueSectionKeyDrop]);
26072
- const clearSocialSelectionRef = (0, import_react23.useRef)(clearSocialSelection);
26235
+ const clearSocialSelectionRef = (0, import_react24.useRef)(clearSocialSelection);
26073
26236
  clearSocialSelectionRef.current = clearSocialSelection;
26074
- const selectIconElement = (0, import_react23.useCallback)((el) => {
26237
+ const selectIconElement = (0, import_react24.useCallback)((el) => {
26075
26238
  if (selectedMediaElRef.current) clearMediaSelectionRef.current();
26076
26239
  selectedIconElRef.current = el;
26077
26240
  const sectionEl = el.closest("[data-ohw-section]");
@@ -26084,9 +26247,9 @@ function OhhwellsBridge() {
26084
26247
  keyLabel: "Icon"
26085
26248
  });
26086
26249
  }, []);
26087
- const selectIconElementRef = (0, import_react23.useRef)(selectIconElement);
26250
+ const selectIconElementRef = (0, import_react24.useRef)(selectIconElement);
26088
26251
  selectIconElementRef.current = selectIconElement;
26089
- const selectMediaElement = (0, import_react23.useCallback)((el) => {
26252
+ const selectMediaElement = (0, import_react24.useCallback)((el) => {
26090
26253
  const r2 = el.getBoundingClientRect();
26091
26254
  const video = el.dataset.ohwEditable === "video" ? el.querySelector("video") : null;
26092
26255
  selectedIconElRef.current = null;
@@ -26111,9 +26274,9 @@ function OhhwellsBridge() {
26111
26274
  keyLabel: el.dataset.ohwEditable === "video" ? "Video" : el.dataset.ohwEditable === "bg-image" ? "Background" : "Image"
26112
26275
  });
26113
26276
  }, []);
26114
- const selectMediaElementRef = (0, import_react23.useRef)(selectMediaElement);
26277
+ const selectMediaElementRef = (0, import_react24.useRef)(selectMediaElement);
26115
26278
  selectMediaElementRef.current = selectMediaElement;
26116
- (0, import_react23.useEffect)(() => {
26279
+ (0, import_react24.useEffect)(() => {
26117
26280
  if (!selectedMedia) return;
26118
26281
  const update = () => {
26119
26282
  const el = selectedMediaElRef.current;
@@ -26133,54 +26296,54 @@ function OhhwellsBridge() {
26133
26296
  window.removeEventListener("resize", update);
26134
26297
  };
26135
26298
  }, [selectedMedia !== null]);
26136
- const [carouselHover, setCarouselHover] = (0, import_react23.useState)(null);
26137
- const [uploadingRects, setUploadingRects] = (0, import_react23.useState)({});
26138
- const hoveredGapRef = (0, import_react23.useRef)(null);
26139
- const imageUnhoverTimerRef = (0, import_react23.useRef)(null);
26140
- const imageShowTimerRef = (0, import_react23.useRef)(null);
26141
- const editStylesRef = (0, import_react23.useRef)(null);
26142
- const activateRef = (0, import_react23.useRef)(() => {
26299
+ const [carouselHover, setCarouselHover] = (0, import_react24.useState)(null);
26300
+ const [uploadingRects, setUploadingRects] = (0, import_react24.useState)({});
26301
+ const hoveredGapRef = (0, import_react24.useRef)(null);
26302
+ const imageUnhoverTimerRef = (0, import_react24.useRef)(null);
26303
+ const imageShowTimerRef = (0, import_react24.useRef)(null);
26304
+ const editStylesRef = (0, import_react24.useRef)(null);
26305
+ const activateRef = (0, import_react24.useRef)(() => {
26143
26306
  });
26144
- const deactivateRef = (0, import_react23.useRef)(() => {
26307
+ const deactivateRef = (0, import_react24.useRef)(() => {
26145
26308
  });
26146
- const selectRef = (0, import_react23.useRef)(() => {
26309
+ const selectRef = (0, import_react24.useRef)(() => {
26147
26310
  });
26148
- const selectFrameRef = (0, import_react23.useRef)(() => {
26311
+ const selectFrameRef = (0, import_react24.useRef)(() => {
26149
26312
  });
26150
- const selectLogoRef = (0, import_react23.useRef)(() => {
26313
+ const selectLogoRef = (0, import_react24.useRef)(() => {
26151
26314
  });
26152
- const openLogoSizePanelRef = (0, import_react23.useRef)(() => {
26315
+ const openLogoSizePanelRef = (0, import_react24.useRef)(() => {
26153
26316
  });
26154
- const deselectRef = (0, import_react23.useRef)(() => {
26317
+ const deselectRef = (0, import_react24.useRef)(() => {
26155
26318
  });
26156
- const closeFloatingPanelOnlyRef = (0, import_react23.useRef)(() => {
26319
+ const closeFloatingPanelOnlyRef = (0, import_react24.useRef)(() => {
26157
26320
  });
26158
- const reselectNavigationItemRef = (0, import_react23.useRef)(() => {
26321
+ const reselectNavigationItemRef = (0, import_react24.useRef)(() => {
26159
26322
  });
26160
- const commitNavigationTextEditRef = (0, import_react23.useRef)(() => {
26323
+ const commitNavigationTextEditRef = (0, import_react24.useRef)(() => {
26161
26324
  });
26162
- const handleDeleteSelectedRef = (0, import_react23.useRef)(() => false);
26163
- const runPendingDeleteUndoRef = (0, import_react23.useRef)(() => false);
26164
- const isFooterFrameSelectionRef = (0, import_react23.useRef)(false);
26165
- const refreshActiveCommandsRef = (0, import_react23.useRef)(() => {
26325
+ const handleDeleteSelectedRef = (0, import_react24.useRef)(() => false);
26326
+ const runPendingDeleteUndoRef = (0, import_react24.useRef)(() => false);
26327
+ const isFooterFrameSelectionRef = (0, import_react24.useRef)(false);
26328
+ const refreshActiveCommandsRef = (0, import_react24.useRef)(() => {
26166
26329
  });
26167
- const postToParentRef = (0, import_react23.useRef)(postToParent2);
26330
+ const postToParentRef = (0, import_react24.useRef)(postToParent2);
26168
26331
  postToParentRef.current = postToParent2;
26169
- const aiSectionApiRef = (0, import_react23.useRef)(null);
26170
- const sectionsLoadedRef = (0, import_react23.useRef)(false);
26171
- const pendingScheduleConfigRequests = (0, import_react23.useRef)([]);
26172
- const [toolbarRect, setToolbarRect] = (0, import_react23.useState)(null);
26173
- const [formPickRect, setFormPickRect] = (0, import_react23.useState)(null);
26174
- const formPickElRef = (0, import_react23.useRef)(null);
26175
- const [formViewState, setFormViewStateUi] = (0, import_react23.useState)("default");
26176
- const [formPickCount, setFormPickCount] = (0, import_react23.useState)(null);
26177
- const [formHoverRect, setFormHoverRect] = (0, import_react23.useState)(null);
26178
- const formHoverElRef = (0, import_react23.useRef)(null);
26179
- const [fieldPickRect, setFieldPickRect] = (0, import_react23.useState)(null);
26180
- const fieldPickElRef = (0, import_react23.useRef)(null);
26181
- const [fieldPickState, setFieldPickState] = (0, import_react23.useState)(null);
26182
- const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0, import_react23.useState)(false);
26183
- const clearFormPick = (0, import_react23.useCallback)(() => {
26332
+ const aiSectionApiRef = (0, import_react24.useRef)(null);
26333
+ const sectionsLoadedRef = (0, import_react24.useRef)(false);
26334
+ const pendingScheduleConfigRequests = (0, import_react24.useRef)([]);
26335
+ const [toolbarRect, setToolbarRect] = (0, import_react24.useState)(null);
26336
+ const [formPickRect, setFormPickRect] = (0, import_react24.useState)(null);
26337
+ const formPickElRef = (0, import_react24.useRef)(null);
26338
+ const [formViewState, setFormViewStateUi] = (0, import_react24.useState)("default");
26339
+ const [formPickCount, setFormPickCount] = (0, import_react24.useState)(null);
26340
+ const [formHoverRect, setFormHoverRect] = (0, import_react24.useState)(null);
26341
+ const formHoverElRef = (0, import_react24.useRef)(null);
26342
+ const [fieldPickRect, setFieldPickRect] = (0, import_react24.useState)(null);
26343
+ const fieldPickElRef = (0, import_react24.useRef)(null);
26344
+ const [fieldPickState, setFieldPickState] = (0, import_react24.useState)(null);
26345
+ const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0, import_react24.useState)(false);
26346
+ const clearFormPick = (0, import_react24.useCallback)(() => {
26184
26347
  const form = formPickElRef.current;
26185
26348
  const editing = fieldPickElRef.current;
26186
26349
  if (commitPlaceholderEdit(editing) && editing) {
@@ -26200,7 +26363,7 @@ function OhhwellsBridge() {
26200
26363
  formPickElRef.current = null;
26201
26364
  setFormPickRect(null);
26202
26365
  }, []);
26203
- const clearFieldPick = (0, import_react23.useCallback)(() => {
26366
+ const clearFieldPick = (0, import_react24.useCallback)(() => {
26204
26367
  const wrapper = fieldPickElRef.current;
26205
26368
  if (commitPlaceholderEdit(wrapper) && wrapper) {
26206
26369
  const form = wrapper.closest('[data-ohw-editable="form"]');
@@ -26210,9 +26373,9 @@ function OhhwellsBridge() {
26210
26373
  setFieldPickRect(null);
26211
26374
  setFieldPickState(null);
26212
26375
  }, []);
26213
- const persistFieldsRef = (0, import_react23.useRef)(() => {
26376
+ const persistFieldsRef = (0, import_react24.useRef)(() => {
26214
26377
  });
26215
- const persistFields = (0, import_react23.useCallback)(
26378
+ const persistFields = (0, import_react24.useCallback)(
26216
26379
  (form) => {
26217
26380
  const key = formKeyOf(form);
26218
26381
  if (!key) return;
@@ -26223,7 +26386,7 @@ function OhhwellsBridge() {
26223
26386
  []
26224
26387
  );
26225
26388
  persistFieldsRef.current = persistFields;
26226
- const selectField = (0, import_react23.useCallback)((wrapper) => {
26389
+ const selectField = (0, import_react24.useCallback)((wrapper) => {
26227
26390
  if (fieldPickElRef.current && fieldPickElRef.current !== wrapper) {
26228
26391
  commitPlaceholderEdit(fieldPickElRef.current);
26229
26392
  }
@@ -26236,7 +26399,7 @@ function OhhwellsBridge() {
26236
26399
  setFieldPickState({ type: fieldTypeOf(wrapper), required: isFieldRequired(wrapper) });
26237
26400
  setFieldTypePickerOpen(false);
26238
26401
  }, []);
26239
- const withSelectedField = (0, import_react23.useCallback)(
26402
+ const withSelectedField = (0, import_react24.useCallback)(
26240
26403
  (run) => {
26241
26404
  const wrapper = fieldPickElRef.current;
26242
26405
  const form = formPickElRef.current;
@@ -26249,28 +26412,28 @@ function OhhwellsBridge() {
26249
26412
  },
26250
26413
  [persistFields]
26251
26414
  );
26252
- const handleFieldTypeChange = (0, import_react23.useCallback)(
26415
+ const handleFieldTypeChange = (0, import_react24.useCallback)(
26253
26416
  (type) => withSelectedField((_form, wrapper) => {
26254
26417
  applyFieldType(wrapper, type);
26255
26418
  selectField(wrapper);
26256
26419
  }),
26257
26420
  [selectField, withSelectedField]
26258
26421
  );
26259
- const handleFieldRequiredToggle = (0, import_react23.useCallback)(
26422
+ const handleFieldRequiredToggle = (0, import_react24.useCallback)(
26260
26423
  () => withSelectedField((_form, wrapper) => {
26261
26424
  setFieldRequired(wrapper, !isFieldRequired(wrapper));
26262
26425
  selectField(wrapper);
26263
26426
  }),
26264
26427
  [selectField, withSelectedField]
26265
26428
  );
26266
- const handleFieldDuplicate = (0, import_react23.useCallback)(
26429
+ const handleFieldDuplicate = (0, import_react24.useCallback)(
26267
26430
  () => withSelectedField((form, wrapper) => {
26268
26431
  const copy = duplicateField(form, wrapper);
26269
26432
  selectField(copy);
26270
26433
  }),
26271
26434
  [selectField, withSelectedField]
26272
26435
  );
26273
- const handleFieldDelete = (0, import_react23.useCallback)(
26436
+ const handleFieldDelete = (0, import_react24.useCallback)(
26274
26437
  () => withSelectedField((_form, wrapper) => {
26275
26438
  removeField(wrapper);
26276
26439
  clearFieldPick();
@@ -26278,7 +26441,7 @@ function OhhwellsBridge() {
26278
26441
  }),
26279
26442
  [clearFieldPick, withSelectedField]
26280
26443
  );
26281
- const handleAddField = (0, import_react23.useCallback)(
26444
+ const handleAddField = (0, import_react24.useCallback)(
26282
26445
  (type) => {
26283
26446
  const form = formPickElRef.current;
26284
26447
  if (!form) return;
@@ -26294,8 +26457,8 @@ function OhhwellsBridge() {
26294
26457
  },
26295
26458
  [persistFields, selectField]
26296
26459
  );
26297
- const fieldDragRef = (0, import_react23.useRef)(null);
26298
- const buildFieldDropSlots = (0, import_react23.useCallback)((form, draggedKey) => {
26460
+ const fieldDragRef = (0, import_react24.useRef)(null);
26461
+ const buildFieldDropSlots = (0, import_react24.useCallback)((form, draggedKey) => {
26299
26462
  const others = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== draggedKey);
26300
26463
  const slots = others.map((el) => {
26301
26464
  const rect = el.getBoundingClientRect();
@@ -26308,7 +26471,7 @@ function OhhwellsBridge() {
26308
26471
  }
26309
26472
  return slots;
26310
26473
  }, []);
26311
- const handleFieldDragStart = (0, import_react23.useCallback)(() => {
26474
+ const handleFieldDragStart = (0, import_react24.useCallback)(() => {
26312
26475
  const wrapper = fieldPickElRef.current;
26313
26476
  const form = formPickElRef.current;
26314
26477
  if (!wrapper || !form) return;
@@ -26317,18 +26480,18 @@ function OhhwellsBridge() {
26317
26480
  setFieldDragging(true);
26318
26481
  setFieldDropSlots(buildFieldDropSlots(form, key));
26319
26482
  }, [buildFieldDropSlots]);
26320
- const handleFieldDragEnd = (0, import_react23.useCallback)(() => {
26483
+ const handleFieldDragEnd = (0, import_react24.useCallback)(() => {
26321
26484
  fieldDragRef.current = null;
26322
26485
  setFieldDropIndex(null);
26323
26486
  setFieldDropSlots([]);
26324
26487
  setFieldDragging(false);
26325
26488
  }, []);
26326
- const [fieldDropIndex, setFieldDropIndex] = (0, import_react23.useState)(null);
26327
- const [fieldDropSlots, setFieldDropSlots] = (0, import_react23.useState)([]);
26328
- const [fieldDragging, setFieldDragging] = (0, import_react23.useState)(false);
26329
- const clearFormPickRef = (0, import_react23.useRef)(clearFormPick);
26489
+ const [fieldDropIndex, setFieldDropIndex] = (0, import_react24.useState)(null);
26490
+ const [fieldDropSlots, setFieldDropSlots] = (0, import_react24.useState)([]);
26491
+ const [fieldDragging, setFieldDragging] = (0, import_react24.useState)(false);
26492
+ const clearFormPickRef = (0, import_react24.useRef)(clearFormPick);
26330
26493
  clearFormPickRef.current = clearFormPick;
26331
- (0, import_react23.useEffect)(() => {
26494
+ (0, import_react24.useEffect)(() => {
26332
26495
  const el = fieldPickElRef.current;
26333
26496
  if (!el || fieldPickRect === null) return;
26334
26497
  const observer = new ResizeObserver(() => {
@@ -26337,7 +26500,7 @@ function OhhwellsBridge() {
26337
26500
  observer.observe(el);
26338
26501
  return () => observer.disconnect();
26339
26502
  }, [fieldPickRect !== null, fieldPickState]);
26340
- (0, import_react23.useEffect)(() => {
26503
+ (0, import_react24.useEffect)(() => {
26341
26504
  const el = formPickElRef.current;
26342
26505
  if (!el || formPickRect === null) return;
26343
26506
  const observer = new ResizeObserver(() => {
@@ -26346,25 +26509,25 @@ function OhhwellsBridge() {
26346
26509
  observer.observe(el);
26347
26510
  return () => observer.disconnect();
26348
26511
  }, [formPickRect !== null, formViewState]);
26349
- const [toolbarVariant, setToolbarVariant] = (0, import_react23.useState)("none");
26350
- const toolbarVariantRef = (0, import_react23.useRef)("none");
26512
+ const [toolbarVariant, setToolbarVariant] = (0, import_react24.useState)("none");
26513
+ const toolbarVariantRef = (0, import_react24.useRef)("none");
26351
26514
  toolbarVariantRef.current = toolbarVariant;
26352
- const [selectedIsCta, setSelectedIsCta] = (0, import_react23.useState)(false);
26353
- const [selectedIsSocial, setSelectedIsSocial] = (0, import_react23.useState)(false);
26354
- const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0, import_react23.useState)(false);
26355
- const [reorderHrefKey, setReorderHrefKey] = (0, import_react23.useState)(null);
26356
- const [reorderDragDisabled, setReorderDragDisabled] = (0, import_react23.useState)(false);
26357
- const [toggleState, setToggleState] = (0, import_react23.useState)(null);
26358
- const [maxBadge, setMaxBadge] = (0, import_react23.useState)(null);
26359
- const [activeCommands, setActiveCommands] = (0, import_react23.useState)(/* @__PURE__ */ new Set());
26360
- const [sectionGap, setSectionGap] = (0, import_react23.useState)(null);
26361
- const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react23.useState)(false);
26362
- const hoveredNavContainerRef = (0, import_react23.useRef)(null);
26363
- const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react23.useState)(null);
26364
- const hoveredItemElRef = (0, import_react23.useRef)(null);
26365
- const [hoveredItemRect, setHoveredItemRect] = (0, import_react23.useState)(null);
26366
- const [hoveredTextRect, setHoveredTextRect] = (0, import_react23.useState)(null);
26367
- (0, import_react23.useEffect)(() => {
26515
+ const [selectedIsCta, setSelectedIsCta] = (0, import_react24.useState)(false);
26516
+ const [selectedIsSocial, setSelectedIsSocial] = (0, import_react24.useState)(false);
26517
+ const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0, import_react24.useState)(false);
26518
+ const [reorderHrefKey, setReorderHrefKey] = (0, import_react24.useState)(null);
26519
+ const [reorderDragDisabled, setReorderDragDisabled] = (0, import_react24.useState)(false);
26520
+ const [toggleState, setToggleState] = (0, import_react24.useState)(null);
26521
+ const [maxBadge, setMaxBadge] = (0, import_react24.useState)(null);
26522
+ const [activeCommands, setActiveCommands] = (0, import_react24.useState)(/* @__PURE__ */ new Set());
26523
+ const [sectionGap, setSectionGap] = (0, import_react24.useState)(null);
26524
+ const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react24.useState)(false);
26525
+ const hoveredNavContainerRef = (0, import_react24.useRef)(null);
26526
+ const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react24.useState)(null);
26527
+ const hoveredItemElRef = (0, import_react24.useRef)(null);
26528
+ const [hoveredItemRect, setHoveredItemRect] = (0, import_react24.useState)(null);
26529
+ const [hoveredTextRect, setHoveredTextRect] = (0, import_react24.useState)(null);
26530
+ (0, import_react24.useEffect)(() => {
26368
26531
  const sync = () => {
26369
26532
  const el = document.querySelector(
26370
26533
  '[data-ohw-hovered]:not([contenteditable]):not([data-ohw-href-key]):not([data-ohw-editable="form"] *)'
@@ -26408,63 +26571,64 @@ function OhhwellsBridge() {
26408
26571
  });
26409
26572
  return () => observer.disconnect();
26410
26573
  }, []);
26411
- const siblingHintElRef = (0, import_react23.useRef)(null);
26412
- const [siblingHintRect, setSiblingHintRect] = (0, import_react23.useState)(null);
26413
- const [siblingHintRects, setSiblingHintRects] = (0, import_react23.useState)([]);
26414
- const [isItemDragging, setIsItemDragging] = (0, import_react23.useState)(false);
26415
- const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react23.useState)(false);
26574
+ const siblingHintElRef = (0, import_react24.useRef)(null);
26575
+ const [siblingHintRect, setSiblingHintRect] = (0, import_react24.useState)(null);
26576
+ const [siblingHintRects, setSiblingHintRects] = (0, import_react24.useState)([]);
26577
+ const [isItemDragging, setIsItemDragging] = (0, import_react24.useState)(false);
26578
+ const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react24.useState)(false);
26416
26579
  isFooterFrameSelectionRef.current = isFooterFrameSelection;
26417
- const [floatingPanel, setFloatingPanel] = (0, import_react23.useState)(null);
26418
- const floatingPanelOpenRef = (0, import_react23.useRef)(false);
26580
+ const [floatingPanel, setFloatingPanel] = (0, import_react24.useState)(null);
26581
+ const floatingPanelOpenRef = (0, import_react24.useRef)(false);
26419
26582
  floatingPanelOpenRef.current = floatingPanel !== null;
26420
- const floatingPanelRef = (0, import_react23.useRef)(null);
26583
+ const floatingPanelRef = (0, import_react24.useRef)(null);
26421
26584
  floatingPanelRef.current = floatingPanel;
26422
- const [floatingPanelPos, setFloatingPanelPos] = (0, import_react23.useState)(null);
26423
- const buttonCollectionDragRef = (0, import_react23.useRef)(null);
26424
- const buttonDropInsertIndexRef = (0, import_react23.useRef)(null);
26425
- const [buttonDropSlots, setButtonDropSlots] = (0, import_react23.useState)([]);
26426
- const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react23.useState)(null);
26427
- const buttonPointerDragRef = (0, import_react23.useRef)(null);
26428
- const [buttonStyleTick, setButtonStyleTick] = (0, import_react23.useState)(0);
26429
- const [logoSizeDraft, setLogoSizeDraft] = (0, import_react23.useState)(null);
26430
- const [editorViewport, setEditorViewport] = (0, import_react23.useState)("desktop");
26431
- const [parentScrollSnap, setParentScrollSnap] = (0, import_react23.useState)(null);
26432
- const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react23.useState)(null);
26433
- const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react23.useState)(null);
26434
- const footerDragRef = (0, import_react23.useRef)(null);
26435
- const [footerDropSlots, setFooterDropSlots] = (0, import_react23.useState)([]);
26436
- const [activeFooterDropIndex, setActiveFooterDropIndex] = (0, import_react23.useState)(null);
26437
- const [draggedItemRect, setDraggedItemRect] = (0, import_react23.useState)(null);
26438
- const footerPointerDragRef = (0, import_react23.useRef)(null);
26439
- const suppressNextClickRef = (0, import_react23.useRef)(false);
26440
- const suppressClickUntilRef = (0, import_react23.useRef)(0);
26441
- const [linkPopover, setLinkPopover] = (0, import_react23.useState)(null);
26442
- const linkPopoverSessionRef = (0, import_react23.useRef)(null);
26443
- const addNavAfterAnchorRef = (0, import_react23.useRef)(null);
26444
- const editContentRef = (0, import_react23.useRef)({});
26445
- const aiSectionsRef = (0, import_react23.useRef)("");
26446
- const aiFooterRef = (0, import_react23.useRef)("");
26447
- const applyTreeLocalRef = (0, import_react23.useRef)(
26585
+ const [floatingPanelPos, setFloatingPanelPos] = (0, import_react24.useState)(null);
26586
+ const buttonCollectionDragRef = (0, import_react24.useRef)(null);
26587
+ const buttonDropInsertIndexRef = (0, import_react24.useRef)(null);
26588
+ const [buttonDropSlots, setButtonDropSlots] = (0, import_react24.useState)([]);
26589
+ const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react24.useState)(null);
26590
+ const buttonPointerDragRef = (0, import_react24.useRef)(null);
26591
+ const [buttonStyleTick, setButtonStyleTick] = (0, import_react24.useState)(0);
26592
+ const [logoSizeDraft, setLogoSizeDraft] = (0, import_react24.useState)(null);
26593
+ const [editorViewport, setEditorViewport] = (0, import_react24.useState)("desktop");
26594
+ const [parentScrollSnap, setParentScrollSnap] = (0, import_react24.useState)(null);
26595
+ const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react24.useState)(null);
26596
+ const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react24.useState)(null);
26597
+ const footerDragRef = (0, import_react24.useRef)(null);
26598
+ const [footerDropSlots, setFooterDropSlots] = (0, import_react24.useState)([]);
26599
+ const [activeFooterDropIndex, setActiveFooterDropIndex] = (0, import_react24.useState)(null);
26600
+ const [draggedItemRect, setDraggedItemRect] = (0, import_react24.useState)(null);
26601
+ const footerPointerDragRef = (0, import_react24.useRef)(null);
26602
+ const suppressNextClickRef = (0, import_react24.useRef)(false);
26603
+ const suppressClickUntilRef = (0, import_react24.useRef)(0);
26604
+ const [linkPopover, setLinkPopover] = (0, import_react24.useState)(null);
26605
+ const linkPopoverSessionRef = (0, import_react24.useRef)(null);
26606
+ const addNavAfterAnchorRef = (0, import_react24.useRef)(null);
26607
+ const editContentRef = (0, import_react24.useRef)({});
26608
+ useBuildPageSync(isEditMode, editContentRef, postToParent2);
26609
+ const aiSectionsRef = (0, import_react24.useRef)("");
26610
+ const aiFooterRef = (0, import_react24.useRef)("");
26611
+ const applyTreeLocalRef = (0, import_react24.useRef)(
26448
26612
  null
26449
26613
  );
26450
- const applyFooterTreeLocalRef = (0, import_react23.useRef)(null);
26451
- const clearInteractionChromeRef = (0, import_react23.useRef)(() => {
26614
+ const applyFooterTreeLocalRef = (0, import_react24.useRef)(null);
26615
+ const clearInteractionChromeRef = (0, import_react24.useRef)(() => {
26452
26616
  });
26453
- const brandKitRef = (0, import_react23.useRef)("");
26454
- const stylesRef = (0, import_react23.useRef)("");
26455
- const appliedDrawerRef = (0, import_react23.useRef)(null);
26456
- const pendingDeleteUndoRef = (0, import_react23.useRef)(null);
26457
- const [sitePages, setSitePages] = (0, import_react23.useState)([]);
26458
- const collectionItemsRef = (0, import_react23.useRef)(/* @__PURE__ */ new Map());
26459
- const [sectionsByPath, setSectionsByPath] = (0, import_react23.useState)({});
26460
- const sectionsPrefetchGenRef = (0, import_react23.useRef)(0);
26461
- const setLinkPopoverRef = (0, import_react23.useRef)(setLinkPopover);
26462
- const linkPopoverPanelRef = (0, import_react23.useRef)(null);
26463
- const linkPopoverOpenRef = (0, import_react23.useRef)(false);
26464
- const linkPopoverGraceUntilRef = (0, import_react23.useRef)(0);
26617
+ const brandKitRef = (0, import_react24.useRef)("");
26618
+ const stylesRef = (0, import_react24.useRef)("");
26619
+ const appliedDrawerRef = (0, import_react24.useRef)(null);
26620
+ const pendingDeleteUndoRef = (0, import_react24.useRef)(null);
26621
+ const [sitePages, setSitePages] = (0, import_react24.useState)([]);
26622
+ const collectionItemsRef = (0, import_react24.useRef)(/* @__PURE__ */ new Map());
26623
+ const [sectionsByPath, setSectionsByPath] = (0, import_react24.useState)({});
26624
+ const sectionsPrefetchGenRef = (0, import_react24.useRef)(0);
26625
+ const setLinkPopoverRef = (0, import_react24.useRef)(setLinkPopover);
26626
+ const linkPopoverPanelRef = (0, import_react24.useRef)(null);
26627
+ const linkPopoverOpenRef = (0, import_react24.useRef)(false);
26628
+ const linkPopoverGraceUntilRef = (0, import_react24.useRef)(0);
26465
26629
  setLinkPopoverRef.current = setLinkPopover;
26466
26630
  linkPopoverSessionRef.current = linkPopover;
26467
- (0, import_react23.useEffect)(() => {
26631
+ (0, import_react24.useEffect)(() => {
26468
26632
  setSectionOrderPersistHandler((entries) => {
26469
26633
  const currentPath = window.location.pathname;
26470
26634
  const merged = mergePageSectionOrder(editContentRef.current[SECTION_ORDER_KEY], currentPath, entries);
@@ -26474,7 +26638,7 @@ function OhhwellsBridge() {
26474
26638
  });
26475
26639
  return () => setSectionOrderPersistHandler(null);
26476
26640
  }, []);
26477
- (0, import_react23.useEffect)(() => {
26641
+ (0, import_react24.useEffect)(() => {
26478
26642
  setAiFooterMountOptions({
26479
26643
  resolvePageHref: (pageOrAnchorId) => {
26480
26644
  const [pageId, anchor] = pageOrAnchorId.split("#");
@@ -26537,7 +26701,7 @@ function OhhwellsBridge() {
26537
26701
  const bumpLinkPopoverGrace = () => {
26538
26702
  linkPopoverGraceUntilRef.current = Date.now() + 350;
26539
26703
  };
26540
- const runSectionsPrefetch = (0, import_react23.useCallback)((pages) => {
26704
+ const runSectionsPrefetch = (0, import_react24.useCallback)((pages) => {
26541
26705
  if (!isEditMode || shouldUseDevFixtures() || pages.length === 0) return;
26542
26706
  const gen = ++sectionsPrefetchGenRef.current;
26543
26707
  const paths = pages.map((p) => p.path);
@@ -26556,9 +26720,9 @@ function OhhwellsBridge() {
26556
26720
  );
26557
26721
  });
26558
26722
  }, [isEditMode, pathname]);
26559
- const runSectionsPrefetchRef = (0, import_react23.useRef)(runSectionsPrefetch);
26723
+ const runSectionsPrefetchRef = (0, import_react24.useRef)(runSectionsPrefetch);
26560
26724
  runSectionsPrefetchRef.current = runSectionsPrefetch;
26561
- (0, import_react23.useEffect)(() => {
26725
+ (0, import_react24.useEffect)(() => {
26562
26726
  if (!linkPopover) {
26563
26727
  document.documentElement.removeAttribute("data-ohw-link-popover-open");
26564
26728
  return;
@@ -26586,7 +26750,7 @@ function OhhwellsBridge() {
26586
26750
  document.documentElement.removeAttribute("data-ohw-link-popover-open");
26587
26751
  };
26588
26752
  }, [linkPopover, postToParent2]);
26589
- (0, import_react23.useEffect)(() => {
26753
+ (0, import_react24.useEffect)(() => {
26590
26754
  if (!isEditMode) return;
26591
26755
  const useFixtures = shouldUseDevFixtures();
26592
26756
  if (useFixtures) {
@@ -26612,7 +26776,7 @@ function OhhwellsBridge() {
26612
26776
  if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
26613
26777
  return () => window.removeEventListener("message", onSitePages);
26614
26778
  }, [isEditMode, postToParent2]);
26615
- (0, import_react23.useEffect)(() => {
26779
+ (0, import_react24.useEffect)(() => {
26616
26780
  if (!isEditMode) return;
26617
26781
  const deps = {
26618
26782
  getEditContent: () => editContentRef.current,
@@ -26649,14 +26813,14 @@ function OhhwellsBridge() {
26649
26813
  window.addEventListener("message", onPageMessage);
26650
26814
  return () => window.removeEventListener("message", onPageMessage);
26651
26815
  }, [isEditMode, postToParent2]);
26652
- (0, import_react23.useEffect)(() => {
26816
+ (0, import_react24.useEffect)(() => {
26653
26817
  if (!isEditMode || shouldUseDevFixtures()) return;
26654
26818
  void loadAllSectionsManifest().then((manifest) => {
26655
26819
  if (Object.keys(manifest).length === 0) return;
26656
26820
  setSectionsByPath((prev) => ({ ...manifest, ...prev }));
26657
26821
  });
26658
26822
  }, [isEditMode]);
26659
- (0, import_react23.useEffect)(() => {
26823
+ (0, import_react24.useEffect)(() => {
26660
26824
  const update = () => {
26661
26825
  const el = activeElRef.current ?? selectedElRef.current;
26662
26826
  if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
@@ -26680,10 +26844,10 @@ function OhhwellsBridge() {
26680
26844
  vvp.removeEventListener("resize", update);
26681
26845
  };
26682
26846
  }, []);
26683
- const refreshStateRules = (0, import_react23.useCallback)(() => {
26847
+ const refreshStateRules = (0, import_react24.useCallback)(() => {
26684
26848
  editStylesRef.current?.forceHover && (editStylesRef.current.forceHover.textContent = collectStateRules());
26685
26849
  }, []);
26686
- const processConfigRequest = (0, import_react23.useCallback)((insertAfterVal) => {
26850
+ const processConfigRequest = (0, import_react24.useCallback)((insertAfterVal) => {
26687
26851
  const tracker = getSectionsTracker();
26688
26852
  let entries = [];
26689
26853
  try {
@@ -26706,7 +26870,7 @@ function OhhwellsBridge() {
26706
26870
  }
26707
26871
  window.postMessage({ type: "ow:schedule-config", insertAfter: insertAfterVal, scheduleId: null }, "*");
26708
26872
  }, [isEditMode]);
26709
- const deactivate = (0, import_react23.useCallback)(() => {
26873
+ const deactivate = (0, import_react24.useCallback)(() => {
26710
26874
  const el = activeElRef.current;
26711
26875
  if (!el) return;
26712
26876
  const isFormBlock = el.dataset.ohwEditable === "form";
@@ -26772,12 +26936,12 @@ function OhhwellsBridge() {
26772
26936
  setToolbarShowEditLink(false);
26773
26937
  postToParent2({ type: "ow:exit-edit" });
26774
26938
  }, [postToParent2]);
26775
- const clearSelectedAttr = (0, import_react23.useCallback)(() => {
26939
+ const clearSelectedAttr = (0, import_react24.useCallback)(() => {
26776
26940
  document.querySelectorAll("[data-ohw-selected]").forEach((el) => {
26777
26941
  el.removeAttribute("data-ohw-selected");
26778
26942
  });
26779
26943
  }, []);
26780
- const deselect = (0, import_react23.useCallback)(() => {
26944
+ const deselect = (0, import_react24.useCallback)(() => {
26781
26945
  const nestedGroup = selectedElRef.current?.closest("[data-ohw-nav-children]") != null ? selectedElRef.current.closest("[data-ohw-nav-group]") : null;
26782
26946
  clearSelectedAttr();
26783
26947
  selectedElRef.current = null;
@@ -26813,20 +26977,20 @@ function OhhwellsBridge() {
26813
26977
  setToolbarVariant("none");
26814
26978
  }
26815
26979
  }, [clearSelectedAttr]);
26816
- const markSelected = (0, import_react23.useCallback)((el) => {
26980
+ const markSelected = (0, import_react24.useCallback)((el) => {
26817
26981
  clearSelectedAttr();
26818
26982
  el.removeAttribute("data-ohw-hovered");
26819
26983
  el.setAttribute("data-ohw-selected", "");
26820
26984
  }, [clearSelectedAttr]);
26821
- const isSelectedForHover = (0, import_react23.useCallback)((el) => {
26985
+ const isSelectedForHover = (0, import_react24.useCallback)((el) => {
26822
26986
  if (!el) return false;
26823
26987
  return [selectedElRef.current, activeElRef.current].some(
26824
26988
  (busy) => busy && (el === busy || busy.contains(el) || el.contains(busy))
26825
26989
  );
26826
26990
  }, []);
26827
- const isSelectedForHoverRef = (0, import_react23.useRef)(isSelectedForHover);
26991
+ const isSelectedForHoverRef = (0, import_react24.useRef)(isSelectedForHover);
26828
26992
  isSelectedForHoverRef.current = isSelectedForHover;
26829
- const resolveHrefKeyElement = (0, import_react23.useCallback)((hrefKey) => {
26993
+ const resolveHrefKeyElement = (0, import_react24.useCallback)((hrefKey) => {
26830
26994
  if (isFooterHrefKey(hrefKey)) {
26831
26995
  return document.querySelector(
26832
26996
  `footer [data-ohw-href-key="${CSS.escape(hrefKey)}"]`
@@ -26841,7 +27005,7 @@ function OhhwellsBridge() {
26841
27005
  `[data-ohw-href-key="${CSS.escape(hrefKey)}"]`
26842
27006
  );
26843
27007
  }, []);
26844
- const resyncSelectedNavigationItem = (0, import_react23.useCallback)(() => {
27008
+ const resyncSelectedNavigationItem = (0, import_react24.useCallback)(() => {
26845
27009
  const hrefKey = selectedHrefKeyRef.current;
26846
27010
  if (hrefKey) {
26847
27011
  const link = resolveHrefKeyElement(hrefKey);
@@ -26879,7 +27043,7 @@ function OhhwellsBridge() {
26879
27043
  );
26880
27044
  }
26881
27045
  }, [resolveHrefKeyElement]);
26882
- const reselectNavigationItem = (0, import_react23.useCallback)((navAnchor) => {
27046
+ const reselectNavigationItem = (0, import_react24.useCallback)((navAnchor) => {
26883
27047
  selectedElRef.current = navAnchor;
26884
27048
  selectedHrefKeyRef.current = navAnchor.getAttribute("data-ohw-href-key");
26885
27049
  selectedFooterColAttrRef.current = null;
@@ -26910,7 +27074,7 @@ function OhhwellsBridge() {
26910
27074
  setToolbarShowEditLink(false);
26911
27075
  setActiveCommands(/* @__PURE__ */ new Set());
26912
27076
  }, [markSelected]);
26913
- const commitNavigationTextEdit = (0, import_react23.useCallback)((navAnchor) => {
27077
+ const commitNavigationTextEdit = (0, import_react24.useCallback)((navAnchor) => {
26914
27078
  const el = activeElRef.current;
26915
27079
  if (!el) return;
26916
27080
  const key = el.dataset.ohwKey;
@@ -26943,7 +27107,7 @@ function OhhwellsBridge() {
26943
27107
  postToParent2({ type: "ow:exit-edit" });
26944
27108
  reselectNavigationItem(navAnchor);
26945
27109
  }, [postToParent2, reselectNavigationItem]);
26946
- const handleAddTopLevelNavItem = (0, import_react23.useCallback)(() => {
27110
+ const handleAddTopLevelNavItem = (0, import_react24.useCallback)(() => {
26947
27111
  const items = listNavbarRootItems();
26948
27112
  addNavAfterAnchorRef.current = items[items.length - 1] ?? null;
26949
27113
  deselectRef.current();
@@ -26955,7 +27119,7 @@ function OhhwellsBridge() {
26955
27119
  intent: "add-nav"
26956
27120
  });
26957
27121
  }, []);
26958
- const maybeWarnNavLinkDropdownConflict = (0, import_react23.useCallback)(
27122
+ const maybeWarnNavLinkDropdownConflict = (0, import_react24.useCallback)(
26959
27123
  (anchor) => {
26960
27124
  if (!isNavbarHrefKey(anchor.getAttribute("data-ohw-href-key"))) return;
26961
27125
  if (!navDropdownsOpenOnClick()) return;
@@ -26968,7 +27132,7 @@ function OhhwellsBridge() {
26968
27132
  },
26969
27133
  [postToParent2]
26970
27134
  );
26971
- const handleNavDropdownOpenChange = (0, import_react23.useCallback)((open) => {
27135
+ const handleNavDropdownOpenChange = (0, import_react24.useCallback)((open) => {
26972
27136
  const selected = selectedElRef.current;
26973
27137
  if (!selected || !isNavigationItem2(selected)) return;
26974
27138
  if (isNestedNavChild(selected)) return;
@@ -26984,7 +27148,7 @@ function OhhwellsBridge() {
26984
27148
  }
26985
27149
  });
26986
27150
  }, []);
26987
- const handleFooterHeadingVisibleChange = (0, import_react23.useCallback)(
27151
+ const handleFooterHeadingVisibleChange = (0, import_react24.useCallback)(
26988
27152
  (visible) => {
26989
27153
  const selected = selectedElRef.current;
26990
27154
  if (!selected || !isFooterFrameSelectionRef.current) return;
@@ -27037,7 +27201,7 @@ function OhhwellsBridge() {
27037
27201
  },
27038
27202
  [postToParent2]
27039
27203
  );
27040
- const enterEditOnNewItem = (0, import_react23.useCallback)((anchor) => {
27204
+ const enterEditOnNewItem = (0, import_react24.useCallback)((anchor) => {
27041
27205
  const label = anchor.querySelector('[data-ohw-editable="text"]');
27042
27206
  if (!label) {
27043
27207
  selectRef.current(anchor);
@@ -27046,8 +27210,8 @@ function OhhwellsBridge() {
27046
27210
  setNavGroupForceOpen(anchor, true);
27047
27211
  activateRef.current(label);
27048
27212
  }, []);
27049
- const pendingSocialAddRef = (0, import_react23.useRef)(null);
27050
- const handleAddChildItem = (0, import_react23.useCallback)(() => {
27213
+ const pendingSocialAddRef = (0, import_react24.useRef)(null);
27214
+ const handleAddChildItem = (0, import_react24.useCallback)(() => {
27051
27215
  const selected = selectedElRef.current;
27052
27216
  if (!selected) return;
27053
27217
  const socialsRow = isSocialsRow(selected) ? selected : findSocialsRow(selected);
@@ -27174,7 +27338,7 @@ function OhhwellsBridge() {
27174
27338
  });
27175
27339
  });
27176
27340
  }, [enterEditOnNewItem, isFooterFrameSelection, maybeWarnNavLinkDropdownConflict, postToParent2]);
27177
- const handleAddFooterColumn = (0, import_react23.useCallback)(() => {
27341
+ const handleAddFooterColumn = (0, import_react24.useCallback)(() => {
27178
27342
  if (document.querySelector("[data-ai-footer]")) {
27179
27343
  const state = parseAiFooterState(aiFooterRef.current);
27180
27344
  if (!state?.tree) return;
@@ -27230,7 +27394,7 @@ function OhhwellsBridge() {
27230
27394
  selectRef.current(result.firstLink);
27231
27395
  });
27232
27396
  }, [postToParent2]);
27233
- const clearFooterDragVisuals = (0, import_react23.useCallback)(() => {
27397
+ const clearFooterDragVisuals = (0, import_react24.useCallback)(() => {
27234
27398
  footerDragRef.current = null;
27235
27399
  setSiblingHintRects([]);
27236
27400
  setFooterDropSlots([]);
@@ -27239,7 +27403,7 @@ function OhhwellsBridge() {
27239
27403
  setIsItemDragging(false);
27240
27404
  unlockFooterDragInteraction();
27241
27405
  }, []);
27242
- const refreshFooterDragVisuals = (0, import_react23.useCallback)((session, activeSlot, clientX, clientY) => {
27406
+ const refreshFooterDragVisuals = (0, import_react24.useCallback)((session, activeSlot, clientX, clientY) => {
27243
27407
  const dragged = session.draggedEl;
27244
27408
  setDraggedItemRect(dragged.getBoundingClientRect());
27245
27409
  if (typeof clientX === "number" && typeof clientY === "number") {
@@ -27271,13 +27435,13 @@ function OhhwellsBridge() {
27271
27435
  const activeIdx = activeSlot ? slots.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
27272
27436
  setActiveFooterDropIndex(activeIdx >= 0 ? activeIdx : null);
27273
27437
  }, []);
27274
- const refreshFooterDragVisualsRef = (0, import_react23.useRef)(refreshFooterDragVisuals);
27438
+ const refreshFooterDragVisualsRef = (0, import_react24.useRef)(refreshFooterDragVisuals);
27275
27439
  refreshFooterDragVisualsRef.current = refreshFooterDragVisuals;
27276
- const commitFooterDragRef = (0, import_react23.useRef)(() => {
27440
+ const commitFooterDragRef = (0, import_react24.useRef)(() => {
27277
27441
  });
27278
- const beginFooterDragRef = (0, import_react23.useRef)(() => {
27442
+ const beginFooterDragRef = (0, import_react24.useRef)(() => {
27279
27443
  });
27280
- const beginFooterDrag = (0, import_react23.useCallback)(
27444
+ const beginFooterDrag = (0, import_react24.useCallback)(
27281
27445
  (session) => {
27282
27446
  const rect = session.draggedEl.getBoundingClientRect();
27283
27447
  session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
@@ -27297,7 +27461,7 @@ function OhhwellsBridge() {
27297
27461
  [refreshFooterDragVisuals]
27298
27462
  );
27299
27463
  beginFooterDragRef.current = beginFooterDrag;
27300
- const commitFooterDrag = (0, import_react23.useCallback)(
27464
+ const commitFooterDrag = (0, import_react24.useCallback)(
27301
27465
  (clientX, clientY) => {
27302
27466
  const session = footerDragRef.current;
27303
27467
  if (!session) {
@@ -27469,7 +27633,7 @@ function OhhwellsBridge() {
27469
27633
  [clearFooterDragVisuals, resolveHrefKeyElement, resyncSelectedNavigationItem]
27470
27634
  );
27471
27635
  commitFooterDragRef.current = commitFooterDrag;
27472
- const startFooterLinkDrag = (0, import_react23.useCallback)(
27636
+ const startFooterLinkDrag = (0, import_react24.useCallback)(
27473
27637
  (anchor, clientX, clientY, wasSelected) => {
27474
27638
  const hrefKey = anchor.getAttribute("data-ohw-href-key");
27475
27639
  if (!hrefKey) return false;
@@ -27505,7 +27669,7 @@ function OhhwellsBridge() {
27505
27669
  },
27506
27670
  [beginFooterDrag]
27507
27671
  );
27508
- const startFooterColumnDrag = (0, import_react23.useCallback)(
27672
+ const startFooterColumnDrag = (0, import_react24.useCallback)(
27509
27673
  (columnEl, clientX, clientY, wasSelected) => {
27510
27674
  const columns = listFooterColumns(columnEl);
27511
27675
  const idx = columns.indexOf(columnEl);
@@ -27525,7 +27689,7 @@ function OhhwellsBridge() {
27525
27689
  },
27526
27690
  [beginFooterDrag]
27527
27691
  );
27528
- const persistButtonCollectionDrag = (0, import_react23.useCallback)(
27692
+ const persistButtonCollectionDrag = (0, import_react24.useCallback)(
27529
27693
  (button, clientX) => {
27530
27694
  const insertIndex = buttonDropInsertIndexRef.current;
27531
27695
  if (insertIndex != null) insertButtonAtCollectionIndex(button, insertIndex);
@@ -27549,7 +27713,7 @@ function OhhwellsBridge() {
27549
27713
  },
27550
27714
  [postToParent2]
27551
27715
  );
27552
- const refreshButtonDragVisuals = (0, import_react23.useCallback)((button, clientX, clientY) => {
27716
+ const refreshButtonDragVisuals = (0, import_react24.useCallback)((button, clientX, clientY) => {
27553
27717
  const collection = buttonCollectionOf(button);
27554
27718
  if (!collection) {
27555
27719
  setButtonDropSlots([]);
@@ -27566,7 +27730,7 @@ function OhhwellsBridge() {
27566
27730
  setDraggedItemRect(button.getBoundingClientRect());
27567
27731
  if (selectedElRef.current === button) setToolbarRect(button.getBoundingClientRect());
27568
27732
  }, []);
27569
- const handleItemDragStart = (0, import_react23.useCallback)(
27733
+ const handleItemDragStart = (0, import_react24.useCallback)(
27570
27734
  (e) => {
27571
27735
  const selected = selectedElRef.current;
27572
27736
  if (!selected) {
@@ -27597,7 +27761,7 @@ function OhhwellsBridge() {
27597
27761
  },
27598
27762
  [startFooterColumnDrag, startFooterLinkDrag, startNavLinkDrag, refreshButtonDragVisuals]
27599
27763
  );
27600
- const handleItemDragEnd = (0, import_react23.useCallback)(
27764
+ const handleItemDragEnd = (0, import_react24.useCallback)(
27601
27765
  (e) => {
27602
27766
  const collectionButton = buttonCollectionDragRef.current;
27603
27767
  if (collectionButton) {
@@ -27628,7 +27792,7 @@ function OhhwellsBridge() {
27628
27792
  },
27629
27793
  [commitFooterDrag, commitNavDrag, navDragRef, persistButtonCollectionDrag]
27630
27794
  );
27631
- const handleItemChromePointerDown = (0, import_react23.useCallback)((e) => {
27795
+ const handleItemChromePointerDown = (0, import_react24.useCallback)((e) => {
27632
27796
  if (e.button !== 0) return;
27633
27797
  const selected = selectedElRef.current;
27634
27798
  if (!selected) return;
@@ -27669,7 +27833,7 @@ function OhhwellsBridge() {
27669
27833
  }
27670
27834
  if (armNavPressFromChrome(selected, e.clientX, e.clientY, e.pointerId)) return;
27671
27835
  }, [armNavPressFromChrome]);
27672
- const handleItemChromeClick = (0, import_react23.useCallback)((clientX, clientY) => {
27836
+ const handleItemChromeClick = (0, import_react24.useCallback)((clientX, clientY) => {
27673
27837
  if (suppressNextClickRef.current || Date.now() < suppressClickUntilRef.current) {
27674
27838
  suppressNextClickRef.current = false;
27675
27839
  return;
@@ -27682,7 +27846,7 @@ function OhhwellsBridge() {
27682
27846
  }, []);
27683
27847
  reselectNavigationItemRef.current = reselectNavigationItem;
27684
27848
  commitNavigationTextEditRef.current = commitNavigationTextEdit;
27685
- const select = (0, import_react23.useCallback)((anchor) => {
27849
+ const select = (0, import_react24.useCallback)((anchor) => {
27686
27850
  if (!isNavigationItem2(anchor)) return;
27687
27851
  if (activeElRef.current) deactivate();
27688
27852
  clearSocialSelectionRef.current();
@@ -27759,7 +27923,7 @@ function OhhwellsBridge() {
27759
27923
  setLogoSizeDraft(null);
27760
27924
  }
27761
27925
  }, [deactivate, markSelected]);
27762
- const selectFrame = (0, import_react23.useCallback)((el) => {
27926
+ const selectFrame = (0, import_react24.useCallback)((el) => {
27763
27927
  if (!isNavigationContainer(el)) return;
27764
27928
  if (activeElRef.current) deactivate();
27765
27929
  aiSectionApiRef.current?.selectFromElement(el);
@@ -27800,7 +27964,7 @@ function OhhwellsBridge() {
27800
27964
  setFloatingPanelPos(null);
27801
27965
  setLogoSizeDraft(null);
27802
27966
  }, [deactivate, markSelected, postToParent2]);
27803
- const selectLogo = (0, import_react23.useCallback)(
27967
+ const selectLogo = (0, import_react24.useCallback)(
27804
27968
  (logoEl) => {
27805
27969
  if (activeElRef.current) deactivate();
27806
27970
  selectedElRef.current = logoEl;
@@ -27829,7 +27993,7 @@ function OhhwellsBridge() {
27829
27993
  },
27830
27994
  [deactivate, markSelected]
27831
27995
  );
27832
- const openLogoSizePanel = (0, import_react23.useCallback)((logoEl) => {
27996
+ const openLogoSizePanel = (0, import_react24.useCallback)((logoEl) => {
27833
27997
  const placement = getLogoPlacement(logoEl);
27834
27998
  const draft = readLogoSizeState(editContentRef.current, placement);
27835
27999
  setLogoSizeDraft(draft);
@@ -27842,7 +28006,7 @@ function OhhwellsBridge() {
27842
28006
  placement
27843
28007
  });
27844
28008
  }, []);
27845
- const openSocialsDisplayPanel = (0, import_react23.useCallback)((row) => {
28009
+ const openSocialsDisplayPanel = (0, import_react24.useCallback)((row) => {
27846
28010
  setFloatingPanelPos(null);
27847
28011
  setParentScrollSnap(parentScrollRef.current);
27848
28012
  setFloatingPanel({
@@ -27853,7 +28017,7 @@ function OhhwellsBridge() {
27853
28017
  row
27854
28018
  });
27855
28019
  }, []);
27856
- const rememberButtonTokens = (0, import_react23.useCallback)(
28020
+ const rememberButtonTokens = (0, import_react24.useCallback)(
27857
28021
  (content, tokens, nodes) => {
27858
28022
  if (nodes.length === 0) return content;
27859
28023
  const next = { ...content };
@@ -27864,7 +28028,7 @@ function OhhwellsBridge() {
27864
28028
  },
27865
28029
  [postToParent2]
27866
28030
  );
27867
- const tokensForButton = (0, import_react23.useCallback)(
28031
+ const tokensForButton = (0, import_react24.useCallback)(
27868
28032
  (el, persistFallback = false) => {
27869
28033
  const stored = readStoredStyleTokens(editContentRef.current);
27870
28034
  if (stored) return stored;
@@ -27879,7 +28043,7 @@ function OhhwellsBridge() {
27879
28043
  },
27880
28044
  [rememberButtonTokens]
27881
28045
  );
27882
- const openButtonStylePanel = (0, import_react23.useCallback)(
28046
+ const openButtonStylePanel = (0, import_react24.useCallback)(
27883
28047
  (anchor) => {
27884
28048
  const id = buttonId(anchor);
27885
28049
  if (!id) return;
@@ -27897,7 +28061,7 @@ function OhhwellsBridge() {
27897
28061
  },
27898
28062
  [tokensForButton]
27899
28063
  );
27900
- const applySelectedButtonStyle = (0, import_react23.useCallback)(
28064
+ const applySelectedButtonStyle = (0, import_react24.useCallback)(
27901
28065
  (patch) => {
27902
28066
  const panel = floatingPanelRef.current;
27903
28067
  const id = panel?.kind === "button-style" ? panel.buttonId : null;
@@ -27915,7 +28079,7 @@ function OhhwellsBridge() {
27915
28079
  },
27916
28080
  [postToParent2]
27917
28081
  );
27918
- (0, import_react23.useEffect)(() => {
28082
+ (0, import_react24.useEffect)(() => {
27919
28083
  const onDragOver = (e) => {
27920
28084
  const dragged = buttonCollectionDragRef.current;
27921
28085
  if (!dragged) return;
@@ -27934,11 +28098,11 @@ function OhhwellsBridge() {
27934
28098
  document.removeEventListener("drop", onDrop);
27935
28099
  };
27936
28100
  }, [refreshButtonDragVisuals]);
27937
- const isEditModeRef = (0, import_react23.useRef)(false);
27938
- const requestMissingSocialIconsRef = (0, import_react23.useRef)(() => {
28101
+ const isEditModeRef = (0, import_react24.useRef)(false);
28102
+ const requestMissingSocialIconsRef = (0, import_react24.useRef)(() => {
27939
28103
  });
27940
- const askedSocialIconsRef = (0, import_react23.useRef)(/* @__PURE__ */ new Set());
27941
- const requestMissingSocialIcons = (0, import_react23.useCallback)(() => {
28104
+ const askedSocialIconsRef = (0, import_react24.useRef)(/* @__PURE__ */ new Set());
28105
+ const requestMissingSocialIcons = (0, import_react24.useCallback)(() => {
27942
28106
  const items = Array.from(document.querySelectorAll(`[${SOCIALS_ROW_ATTR}]`)).filter((row) => socialsDisplayFor(row, editContentRef.current).icon).flatMap((row) => {
27943
28107
  const missing = socialsMissingIcons(row);
27944
28108
  listSocialItems(row).forEach((item) => ensureIconSlot(item));
@@ -27950,7 +28114,7 @@ function OhhwellsBridge() {
27950
28114
  }, []);
27951
28115
  requestMissingSocialIconsRef.current = requestMissingSocialIcons;
27952
28116
  isEditModeRef.current = isEditMode;
27953
- const changeSocialsDisplay = (0, import_react23.useCallback)(
28117
+ const changeSocialsDisplay = (0, import_react24.useCallback)(
27954
28118
  (row, next) => {
27955
28119
  if (next.icon) {
27956
28120
  const missing = socialsMissingIcons(row);
@@ -27974,19 +28138,19 @@ function OhhwellsBridge() {
27974
28138
  },
27975
28139
  []
27976
28140
  );
27977
- const closeFloatingPanelOnly = (0, import_react23.useCallback)(() => {
28141
+ const closeFloatingPanelOnly = (0, import_react24.useCallback)(() => {
27978
28142
  setFloatingPanel(null);
27979
28143
  setFloatingPanelPos(null);
27980
28144
  setLogoSizeDraft(null);
27981
28145
  }, []);
27982
28146
  closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
27983
- const closeFloatingPanelAndDeselect = (0, import_react23.useCallback)(() => {
28147
+ const closeFloatingPanelAndDeselect = (0, import_react24.useCallback)(() => {
27984
28148
  setFloatingPanel(null);
27985
28149
  setFloatingPanelPos(null);
27986
28150
  setLogoSizeDraft(null);
27987
28151
  deselectRef.current();
27988
28152
  }, []);
27989
- (0, import_react23.useEffect)(() => {
28153
+ (0, import_react24.useEffect)(() => {
27990
28154
  const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
27991
28155
  if (!session || !logoSizeDraft) {
27992
28156
  postToParentRef.current({ type: "ow:logo-size-panel", open: false });
@@ -28005,7 +28169,7 @@ function OhhwellsBridge() {
28005
28169
  max: LOGO_SIZE_MAX
28006
28170
  });
28007
28171
  }, [floatingPanel, logoSizeDraft, editorViewport]);
28008
- const persistLogoSizeDraft = (0, import_react23.useCallback)(
28172
+ const persistLogoSizeDraft = (0, import_react24.useCallback)(
28009
28173
  (placement, draft) => {
28010
28174
  const desktopKey = LOGO_SIZE_DESKTOP_KEYS[placement];
28011
28175
  const mobileKey = LOGO_SIZE_MOBILE_KEYS[placement];
@@ -28045,7 +28209,7 @@ function OhhwellsBridge() {
28045
28209
  },
28046
28210
  [postToParent2]
28047
28211
  );
28048
- const activate = (0, import_react23.useCallback)((el, options) => {
28212
+ const activate = (0, import_react24.useCallback)((el, options) => {
28049
28213
  if (activeElRef.current === el) return;
28050
28214
  document.querySelectorAll("[data-ohw-hovered]").forEach((hovered) => {
28051
28215
  hovered.removeAttribute("data-ohw-hovered");
@@ -28143,8 +28307,8 @@ function OhhwellsBridge() {
28143
28307
  openLogoSizePanelRef.current = openLogoSizePanel;
28144
28308
  deselectRef.current = deselect;
28145
28309
  closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
28146
- const lastSiteWideScopeRef = (0, import_react23.useRef)(null);
28147
- (0, import_react23.useEffect)(() => {
28310
+ const lastSiteWideScopeRef = (0, import_react24.useRef)(null);
28311
+ (0, import_react24.useEffect)(() => {
28148
28312
  if (!isEditMode) {
28149
28313
  if (lastSiteWideScopeRef.current !== false) {
28150
28314
  lastSiteWideScopeRef.current = false;
@@ -28170,7 +28334,7 @@ function OhhwellsBridge() {
28170
28334
  isFooterFrameSelection,
28171
28335
  postToParent2
28172
28336
  ]);
28173
- (0, import_react23.useLayoutEffect)(() => {
28337
+ (0, import_react24.useLayoutEffect)(() => {
28174
28338
  if (!subdomain || isEditMode) {
28175
28339
  setFetchState("done");
28176
28340
  return;
@@ -28321,7 +28485,7 @@ function OhhwellsBridge() {
28321
28485
  cancelled = true;
28322
28486
  };
28323
28487
  }, [subdomain, isEditMode]);
28324
- (0, import_react23.useEffect)(() => {
28488
+ (0, import_react24.useEffect)(() => {
28325
28489
  if (!isEditMode) return;
28326
28490
  const resolveIndex = (form, clientY) => {
28327
28491
  const wrappers = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== fieldDragRef.current?.key);
@@ -28362,7 +28526,7 @@ function OhhwellsBridge() {
28362
28526
  window.removeEventListener("drop", onDrop, true);
28363
28527
  };
28364
28528
  }, [buildFieldDropSlots, isEditMode, persistFields, selectField]);
28365
- (0, import_react23.useEffect)(() => {
28529
+ (0, import_react24.useEffect)(() => {
28366
28530
  if (!isEditMode) return;
28367
28531
  const mark = () => document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
28368
28532
  markFormFields(form);
@@ -28374,7 +28538,7 @@ function OhhwellsBridge() {
28374
28538
  });
28375
28539
  return () => observer.disconnect();
28376
28540
  }, [isEditMode, fetchState, pathname]);
28377
- (0, import_react23.useEffect)(() => {
28541
+ (0, import_react24.useEffect)(() => {
28378
28542
  if (!isEditMode) return;
28379
28543
  let saveTimer = null;
28380
28544
  const onInput = (e) => {
@@ -28396,14 +28560,14 @@ function OhhwellsBridge() {
28396
28560
  document.addEventListener("input", onInput, true);
28397
28561
  return () => document.removeEventListener("input", onInput, true);
28398
28562
  }, [isEditMode, persistFields]);
28399
- (0, import_react23.useEffect)(() => {
28563
+ (0, import_react24.useEffect)(() => {
28400
28564
  if (isEditMode || fetchState !== "done") return;
28401
28565
  const content = contentCache.get(subdomain) ?? {};
28402
28566
  document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
28403
28567
  reconcileFieldsFromContent(form, content);
28404
28568
  });
28405
28569
  }, [isEditMode, fetchState, subdomain]);
28406
- (0, import_react23.useEffect)(() => {
28570
+ (0, import_react24.useEffect)(() => {
28407
28571
  if (!isEditMode) return;
28408
28572
  const swallow = (e) => {
28409
28573
  const target = e.target;
@@ -28412,14 +28576,14 @@ function OhhwellsBridge() {
28412
28576
  document.addEventListener("submit", swallow, true);
28413
28577
  return () => document.removeEventListener("submit", swallow, true);
28414
28578
  }, [isEditMode]);
28415
- (0, import_react23.useEffect)(() => {
28579
+ (0, import_react24.useEffect)(() => {
28416
28580
  if (isEditMode || fetchState !== "done") return;
28417
28581
  console.log("env", process.env.NEXT_PUBLIC_FLOWOPS_API_URL);
28418
28582
  const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
28419
28583
  console.log({ apiUrl, subdomain });
28420
28584
  bindPublishedForms(apiUrl, subdomain, contentCache.get(subdomain) ?? {});
28421
28585
  }, [isEditMode, fetchState, subdomain]);
28422
- (0, import_react23.useEffect)(() => {
28586
+ (0, import_react24.useEffect)(() => {
28423
28587
  if (!subdomain || isEditMode) return;
28424
28588
  let debounceTimer = null;
28425
28589
  let observer = null;
@@ -28536,16 +28700,16 @@ function OhhwellsBridge() {
28536
28700
  if (debounceTimer) clearTimeout(debounceTimer);
28537
28701
  };
28538
28702
  }, [subdomain, isEditMode, pathname]);
28539
- (0, import_react23.useLayoutEffect)(() => {
28703
+ (0, import_react24.useLayoutEffect)(() => {
28540
28704
  const el = document.getElementById("ohw-loader");
28541
28705
  if (!el) return;
28542
28706
  const visible = Boolean(subdomain) && fetchState !== "done";
28543
28707
  el.style.display = visible ? "flex" : "none";
28544
28708
  }, [subdomain, fetchState]);
28545
- (0, import_react23.useEffect)(() => {
28709
+ (0, import_react24.useEffect)(() => {
28546
28710
  postToParent2({ type: "ow:navigation", path: pathname });
28547
28711
  }, [pathname, postToParent2]);
28548
- (0, import_react23.useEffect)(() => {
28712
+ (0, import_react24.useEffect)(() => {
28549
28713
  if (!subdomain || isEditMode) return;
28550
28714
  const content = contentCache.get(subdomain);
28551
28715
  if (!content) return;
@@ -28563,7 +28727,7 @@ function OhhwellsBridge() {
28563
28727
  }
28564
28728
  applyAiFooterFromContent(content);
28565
28729
  }, [pathname, subdomain, isEditMode]);
28566
- (0, import_react23.useEffect)(() => {
28730
+ (0, import_react24.useEffect)(() => {
28567
28731
  if (!isEditMode) return;
28568
28732
  if (linkPopoverSessionRef.current?.intent === "add-nav") return;
28569
28733
  if (document.querySelector("[data-ohw-section-picker]")) return;
@@ -28571,12 +28735,12 @@ function OhhwellsBridge() {
28571
28735
  deselectRef.current();
28572
28736
  deactivateRef.current();
28573
28737
  }, [pathname, isEditMode]);
28574
- (0, import_react23.useEffect)(() => {
28738
+ (0, import_react24.useEffect)(() => {
28575
28739
  if (!isEditMode) return;
28576
28740
  initSectionInstancesFromContent(editContentRef.current, pathname);
28577
28741
  initItemInstancesFromContent(editContentRef.current);
28578
28742
  }, [pathname, isEditMode]);
28579
- (0, import_react23.useEffect)(() => {
28743
+ (0, import_react24.useEffect)(() => {
28580
28744
  if (!isEditMode) return;
28581
28745
  const observer = new MutationObserver(() => {
28582
28746
  const drawer = document.querySelector("[data-ohw-nav-drawer]");
@@ -28587,7 +28751,7 @@ function OhhwellsBridge() {
28587
28751
  observer.observe(document.body, { childList: true, subtree: true });
28588
28752
  return () => observer.disconnect();
28589
28753
  }, [isEditMode, pathname]);
28590
- (0, import_react23.useEffect)(() => {
28754
+ (0, import_react24.useEffect)(() => {
28591
28755
  const contentForNav = () => {
28592
28756
  if (isEditMode) return editContentRef.current;
28593
28757
  if (!subdomain) return {};
@@ -28660,7 +28824,7 @@ function OhhwellsBridge() {
28660
28824
  observer?.disconnect();
28661
28825
  };
28662
28826
  }, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
28663
- (0, import_react23.useEffect)(() => {
28827
+ (0, import_react24.useEffect)(() => {
28664
28828
  if (!isEditMode) return;
28665
28829
  let applying = false;
28666
28830
  let rafId = null;
@@ -28698,7 +28862,7 @@ function OhhwellsBridge() {
28698
28862
  observer.disconnect();
28699
28863
  };
28700
28864
  }, [isEditMode, pathname]);
28701
- (0, import_react23.useEffect)(() => {
28865
+ (0, import_react24.useEffect)(() => {
28702
28866
  if (!isEditMode) return;
28703
28867
  let lastPosted = 0;
28704
28868
  const measure = () => {
@@ -28742,7 +28906,7 @@ function OhhwellsBridge() {
28742
28906
  window.removeEventListener("resize", handleResize);
28743
28907
  };
28744
28908
  }, [pathname, isEditMode, postToParent2]);
28745
- (0, import_react23.useEffect)(() => {
28909
+ (0, import_react24.useEffect)(() => {
28746
28910
  if (isEditMode) return;
28747
28911
  const handleClick = (e) => {
28748
28912
  if (!isPlainLeftClick(e)) return;
@@ -28756,7 +28920,7 @@ function OhhwellsBridge() {
28756
28920
  document.addEventListener("click", handleClick, true);
28757
28921
  return () => document.removeEventListener("click", handleClick, true);
28758
28922
  }, [isEditMode, router, pathname]);
28759
- (0, import_react23.useEffect)(() => {
28923
+ (0, import_react24.useEffect)(() => {
28760
28924
  if (!isEditMode) {
28761
28925
  editStylesRef.current?.base.remove();
28762
28926
  editStylesRef.current?.forceHover.remove();
@@ -30986,6 +31150,31 @@ function OhhwellsBridge() {
30986
31150
  postAiSectionsChanged();
30987
31151
  };
30988
31152
  window.addEventListener("message", handleAiDeleteSection);
31153
+ const handleAiMoveSection = (e) => {
31154
+ if (e.data?.type !== "ow:ai-move-section") return;
31155
+ const sectionId = typeof e.data.sectionId === "string" ? e.data.sectionId : "";
31156
+ const targetPage = typeof e.data.targetPage === "string" ? e.data.targetPage : "";
31157
+ if (!sectionId || !targetPage) return;
31158
+ const previous = aiSectionsRef.current;
31159
+ const nextState = moveSectionInState(parseAiSectionsState(previous), sectionId, targetPage);
31160
+ if (!nextState) return;
31161
+ clearInteractionChrome();
31162
+ const nextValue = serializeAiSectionsState(nextState);
31163
+ aiSectionsRef.current = nextValue;
31164
+ applyAiSectionsToDom(nextState);
31165
+ const newHeight = document.body.scrollHeight;
31166
+ if (newHeight > 50) postToParentRef.current({ type: "ow:height", height: newHeight });
31167
+ postToParentRef.current({ type: "ow:change", nodes: [{ key: AI_SECTIONS_KEY, text: nextValue }] });
31168
+ postToParentRef.current({
31169
+ type: "ow:ai-section-moved",
31170
+ sectionId,
31171
+ targetPage,
31172
+ previous,
31173
+ value: nextValue
31174
+ });
31175
+ postAiSectionsChanged();
31176
+ };
31177
+ window.addEventListener("message", handleAiMoveSection);
30989
31178
  const handleAiSetSections = (e) => {
30990
31179
  if (e.data?.type !== "ow:ai-set-sections") return;
30991
31180
  const value = typeof e.data.value === "string" ? e.data.value : "";
@@ -32185,6 +32374,7 @@ function OhhwellsBridge() {
32185
32374
  window.removeEventListener("message", handleAiApplyTree);
32186
32375
  window.removeEventListener("message", handleAiApplyFooter);
32187
32376
  window.removeEventListener("message", handleAiDeleteSection);
32377
+ window.removeEventListener("message", handleAiMoveSection);
32188
32378
  window.removeEventListener("message", handleAiSetSections);
32189
32379
  window.removeEventListener("message", handleAiSetBrand);
32190
32380
  window.removeEventListener("message", handleAiSetStyles);
@@ -32211,7 +32401,7 @@ function OhhwellsBridge() {
32211
32401
  if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
32212
32402
  };
32213
32403
  }, [isEditMode, refreshStateRules]);
32214
- (0, import_react23.useEffect)(() => {
32404
+ (0, import_react24.useEffect)(() => {
32215
32405
  if (!isEditMode) return;
32216
32406
  const THRESHOLD = 10;
32217
32407
  const resolveWasSelected = (el) => {
@@ -32367,7 +32557,7 @@ function OhhwellsBridge() {
32367
32557
  unlockFooterDragInteraction();
32368
32558
  };
32369
32559
  }, [isEditMode]);
32370
- (0, import_react23.useEffect)(() => {
32560
+ (0, import_react24.useEffect)(() => {
32371
32561
  if (!isEditMode) return;
32372
32562
  const THRESHOLD = 10;
32373
32563
  const onPointerDown = (e) => {
@@ -32458,7 +32648,7 @@ function OhhwellsBridge() {
32458
32648
  document.removeEventListener("selectstart", blockSelectStart, true);
32459
32649
  };
32460
32650
  }, [isEditMode, persistButtonCollectionDrag, refreshButtonDragVisuals]);
32461
- (0, import_react23.useEffect)(() => {
32651
+ (0, import_react24.useEffect)(() => {
32462
32652
  const handler = (e) => {
32463
32653
  if (e.data?.type !== "ow:request-schedule-config") return;
32464
32654
  const insertAfterVal = e.data.insertAfter;
@@ -32474,7 +32664,7 @@ function OhhwellsBridge() {
32474
32664
  window.addEventListener("message", handler);
32475
32665
  return () => window.removeEventListener("message", handler);
32476
32666
  }, [processConfigRequest]);
32477
- (0, import_react23.useEffect)(() => {
32667
+ (0, import_react24.useEffect)(() => {
32478
32668
  if (!isEditMode) return;
32479
32669
  document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
32480
32670
  el.removeAttribute("data-ohw-active-state");
@@ -32498,7 +32688,7 @@ function OhhwellsBridge() {
32498
32688
  postToParent2({
32499
32689
  type: "ow:ready",
32500
32690
  version: "1",
32501
- bridgeVersion: "0.1.164",
32691
+ bridgeVersion: "0.1.166",
32502
32692
  path: pathname,
32503
32693
  nodes: collectEditableNodes(editContentRef.current),
32504
32694
  sections
@@ -32510,13 +32700,13 @@ function OhhwellsBridge() {
32510
32700
  clearTimeout(timer);
32511
32701
  };
32512
32702
  }, [pathname, isEditMode, refreshStateRules, postToParent2]);
32513
- (0, import_react23.useEffect)(() => {
32703
+ (0, import_react24.useEffect)(() => {
32514
32704
  scrollToHashSectionWhenReady();
32515
32705
  const onHashChange = () => scrollToHashSectionWhenReady();
32516
32706
  window.addEventListener("hashchange", onHashChange);
32517
32707
  return () => window.removeEventListener("hashchange", onHashChange);
32518
32708
  }, [pathname]);
32519
- const handleCommand = (0, import_react23.useCallback)((cmd) => {
32709
+ const handleCommand = (0, import_react24.useCallback)((cmd) => {
32520
32710
  const el = activeElRef.current;
32521
32711
  const selBefore = window.getSelection();
32522
32712
  let savedOffsets = null;
@@ -32552,7 +32742,7 @@ function OhhwellsBridge() {
32552
32742
  if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
32553
32743
  refreshActiveCommandsRef.current();
32554
32744
  }, []);
32555
- (0, import_react23.useEffect)(() => {
32745
+ (0, import_react24.useEffect)(() => {
32556
32746
  const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
32557
32747
  if (!session || !logoSizeDraft) return;
32558
32748
  const onPanelAction = (e) => {
@@ -32590,7 +32780,7 @@ function OhhwellsBridge() {
32590
32780
  window.addEventListener("message", onPanelAction);
32591
32781
  return () => window.removeEventListener("message", onPanelAction);
32592
32782
  }, [floatingPanel, logoSizeDraft, editorViewport, persistLogoSizeDraft, closeFloatingPanelAndDeselect]);
32593
- const handleStateChange = (0, import_react23.useCallback)((state) => {
32783
+ const handleStateChange = (0, import_react24.useCallback)((state) => {
32594
32784
  if (!activeStateElRef.current) return;
32595
32785
  const el = activeStateElRef.current;
32596
32786
  if (state === "Default") {
@@ -32603,7 +32793,7 @@ function OhhwellsBridge() {
32603
32793
  }
32604
32794
  setToggleState((prev) => prev ? { ...prev, activeState: state } : null);
32605
32795
  }, [deactivate]);
32606
- const reselectAfterLinkPopover = (0, import_react23.useCallback)(
32796
+ const reselectAfterLinkPopover = (0, import_react24.useCallback)(
32607
32797
  (hrefKey) => {
32608
32798
  requestAnimationFrame(() => {
32609
32799
  const el = resolveHrefKeyElement(hrefKey);
@@ -32612,7 +32802,7 @@ function OhhwellsBridge() {
32612
32802
  },
32613
32803
  [resolveHrefKeyElement]
32614
32804
  );
32615
- const closeLinkPopover = (0, import_react23.useCallback)(() => {
32805
+ const closeLinkPopover = (0, import_react24.useCallback)(() => {
32616
32806
  const session = linkPopoverSessionRef.current;
32617
32807
  addNavAfterAnchorRef.current = null;
32618
32808
  setLinkPopover(null);
@@ -32620,9 +32810,9 @@ function OhhwellsBridge() {
32620
32810
  reselectAfterLinkPopover(session.key);
32621
32811
  }
32622
32812
  }, [reselectAfterLinkPopover]);
32623
- const closeLinkPopoverRef = (0, import_react23.useRef)(closeLinkPopover);
32813
+ const closeLinkPopoverRef = (0, import_react24.useRef)(closeLinkPopover);
32624
32814
  closeLinkPopoverRef.current = closeLinkPopover;
32625
- const openLinkPopoverForActive = (0, import_react23.useCallback)(() => {
32815
+ const openLinkPopoverForActive = (0, import_react24.useCallback)(() => {
32626
32816
  const hrefCtx = getHrefKeyFromElement(activeElRef.current);
32627
32817
  if (!hrefCtx) return;
32628
32818
  bumpLinkPopoverGrace();
@@ -32633,7 +32823,7 @@ function OhhwellsBridge() {
32633
32823
  });
32634
32824
  deactivate();
32635
32825
  }, [deactivate]);
32636
- const openLinkPopoverForSelected = (0, import_react23.useCallback)(() => {
32826
+ const openLinkPopoverForSelected = (0, import_react24.useCallback)(() => {
32637
32827
  const anchor = selectedElRef.current;
32638
32828
  if (!anchor) return;
32639
32829
  const key = anchor.getAttribute("data-ohw-href-key");
@@ -32650,7 +32840,7 @@ function OhhwellsBridge() {
32650
32840
  });
32651
32841
  deselect();
32652
32842
  }, [deselect]);
32653
- const handleSelectParent = (0, import_react23.useCallback)(() => {
32843
+ const handleSelectParent = (0, import_react24.useCallback)(() => {
32654
32844
  const selected = selectedElRef.current;
32655
32845
  if (!selected) return;
32656
32846
  if (toolbarVariantRef.current === "select-frame") {
@@ -32677,7 +32867,7 @@ function OhhwellsBridge() {
32677
32867
  }
32678
32868
  deselectRef.current();
32679
32869
  }, []);
32680
- const handleDuplicateSelected = (0, import_react23.useCallback)(() => {
32870
+ const handleDuplicateSelected = (0, import_react24.useCallback)(() => {
32681
32871
  const selected = selectedElRef.current;
32682
32872
  if (!selected || !isNavigationItem2(selected)) return;
32683
32873
  if (isCtaButton(selected)) {
@@ -32846,7 +33036,7 @@ function OhhwellsBridge() {
32846
33036
  });
32847
33037
  }
32848
33038
  }, [postToParent2, tokensForButton]);
32849
- const runPendingDeleteUndo = (0, import_react23.useCallback)(() => {
33039
+ const runPendingDeleteUndo = (0, import_react24.useCallback)(() => {
32850
33040
  const pending = pendingDeleteUndoRef.current;
32851
33041
  if (!pending) return false;
32852
33042
  pendingDeleteUndoRef.current = null;
@@ -32854,7 +33044,7 @@ function OhhwellsBridge() {
32854
33044
  enforceLinkHrefs();
32855
33045
  return true;
32856
33046
  }, []);
32857
- const handleDeleteSelected = (0, import_react23.useCallback)(() => {
33047
+ const handleDeleteSelected = (0, import_react24.useCallback)(() => {
32858
33048
  const selected = selectedElRef.current;
32859
33049
  if (!selected) return false;
32860
33050
  if (isCtaButton(selected)) {
@@ -32916,7 +33106,7 @@ function OhhwellsBridge() {
32916
33106
  }, [postToParent2]);
32917
33107
  handleDeleteSelectedRef.current = handleDeleteSelected;
32918
33108
  runPendingDeleteUndoRef.current = runPendingDeleteUndo;
32919
- const handleLinkPopoverSubmit = (0, import_react23.useCallback)(
33109
+ const handleLinkPopoverSubmit = (0, import_react24.useCallback)(
32920
33110
  (target) => {
32921
33111
  const session = linkPopoverSessionRef.current;
32922
33112
  if (!session) return;
@@ -32982,14 +33172,14 @@ function OhhwellsBridge() {
32982
33172
  const showEditLink = toolbarShowEditLink;
32983
33173
  const currentSections = sectionsByPath[pathname] ?? [];
32984
33174
  linkPopoverOpenRef.current = linkPopover !== null;
32985
- const handleMediaSelect = (0, import_react23.useCallback)((key) => {
33175
+ const handleMediaSelect = (0, import_react24.useCallback)((key) => {
32986
33176
  const el = hoveredImageRef.current?.dataset.ohwKey === key ? hoveredImageRef.current : Array.from(document.querySelectorAll(MEDIA_SELECTOR)).find(
32987
33177
  (m) => (m.dataset.ohwKey ?? "") === key
32988
33178
  ) ?? null;
32989
33179
  if (!el) return;
32990
33180
  selectMediaElementRef.current(el);
32991
33181
  }, []);
32992
- const handleMediaReplace = (0, import_react23.useCallback)(
33182
+ const handleMediaReplace = (0, import_react24.useCallback)(
32993
33183
  (key) => {
32994
33184
  postToParent2({
32995
33185
  type: "ow:image-pick",
@@ -32999,13 +33189,13 @@ function OhhwellsBridge() {
32999
33189
  },
33000
33190
  [postToParent2, mediaHover?.elementType, selectedMedia?.elementType]
33001
33191
  );
33002
- const handleEditCarousel = (0, import_react23.useCallback)(
33192
+ const handleEditCarousel = (0, import_react24.useCallback)(
33003
33193
  (key) => {
33004
33194
  postToParent2({ type: "ow:carousel-open", key, images: readCarouselValue(key) });
33005
33195
  },
33006
33196
  [postToParent2]
33007
33197
  );
33008
- const handleMediaFadeOutComplete = (0, import_react23.useCallback)((key) => {
33198
+ const handleMediaFadeOutComplete = (0, import_react24.useCallback)((key) => {
33009
33199
  setUploadingRects((prev) => {
33010
33200
  if (!(key in prev)) return prev;
33011
33201
  const next = { ...prev };
@@ -33013,7 +33203,7 @@ function OhhwellsBridge() {
33013
33203
  return next;
33014
33204
  });
33015
33205
  }, []);
33016
- const handleVideoSettingsChange = (0, import_react23.useCallback)(
33206
+ const handleVideoSettingsChange = (0, import_react24.useCallback)(
33017
33207
  (key, settings) => {
33018
33208
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
33019
33209
  const video = getVideoEl2(el);
@@ -33727,6 +33917,7 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
33727
33917
  hasMountedContentNodes,
33728
33918
  indexCollectionItems,
33729
33919
  insertFooterHours,
33920
+ isDeadPageHref,
33730
33921
  isEditSessionActive,
33731
33922
  isPlainLeftClick,
33732
33923
  isRenderableFooterTree,
@@ -33738,6 +33929,7 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
33738
33929
  parseAiFooterState,
33739
33930
  parseAiSectionsState,
33740
33931
  parseTarget,
33932
+ planBuildPageSync,
33741
33933
  recordOverriddenPaths,
33742
33934
  releaseTemplateLogoIfReplaced,
33743
33935
  removeFooterBlock,