@ohhwells/bridge 0.1.160 → 0.1.162

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
@@ -115,7 +115,7 @@ __export(index_exports, {
115
115
  module.exports = __toCommonJS(index_exports);
116
116
 
117
117
  // src/OhhwellsBridge.tsx
118
- var import_react21 = __toESM(require("react"), 1);
118
+ var import_react23 = __toESM(require("react"), 1);
119
119
  var import_client3 = require("react-dom/client");
120
120
  var import_react_dom5 = require("react-dom");
121
121
 
@@ -12107,11 +12107,139 @@ function useSavedLinkNavigation(isEditMode) {
12107
12107
  }, [isEditMode, router]);
12108
12108
  }
12109
12109
 
12110
- // src/ui/SchedulingWidget.tsx
12110
+ // src/useNavDropdownToggle.ts
12111
+ var import_react5 = require("react");
12112
+ var import_navigation2 = require("next/navigation");
12113
+ var OPEN_ATTR = "data-ohw-nav-force-open";
12114
+ function parentLinkWithDropdown(target) {
12115
+ const anchor = target?.closest?.("a");
12116
+ const group = anchor?.parentElement;
12117
+ if (!anchor || !group?.matches("[data-ohw-nav-group]:not([data-ohw-nav-dropdown-template])")) {
12118
+ return null;
12119
+ }
12120
+ const hasChildren = group.querySelector(":scope > [data-ohw-nav-children] > [data-ohw-href-key]");
12121
+ return hasChildren ? anchor : null;
12122
+ }
12123
+ function closeAll(except) {
12124
+ document.querySelectorAll(`[${OPEN_ATTR}]`).forEach((group) => {
12125
+ if (group === except) return;
12126
+ group.removeAttribute(OPEN_ATTR);
12127
+ group.querySelector(":scope > a")?.setAttribute("aria-expanded", "false");
12128
+ });
12129
+ }
12130
+ function useNavDropdownToggle(isEditMode) {
12131
+ const pathname = (0, import_navigation2.usePathname)();
12132
+ (0, import_react5.useEffect)(() => {
12133
+ if (isEditMode) return;
12134
+ const onClick = (e) => {
12135
+ if (e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
12136
+ const anchor = parentLinkWithDropdown(e.target);
12137
+ if (!anchor) {
12138
+ const insideOpen = e.target?.closest?.(`[${OPEN_ATTR}]`);
12139
+ const onChildLink = e.target?.closest?.("[data-ohw-nav-children] a");
12140
+ if (!insideOpen || onChildLink) closeAll();
12141
+ return;
12142
+ }
12143
+ e.preventDefault();
12144
+ e.stopPropagation();
12145
+ const group = anchor.parentElement;
12146
+ const open = !group.hasAttribute(OPEN_ATTR);
12147
+ closeAll(group);
12148
+ group.toggleAttribute(OPEN_ATTR, open);
12149
+ anchor.setAttribute("aria-expanded", String(open));
12150
+ };
12151
+ const onKeyDown = (e) => {
12152
+ if (e.key !== "Escape") return;
12153
+ const open = document.querySelector(`[${OPEN_ATTR}] > a`);
12154
+ closeAll();
12155
+ open?.focus();
12156
+ };
12157
+ window.addEventListener("click", onClick, true);
12158
+ window.addEventListener("keydown", onKeyDown);
12159
+ return () => {
12160
+ window.removeEventListener("click", onClick, true);
12161
+ window.removeEventListener("keydown", onKeyDown);
12162
+ };
12163
+ }, [isEditMode]);
12164
+ (0, import_react5.useEffect)(() => {
12165
+ if (!isEditMode) closeAll();
12166
+ }, [pathname, isEditMode]);
12167
+ }
12168
+
12169
+ // src/useHashLinkScroll.ts
12111
12170
  var import_react6 = require("react");
12112
12171
 
12172
+ // src/lib/scroll-to-section.ts
12173
+ var MAX_ATTEMPTS = 12;
12174
+ var RETRY_MS = 100;
12175
+ function getHashSectionId() {
12176
+ if (typeof window === "undefined") return null;
12177
+ const id = window.location.hash.replace(/^#/, "").trim();
12178
+ return id || null;
12179
+ }
12180
+ function scrollToOhwSection(sectionId, behavior = "smooth") {
12181
+ if (!sectionId || typeof document === "undefined") return false;
12182
+ const el = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
12183
+ if (!el) return false;
12184
+ el.scrollIntoView({ behavior, block: "start" });
12185
+ return true;
12186
+ }
12187
+ function scrollToHashSectionWhenReady(behavior = "smooth") {
12188
+ const id = getHashSectionId();
12189
+ if (!id) return;
12190
+ let attempt = 0;
12191
+ const tick = () => {
12192
+ if (scrollToOhwSection(id, behavior)) return;
12193
+ attempt += 1;
12194
+ if (attempt < MAX_ATTEMPTS) window.setTimeout(tick, RETRY_MS);
12195
+ };
12196
+ tick();
12197
+ }
12198
+ function scrollToOhwSectionAfterNavigation(sectionId, behavior = "smooth") {
12199
+ let attempt = 0;
12200
+ const tick = () => {
12201
+ if (getHashSectionId() === sectionId && scrollToOhwSection(sectionId, behavior)) return;
12202
+ attempt += 1;
12203
+ if (attempt < MAX_ATTEMPTS) window.setTimeout(tick, RETRY_MS);
12204
+ };
12205
+ window.setTimeout(tick, 0);
12206
+ }
12207
+
12208
+ // src/useHashLinkScroll.ts
12209
+ function samePageSectionId(anchor) {
12210
+ const href = anchor.getAttribute("href");
12211
+ if (!href || !href.includes("#")) return null;
12212
+ if (anchor.target !== "" && anchor.target !== "_self") return null;
12213
+ let url;
12214
+ try {
12215
+ url = new URL(href, window.location.href);
12216
+ } catch {
12217
+ return null;
12218
+ }
12219
+ if (url.origin !== window.location.origin || url.pathname !== window.location.pathname) return null;
12220
+ const id = decodeURIComponent(url.hash.replace(/^#/, "")).trim();
12221
+ return id || null;
12222
+ }
12223
+ function useHashLinkScroll(isEditMode) {
12224
+ (0, import_react6.useEffect)(() => {
12225
+ if (isEditMode) return;
12226
+ const onClick = (e) => {
12227
+ if (e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
12228
+ const anchor = e.target?.closest?.("a");
12229
+ if (!anchor) return;
12230
+ const id = samePageSectionId(anchor);
12231
+ if (id) scrollToOhwSectionAfterNavigation(id);
12232
+ };
12233
+ window.addEventListener("click", onClick, true);
12234
+ return () => window.removeEventListener("click", onClick, true);
12235
+ }, [isEditMode]);
12236
+ }
12237
+
12238
+ // src/ui/SchedulingWidget.tsx
12239
+ var import_react8 = require("react");
12240
+
12113
12241
  // src/ui/EmailCaptureModal.tsx
12114
- var import_react5 = require("react");
12242
+ var import_react7 = require("react");
12115
12243
  var import_radix_ui = require("radix-ui");
12116
12244
  var import_jsx_runtime4 = require("react/jsx-runtime");
12117
12245
  var isValidEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
@@ -12141,11 +12269,11 @@ function Spinner() {
12141
12269
  );
12142
12270
  }
12143
12271
  function EmailCaptureModal({ title, subtitle, onSubmit, onClose }) {
12144
- const [email, setEmail] = (0, import_react5.useState)("");
12145
- const [submittedEmail, setSubmittedEmail] = (0, import_react5.useState)("");
12146
- const [loading, setLoading] = (0, import_react5.useState)(false);
12147
- const [success, setSuccess] = (0, import_react5.useState)(false);
12148
- const [error, setError] = (0, import_react5.useState)(null);
12272
+ const [email, setEmail] = (0, import_react7.useState)("");
12273
+ const [submittedEmail, setSubmittedEmail] = (0, import_react7.useState)("");
12274
+ const [loading, setLoading] = (0, import_react7.useState)(false);
12275
+ const [success, setSuccess] = (0, import_react7.useState)(false);
12276
+ const [error, setError] = (0, import_react7.useState)(null);
12149
12277
  const isBook = title === "Confirm your spot";
12150
12278
  const handleSubmit = async () => {
12151
12279
  const trimmed = email.trim();
@@ -12412,21 +12540,21 @@ function LoadingSkeleton() {
12412
12540
  ] });
12413
12541
  }
12414
12542
  function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal }) {
12415
- const todayMs = (0, import_react6.useMemo)(() => {
12543
+ const todayMs = (0, import_react8.useMemo)(() => {
12416
12544
  const d = /* @__PURE__ */ new Date();
12417
12545
  d.setHours(0, 0, 0, 0);
12418
12546
  return d.getTime();
12419
12547
  }, []);
12420
- const scrollRef = (0, import_react6.useRef)(null);
12421
- const [canScrollLeft, setCanScrollLeft] = (0, import_react6.useState)(false);
12422
- const [canScrollRight, setCanScrollRight] = (0, import_react6.useState)(false);
12548
+ const scrollRef = (0, import_react8.useRef)(null);
12549
+ const [canScrollLeft, setCanScrollLeft] = (0, import_react8.useState)(false);
12550
+ const [canScrollRight, setCanScrollRight] = (0, import_react8.useState)(false);
12423
12551
  const updateScrollState = () => {
12424
12552
  const el = scrollRef.current;
12425
12553
  if (!el) return;
12426
12554
  setCanScrollLeft(el.scrollLeft > 0);
12427
12555
  setCanScrollRight(el.scrollLeft + el.clientWidth < el.scrollWidth - 1);
12428
12556
  };
12429
- (0, import_react6.useEffect)(() => {
12557
+ (0, import_react8.useEffect)(() => {
12430
12558
  const el = scrollRef.current;
12431
12559
  if (!el) return;
12432
12560
  updateScrollState();
@@ -12441,9 +12569,9 @@ function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal
12441
12569
  const scroll = (dir) => {
12442
12570
  scrollRef.current?.scrollBy({ left: dir === "left" ? -216 : 216, behavior: "smooth" });
12443
12571
  };
12444
- const isDragging = (0, import_react6.useRef)(false);
12445
- const dragStartX = (0, import_react6.useRef)(0);
12446
- const dragStartScrollLeft = (0, import_react6.useRef)(0);
12572
+ const isDragging = (0, import_react8.useRef)(false);
12573
+ const dragStartX = (0, import_react8.useRef)(0);
12574
+ const dragStartScrollLeft = (0, import_react8.useRef)(0);
12447
12575
  const onDragStart = (e) => {
12448
12576
  if (!scrollRef.current) return;
12449
12577
  isDragging.current = true;
@@ -12463,14 +12591,14 @@ function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal
12463
12591
  scrollRef.current.style.cursor = "grab";
12464
12592
  scrollRef.current.style.userSelect = "";
12465
12593
  };
12466
- const datesWithClasses = (0, import_react6.useMemo)(
12594
+ const datesWithClasses = (0, import_react8.useMemo)(
12467
12595
  () => new Set(dates.map(
12468
12596
  (d, i) => schedule.classes?.some((c) => classRunsOnDate(c, d, schedule.type)) ? i : -1
12469
12597
  ).filter((i) => i >= 0)),
12470
12598
  [dates, schedule]
12471
12599
  );
12472
12600
  const selectedDate = dates[selectedIdx];
12473
- const selectedClasses = (0, import_react6.useMemo)(
12601
+ const selectedClasses = (0, import_react8.useMemo)(
12474
12602
  () => (schedule.classes ?? []).filter((c) => selectedDate && classRunsOnDate(c, selectedDate, schedule.type)),
12475
12603
  [schedule, selectedDate]
12476
12604
  );
@@ -12655,16 +12783,16 @@ function CalendarFoldIcon() {
12655
12783
  );
12656
12784
  }
12657
12785
  function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAfter: insertAfterProp }) {
12658
- const autoId = (0, import_react6.useId)();
12786
+ const autoId = (0, import_react8.useId)();
12659
12787
  const insertAfter = insertAfterProp ?? autoId;
12660
- const [schedule, setSchedule] = (0, import_react6.useState)(null);
12661
- const [loading, setLoading] = (0, import_react6.useState)(initialScheduleId !== null);
12662
- const [inEditor, setInEditor] = (0, import_react6.useState)(false);
12663
- const [isHovered, setIsHovered] = (0, import_react6.useState)(false);
12664
- const [modalState, setModalState] = (0, import_react6.useState)(null);
12665
- const switchScheduleIdRef = (0, import_react6.useRef)(null);
12666
- const liveScheduleIdRef = (0, import_react6.useRef)(null);
12667
- const refetchLiveSchedule = (0, import_react6.useCallback)(async () => {
12788
+ const [schedule, setSchedule] = (0, import_react8.useState)(null);
12789
+ const [loading, setLoading] = (0, import_react8.useState)(initialScheduleId !== null);
12790
+ const [inEditor, setInEditor] = (0, import_react8.useState)(false);
12791
+ const [isHovered, setIsHovered] = (0, import_react8.useState)(false);
12792
+ const [modalState, setModalState] = (0, import_react8.useState)(null);
12793
+ const switchScheduleIdRef = (0, import_react8.useRef)(null);
12794
+ const liveScheduleIdRef = (0, import_react8.useRef)(null);
12795
+ const refetchLiveSchedule = (0, import_react8.useCallback)(async () => {
12668
12796
  const id = liveScheduleIdRef.current;
12669
12797
  if (!id) return;
12670
12798
  try {
@@ -12674,7 +12802,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
12674
12802
  } catch {
12675
12803
  }
12676
12804
  }, []);
12677
- const dates = (0, import_react6.useMemo)(() => {
12805
+ const dates = (0, import_react8.useMemo)(() => {
12678
12806
  const today = /* @__PURE__ */ new Date();
12679
12807
  today.setHours(0, 0, 0, 0);
12680
12808
  return Array.from({ length: 14 }, (_, i) => {
@@ -12683,8 +12811,8 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
12683
12811
  return d;
12684
12812
  });
12685
12813
  }, []);
12686
- const [selectedIdx, setSelectedIdx] = (0, import_react6.useState)(0);
12687
- (0, import_react6.useEffect)(() => {
12814
+ const [selectedIdx, setSelectedIdx] = (0, import_react8.useState)(0);
12815
+ (0, import_react8.useEffect)(() => {
12688
12816
  if (!schedule?.classes) return;
12689
12817
  for (let i = 0; i < dates.length; i++) {
12690
12818
  if (schedule.classes.some((c) => classRunsOnDate(c, dates[i], schedule.type))) {
@@ -12693,7 +12821,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
12693
12821
  }
12694
12822
  }
12695
12823
  }, [schedule, dates]);
12696
- (0, import_react6.useEffect)(() => {
12824
+ (0, import_react8.useEffect)(() => {
12697
12825
  if (typeof window === "undefined") return;
12698
12826
  const onVisible = () => {
12699
12827
  if (!document.hidden) void refetchLiveSchedule();
@@ -12705,7 +12833,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
12705
12833
  document.removeEventListener("visibilitychange", onVisible);
12706
12834
  };
12707
12835
  }, [refetchLiveSchedule]);
12708
- (0, import_react6.useEffect)(() => {
12836
+ (0, import_react8.useEffect)(() => {
12709
12837
  if (typeof window === "undefined") return;
12710
12838
  const isInEditor = window.self !== window.top;
12711
12839
  setInEditor(isInEditor);
@@ -16460,7 +16588,7 @@ var CustomToolbarButton = React5.forwardRef(
16460
16588
  CustomToolbarButton.displayName = "CustomToolbarButton";
16461
16589
 
16462
16590
  // src/ui/item-action-toolbar.tsx
16463
- var import_react7 = require("react");
16591
+ var import_react9 = require("react");
16464
16592
  var import_lucide_react3 = require("lucide-react");
16465
16593
 
16466
16594
  // src/ui/dropdown-menu.tsx
@@ -16645,7 +16773,7 @@ function ItemActionToolbar({
16645
16773
  headingVisible = null,
16646
16774
  onHeadingVisibleChange
16647
16775
  }) {
16648
- const [moreOpen, setMoreOpen] = (0, import_react7.useState)(false);
16776
+ const [moreOpen, setMoreOpen] = (0, import_react9.useState)(false);
16649
16777
  const showDropdownToggle = dropdownOpen !== null && dropdownOpen !== void 0;
16650
16778
  const showHeadingToggle = headingVisible !== null && headingVisible !== void 0;
16651
16779
  const headingTooltip = headingVisible ? "Hide heading" : "Show heading";
@@ -16853,7 +16981,7 @@ function ItemActionToolbar({
16853
16981
  }
16854
16982
 
16855
16983
  // src/ui/item-interaction-layer.tsx
16856
- var import_react8 = require("react");
16984
+ var import_react10 = require("react");
16857
16985
  var import_react_dom3 = require("react-dom");
16858
16986
  var import_jsx_runtime14 = require("react/jsx-runtime");
16859
16987
  var PRIMARY = "var(--ohw-primary, #0885FE)";
@@ -16910,8 +17038,8 @@ function ClampedToolbarSlot({
16910
17038
  align = "center",
16911
17039
  children
16912
17040
  }) {
16913
- const slotRef = (0, import_react8.useRef)(null);
16914
- (0, import_react8.useLayoutEffect)(() => {
17041
+ const slotRef = (0, import_react10.useRef)(null);
17042
+ (0, import_react10.useLayoutEffect)(() => {
16915
17043
  const slot = slotRef.current;
16916
17044
  if (!slot) return;
16917
17045
  const clamp = () => {
@@ -16974,15 +17102,15 @@ function DetachedBelowToolbarSlot({
16974
17102
  belowEl,
16975
17103
  children
16976
17104
  }) {
16977
- const slotRef = (0, import_react8.useRef)(null);
16978
- const [anchorBottom, setAnchorBottom] = (0, import_react8.useState)(belowRect.bottom);
16979
- const [portalTarget] = (0, import_react8.useState)(
17105
+ const slotRef = (0, import_react10.useRef)(null);
17106
+ const [anchorBottom, setAnchorBottom] = (0, import_react10.useState)(belowRect.bottom);
17107
+ const [portalTarget] = (0, import_react10.useState)(
16980
17108
  () => typeof document === "undefined" ? null : document.querySelector("[data-ohw-bridge-root]") ?? document.body
16981
17109
  );
16982
- (0, import_react8.useLayoutEffect)(() => {
17110
+ (0, import_react10.useLayoutEffect)(() => {
16983
17111
  setAnchorBottom(belowRect.bottom);
16984
17112
  }, [belowRect.bottom, belowRect.height, belowRect.top]);
16985
- (0, import_react8.useLayoutEffect)(() => {
17113
+ (0, import_react10.useLayoutEffect)(() => {
16986
17114
  const slot = slotRef.current;
16987
17115
  if (!slot) return;
16988
17116
  const sync = () => {
@@ -17063,8 +17191,8 @@ function ItemInteractionLayer({
17063
17191
  hidden = false,
17064
17192
  className
17065
17193
  }) {
17066
- const localRef = (0, import_react8.useRef)(null);
17067
- (0, import_react8.useLayoutEffect)(() => {
17194
+ const localRef = (0, import_react10.useRef)(null);
17195
+ (0, import_react10.useLayoutEffect)(() => {
17068
17196
  const node = localRef.current;
17069
17197
  if (!node) return;
17070
17198
  node.style.display = hidden ? "none" : "block";
@@ -17339,7 +17467,7 @@ function apiBase() {
17339
17467
  function bridgeVersion() {
17340
17468
  try {
17341
17469
  if (true) {
17342
- return "0.1.160";
17470
+ return "0.1.162";
17343
17471
  }
17344
17472
  } catch {
17345
17473
  }
@@ -17353,7 +17481,7 @@ function stampBridgeVersionOnDocument() {
17353
17481
  return;
17354
17482
  }
17355
17483
  try {
17356
- const v = true ? "0.1.160" : "";
17484
+ const v = true ? "0.1.162" : "";
17357
17485
  if (v) {
17358
17486
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
17359
17487
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -18260,7 +18388,7 @@ function CarouselOverlay({
18260
18388
  }
18261
18389
 
18262
18390
  // src/ui/ai-section/AiSectionOverlay.tsx
18263
- var import_react9 = require("react");
18391
+ var import_react11 = require("react");
18264
18392
  var import_lucide_react7 = require("lucide-react");
18265
18393
 
18266
18394
  // src/lib/ai-change-highlight.ts
@@ -18355,8 +18483,8 @@ function readRect(instanceId) {
18355
18483
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
18356
18484
  }
18357
18485
  function useLiveSectionRect(sectionId) {
18358
- const [rect, setRect] = (0, import_react9.useState)(null);
18359
- (0, import_react9.useEffect)(() => {
18486
+ const [rect, setRect] = (0, import_react11.useState)(null);
18487
+ (0, import_react11.useEffect)(() => {
18360
18488
  if (!sectionId) {
18361
18489
  setRect(null);
18362
18490
  return;
@@ -18395,8 +18523,8 @@ function readNavToggleRect() {
18395
18523
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
18396
18524
  }
18397
18525
  function useLiveNavToggleHole(active) {
18398
- const [rect, setRect] = (0, import_react9.useState)(null);
18399
- (0, import_react9.useEffect)(() => {
18526
+ const [rect, setRect] = (0, import_react11.useState)(null);
18527
+ (0, import_react11.useEffect)(() => {
18400
18528
  if (!active) {
18401
18529
  setRect(null);
18402
18530
  return;
@@ -18458,7 +18586,7 @@ function ReviewButton({
18458
18586
  background,
18459
18587
  color
18460
18588
  }) {
18461
- const [hover, setHover] = (0, import_react9.useState)(false);
18589
+ const [hover, setHover] = (0, import_react11.useState)(false);
18462
18590
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { style: { position: "relative" }, children: [
18463
18591
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
18464
18592
  "button",
@@ -18513,17 +18641,17 @@ function AiSectionOverlay({
18513
18641
  apiRef,
18514
18642
  onSelectionChange
18515
18643
  }) {
18516
- const [selectedId, setSelectedId] = (0, import_react9.useState)(null);
18517
- const [reviewId, setReviewId] = (0, import_react9.useState)(null);
18518
- const [reviewButtonsHidden, setReviewButtonsHidden] = (0, import_react9.useState)(false);
18519
- const reviewIdRef = (0, import_react9.useRef)(null);
18644
+ const [selectedId, setSelectedId] = (0, import_react11.useState)(null);
18645
+ const [reviewId, setReviewId] = (0, import_react11.useState)(null);
18646
+ const [reviewButtonsHidden, setReviewButtonsHidden] = (0, import_react11.useState)(false);
18647
+ const reviewIdRef = (0, import_react11.useRef)(null);
18520
18648
  reviewIdRef.current = reviewId;
18521
- const selectedIdRef = (0, import_react9.useRef)(null);
18649
+ const selectedIdRef = (0, import_react11.useRef)(null);
18522
18650
  selectedIdRef.current = selectedId;
18523
- (0, import_react9.useEffect)(() => {
18651
+ (0, import_react11.useEffect)(() => {
18524
18652
  onSelectionChange?.(selectedId);
18525
18653
  }, [selectedId, onSelectionChange]);
18526
- const report = (0, import_react9.useCallback)(
18654
+ const report = (0, import_react11.useCallback)(
18527
18655
  (el) => {
18528
18656
  const labelSrc = el ? sectionElementOf(el) : null;
18529
18657
  postToParent2({
@@ -18534,7 +18662,7 @@ function AiSectionOverlay({
18534
18662
  },
18535
18663
  [postToParent2]
18536
18664
  );
18537
- const selectFromElement = (0, import_react9.useCallback)(
18665
+ const selectFromElement = (0, import_react11.useCallback)(
18538
18666
  (el, options) => {
18539
18667
  const inner = el?.closest("[data-ohw-section]") ?? null;
18540
18668
  const sectionEl = inner ? movableUnit(inner) : null;
@@ -18546,7 +18674,7 @@ function AiSectionOverlay({
18546
18674
  },
18547
18675
  [report]
18548
18676
  );
18549
- (0, import_react9.useEffect)(() => {
18677
+ (0, import_react11.useEffect)(() => {
18550
18678
  apiRef.current = {
18551
18679
  selectFromElement,
18552
18680
  handleBackgroundClick: (target, clientX, clientY) => {
@@ -18571,7 +18699,7 @@ function AiSectionOverlay({
18571
18699
  apiRef.current = null;
18572
18700
  };
18573
18701
  }, [apiRef, selectFromElement, report]);
18574
- (0, import_react9.useEffect)(() => {
18702
+ (0, import_react11.useEffect)(() => {
18575
18703
  const onMessage = (e) => {
18576
18704
  if (e.data?.type === "ow:ai-select" && e.data.sectionId === null) {
18577
18705
  selectedIdRef.current = null;
@@ -18596,9 +18724,9 @@ function AiSectionOverlay({
18596
18724
  window.addEventListener("message", onMessage);
18597
18725
  return () => window.removeEventListener("message", onMessage);
18598
18726
  }, [postToParent2]);
18599
- (0, import_react9.useEffect)(() => installAiChangeHighlight(), []);
18600
- const [hoveredId, setHoveredId] = (0, import_react9.useState)(null);
18601
- (0, import_react9.useEffect)(() => {
18727
+ (0, import_react11.useEffect)(() => installAiChangeHighlight(), []);
18728
+ const [hoveredId, setHoveredId] = (0, import_react11.useState)(null);
18729
+ (0, import_react11.useEffect)(() => {
18602
18730
  const onMove = (e) => {
18603
18731
  const t = e.target;
18604
18732
  if (!(t instanceof Element)) return;
@@ -18623,7 +18751,7 @@ function AiSectionOverlay({
18623
18751
  document.documentElement.removeEventListener("mouseleave", onLeave);
18624
18752
  };
18625
18753
  }, []);
18626
- (0, import_react9.useEffect)(() => {
18754
+ (0, import_react11.useEffect)(() => {
18627
18755
  const onKeyDown = (e) => {
18628
18756
  if (e.key !== "Escape") return;
18629
18757
  if (reviewIdRef.current) return;
@@ -18637,7 +18765,7 @@ function AiSectionOverlay({
18637
18765
  document.addEventListener("keydown", onKeyDown);
18638
18766
  return () => document.removeEventListener("keydown", onKeyDown);
18639
18767
  }, [report]);
18640
- const decide = (0, import_react9.useCallback)(
18768
+ const decide = (0, import_react11.useCallback)(
18641
18769
  (decision) => {
18642
18770
  const sectionId = reviewIdRef.current;
18643
18771
  if (!sectionId) return;
@@ -18646,8 +18774,8 @@ function AiSectionOverlay({
18646
18774
  },
18647
18775
  [postToParent2]
18648
18776
  );
18649
- const [navDropdownForceOpen, setNavDropdownForceOpen] = (0, import_react9.useState)(false);
18650
- (0, import_react9.useEffect)(() => {
18777
+ const [navDropdownForceOpen, setNavDropdownForceOpen] = (0, import_react11.useState)(false);
18778
+ (0, import_react11.useEffect)(() => {
18651
18779
  const update = () => {
18652
18780
  setNavDropdownForceOpen(Boolean(document.querySelector("[data-ohw-nav-force-open]")));
18653
18781
  };
@@ -18666,7 +18794,7 @@ function AiSectionOverlay({
18666
18794
  const navToggleHole = useLiveNavToggleHole(Boolean(reviewId));
18667
18795
  const hoverRect = useLiveSectionRect(reviewId || hoveredId === selectedId ? null : hoveredId);
18668
18796
  const showSelectionBorder = Boolean(selectionRect) && !navDropdownForceOpen;
18669
- (0, import_react9.useEffect)(() => {
18797
+ (0, import_react11.useEffect)(() => {
18670
18798
  const selectedEl = activeSelectionId ? findSectionElement(activeSelectionId) : null;
18671
18799
  if (!activeSelectionId || !selectionRect || selectedEl && isChromeSection(selectedEl)) {
18672
18800
  postToParent2({ type: "ow:section-rect", instanceId: null, rect: null });
@@ -18786,7 +18914,7 @@ function AiSectionOverlay({
18786
18914
  }
18787
18915
 
18788
18916
  // src/ui/ai-section/AiMediaStripOverlay.tsx
18789
- var import_react10 = require("react");
18917
+ var import_react12 = require("react");
18790
18918
  var import_lucide_react8 = require("lucide-react");
18791
18919
 
18792
18920
  // src/lib/ai-media-strip-tree.ts
@@ -18948,8 +19076,8 @@ function readRect2(ref) {
18948
19076
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
18949
19077
  }
18950
19078
  function useLiveItemRect(ref) {
18951
- const [rect, setRect] = (0, import_react10.useState)(null);
18952
- (0, import_react10.useEffect)(() => {
19079
+ const [rect, setRect] = (0, import_react12.useState)(null);
19080
+ (0, import_react12.useEffect)(() => {
18953
19081
  if (!ref) {
18954
19082
  setRect(null);
18955
19083
  return;
@@ -19044,8 +19172,8 @@ function Pill({
19044
19172
  );
19045
19173
  }
19046
19174
  function AltInput({ value, onCommit }) {
19047
- const [draft, setDraft] = (0, import_react10.useState)(value);
19048
- (0, import_react10.useEffect)(() => setDraft(value), [value]);
19175
+ const [draft, setDraft] = (0, import_react12.useState)(value);
19176
+ (0, import_react12.useEffect)(() => setDraft(value), [value]);
19049
19177
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
19050
19178
  "div",
19051
19179
  {
@@ -19132,13 +19260,13 @@ var TREATMENTS = [
19132
19260
  ];
19133
19261
  var HTTP_URL_RE = /^https?:\/\/\S+$/i;
19134
19262
  function LinkInput({ value, onCommit }) {
19135
- const [draft, setDraft] = (0, import_react10.useState)(value);
19136
- const [invalid, setInvalid] = (0, import_react10.useState)(false);
19137
- (0, import_react10.useEffect)(() => {
19263
+ const [draft, setDraft] = (0, import_react12.useState)(value);
19264
+ const [invalid, setInvalid] = (0, import_react12.useState)(false);
19265
+ (0, import_react12.useEffect)(() => {
19138
19266
  setDraft(value);
19139
19267
  setInvalid(false);
19140
19268
  }, [value]);
19141
- const commit = () => {
19269
+ const commit2 = () => {
19142
19270
  const next = draft.trim();
19143
19271
  if (next === value) return setInvalid(false);
19144
19272
  if (next && !HTTP_URL_RE.test(next)) return setInvalid(true);
@@ -19183,7 +19311,7 @@ function LinkInput({ value, onCommit }) {
19183
19311
  inputMode: "url",
19184
19312
  value: draft,
19185
19313
  onChange: (e) => setDraft(e.target.value),
19186
- onBlur: commit,
19314
+ onBlur: commit2,
19187
19315
  onKeyDown: (e) => {
19188
19316
  if (e.key === "Enter") e.currentTarget.blur();
19189
19317
  if (e.key === "Escape") {
@@ -19233,7 +19361,7 @@ function MediaStripToolbar({
19233
19361
  const items = mediaStripItems(entry.tree);
19234
19362
  const itemCount = items.length;
19235
19363
  const currentAlt = items[index]?.alt ?? "";
19236
- const currentHref = items[index]?.href ?? "";
19364
+ const currentHref2 = items[index]?.href ?? "";
19237
19365
  const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
19238
19366
  const slots = findMediaStripSlots(entry.tree);
19239
19367
  const variant = slots?.variant === "reel" ? "reel" : "logos";
@@ -19289,10 +19417,10 @@ function MediaStripToolbar({
19289
19417
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "+", onClick: () => onResize(8) })
19290
19418
  ] }),
19291
19419
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AltInput, { value: currentAlt, onCommit: onSetAlt }) }),
19292
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(LinkInput, { value: currentHref, onCommit: (href) => onSetLink(href, currentTarget) }) }),
19293
- currentHref && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19294
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "New tab", active: currentTarget === "new-tab", onClick: () => onSetLink(currentHref, "new-tab") }),
19295
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "Same tab", active: currentTarget === "same-tab", onClick: () => onSetLink(currentHref, "same-tab") })
19420
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(LinkInput, { value: currentHref2, onCommit: (href) => onSetLink(href, currentTarget) }) }),
19421
+ currentHref2 && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19422
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "New tab", active: currentTarget === "new-tab", onClick: () => onSetLink(currentHref2, "new-tab") }),
19423
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "Same tab", active: currentTarget === "same-tab", onClick: () => onSetLink(currentHref2, "same-tab") })
19296
19424
  ] }),
19297
19425
  /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19298
19426
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "Change Image", onClick: onChangeImage }),
@@ -19323,13 +19451,13 @@ function AiMediaStripOverlay({
19323
19451
  applyTreeLocalRef,
19324
19452
  clearInteractionChromeRef
19325
19453
  }) {
19326
- const [hover, setHover] = (0, import_react10.useState)(null);
19327
- const [active, setActive] = (0, import_react10.useState)(null);
19328
- const [pending, setPending] = (0, import_react10.useState)(false);
19329
- const [error, setError] = (0, import_react10.useState)(null);
19330
- const activeRef = (0, import_react10.useRef)(null);
19454
+ const [hover, setHover] = (0, import_react12.useState)(null);
19455
+ const [active, setActive] = (0, import_react12.useState)(null);
19456
+ const [pending, setPending] = (0, import_react12.useState)(false);
19457
+ const [error, setError] = (0, import_react12.useState)(null);
19458
+ const activeRef = (0, import_react12.useRef)(null);
19331
19459
  activeRef.current = active;
19332
- (0, import_react10.useEffect)(() => {
19460
+ (0, import_react12.useEffect)(() => {
19333
19461
  const onMove = (e) => {
19334
19462
  const t = e.target;
19335
19463
  if (!(t instanceof HTMLElement)) return;
@@ -19359,7 +19487,7 @@ function AiMediaStripOverlay({
19359
19487
  document.documentElement.removeEventListener("mouseleave", onLeave);
19360
19488
  };
19361
19489
  }, []);
19362
- (0, import_react10.useEffect)(() => {
19490
+ (0, import_react12.useEffect)(() => {
19363
19491
  const onClick = (e) => {
19364
19492
  const current = activeRef.current;
19365
19493
  if (!current) return;
@@ -19374,7 +19502,7 @@ function AiMediaStripOverlay({
19374
19502
  document.addEventListener("click", onClick, true);
19375
19503
  return () => document.removeEventListener("click", onClick, true);
19376
19504
  }, []);
19377
- (0, import_react10.useEffect)(() => {
19505
+ (0, import_react12.useEffect)(() => {
19378
19506
  const onBlur = () => {
19379
19507
  if (!activeRef.current) return;
19380
19508
  setActive(null);
@@ -19383,7 +19511,7 @@ function AiMediaStripOverlay({
19383
19511
  window.addEventListener("blur", onBlur);
19384
19512
  return () => window.removeEventListener("blur", onBlur);
19385
19513
  }, []);
19386
- (0, import_react10.useEffect)(() => {
19514
+ (0, import_react12.useEffect)(() => {
19387
19515
  const onKeyDown = (e) => {
19388
19516
  if (e.key !== "Escape") return;
19389
19517
  if (!activeRef.current) return;
@@ -19393,14 +19521,14 @@ function AiMediaStripOverlay({
19393
19521
  document.addEventListener("keydown", onKeyDown);
19394
19522
  return () => document.removeEventListener("keydown", onKeyDown);
19395
19523
  }, []);
19396
- const findEntry = (0, import_react10.useCallback)(
19524
+ const findEntry = (0, import_react12.useCallback)(
19397
19525
  (sectionId) => {
19398
19526
  const state = parseAiSectionsState(aiSectionsRef.current);
19399
19527
  return state.sections.find((s) => s.id === sectionId) ?? null;
19400
19528
  },
19401
19529
  [aiSectionsRef]
19402
19530
  );
19403
- const runMutation = (0, import_react10.useCallback)(
19531
+ const runMutation = (0, import_react12.useCallback)(
19404
19532
  async (sectionId, mutate, extraMedia) => {
19405
19533
  const entry = findEntry(sectionId);
19406
19534
  if (!entry) return false;
@@ -19547,7 +19675,7 @@ function AiMediaStripOverlay({
19547
19675
  }
19548
19676
 
19549
19677
  // src/ui/ai-section/AiPricingCardOverlay.tsx
19550
- var import_react11 = require("react");
19678
+ var import_react13 = require("react");
19551
19679
  var import_lucide_react9 = require("lucide-react");
19552
19680
  var import_jsx_runtime21 = require("react/jsx-runtime");
19553
19681
  var PRIMARY4 = "var(--ohw-primary, #0885FE)";
@@ -19590,8 +19718,8 @@ function readGridRect(ref) {
19590
19718
  return rectOf(card?.closest("[data-ohw-pricing-collection]") ?? card);
19591
19719
  }
19592
19720
  function useLiveCardRect(ref, grid = false) {
19593
- const [rect, setRect] = (0, import_react11.useState)(null);
19594
- (0, import_react11.useEffect)(() => {
19721
+ const [rect, setRect] = (0, import_react13.useState)(null);
19722
+ (0, import_react13.useEffect)(() => {
19595
19723
  if (!ref) {
19596
19724
  setRect(null);
19597
19725
  return;
@@ -19619,10 +19747,10 @@ var TOOLBAR_GRID_GAP = 52;
19619
19747
  var TOOLBAR_GRID_GAP_MOBILE = 42;
19620
19748
  var TOOLBAR_EDGE_MARGIN2 = 4;
19621
19749
  function GridToolbarSlot({ gridRect, children }) {
19622
- const slotRef = (0, import_react11.useRef)(null);
19623
- const [shift, setShift] = (0, import_react11.useState)(0);
19750
+ const slotRef = (0, import_react13.useRef)(null);
19751
+ const [shift, setShift] = (0, import_react13.useState)(0);
19624
19752
  const centerX = gridRect.left + gridRect.width / 2;
19625
- (0, import_react11.useLayoutEffect)(() => {
19753
+ (0, import_react13.useLayoutEffect)(() => {
19626
19754
  const slot = slotRef.current;
19627
19755
  if (!slot) return;
19628
19756
  const clamp = () => {
@@ -19879,13 +20007,13 @@ function AiPricingCardOverlay({
19879
20007
  aiSectionsRef,
19880
20008
  applyTreeLocalRef
19881
20009
  }) {
19882
- const [hover, setHover] = (0, import_react11.useState)(null);
19883
- const [active, setActive] = (0, import_react11.useState)(null);
19884
- const [pending, setPending] = (0, import_react11.useState)(false);
19885
- const [error, setError] = (0, import_react11.useState)(null);
19886
- const activeRef = (0, import_react11.useRef)(null);
20010
+ const [hover, setHover] = (0, import_react13.useState)(null);
20011
+ const [active, setActive] = (0, import_react13.useState)(null);
20012
+ const [pending, setPending] = (0, import_react13.useState)(false);
20013
+ const [error, setError] = (0, import_react13.useState)(null);
20014
+ const activeRef = (0, import_react13.useRef)(null);
19887
20015
  activeRef.current = active;
19888
- (0, import_react11.useEffect)(() => {
20016
+ (0, import_react13.useEffect)(() => {
19889
20017
  const onMove = (e) => {
19890
20018
  const ref = cardRefFromTarget(e.target);
19891
20019
  const t = e.target;
@@ -19903,7 +20031,7 @@ function AiPricingCardOverlay({
19903
20031
  document.documentElement.removeEventListener("mouseleave", onLeave);
19904
20032
  };
19905
20033
  }, []);
19906
- (0, import_react11.useEffect)(() => {
20034
+ (0, import_react13.useEffect)(() => {
19907
20035
  const onClick = (e) => {
19908
20036
  const t = e.target;
19909
20037
  if (!(t instanceof Element)) return;
@@ -19915,7 +20043,7 @@ function AiPricingCardOverlay({
19915
20043
  document.addEventListener("click", onClick, true);
19916
20044
  return () => document.removeEventListener("click", onClick, true);
19917
20045
  }, []);
19918
- (0, import_react11.useEffect)(() => {
20046
+ (0, import_react13.useEffect)(() => {
19919
20047
  const onBlur = () => {
19920
20048
  if (!activeRef.current) return;
19921
20049
  setActive(null);
@@ -19924,7 +20052,7 @@ function AiPricingCardOverlay({
19924
20052
  window.addEventListener("blur", onBlur);
19925
20053
  return () => window.removeEventListener("blur", onBlur);
19926
20054
  }, []);
19927
- (0, import_react11.useEffect)(() => {
20055
+ (0, import_react13.useEffect)(() => {
19928
20056
  const onKeyDown = (e) => {
19929
20057
  if (e.key !== "Escape") return;
19930
20058
  if (!activeRef.current) return;
@@ -19935,14 +20063,14 @@ function AiPricingCardOverlay({
19935
20063
  document.addEventListener("keydown", onKeyDown);
19936
20064
  return () => document.removeEventListener("keydown", onKeyDown);
19937
20065
  }, []);
19938
- const findEntry = (0, import_react11.useCallback)(
20066
+ const findEntry = (0, import_react13.useCallback)(
19939
20067
  (sectionId) => {
19940
20068
  const state = parseAiSectionsState(aiSectionsRef.current);
19941
20069
  return state.sections.find((s) => s.id === sectionId) ?? null;
19942
20070
  },
19943
20071
  [aiSectionsRef]
19944
20072
  );
19945
- const runMutation = (0, import_react11.useCallback)(
20073
+ const runMutation = (0, import_react13.useCallback)(
19946
20074
  async (sectionId, mutate) => {
19947
20075
  const entry = findEntry(sectionId);
19948
20076
  if (!entry) return false;
@@ -20029,7 +20157,7 @@ function AiPricingCardOverlay({
20029
20157
  }
20030
20158
 
20031
20159
  // src/ui/ai-section/AiVideoOverlay.tsx
20032
- var import_react12 = require("react");
20160
+ var import_react14 = require("react");
20033
20161
  var import_lucide_react10 = require("lucide-react");
20034
20162
 
20035
20163
  // src/lib/ai-video-tree.ts
@@ -20122,8 +20250,8 @@ function readRect4(ref) {
20122
20250
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
20123
20251
  }
20124
20252
  function useLiveBlockRect(ref) {
20125
- const [rect, setRect] = (0, import_react12.useState)(null);
20126
- (0, import_react12.useEffect)(() => {
20253
+ const [rect, setRect] = (0, import_react14.useState)(null);
20254
+ (0, import_react14.useEffect)(() => {
20127
20255
  if (!ref) {
20128
20256
  setRect(null);
20129
20257
  return;
@@ -20201,13 +20329,13 @@ function watchUrl(id) {
20201
20329
  return `https://www.youtube.com/watch?v=${id}`;
20202
20330
  }
20203
20331
  function VideoUrlInput({ value, onCommit }) {
20204
- const [draft, setDraft] = (0, import_react12.useState)(value ? watchUrl(value) : "");
20205
- const [invalid, setInvalid] = (0, import_react12.useState)(false);
20206
- (0, import_react12.useEffect)(() => {
20332
+ const [draft, setDraft] = (0, import_react14.useState)(value ? watchUrl(value) : "");
20333
+ const [invalid, setInvalid] = (0, import_react14.useState)(false);
20334
+ (0, import_react14.useEffect)(() => {
20207
20335
  setDraft(value ? watchUrl(value) : "");
20208
20336
  setInvalid(false);
20209
20337
  }, [value]);
20210
- const commit = () => {
20338
+ const commit2 = () => {
20211
20339
  const next = draft.trim();
20212
20340
  if (!next) {
20213
20341
  setInvalid(false);
@@ -20267,7 +20395,7 @@ function VideoUrlInput({ value, onCommit }) {
20267
20395
  inputMode: "url",
20268
20396
  value: draft,
20269
20397
  onChange: (e) => handleChange(e.target.value),
20270
- onBlur: commit,
20398
+ onBlur: commit2,
20271
20399
  onKeyDown: (e) => {
20272
20400
  if (e.key === "Enter") e.currentTarget.blur();
20273
20401
  if (e.key === "Escape") {
@@ -20340,13 +20468,13 @@ function AiVideoOverlay({
20340
20468
  applyTreeLocalRef,
20341
20469
  clearInteractionChromeRef
20342
20470
  }) {
20343
- const [hover, setHover] = (0, import_react12.useState)(null);
20344
- const [active, setActive] = (0, import_react12.useState)(null);
20345
- const [pending, setPending] = (0, import_react12.useState)(false);
20346
- const [error, setError] = (0, import_react12.useState)(null);
20347
- const activeRef = (0, import_react12.useRef)(null);
20471
+ const [hover, setHover] = (0, import_react14.useState)(null);
20472
+ const [active, setActive] = (0, import_react14.useState)(null);
20473
+ const [pending, setPending] = (0, import_react14.useState)(false);
20474
+ const [error, setError] = (0, import_react14.useState)(null);
20475
+ const activeRef = (0, import_react14.useRef)(null);
20348
20476
  activeRef.current = active;
20349
- (0, import_react12.useEffect)(() => {
20477
+ (0, import_react14.useEffect)(() => {
20350
20478
  const onMove = (e) => {
20351
20479
  const t = e.target;
20352
20480
  if (!(t instanceof HTMLElement)) return;
@@ -20376,7 +20504,7 @@ function AiVideoOverlay({
20376
20504
  document.documentElement.removeEventListener("mouseleave", onLeave);
20377
20505
  };
20378
20506
  }, []);
20379
- (0, import_react12.useEffect)(() => {
20507
+ (0, import_react14.useEffect)(() => {
20380
20508
  const onClick = (e) => {
20381
20509
  const current = activeRef.current;
20382
20510
  if (!current) return;
@@ -20391,7 +20519,7 @@ function AiVideoOverlay({
20391
20519
  document.addEventListener("click", onClick, true);
20392
20520
  return () => document.removeEventListener("click", onClick, true);
20393
20521
  }, []);
20394
- (0, import_react12.useEffect)(() => {
20522
+ (0, import_react14.useEffect)(() => {
20395
20523
  const onBlur = () => {
20396
20524
  if (!activeRef.current) return;
20397
20525
  setActive(null);
@@ -20400,7 +20528,7 @@ function AiVideoOverlay({
20400
20528
  window.addEventListener("blur", onBlur);
20401
20529
  return () => window.removeEventListener("blur", onBlur);
20402
20530
  }, []);
20403
- (0, import_react12.useEffect)(() => {
20531
+ (0, import_react14.useEffect)(() => {
20404
20532
  const onKeyDown = (e) => {
20405
20533
  if (e.key !== "Escape") return;
20406
20534
  if (!activeRef.current) return;
@@ -20410,14 +20538,14 @@ function AiVideoOverlay({
20410
20538
  document.addEventListener("keydown", onKeyDown);
20411
20539
  return () => document.removeEventListener("keydown", onKeyDown);
20412
20540
  }, []);
20413
- const findEntry = (0, import_react12.useCallback)(
20541
+ const findEntry = (0, import_react14.useCallback)(
20414
20542
  (sectionId) => {
20415
20543
  const state = parseAiSectionsState(aiSectionsRef.current);
20416
20544
  return state.sections.find((s) => s.id === sectionId) ?? null;
20417
20545
  },
20418
20546
  [aiSectionsRef]
20419
20547
  );
20420
- const runMutation = (0, import_react12.useCallback)(
20548
+ const runMutation = (0, import_react14.useCallback)(
20421
20549
  async (sectionId, mutate) => {
20422
20550
  const entry = findEntry(sectionId);
20423
20551
  if (!entry) return false;
@@ -20509,7 +20637,7 @@ function AiVideoOverlay({
20509
20637
  }
20510
20638
 
20511
20639
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
20512
- var import_react13 = require("react");
20640
+ var import_react15 = require("react");
20513
20641
  var import_lucide_react11 = require("lucide-react");
20514
20642
 
20515
20643
  // src/lib/ai-carousel-tree.ts
@@ -20582,8 +20710,8 @@ function readRect5(ref) {
20582
20710
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
20583
20711
  }
20584
20712
  function useLiveItemRect2(ref) {
20585
- const [rect, setRect] = (0, import_react13.useState)(null);
20586
- (0, import_react13.useEffect)(() => {
20713
+ const [rect, setRect] = (0, import_react15.useState)(null);
20714
+ (0, import_react15.useEffect)(() => {
20587
20715
  if (!ref) {
20588
20716
  setRect(null);
20589
20717
  return;
@@ -20790,19 +20918,19 @@ function AiFadeCarouselOverlay({
20790
20918
  applyTreeLocalRef,
20791
20919
  clearInteractionChromeRef
20792
20920
  }) {
20793
- const [hover, setHover] = (0, import_react13.useState)(null);
20794
- const [active, setActive] = (0, import_react13.useState)(null);
20795
- const [pending, setPending] = (0, import_react13.useState)(false);
20796
- const [error, setError] = (0, import_react13.useState)(null);
20797
- const [autoplayOverride, setAutoplayOverride] = (0, import_react13.useState)(null);
20798
- const [swapping, setSwapping] = (0, import_react13.useState)(null);
20799
- const skeletonRef = (0, import_react13.useRef)(null);
20800
- const activeRef = (0, import_react13.useRef)(null);
20921
+ const [hover, setHover] = (0, import_react15.useState)(null);
20922
+ const [active, setActive] = (0, import_react15.useState)(null);
20923
+ const [pending, setPending] = (0, import_react15.useState)(false);
20924
+ const [error, setError] = (0, import_react15.useState)(null);
20925
+ const [autoplayOverride, setAutoplayOverride] = (0, import_react15.useState)(null);
20926
+ const [swapping, setSwapping] = (0, import_react15.useState)(null);
20927
+ const skeletonRef = (0, import_react15.useRef)(null);
20928
+ const activeRef = (0, import_react15.useRef)(null);
20801
20929
  activeRef.current = active;
20802
- (0, import_react13.useEffect)(() => {
20930
+ (0, import_react15.useEffect)(() => {
20803
20931
  setAutoplayOverride(null);
20804
20932
  }, [active?.sectionId, active?.index]);
20805
- (0, import_react13.useEffect)(() => {
20933
+ (0, import_react15.useEffect)(() => {
20806
20934
  if (!swapping?.fadingOut || !skeletonRef.current) return;
20807
20935
  const anim = skeletonRef.current.animate([{ opacity: 1 }, { opacity: 0 }], {
20808
20936
  duration: MEDIA_UPLOAD_FADE_MS,
@@ -20812,7 +20940,7 @@ function AiFadeCarouselOverlay({
20812
20940
  anim.finished.then(() => setSwapping(null)).catch(() => setSwapping(null));
20813
20941
  return () => anim.cancel();
20814
20942
  }, [swapping?.fadingOut]);
20815
- (0, import_react13.useEffect)(() => {
20943
+ (0, import_react15.useEffect)(() => {
20816
20944
  const onMove = (e) => {
20817
20945
  const t = e.target;
20818
20946
  if (!(t instanceof Element)) return;
@@ -20846,7 +20974,7 @@ function AiFadeCarouselOverlay({
20846
20974
  document.documentElement.removeEventListener("mouseleave", onLeave);
20847
20975
  };
20848
20976
  }, []);
20849
- (0, import_react13.useEffect)(() => {
20977
+ (0, import_react15.useEffect)(() => {
20850
20978
  const onClick = (e) => {
20851
20979
  const current = activeRef.current;
20852
20980
  if (!current) return;
@@ -20861,7 +20989,7 @@ function AiFadeCarouselOverlay({
20861
20989
  document.addEventListener("click", onClick, true);
20862
20990
  return () => document.removeEventListener("click", onClick, true);
20863
20991
  }, []);
20864
- (0, import_react13.useEffect)(() => {
20992
+ (0, import_react15.useEffect)(() => {
20865
20993
  const onBlur = () => {
20866
20994
  if (!activeRef.current) return;
20867
20995
  setActive(null);
@@ -20870,7 +20998,7 @@ function AiFadeCarouselOverlay({
20870
20998
  window.addEventListener("blur", onBlur);
20871
20999
  return () => window.removeEventListener("blur", onBlur);
20872
21000
  }, []);
20873
- (0, import_react13.useEffect)(() => {
21001
+ (0, import_react15.useEffect)(() => {
20874
21002
  const onKeyDown = (e) => {
20875
21003
  if (e.key !== "Escape") return;
20876
21004
  if (!activeRef.current) return;
@@ -20880,14 +21008,14 @@ function AiFadeCarouselOverlay({
20880
21008
  document.addEventListener("keydown", onKeyDown);
20881
21009
  return () => document.removeEventListener("keydown", onKeyDown);
20882
21010
  }, []);
20883
- const findEntry = (0, import_react13.useCallback)(
21011
+ const findEntry = (0, import_react15.useCallback)(
20884
21012
  (sectionId) => {
20885
21013
  const state = parseAiSectionsState(aiSectionsRef.current);
20886
21014
  return state.sections.find((s) => s.id === sectionId) ?? null;
20887
21015
  },
20888
21016
  [aiSectionsRef]
20889
21017
  );
20890
- const runMutation = (0, import_react13.useCallback)(
21018
+ const runMutation = (0, import_react15.useCallback)(
20891
21019
  async (sectionId, mutate, extraMedia) => {
20892
21020
  const entry = findEntry(sectionId);
20893
21021
  if (!entry) return false;
@@ -21024,7 +21152,7 @@ function AiFadeCarouselOverlay({
21024
21152
 
21025
21153
  // src/OhhwellsBridge.tsx
21026
21154
  var import_react_dom6 = require("react-dom");
21027
- var import_navigation3 = require("next/navigation");
21155
+ var import_navigation4 = require("next/navigation");
21028
21156
 
21029
21157
  // src/lib/media-overlay-guards.ts
21030
21158
  var BRIDGE_CHROME_SELECTOR = [
@@ -21166,35 +21294,8 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
21166
21294
  return next;
21167
21295
  }
21168
21296
 
21169
- // src/lib/scroll-to-section.ts
21170
- var MAX_ATTEMPTS = 12;
21171
- var RETRY_MS = 100;
21172
- function getHashSectionId() {
21173
- if (typeof window === "undefined") return null;
21174
- const id = window.location.hash.replace(/^#/, "").trim();
21175
- return id || null;
21176
- }
21177
- function scrollToOhwSection(sectionId, behavior = "smooth") {
21178
- if (!sectionId || typeof document === "undefined") return false;
21179
- const el = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
21180
- if (!el) return false;
21181
- el.scrollIntoView({ behavior, block: "start" });
21182
- return true;
21183
- }
21184
- function scrollToHashSectionWhenReady(behavior = "smooth") {
21185
- const id = getHashSectionId();
21186
- if (!id) return;
21187
- let attempt = 0;
21188
- const tick = () => {
21189
- if (scrollToOhwSection(id, behavior)) return;
21190
- attempt += 1;
21191
- if (attempt < MAX_ATTEMPTS) window.setTimeout(tick, RETRY_MS);
21192
- };
21193
- tick();
21194
- }
21195
-
21196
21297
  // src/ui/link-modal/LinkPopover.tsx
21197
- var import_react17 = require("react");
21298
+ var import_react19 = require("react");
21198
21299
 
21199
21300
  // src/ui/dialog.tsx
21200
21301
  var React9 = __toESM(require("react"), 1);
@@ -21394,7 +21495,7 @@ function SectionTreeItem({
21394
21495
  }
21395
21496
 
21396
21497
  // src/ui/link-modal/UrlOrPageInput.tsx
21397
- var import_react14 = require("react");
21498
+ var import_react16 = require("react");
21398
21499
 
21399
21500
  // src/ui/input.tsx
21400
21501
  var React10 = __toESM(require("react"), 1);
@@ -21462,11 +21563,11 @@ function UrlOrPageInput({
21462
21563
  readOnly = false,
21463
21564
  urlError
21464
21565
  }) {
21465
- const inputId = (0, import_react14.useId)();
21466
- const inputRef = (0, import_react14.useRef)(null);
21467
- const rootRef = (0, import_react14.useRef)(null);
21468
- const [isFocused, setIsFocused] = (0, import_react14.useState)(false);
21469
- (0, import_react14.useEffect)(() => {
21566
+ const inputId = (0, import_react16.useId)();
21567
+ const inputRef = (0, import_react16.useRef)(null);
21568
+ const rootRef = (0, import_react16.useRef)(null);
21569
+ const [isFocused, setIsFocused] = (0, import_react16.useState)(false);
21570
+ (0, import_react16.useEffect)(() => {
21470
21571
  if (!dropdownOpen) return;
21471
21572
  const isOutside = (e) => {
21472
21573
  const root = rootRef.current;
@@ -21674,10 +21775,10 @@ function LinkEditorPanel({ state, onClose }) {
21674
21775
  }
21675
21776
 
21676
21777
  // src/ui/link-modal/SectionPickerOverlay.tsx
21677
- var import_react15 = require("react");
21778
+ var import_react17 = require("react");
21678
21779
  var import_react_dom4 = require("react-dom");
21679
21780
  var import_lucide_react17 = require("lucide-react");
21680
- var import_navigation2 = require("next/navigation");
21781
+ var import_navigation3 = require("next/navigation");
21681
21782
 
21682
21783
  // src/lib/parent-scroll.ts
21683
21784
  function visibleBand(parentScroll) {
@@ -21731,12 +21832,12 @@ function hitTestSectionId(x, y, sectionIds, rects) {
21731
21832
  return null;
21732
21833
  }
21733
21834
  function useSectionRects(sectionIdsKey, enabled) {
21734
- const [rects, setRects] = (0, import_react15.useState)(/* @__PURE__ */ new Map());
21735
- const sectionIds = (0, import_react15.useMemo)(
21835
+ const [rects, setRects] = (0, import_react17.useState)(/* @__PURE__ */ new Map());
21836
+ const sectionIds = (0, import_react17.useMemo)(
21736
21837
  () => sectionIdsKey ? sectionIdsKey.split("\0") : [],
21737
21838
  [sectionIdsKey]
21738
21839
  );
21739
- (0, import_react15.useEffect)(() => {
21840
+ (0, import_react17.useEffect)(() => {
21740
21841
  if (!enabled || sectionIds.length === 0) {
21741
21842
  setRects((prev) => prev.size === 0 ? prev : /* @__PURE__ */ new Map());
21742
21843
  return;
@@ -21775,15 +21876,15 @@ function SectionPickerOverlay({
21775
21876
  onBack,
21776
21877
  onSelect
21777
21878
  }) {
21778
- const router = (0, import_navigation2.useRouter)();
21779
- const pathname = (0, import_navigation2.usePathname)();
21780
- const [selectedId, setSelectedId] = (0, import_react15.useState)(null);
21781
- const [hoveredId, setHoveredId] = (0, import_react15.useState)(null);
21782
- const pointerRef = (0, import_react15.useRef)(null);
21783
- const pointerScreenRef = (0, import_react15.useRef)(null);
21784
- const iframeOffsetTopRef = (0, import_react15.useRef)(null);
21785
- const sectionIdsRef = (0, import_react15.useRef)([]);
21786
- const [chromeClip, setChromeClip] = (0, import_react15.useState)(
21879
+ const router = (0, import_navigation3.useRouter)();
21880
+ const pathname = (0, import_navigation3.usePathname)();
21881
+ const [selectedId, setSelectedId] = (0, import_react17.useState)(null);
21882
+ const [hoveredId, setHoveredId] = (0, import_react17.useState)(null);
21883
+ const pointerRef = (0, import_react17.useRef)(null);
21884
+ const pointerScreenRef = (0, import_react17.useRef)(null);
21885
+ const iframeOffsetTopRef = (0, import_react17.useRef)(null);
21886
+ const sectionIdsRef = (0, import_react17.useRef)([]);
21887
+ const [chromeClip, setChromeClip] = (0, import_react17.useState)(
21787
21888
  () => ({
21788
21889
  top: 0,
21789
21890
  bottom: typeof window !== "undefined" ? window.innerHeight : 0
@@ -21791,12 +21892,12 @@ function SectionPickerOverlay({
21791
21892
  );
21792
21893
  const normalizedTarget = normalizePath(pagePath);
21793
21894
  const isOnTargetPage = normalizePath(pathname) === normalizedTarget;
21794
- (0, import_react15.useEffect)(() => {
21895
+ (0, import_react17.useEffect)(() => {
21795
21896
  if (isOnTargetPage) return;
21796
21897
  const search = readPreservedSearch();
21797
21898
  router.push(`${normalizedTarget}${search}`);
21798
21899
  }, [isOnTargetPage, normalizedTarget, router]);
21799
- (0, import_react15.useEffect)(() => {
21900
+ (0, import_react17.useEffect)(() => {
21800
21901
  document.documentElement.setAttribute("data-ohw-section-picking", "");
21801
21902
  document.querySelectorAll("[data-ohw-hovered]").forEach((el) => {
21802
21903
  el.removeAttribute("data-ohw-hovered");
@@ -21808,24 +21909,24 @@ function SectionPickerOverlay({
21808
21909
  document.documentElement.removeAttribute("data-ohw-section-picking");
21809
21910
  };
21810
21911
  }, []);
21811
- const liveSections = (0, import_react15.useMemo)(() => {
21912
+ const liveSections = (0, import_react17.useMemo)(() => {
21812
21913
  if (!isOnTargetPage) return sections;
21813
21914
  const live = collectSectionsFromDom();
21814
21915
  if (live.length === 0) return sections;
21815
21916
  const labels = new Map(sections.map((s) => [s.id, s.label]));
21816
21917
  return live.map((s) => ({ id: s.id, label: labels.get(s.id) ?? s.label }));
21817
21918
  }, [isOnTargetPage, sections, pathname]);
21818
- const sectionIdsKey = (0, import_react15.useMemo)(
21919
+ const sectionIdsKey = (0, import_react17.useMemo)(
21819
21920
  () => liveSections.map((s) => s.id).join("\0"),
21820
21921
  [liveSections]
21821
21922
  );
21822
- const sectionIds = (0, import_react15.useMemo)(
21923
+ const sectionIds = (0, import_react17.useMemo)(
21823
21924
  () => liveSections.map((s) => s.id),
21824
21925
  [liveSections]
21825
21926
  );
21826
21927
  sectionIdsRef.current = sectionIds;
21827
21928
  const rects = useSectionRects(sectionIdsKey, isOnTargetPage);
21828
- const applyHoverAt = (0, import_react15.useCallback)(
21929
+ const applyHoverAt = (0, import_react17.useCallback)(
21829
21930
  (x, y, liveRects) => {
21830
21931
  const ids = sectionIdsRef.current;
21831
21932
  const map = liveRects ?? readSectionRects(ids);
@@ -21834,7 +21935,7 @@ function SectionPickerOverlay({
21834
21935
  },
21835
21936
  []
21836
21937
  );
21837
- (0, import_react15.useEffect)(() => {
21938
+ (0, import_react17.useEffect)(() => {
21838
21939
  const applyClip = (iframeOffsetTop, visibleCanvasTop, canvasH, promptBarH = 0) => {
21839
21940
  const next = getIframeVisibleClip({
21840
21941
  iframeOffsetTop,
@@ -21878,12 +21979,12 @@ function SectionPickerOverlay({
21878
21979
  window.removeEventListener("resize", onResize);
21879
21980
  };
21880
21981
  }, [applyHoverAt]);
21881
- (0, import_react15.useEffect)(() => {
21982
+ (0, import_react17.useEffect)(() => {
21882
21983
  const ptr = pointerRef.current;
21883
21984
  if (!ptr) return;
21884
21985
  applyHoverAt(ptr.x, ptr.y, rects);
21885
21986
  }, [rects, applyHoverAt]);
21886
- (0, import_react15.useEffect)(() => {
21987
+ (0, import_react17.useEffect)(() => {
21887
21988
  const rememberPointer = (clientX, clientY) => {
21888
21989
  pointerRef.current = { x: clientX, y: clientY };
21889
21990
  const top = iframeOffsetTopRef.current;
@@ -21907,7 +22008,7 @@ function SectionPickerOverlay({
21907
22008
  window.removeEventListener("message", onPointerSync);
21908
22009
  };
21909
22010
  }, [rects, applyHoverAt]);
21910
- const handleSelect = (0, import_react15.useCallback)(
22011
+ const handleSelect = (0, import_react17.useCallback)(
21911
22012
  (section) => {
21912
22013
  if (selectedId) return;
21913
22014
  setSelectedId(section.id);
@@ -21915,7 +22016,7 @@ function SectionPickerOverlay({
21915
22016
  },
21916
22017
  [selectedId, onSelect]
21917
22018
  );
21918
- (0, import_react15.useEffect)(() => {
22019
+ (0, import_react17.useEffect)(() => {
21919
22020
  const onKeyDown = (e) => {
21920
22021
  if (e.key === "Escape") {
21921
22022
  e.preventDefault();
@@ -22038,7 +22139,7 @@ function SectionPickerOverlay({
22038
22139
  }
22039
22140
 
22040
22141
  // src/ui/link-modal/useLinkModalState.ts
22041
- var import_react16 = require("react");
22142
+ var import_react18 = require("react");
22042
22143
  function useLinkModalState({
22043
22144
  open,
22044
22145
  mode,
@@ -22050,14 +22151,14 @@ function useLinkModalState({
22050
22151
  onClose,
22051
22152
  onSubmit
22052
22153
  }) {
22053
- const availablePages = (0, import_react16.useMemo)(() => pages, [pages]);
22054
- const [searchValue, setSearchValue] = (0, import_react16.useState)("");
22055
- const [selectedPage, setSelectedPage] = (0, import_react16.useState)(null);
22056
- const [selectedSection, setSelectedSection] = (0, import_react16.useState)(null);
22057
- const [step, setStep] = (0, import_react16.useState)("input");
22058
- const [dropdownOpen, setDropdownOpen] = (0, import_react16.useState)(false);
22059
- const [urlError, setUrlError] = (0, import_react16.useState)("");
22060
- const reset = (0, import_react16.useCallback)(() => {
22154
+ const availablePages = (0, import_react18.useMemo)(() => pages, [pages]);
22155
+ const [searchValue, setSearchValue] = (0, import_react18.useState)("");
22156
+ const [selectedPage, setSelectedPage] = (0, import_react18.useState)(null);
22157
+ const [selectedSection, setSelectedSection] = (0, import_react18.useState)(null);
22158
+ const [step, setStep] = (0, import_react18.useState)("input");
22159
+ const [dropdownOpen, setDropdownOpen] = (0, import_react18.useState)(false);
22160
+ const [urlError, setUrlError] = (0, import_react18.useState)("");
22161
+ const reset = (0, import_react18.useCallback)(() => {
22061
22162
  setSearchValue("");
22062
22163
  setSelectedPage(null);
22063
22164
  setSelectedSection(null);
@@ -22065,7 +22166,7 @@ function useLinkModalState({
22065
22166
  setDropdownOpen(false);
22066
22167
  setUrlError("");
22067
22168
  }, []);
22068
- (0, import_react16.useEffect)(() => {
22169
+ (0, import_react18.useEffect)(() => {
22069
22170
  if (!open) return;
22070
22171
  if (mode === "edit" && initialTarget) {
22071
22172
  const { pageRoute } = parseTarget(initialTarget);
@@ -22081,11 +22182,11 @@ function useLinkModalState({
22081
22182
  setDropdownOpen(false);
22082
22183
  setUrlError("");
22083
22184
  }, [open, mode, initialTarget, reset]);
22084
- const filteredPages = (0, import_react16.useMemo)(() => {
22185
+ const filteredPages = (0, import_react18.useMemo)(() => {
22085
22186
  if (!searchValue.trim()) return availablePages;
22086
22187
  return availablePages.filter((p) => p.title.toLowerCase().startsWith(searchValue.toLowerCase()));
22087
22188
  }, [availablePages, searchValue]);
22088
- const activeSections = (0, import_react16.useMemo)(() => {
22189
+ const activeSections = (0, import_react18.useMemo)(() => {
22089
22190
  if (!selectedPage) return [];
22090
22191
  return getSectionsForPath(sectionsByPath, selectedPage.path);
22091
22192
  }, [selectedPage, sectionsByPath]);
@@ -22134,7 +22235,7 @@ function useLinkModalState({
22134
22235
  reset();
22135
22236
  onClose();
22136
22237
  };
22137
- const isValid = (0, import_react16.useMemo)(() => {
22238
+ const isValid = (0, import_react18.useMemo)(() => {
22138
22239
  if (urlError) return false;
22139
22240
  if (showBreadcrumb) return true;
22140
22241
  if (selectedPage) return true;
@@ -22231,7 +22332,7 @@ function LinkPopover({
22231
22332
  onSubmit
22232
22333
  });
22233
22334
  const sectionPickerActive = state.showSectionPicker && Boolean(state.selectedPage);
22234
- (0, import_react17.useEffect)(() => {
22335
+ (0, import_react19.useEffect)(() => {
22235
22336
  if (!open) return;
22236
22337
  if (sectionPickerActive) {
22237
22338
  postToParent({ type: "ui:unlock" });
@@ -22472,7 +22573,7 @@ function addFooterColumnWithPersist({
22472
22573
  }
22473
22574
 
22474
22575
  // src/ui/FloatingPanel.tsx
22475
- var import_react18 = require("react");
22576
+ var import_react20 = require("react");
22476
22577
  var import_lucide_react18 = require("lucide-react");
22477
22578
  var import_jsx_runtime33 = require("react/jsx-runtime");
22478
22579
  var PANEL_WIDTH = 256;
@@ -22534,10 +22635,10 @@ function FloatingPanel({
22534
22635
  className,
22535
22636
  bodyClassName
22536
22637
  }) {
22537
- const panelRef = (0, import_react18.useRef)(null);
22538
- const [measured, setMeasured] = (0, import_react18.useState)({ w: PANEL_WIDTH, h: 280 });
22539
- const dragRef = (0, import_react18.useRef)(null);
22540
- const homeRef = (0, import_react18.useRef)(null);
22638
+ const panelRef = (0, import_react20.useRef)(null);
22639
+ const [measured, setMeasured] = (0, import_react20.useState)({ w: PANEL_WIDTH, h: 280 });
22640
+ const dragRef = (0, import_react20.useRef)(null);
22641
+ const homeRef = (0, import_react20.useRef)(null);
22541
22642
  if (!open) {
22542
22643
  homeRef.current = null;
22543
22644
  } else if (position) {
@@ -22545,17 +22646,17 @@ function FloatingPanel({
22545
22646
  } else if (homeRef.current == null) {
22546
22647
  homeRef.current = defaultFloatingPanelPosition(parentScroll);
22547
22648
  }
22548
- const [liveScroll, setLiveScroll] = (0, import_react18.useState)(parentScroll);
22649
+ const [liveScroll, setLiveScroll] = (0, import_react20.useState)(parentScroll);
22549
22650
  const home = position ?? homeRef.current ?? defaultFloatingPanelPosition(parentScroll);
22550
22651
  const { y: fittedY, maxHeight } = fitPanelInClip(home.y, liveScroll, measured.h);
22551
22652
  const clamped = {
22552
22653
  x: clampX(home.x, measured.w),
22553
22654
  y: fittedY
22554
22655
  };
22555
- (0, import_react18.useEffect)(() => {
22656
+ (0, import_react20.useEffect)(() => {
22556
22657
  setLiveScroll(parentScroll);
22557
22658
  }, [parentScroll]);
22558
- (0, import_react18.useEffect)(() => {
22659
+ (0, import_react20.useEffect)(() => {
22559
22660
  if (!open) return;
22560
22661
  const onParentScroll = (e) => {
22561
22662
  if (e.data?.type !== "ow:parent-scroll") return;
@@ -22565,8 +22666,8 @@ function FloatingPanel({
22565
22666
  window.addEventListener("message", onParentScroll);
22566
22667
  return () => window.removeEventListener("message", onParentScroll);
22567
22668
  }, [open]);
22568
- const positionRef = (0, import_react18.useRef)(position);
22569
- (0, import_react18.useLayoutEffect)(() => {
22669
+ const positionRef = (0, import_react20.useRef)(position);
22670
+ (0, import_react20.useLayoutEffect)(() => {
22570
22671
  if (!open) {
22571
22672
  positionRef.current = position;
22572
22673
  return;
@@ -22576,7 +22677,7 @@ function FloatingPanel({
22576
22677
  }
22577
22678
  positionRef.current = position;
22578
22679
  }, [open, position, liveScroll, parentScroll]);
22579
- (0, import_react18.useLayoutEffect)(() => {
22680
+ (0, import_react20.useLayoutEffect)(() => {
22580
22681
  if (!open || !panelRef.current) return;
22581
22682
  const el = panelRef.current;
22582
22683
  const header = el.querySelector("[data-ohw-floating-panel-header]");
@@ -22585,7 +22686,7 @@ function FloatingPanel({
22585
22686
  const next = { w: el.offsetWidth || PANEL_WIDTH, h: contentH };
22586
22687
  setMeasured((prev) => prev.w === next.w && prev.h === next.h ? prev : next);
22587
22688
  }, [open, children, title, context]);
22588
- const onHeaderPointerDown = (0, import_react18.useCallback)(
22689
+ const onHeaderPointerDown = (0, import_react20.useCallback)(
22589
22690
  (e) => {
22590
22691
  if (e.button !== 0) return;
22591
22692
  if (e.target.closest("[data-ohw-floating-panel-close]")) return;
@@ -22604,7 +22705,7 @@ function FloatingPanel({
22604
22705
  },
22605
22706
  [clamped.x, clamped.y]
22606
22707
  );
22607
- const onHeaderPointerMove = (0, import_react18.useCallback)(
22708
+ const onHeaderPointerMove = (0, import_react20.useCallback)(
22608
22709
  (e) => {
22609
22710
  const drag = dragRef.current;
22610
22711
  if (!drag || drag.pointerId !== e.pointerId) return;
@@ -22630,7 +22731,7 @@ function FloatingPanel({
22630
22731
  },
22631
22732
  [measured.w, onPositionChange, liveScroll]
22632
22733
  );
22633
- const endDrag = (0, import_react18.useCallback)((e) => {
22734
+ const endDrag = (0, import_react20.useCallback)((e) => {
22634
22735
  const drag = dragRef.current;
22635
22736
  if (!drag || drag.pointerId !== e.pointerId) return;
22636
22737
  dragRef.current = null;
@@ -22640,11 +22741,11 @@ function FloatingPanel({
22640
22741
  } catch {
22641
22742
  }
22642
22743
  }, []);
22643
- (0, import_react18.useEffect)(() => {
22744
+ (0, import_react20.useEffect)(() => {
22644
22745
  if (open) return;
22645
22746
  document.documentElement.removeAttribute("data-ohw-panel-dragging");
22646
22747
  }, [open]);
22647
- (0, import_react18.useEffect)(() => () => document.documentElement.removeAttribute("data-ohw-panel-dragging"), []);
22748
+ (0, import_react20.useEffect)(() => () => document.documentElement.removeAttribute("data-ohw-panel-dragging"), []);
22648
22749
  if (!open) return null;
22649
22750
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
22650
22751
  "div",
@@ -23164,7 +23265,7 @@ function hitTestNavDropSlot(clientX, clientY, draggedHrefKey, draggedEl) {
23164
23265
  }
23165
23266
 
23166
23267
  // src/useNavItemDrag.ts
23167
- var import_react19 = require("react");
23268
+ var import_react21 = require("react");
23168
23269
  function useNavItemDrag({
23169
23270
  isEditMode,
23170
23271
  editContentRef,
@@ -23188,11 +23289,11 @@ function useNavItemDrag({
23188
23289
  getNavigationItemAnchor: getNavigationItemAnchor2,
23189
23290
  isDragHandleDisabled: isDragHandleDisabled2
23190
23291
  }) {
23191
- const navDragRef = (0, import_react19.useRef)(null);
23192
- const [navDropSlots, setNavDropSlots] = (0, import_react19.useState)([]);
23193
- const [activeNavDropIndex, setActiveNavDropIndex] = (0, import_react19.useState)(null);
23194
- const navPointerDragRef = (0, import_react19.useRef)(null);
23195
- const clearNavDragVisuals = (0, import_react19.useCallback)(() => {
23292
+ const navDragRef = (0, import_react21.useRef)(null);
23293
+ const [navDropSlots, setNavDropSlots] = (0, import_react21.useState)([]);
23294
+ const [activeNavDropIndex, setActiveNavDropIndex] = (0, import_react21.useState)(null);
23295
+ const navPointerDragRef = (0, import_react21.useRef)(null);
23296
+ const clearNavDragVisuals = (0, import_react21.useCallback)(() => {
23196
23297
  const session = navDragRef.current;
23197
23298
  const nestedHrefKey = session?.draggedEl?.closest("[data-ohw-nav-children]") != null ? session.hrefKey : null;
23198
23299
  navDragRef.current = null;
@@ -23225,7 +23326,7 @@ function useNavItemDrag({
23225
23326
  document.documentElement.removeAttribute("data-ohw-nav-dragging-root");
23226
23327
  unlockItemDragInteraction();
23227
23328
  }, [setDraggedItemRect, setIsItemDragging, setSiblingHintRects]);
23228
- const refreshNavDragVisuals = (0, import_react19.useCallback)(
23329
+ const refreshNavDragVisuals = (0, import_react21.useCallback)(
23229
23330
  (session, activeSlot, clientX, clientY) => {
23230
23331
  setDraggedItemRect(session.draggedEl.getBoundingClientRect());
23231
23332
  if (typeof clientX === "number" && typeof clientY === "number") {
@@ -23243,13 +23344,13 @@ function useNavItemDrag({
23243
23344
  },
23244
23345
  [setDraggedItemRect, setSiblingHintRects]
23245
23346
  );
23246
- const refreshNavDragVisualsRef = (0, import_react19.useRef)(refreshNavDragVisuals);
23347
+ const refreshNavDragVisualsRef = (0, import_react21.useRef)(refreshNavDragVisuals);
23247
23348
  refreshNavDragVisualsRef.current = refreshNavDragVisuals;
23248
- const commitNavDragRef = (0, import_react19.useRef)(() => {
23349
+ const commitNavDragRef = (0, import_react21.useRef)(() => {
23249
23350
  });
23250
- const beginNavDragRef = (0, import_react19.useRef)(() => {
23351
+ const beginNavDragRef = (0, import_react21.useRef)(() => {
23251
23352
  });
23252
- const beginNavDrag = (0, import_react19.useCallback)(
23353
+ const beginNavDrag = (0, import_react21.useCallback)(
23253
23354
  (session) => {
23254
23355
  const rect = session.draggedEl.getBoundingClientRect();
23255
23356
  session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
@@ -23288,7 +23389,7 @@ function useNavItemDrag({
23288
23389
  ]
23289
23390
  );
23290
23391
  beginNavDragRef.current = beginNavDrag;
23291
- const commitNavDrag = (0, import_react19.useCallback)(
23392
+ const commitNavDrag = (0, import_react21.useCallback)(
23292
23393
  (clientX, clientY) => {
23293
23394
  const session = navDragRef.current;
23294
23395
  if (!session) {
@@ -23367,7 +23468,7 @@ function useNavItemDrag({
23367
23468
  [clearNavDragVisuals, deselectRef, editContentRef, postToParentRef, selectRef]
23368
23469
  );
23369
23470
  commitNavDragRef.current = commitNavDrag;
23370
- const startNavLinkDrag = (0, import_react19.useCallback)(
23471
+ const startNavLinkDrag = (0, import_react21.useCallback)(
23371
23472
  (anchor, clientX, clientY, wasSelected) => {
23372
23473
  if (footerDragRef.current) return false;
23373
23474
  const hrefKey = anchor.getAttribute("data-ohw-href-key");
@@ -23385,7 +23486,7 @@ function useNavItemDrag({
23385
23486
  },
23386
23487
  [beginNavDrag, footerDragRef, isDragHandleDisabled2, isCtaButton]
23387
23488
  );
23388
- const onNavDragOver = (0, import_react19.useCallback)(
23489
+ const onNavDragOver = (0, import_react21.useCallback)(
23389
23490
  (e) => {
23390
23491
  const session = navDragRef.current;
23391
23492
  if (!session) return false;
@@ -23397,7 +23498,7 @@ function useNavItemDrag({
23397
23498
  },
23398
23499
  []
23399
23500
  );
23400
- (0, import_react19.useEffect)(() => {
23501
+ (0, import_react21.useEffect)(() => {
23401
23502
  if (!isEditMode) return;
23402
23503
  const THRESHOLD = 10;
23403
23504
  const resolveWasSelected = (el) => {
@@ -23524,7 +23625,7 @@ function useNavItemDrag({
23524
23625
  setLinkPopover,
23525
23626
  suppressNextClickRef
23526
23627
  ]);
23527
- const armNavPressFromChrome = (0, import_react19.useCallback)(
23628
+ const armNavPressFromChrome = (0, import_react21.useCallback)(
23528
23629
  (selected, clientX, clientY, pointerId) => {
23529
23630
  const hrefKey = selected.getAttribute("data-ohw-href-key");
23530
23631
  if (!hrefKey || !isNavbarHrefKey(hrefKey)) return false;
@@ -23556,7 +23657,7 @@ function useNavItemDrag({
23556
23657
  }
23557
23658
 
23558
23659
  // src/useSectionDrag.ts
23559
- var import_react20 = require("react");
23660
+ var import_react22 = require("react");
23560
23661
 
23561
23662
  // src/lib/section-dnd.ts
23562
23663
  function isFooterSection(el) {
@@ -23649,21 +23750,21 @@ function useSectionDrag({
23649
23750
  suppressNextClickRef,
23650
23751
  suppressClickUntilRef
23651
23752
  }) {
23652
- const sectionDragRef = (0, import_react20.useRef)(null);
23653
- const [sectionDropSlots, setSectionDropSlots] = (0, import_react20.useState)([]);
23654
- const [activeSectionDropIndex, setActiveSectionDropIndex] = (0, import_react20.useState)(null);
23655
- const [isSectionDragging, setIsSectionDragging] = (0, import_react20.useState)(false);
23656
- const sectionPointerDragRef = (0, import_react20.useRef)(null);
23657
- const autoScrollRafRef = (0, import_react20.useRef)(null);
23658
- const autoScrollDeltaRef = (0, import_react20.useRef)(0);
23659
- const stopAutoScroll = (0, import_react20.useCallback)(() => {
23753
+ const sectionDragRef = (0, import_react22.useRef)(null);
23754
+ const [sectionDropSlots, setSectionDropSlots] = (0, import_react22.useState)([]);
23755
+ const [activeSectionDropIndex, setActiveSectionDropIndex] = (0, import_react22.useState)(null);
23756
+ const [isSectionDragging, setIsSectionDragging] = (0, import_react22.useState)(false);
23757
+ const sectionPointerDragRef = (0, import_react22.useRef)(null);
23758
+ const autoScrollRafRef = (0, import_react22.useRef)(null);
23759
+ const autoScrollDeltaRef = (0, import_react22.useRef)(0);
23760
+ const stopAutoScroll = (0, import_react22.useCallback)(() => {
23660
23761
  if (autoScrollRafRef.current != null) {
23661
23762
  cancelAnimationFrame(autoScrollRafRef.current);
23662
23763
  autoScrollRafRef.current = null;
23663
23764
  }
23664
23765
  autoScrollDeltaRef.current = 0;
23665
23766
  }, []);
23666
- const tickAutoScroll = (0, import_react20.useCallback)(() => {
23767
+ const tickAutoScroll = (0, import_react22.useCallback)(() => {
23667
23768
  if (!sectionDragRef.current) {
23668
23769
  stopAutoScroll();
23669
23770
  return;
@@ -23673,7 +23774,7 @@ function useSectionDrag({
23673
23774
  }
23674
23775
  autoScrollRafRef.current = requestAnimationFrame(tickAutoScroll);
23675
23776
  }, [postToParentRef, stopAutoScroll]);
23676
- const updateAutoScroll = (0, import_react20.useCallback)(
23777
+ const updateAutoScroll = (0, import_react22.useCallback)(
23677
23778
  (clientY) => {
23678
23779
  const clip = getIframeChromeClip(parentScrollRef.current);
23679
23780
  let delta = 0;
@@ -23695,7 +23796,7 @@ function useSectionDrag({
23695
23796
  },
23696
23797
  [parentScrollRef, stopAutoScroll, tickAutoScroll]
23697
23798
  );
23698
- const clearSectionDragVisuals = (0, import_react20.useCallback)(() => {
23799
+ const clearSectionDragVisuals = (0, import_react22.useCallback)(() => {
23699
23800
  sectionDragRef.current?.draggedEl.removeAttribute("data-ohw-section-dragging");
23700
23801
  sectionDragRef.current = null;
23701
23802
  setSectionDropSlots([]);
@@ -23705,7 +23806,7 @@ function useSectionDrag({
23705
23806
  document.documentElement.removeAttribute("data-ohw-section-dragging-root");
23706
23807
  unlockItemDragInteraction();
23707
23808
  }, [stopAutoScroll]);
23708
- const refreshSectionDragVisuals = (0, import_react20.useCallback)(
23809
+ const refreshSectionDragVisuals = (0, import_react22.useCallback)(
23709
23810
  (session, clientX, clientY) => {
23710
23811
  session.lastClientX = clientX;
23711
23812
  session.lastClientY = clientY;
@@ -23719,7 +23820,7 @@ function useSectionDrag({
23719
23820
  },
23720
23821
  [updateAutoScroll]
23721
23822
  );
23722
- const beginSectionDrag = (0, import_react20.useCallback)(
23823
+ const beginSectionDrag = (0, import_react22.useCallback)(
23723
23824
  (session) => {
23724
23825
  sectionDragRef.current = session;
23725
23826
  setIsSectionDragging(true);
@@ -23730,7 +23831,7 @@ function useSectionDrag({
23730
23831
  },
23731
23832
  [refreshSectionDragVisuals]
23732
23833
  );
23733
- const commitSectionDrag = (0, import_react20.useCallback)(() => {
23834
+ const commitSectionDrag = (0, import_react22.useCallback)(() => {
23734
23835
  const session = sectionDragRef.current;
23735
23836
  if (!session) {
23736
23837
  clearSectionDragVisuals();
@@ -23759,7 +23860,7 @@ function useSectionDrag({
23759
23860
  });
23760
23861
  });
23761
23862
  }, [clearSectionDragVisuals, editContentRef, postToParentRef]);
23762
- const startSectionPressDrag = (0, import_react20.useCallback)(
23863
+ const startSectionPressDrag = (0, import_react22.useCallback)(
23763
23864
  (el, clientX, clientY, pointerId) => {
23764
23865
  if (navDragRef.current || footerDragRef.current || sectionDragRef.current) return false;
23765
23866
  const instanceId = instanceIdOf(el);
@@ -23776,7 +23877,7 @@ function useSectionDrag({
23776
23877
  },
23777
23878
  [footerDragRef, navDragRef]
23778
23879
  );
23779
- (0, import_react20.useEffect)(() => {
23880
+ (0, import_react22.useEffect)(() => {
23780
23881
  if (!isEditMode) return;
23781
23882
  const onPointerDown = (e) => {
23782
23883
  if (e.button !== 0) return;
@@ -24100,6 +24201,102 @@ function deleteSelectedNavFooterItem(deps) {
24100
24201
  return false;
24101
24202
  }
24102
24203
 
24204
+ // src/lib/nav-page-sync.ts
24205
+ function labelKeyFor(hrefKey) {
24206
+ return hrefKey.replace(/-href$/, "-label");
24207
+ }
24208
+ function isPageLinkKey(key) {
24209
+ return isNavbarHrefKey(key) || isFooterHrefKey(key);
24210
+ }
24211
+ function currentHref(key, anchor, content) {
24212
+ const stored = content[key];
24213
+ if (typeof stored === "string" && stored.length > 0) return stored;
24214
+ return anchor.getAttribute("href") ?? "";
24215
+ }
24216
+ function normalizePath2(value) {
24217
+ if (value.length > 1 && value.endsWith("/")) return value.slice(0, -1);
24218
+ return value;
24219
+ }
24220
+ function pointsAt(href, path) {
24221
+ const normalized = normalizePath2(href);
24222
+ const target = normalizePath2(path);
24223
+ if (normalized === target) return true;
24224
+ return (normalized.startsWith(`${target}#`) || normalized.startsWith(`${target}?`)) && target !== "/";
24225
+ }
24226
+ function retargetHref(href, oldPath, newPath) {
24227
+ const normalized = normalizePath2(href);
24228
+ const target = normalizePath2(oldPath);
24229
+ if (normalized === target) return newPath;
24230
+ return `${newPath}${normalized.slice(target.length)}`;
24231
+ }
24232
+ function setLabelText(key, text) {
24233
+ document.querySelectorAll(`[data-ohw-key="${CSS.escape(key)}"]`).forEach((el) => {
24234
+ el.textContent = text;
24235
+ });
24236
+ }
24237
+ function commit(delta, deps) {
24238
+ if (Object.keys(delta).length === 0) return;
24239
+ deps.setEditContent({ ...deps.getEditContent(), ...delta });
24240
+ deps.postToParent({
24241
+ type: "ow:change",
24242
+ nodes: Object.entries(delta).map(([key, text]) => ({ key, text }))
24243
+ });
24244
+ }
24245
+ function navLinksTo(path, content) {
24246
+ return Array.from(document.querySelectorAll("[data-ohw-href-key]")).filter((anchor) => {
24247
+ const key = anchor.getAttribute("data-ohw-href-key");
24248
+ return isNavbarHrefKey(key) && pointsAt(currentHref(key, anchor, content), path);
24249
+ }).map((anchor) => anchor.getAttribute("data-ohw-href-key"));
24250
+ }
24251
+ function addNavLinkForPage(page, deps) {
24252
+ const content = deps.getEditContent();
24253
+ if (navLinksTo(page.path, content).length > 0) return false;
24254
+ const roots = listNavbarRootItems();
24255
+ const afterAnchor = roots[roots.length - 1] ?? null;
24256
+ let inserted;
24257
+ try {
24258
+ inserted = insertNavbarItem(page.path, page.title, afterAnchor);
24259
+ } catch {
24260
+ return false;
24261
+ }
24262
+ const { hrefKey, labelKey, index } = inserted;
24263
+ deps.applyLinkByKey(hrefKey, page.path);
24264
+ setLabelText(labelKey, page.title);
24265
+ commit(
24266
+ {
24267
+ [hrefKey]: page.path,
24268
+ [labelKey]: page.title,
24269
+ [NAV_COUNT_KEY]: String(index + 1),
24270
+ [NAV_ORDER_KEY]: getNavbarOrderJson()
24271
+ },
24272
+ deps
24273
+ );
24274
+ return true;
24275
+ }
24276
+ function retargetPageLinks(change, deps) {
24277
+ const { oldPath, newPath, oldTitle, newTitle } = change;
24278
+ if (!oldPath || !newPath || normalizePath2(oldPath) === normalizePath2(newPath)) return 0;
24279
+ const content = deps.getEditContent();
24280
+ const delta = {};
24281
+ for (const anchor of Array.from(document.querySelectorAll("[data-ohw-href-key]"))) {
24282
+ const hrefKey = anchor.getAttribute("data-ohw-href-key");
24283
+ if (!isPageLinkKey(hrefKey)) continue;
24284
+ const href = currentHref(hrefKey, anchor, content);
24285
+ if (!pointsAt(href, oldPath)) continue;
24286
+ const nextHref = retargetHref(href, oldPath, newPath);
24287
+ deps.applyLinkByKey(hrefKey, nextHref);
24288
+ delta[hrefKey] = nextHref;
24289
+ if (!oldTitle || !newTitle) continue;
24290
+ const labelKey = labelKeyFor(hrefKey);
24291
+ const label = content[labelKey] ?? anchor.querySelector('[data-ohw-editable="text"]')?.textContent ?? "";
24292
+ if (label.trim() !== oldTitle) continue;
24293
+ setLabelText(labelKey, newTitle);
24294
+ delta[labelKey] = newTitle;
24295
+ }
24296
+ commit(delta, deps);
24297
+ return Object.keys(delta).filter((key) => key.endsWith("-href")).length;
24298
+ }
24299
+
24103
24300
  // src/ui/navbar-container-chrome.tsx
24104
24301
  var import_lucide_react21 = require("lucide-react");
24105
24302
  var import_jsx_runtime37 = require("react/jsx-runtime");
@@ -25459,9 +25656,9 @@ function FloatingToolbar({
25459
25656
  showEditLink,
25460
25657
  onEditLink
25461
25658
  }) {
25462
- const localRef = import_react21.default.useRef(null);
25463
- const [measuredW, setMeasuredW] = import_react21.default.useState(330);
25464
- const setRefs = import_react21.default.useCallback(
25659
+ const localRef = import_react23.default.useRef(null);
25660
+ const [measuredW, setMeasuredW] = import_react23.default.useState(330);
25661
+ const setRefs = import_react23.default.useCallback(
25465
25662
  (node) => {
25466
25663
  localRef.current = node;
25467
25664
  if (typeof elRef === "function") elRef(node);
@@ -25473,7 +25670,7 @@ function FloatingToolbar({
25473
25670
  },
25474
25671
  [elRef]
25475
25672
  );
25476
- import_react21.default.useLayoutEffect(() => {
25673
+ import_react23.default.useLayoutEffect(() => {
25477
25674
  const node = localRef.current;
25478
25675
  if (!node) return;
25479
25676
  const update = () => {
@@ -25499,7 +25696,7 @@ function FloatingToolbar({
25499
25696
  pointerEvents: "auto"
25500
25697
  },
25501
25698
  children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(CustomToolbar, { children: [
25502
- TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react21.default.Fragment, { children: [
25699
+ TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react23.default.Fragment, { children: [
25503
25700
  gi > 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CustomToolbarDivider, {}),
25504
25701
  btns.map((btn) => {
25505
25702
  const isActive = activeCommands.has(btn.cmd);
@@ -25704,12 +25901,12 @@ function resolveSubdomain(subdomainFromQuery) {
25704
25901
  return "";
25705
25902
  }
25706
25903
  function OhhwellsBridge() {
25707
- const pathname = (0, import_navigation3.usePathname)();
25708
- const router = (0, import_navigation3.useRouter)();
25709
- const searchParams = (0, import_navigation3.useSearchParams)();
25904
+ const pathname = (0, import_navigation4.usePathname)();
25905
+ const router = (0, import_navigation4.useRouter)();
25906
+ const searchParams = (0, import_navigation4.useSearchParams)();
25710
25907
  const isEditMode = isEditSessionActive();
25711
- const [bridgeRoot, setBridgeRoot] = (0, import_react21.useState)(null);
25712
- (0, import_react21.useEffect)(() => {
25908
+ const [bridgeRoot, setBridgeRoot] = (0, import_react23.useState)(null);
25909
+ (0, import_react23.useEffect)(() => {
25713
25910
  const figtreeFontId = "ohw-figtree-font";
25714
25911
  if (!document.getElementById(figtreeFontId)) {
25715
25912
  const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
@@ -25735,8 +25932,8 @@ function OhhwellsBridge() {
25735
25932
  };
25736
25933
  }, []);
25737
25934
  const subdomainFromQuery = searchParams.get("subdomain");
25738
- const [subdomain, setSubdomain] = (0, import_react21.useState)(() => resolveSubdomain(subdomainFromQuery));
25739
- (0, import_react21.useLayoutEffect)(() => {
25935
+ const [subdomain, setSubdomain] = (0, import_react23.useState)(() => resolveSubdomain(subdomainFromQuery));
25936
+ (0, import_react23.useLayoutEffect)(() => {
25740
25937
  const next = resolveSubdomain(subdomainFromQuery);
25741
25938
  if (next !== subdomain) setSubdomain(next);
25742
25939
  if (next) return;
@@ -25748,7 +25945,7 @@ function OhhwellsBridge() {
25748
25945
  }, 0);
25749
25946
  return () => window.clearTimeout(t);
25750
25947
  }, [subdomainFromQuery, subdomain]);
25751
- (0, import_react21.useEffect)(() => {
25948
+ (0, import_react23.useEffect)(() => {
25752
25949
  if (!subdomainFromQuery || typeof window === "undefined") return;
25753
25950
  const url = new URL(window.location.href);
25754
25951
  if (!url.searchParams.has("subdomain")) return;
@@ -25758,22 +25955,24 @@ function OhhwellsBridge() {
25758
25955
  }, [subdomainFromQuery]);
25759
25956
  useLinkHrefGuardian(pathname, subdomain, isEditMode);
25760
25957
  useSavedLinkNavigation(isEditMode);
25761
- const postToParent2 = (0, import_react21.useCallback)((data) => {
25958
+ useNavDropdownToggle(isEditMode);
25959
+ useHashLinkScroll(isEditMode);
25960
+ const postToParent2 = (0, import_react23.useCallback)((data) => {
25762
25961
  if (typeof window !== "undefined" && window.parent !== window) {
25763
25962
  window.parent.postMessage(data, "*");
25764
25963
  }
25765
25964
  }, []);
25766
- const [fetchState, setFetchState] = (0, import_react21.useState)("idle");
25767
- const [showBranding, setShowBranding] = (0, import_react21.useState)(false);
25768
- const autoSaveTimers = (0, import_react21.useRef)(/* @__PURE__ */ new Map());
25769
- (0, import_react21.useEffect)(() => {
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)(() => {
25770
25969
  stampBridgeVersionOnDocument();
25771
25970
  }, []);
25772
- (0, import_react21.useEffect)(() => {
25971
+ (0, import_react23.useEffect)(() => {
25773
25972
  if (isEditMode) return;
25774
25973
  return armLoaderHangBeacon(subdomain, fetchState);
25775
25974
  }, [isEditMode, subdomain, fetchState]);
25776
- (0, import_react21.useEffect)(() => {
25975
+ (0, import_react23.useEffect)(() => {
25777
25976
  if (isEditMode || !subdomain) return;
25778
25977
  const onError = (event) => {
25779
25978
  reportOutageBeacon({
@@ -25794,40 +25993,40 @@ function OhhwellsBridge() {
25794
25993
  window.removeEventListener("unhandledrejection", onRejection);
25795
25994
  };
25796
25995
  }, [isEditMode, subdomain]);
25797
- const activeElRef = (0, import_react21.useRef)(null);
25798
- const pointerHeldRef = (0, import_react21.useRef)(false);
25799
- const selectedElRef = (0, import_react21.useRef)(null);
25800
- const selectedHrefKeyRef = (0, import_react21.useRef)(null);
25801
- const selectedFooterColAttrRef = (0, import_react21.useRef)(null);
25802
- const footerHeadingTitleCacheRef = (0, import_react21.useRef)(/* @__PURE__ */ new Map());
25803
- const originalContentRef = (0, import_react21.useRef)(null);
25804
- const activeStateElRef = (0, import_react21.useRef)(null);
25805
- const parentScrollRef = (0, import_react21.useRef)(null);
25806
- const visibleViewportRef = (0, import_react21.useRef)(null);
25807
- const [dialogPortalContainer, setDialogPortalContainer] = (0, import_react21.useState)(null);
25808
- const attachVisibleViewport = (0, import_react21.useCallback)((node) => {
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) => {
25809
26008
  visibleViewportRef.current = node;
25810
26009
  setDialogPortalContainer(node);
25811
26010
  if (node) applyVisibleViewport(node, parentScrollRef.current);
25812
26011
  }, []);
25813
- const toolbarElRef = (0, import_react21.useRef)(null);
25814
- const glowElRef = (0, import_react21.useRef)(null);
25815
- const hoveredImageRef = (0, import_react21.useRef)(null);
25816
- const hoveredImageHasTextOverlapRef = (0, import_react21.useRef)(false);
25817
- const dragOverElRef = (0, import_react21.useRef)(null);
25818
- const [mediaHover, setMediaHover] = (0, import_react21.useState)(null);
25819
- const [selectedAiSectionId, setSelectedAiSectionId] = (0, import_react21.useState)(null);
25820
- const selectedAiSectionIdRef = (0, import_react21.useRef)(null);
25821
- const handleAiSectionSelectionChange = (0, import_react21.useCallback)((id) => {
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) => {
25822
26021
  selectedAiSectionIdRef.current = id;
25823
26022
  setSelectedAiSectionId(id);
25824
26023
  }, []);
25825
- const [selectedMedia, setSelectedMedia] = (0, import_react21.useState)(null);
25826
- const selectedMediaElRef = (0, import_react21.useRef)(null);
25827
- const mediaKeyDropTokenRef = (0, import_react21.useRef)(0);
25828
- const selectedIconElRef = (0, import_react21.useRef)(null);
25829
- const selectedSocialElRef = (0, import_react21.useRef)(null);
25830
- const queueSectionKeyDrop = (0, import_react21.useCallback)((prev) => {
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) => {
25831
26030
  const sectionEl = prev?.closest("[data-ohw-section]") ?? null;
25832
26031
  if (!sectionEl) return;
25833
26032
  const sectionInstanceId = instanceIdOf(movableUnit(sectionEl)) || null;
@@ -25848,31 +26047,31 @@ function OhhwellsBridge() {
25848
26047
  window.addEventListener("message", onQueueDrained);
25849
26048
  window.postMessage({ type: "ow:media-key-drop", token }, "*");
25850
26049
  }, []);
25851
- const clearMediaSelection = (0, import_react21.useCallback)(() => {
26050
+ const clearMediaSelection = (0, import_react23.useCallback)(() => {
25852
26051
  const prev = selectedMediaElRef.current;
25853
26052
  selectedMediaElRef.current = null;
25854
26053
  setSelectedMedia(null);
25855
26054
  queueSectionKeyDrop(prev);
25856
26055
  }, [queueSectionKeyDrop]);
25857
- const clearMediaSelectionRef = (0, import_react21.useRef)(clearMediaSelection);
26056
+ const clearMediaSelectionRef = (0, import_react23.useRef)(clearMediaSelection);
25858
26057
  clearMediaSelectionRef.current = clearMediaSelection;
25859
- const clearIconSelection = (0, import_react21.useCallback)(() => {
26058
+ const clearIconSelection = (0, import_react23.useCallback)(() => {
25860
26059
  const prev = selectedIconElRef.current;
25861
26060
  if (!prev) return;
25862
26061
  selectedIconElRef.current = null;
25863
26062
  queueSectionKeyDrop(prev);
25864
26063
  }, [queueSectionKeyDrop]);
25865
- const clearIconSelectionRef = (0, import_react21.useRef)(clearIconSelection);
26064
+ const clearIconSelectionRef = (0, import_react23.useRef)(clearIconSelection);
25866
26065
  clearIconSelectionRef.current = clearIconSelection;
25867
- const clearSocialSelection = (0, import_react21.useCallback)(() => {
26066
+ const clearSocialSelection = (0, import_react23.useCallback)(() => {
25868
26067
  const prev = selectedSocialElRef.current;
25869
26068
  if (!prev) return;
25870
26069
  selectedSocialElRef.current = null;
25871
26070
  queueSectionKeyDrop(prev);
25872
26071
  }, [queueSectionKeyDrop]);
25873
- const clearSocialSelectionRef = (0, import_react21.useRef)(clearSocialSelection);
26072
+ const clearSocialSelectionRef = (0, import_react23.useRef)(clearSocialSelection);
25874
26073
  clearSocialSelectionRef.current = clearSocialSelection;
25875
- const selectIconElement = (0, import_react21.useCallback)((el) => {
26074
+ const selectIconElement = (0, import_react23.useCallback)((el) => {
25876
26075
  if (selectedMediaElRef.current) clearMediaSelectionRef.current();
25877
26076
  selectedIconElRef.current = el;
25878
26077
  const sectionEl = el.closest("[data-ohw-section]");
@@ -25885,9 +26084,9 @@ function OhhwellsBridge() {
25885
26084
  keyLabel: "Icon"
25886
26085
  });
25887
26086
  }, []);
25888
- const selectIconElementRef = (0, import_react21.useRef)(selectIconElement);
26087
+ const selectIconElementRef = (0, import_react23.useRef)(selectIconElement);
25889
26088
  selectIconElementRef.current = selectIconElement;
25890
- const selectMediaElement = (0, import_react21.useCallback)((el) => {
26089
+ const selectMediaElement = (0, import_react23.useCallback)((el) => {
25891
26090
  const r2 = el.getBoundingClientRect();
25892
26091
  const video = el.dataset.ohwEditable === "video" ? el.querySelector("video") : null;
25893
26092
  selectedIconElRef.current = null;
@@ -25912,9 +26111,9 @@ function OhhwellsBridge() {
25912
26111
  keyLabel: el.dataset.ohwEditable === "video" ? "Video" : el.dataset.ohwEditable === "bg-image" ? "Background" : "Image"
25913
26112
  });
25914
26113
  }, []);
25915
- const selectMediaElementRef = (0, import_react21.useRef)(selectMediaElement);
26114
+ const selectMediaElementRef = (0, import_react23.useRef)(selectMediaElement);
25916
26115
  selectMediaElementRef.current = selectMediaElement;
25917
- (0, import_react21.useEffect)(() => {
26116
+ (0, import_react23.useEffect)(() => {
25918
26117
  if (!selectedMedia) return;
25919
26118
  const update = () => {
25920
26119
  const el = selectedMediaElRef.current;
@@ -25934,54 +26133,54 @@ function OhhwellsBridge() {
25934
26133
  window.removeEventListener("resize", update);
25935
26134
  };
25936
26135
  }, [selectedMedia !== null]);
25937
- const [carouselHover, setCarouselHover] = (0, import_react21.useState)(null);
25938
- const [uploadingRects, setUploadingRects] = (0, import_react21.useState)({});
25939
- const hoveredGapRef = (0, import_react21.useRef)(null);
25940
- const imageUnhoverTimerRef = (0, import_react21.useRef)(null);
25941
- const imageShowTimerRef = (0, import_react21.useRef)(null);
25942
- const editStylesRef = (0, import_react21.useRef)(null);
25943
- const activateRef = (0, import_react21.useRef)(() => {
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)(() => {
25944
26143
  });
25945
- const deactivateRef = (0, import_react21.useRef)(() => {
26144
+ const deactivateRef = (0, import_react23.useRef)(() => {
25946
26145
  });
25947
- const selectRef = (0, import_react21.useRef)(() => {
26146
+ const selectRef = (0, import_react23.useRef)(() => {
25948
26147
  });
25949
- const selectFrameRef = (0, import_react21.useRef)(() => {
26148
+ const selectFrameRef = (0, import_react23.useRef)(() => {
25950
26149
  });
25951
- const selectLogoRef = (0, import_react21.useRef)(() => {
26150
+ const selectLogoRef = (0, import_react23.useRef)(() => {
25952
26151
  });
25953
- const openLogoSizePanelRef = (0, import_react21.useRef)(() => {
26152
+ const openLogoSizePanelRef = (0, import_react23.useRef)(() => {
25954
26153
  });
25955
- const deselectRef = (0, import_react21.useRef)(() => {
26154
+ const deselectRef = (0, import_react23.useRef)(() => {
25956
26155
  });
25957
- const closeFloatingPanelOnlyRef = (0, import_react21.useRef)(() => {
26156
+ const closeFloatingPanelOnlyRef = (0, import_react23.useRef)(() => {
25958
26157
  });
25959
- const reselectNavigationItemRef = (0, import_react21.useRef)(() => {
26158
+ const reselectNavigationItemRef = (0, import_react23.useRef)(() => {
25960
26159
  });
25961
- const commitNavigationTextEditRef = (0, import_react21.useRef)(() => {
26160
+ const commitNavigationTextEditRef = (0, import_react23.useRef)(() => {
25962
26161
  });
25963
- const handleDeleteSelectedRef = (0, import_react21.useRef)(() => false);
25964
- const runPendingDeleteUndoRef = (0, import_react21.useRef)(() => false);
25965
- const isFooterFrameSelectionRef = (0, import_react21.useRef)(false);
25966
- const refreshActiveCommandsRef = (0, import_react21.useRef)(() => {
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)(() => {
25967
26166
  });
25968
- const postToParentRef = (0, import_react21.useRef)(postToParent2);
26167
+ const postToParentRef = (0, import_react23.useRef)(postToParent2);
25969
26168
  postToParentRef.current = postToParent2;
25970
- const aiSectionApiRef = (0, import_react21.useRef)(null);
25971
- const sectionsLoadedRef = (0, import_react21.useRef)(false);
25972
- const pendingScheduleConfigRequests = (0, import_react21.useRef)([]);
25973
- const [toolbarRect, setToolbarRect] = (0, import_react21.useState)(null);
25974
- const [formPickRect, setFormPickRect] = (0, import_react21.useState)(null);
25975
- const formPickElRef = (0, import_react21.useRef)(null);
25976
- const [formViewState, setFormViewStateUi] = (0, import_react21.useState)("default");
25977
- const [formPickCount, setFormPickCount] = (0, import_react21.useState)(null);
25978
- const [formHoverRect, setFormHoverRect] = (0, import_react21.useState)(null);
25979
- const formHoverElRef = (0, import_react21.useRef)(null);
25980
- const [fieldPickRect, setFieldPickRect] = (0, import_react21.useState)(null);
25981
- const fieldPickElRef = (0, import_react21.useRef)(null);
25982
- const [fieldPickState, setFieldPickState] = (0, import_react21.useState)(null);
25983
- const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0, import_react21.useState)(false);
25984
- const clearFormPick = (0, import_react21.useCallback)(() => {
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)(() => {
25985
26184
  const form = formPickElRef.current;
25986
26185
  const editing = fieldPickElRef.current;
25987
26186
  if (commitPlaceholderEdit(editing) && editing) {
@@ -26001,7 +26200,7 @@ function OhhwellsBridge() {
26001
26200
  formPickElRef.current = null;
26002
26201
  setFormPickRect(null);
26003
26202
  }, []);
26004
- const clearFieldPick = (0, import_react21.useCallback)(() => {
26203
+ const clearFieldPick = (0, import_react23.useCallback)(() => {
26005
26204
  const wrapper = fieldPickElRef.current;
26006
26205
  if (commitPlaceholderEdit(wrapper) && wrapper) {
26007
26206
  const form = wrapper.closest('[data-ohw-editable="form"]');
@@ -26011,9 +26210,9 @@ function OhhwellsBridge() {
26011
26210
  setFieldPickRect(null);
26012
26211
  setFieldPickState(null);
26013
26212
  }, []);
26014
- const persistFieldsRef = (0, import_react21.useRef)(() => {
26213
+ const persistFieldsRef = (0, import_react23.useRef)(() => {
26015
26214
  });
26016
- const persistFields = (0, import_react21.useCallback)(
26215
+ const persistFields = (0, import_react23.useCallback)(
26017
26216
  (form) => {
26018
26217
  const key = formKeyOf(form);
26019
26218
  if (!key) return;
@@ -26024,7 +26223,7 @@ function OhhwellsBridge() {
26024
26223
  []
26025
26224
  );
26026
26225
  persistFieldsRef.current = persistFields;
26027
- const selectField = (0, import_react21.useCallback)((wrapper) => {
26226
+ const selectField = (0, import_react23.useCallback)((wrapper) => {
26028
26227
  if (fieldPickElRef.current && fieldPickElRef.current !== wrapper) {
26029
26228
  commitPlaceholderEdit(fieldPickElRef.current);
26030
26229
  }
@@ -26037,7 +26236,7 @@ function OhhwellsBridge() {
26037
26236
  setFieldPickState({ type: fieldTypeOf(wrapper), required: isFieldRequired(wrapper) });
26038
26237
  setFieldTypePickerOpen(false);
26039
26238
  }, []);
26040
- const withSelectedField = (0, import_react21.useCallback)(
26239
+ const withSelectedField = (0, import_react23.useCallback)(
26041
26240
  (run) => {
26042
26241
  const wrapper = fieldPickElRef.current;
26043
26242
  const form = formPickElRef.current;
@@ -26050,28 +26249,28 @@ function OhhwellsBridge() {
26050
26249
  },
26051
26250
  [persistFields]
26052
26251
  );
26053
- const handleFieldTypeChange = (0, import_react21.useCallback)(
26252
+ const handleFieldTypeChange = (0, import_react23.useCallback)(
26054
26253
  (type) => withSelectedField((_form, wrapper) => {
26055
26254
  applyFieldType(wrapper, type);
26056
26255
  selectField(wrapper);
26057
26256
  }),
26058
26257
  [selectField, withSelectedField]
26059
26258
  );
26060
- const handleFieldRequiredToggle = (0, import_react21.useCallback)(
26259
+ const handleFieldRequiredToggle = (0, import_react23.useCallback)(
26061
26260
  () => withSelectedField((_form, wrapper) => {
26062
26261
  setFieldRequired(wrapper, !isFieldRequired(wrapper));
26063
26262
  selectField(wrapper);
26064
26263
  }),
26065
26264
  [selectField, withSelectedField]
26066
26265
  );
26067
- const handleFieldDuplicate = (0, import_react21.useCallback)(
26266
+ const handleFieldDuplicate = (0, import_react23.useCallback)(
26068
26267
  () => withSelectedField((form, wrapper) => {
26069
26268
  const copy = duplicateField(form, wrapper);
26070
26269
  selectField(copy);
26071
26270
  }),
26072
26271
  [selectField, withSelectedField]
26073
26272
  );
26074
- const handleFieldDelete = (0, import_react21.useCallback)(
26273
+ const handleFieldDelete = (0, import_react23.useCallback)(
26075
26274
  () => withSelectedField((_form, wrapper) => {
26076
26275
  removeField(wrapper);
26077
26276
  clearFieldPick();
@@ -26079,7 +26278,7 @@ function OhhwellsBridge() {
26079
26278
  }),
26080
26279
  [clearFieldPick, withSelectedField]
26081
26280
  );
26082
- const handleAddField = (0, import_react21.useCallback)(
26281
+ const handleAddField = (0, import_react23.useCallback)(
26083
26282
  (type) => {
26084
26283
  const form = formPickElRef.current;
26085
26284
  if (!form) return;
@@ -26095,8 +26294,8 @@ function OhhwellsBridge() {
26095
26294
  },
26096
26295
  [persistFields, selectField]
26097
26296
  );
26098
- const fieldDragRef = (0, import_react21.useRef)(null);
26099
- const buildFieldDropSlots = (0, import_react21.useCallback)((form, draggedKey) => {
26297
+ const fieldDragRef = (0, import_react23.useRef)(null);
26298
+ const buildFieldDropSlots = (0, import_react23.useCallback)((form, draggedKey) => {
26100
26299
  const others = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== draggedKey);
26101
26300
  const slots = others.map((el) => {
26102
26301
  const rect = el.getBoundingClientRect();
@@ -26109,7 +26308,7 @@ function OhhwellsBridge() {
26109
26308
  }
26110
26309
  return slots;
26111
26310
  }, []);
26112
- const handleFieldDragStart = (0, import_react21.useCallback)(() => {
26311
+ const handleFieldDragStart = (0, import_react23.useCallback)(() => {
26113
26312
  const wrapper = fieldPickElRef.current;
26114
26313
  const form = formPickElRef.current;
26115
26314
  if (!wrapper || !form) return;
@@ -26118,18 +26317,18 @@ function OhhwellsBridge() {
26118
26317
  setFieldDragging(true);
26119
26318
  setFieldDropSlots(buildFieldDropSlots(form, key));
26120
26319
  }, [buildFieldDropSlots]);
26121
- const handleFieldDragEnd = (0, import_react21.useCallback)(() => {
26320
+ const handleFieldDragEnd = (0, import_react23.useCallback)(() => {
26122
26321
  fieldDragRef.current = null;
26123
26322
  setFieldDropIndex(null);
26124
26323
  setFieldDropSlots([]);
26125
26324
  setFieldDragging(false);
26126
26325
  }, []);
26127
- const [fieldDropIndex, setFieldDropIndex] = (0, import_react21.useState)(null);
26128
- const [fieldDropSlots, setFieldDropSlots] = (0, import_react21.useState)([]);
26129
- const [fieldDragging, setFieldDragging] = (0, import_react21.useState)(false);
26130
- const clearFormPickRef = (0, import_react21.useRef)(clearFormPick);
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);
26131
26330
  clearFormPickRef.current = clearFormPick;
26132
- (0, import_react21.useEffect)(() => {
26331
+ (0, import_react23.useEffect)(() => {
26133
26332
  const el = fieldPickElRef.current;
26134
26333
  if (!el || fieldPickRect === null) return;
26135
26334
  const observer = new ResizeObserver(() => {
@@ -26138,7 +26337,7 @@ function OhhwellsBridge() {
26138
26337
  observer.observe(el);
26139
26338
  return () => observer.disconnect();
26140
26339
  }, [fieldPickRect !== null, fieldPickState]);
26141
- (0, import_react21.useEffect)(() => {
26340
+ (0, import_react23.useEffect)(() => {
26142
26341
  const el = formPickElRef.current;
26143
26342
  if (!el || formPickRect === null) return;
26144
26343
  const observer = new ResizeObserver(() => {
@@ -26147,25 +26346,25 @@ function OhhwellsBridge() {
26147
26346
  observer.observe(el);
26148
26347
  return () => observer.disconnect();
26149
26348
  }, [formPickRect !== null, formViewState]);
26150
- const [toolbarVariant, setToolbarVariant] = (0, import_react21.useState)("none");
26151
- const toolbarVariantRef = (0, import_react21.useRef)("none");
26349
+ const [toolbarVariant, setToolbarVariant] = (0, import_react23.useState)("none");
26350
+ const toolbarVariantRef = (0, import_react23.useRef)("none");
26152
26351
  toolbarVariantRef.current = toolbarVariant;
26153
- const [selectedIsCta, setSelectedIsCta] = (0, import_react21.useState)(false);
26154
- const [selectedIsSocial, setSelectedIsSocial] = (0, import_react21.useState)(false);
26155
- const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0, import_react21.useState)(false);
26156
- const [reorderHrefKey, setReorderHrefKey] = (0, import_react21.useState)(null);
26157
- const [reorderDragDisabled, setReorderDragDisabled] = (0, import_react21.useState)(false);
26158
- const [toggleState, setToggleState] = (0, import_react21.useState)(null);
26159
- const [maxBadge, setMaxBadge] = (0, import_react21.useState)(null);
26160
- const [activeCommands, setActiveCommands] = (0, import_react21.useState)(/* @__PURE__ */ new Set());
26161
- const [sectionGap, setSectionGap] = (0, import_react21.useState)(null);
26162
- const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react21.useState)(false);
26163
- const hoveredNavContainerRef = (0, import_react21.useRef)(null);
26164
- const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react21.useState)(null);
26165
- const hoveredItemElRef = (0, import_react21.useRef)(null);
26166
- const [hoveredItemRect, setHoveredItemRect] = (0, import_react21.useState)(null);
26167
- const [hoveredTextRect, setHoveredTextRect] = (0, import_react21.useState)(null);
26168
- (0, import_react21.useEffect)(() => {
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)(() => {
26169
26368
  const sync = () => {
26170
26369
  const el = document.querySelector(
26171
26370
  '[data-ohw-hovered]:not([contenteditable]):not([data-ohw-href-key]):not([data-ohw-editable="form"] *)'
@@ -26209,63 +26408,63 @@ function OhhwellsBridge() {
26209
26408
  });
26210
26409
  return () => observer.disconnect();
26211
26410
  }, []);
26212
- const siblingHintElRef = (0, import_react21.useRef)(null);
26213
- const [siblingHintRect, setSiblingHintRect] = (0, import_react21.useState)(null);
26214
- const [siblingHintRects, setSiblingHintRects] = (0, import_react21.useState)([]);
26215
- const [isItemDragging, setIsItemDragging] = (0, import_react21.useState)(false);
26216
- const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react21.useState)(false);
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);
26217
26416
  isFooterFrameSelectionRef.current = isFooterFrameSelection;
26218
- const [floatingPanel, setFloatingPanel] = (0, import_react21.useState)(null);
26219
- const floatingPanelOpenRef = (0, import_react21.useRef)(false);
26417
+ const [floatingPanel, setFloatingPanel] = (0, import_react23.useState)(null);
26418
+ const floatingPanelOpenRef = (0, import_react23.useRef)(false);
26220
26419
  floatingPanelOpenRef.current = floatingPanel !== null;
26221
- const floatingPanelRef = (0, import_react21.useRef)(null);
26420
+ const floatingPanelRef = (0, import_react23.useRef)(null);
26222
26421
  floatingPanelRef.current = floatingPanel;
26223
- const [floatingPanelPos, setFloatingPanelPos] = (0, import_react21.useState)(null);
26224
- const buttonCollectionDragRef = (0, import_react21.useRef)(null);
26225
- const buttonDropInsertIndexRef = (0, import_react21.useRef)(null);
26226
- const [buttonDropSlots, setButtonDropSlots] = (0, import_react21.useState)([]);
26227
- const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react21.useState)(null);
26228
- const buttonPointerDragRef = (0, import_react21.useRef)(null);
26229
- const [buttonStyleTick, setButtonStyleTick] = (0, import_react21.useState)(0);
26230
- const [logoSizeDraft, setLogoSizeDraft] = (0, import_react21.useState)(null);
26231
- const [editorViewport, setEditorViewport] = (0, import_react21.useState)("desktop");
26232
- const [parentScrollSnap, setParentScrollSnap] = (0, import_react21.useState)(null);
26233
- const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react21.useState)(null);
26234
- const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react21.useState)(null);
26235
- const footerDragRef = (0, import_react21.useRef)(null);
26236
- const [footerDropSlots, setFooterDropSlots] = (0, import_react21.useState)([]);
26237
- const [activeFooterDropIndex, setActiveFooterDropIndex] = (0, import_react21.useState)(null);
26238
- const [draggedItemRect, setDraggedItemRect] = (0, import_react21.useState)(null);
26239
- const footerPointerDragRef = (0, import_react21.useRef)(null);
26240
- const suppressNextClickRef = (0, import_react21.useRef)(false);
26241
- const suppressClickUntilRef = (0, import_react21.useRef)(0);
26242
- const [linkPopover, setLinkPopover] = (0, import_react21.useState)(null);
26243
- const linkPopoverSessionRef = (0, import_react21.useRef)(null);
26244
- const addNavAfterAnchorRef = (0, import_react21.useRef)(null);
26245
- const editContentRef = (0, import_react21.useRef)({});
26246
- const aiSectionsRef = (0, import_react21.useRef)("");
26247
- const aiFooterRef = (0, import_react21.useRef)("");
26248
- const applyTreeLocalRef = (0, import_react21.useRef)(
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)(
26249
26448
  null
26250
26449
  );
26251
- const applyFooterTreeLocalRef = (0, import_react21.useRef)(null);
26252
- const clearInteractionChromeRef = (0, import_react21.useRef)(() => {
26450
+ const applyFooterTreeLocalRef = (0, import_react23.useRef)(null);
26451
+ const clearInteractionChromeRef = (0, import_react23.useRef)(() => {
26253
26452
  });
26254
- const brandKitRef = (0, import_react21.useRef)("");
26255
- const stylesRef = (0, import_react21.useRef)("");
26256
- const appliedDrawerRef = (0, import_react21.useRef)(null);
26257
- const pendingDeleteUndoRef = (0, import_react21.useRef)(null);
26258
- const [sitePages, setSitePages] = (0, import_react21.useState)([]);
26259
- const collectionItemsRef = (0, import_react21.useRef)(/* @__PURE__ */ new Map());
26260
- const [sectionsByPath, setSectionsByPath] = (0, import_react21.useState)({});
26261
- const sectionsPrefetchGenRef = (0, import_react21.useRef)(0);
26262
- const setLinkPopoverRef = (0, import_react21.useRef)(setLinkPopover);
26263
- const linkPopoverPanelRef = (0, import_react21.useRef)(null);
26264
- const linkPopoverOpenRef = (0, import_react21.useRef)(false);
26265
- const linkPopoverGraceUntilRef = (0, import_react21.useRef)(0);
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);
26266
26465
  setLinkPopoverRef.current = setLinkPopover;
26267
26466
  linkPopoverSessionRef.current = linkPopover;
26268
- (0, import_react21.useEffect)(() => {
26467
+ (0, import_react23.useEffect)(() => {
26269
26468
  setSectionOrderPersistHandler((entries) => {
26270
26469
  const currentPath = window.location.pathname;
26271
26470
  const merged = mergePageSectionOrder(editContentRef.current[SECTION_ORDER_KEY], currentPath, entries);
@@ -26275,7 +26474,7 @@ function OhhwellsBridge() {
26275
26474
  });
26276
26475
  return () => setSectionOrderPersistHandler(null);
26277
26476
  }, []);
26278
- (0, import_react21.useEffect)(() => {
26477
+ (0, import_react23.useEffect)(() => {
26279
26478
  setAiFooterMountOptions({
26280
26479
  resolvePageHref: (pageOrAnchorId) => {
26281
26480
  const [pageId, anchor] = pageOrAnchorId.split("#");
@@ -26338,7 +26537,7 @@ function OhhwellsBridge() {
26338
26537
  const bumpLinkPopoverGrace = () => {
26339
26538
  linkPopoverGraceUntilRef.current = Date.now() + 350;
26340
26539
  };
26341
- const runSectionsPrefetch = (0, import_react21.useCallback)((pages) => {
26540
+ const runSectionsPrefetch = (0, import_react23.useCallback)((pages) => {
26342
26541
  if (!isEditMode || shouldUseDevFixtures() || pages.length === 0) return;
26343
26542
  const gen = ++sectionsPrefetchGenRef.current;
26344
26543
  const paths = pages.map((p) => p.path);
@@ -26357,9 +26556,9 @@ function OhhwellsBridge() {
26357
26556
  );
26358
26557
  });
26359
26558
  }, [isEditMode, pathname]);
26360
- const runSectionsPrefetchRef = (0, import_react21.useRef)(runSectionsPrefetch);
26559
+ const runSectionsPrefetchRef = (0, import_react23.useRef)(runSectionsPrefetch);
26361
26560
  runSectionsPrefetchRef.current = runSectionsPrefetch;
26362
- (0, import_react21.useEffect)(() => {
26561
+ (0, import_react23.useEffect)(() => {
26363
26562
  if (!linkPopover) {
26364
26563
  document.documentElement.removeAttribute("data-ohw-link-popover-open");
26365
26564
  return;
@@ -26387,7 +26586,7 @@ function OhhwellsBridge() {
26387
26586
  document.documentElement.removeAttribute("data-ohw-link-popover-open");
26388
26587
  };
26389
26588
  }, [linkPopover, postToParent2]);
26390
- (0, import_react21.useEffect)(() => {
26589
+ (0, import_react23.useEffect)(() => {
26391
26590
  if (!isEditMode) return;
26392
26591
  const useFixtures = shouldUseDevFixtures();
26393
26592
  if (useFixtures) {
@@ -26413,14 +26612,51 @@ function OhhwellsBridge() {
26413
26612
  if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
26414
26613
  return () => window.removeEventListener("message", onSitePages);
26415
26614
  }, [isEditMode, postToParent2]);
26416
- (0, import_react21.useEffect)(() => {
26615
+ (0, import_react23.useEffect)(() => {
26616
+ if (!isEditMode) return;
26617
+ const deps = {
26618
+ getEditContent: () => editContentRef.current,
26619
+ setEditContent: (next) => {
26620
+ editContentRef.current = next;
26621
+ },
26622
+ applyLinkByKey,
26623
+ postToParent: postToParent2
26624
+ };
26625
+ const onPageMessage = (e) => {
26626
+ if (e.data?.type === "ow:page-created") {
26627
+ const { path, title } = e.data;
26628
+ if (typeof path !== "string" || !path) return;
26629
+ if (addNavLinkForPage({ path, title: typeof title === "string" && title ? title : path }, deps)) {
26630
+ enforceLinkHrefs();
26631
+ }
26632
+ return;
26633
+ }
26634
+ if (e.data?.type === "ow:page-renamed") {
26635
+ const { oldPath, newPath, oldTitle, newTitle } = e.data;
26636
+ if (typeof oldPath !== "string" || typeof newPath !== "string") return;
26637
+ const moved = retargetPageLinks(
26638
+ {
26639
+ oldPath,
26640
+ newPath,
26641
+ oldTitle: typeof oldTitle === "string" ? oldTitle : void 0,
26642
+ newTitle: typeof newTitle === "string" ? newTitle : void 0
26643
+ },
26644
+ deps
26645
+ );
26646
+ if (moved > 0) enforceLinkHrefs();
26647
+ }
26648
+ };
26649
+ window.addEventListener("message", onPageMessage);
26650
+ return () => window.removeEventListener("message", onPageMessage);
26651
+ }, [isEditMode, postToParent2]);
26652
+ (0, import_react23.useEffect)(() => {
26417
26653
  if (!isEditMode || shouldUseDevFixtures()) return;
26418
26654
  void loadAllSectionsManifest().then((manifest) => {
26419
26655
  if (Object.keys(manifest).length === 0) return;
26420
26656
  setSectionsByPath((prev) => ({ ...manifest, ...prev }));
26421
26657
  });
26422
26658
  }, [isEditMode]);
26423
- (0, import_react21.useEffect)(() => {
26659
+ (0, import_react23.useEffect)(() => {
26424
26660
  const update = () => {
26425
26661
  const el = activeElRef.current ?? selectedElRef.current;
26426
26662
  if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
@@ -26444,10 +26680,10 @@ function OhhwellsBridge() {
26444
26680
  vvp.removeEventListener("resize", update);
26445
26681
  };
26446
26682
  }, []);
26447
- const refreshStateRules = (0, import_react21.useCallback)(() => {
26683
+ const refreshStateRules = (0, import_react23.useCallback)(() => {
26448
26684
  editStylesRef.current?.forceHover && (editStylesRef.current.forceHover.textContent = collectStateRules());
26449
26685
  }, []);
26450
- const processConfigRequest = (0, import_react21.useCallback)((insertAfterVal) => {
26686
+ const processConfigRequest = (0, import_react23.useCallback)((insertAfterVal) => {
26451
26687
  const tracker = getSectionsTracker();
26452
26688
  let entries = [];
26453
26689
  try {
@@ -26470,7 +26706,7 @@ function OhhwellsBridge() {
26470
26706
  }
26471
26707
  window.postMessage({ type: "ow:schedule-config", insertAfter: insertAfterVal, scheduleId: null }, "*");
26472
26708
  }, [isEditMode]);
26473
- const deactivate = (0, import_react21.useCallback)(() => {
26709
+ const deactivate = (0, import_react23.useCallback)(() => {
26474
26710
  const el = activeElRef.current;
26475
26711
  if (!el) return;
26476
26712
  const isFormBlock = el.dataset.ohwEditable === "form";
@@ -26536,12 +26772,12 @@ function OhhwellsBridge() {
26536
26772
  setToolbarShowEditLink(false);
26537
26773
  postToParent2({ type: "ow:exit-edit" });
26538
26774
  }, [postToParent2]);
26539
- const clearSelectedAttr = (0, import_react21.useCallback)(() => {
26775
+ const clearSelectedAttr = (0, import_react23.useCallback)(() => {
26540
26776
  document.querySelectorAll("[data-ohw-selected]").forEach((el) => {
26541
26777
  el.removeAttribute("data-ohw-selected");
26542
26778
  });
26543
26779
  }, []);
26544
- const deselect = (0, import_react21.useCallback)(() => {
26780
+ const deselect = (0, import_react23.useCallback)(() => {
26545
26781
  const nestedGroup = selectedElRef.current?.closest("[data-ohw-nav-children]") != null ? selectedElRef.current.closest("[data-ohw-nav-group]") : null;
26546
26782
  clearSelectedAttr();
26547
26783
  selectedElRef.current = null;
@@ -26577,20 +26813,20 @@ function OhhwellsBridge() {
26577
26813
  setToolbarVariant("none");
26578
26814
  }
26579
26815
  }, [clearSelectedAttr]);
26580
- const markSelected = (0, import_react21.useCallback)((el) => {
26816
+ const markSelected = (0, import_react23.useCallback)((el) => {
26581
26817
  clearSelectedAttr();
26582
26818
  el.removeAttribute("data-ohw-hovered");
26583
26819
  el.setAttribute("data-ohw-selected", "");
26584
26820
  }, [clearSelectedAttr]);
26585
- const isSelectedForHover = (0, import_react21.useCallback)((el) => {
26821
+ const isSelectedForHover = (0, import_react23.useCallback)((el) => {
26586
26822
  if (!el) return false;
26587
26823
  return [selectedElRef.current, activeElRef.current].some(
26588
26824
  (busy) => busy && (el === busy || busy.contains(el) || el.contains(busy))
26589
26825
  );
26590
26826
  }, []);
26591
- const isSelectedForHoverRef = (0, import_react21.useRef)(isSelectedForHover);
26827
+ const isSelectedForHoverRef = (0, import_react23.useRef)(isSelectedForHover);
26592
26828
  isSelectedForHoverRef.current = isSelectedForHover;
26593
- const resolveHrefKeyElement = (0, import_react21.useCallback)((hrefKey) => {
26829
+ const resolveHrefKeyElement = (0, import_react23.useCallback)((hrefKey) => {
26594
26830
  if (isFooterHrefKey(hrefKey)) {
26595
26831
  return document.querySelector(
26596
26832
  `footer [data-ohw-href-key="${CSS.escape(hrefKey)}"]`
@@ -26605,7 +26841,7 @@ function OhhwellsBridge() {
26605
26841
  `[data-ohw-href-key="${CSS.escape(hrefKey)}"]`
26606
26842
  );
26607
26843
  }, []);
26608
- const resyncSelectedNavigationItem = (0, import_react21.useCallback)(() => {
26844
+ const resyncSelectedNavigationItem = (0, import_react23.useCallback)(() => {
26609
26845
  const hrefKey = selectedHrefKeyRef.current;
26610
26846
  if (hrefKey) {
26611
26847
  const link = resolveHrefKeyElement(hrefKey);
@@ -26643,7 +26879,7 @@ function OhhwellsBridge() {
26643
26879
  );
26644
26880
  }
26645
26881
  }, [resolveHrefKeyElement]);
26646
- const reselectNavigationItem = (0, import_react21.useCallback)((navAnchor) => {
26882
+ const reselectNavigationItem = (0, import_react23.useCallback)((navAnchor) => {
26647
26883
  selectedElRef.current = navAnchor;
26648
26884
  selectedHrefKeyRef.current = navAnchor.getAttribute("data-ohw-href-key");
26649
26885
  selectedFooterColAttrRef.current = null;
@@ -26674,7 +26910,7 @@ function OhhwellsBridge() {
26674
26910
  setToolbarShowEditLink(false);
26675
26911
  setActiveCommands(/* @__PURE__ */ new Set());
26676
26912
  }, [markSelected]);
26677
- const commitNavigationTextEdit = (0, import_react21.useCallback)((navAnchor) => {
26913
+ const commitNavigationTextEdit = (0, import_react23.useCallback)((navAnchor) => {
26678
26914
  const el = activeElRef.current;
26679
26915
  if (!el) return;
26680
26916
  const key = el.dataset.ohwKey;
@@ -26707,7 +26943,7 @@ function OhhwellsBridge() {
26707
26943
  postToParent2({ type: "ow:exit-edit" });
26708
26944
  reselectNavigationItem(navAnchor);
26709
26945
  }, [postToParent2, reselectNavigationItem]);
26710
- const handleAddTopLevelNavItem = (0, import_react21.useCallback)(() => {
26946
+ const handleAddTopLevelNavItem = (0, import_react23.useCallback)(() => {
26711
26947
  const items = listNavbarRootItems();
26712
26948
  addNavAfterAnchorRef.current = items[items.length - 1] ?? null;
26713
26949
  deselectRef.current();
@@ -26719,7 +26955,7 @@ function OhhwellsBridge() {
26719
26955
  intent: "add-nav"
26720
26956
  });
26721
26957
  }, []);
26722
- const maybeWarnNavLinkDropdownConflict = (0, import_react21.useCallback)(
26958
+ const maybeWarnNavLinkDropdownConflict = (0, import_react23.useCallback)(
26723
26959
  (anchor) => {
26724
26960
  if (!isNavbarHrefKey(anchor.getAttribute("data-ohw-href-key"))) return;
26725
26961
  if (!navDropdownsOpenOnClick()) return;
@@ -26732,7 +26968,7 @@ function OhhwellsBridge() {
26732
26968
  },
26733
26969
  [postToParent2]
26734
26970
  );
26735
- const handleNavDropdownOpenChange = (0, import_react21.useCallback)((open) => {
26971
+ const handleNavDropdownOpenChange = (0, import_react23.useCallback)((open) => {
26736
26972
  const selected = selectedElRef.current;
26737
26973
  if (!selected || !isNavigationItem2(selected)) return;
26738
26974
  if (isNestedNavChild(selected)) return;
@@ -26748,7 +26984,7 @@ function OhhwellsBridge() {
26748
26984
  }
26749
26985
  });
26750
26986
  }, []);
26751
- const handleFooterHeadingVisibleChange = (0, import_react21.useCallback)(
26987
+ const handleFooterHeadingVisibleChange = (0, import_react23.useCallback)(
26752
26988
  (visible) => {
26753
26989
  const selected = selectedElRef.current;
26754
26990
  if (!selected || !isFooterFrameSelectionRef.current) return;
@@ -26801,7 +27037,7 @@ function OhhwellsBridge() {
26801
27037
  },
26802
27038
  [postToParent2]
26803
27039
  );
26804
- const enterEditOnNewItem = (0, import_react21.useCallback)((anchor) => {
27040
+ const enterEditOnNewItem = (0, import_react23.useCallback)((anchor) => {
26805
27041
  const label = anchor.querySelector('[data-ohw-editable="text"]');
26806
27042
  if (!label) {
26807
27043
  selectRef.current(anchor);
@@ -26810,8 +27046,8 @@ function OhhwellsBridge() {
26810
27046
  setNavGroupForceOpen(anchor, true);
26811
27047
  activateRef.current(label);
26812
27048
  }, []);
26813
- const pendingSocialAddRef = (0, import_react21.useRef)(null);
26814
- const handleAddChildItem = (0, import_react21.useCallback)(() => {
27049
+ const pendingSocialAddRef = (0, import_react23.useRef)(null);
27050
+ const handleAddChildItem = (0, import_react23.useCallback)(() => {
26815
27051
  const selected = selectedElRef.current;
26816
27052
  if (!selected) return;
26817
27053
  const socialsRow = isSocialsRow(selected) ? selected : findSocialsRow(selected);
@@ -26938,7 +27174,7 @@ function OhhwellsBridge() {
26938
27174
  });
26939
27175
  });
26940
27176
  }, [enterEditOnNewItem, isFooterFrameSelection, maybeWarnNavLinkDropdownConflict, postToParent2]);
26941
- const handleAddFooterColumn = (0, import_react21.useCallback)(() => {
27177
+ const handleAddFooterColumn = (0, import_react23.useCallback)(() => {
26942
27178
  if (document.querySelector("[data-ai-footer]")) {
26943
27179
  const state = parseAiFooterState(aiFooterRef.current);
26944
27180
  if (!state?.tree) return;
@@ -26994,7 +27230,7 @@ function OhhwellsBridge() {
26994
27230
  selectRef.current(result.firstLink);
26995
27231
  });
26996
27232
  }, [postToParent2]);
26997
- const clearFooterDragVisuals = (0, import_react21.useCallback)(() => {
27233
+ const clearFooterDragVisuals = (0, import_react23.useCallback)(() => {
26998
27234
  footerDragRef.current = null;
26999
27235
  setSiblingHintRects([]);
27000
27236
  setFooterDropSlots([]);
@@ -27003,7 +27239,7 @@ function OhhwellsBridge() {
27003
27239
  setIsItemDragging(false);
27004
27240
  unlockFooterDragInteraction();
27005
27241
  }, []);
27006
- const refreshFooterDragVisuals = (0, import_react21.useCallback)((session, activeSlot, clientX, clientY) => {
27242
+ const refreshFooterDragVisuals = (0, import_react23.useCallback)((session, activeSlot, clientX, clientY) => {
27007
27243
  const dragged = session.draggedEl;
27008
27244
  setDraggedItemRect(dragged.getBoundingClientRect());
27009
27245
  if (typeof clientX === "number" && typeof clientY === "number") {
@@ -27035,13 +27271,13 @@ function OhhwellsBridge() {
27035
27271
  const activeIdx = activeSlot ? slots.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
27036
27272
  setActiveFooterDropIndex(activeIdx >= 0 ? activeIdx : null);
27037
27273
  }, []);
27038
- const refreshFooterDragVisualsRef = (0, import_react21.useRef)(refreshFooterDragVisuals);
27274
+ const refreshFooterDragVisualsRef = (0, import_react23.useRef)(refreshFooterDragVisuals);
27039
27275
  refreshFooterDragVisualsRef.current = refreshFooterDragVisuals;
27040
- const commitFooterDragRef = (0, import_react21.useRef)(() => {
27276
+ const commitFooterDragRef = (0, import_react23.useRef)(() => {
27041
27277
  });
27042
- const beginFooterDragRef = (0, import_react21.useRef)(() => {
27278
+ const beginFooterDragRef = (0, import_react23.useRef)(() => {
27043
27279
  });
27044
- const beginFooterDrag = (0, import_react21.useCallback)(
27280
+ const beginFooterDrag = (0, import_react23.useCallback)(
27045
27281
  (session) => {
27046
27282
  const rect = session.draggedEl.getBoundingClientRect();
27047
27283
  session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
@@ -27061,7 +27297,7 @@ function OhhwellsBridge() {
27061
27297
  [refreshFooterDragVisuals]
27062
27298
  );
27063
27299
  beginFooterDragRef.current = beginFooterDrag;
27064
- const commitFooterDrag = (0, import_react21.useCallback)(
27300
+ const commitFooterDrag = (0, import_react23.useCallback)(
27065
27301
  (clientX, clientY) => {
27066
27302
  const session = footerDragRef.current;
27067
27303
  if (!session) {
@@ -27233,7 +27469,7 @@ function OhhwellsBridge() {
27233
27469
  [clearFooterDragVisuals, resolveHrefKeyElement, resyncSelectedNavigationItem]
27234
27470
  );
27235
27471
  commitFooterDragRef.current = commitFooterDrag;
27236
- const startFooterLinkDrag = (0, import_react21.useCallback)(
27472
+ const startFooterLinkDrag = (0, import_react23.useCallback)(
27237
27473
  (anchor, clientX, clientY, wasSelected) => {
27238
27474
  const hrefKey = anchor.getAttribute("data-ohw-href-key");
27239
27475
  if (!hrefKey) return false;
@@ -27269,7 +27505,7 @@ function OhhwellsBridge() {
27269
27505
  },
27270
27506
  [beginFooterDrag]
27271
27507
  );
27272
- const startFooterColumnDrag = (0, import_react21.useCallback)(
27508
+ const startFooterColumnDrag = (0, import_react23.useCallback)(
27273
27509
  (columnEl, clientX, clientY, wasSelected) => {
27274
27510
  const columns = listFooterColumns(columnEl);
27275
27511
  const idx = columns.indexOf(columnEl);
@@ -27289,7 +27525,7 @@ function OhhwellsBridge() {
27289
27525
  },
27290
27526
  [beginFooterDrag]
27291
27527
  );
27292
- const persistButtonCollectionDrag = (0, import_react21.useCallback)(
27528
+ const persistButtonCollectionDrag = (0, import_react23.useCallback)(
27293
27529
  (button, clientX) => {
27294
27530
  const insertIndex = buttonDropInsertIndexRef.current;
27295
27531
  if (insertIndex != null) insertButtonAtCollectionIndex(button, insertIndex);
@@ -27313,7 +27549,7 @@ function OhhwellsBridge() {
27313
27549
  },
27314
27550
  [postToParent2]
27315
27551
  );
27316
- const refreshButtonDragVisuals = (0, import_react21.useCallback)((button, clientX, clientY) => {
27552
+ const refreshButtonDragVisuals = (0, import_react23.useCallback)((button, clientX, clientY) => {
27317
27553
  const collection = buttonCollectionOf(button);
27318
27554
  if (!collection) {
27319
27555
  setButtonDropSlots([]);
@@ -27330,7 +27566,7 @@ function OhhwellsBridge() {
27330
27566
  setDraggedItemRect(button.getBoundingClientRect());
27331
27567
  if (selectedElRef.current === button) setToolbarRect(button.getBoundingClientRect());
27332
27568
  }, []);
27333
- const handleItemDragStart = (0, import_react21.useCallback)(
27569
+ const handleItemDragStart = (0, import_react23.useCallback)(
27334
27570
  (e) => {
27335
27571
  const selected = selectedElRef.current;
27336
27572
  if (!selected) {
@@ -27361,7 +27597,7 @@ function OhhwellsBridge() {
27361
27597
  },
27362
27598
  [startFooterColumnDrag, startFooterLinkDrag, startNavLinkDrag, refreshButtonDragVisuals]
27363
27599
  );
27364
- const handleItemDragEnd = (0, import_react21.useCallback)(
27600
+ const handleItemDragEnd = (0, import_react23.useCallback)(
27365
27601
  (e) => {
27366
27602
  const collectionButton = buttonCollectionDragRef.current;
27367
27603
  if (collectionButton) {
@@ -27392,7 +27628,7 @@ function OhhwellsBridge() {
27392
27628
  },
27393
27629
  [commitFooterDrag, commitNavDrag, navDragRef, persistButtonCollectionDrag]
27394
27630
  );
27395
- const handleItemChromePointerDown = (0, import_react21.useCallback)((e) => {
27631
+ const handleItemChromePointerDown = (0, import_react23.useCallback)((e) => {
27396
27632
  if (e.button !== 0) return;
27397
27633
  const selected = selectedElRef.current;
27398
27634
  if (!selected) return;
@@ -27433,7 +27669,7 @@ function OhhwellsBridge() {
27433
27669
  }
27434
27670
  if (armNavPressFromChrome(selected, e.clientX, e.clientY, e.pointerId)) return;
27435
27671
  }, [armNavPressFromChrome]);
27436
- const handleItemChromeClick = (0, import_react21.useCallback)((clientX, clientY) => {
27672
+ const handleItemChromeClick = (0, import_react23.useCallback)((clientX, clientY) => {
27437
27673
  if (suppressNextClickRef.current || Date.now() < suppressClickUntilRef.current) {
27438
27674
  suppressNextClickRef.current = false;
27439
27675
  return;
@@ -27446,7 +27682,7 @@ function OhhwellsBridge() {
27446
27682
  }, []);
27447
27683
  reselectNavigationItemRef.current = reselectNavigationItem;
27448
27684
  commitNavigationTextEditRef.current = commitNavigationTextEdit;
27449
- const select = (0, import_react21.useCallback)((anchor) => {
27685
+ const select = (0, import_react23.useCallback)((anchor) => {
27450
27686
  if (!isNavigationItem2(anchor)) return;
27451
27687
  if (activeElRef.current) deactivate();
27452
27688
  clearSocialSelectionRef.current();
@@ -27523,7 +27759,7 @@ function OhhwellsBridge() {
27523
27759
  setLogoSizeDraft(null);
27524
27760
  }
27525
27761
  }, [deactivate, markSelected]);
27526
- const selectFrame = (0, import_react21.useCallback)((el) => {
27762
+ const selectFrame = (0, import_react23.useCallback)((el) => {
27527
27763
  if (!isNavigationContainer(el)) return;
27528
27764
  if (activeElRef.current) deactivate();
27529
27765
  aiSectionApiRef.current?.selectFromElement(el);
@@ -27564,7 +27800,7 @@ function OhhwellsBridge() {
27564
27800
  setFloatingPanelPos(null);
27565
27801
  setLogoSizeDraft(null);
27566
27802
  }, [deactivate, markSelected, postToParent2]);
27567
- const selectLogo = (0, import_react21.useCallback)(
27803
+ const selectLogo = (0, import_react23.useCallback)(
27568
27804
  (logoEl) => {
27569
27805
  if (activeElRef.current) deactivate();
27570
27806
  selectedElRef.current = logoEl;
@@ -27593,7 +27829,7 @@ function OhhwellsBridge() {
27593
27829
  },
27594
27830
  [deactivate, markSelected]
27595
27831
  );
27596
- const openLogoSizePanel = (0, import_react21.useCallback)((logoEl) => {
27832
+ const openLogoSizePanel = (0, import_react23.useCallback)((logoEl) => {
27597
27833
  const placement = getLogoPlacement(logoEl);
27598
27834
  const draft = readLogoSizeState(editContentRef.current, placement);
27599
27835
  setLogoSizeDraft(draft);
@@ -27606,7 +27842,7 @@ function OhhwellsBridge() {
27606
27842
  placement
27607
27843
  });
27608
27844
  }, []);
27609
- const openSocialsDisplayPanel = (0, import_react21.useCallback)((row) => {
27845
+ const openSocialsDisplayPanel = (0, import_react23.useCallback)((row) => {
27610
27846
  setFloatingPanelPos(null);
27611
27847
  setParentScrollSnap(parentScrollRef.current);
27612
27848
  setFloatingPanel({
@@ -27617,7 +27853,7 @@ function OhhwellsBridge() {
27617
27853
  row
27618
27854
  });
27619
27855
  }, []);
27620
- const rememberButtonTokens = (0, import_react21.useCallback)(
27856
+ const rememberButtonTokens = (0, import_react23.useCallback)(
27621
27857
  (content, tokens, nodes) => {
27622
27858
  if (nodes.length === 0) return content;
27623
27859
  const next = { ...content };
@@ -27628,7 +27864,7 @@ function OhhwellsBridge() {
27628
27864
  },
27629
27865
  [postToParent2]
27630
27866
  );
27631
- const tokensForButton = (0, import_react21.useCallback)(
27867
+ const tokensForButton = (0, import_react23.useCallback)(
27632
27868
  (el, persistFallback = false) => {
27633
27869
  const stored = readStoredStyleTokens(editContentRef.current);
27634
27870
  if (stored) return stored;
@@ -27643,7 +27879,7 @@ function OhhwellsBridge() {
27643
27879
  },
27644
27880
  [rememberButtonTokens]
27645
27881
  );
27646
- const openButtonStylePanel = (0, import_react21.useCallback)(
27882
+ const openButtonStylePanel = (0, import_react23.useCallback)(
27647
27883
  (anchor) => {
27648
27884
  const id = buttonId(anchor);
27649
27885
  if (!id) return;
@@ -27661,7 +27897,7 @@ function OhhwellsBridge() {
27661
27897
  },
27662
27898
  [tokensForButton]
27663
27899
  );
27664
- const applySelectedButtonStyle = (0, import_react21.useCallback)(
27900
+ const applySelectedButtonStyle = (0, import_react23.useCallback)(
27665
27901
  (patch) => {
27666
27902
  const panel = floatingPanelRef.current;
27667
27903
  const id = panel?.kind === "button-style" ? panel.buttonId : null;
@@ -27679,7 +27915,7 @@ function OhhwellsBridge() {
27679
27915
  },
27680
27916
  [postToParent2]
27681
27917
  );
27682
- (0, import_react21.useEffect)(() => {
27918
+ (0, import_react23.useEffect)(() => {
27683
27919
  const onDragOver = (e) => {
27684
27920
  const dragged = buttonCollectionDragRef.current;
27685
27921
  if (!dragged) return;
@@ -27698,11 +27934,11 @@ function OhhwellsBridge() {
27698
27934
  document.removeEventListener("drop", onDrop);
27699
27935
  };
27700
27936
  }, [refreshButtonDragVisuals]);
27701
- const isEditModeRef = (0, import_react21.useRef)(false);
27702
- const requestMissingSocialIconsRef = (0, import_react21.useRef)(() => {
27937
+ const isEditModeRef = (0, import_react23.useRef)(false);
27938
+ const requestMissingSocialIconsRef = (0, import_react23.useRef)(() => {
27703
27939
  });
27704
- const askedSocialIconsRef = (0, import_react21.useRef)(/* @__PURE__ */ new Set());
27705
- const requestMissingSocialIcons = (0, import_react21.useCallback)(() => {
27940
+ const askedSocialIconsRef = (0, import_react23.useRef)(/* @__PURE__ */ new Set());
27941
+ const requestMissingSocialIcons = (0, import_react23.useCallback)(() => {
27706
27942
  const items = Array.from(document.querySelectorAll(`[${SOCIALS_ROW_ATTR}]`)).filter((row) => socialsDisplayFor(row, editContentRef.current).icon).flatMap((row) => {
27707
27943
  const missing = socialsMissingIcons(row);
27708
27944
  listSocialItems(row).forEach((item) => ensureIconSlot(item));
@@ -27714,7 +27950,7 @@ function OhhwellsBridge() {
27714
27950
  }, []);
27715
27951
  requestMissingSocialIconsRef.current = requestMissingSocialIcons;
27716
27952
  isEditModeRef.current = isEditMode;
27717
- const changeSocialsDisplay = (0, import_react21.useCallback)(
27953
+ const changeSocialsDisplay = (0, import_react23.useCallback)(
27718
27954
  (row, next) => {
27719
27955
  if (next.icon) {
27720
27956
  const missing = socialsMissingIcons(row);
@@ -27738,19 +27974,19 @@ function OhhwellsBridge() {
27738
27974
  },
27739
27975
  []
27740
27976
  );
27741
- const closeFloatingPanelOnly = (0, import_react21.useCallback)(() => {
27977
+ const closeFloatingPanelOnly = (0, import_react23.useCallback)(() => {
27742
27978
  setFloatingPanel(null);
27743
27979
  setFloatingPanelPos(null);
27744
27980
  setLogoSizeDraft(null);
27745
27981
  }, []);
27746
27982
  closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
27747
- const closeFloatingPanelAndDeselect = (0, import_react21.useCallback)(() => {
27983
+ const closeFloatingPanelAndDeselect = (0, import_react23.useCallback)(() => {
27748
27984
  setFloatingPanel(null);
27749
27985
  setFloatingPanelPos(null);
27750
27986
  setLogoSizeDraft(null);
27751
27987
  deselectRef.current();
27752
27988
  }, []);
27753
- (0, import_react21.useEffect)(() => {
27989
+ (0, import_react23.useEffect)(() => {
27754
27990
  const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
27755
27991
  if (!session || !logoSizeDraft) {
27756
27992
  postToParentRef.current({ type: "ow:logo-size-panel", open: false });
@@ -27769,7 +28005,7 @@ function OhhwellsBridge() {
27769
28005
  max: LOGO_SIZE_MAX
27770
28006
  });
27771
28007
  }, [floatingPanel, logoSizeDraft, editorViewport]);
27772
- const persistLogoSizeDraft = (0, import_react21.useCallback)(
28008
+ const persistLogoSizeDraft = (0, import_react23.useCallback)(
27773
28009
  (placement, draft) => {
27774
28010
  const desktopKey = LOGO_SIZE_DESKTOP_KEYS[placement];
27775
28011
  const mobileKey = LOGO_SIZE_MOBILE_KEYS[placement];
@@ -27809,7 +28045,7 @@ function OhhwellsBridge() {
27809
28045
  },
27810
28046
  [postToParent2]
27811
28047
  );
27812
- const activate = (0, import_react21.useCallback)((el, options) => {
28048
+ const activate = (0, import_react23.useCallback)((el, options) => {
27813
28049
  if (activeElRef.current === el) return;
27814
28050
  document.querySelectorAll("[data-ohw-hovered]").forEach((hovered) => {
27815
28051
  hovered.removeAttribute("data-ohw-hovered");
@@ -27907,8 +28143,8 @@ function OhhwellsBridge() {
27907
28143
  openLogoSizePanelRef.current = openLogoSizePanel;
27908
28144
  deselectRef.current = deselect;
27909
28145
  closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
27910
- const lastSiteWideScopeRef = (0, import_react21.useRef)(null);
27911
- (0, import_react21.useEffect)(() => {
28146
+ const lastSiteWideScopeRef = (0, import_react23.useRef)(null);
28147
+ (0, import_react23.useEffect)(() => {
27912
28148
  if (!isEditMode) {
27913
28149
  if (lastSiteWideScopeRef.current !== false) {
27914
28150
  lastSiteWideScopeRef.current = false;
@@ -27934,7 +28170,7 @@ function OhhwellsBridge() {
27934
28170
  isFooterFrameSelection,
27935
28171
  postToParent2
27936
28172
  ]);
27937
- (0, import_react21.useLayoutEffect)(() => {
28173
+ (0, import_react23.useLayoutEffect)(() => {
27938
28174
  if (!subdomain || isEditMode) {
27939
28175
  setFetchState("done");
27940
28176
  return;
@@ -28085,7 +28321,7 @@ function OhhwellsBridge() {
28085
28321
  cancelled = true;
28086
28322
  };
28087
28323
  }, [subdomain, isEditMode]);
28088
- (0, import_react21.useEffect)(() => {
28324
+ (0, import_react23.useEffect)(() => {
28089
28325
  if (!isEditMode) return;
28090
28326
  const resolveIndex = (form, clientY) => {
28091
28327
  const wrappers = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== fieldDragRef.current?.key);
@@ -28126,7 +28362,7 @@ function OhhwellsBridge() {
28126
28362
  window.removeEventListener("drop", onDrop, true);
28127
28363
  };
28128
28364
  }, [buildFieldDropSlots, isEditMode, persistFields, selectField]);
28129
- (0, import_react21.useEffect)(() => {
28365
+ (0, import_react23.useEffect)(() => {
28130
28366
  if (!isEditMode) return;
28131
28367
  const mark = () => document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
28132
28368
  markFormFields(form);
@@ -28138,7 +28374,7 @@ function OhhwellsBridge() {
28138
28374
  });
28139
28375
  return () => observer.disconnect();
28140
28376
  }, [isEditMode, fetchState, pathname]);
28141
- (0, import_react21.useEffect)(() => {
28377
+ (0, import_react23.useEffect)(() => {
28142
28378
  if (!isEditMode) return;
28143
28379
  let saveTimer = null;
28144
28380
  const onInput = (e) => {
@@ -28160,14 +28396,14 @@ function OhhwellsBridge() {
28160
28396
  document.addEventListener("input", onInput, true);
28161
28397
  return () => document.removeEventListener("input", onInput, true);
28162
28398
  }, [isEditMode, persistFields]);
28163
- (0, import_react21.useEffect)(() => {
28399
+ (0, import_react23.useEffect)(() => {
28164
28400
  if (isEditMode || fetchState !== "done") return;
28165
28401
  const content = contentCache.get(subdomain) ?? {};
28166
28402
  document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
28167
28403
  reconcileFieldsFromContent(form, content);
28168
28404
  });
28169
28405
  }, [isEditMode, fetchState, subdomain]);
28170
- (0, import_react21.useEffect)(() => {
28406
+ (0, import_react23.useEffect)(() => {
28171
28407
  if (!isEditMode) return;
28172
28408
  const swallow = (e) => {
28173
28409
  const target = e.target;
@@ -28176,14 +28412,14 @@ function OhhwellsBridge() {
28176
28412
  document.addEventListener("submit", swallow, true);
28177
28413
  return () => document.removeEventListener("submit", swallow, true);
28178
28414
  }, [isEditMode]);
28179
- (0, import_react21.useEffect)(() => {
28415
+ (0, import_react23.useEffect)(() => {
28180
28416
  if (isEditMode || fetchState !== "done") return;
28181
28417
  console.log("env", process.env.NEXT_PUBLIC_FLOWOPS_API_URL);
28182
28418
  const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
28183
28419
  console.log({ apiUrl, subdomain });
28184
28420
  bindPublishedForms(apiUrl, subdomain, contentCache.get(subdomain) ?? {});
28185
28421
  }, [isEditMode, fetchState, subdomain]);
28186
- (0, import_react21.useEffect)(() => {
28422
+ (0, import_react23.useEffect)(() => {
28187
28423
  if (!subdomain || isEditMode) return;
28188
28424
  let debounceTimer = null;
28189
28425
  let observer = null;
@@ -28300,16 +28536,16 @@ function OhhwellsBridge() {
28300
28536
  if (debounceTimer) clearTimeout(debounceTimer);
28301
28537
  };
28302
28538
  }, [subdomain, isEditMode, pathname]);
28303
- (0, import_react21.useLayoutEffect)(() => {
28539
+ (0, import_react23.useLayoutEffect)(() => {
28304
28540
  const el = document.getElementById("ohw-loader");
28305
28541
  if (!el) return;
28306
28542
  const visible = Boolean(subdomain) && fetchState !== "done";
28307
28543
  el.style.display = visible ? "flex" : "none";
28308
28544
  }, [subdomain, fetchState]);
28309
- (0, import_react21.useEffect)(() => {
28545
+ (0, import_react23.useEffect)(() => {
28310
28546
  postToParent2({ type: "ow:navigation", path: pathname });
28311
28547
  }, [pathname, postToParent2]);
28312
- (0, import_react21.useEffect)(() => {
28548
+ (0, import_react23.useEffect)(() => {
28313
28549
  if (!subdomain || isEditMode) return;
28314
28550
  const content = contentCache.get(subdomain);
28315
28551
  if (!content) return;
@@ -28327,7 +28563,7 @@ function OhhwellsBridge() {
28327
28563
  }
28328
28564
  applyAiFooterFromContent(content);
28329
28565
  }, [pathname, subdomain, isEditMode]);
28330
- (0, import_react21.useEffect)(() => {
28566
+ (0, import_react23.useEffect)(() => {
28331
28567
  if (!isEditMode) return;
28332
28568
  if (linkPopoverSessionRef.current?.intent === "add-nav") return;
28333
28569
  if (document.querySelector("[data-ohw-section-picker]")) return;
@@ -28335,12 +28571,12 @@ function OhhwellsBridge() {
28335
28571
  deselectRef.current();
28336
28572
  deactivateRef.current();
28337
28573
  }, [pathname, isEditMode]);
28338
- (0, import_react21.useEffect)(() => {
28574
+ (0, import_react23.useEffect)(() => {
28339
28575
  if (!isEditMode) return;
28340
28576
  initSectionInstancesFromContent(editContentRef.current, pathname);
28341
28577
  initItemInstancesFromContent(editContentRef.current);
28342
28578
  }, [pathname, isEditMode]);
28343
- (0, import_react21.useEffect)(() => {
28579
+ (0, import_react23.useEffect)(() => {
28344
28580
  if (!isEditMode) return;
28345
28581
  const observer = new MutationObserver(() => {
28346
28582
  const drawer = document.querySelector("[data-ohw-nav-drawer]");
@@ -28351,7 +28587,7 @@ function OhhwellsBridge() {
28351
28587
  observer.observe(document.body, { childList: true, subtree: true });
28352
28588
  return () => observer.disconnect();
28353
28589
  }, [isEditMode, pathname]);
28354
- (0, import_react21.useEffect)(() => {
28590
+ (0, import_react23.useEffect)(() => {
28355
28591
  const contentForNav = () => {
28356
28592
  if (isEditMode) return editContentRef.current;
28357
28593
  if (!subdomain) return {};
@@ -28424,7 +28660,7 @@ function OhhwellsBridge() {
28424
28660
  observer?.disconnect();
28425
28661
  };
28426
28662
  }, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
28427
- (0, import_react21.useEffect)(() => {
28663
+ (0, import_react23.useEffect)(() => {
28428
28664
  if (!isEditMode) return;
28429
28665
  let applying = false;
28430
28666
  let rafId = null;
@@ -28462,7 +28698,7 @@ function OhhwellsBridge() {
28462
28698
  observer.disconnect();
28463
28699
  };
28464
28700
  }, [isEditMode, pathname]);
28465
- (0, import_react21.useEffect)(() => {
28701
+ (0, import_react23.useEffect)(() => {
28466
28702
  if (!isEditMode) return;
28467
28703
  let lastPosted = 0;
28468
28704
  const measure = () => {
@@ -28506,7 +28742,7 @@ function OhhwellsBridge() {
28506
28742
  window.removeEventListener("resize", handleResize);
28507
28743
  };
28508
28744
  }, [pathname, isEditMode, postToParent2]);
28509
- (0, import_react21.useEffect)(() => {
28745
+ (0, import_react23.useEffect)(() => {
28510
28746
  if (isEditMode) return;
28511
28747
  const handleClick = (e) => {
28512
28748
  if (!isPlainLeftClick(e)) return;
@@ -28520,7 +28756,7 @@ function OhhwellsBridge() {
28520
28756
  document.addEventListener("click", handleClick, true);
28521
28757
  return () => document.removeEventListener("click", handleClick, true);
28522
28758
  }, [isEditMode, router, pathname]);
28523
- (0, import_react21.useEffect)(() => {
28759
+ (0, import_react23.useEffect)(() => {
28524
28760
  if (!isEditMode) {
28525
28761
  editStylesRef.current?.base.remove();
28526
28762
  editStylesRef.current?.forceHover.remove();
@@ -31975,7 +32211,7 @@ function OhhwellsBridge() {
31975
32211
  if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
31976
32212
  };
31977
32213
  }, [isEditMode, refreshStateRules]);
31978
- (0, import_react21.useEffect)(() => {
32214
+ (0, import_react23.useEffect)(() => {
31979
32215
  if (!isEditMode) return;
31980
32216
  const THRESHOLD = 10;
31981
32217
  const resolveWasSelected = (el) => {
@@ -32131,7 +32367,7 @@ function OhhwellsBridge() {
32131
32367
  unlockFooterDragInteraction();
32132
32368
  };
32133
32369
  }, [isEditMode]);
32134
- (0, import_react21.useEffect)(() => {
32370
+ (0, import_react23.useEffect)(() => {
32135
32371
  if (!isEditMode) return;
32136
32372
  const THRESHOLD = 10;
32137
32373
  const onPointerDown = (e) => {
@@ -32222,7 +32458,7 @@ function OhhwellsBridge() {
32222
32458
  document.removeEventListener("selectstart", blockSelectStart, true);
32223
32459
  };
32224
32460
  }, [isEditMode, persistButtonCollectionDrag, refreshButtonDragVisuals]);
32225
- (0, import_react21.useEffect)(() => {
32461
+ (0, import_react23.useEffect)(() => {
32226
32462
  const handler = (e) => {
32227
32463
  if (e.data?.type !== "ow:request-schedule-config") return;
32228
32464
  const insertAfterVal = e.data.insertAfter;
@@ -32238,7 +32474,7 @@ function OhhwellsBridge() {
32238
32474
  window.addEventListener("message", handler);
32239
32475
  return () => window.removeEventListener("message", handler);
32240
32476
  }, [processConfigRequest]);
32241
- (0, import_react21.useEffect)(() => {
32477
+ (0, import_react23.useEffect)(() => {
32242
32478
  if (!isEditMode) return;
32243
32479
  document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
32244
32480
  el.removeAttribute("data-ohw-active-state");
@@ -32262,7 +32498,7 @@ function OhhwellsBridge() {
32262
32498
  postToParent2({
32263
32499
  type: "ow:ready",
32264
32500
  version: "1",
32265
- bridgeVersion: "0.1.160",
32501
+ bridgeVersion: "0.1.162",
32266
32502
  path: pathname,
32267
32503
  nodes: collectEditableNodes(editContentRef.current),
32268
32504
  sections
@@ -32274,13 +32510,13 @@ function OhhwellsBridge() {
32274
32510
  clearTimeout(timer);
32275
32511
  };
32276
32512
  }, [pathname, isEditMode, refreshStateRules, postToParent2]);
32277
- (0, import_react21.useEffect)(() => {
32513
+ (0, import_react23.useEffect)(() => {
32278
32514
  scrollToHashSectionWhenReady();
32279
32515
  const onHashChange = () => scrollToHashSectionWhenReady();
32280
32516
  window.addEventListener("hashchange", onHashChange);
32281
32517
  return () => window.removeEventListener("hashchange", onHashChange);
32282
32518
  }, [pathname]);
32283
- const handleCommand = (0, import_react21.useCallback)((cmd) => {
32519
+ const handleCommand = (0, import_react23.useCallback)((cmd) => {
32284
32520
  const el = activeElRef.current;
32285
32521
  const selBefore = window.getSelection();
32286
32522
  let savedOffsets = null;
@@ -32316,7 +32552,7 @@ function OhhwellsBridge() {
32316
32552
  if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
32317
32553
  refreshActiveCommandsRef.current();
32318
32554
  }, []);
32319
- (0, import_react21.useEffect)(() => {
32555
+ (0, import_react23.useEffect)(() => {
32320
32556
  const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
32321
32557
  if (!session || !logoSizeDraft) return;
32322
32558
  const onPanelAction = (e) => {
@@ -32354,7 +32590,7 @@ function OhhwellsBridge() {
32354
32590
  window.addEventListener("message", onPanelAction);
32355
32591
  return () => window.removeEventListener("message", onPanelAction);
32356
32592
  }, [floatingPanel, logoSizeDraft, editorViewport, persistLogoSizeDraft, closeFloatingPanelAndDeselect]);
32357
- const handleStateChange = (0, import_react21.useCallback)((state) => {
32593
+ const handleStateChange = (0, import_react23.useCallback)((state) => {
32358
32594
  if (!activeStateElRef.current) return;
32359
32595
  const el = activeStateElRef.current;
32360
32596
  if (state === "Default") {
@@ -32367,7 +32603,7 @@ function OhhwellsBridge() {
32367
32603
  }
32368
32604
  setToggleState((prev) => prev ? { ...prev, activeState: state } : null);
32369
32605
  }, [deactivate]);
32370
- const reselectAfterLinkPopover = (0, import_react21.useCallback)(
32606
+ const reselectAfterLinkPopover = (0, import_react23.useCallback)(
32371
32607
  (hrefKey) => {
32372
32608
  requestAnimationFrame(() => {
32373
32609
  const el = resolveHrefKeyElement(hrefKey);
@@ -32376,7 +32612,7 @@ function OhhwellsBridge() {
32376
32612
  },
32377
32613
  [resolveHrefKeyElement]
32378
32614
  );
32379
- const closeLinkPopover = (0, import_react21.useCallback)(() => {
32615
+ const closeLinkPopover = (0, import_react23.useCallback)(() => {
32380
32616
  const session = linkPopoverSessionRef.current;
32381
32617
  addNavAfterAnchorRef.current = null;
32382
32618
  setLinkPopover(null);
@@ -32384,9 +32620,9 @@ function OhhwellsBridge() {
32384
32620
  reselectAfterLinkPopover(session.key);
32385
32621
  }
32386
32622
  }, [reselectAfterLinkPopover]);
32387
- const closeLinkPopoverRef = (0, import_react21.useRef)(closeLinkPopover);
32623
+ const closeLinkPopoverRef = (0, import_react23.useRef)(closeLinkPopover);
32388
32624
  closeLinkPopoverRef.current = closeLinkPopover;
32389
- const openLinkPopoverForActive = (0, import_react21.useCallback)(() => {
32625
+ const openLinkPopoverForActive = (0, import_react23.useCallback)(() => {
32390
32626
  const hrefCtx = getHrefKeyFromElement(activeElRef.current);
32391
32627
  if (!hrefCtx) return;
32392
32628
  bumpLinkPopoverGrace();
@@ -32397,7 +32633,7 @@ function OhhwellsBridge() {
32397
32633
  });
32398
32634
  deactivate();
32399
32635
  }, [deactivate]);
32400
- const openLinkPopoverForSelected = (0, import_react21.useCallback)(() => {
32636
+ const openLinkPopoverForSelected = (0, import_react23.useCallback)(() => {
32401
32637
  const anchor = selectedElRef.current;
32402
32638
  if (!anchor) return;
32403
32639
  const key = anchor.getAttribute("data-ohw-href-key");
@@ -32414,7 +32650,7 @@ function OhhwellsBridge() {
32414
32650
  });
32415
32651
  deselect();
32416
32652
  }, [deselect]);
32417
- const handleSelectParent = (0, import_react21.useCallback)(() => {
32653
+ const handleSelectParent = (0, import_react23.useCallback)(() => {
32418
32654
  const selected = selectedElRef.current;
32419
32655
  if (!selected) return;
32420
32656
  if (toolbarVariantRef.current === "select-frame") {
@@ -32441,7 +32677,7 @@ function OhhwellsBridge() {
32441
32677
  }
32442
32678
  deselectRef.current();
32443
32679
  }, []);
32444
- const handleDuplicateSelected = (0, import_react21.useCallback)(() => {
32680
+ const handleDuplicateSelected = (0, import_react23.useCallback)(() => {
32445
32681
  const selected = selectedElRef.current;
32446
32682
  if (!selected || !isNavigationItem2(selected)) return;
32447
32683
  if (isCtaButton(selected)) {
@@ -32610,7 +32846,7 @@ function OhhwellsBridge() {
32610
32846
  });
32611
32847
  }
32612
32848
  }, [postToParent2, tokensForButton]);
32613
- const runPendingDeleteUndo = (0, import_react21.useCallback)(() => {
32849
+ const runPendingDeleteUndo = (0, import_react23.useCallback)(() => {
32614
32850
  const pending = pendingDeleteUndoRef.current;
32615
32851
  if (!pending) return false;
32616
32852
  pendingDeleteUndoRef.current = null;
@@ -32618,7 +32854,7 @@ function OhhwellsBridge() {
32618
32854
  enforceLinkHrefs();
32619
32855
  return true;
32620
32856
  }, []);
32621
- const handleDeleteSelected = (0, import_react21.useCallback)(() => {
32857
+ const handleDeleteSelected = (0, import_react23.useCallback)(() => {
32622
32858
  const selected = selectedElRef.current;
32623
32859
  if (!selected) return false;
32624
32860
  if (isCtaButton(selected)) {
@@ -32680,7 +32916,7 @@ function OhhwellsBridge() {
32680
32916
  }, [postToParent2]);
32681
32917
  handleDeleteSelectedRef.current = handleDeleteSelected;
32682
32918
  runPendingDeleteUndoRef.current = runPendingDeleteUndo;
32683
- const handleLinkPopoverSubmit = (0, import_react21.useCallback)(
32919
+ const handleLinkPopoverSubmit = (0, import_react23.useCallback)(
32684
32920
  (target) => {
32685
32921
  const session = linkPopoverSessionRef.current;
32686
32922
  if (!session) return;
@@ -32746,14 +32982,14 @@ function OhhwellsBridge() {
32746
32982
  const showEditLink = toolbarShowEditLink;
32747
32983
  const currentSections = sectionsByPath[pathname] ?? [];
32748
32984
  linkPopoverOpenRef.current = linkPopover !== null;
32749
- const handleMediaSelect = (0, import_react21.useCallback)((key) => {
32985
+ const handleMediaSelect = (0, import_react23.useCallback)((key) => {
32750
32986
  const el = hoveredImageRef.current?.dataset.ohwKey === key ? hoveredImageRef.current : Array.from(document.querySelectorAll(MEDIA_SELECTOR)).find(
32751
32987
  (m) => (m.dataset.ohwKey ?? "") === key
32752
32988
  ) ?? null;
32753
32989
  if (!el) return;
32754
32990
  selectMediaElementRef.current(el);
32755
32991
  }, []);
32756
- const handleMediaReplace = (0, import_react21.useCallback)(
32992
+ const handleMediaReplace = (0, import_react23.useCallback)(
32757
32993
  (key) => {
32758
32994
  postToParent2({
32759
32995
  type: "ow:image-pick",
@@ -32763,13 +32999,13 @@ function OhhwellsBridge() {
32763
32999
  },
32764
33000
  [postToParent2, mediaHover?.elementType, selectedMedia?.elementType]
32765
33001
  );
32766
- const handleEditCarousel = (0, import_react21.useCallback)(
33002
+ const handleEditCarousel = (0, import_react23.useCallback)(
32767
33003
  (key) => {
32768
33004
  postToParent2({ type: "ow:carousel-open", key, images: readCarouselValue(key) });
32769
33005
  },
32770
33006
  [postToParent2]
32771
33007
  );
32772
- const handleMediaFadeOutComplete = (0, import_react21.useCallback)((key) => {
33008
+ const handleMediaFadeOutComplete = (0, import_react23.useCallback)((key) => {
32773
33009
  setUploadingRects((prev) => {
32774
33010
  if (!(key in prev)) return prev;
32775
33011
  const next = { ...prev };
@@ -32777,7 +33013,7 @@ function OhhwellsBridge() {
32777
33013
  return next;
32778
33014
  });
32779
33015
  }, []);
32780
- const handleVideoSettingsChange = (0, import_react21.useCallback)(
33016
+ const handleVideoSettingsChange = (0, import_react23.useCallback)(
32781
33017
  (key, settings) => {
32782
33018
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
32783
33019
  const video = getVideoEl2(el);