@ohhwells/bridge 0.1.160-next.427 → 0.1.160-next.429

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
 
@@ -1208,21 +1208,21 @@ function chromeFrom(sample) {
1208
1208
  };
1209
1209
  }
1210
1210
  function filledPrimary(seed) {
1211
- const paint = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
1212
- const luminance = relativeLuminance(paint);
1211
+ const paint2 = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
1212
+ const luminance = relativeLuminance(paint2);
1213
1213
  return {
1214
- background: toCss({ ...paint, a: 1 }),
1214
+ background: toCss({ ...paint2, a: 1 }),
1215
1215
  color: luminance > 0.55 ? "rgb(15, 15, 15)" : "rgb(255, 255, 255)",
1216
1216
  borderColor: TRANSPARENT,
1217
1217
  borderWidth: "0px"
1218
1218
  };
1219
1219
  }
1220
1220
  function generatedSecondary(primary) {
1221
- const paint = accentColor(primary);
1221
+ const paint2 = accentColor(primary);
1222
1222
  return {
1223
1223
  background: TRANSPARENT,
1224
- color: paint,
1225
- borderColor: paint,
1224
+ color: paint2,
1225
+ borderColor: paint2,
1226
1226
  borderWidth: "1px"
1227
1227
  };
1228
1228
  }
@@ -1235,9 +1235,9 @@ function generatedGhost(primary) {
1235
1235
  };
1236
1236
  }
1237
1237
  function normalizeOutlineChrome(outline, primary) {
1238
- const paint = accentColor(primary);
1238
+ const paint2 = accentColor(primary);
1239
1239
  const text = parseColor(outline.color);
1240
- const paintRgb = parseColor(paint);
1240
+ const paintRgb = parseColor(paint2);
1241
1241
  const primaryLabel = parseColor(primary.color);
1242
1242
  const matchesOnPrimary = Boolean(text && primaryLabel) && colorKey(outline.color) === colorKey(primary.color);
1243
1243
  const textTooLight = text ? relativeLuminance(text) > 0.7 : false;
@@ -1246,8 +1246,8 @@ function normalizeOutlineChrome(outline, primary) {
1246
1246
  const hasBorder = parseFloat(outline.borderWidth) > 0;
1247
1247
  return {
1248
1248
  ...outline,
1249
- color: paint,
1250
- borderColor: hasBorder ? paint : outline.borderColor
1249
+ color: paint2,
1250
+ borderColor: hasBorder ? paint2 : outline.borderColor
1251
1251
  };
1252
1252
  }
1253
1253
  function generateButtonVariants(samples) {
@@ -7430,6 +7430,120 @@ function findSelectableNavContainer(doc = document) {
7430
7430
  );
7431
7431
  }
7432
7432
 
7433
+ // src/lib/youtube.ts
7434
+ var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
7435
+ function extractYouTubeId(input) {
7436
+ const trimmed = input.trim();
7437
+ if (!trimmed) return null;
7438
+ if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
7439
+ let url;
7440
+ try {
7441
+ url = new URL(trimmed);
7442
+ } catch {
7443
+ return null;
7444
+ }
7445
+ const host = url.hostname.replace(/^www\./, "");
7446
+ if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
7447
+ return null;
7448
+ }
7449
+ let candidate = null;
7450
+ if (host === "youtu.be") {
7451
+ candidate = url.pathname.slice(1).split("/")[0] ?? null;
7452
+ } else if (url.pathname === "/watch") {
7453
+ candidate = url.searchParams.get("v");
7454
+ } else {
7455
+ const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
7456
+ candidate = match ? match[1] : null;
7457
+ }
7458
+ return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
7459
+ }
7460
+
7461
+ // src/lib/section-embed.ts
7462
+ var SECTION_EMBED_SUFFIX = "__ohw_embed";
7463
+ function readStoredEmbed(value) {
7464
+ if (value.startsWith("start\n")) {
7465
+ return { raw: value.slice("start\n".length), at: "start" };
7466
+ }
7467
+ return { raw: value, at: "end" };
7468
+ }
7469
+ function embedFrameSrc(value) {
7470
+ const videoId = extractYouTubeId(value);
7471
+ if (videoId) {
7472
+ return { src: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0`, title: "YouTube video" };
7473
+ }
7474
+ let url;
7475
+ try {
7476
+ url = new URL(value);
7477
+ } catch {
7478
+ return null;
7479
+ }
7480
+ const host = url.hostname.replace(/^www\./, "").toLowerCase();
7481
+ if (host === "google.com" && url.pathname.startsWith("/maps") || host === "maps.google.com") {
7482
+ const query = url.searchParams.get("q") || url.searchParams.get("query") || "";
7483
+ const src = query ? `https://maps.google.com/maps?q=${encodeURIComponent(query)}&output=embed` : `https://maps.google.com/maps?output=embed`;
7484
+ return { src, title: "Map" };
7485
+ }
7486
+ if (host === "maps.app.goo.gl") {
7487
+ return { src: value, title: "Map" };
7488
+ }
7489
+ if (host === "calendly.com" || host.endsWith(".calendly.com") || host === "calendar.google.com") {
7490
+ return { src: value, title: "Calendar" };
7491
+ }
7492
+ if (host === "docs.google.com" && url.pathname.includes("/forms/")) {
7493
+ return { src: value.replace(/\/edit(?:\?.*)?$/i, "/viewform"), title: "Form" };
7494
+ }
7495
+ if (host === "forms.gle") {
7496
+ return { src: value, title: "Form" };
7497
+ }
7498
+ return null;
7499
+ }
7500
+ function place(section, box, at) {
7501
+ if (at === "start") {
7502
+ section.insertBefore(box, section.firstChild);
7503
+ return;
7504
+ }
7505
+ section.appendChild(box);
7506
+ }
7507
+ function paint(section, key, src, title, at) {
7508
+ const existing = section.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`);
7509
+ const frame = existing?.querySelector("iframe");
7510
+ if (existing && frame) {
7511
+ if (frame.getAttribute("src") !== src) frame.setAttribute("src", src);
7512
+ frame.title = title;
7513
+ place(section, existing, at);
7514
+ return;
7515
+ }
7516
+ existing?.remove();
7517
+ const box = document.createElement("div");
7518
+ box.setAttribute("data-ohw-section-embed", key);
7519
+ box.style.cssText = at === "start" ? "width:100%;max-width:960px;margin:0 auto 32px;padding:32px 24px 0;box-sizing:border-box;" : "width:100%;max-width:960px;margin:32px auto 0;padding:0 24px 32px;box-sizing:border-box;";
7520
+ const frameWrap = document.createElement("div");
7521
+ frameWrap.style.cssText = "position:relative;width:100%;aspect-ratio:16/9;min-height:250px;border-radius:12px;overflow:hidden;background:#0f172a;";
7522
+ const iframe = document.createElement("iframe");
7523
+ iframe.src = src;
7524
+ iframe.title = title;
7525
+ iframe.style.cssText = "position:absolute;inset:0;width:100%;height:100%;border:0;";
7526
+ iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture";
7527
+ iframe.setAttribute("allowfullscreen", "");
7528
+ frameWrap.appendChild(iframe);
7529
+ box.appendChild(frameWrap);
7530
+ place(section, box, at);
7531
+ }
7532
+ function applySectionEmbeds(content) {
7533
+ for (const [key, val] of Object.entries(content)) {
7534
+ if (!key.endsWith(SECTION_EMBED_SUFFIX)) continue;
7535
+ const sectionId = key.slice(0, -SECTION_EMBED_SUFFIX.length);
7536
+ const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
7537
+ const stored = typeof val === "string" ? readStoredEmbed(val) : null;
7538
+ const frame = stored ? embedFrameSrc(stored.raw) : null;
7539
+ if (!section || !stored || !frame) {
7540
+ section?.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`)?.remove();
7541
+ continue;
7542
+ }
7543
+ paint(section, key, frame.src, frame.title, stored.at);
7544
+ }
7545
+ }
7546
+
7433
7547
  // src/ui/ai-tree/aiSectionsManager.tsx
7434
7548
  var import_react_dom = require("react-dom");
7435
7549
  var import_client = require("react-dom/client");
@@ -11563,6 +11677,34 @@ function minSpanForFooterBlock(type) {
11563
11677
  return 3;
11564
11678
  }
11565
11679
  }
11680
+ function readLiveSocialItems() {
11681
+ const root = getFooterRoot();
11682
+ const row = root?.querySelector("[data-ohw-socials-row]");
11683
+ if (!row) return [];
11684
+ const items = [];
11685
+ for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
11686
+ const href = anchor.getAttribute("href")?.trim() ?? "";
11687
+ const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
11688
+ const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
11689
+ if (!platform || !/^https?:\/\//i.test(href)) continue;
11690
+ items.push({ platform, href });
11691
+ }
11692
+ return items;
11693
+ }
11694
+ function syncSocialRowsFromDom(tree) {
11695
+ const root = getFooterRoot();
11696
+ if (!root) return;
11697
+ const row = root.querySelector("[data-ohw-socials-row]");
11698
+ const live = readLiveSocialItems();
11699
+ if (row && live.length === 0) return;
11700
+ for (const col of tree.columns) {
11701
+ col.blocks = col.blocks.flatMap((block) => {
11702
+ if (block.type !== "social-row") return [block];
11703
+ if (!row) return [];
11704
+ return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
11705
+ });
11706
+ }
11707
+ }
11566
11708
  function collectBrandBlocks(tree) {
11567
11709
  const brand = [];
11568
11710
  for (const col of tree.columns) {
@@ -11808,6 +11950,7 @@ function textOf2(el) {
11808
11950
  }
11809
11951
  function syncFooterTreeLinksFromDom(tree) {
11810
11952
  const next = cloneTree(tree);
11953
+ syncSocialRowsFromDom(next);
11811
11954
  const domCols = listFooterColumns().map((col) => {
11812
11955
  const heading = getFooterColumnHeadingEl(col);
11813
11956
  const title = heading ? textOf2(heading) : void 0;
@@ -12152,11 +12295,139 @@ function useSavedLinkNavigation(isEditMode) {
12152
12295
  }, [isEditMode, router]);
12153
12296
  }
12154
12297
 
12155
- // src/ui/SchedulingWidget.tsx
12298
+ // src/useNavDropdownToggle.ts
12299
+ var import_react5 = require("react");
12300
+ var import_navigation2 = require("next/navigation");
12301
+ var OPEN_ATTR = "data-ohw-nav-force-open";
12302
+ function parentLinkWithDropdown(target) {
12303
+ const anchor = target?.closest?.("a");
12304
+ const group = anchor?.parentElement;
12305
+ if (!anchor || !group?.matches("[data-ohw-nav-group]:not([data-ohw-nav-dropdown-template])")) {
12306
+ return null;
12307
+ }
12308
+ const hasChildren = group.querySelector(":scope > [data-ohw-nav-children] > [data-ohw-href-key]");
12309
+ return hasChildren ? anchor : null;
12310
+ }
12311
+ function closeAll(except) {
12312
+ document.querySelectorAll(`[${OPEN_ATTR}]`).forEach((group) => {
12313
+ if (group === except) return;
12314
+ group.removeAttribute(OPEN_ATTR);
12315
+ group.querySelector(":scope > a")?.setAttribute("aria-expanded", "false");
12316
+ });
12317
+ }
12318
+ function useNavDropdownToggle(isEditMode) {
12319
+ const pathname = (0, import_navigation2.usePathname)();
12320
+ (0, import_react5.useEffect)(() => {
12321
+ if (isEditMode) return;
12322
+ const onClick = (e) => {
12323
+ if (e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
12324
+ const anchor = parentLinkWithDropdown(e.target);
12325
+ if (!anchor) {
12326
+ const insideOpen = e.target?.closest?.(`[${OPEN_ATTR}]`);
12327
+ const onChildLink = e.target?.closest?.("[data-ohw-nav-children] a");
12328
+ if (!insideOpen || onChildLink) closeAll();
12329
+ return;
12330
+ }
12331
+ e.preventDefault();
12332
+ e.stopPropagation();
12333
+ const group = anchor.parentElement;
12334
+ const open = !group.hasAttribute(OPEN_ATTR);
12335
+ closeAll(group);
12336
+ group.toggleAttribute(OPEN_ATTR, open);
12337
+ anchor.setAttribute("aria-expanded", String(open));
12338
+ };
12339
+ const onKeyDown = (e) => {
12340
+ if (e.key !== "Escape") return;
12341
+ const open = document.querySelector(`[${OPEN_ATTR}] > a`);
12342
+ closeAll();
12343
+ open?.focus();
12344
+ };
12345
+ window.addEventListener("click", onClick, true);
12346
+ window.addEventListener("keydown", onKeyDown);
12347
+ return () => {
12348
+ window.removeEventListener("click", onClick, true);
12349
+ window.removeEventListener("keydown", onKeyDown);
12350
+ };
12351
+ }, [isEditMode]);
12352
+ (0, import_react5.useEffect)(() => {
12353
+ if (!isEditMode) closeAll();
12354
+ }, [pathname, isEditMode]);
12355
+ }
12356
+
12357
+ // src/useHashLinkScroll.ts
12156
12358
  var import_react6 = require("react");
12157
12359
 
12360
+ // src/lib/scroll-to-section.ts
12361
+ var MAX_ATTEMPTS = 12;
12362
+ var RETRY_MS = 100;
12363
+ function getHashSectionId() {
12364
+ if (typeof window === "undefined") return null;
12365
+ const id = window.location.hash.replace(/^#/, "").trim();
12366
+ return id || null;
12367
+ }
12368
+ function scrollToOhwSection(sectionId, behavior = "smooth") {
12369
+ if (!sectionId || typeof document === "undefined") return false;
12370
+ const el = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
12371
+ if (!el) return false;
12372
+ el.scrollIntoView({ behavior, block: "start" });
12373
+ return true;
12374
+ }
12375
+ function scrollToHashSectionWhenReady(behavior = "smooth") {
12376
+ const id = getHashSectionId();
12377
+ if (!id) return;
12378
+ let attempt = 0;
12379
+ const tick = () => {
12380
+ if (scrollToOhwSection(id, behavior)) return;
12381
+ attempt += 1;
12382
+ if (attempt < MAX_ATTEMPTS) window.setTimeout(tick, RETRY_MS);
12383
+ };
12384
+ tick();
12385
+ }
12386
+ function scrollToOhwSectionAfterNavigation(sectionId, behavior = "smooth") {
12387
+ let attempt = 0;
12388
+ const tick = () => {
12389
+ if (getHashSectionId() === sectionId && scrollToOhwSection(sectionId, behavior)) return;
12390
+ attempt += 1;
12391
+ if (attempt < MAX_ATTEMPTS) window.setTimeout(tick, RETRY_MS);
12392
+ };
12393
+ window.setTimeout(tick, 0);
12394
+ }
12395
+
12396
+ // src/useHashLinkScroll.ts
12397
+ function samePageSectionId(anchor) {
12398
+ const href = anchor.getAttribute("href");
12399
+ if (!href || !href.includes("#")) return null;
12400
+ if (anchor.target !== "" && anchor.target !== "_self") return null;
12401
+ let url;
12402
+ try {
12403
+ url = new URL(href, window.location.href);
12404
+ } catch {
12405
+ return null;
12406
+ }
12407
+ if (url.origin !== window.location.origin || url.pathname !== window.location.pathname) return null;
12408
+ const id = decodeURIComponent(url.hash.replace(/^#/, "")).trim();
12409
+ return id || null;
12410
+ }
12411
+ function useHashLinkScroll(isEditMode) {
12412
+ (0, import_react6.useEffect)(() => {
12413
+ if (isEditMode) return;
12414
+ const onClick = (e) => {
12415
+ if (e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
12416
+ const anchor = e.target?.closest?.("a");
12417
+ if (!anchor) return;
12418
+ const id = samePageSectionId(anchor);
12419
+ if (id) scrollToOhwSectionAfterNavigation(id);
12420
+ };
12421
+ window.addEventListener("click", onClick, true);
12422
+ return () => window.removeEventListener("click", onClick, true);
12423
+ }, [isEditMode]);
12424
+ }
12425
+
12426
+ // src/ui/SchedulingWidget.tsx
12427
+ var import_react8 = require("react");
12428
+
12158
12429
  // src/ui/EmailCaptureModal.tsx
12159
- var import_react5 = require("react");
12430
+ var import_react7 = require("react");
12160
12431
  var import_radix_ui = require("radix-ui");
12161
12432
  var import_jsx_runtime4 = require("react/jsx-runtime");
12162
12433
  var isValidEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
@@ -12186,11 +12457,11 @@ function Spinner() {
12186
12457
  );
12187
12458
  }
12188
12459
  function EmailCaptureModal({ title, subtitle, onSubmit, onClose }) {
12189
- const [email, setEmail] = (0, import_react5.useState)("");
12190
- const [submittedEmail, setSubmittedEmail] = (0, import_react5.useState)("");
12191
- const [loading, setLoading] = (0, import_react5.useState)(false);
12192
- const [success, setSuccess] = (0, import_react5.useState)(false);
12193
- const [error, setError] = (0, import_react5.useState)(null);
12460
+ const [email, setEmail] = (0, import_react7.useState)("");
12461
+ const [submittedEmail, setSubmittedEmail] = (0, import_react7.useState)("");
12462
+ const [loading, setLoading] = (0, import_react7.useState)(false);
12463
+ const [success, setSuccess] = (0, import_react7.useState)(false);
12464
+ const [error, setError] = (0, import_react7.useState)(null);
12194
12465
  const isBook = title === "Confirm your spot";
12195
12466
  const handleSubmit = async () => {
12196
12467
  const trimmed = email.trim();
@@ -12457,21 +12728,21 @@ function LoadingSkeleton() {
12457
12728
  ] });
12458
12729
  }
12459
12730
  function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal }) {
12460
- const todayMs = (0, import_react6.useMemo)(() => {
12731
+ const todayMs = (0, import_react8.useMemo)(() => {
12461
12732
  const d = /* @__PURE__ */ new Date();
12462
12733
  d.setHours(0, 0, 0, 0);
12463
12734
  return d.getTime();
12464
12735
  }, []);
12465
- const scrollRef = (0, import_react6.useRef)(null);
12466
- const [canScrollLeft, setCanScrollLeft] = (0, import_react6.useState)(false);
12467
- const [canScrollRight, setCanScrollRight] = (0, import_react6.useState)(false);
12736
+ const scrollRef = (0, import_react8.useRef)(null);
12737
+ const [canScrollLeft, setCanScrollLeft] = (0, import_react8.useState)(false);
12738
+ const [canScrollRight, setCanScrollRight] = (0, import_react8.useState)(false);
12468
12739
  const updateScrollState = () => {
12469
12740
  const el = scrollRef.current;
12470
12741
  if (!el) return;
12471
12742
  setCanScrollLeft(el.scrollLeft > 0);
12472
12743
  setCanScrollRight(el.scrollLeft + el.clientWidth < el.scrollWidth - 1);
12473
12744
  };
12474
- (0, import_react6.useEffect)(() => {
12745
+ (0, import_react8.useEffect)(() => {
12475
12746
  const el = scrollRef.current;
12476
12747
  if (!el) return;
12477
12748
  updateScrollState();
@@ -12486,9 +12757,9 @@ function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal
12486
12757
  const scroll = (dir) => {
12487
12758
  scrollRef.current?.scrollBy({ left: dir === "left" ? -216 : 216, behavior: "smooth" });
12488
12759
  };
12489
- const isDragging = (0, import_react6.useRef)(false);
12490
- const dragStartX = (0, import_react6.useRef)(0);
12491
- const dragStartScrollLeft = (0, import_react6.useRef)(0);
12760
+ const isDragging = (0, import_react8.useRef)(false);
12761
+ const dragStartX = (0, import_react8.useRef)(0);
12762
+ const dragStartScrollLeft = (0, import_react8.useRef)(0);
12492
12763
  const onDragStart = (e) => {
12493
12764
  if (!scrollRef.current) return;
12494
12765
  isDragging.current = true;
@@ -12508,14 +12779,14 @@ function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal
12508
12779
  scrollRef.current.style.cursor = "grab";
12509
12780
  scrollRef.current.style.userSelect = "";
12510
12781
  };
12511
- const datesWithClasses = (0, import_react6.useMemo)(
12782
+ const datesWithClasses = (0, import_react8.useMemo)(
12512
12783
  () => new Set(dates.map(
12513
12784
  (d, i) => schedule.classes?.some((c) => classRunsOnDate(c, d, schedule.type)) ? i : -1
12514
12785
  ).filter((i) => i >= 0)),
12515
12786
  [dates, schedule]
12516
12787
  );
12517
12788
  const selectedDate = dates[selectedIdx];
12518
- const selectedClasses = (0, import_react6.useMemo)(
12789
+ const selectedClasses = (0, import_react8.useMemo)(
12519
12790
  () => (schedule.classes ?? []).filter((c) => selectedDate && classRunsOnDate(c, selectedDate, schedule.type)),
12520
12791
  [schedule, selectedDate]
12521
12792
  );
@@ -12700,16 +12971,16 @@ function CalendarFoldIcon() {
12700
12971
  );
12701
12972
  }
12702
12973
  function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAfter: insertAfterProp }) {
12703
- const autoId = (0, import_react6.useId)();
12974
+ const autoId = (0, import_react8.useId)();
12704
12975
  const insertAfter = insertAfterProp ?? autoId;
12705
- const [schedule, setSchedule] = (0, import_react6.useState)(null);
12706
- const [loading, setLoading] = (0, import_react6.useState)(initialScheduleId !== null);
12707
- const [inEditor, setInEditor] = (0, import_react6.useState)(false);
12708
- const [isHovered, setIsHovered] = (0, import_react6.useState)(false);
12709
- const [modalState, setModalState] = (0, import_react6.useState)(null);
12710
- const switchScheduleIdRef = (0, import_react6.useRef)(null);
12711
- const liveScheduleIdRef = (0, import_react6.useRef)(null);
12712
- const refetchLiveSchedule = (0, import_react6.useCallback)(async () => {
12976
+ const [schedule, setSchedule] = (0, import_react8.useState)(null);
12977
+ const [loading, setLoading] = (0, import_react8.useState)(initialScheduleId !== null);
12978
+ const [inEditor, setInEditor] = (0, import_react8.useState)(false);
12979
+ const [isHovered, setIsHovered] = (0, import_react8.useState)(false);
12980
+ const [modalState, setModalState] = (0, import_react8.useState)(null);
12981
+ const switchScheduleIdRef = (0, import_react8.useRef)(null);
12982
+ const liveScheduleIdRef = (0, import_react8.useRef)(null);
12983
+ const refetchLiveSchedule = (0, import_react8.useCallback)(async () => {
12713
12984
  const id = liveScheduleIdRef.current;
12714
12985
  if (!id) return;
12715
12986
  try {
@@ -12719,7 +12990,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
12719
12990
  } catch {
12720
12991
  }
12721
12992
  }, []);
12722
- const dates = (0, import_react6.useMemo)(() => {
12993
+ const dates = (0, import_react8.useMemo)(() => {
12723
12994
  const today = /* @__PURE__ */ new Date();
12724
12995
  today.setHours(0, 0, 0, 0);
12725
12996
  return Array.from({ length: 14 }, (_, i) => {
@@ -12728,8 +12999,8 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
12728
12999
  return d;
12729
13000
  });
12730
13001
  }, []);
12731
- const [selectedIdx, setSelectedIdx] = (0, import_react6.useState)(0);
12732
- (0, import_react6.useEffect)(() => {
13002
+ const [selectedIdx, setSelectedIdx] = (0, import_react8.useState)(0);
13003
+ (0, import_react8.useEffect)(() => {
12733
13004
  if (!schedule?.classes) return;
12734
13005
  for (let i = 0; i < dates.length; i++) {
12735
13006
  if (schedule.classes.some((c) => classRunsOnDate(c, dates[i], schedule.type))) {
@@ -12738,7 +13009,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
12738
13009
  }
12739
13010
  }
12740
13011
  }, [schedule, dates]);
12741
- (0, import_react6.useEffect)(() => {
13012
+ (0, import_react8.useEffect)(() => {
12742
13013
  if (typeof window === "undefined") return;
12743
13014
  const onVisible = () => {
12744
13015
  if (!document.hidden) void refetchLiveSchedule();
@@ -12750,7 +13021,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
12750
13021
  document.removeEventListener("visibilitychange", onVisible);
12751
13022
  };
12752
13023
  }, [refetchLiveSchedule]);
12753
- (0, import_react6.useEffect)(() => {
13024
+ (0, import_react8.useEffect)(() => {
12754
13025
  if (typeof window === "undefined") return;
12755
13026
  const isInEditor = window.self !== window.top;
12756
13027
  setInEditor(isInEditor);
@@ -16505,7 +16776,7 @@ var CustomToolbarButton = React5.forwardRef(
16505
16776
  CustomToolbarButton.displayName = "CustomToolbarButton";
16506
16777
 
16507
16778
  // src/ui/item-action-toolbar.tsx
16508
- var import_react7 = require("react");
16779
+ var import_react9 = require("react");
16509
16780
  var import_lucide_react3 = require("lucide-react");
16510
16781
 
16511
16782
  // src/ui/dropdown-menu.tsx
@@ -16690,7 +16961,7 @@ function ItemActionToolbar({
16690
16961
  headingVisible = null,
16691
16962
  onHeadingVisibleChange
16692
16963
  }) {
16693
- const [moreOpen, setMoreOpen] = (0, import_react7.useState)(false);
16964
+ const [moreOpen, setMoreOpen] = (0, import_react9.useState)(false);
16694
16965
  const showDropdownToggle = dropdownOpen !== null && dropdownOpen !== void 0;
16695
16966
  const showHeadingToggle = headingVisible !== null && headingVisible !== void 0;
16696
16967
  const headingTooltip = headingVisible ? "Hide heading" : "Show heading";
@@ -16898,7 +17169,7 @@ function ItemActionToolbar({
16898
17169
  }
16899
17170
 
16900
17171
  // src/ui/item-interaction-layer.tsx
16901
- var import_react8 = require("react");
17172
+ var import_react10 = require("react");
16902
17173
  var import_react_dom3 = require("react-dom");
16903
17174
  var import_jsx_runtime14 = require("react/jsx-runtime");
16904
17175
  var PRIMARY = "var(--ohw-primary, #0885FE)";
@@ -16955,8 +17226,8 @@ function ClampedToolbarSlot({
16955
17226
  align = "center",
16956
17227
  children
16957
17228
  }) {
16958
- const slotRef = (0, import_react8.useRef)(null);
16959
- (0, import_react8.useLayoutEffect)(() => {
17229
+ const slotRef = (0, import_react10.useRef)(null);
17230
+ (0, import_react10.useLayoutEffect)(() => {
16960
17231
  const slot = slotRef.current;
16961
17232
  if (!slot) return;
16962
17233
  const clamp = () => {
@@ -17019,15 +17290,15 @@ function DetachedBelowToolbarSlot({
17019
17290
  belowEl,
17020
17291
  children
17021
17292
  }) {
17022
- const slotRef = (0, import_react8.useRef)(null);
17023
- const [anchorBottom, setAnchorBottom] = (0, import_react8.useState)(belowRect.bottom);
17024
- const [portalTarget] = (0, import_react8.useState)(
17293
+ const slotRef = (0, import_react10.useRef)(null);
17294
+ const [anchorBottom, setAnchorBottom] = (0, import_react10.useState)(belowRect.bottom);
17295
+ const [portalTarget] = (0, import_react10.useState)(
17025
17296
  () => typeof document === "undefined" ? null : document.querySelector("[data-ohw-bridge-root]") ?? document.body
17026
17297
  );
17027
- (0, import_react8.useLayoutEffect)(() => {
17298
+ (0, import_react10.useLayoutEffect)(() => {
17028
17299
  setAnchorBottom(belowRect.bottom);
17029
17300
  }, [belowRect.bottom, belowRect.height, belowRect.top]);
17030
- (0, import_react8.useLayoutEffect)(() => {
17301
+ (0, import_react10.useLayoutEffect)(() => {
17031
17302
  const slot = slotRef.current;
17032
17303
  if (!slot) return;
17033
17304
  const sync = () => {
@@ -17108,8 +17379,8 @@ function ItemInteractionLayer({
17108
17379
  hidden = false,
17109
17380
  className
17110
17381
  }) {
17111
- const localRef = (0, import_react8.useRef)(null);
17112
- (0, import_react8.useLayoutEffect)(() => {
17382
+ const localRef = (0, import_react10.useRef)(null);
17383
+ (0, import_react10.useLayoutEffect)(() => {
17113
17384
  const node = localRef.current;
17114
17385
  if (!node) return;
17115
17386
  node.style.display = hidden ? "none" : "block";
@@ -17384,7 +17655,7 @@ function apiBase() {
17384
17655
  function bridgeVersion() {
17385
17656
  try {
17386
17657
  if (true) {
17387
- return "0.1.160-next.427";
17658
+ return "0.1.160-next.429";
17388
17659
  }
17389
17660
  } catch {
17390
17661
  }
@@ -17398,7 +17669,7 @@ function stampBridgeVersionOnDocument() {
17398
17669
  return;
17399
17670
  }
17400
17671
  try {
17401
- const v = true ? "0.1.160-next.427" : "";
17672
+ const v = true ? "0.1.160-next.429" : "";
17402
17673
  if (v) {
17403
17674
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
17404
17675
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -18305,7 +18576,7 @@ function CarouselOverlay({
18305
18576
  }
18306
18577
 
18307
18578
  // src/ui/ai-section/AiSectionOverlay.tsx
18308
- var import_react9 = require("react");
18579
+ var import_react11 = require("react");
18309
18580
  var import_lucide_react7 = require("lucide-react");
18310
18581
 
18311
18582
  // src/lib/ai-change-highlight.ts
@@ -18400,8 +18671,8 @@ function readRect(instanceId) {
18400
18671
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
18401
18672
  }
18402
18673
  function useLiveSectionRect(sectionId) {
18403
- const [rect, setRect] = (0, import_react9.useState)(null);
18404
- (0, import_react9.useEffect)(() => {
18674
+ const [rect, setRect] = (0, import_react11.useState)(null);
18675
+ (0, import_react11.useEffect)(() => {
18405
18676
  if (!sectionId) {
18406
18677
  setRect(null);
18407
18678
  return;
@@ -18440,8 +18711,8 @@ function readNavToggleRect() {
18440
18711
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
18441
18712
  }
18442
18713
  function useLiveNavToggleHole(active) {
18443
- const [rect, setRect] = (0, import_react9.useState)(null);
18444
- (0, import_react9.useEffect)(() => {
18714
+ const [rect, setRect] = (0, import_react11.useState)(null);
18715
+ (0, import_react11.useEffect)(() => {
18445
18716
  if (!active) {
18446
18717
  setRect(null);
18447
18718
  return;
@@ -18503,7 +18774,7 @@ function ReviewButton({
18503
18774
  background,
18504
18775
  color
18505
18776
  }) {
18506
- const [hover, setHover] = (0, import_react9.useState)(false);
18777
+ const [hover, setHover] = (0, import_react11.useState)(false);
18507
18778
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { style: { position: "relative" }, children: [
18508
18779
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
18509
18780
  "button",
@@ -18558,17 +18829,17 @@ function AiSectionOverlay({
18558
18829
  apiRef,
18559
18830
  onSelectionChange
18560
18831
  }) {
18561
- const [selectedId, setSelectedId] = (0, import_react9.useState)(null);
18562
- const [reviewId, setReviewId] = (0, import_react9.useState)(null);
18563
- const [reviewButtonsHidden, setReviewButtonsHidden] = (0, import_react9.useState)(false);
18564
- const reviewIdRef = (0, import_react9.useRef)(null);
18832
+ const [selectedId, setSelectedId] = (0, import_react11.useState)(null);
18833
+ const [reviewId, setReviewId] = (0, import_react11.useState)(null);
18834
+ const [reviewButtonsHidden, setReviewButtonsHidden] = (0, import_react11.useState)(false);
18835
+ const reviewIdRef = (0, import_react11.useRef)(null);
18565
18836
  reviewIdRef.current = reviewId;
18566
- const selectedIdRef = (0, import_react9.useRef)(null);
18837
+ const selectedIdRef = (0, import_react11.useRef)(null);
18567
18838
  selectedIdRef.current = selectedId;
18568
- (0, import_react9.useEffect)(() => {
18839
+ (0, import_react11.useEffect)(() => {
18569
18840
  onSelectionChange?.(selectedId);
18570
18841
  }, [selectedId, onSelectionChange]);
18571
- const report = (0, import_react9.useCallback)(
18842
+ const report = (0, import_react11.useCallback)(
18572
18843
  (el) => {
18573
18844
  const labelSrc = el ? sectionElementOf(el) : null;
18574
18845
  postToParent2({
@@ -18579,7 +18850,7 @@ function AiSectionOverlay({
18579
18850
  },
18580
18851
  [postToParent2]
18581
18852
  );
18582
- const selectFromElement = (0, import_react9.useCallback)(
18853
+ const selectFromElement = (0, import_react11.useCallback)(
18583
18854
  (el, options) => {
18584
18855
  const inner = el?.closest("[data-ohw-section]") ?? null;
18585
18856
  const sectionEl = inner ? movableUnit(inner) : null;
@@ -18591,7 +18862,7 @@ function AiSectionOverlay({
18591
18862
  },
18592
18863
  [report]
18593
18864
  );
18594
- (0, import_react9.useEffect)(() => {
18865
+ (0, import_react11.useEffect)(() => {
18595
18866
  apiRef.current = {
18596
18867
  selectFromElement,
18597
18868
  handleBackgroundClick: (target, clientX, clientY) => {
@@ -18616,7 +18887,7 @@ function AiSectionOverlay({
18616
18887
  apiRef.current = null;
18617
18888
  };
18618
18889
  }, [apiRef, selectFromElement, report]);
18619
- (0, import_react9.useEffect)(() => {
18890
+ (0, import_react11.useEffect)(() => {
18620
18891
  const onMessage = (e) => {
18621
18892
  if (e.data?.type === "ow:ai-select" && e.data.sectionId === null) {
18622
18893
  selectedIdRef.current = null;
@@ -18641,9 +18912,9 @@ function AiSectionOverlay({
18641
18912
  window.addEventListener("message", onMessage);
18642
18913
  return () => window.removeEventListener("message", onMessage);
18643
18914
  }, [postToParent2]);
18644
- (0, import_react9.useEffect)(() => installAiChangeHighlight(), []);
18645
- const [hoveredId, setHoveredId] = (0, import_react9.useState)(null);
18646
- (0, import_react9.useEffect)(() => {
18915
+ (0, import_react11.useEffect)(() => installAiChangeHighlight(), []);
18916
+ const [hoveredId, setHoveredId] = (0, import_react11.useState)(null);
18917
+ (0, import_react11.useEffect)(() => {
18647
18918
  const onMove = (e) => {
18648
18919
  const t = e.target;
18649
18920
  if (!(t instanceof Element)) return;
@@ -18668,7 +18939,7 @@ function AiSectionOverlay({
18668
18939
  document.documentElement.removeEventListener("mouseleave", onLeave);
18669
18940
  };
18670
18941
  }, []);
18671
- (0, import_react9.useEffect)(() => {
18942
+ (0, import_react11.useEffect)(() => {
18672
18943
  const onKeyDown = (e) => {
18673
18944
  if (e.key !== "Escape") return;
18674
18945
  if (reviewIdRef.current) return;
@@ -18682,7 +18953,7 @@ function AiSectionOverlay({
18682
18953
  document.addEventListener("keydown", onKeyDown);
18683
18954
  return () => document.removeEventListener("keydown", onKeyDown);
18684
18955
  }, [report]);
18685
- const decide = (0, import_react9.useCallback)(
18956
+ const decide = (0, import_react11.useCallback)(
18686
18957
  (decision) => {
18687
18958
  const sectionId = reviewIdRef.current;
18688
18959
  if (!sectionId) return;
@@ -18691,8 +18962,8 @@ function AiSectionOverlay({
18691
18962
  },
18692
18963
  [postToParent2]
18693
18964
  );
18694
- const [navDropdownForceOpen, setNavDropdownForceOpen] = (0, import_react9.useState)(false);
18695
- (0, import_react9.useEffect)(() => {
18965
+ const [navDropdownForceOpen, setNavDropdownForceOpen] = (0, import_react11.useState)(false);
18966
+ (0, import_react11.useEffect)(() => {
18696
18967
  const update = () => {
18697
18968
  setNavDropdownForceOpen(Boolean(document.querySelector("[data-ohw-nav-force-open]")));
18698
18969
  };
@@ -18711,7 +18982,7 @@ function AiSectionOverlay({
18711
18982
  const navToggleHole = useLiveNavToggleHole(Boolean(reviewId));
18712
18983
  const hoverRect = useLiveSectionRect(reviewId || hoveredId === selectedId ? null : hoveredId);
18713
18984
  const showSelectionBorder = Boolean(selectionRect) && !navDropdownForceOpen;
18714
- (0, import_react9.useEffect)(() => {
18985
+ (0, import_react11.useEffect)(() => {
18715
18986
  const selectedEl = activeSelectionId ? findSectionElement(activeSelectionId) : null;
18716
18987
  if (!activeSelectionId || !selectionRect || selectedEl && isChromeSection(selectedEl)) {
18717
18988
  postToParent2({ type: "ow:section-rect", instanceId: null, rect: null });
@@ -18831,7 +19102,7 @@ function AiSectionOverlay({
18831
19102
  }
18832
19103
 
18833
19104
  // src/ui/ai-section/AiMediaStripOverlay.tsx
18834
- var import_react10 = require("react");
19105
+ var import_react12 = require("react");
18835
19106
  var import_lucide_react9 = require("lucide-react");
18836
19107
 
18837
19108
  // src/lib/ai-media-strip-tree.ts
@@ -19112,8 +19383,8 @@ function readStripRect(ref) {
19112
19383
  return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
19113
19384
  }
19114
19385
  function useLiveItemRect(ref, strip = false) {
19115
- const [rect, setRect] = (0, import_react10.useState)(null);
19116
- (0, import_react10.useEffect)(() => {
19386
+ const [rect, setRect] = (0, import_react12.useState)(null);
19387
+ (0, import_react12.useEffect)(() => {
19117
19388
  if (!ref) {
19118
19389
  setRect(null);
19119
19390
  return;
@@ -19141,10 +19412,10 @@ var TOOLBAR_STRIP_GAP = 52;
19141
19412
  var TOOLBAR_STRIP_GAP_MOBILE = 42;
19142
19413
  var TOOLBAR_EDGE_MARGIN2 = 4;
19143
19414
  function StripToolbarSlot({ stripRect, children }) {
19144
- const slotRef = (0, import_react10.useRef)(null);
19145
- const [shift, setShift] = (0, import_react10.useState)(0);
19415
+ const slotRef = (0, import_react12.useRef)(null);
19416
+ const [shift, setShift] = (0, import_react12.useState)(0);
19146
19417
  const centerX = stripRect.left + stripRect.width / 2;
19147
- (0, import_react10.useLayoutEffect)(() => {
19418
+ (0, import_react12.useLayoutEffect)(() => {
19148
19419
  const slot = slotRef.current;
19149
19420
  if (!slot) return;
19150
19421
  const clamp = () => {
@@ -19293,9 +19564,9 @@ function LinkModal({
19293
19564
  onClose,
19294
19565
  onSave
19295
19566
  }) {
19296
- const [draft, setDraft] = (0, import_react10.useState)(href);
19297
- const [newTab, setNewTab] = (0, import_react10.useState)(linkTarget !== "same-tab");
19298
- const [invalid, setInvalid] = (0, import_react10.useState)(false);
19567
+ const [draft, setDraft] = (0, import_react12.useState)(href);
19568
+ const [newTab, setNewTab] = (0, import_react12.useState)(linkTarget !== "same-tab");
19569
+ const [invalid, setInvalid] = (0, import_react12.useState)(false);
19299
19570
  const save = () => {
19300
19571
  const next = draft.trim();
19301
19572
  if (next && !HTTP_URL_RE.test(next)) {
@@ -19504,17 +19775,17 @@ function AiMediaStripOverlay({
19504
19775
  applyTreeLocalRef,
19505
19776
  clearInteractionChromeRef
19506
19777
  }) {
19507
- const [hover, setHover] = (0, import_react10.useState)(null);
19508
- const [active, setActive] = (0, import_react10.useState)(null);
19509
- const [itemEditOn, setItemEditOn] = (0, import_react10.useState)(false);
19510
- const [linkOpen, setLinkOpen] = (0, import_react10.useState)(false);
19511
- const [pending, setPending] = (0, import_react10.useState)(false);
19512
- const [error, setError] = (0, import_react10.useState)(null);
19513
- const activeRef = (0, import_react10.useRef)(null);
19778
+ const [hover, setHover] = (0, import_react12.useState)(null);
19779
+ const [active, setActive] = (0, import_react12.useState)(null);
19780
+ const [itemEditOn, setItemEditOn] = (0, import_react12.useState)(false);
19781
+ const [linkOpen, setLinkOpen] = (0, import_react12.useState)(false);
19782
+ const [pending, setPending] = (0, import_react12.useState)(false);
19783
+ const [error, setError] = (0, import_react12.useState)(null);
19784
+ const activeRef = (0, import_react12.useRef)(null);
19514
19785
  activeRef.current = active;
19515
- const linkOpenRef = (0, import_react10.useRef)(false);
19786
+ const linkOpenRef = (0, import_react12.useRef)(false);
19516
19787
  linkOpenRef.current = linkOpen;
19517
- (0, import_react10.useEffect)(() => {
19788
+ (0, import_react12.useEffect)(() => {
19518
19789
  const onMove = (e) => {
19519
19790
  const ref = itemRefFromTarget(e.target);
19520
19791
  const t = e.target;
@@ -19532,7 +19803,7 @@ function AiMediaStripOverlay({
19532
19803
  document.documentElement.removeEventListener("mouseleave", onLeave);
19533
19804
  };
19534
19805
  }, []);
19535
- (0, import_react10.useEffect)(() => {
19806
+ (0, import_react12.useEffect)(() => {
19536
19807
  const onClick = (e) => {
19537
19808
  const t = e.target;
19538
19809
  if (!(t instanceof Element)) return;
@@ -19547,7 +19818,7 @@ function AiMediaStripOverlay({
19547
19818
  document.addEventListener("click", onClick, true);
19548
19819
  return () => document.removeEventListener("click", onClick, true);
19549
19820
  }, [clearInteractionChromeRef]);
19550
- (0, import_react10.useEffect)(() => {
19821
+ (0, import_react12.useEffect)(() => {
19551
19822
  const onBlur = () => {
19552
19823
  if (!activeRef.current) return;
19553
19824
  setActive(null);
@@ -19558,7 +19829,7 @@ function AiMediaStripOverlay({
19558
19829
  window.addEventListener("blur", onBlur);
19559
19830
  return () => window.removeEventListener("blur", onBlur);
19560
19831
  }, []);
19561
- (0, import_react10.useEffect)(() => {
19832
+ (0, import_react12.useEffect)(() => {
19562
19833
  const onKeyDown = (e) => {
19563
19834
  if (e.key !== "Escape") return;
19564
19835
  if (!activeRef.current) return;
@@ -19571,14 +19842,14 @@ function AiMediaStripOverlay({
19571
19842
  document.addEventListener("keydown", onKeyDown);
19572
19843
  return () => document.removeEventListener("keydown", onKeyDown);
19573
19844
  }, []);
19574
- const findEntry = (0, import_react10.useCallback)(
19845
+ const findEntry = (0, import_react12.useCallback)(
19575
19846
  (sectionId) => {
19576
19847
  const state = parseAiSectionsState(aiSectionsRef.current);
19577
19848
  return state.sections.find((s) => s.id === sectionId) ?? null;
19578
19849
  },
19579
19850
  [aiSectionsRef]
19580
19851
  );
19581
- const runMutation = (0, import_react10.useCallback)(
19852
+ const runMutation = (0, import_react12.useCallback)(
19582
19853
  async (sectionId, mutate, extraMedia) => {
19583
19854
  const entry = findEntry(sectionId);
19584
19855
  if (!entry) return false;
@@ -19721,7 +19992,7 @@ function AiMediaStripOverlay({
19721
19992
  }
19722
19993
 
19723
19994
  // src/ui/ai-section/AiPricingCardOverlay.tsx
19724
- var import_react11 = require("react");
19995
+ var import_react13 = require("react");
19725
19996
  var import_lucide_react10 = require("lucide-react");
19726
19997
  var import_jsx_runtime22 = require("react/jsx-runtime");
19727
19998
  var PRIMARY4 = "var(--ohw-primary, #0885FE)";
@@ -19764,8 +20035,8 @@ function readGridRect(ref) {
19764
20035
  return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
19765
20036
  }
19766
20037
  function useLiveCardRect(ref, grid = false) {
19767
- const [rect, setRect] = (0, import_react11.useState)(null);
19768
- (0, import_react11.useEffect)(() => {
20038
+ const [rect, setRect] = (0, import_react13.useState)(null);
20039
+ (0, import_react13.useEffect)(() => {
19769
20040
  if (!ref) {
19770
20041
  setRect(null);
19771
20042
  return;
@@ -19793,10 +20064,10 @@ var TOOLBAR_GRID_GAP = 52;
19793
20064
  var TOOLBAR_GRID_GAP_MOBILE = 42;
19794
20065
  var TOOLBAR_EDGE_MARGIN3 = 4;
19795
20066
  function GridToolbarSlot({ gridRect, children }) {
19796
- const slotRef = (0, import_react11.useRef)(null);
19797
- const [shift, setShift] = (0, import_react11.useState)(0);
20067
+ const slotRef = (0, import_react13.useRef)(null);
20068
+ const [shift, setShift] = (0, import_react13.useState)(0);
19798
20069
  const centerX = gridRect.left + gridRect.width / 2;
19799
- (0, import_react11.useLayoutEffect)(() => {
20070
+ (0, import_react13.useLayoutEffect)(() => {
19800
20071
  const slot = slotRef.current;
19801
20072
  if (!slot) return;
19802
20073
  const clamp = () => {
@@ -20053,13 +20324,13 @@ function AiPricingCardOverlay({
20053
20324
  aiSectionsRef,
20054
20325
  applyTreeLocalRef
20055
20326
  }) {
20056
- const [hover, setHover] = (0, import_react11.useState)(null);
20057
- const [active, setActive] = (0, import_react11.useState)(null);
20058
- const [pending, setPending] = (0, import_react11.useState)(false);
20059
- const [error, setError] = (0, import_react11.useState)(null);
20060
- const activeRef = (0, import_react11.useRef)(null);
20327
+ const [hover, setHover] = (0, import_react13.useState)(null);
20328
+ const [active, setActive] = (0, import_react13.useState)(null);
20329
+ const [pending, setPending] = (0, import_react13.useState)(false);
20330
+ const [error, setError] = (0, import_react13.useState)(null);
20331
+ const activeRef = (0, import_react13.useRef)(null);
20061
20332
  activeRef.current = active;
20062
- (0, import_react11.useEffect)(() => {
20333
+ (0, import_react13.useEffect)(() => {
20063
20334
  const onMove = (e) => {
20064
20335
  const ref = cardRefFromTarget(e.target);
20065
20336
  const t = e.target;
@@ -20077,7 +20348,7 @@ function AiPricingCardOverlay({
20077
20348
  document.documentElement.removeEventListener("mouseleave", onLeave);
20078
20349
  };
20079
20350
  }, []);
20080
- (0, import_react11.useEffect)(() => {
20351
+ (0, import_react13.useEffect)(() => {
20081
20352
  const onClick = (e) => {
20082
20353
  const t = e.target;
20083
20354
  if (!(t instanceof Element)) return;
@@ -20089,7 +20360,7 @@ function AiPricingCardOverlay({
20089
20360
  document.addEventListener("click", onClick, true);
20090
20361
  return () => document.removeEventListener("click", onClick, true);
20091
20362
  }, []);
20092
- (0, import_react11.useEffect)(() => {
20363
+ (0, import_react13.useEffect)(() => {
20093
20364
  const onBlur = () => {
20094
20365
  if (!activeRef.current) return;
20095
20366
  setActive(null);
@@ -20098,7 +20369,7 @@ function AiPricingCardOverlay({
20098
20369
  window.addEventListener("blur", onBlur);
20099
20370
  return () => window.removeEventListener("blur", onBlur);
20100
20371
  }, []);
20101
- (0, import_react11.useEffect)(() => {
20372
+ (0, import_react13.useEffect)(() => {
20102
20373
  const onKeyDown = (e) => {
20103
20374
  if (e.key !== "Escape") return;
20104
20375
  if (!activeRef.current) return;
@@ -20109,14 +20380,14 @@ function AiPricingCardOverlay({
20109
20380
  document.addEventListener("keydown", onKeyDown);
20110
20381
  return () => document.removeEventListener("keydown", onKeyDown);
20111
20382
  }, []);
20112
- const findEntry = (0, import_react11.useCallback)(
20383
+ const findEntry = (0, import_react13.useCallback)(
20113
20384
  (sectionId) => {
20114
20385
  const state = parseAiSectionsState(aiSectionsRef.current);
20115
20386
  return state.sections.find((s) => s.id === sectionId) ?? null;
20116
20387
  },
20117
20388
  [aiSectionsRef]
20118
20389
  );
20119
- const runMutation = (0, import_react11.useCallback)(
20390
+ const runMutation = (0, import_react13.useCallback)(
20120
20391
  async (sectionId, mutate) => {
20121
20392
  const entry = findEntry(sectionId);
20122
20393
  if (!entry) return false;
@@ -20203,7 +20474,7 @@ function AiPricingCardOverlay({
20203
20474
  }
20204
20475
 
20205
20476
  // src/ui/ai-section/AiVideoOverlay.tsx
20206
- var import_react12 = require("react");
20477
+ var import_react14 = require("react");
20207
20478
  var import_lucide_react11 = require("lucide-react");
20208
20479
 
20209
20480
  // src/lib/ai-video-tree.ts
@@ -20246,34 +20517,6 @@ function clearVideo(tree, path) {
20246
20517
  });
20247
20518
  }
20248
20519
 
20249
- // src/lib/youtube.ts
20250
- var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
20251
- function extractYouTubeId(input) {
20252
- const trimmed = input.trim();
20253
- if (!trimmed) return null;
20254
- if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
20255
- let url;
20256
- try {
20257
- url = new URL(trimmed);
20258
- } catch {
20259
- return null;
20260
- }
20261
- const host = url.hostname.replace(/^www\./, "");
20262
- if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
20263
- return null;
20264
- }
20265
- let candidate = null;
20266
- if (host === "youtu.be") {
20267
- candidate = url.pathname.slice(1).split("/")[0] ?? null;
20268
- } else if (url.pathname === "/watch") {
20269
- candidate = url.searchParams.get("v");
20270
- } else {
20271
- const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
20272
- candidate = match ? match[1] : null;
20273
- }
20274
- return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
20275
- }
20276
-
20277
20520
  // src/ui/ai-section/AiVideoOverlay.tsx
20278
20521
  var import_jsx_runtime23 = require("react/jsx-runtime");
20279
20522
  var PRIMARY5 = "#0885FE";
@@ -20296,8 +20539,8 @@ function readRect4(ref) {
20296
20539
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
20297
20540
  }
20298
20541
  function useLiveBlockRect(ref) {
20299
- const [rect, setRect] = (0, import_react12.useState)(null);
20300
- (0, import_react12.useEffect)(() => {
20542
+ const [rect, setRect] = (0, import_react14.useState)(null);
20543
+ (0, import_react14.useEffect)(() => {
20301
20544
  if (!ref) {
20302
20545
  setRect(null);
20303
20546
  return;
@@ -20375,9 +20618,9 @@ function watchUrl(id) {
20375
20618
  return `https://www.youtube.com/watch?v=${id}`;
20376
20619
  }
20377
20620
  function VideoUrlInput({ value, onCommit }) {
20378
- const [draft, setDraft] = (0, import_react12.useState)(value ? watchUrl(value) : "");
20379
- const [invalid, setInvalid] = (0, import_react12.useState)(false);
20380
- (0, import_react12.useEffect)(() => {
20621
+ const [draft, setDraft] = (0, import_react14.useState)(value ? watchUrl(value) : "");
20622
+ const [invalid, setInvalid] = (0, import_react14.useState)(false);
20623
+ (0, import_react14.useEffect)(() => {
20381
20624
  setDraft(value ? watchUrl(value) : "");
20382
20625
  setInvalid(false);
20383
20626
  }, [value]);
@@ -20514,13 +20757,13 @@ function AiVideoOverlay({
20514
20757
  applyTreeLocalRef,
20515
20758
  clearInteractionChromeRef
20516
20759
  }) {
20517
- const [hover, setHover] = (0, import_react12.useState)(null);
20518
- const [active, setActive] = (0, import_react12.useState)(null);
20519
- const [pending, setPending] = (0, import_react12.useState)(false);
20520
- const [error, setError] = (0, import_react12.useState)(null);
20521
- const activeRef = (0, import_react12.useRef)(null);
20760
+ const [hover, setHover] = (0, import_react14.useState)(null);
20761
+ const [active, setActive] = (0, import_react14.useState)(null);
20762
+ const [pending, setPending] = (0, import_react14.useState)(false);
20763
+ const [error, setError] = (0, import_react14.useState)(null);
20764
+ const activeRef = (0, import_react14.useRef)(null);
20522
20765
  activeRef.current = active;
20523
- (0, import_react12.useEffect)(() => {
20766
+ (0, import_react14.useEffect)(() => {
20524
20767
  const onMove = (e) => {
20525
20768
  const t = e.target;
20526
20769
  if (!(t instanceof HTMLElement)) return;
@@ -20550,7 +20793,7 @@ function AiVideoOverlay({
20550
20793
  document.documentElement.removeEventListener("mouseleave", onLeave);
20551
20794
  };
20552
20795
  }, []);
20553
- (0, import_react12.useEffect)(() => {
20796
+ (0, import_react14.useEffect)(() => {
20554
20797
  const onClick = (e) => {
20555
20798
  const current = activeRef.current;
20556
20799
  if (!current) return;
@@ -20565,7 +20808,7 @@ function AiVideoOverlay({
20565
20808
  document.addEventListener("click", onClick, true);
20566
20809
  return () => document.removeEventListener("click", onClick, true);
20567
20810
  }, []);
20568
- (0, import_react12.useEffect)(() => {
20811
+ (0, import_react14.useEffect)(() => {
20569
20812
  const onBlur = () => {
20570
20813
  if (!activeRef.current) return;
20571
20814
  setActive(null);
@@ -20574,7 +20817,7 @@ function AiVideoOverlay({
20574
20817
  window.addEventListener("blur", onBlur);
20575
20818
  return () => window.removeEventListener("blur", onBlur);
20576
20819
  }, []);
20577
- (0, import_react12.useEffect)(() => {
20820
+ (0, import_react14.useEffect)(() => {
20578
20821
  const onKeyDown = (e) => {
20579
20822
  if (e.key !== "Escape") return;
20580
20823
  if (!activeRef.current) return;
@@ -20584,14 +20827,14 @@ function AiVideoOverlay({
20584
20827
  document.addEventListener("keydown", onKeyDown);
20585
20828
  return () => document.removeEventListener("keydown", onKeyDown);
20586
20829
  }, []);
20587
- const findEntry = (0, import_react12.useCallback)(
20830
+ const findEntry = (0, import_react14.useCallback)(
20588
20831
  (sectionId) => {
20589
20832
  const state = parseAiSectionsState(aiSectionsRef.current);
20590
20833
  return state.sections.find((s) => s.id === sectionId) ?? null;
20591
20834
  },
20592
20835
  [aiSectionsRef]
20593
20836
  );
20594
- const runMutation = (0, import_react12.useCallback)(
20837
+ const runMutation = (0, import_react14.useCallback)(
20595
20838
  async (sectionId, mutate) => {
20596
20839
  const entry = findEntry(sectionId);
20597
20840
  if (!entry) return false;
@@ -20683,7 +20926,7 @@ function AiVideoOverlay({
20683
20926
  }
20684
20927
 
20685
20928
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
20686
- var import_react13 = require("react");
20929
+ var import_react15 = require("react");
20687
20930
  var import_lucide_react12 = require("lucide-react");
20688
20931
 
20689
20932
  // src/lib/ai-carousel-tree.ts
@@ -20756,8 +20999,8 @@ function readRect5(ref) {
20756
20999
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
20757
21000
  }
20758
21001
  function useLiveItemRect2(ref) {
20759
- const [rect, setRect] = (0, import_react13.useState)(null);
20760
- (0, import_react13.useEffect)(() => {
21002
+ const [rect, setRect] = (0, import_react15.useState)(null);
21003
+ (0, import_react15.useEffect)(() => {
20761
21004
  if (!ref) {
20762
21005
  setRect(null);
20763
21006
  return;
@@ -20964,19 +21207,19 @@ function AiFadeCarouselOverlay({
20964
21207
  applyTreeLocalRef,
20965
21208
  clearInteractionChromeRef
20966
21209
  }) {
20967
- const [hover, setHover] = (0, import_react13.useState)(null);
20968
- const [active, setActive] = (0, import_react13.useState)(null);
20969
- const [pending, setPending] = (0, import_react13.useState)(false);
20970
- const [error, setError] = (0, import_react13.useState)(null);
20971
- const [autoplayOverride, setAutoplayOverride] = (0, import_react13.useState)(null);
20972
- const [swapping, setSwapping] = (0, import_react13.useState)(null);
20973
- const skeletonRef = (0, import_react13.useRef)(null);
20974
- const activeRef = (0, import_react13.useRef)(null);
21210
+ const [hover, setHover] = (0, import_react15.useState)(null);
21211
+ const [active, setActive] = (0, import_react15.useState)(null);
21212
+ const [pending, setPending] = (0, import_react15.useState)(false);
21213
+ const [error, setError] = (0, import_react15.useState)(null);
21214
+ const [autoplayOverride, setAutoplayOverride] = (0, import_react15.useState)(null);
21215
+ const [swapping, setSwapping] = (0, import_react15.useState)(null);
21216
+ const skeletonRef = (0, import_react15.useRef)(null);
21217
+ const activeRef = (0, import_react15.useRef)(null);
20975
21218
  activeRef.current = active;
20976
- (0, import_react13.useEffect)(() => {
21219
+ (0, import_react15.useEffect)(() => {
20977
21220
  setAutoplayOverride(null);
20978
21221
  }, [active?.sectionId, active?.index]);
20979
- (0, import_react13.useEffect)(() => {
21222
+ (0, import_react15.useEffect)(() => {
20980
21223
  if (!swapping?.fadingOut || !skeletonRef.current) return;
20981
21224
  const anim = skeletonRef.current.animate([{ opacity: 1 }, { opacity: 0 }], {
20982
21225
  duration: MEDIA_UPLOAD_FADE_MS,
@@ -20986,7 +21229,7 @@ function AiFadeCarouselOverlay({
20986
21229
  anim.finished.then(() => setSwapping(null)).catch(() => setSwapping(null));
20987
21230
  return () => anim.cancel();
20988
21231
  }, [swapping?.fadingOut]);
20989
- (0, import_react13.useEffect)(() => {
21232
+ (0, import_react15.useEffect)(() => {
20990
21233
  const onMove = (e) => {
20991
21234
  const t = e.target;
20992
21235
  if (!(t instanceof Element)) return;
@@ -21020,7 +21263,7 @@ function AiFadeCarouselOverlay({
21020
21263
  document.documentElement.removeEventListener("mouseleave", onLeave);
21021
21264
  };
21022
21265
  }, []);
21023
- (0, import_react13.useEffect)(() => {
21266
+ (0, import_react15.useEffect)(() => {
21024
21267
  const onClick = (e) => {
21025
21268
  const current = activeRef.current;
21026
21269
  if (!current) return;
@@ -21035,7 +21278,7 @@ function AiFadeCarouselOverlay({
21035
21278
  document.addEventListener("click", onClick, true);
21036
21279
  return () => document.removeEventListener("click", onClick, true);
21037
21280
  }, []);
21038
- (0, import_react13.useEffect)(() => {
21281
+ (0, import_react15.useEffect)(() => {
21039
21282
  const onBlur = () => {
21040
21283
  if (!activeRef.current) return;
21041
21284
  setActive(null);
@@ -21044,7 +21287,7 @@ function AiFadeCarouselOverlay({
21044
21287
  window.addEventListener("blur", onBlur);
21045
21288
  return () => window.removeEventListener("blur", onBlur);
21046
21289
  }, []);
21047
- (0, import_react13.useEffect)(() => {
21290
+ (0, import_react15.useEffect)(() => {
21048
21291
  const onKeyDown = (e) => {
21049
21292
  if (e.key !== "Escape") return;
21050
21293
  if (!activeRef.current) return;
@@ -21054,14 +21297,14 @@ function AiFadeCarouselOverlay({
21054
21297
  document.addEventListener("keydown", onKeyDown);
21055
21298
  return () => document.removeEventListener("keydown", onKeyDown);
21056
21299
  }, []);
21057
- const findEntry = (0, import_react13.useCallback)(
21300
+ const findEntry = (0, import_react15.useCallback)(
21058
21301
  (sectionId) => {
21059
21302
  const state = parseAiSectionsState(aiSectionsRef.current);
21060
21303
  return state.sections.find((s) => s.id === sectionId) ?? null;
21061
21304
  },
21062
21305
  [aiSectionsRef]
21063
21306
  );
21064
- const runMutation = (0, import_react13.useCallback)(
21307
+ const runMutation = (0, import_react15.useCallback)(
21065
21308
  async (sectionId, mutate, extraMedia) => {
21066
21309
  const entry = findEntry(sectionId);
21067
21310
  if (!entry) return false;
@@ -21198,7 +21441,7 @@ function AiFadeCarouselOverlay({
21198
21441
 
21199
21442
  // src/OhhwellsBridge.tsx
21200
21443
  var import_react_dom6 = require("react-dom");
21201
- var import_navigation3 = require("next/navigation");
21444
+ var import_navigation4 = require("next/navigation");
21202
21445
 
21203
21446
  // src/lib/media-overlay-guards.ts
21204
21447
  var BRIDGE_CHROME_SELECTOR = [
@@ -21340,35 +21583,8 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
21340
21583
  return next;
21341
21584
  }
21342
21585
 
21343
- // src/lib/scroll-to-section.ts
21344
- var MAX_ATTEMPTS = 12;
21345
- var RETRY_MS = 100;
21346
- function getHashSectionId() {
21347
- if (typeof window === "undefined") return null;
21348
- const id = window.location.hash.replace(/^#/, "").trim();
21349
- return id || null;
21350
- }
21351
- function scrollToOhwSection(sectionId, behavior = "smooth") {
21352
- if (!sectionId || typeof document === "undefined") return false;
21353
- const el = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
21354
- if (!el) return false;
21355
- el.scrollIntoView({ behavior, block: "start" });
21356
- return true;
21357
- }
21358
- function scrollToHashSectionWhenReady(behavior = "smooth") {
21359
- const id = getHashSectionId();
21360
- if (!id) return;
21361
- let attempt = 0;
21362
- const tick = () => {
21363
- if (scrollToOhwSection(id, behavior)) return;
21364
- attempt += 1;
21365
- if (attempt < MAX_ATTEMPTS) window.setTimeout(tick, RETRY_MS);
21366
- };
21367
- tick();
21368
- }
21369
-
21370
21586
  // src/ui/link-modal/LinkPopover.tsx
21371
- var import_react17 = require("react");
21587
+ var import_react19 = require("react");
21372
21588
 
21373
21589
  // src/ui/link-modal/LinkEditorPanel.tsx
21374
21590
  var import_lucide_react16 = require("lucide-react");
@@ -21461,7 +21677,7 @@ function SectionTreeItem({
21461
21677
  }
21462
21678
 
21463
21679
  // src/ui/link-modal/UrlOrPageInput.tsx
21464
- var import_react14 = require("react");
21680
+ var import_react16 = require("react");
21465
21681
 
21466
21682
  // src/ui/input.tsx
21467
21683
  var React10 = __toESM(require("react"), 1);
@@ -21529,11 +21745,11 @@ function UrlOrPageInput({
21529
21745
  readOnly = false,
21530
21746
  urlError
21531
21747
  }) {
21532
- const inputId = (0, import_react14.useId)();
21533
- const inputRef = (0, import_react14.useRef)(null);
21534
- const rootRef = (0, import_react14.useRef)(null);
21535
- const [isFocused, setIsFocused] = (0, import_react14.useState)(false);
21536
- (0, import_react14.useEffect)(() => {
21748
+ const inputId = (0, import_react16.useId)();
21749
+ const inputRef = (0, import_react16.useRef)(null);
21750
+ const rootRef = (0, import_react16.useRef)(null);
21751
+ const [isFocused, setIsFocused] = (0, import_react16.useState)(false);
21752
+ (0, import_react16.useEffect)(() => {
21537
21753
  if (!dropdownOpen) return;
21538
21754
  const isOutside = (e) => {
21539
21755
  const root = rootRef.current;
@@ -21741,10 +21957,10 @@ function LinkEditorPanel({ state, onClose }) {
21741
21957
  }
21742
21958
 
21743
21959
  // src/ui/link-modal/SectionPickerOverlay.tsx
21744
- var import_react15 = require("react");
21960
+ var import_react17 = require("react");
21745
21961
  var import_react_dom4 = require("react-dom");
21746
21962
  var import_lucide_react17 = require("lucide-react");
21747
- var import_navigation2 = require("next/navigation");
21963
+ var import_navigation3 = require("next/navigation");
21748
21964
 
21749
21965
  // src/lib/parent-scroll.ts
21750
21966
  function visibleBand(parentScroll) {
@@ -21798,12 +22014,12 @@ function hitTestSectionId(x, y, sectionIds, rects) {
21798
22014
  return null;
21799
22015
  }
21800
22016
  function useSectionRects(sectionIdsKey, enabled) {
21801
- const [rects, setRects] = (0, import_react15.useState)(/* @__PURE__ */ new Map());
21802
- const sectionIds = (0, import_react15.useMemo)(
22017
+ const [rects, setRects] = (0, import_react17.useState)(/* @__PURE__ */ new Map());
22018
+ const sectionIds = (0, import_react17.useMemo)(
21803
22019
  () => sectionIdsKey ? sectionIdsKey.split("\0") : [],
21804
22020
  [sectionIdsKey]
21805
22021
  );
21806
- (0, import_react15.useEffect)(() => {
22022
+ (0, import_react17.useEffect)(() => {
21807
22023
  if (!enabled || sectionIds.length === 0) {
21808
22024
  setRects((prev) => prev.size === 0 ? prev : /* @__PURE__ */ new Map());
21809
22025
  return;
@@ -21842,15 +22058,15 @@ function SectionPickerOverlay({
21842
22058
  onBack,
21843
22059
  onSelect
21844
22060
  }) {
21845
- const router = (0, import_navigation2.useRouter)();
21846
- const pathname = (0, import_navigation2.usePathname)();
21847
- const [selectedId, setSelectedId] = (0, import_react15.useState)(null);
21848
- const [hoveredId, setHoveredId] = (0, import_react15.useState)(null);
21849
- const pointerRef = (0, import_react15.useRef)(null);
21850
- const pointerScreenRef = (0, import_react15.useRef)(null);
21851
- const iframeOffsetTopRef = (0, import_react15.useRef)(null);
21852
- const sectionIdsRef = (0, import_react15.useRef)([]);
21853
- const [chromeClip, setChromeClip] = (0, import_react15.useState)(
22061
+ const router = (0, import_navigation3.useRouter)();
22062
+ const pathname = (0, import_navigation3.usePathname)();
22063
+ const [selectedId, setSelectedId] = (0, import_react17.useState)(null);
22064
+ const [hoveredId, setHoveredId] = (0, import_react17.useState)(null);
22065
+ const pointerRef = (0, import_react17.useRef)(null);
22066
+ const pointerScreenRef = (0, import_react17.useRef)(null);
22067
+ const iframeOffsetTopRef = (0, import_react17.useRef)(null);
22068
+ const sectionIdsRef = (0, import_react17.useRef)([]);
22069
+ const [chromeClip, setChromeClip] = (0, import_react17.useState)(
21854
22070
  () => ({
21855
22071
  top: 0,
21856
22072
  bottom: typeof window !== "undefined" ? window.innerHeight : 0
@@ -21858,12 +22074,12 @@ function SectionPickerOverlay({
21858
22074
  );
21859
22075
  const normalizedTarget = normalizePath(pagePath);
21860
22076
  const isOnTargetPage = normalizePath(pathname) === normalizedTarget;
21861
- (0, import_react15.useEffect)(() => {
22077
+ (0, import_react17.useEffect)(() => {
21862
22078
  if (isOnTargetPage) return;
21863
22079
  const search = readPreservedSearch();
21864
22080
  router.push(`${normalizedTarget}${search}`);
21865
22081
  }, [isOnTargetPage, normalizedTarget, router]);
21866
- (0, import_react15.useEffect)(() => {
22082
+ (0, import_react17.useEffect)(() => {
21867
22083
  document.documentElement.setAttribute("data-ohw-section-picking", "");
21868
22084
  document.querySelectorAll("[data-ohw-hovered]").forEach((el) => {
21869
22085
  el.removeAttribute("data-ohw-hovered");
@@ -21875,24 +22091,24 @@ function SectionPickerOverlay({
21875
22091
  document.documentElement.removeAttribute("data-ohw-section-picking");
21876
22092
  };
21877
22093
  }, []);
21878
- const liveSections = (0, import_react15.useMemo)(() => {
22094
+ const liveSections = (0, import_react17.useMemo)(() => {
21879
22095
  if (!isOnTargetPage) return sections;
21880
22096
  const live = collectSectionsFromDom();
21881
22097
  if (live.length === 0) return sections;
21882
22098
  const labels = new Map(sections.map((s) => [s.id, s.label]));
21883
22099
  return live.map((s) => ({ id: s.id, label: labels.get(s.id) ?? s.label }));
21884
22100
  }, [isOnTargetPage, sections, pathname]);
21885
- const sectionIdsKey = (0, import_react15.useMemo)(
22101
+ const sectionIdsKey = (0, import_react17.useMemo)(
21886
22102
  () => liveSections.map((s) => s.id).join("\0"),
21887
22103
  [liveSections]
21888
22104
  );
21889
- const sectionIds = (0, import_react15.useMemo)(
22105
+ const sectionIds = (0, import_react17.useMemo)(
21890
22106
  () => liveSections.map((s) => s.id),
21891
22107
  [liveSections]
21892
22108
  );
21893
22109
  sectionIdsRef.current = sectionIds;
21894
22110
  const rects = useSectionRects(sectionIdsKey, isOnTargetPage);
21895
- const applyHoverAt = (0, import_react15.useCallback)(
22111
+ const applyHoverAt = (0, import_react17.useCallback)(
21896
22112
  (x, y, liveRects) => {
21897
22113
  const ids = sectionIdsRef.current;
21898
22114
  const map = liveRects ?? readSectionRects(ids);
@@ -21901,7 +22117,7 @@ function SectionPickerOverlay({
21901
22117
  },
21902
22118
  []
21903
22119
  );
21904
- (0, import_react15.useEffect)(() => {
22120
+ (0, import_react17.useEffect)(() => {
21905
22121
  const applyClip = (iframeOffsetTop, visibleCanvasTop, canvasH, promptBarH = 0) => {
21906
22122
  const next = getIframeVisibleClip({
21907
22123
  iframeOffsetTop,
@@ -21945,12 +22161,12 @@ function SectionPickerOverlay({
21945
22161
  window.removeEventListener("resize", onResize);
21946
22162
  };
21947
22163
  }, [applyHoverAt]);
21948
- (0, import_react15.useEffect)(() => {
22164
+ (0, import_react17.useEffect)(() => {
21949
22165
  const ptr = pointerRef.current;
21950
22166
  if (!ptr) return;
21951
22167
  applyHoverAt(ptr.x, ptr.y, rects);
21952
22168
  }, [rects, applyHoverAt]);
21953
- (0, import_react15.useEffect)(() => {
22169
+ (0, import_react17.useEffect)(() => {
21954
22170
  const rememberPointer = (clientX, clientY) => {
21955
22171
  pointerRef.current = { x: clientX, y: clientY };
21956
22172
  const top = iframeOffsetTopRef.current;
@@ -21974,7 +22190,7 @@ function SectionPickerOverlay({
21974
22190
  window.removeEventListener("message", onPointerSync);
21975
22191
  };
21976
22192
  }, [rects, applyHoverAt]);
21977
- const handleSelect = (0, import_react15.useCallback)(
22193
+ const handleSelect = (0, import_react17.useCallback)(
21978
22194
  (section) => {
21979
22195
  if (selectedId) return;
21980
22196
  setSelectedId(section.id);
@@ -21982,7 +22198,7 @@ function SectionPickerOverlay({
21982
22198
  },
21983
22199
  [selectedId, onSelect]
21984
22200
  );
21985
- (0, import_react15.useEffect)(() => {
22201
+ (0, import_react17.useEffect)(() => {
21986
22202
  const onKeyDown = (e) => {
21987
22203
  if (e.key === "Escape") {
21988
22204
  e.preventDefault();
@@ -22105,7 +22321,7 @@ function SectionPickerOverlay({
22105
22321
  }
22106
22322
 
22107
22323
  // src/ui/link-modal/useLinkModalState.ts
22108
- var import_react16 = require("react");
22324
+ var import_react18 = require("react");
22109
22325
  function useLinkModalState({
22110
22326
  open,
22111
22327
  mode,
@@ -22117,14 +22333,14 @@ function useLinkModalState({
22117
22333
  onClose,
22118
22334
  onSubmit
22119
22335
  }) {
22120
- const availablePages = (0, import_react16.useMemo)(() => pages, [pages]);
22121
- const [searchValue, setSearchValue] = (0, import_react16.useState)("");
22122
- const [selectedPage, setSelectedPage] = (0, import_react16.useState)(null);
22123
- const [selectedSection, setSelectedSection] = (0, import_react16.useState)(null);
22124
- const [step, setStep] = (0, import_react16.useState)("input");
22125
- const [dropdownOpen, setDropdownOpen] = (0, import_react16.useState)(false);
22126
- const [urlError, setUrlError] = (0, import_react16.useState)("");
22127
- const reset = (0, import_react16.useCallback)(() => {
22336
+ const availablePages = (0, import_react18.useMemo)(() => pages, [pages]);
22337
+ const [searchValue, setSearchValue] = (0, import_react18.useState)("");
22338
+ const [selectedPage, setSelectedPage] = (0, import_react18.useState)(null);
22339
+ const [selectedSection, setSelectedSection] = (0, import_react18.useState)(null);
22340
+ const [step, setStep] = (0, import_react18.useState)("input");
22341
+ const [dropdownOpen, setDropdownOpen] = (0, import_react18.useState)(false);
22342
+ const [urlError, setUrlError] = (0, import_react18.useState)("");
22343
+ const reset = (0, import_react18.useCallback)(() => {
22128
22344
  setSearchValue("");
22129
22345
  setSelectedPage(null);
22130
22346
  setSelectedSection(null);
@@ -22132,7 +22348,7 @@ function useLinkModalState({
22132
22348
  setDropdownOpen(false);
22133
22349
  setUrlError("");
22134
22350
  }, []);
22135
- (0, import_react16.useEffect)(() => {
22351
+ (0, import_react18.useEffect)(() => {
22136
22352
  if (!open) return;
22137
22353
  if (mode === "edit" && initialTarget) {
22138
22354
  const { pageRoute } = parseTarget(initialTarget);
@@ -22148,11 +22364,11 @@ function useLinkModalState({
22148
22364
  setDropdownOpen(false);
22149
22365
  setUrlError("");
22150
22366
  }, [open, mode, initialTarget, reset]);
22151
- const filteredPages = (0, import_react16.useMemo)(() => {
22367
+ const filteredPages = (0, import_react18.useMemo)(() => {
22152
22368
  if (!searchValue.trim()) return availablePages;
22153
22369
  return availablePages.filter((p) => p.title.toLowerCase().startsWith(searchValue.toLowerCase()));
22154
22370
  }, [availablePages, searchValue]);
22155
- const activeSections = (0, import_react16.useMemo)(() => {
22371
+ const activeSections = (0, import_react18.useMemo)(() => {
22156
22372
  if (!selectedPage) return [];
22157
22373
  return getSectionsForPath(sectionsByPath, selectedPage.path);
22158
22374
  }, [selectedPage, sectionsByPath]);
@@ -22201,7 +22417,7 @@ function useLinkModalState({
22201
22417
  reset();
22202
22418
  onClose();
22203
22419
  };
22204
- const isValid = (0, import_react16.useMemo)(() => {
22420
+ const isValid = (0, import_react18.useMemo)(() => {
22205
22421
  if (urlError) return false;
22206
22422
  if (showBreadcrumb) return true;
22207
22423
  if (selectedPage) return true;
@@ -22298,7 +22514,7 @@ function LinkPopover({
22298
22514
  onSubmit
22299
22515
  });
22300
22516
  const sectionPickerActive = state.showSectionPicker && Boolean(state.selectedPage);
22301
- (0, import_react17.useEffect)(() => {
22517
+ (0, import_react19.useEffect)(() => {
22302
22518
  if (!open) return;
22303
22519
  if (sectionPickerActive) {
22304
22520
  postToParent({ type: "ui:unlock" });
@@ -22540,7 +22756,7 @@ function addFooterColumnWithPersist({
22540
22756
  }
22541
22757
 
22542
22758
  // src/ui/FloatingPanel.tsx
22543
- var import_react18 = require("react");
22759
+ var import_react20 = require("react");
22544
22760
  var import_lucide_react18 = require("lucide-react");
22545
22761
  var import_jsx_runtime33 = require("react/jsx-runtime");
22546
22762
  var PANEL_WIDTH = 256;
@@ -22602,10 +22818,10 @@ function FloatingPanel({
22602
22818
  className,
22603
22819
  bodyClassName
22604
22820
  }) {
22605
- const panelRef = (0, import_react18.useRef)(null);
22606
- const [measured, setMeasured] = (0, import_react18.useState)({ w: PANEL_WIDTH, h: 280 });
22607
- const dragRef = (0, import_react18.useRef)(null);
22608
- const homeRef = (0, import_react18.useRef)(null);
22821
+ const panelRef = (0, import_react20.useRef)(null);
22822
+ const [measured, setMeasured] = (0, import_react20.useState)({ w: PANEL_WIDTH, h: 280 });
22823
+ const dragRef = (0, import_react20.useRef)(null);
22824
+ const homeRef = (0, import_react20.useRef)(null);
22609
22825
  if (!open) {
22610
22826
  homeRef.current = null;
22611
22827
  } else if (position) {
@@ -22613,17 +22829,17 @@ function FloatingPanel({
22613
22829
  } else if (homeRef.current == null) {
22614
22830
  homeRef.current = defaultFloatingPanelPosition(parentScroll);
22615
22831
  }
22616
- const [liveScroll, setLiveScroll] = (0, import_react18.useState)(parentScroll);
22832
+ const [liveScroll, setLiveScroll] = (0, import_react20.useState)(parentScroll);
22617
22833
  const home = position ?? homeRef.current ?? defaultFloatingPanelPosition(parentScroll);
22618
22834
  const { y: fittedY, maxHeight } = fitPanelInClip(home.y, liveScroll, measured.h);
22619
22835
  const clamped = {
22620
22836
  x: clampX(home.x, measured.w),
22621
22837
  y: fittedY
22622
22838
  };
22623
- (0, import_react18.useEffect)(() => {
22839
+ (0, import_react20.useEffect)(() => {
22624
22840
  setLiveScroll(parentScroll);
22625
22841
  }, [parentScroll]);
22626
- (0, import_react18.useEffect)(() => {
22842
+ (0, import_react20.useEffect)(() => {
22627
22843
  if (!open) return;
22628
22844
  const onParentScroll = (e) => {
22629
22845
  if (e.data?.type !== "ow:parent-scroll") return;
@@ -22633,8 +22849,8 @@ function FloatingPanel({
22633
22849
  window.addEventListener("message", onParentScroll);
22634
22850
  return () => window.removeEventListener("message", onParentScroll);
22635
22851
  }, [open]);
22636
- const positionRef = (0, import_react18.useRef)(position);
22637
- (0, import_react18.useLayoutEffect)(() => {
22852
+ const positionRef = (0, import_react20.useRef)(position);
22853
+ (0, import_react20.useLayoutEffect)(() => {
22638
22854
  if (!open) {
22639
22855
  positionRef.current = position;
22640
22856
  return;
@@ -22644,7 +22860,7 @@ function FloatingPanel({
22644
22860
  }
22645
22861
  positionRef.current = position;
22646
22862
  }, [open, position, liveScroll, parentScroll]);
22647
- (0, import_react18.useLayoutEffect)(() => {
22863
+ (0, import_react20.useLayoutEffect)(() => {
22648
22864
  if (!open || !panelRef.current) return;
22649
22865
  const el = panelRef.current;
22650
22866
  const header = el.querySelector("[data-ohw-floating-panel-header]");
@@ -22653,7 +22869,7 @@ function FloatingPanel({
22653
22869
  const next = { w: el.offsetWidth || PANEL_WIDTH, h: contentH };
22654
22870
  setMeasured((prev) => prev.w === next.w && prev.h === next.h ? prev : next);
22655
22871
  }, [open, children, title, context]);
22656
- const onHeaderPointerDown = (0, import_react18.useCallback)(
22872
+ const onHeaderPointerDown = (0, import_react20.useCallback)(
22657
22873
  (e) => {
22658
22874
  if (e.button !== 0) return;
22659
22875
  if (e.target.closest("[data-ohw-floating-panel-close]")) return;
@@ -22672,7 +22888,7 @@ function FloatingPanel({
22672
22888
  },
22673
22889
  [clamped.x, clamped.y]
22674
22890
  );
22675
- const onHeaderPointerMove = (0, import_react18.useCallback)(
22891
+ const onHeaderPointerMove = (0, import_react20.useCallback)(
22676
22892
  (e) => {
22677
22893
  const drag = dragRef.current;
22678
22894
  if (!drag || drag.pointerId !== e.pointerId) return;
@@ -22698,7 +22914,7 @@ function FloatingPanel({
22698
22914
  },
22699
22915
  [measured.w, onPositionChange, liveScroll]
22700
22916
  );
22701
- const endDrag = (0, import_react18.useCallback)((e) => {
22917
+ const endDrag = (0, import_react20.useCallback)((e) => {
22702
22918
  const drag = dragRef.current;
22703
22919
  if (!drag || drag.pointerId !== e.pointerId) return;
22704
22920
  dragRef.current = null;
@@ -22708,11 +22924,11 @@ function FloatingPanel({
22708
22924
  } catch {
22709
22925
  }
22710
22926
  }, []);
22711
- (0, import_react18.useEffect)(() => {
22927
+ (0, import_react20.useEffect)(() => {
22712
22928
  if (open) return;
22713
22929
  document.documentElement.removeAttribute("data-ohw-panel-dragging");
22714
22930
  }, [open]);
22715
- (0, import_react18.useEffect)(() => () => document.documentElement.removeAttribute("data-ohw-panel-dragging"), []);
22931
+ (0, import_react20.useEffect)(() => () => document.documentElement.removeAttribute("data-ohw-panel-dragging"), []);
22716
22932
  if (!open) return null;
22717
22933
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
22718
22934
  "div",
@@ -23232,7 +23448,7 @@ function hitTestNavDropSlot(clientX, clientY, draggedHrefKey, draggedEl) {
23232
23448
  }
23233
23449
 
23234
23450
  // src/useNavItemDrag.ts
23235
- var import_react19 = require("react");
23451
+ var import_react21 = require("react");
23236
23452
  function useNavItemDrag({
23237
23453
  isEditMode,
23238
23454
  editContentRef,
@@ -23256,11 +23472,11 @@ function useNavItemDrag({
23256
23472
  getNavigationItemAnchor: getNavigationItemAnchor2,
23257
23473
  isDragHandleDisabled: isDragHandleDisabled2
23258
23474
  }) {
23259
- const navDragRef = (0, import_react19.useRef)(null);
23260
- const [navDropSlots, setNavDropSlots] = (0, import_react19.useState)([]);
23261
- const [activeNavDropIndex, setActiveNavDropIndex] = (0, import_react19.useState)(null);
23262
- const navPointerDragRef = (0, import_react19.useRef)(null);
23263
- const clearNavDragVisuals = (0, import_react19.useCallback)(() => {
23475
+ const navDragRef = (0, import_react21.useRef)(null);
23476
+ const [navDropSlots, setNavDropSlots] = (0, import_react21.useState)([]);
23477
+ const [activeNavDropIndex, setActiveNavDropIndex] = (0, import_react21.useState)(null);
23478
+ const navPointerDragRef = (0, import_react21.useRef)(null);
23479
+ const clearNavDragVisuals = (0, import_react21.useCallback)(() => {
23264
23480
  const session = navDragRef.current;
23265
23481
  const nestedHrefKey = session?.draggedEl?.closest("[data-ohw-nav-children]") != null ? session.hrefKey : null;
23266
23482
  navDragRef.current = null;
@@ -23293,7 +23509,7 @@ function useNavItemDrag({
23293
23509
  document.documentElement.removeAttribute("data-ohw-nav-dragging-root");
23294
23510
  unlockItemDragInteraction();
23295
23511
  }, [setDraggedItemRect, setIsItemDragging, setSiblingHintRects]);
23296
- const refreshNavDragVisuals = (0, import_react19.useCallback)(
23512
+ const refreshNavDragVisuals = (0, import_react21.useCallback)(
23297
23513
  (session, activeSlot, clientX, clientY) => {
23298
23514
  setDraggedItemRect(session.draggedEl.getBoundingClientRect());
23299
23515
  if (typeof clientX === "number" && typeof clientY === "number") {
@@ -23311,13 +23527,13 @@ function useNavItemDrag({
23311
23527
  },
23312
23528
  [setDraggedItemRect, setSiblingHintRects]
23313
23529
  );
23314
- const refreshNavDragVisualsRef = (0, import_react19.useRef)(refreshNavDragVisuals);
23530
+ const refreshNavDragVisualsRef = (0, import_react21.useRef)(refreshNavDragVisuals);
23315
23531
  refreshNavDragVisualsRef.current = refreshNavDragVisuals;
23316
- const commitNavDragRef = (0, import_react19.useRef)(() => {
23532
+ const commitNavDragRef = (0, import_react21.useRef)(() => {
23317
23533
  });
23318
- const beginNavDragRef = (0, import_react19.useRef)(() => {
23534
+ const beginNavDragRef = (0, import_react21.useRef)(() => {
23319
23535
  });
23320
- const beginNavDrag = (0, import_react19.useCallback)(
23536
+ const beginNavDrag = (0, import_react21.useCallback)(
23321
23537
  (session) => {
23322
23538
  const rect = session.draggedEl.getBoundingClientRect();
23323
23539
  session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
@@ -23356,7 +23572,7 @@ function useNavItemDrag({
23356
23572
  ]
23357
23573
  );
23358
23574
  beginNavDragRef.current = beginNavDrag;
23359
- const commitNavDrag = (0, import_react19.useCallback)(
23575
+ const commitNavDrag = (0, import_react21.useCallback)(
23360
23576
  (clientX, clientY) => {
23361
23577
  const session = navDragRef.current;
23362
23578
  if (!session) {
@@ -23435,7 +23651,7 @@ function useNavItemDrag({
23435
23651
  [clearNavDragVisuals, deselectRef, editContentRef, postToParentRef, selectRef]
23436
23652
  );
23437
23653
  commitNavDragRef.current = commitNavDrag;
23438
- const startNavLinkDrag = (0, import_react19.useCallback)(
23654
+ const startNavLinkDrag = (0, import_react21.useCallback)(
23439
23655
  (anchor, clientX, clientY, wasSelected) => {
23440
23656
  if (footerDragRef.current) return false;
23441
23657
  const hrefKey = anchor.getAttribute("data-ohw-href-key");
@@ -23453,7 +23669,7 @@ function useNavItemDrag({
23453
23669
  },
23454
23670
  [beginNavDrag, footerDragRef, isDragHandleDisabled2, isCtaButton]
23455
23671
  );
23456
- const onNavDragOver = (0, import_react19.useCallback)(
23672
+ const onNavDragOver = (0, import_react21.useCallback)(
23457
23673
  (e) => {
23458
23674
  const session = navDragRef.current;
23459
23675
  if (!session) return false;
@@ -23465,7 +23681,7 @@ function useNavItemDrag({
23465
23681
  },
23466
23682
  []
23467
23683
  );
23468
- (0, import_react19.useEffect)(() => {
23684
+ (0, import_react21.useEffect)(() => {
23469
23685
  if (!isEditMode) return;
23470
23686
  const THRESHOLD = 10;
23471
23687
  const resolveWasSelected = (el) => {
@@ -23592,7 +23808,7 @@ function useNavItemDrag({
23592
23808
  setLinkPopover,
23593
23809
  suppressNextClickRef
23594
23810
  ]);
23595
- const armNavPressFromChrome = (0, import_react19.useCallback)(
23811
+ const armNavPressFromChrome = (0, import_react21.useCallback)(
23596
23812
  (selected, clientX, clientY, pointerId) => {
23597
23813
  const hrefKey = selected.getAttribute("data-ohw-href-key");
23598
23814
  if (!hrefKey || !isNavbarHrefKey(hrefKey)) return false;
@@ -23624,7 +23840,7 @@ function useNavItemDrag({
23624
23840
  }
23625
23841
 
23626
23842
  // src/useSectionDrag.ts
23627
- var import_react20 = require("react");
23843
+ var import_react22 = require("react");
23628
23844
 
23629
23845
  // src/lib/section-dnd.ts
23630
23846
  function isFooterSection(el) {
@@ -23717,21 +23933,21 @@ function useSectionDrag({
23717
23933
  suppressNextClickRef,
23718
23934
  suppressClickUntilRef
23719
23935
  }) {
23720
- const sectionDragRef = (0, import_react20.useRef)(null);
23721
- const [sectionDropSlots, setSectionDropSlots] = (0, import_react20.useState)([]);
23722
- const [activeSectionDropIndex, setActiveSectionDropIndex] = (0, import_react20.useState)(null);
23723
- const [isSectionDragging, setIsSectionDragging] = (0, import_react20.useState)(false);
23724
- const sectionPointerDragRef = (0, import_react20.useRef)(null);
23725
- const autoScrollRafRef = (0, import_react20.useRef)(null);
23726
- const autoScrollDeltaRef = (0, import_react20.useRef)(0);
23727
- const stopAutoScroll = (0, import_react20.useCallback)(() => {
23936
+ const sectionDragRef = (0, import_react22.useRef)(null);
23937
+ const [sectionDropSlots, setSectionDropSlots] = (0, import_react22.useState)([]);
23938
+ const [activeSectionDropIndex, setActiveSectionDropIndex] = (0, import_react22.useState)(null);
23939
+ const [isSectionDragging, setIsSectionDragging] = (0, import_react22.useState)(false);
23940
+ const sectionPointerDragRef = (0, import_react22.useRef)(null);
23941
+ const autoScrollRafRef = (0, import_react22.useRef)(null);
23942
+ const autoScrollDeltaRef = (0, import_react22.useRef)(0);
23943
+ const stopAutoScroll = (0, import_react22.useCallback)(() => {
23728
23944
  if (autoScrollRafRef.current != null) {
23729
23945
  cancelAnimationFrame(autoScrollRafRef.current);
23730
23946
  autoScrollRafRef.current = null;
23731
23947
  }
23732
23948
  autoScrollDeltaRef.current = 0;
23733
23949
  }, []);
23734
- const tickAutoScroll = (0, import_react20.useCallback)(() => {
23950
+ const tickAutoScroll = (0, import_react22.useCallback)(() => {
23735
23951
  if (!sectionDragRef.current) {
23736
23952
  stopAutoScroll();
23737
23953
  return;
@@ -23741,7 +23957,7 @@ function useSectionDrag({
23741
23957
  }
23742
23958
  autoScrollRafRef.current = requestAnimationFrame(tickAutoScroll);
23743
23959
  }, [postToParentRef, stopAutoScroll]);
23744
- const updateAutoScroll = (0, import_react20.useCallback)(
23960
+ const updateAutoScroll = (0, import_react22.useCallback)(
23745
23961
  (clientY) => {
23746
23962
  const clip = getIframeChromeClip(parentScrollRef.current);
23747
23963
  let delta = 0;
@@ -23763,7 +23979,7 @@ function useSectionDrag({
23763
23979
  },
23764
23980
  [parentScrollRef, stopAutoScroll, tickAutoScroll]
23765
23981
  );
23766
- const clearSectionDragVisuals = (0, import_react20.useCallback)(() => {
23982
+ const clearSectionDragVisuals = (0, import_react22.useCallback)(() => {
23767
23983
  sectionDragRef.current?.draggedEl.removeAttribute("data-ohw-section-dragging");
23768
23984
  sectionDragRef.current = null;
23769
23985
  setSectionDropSlots([]);
@@ -23773,7 +23989,7 @@ function useSectionDrag({
23773
23989
  document.documentElement.removeAttribute("data-ohw-section-dragging-root");
23774
23990
  unlockItemDragInteraction();
23775
23991
  }, [stopAutoScroll]);
23776
- const refreshSectionDragVisuals = (0, import_react20.useCallback)(
23992
+ const refreshSectionDragVisuals = (0, import_react22.useCallback)(
23777
23993
  (session, clientX, clientY) => {
23778
23994
  session.lastClientX = clientX;
23779
23995
  session.lastClientY = clientY;
@@ -23787,7 +24003,7 @@ function useSectionDrag({
23787
24003
  },
23788
24004
  [updateAutoScroll]
23789
24005
  );
23790
- const beginSectionDrag = (0, import_react20.useCallback)(
24006
+ const beginSectionDrag = (0, import_react22.useCallback)(
23791
24007
  (session) => {
23792
24008
  sectionDragRef.current = session;
23793
24009
  setIsSectionDragging(true);
@@ -23798,7 +24014,7 @@ function useSectionDrag({
23798
24014
  },
23799
24015
  [refreshSectionDragVisuals]
23800
24016
  );
23801
- const commitSectionDrag = (0, import_react20.useCallback)(() => {
24017
+ const commitSectionDrag = (0, import_react22.useCallback)(() => {
23802
24018
  const session = sectionDragRef.current;
23803
24019
  if (!session) {
23804
24020
  clearSectionDragVisuals();
@@ -23827,7 +24043,7 @@ function useSectionDrag({
23827
24043
  });
23828
24044
  });
23829
24045
  }, [clearSectionDragVisuals, editContentRef, postToParentRef]);
23830
- const startSectionPressDrag = (0, import_react20.useCallback)(
24046
+ const startSectionPressDrag = (0, import_react22.useCallback)(
23831
24047
  (el, clientX, clientY, pointerId) => {
23832
24048
  if (navDragRef.current || footerDragRef.current || sectionDragRef.current) return false;
23833
24049
  const instanceId = instanceIdOf(el);
@@ -23844,7 +24060,7 @@ function useSectionDrag({
23844
24060
  },
23845
24061
  [footerDragRef, navDragRef]
23846
24062
  );
23847
- (0, import_react20.useEffect)(() => {
24063
+ (0, import_react22.useEffect)(() => {
23848
24064
  if (!isEditMode) return;
23849
24065
  const onPointerDown = (e) => {
23850
24066
  if (e.button !== 0) return;
@@ -25622,9 +25838,9 @@ function FloatingToolbar({
25622
25838
  showEditLink,
25623
25839
  onEditLink
25624
25840
  }) {
25625
- const localRef = import_react21.default.useRef(null);
25626
- const [measuredW, setMeasuredW] = import_react21.default.useState(330);
25627
- const setRefs = import_react21.default.useCallback(
25841
+ const localRef = import_react23.default.useRef(null);
25842
+ const [measuredW, setMeasuredW] = import_react23.default.useState(330);
25843
+ const setRefs = import_react23.default.useCallback(
25628
25844
  (node) => {
25629
25845
  localRef.current = node;
25630
25846
  if (typeof elRef === "function") elRef(node);
@@ -25636,7 +25852,7 @@ function FloatingToolbar({
25636
25852
  },
25637
25853
  [elRef]
25638
25854
  );
25639
- import_react21.default.useLayoutEffect(() => {
25855
+ import_react23.default.useLayoutEffect(() => {
25640
25856
  const node = localRef.current;
25641
25857
  if (!node) return;
25642
25858
  const update = () => {
@@ -25662,7 +25878,7 @@ function FloatingToolbar({
25662
25878
  pointerEvents: "auto"
25663
25879
  },
25664
25880
  children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(CustomToolbar, { children: [
25665
- TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react21.default.Fragment, { children: [
25881
+ TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react23.default.Fragment, { children: [
25666
25882
  gi > 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CustomToolbarDivider, {}),
25667
25883
  btns.map((btn) => {
25668
25884
  const isActive = activeCommands.has(btn.cmd);
@@ -25867,12 +26083,12 @@ function resolveSubdomain(subdomainFromQuery) {
25867
26083
  return "";
25868
26084
  }
25869
26085
  function OhhwellsBridge() {
25870
- const pathname = (0, import_navigation3.usePathname)();
25871
- const router = (0, import_navigation3.useRouter)();
25872
- const searchParams = (0, import_navigation3.useSearchParams)();
26086
+ const pathname = (0, import_navigation4.usePathname)();
26087
+ const router = (0, import_navigation4.useRouter)();
26088
+ const searchParams = (0, import_navigation4.useSearchParams)();
25873
26089
  const isEditMode = isEditSessionActive();
25874
- const [bridgeRoot, setBridgeRoot] = (0, import_react21.useState)(null);
25875
- (0, import_react21.useEffect)(() => {
26090
+ const [bridgeRoot, setBridgeRoot] = (0, import_react23.useState)(null);
26091
+ (0, import_react23.useEffect)(() => {
25876
26092
  const figtreeFontId = "ohw-figtree-font";
25877
26093
  if (!document.getElementById(figtreeFontId)) {
25878
26094
  const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
@@ -25898,8 +26114,8 @@ function OhhwellsBridge() {
25898
26114
  };
25899
26115
  }, []);
25900
26116
  const subdomainFromQuery = searchParams.get("subdomain");
25901
- const [subdomain, setSubdomain] = (0, import_react21.useState)(() => resolveSubdomain(subdomainFromQuery));
25902
- (0, import_react21.useLayoutEffect)(() => {
26117
+ const [subdomain, setSubdomain] = (0, import_react23.useState)(() => resolveSubdomain(subdomainFromQuery));
26118
+ (0, import_react23.useLayoutEffect)(() => {
25903
26119
  const next = resolveSubdomain(subdomainFromQuery);
25904
26120
  if (next !== subdomain) setSubdomain(next);
25905
26121
  if (next) return;
@@ -25911,7 +26127,7 @@ function OhhwellsBridge() {
25911
26127
  }, 0);
25912
26128
  return () => window.clearTimeout(t);
25913
26129
  }, [subdomainFromQuery, subdomain]);
25914
- (0, import_react21.useEffect)(() => {
26130
+ (0, import_react23.useEffect)(() => {
25915
26131
  if (!subdomainFromQuery || typeof window === "undefined") return;
25916
26132
  const url = new URL(window.location.href);
25917
26133
  if (!url.searchParams.has("subdomain")) return;
@@ -25921,22 +26137,24 @@ function OhhwellsBridge() {
25921
26137
  }, [subdomainFromQuery]);
25922
26138
  useLinkHrefGuardian(pathname, subdomain, isEditMode);
25923
26139
  useSavedLinkNavigation(isEditMode);
25924
- const postToParent2 = (0, import_react21.useCallback)((data) => {
26140
+ useNavDropdownToggle(isEditMode);
26141
+ useHashLinkScroll(isEditMode);
26142
+ const postToParent2 = (0, import_react23.useCallback)((data) => {
25925
26143
  if (typeof window !== "undefined" && window.parent !== window) {
25926
26144
  window.parent.postMessage(data, "*");
25927
26145
  }
25928
26146
  }, []);
25929
- const [fetchState, setFetchState] = (0, import_react21.useState)("idle");
25930
- const [showBranding, setShowBranding] = (0, import_react21.useState)(false);
25931
- const autoSaveTimers = (0, import_react21.useRef)(/* @__PURE__ */ new Map());
25932
- (0, import_react21.useEffect)(() => {
26147
+ const [fetchState, setFetchState] = (0, import_react23.useState)("idle");
26148
+ const [showBranding, setShowBranding] = (0, import_react23.useState)(false);
26149
+ const autoSaveTimers = (0, import_react23.useRef)(/* @__PURE__ */ new Map());
26150
+ (0, import_react23.useEffect)(() => {
25933
26151
  stampBridgeVersionOnDocument();
25934
26152
  }, []);
25935
- (0, import_react21.useEffect)(() => {
26153
+ (0, import_react23.useEffect)(() => {
25936
26154
  if (isEditMode) return;
25937
26155
  return armLoaderHangBeacon(subdomain, fetchState);
25938
26156
  }, [isEditMode, subdomain, fetchState]);
25939
- (0, import_react21.useEffect)(() => {
26157
+ (0, import_react23.useEffect)(() => {
25940
26158
  if (isEditMode || !subdomain) return;
25941
26159
  const onError = (event) => {
25942
26160
  reportOutageBeacon({
@@ -25957,40 +26175,40 @@ function OhhwellsBridge() {
25957
26175
  window.removeEventListener("unhandledrejection", onRejection);
25958
26176
  };
25959
26177
  }, [isEditMode, subdomain]);
25960
- const activeElRef = (0, import_react21.useRef)(null);
25961
- const pointerHeldRef = (0, import_react21.useRef)(false);
25962
- const selectedElRef = (0, import_react21.useRef)(null);
25963
- const selectedHrefKeyRef = (0, import_react21.useRef)(null);
25964
- const selectedFooterColAttrRef = (0, import_react21.useRef)(null);
25965
- const footerHeadingTitleCacheRef = (0, import_react21.useRef)(/* @__PURE__ */ new Map());
25966
- const originalContentRef = (0, import_react21.useRef)(null);
25967
- const activeStateElRef = (0, import_react21.useRef)(null);
25968
- const parentScrollRef = (0, import_react21.useRef)(null);
25969
- const visibleViewportRef = (0, import_react21.useRef)(null);
25970
- const [dialogPortalContainer, setDialogPortalContainer] = (0, import_react21.useState)(null);
25971
- const attachVisibleViewport = (0, import_react21.useCallback)((node) => {
26178
+ const activeElRef = (0, import_react23.useRef)(null);
26179
+ const pointerHeldRef = (0, import_react23.useRef)(false);
26180
+ const selectedElRef = (0, import_react23.useRef)(null);
26181
+ const selectedHrefKeyRef = (0, import_react23.useRef)(null);
26182
+ const selectedFooterColAttrRef = (0, import_react23.useRef)(null);
26183
+ const footerHeadingTitleCacheRef = (0, import_react23.useRef)(/* @__PURE__ */ new Map());
26184
+ const originalContentRef = (0, import_react23.useRef)(null);
26185
+ const activeStateElRef = (0, import_react23.useRef)(null);
26186
+ const parentScrollRef = (0, import_react23.useRef)(null);
26187
+ const visibleViewportRef = (0, import_react23.useRef)(null);
26188
+ const [dialogPortalContainer, setDialogPortalContainer] = (0, import_react23.useState)(null);
26189
+ const attachVisibleViewport = (0, import_react23.useCallback)((node) => {
25972
26190
  visibleViewportRef.current = node;
25973
26191
  setDialogPortalContainer(node);
25974
26192
  if (node) applyVisibleViewport(node, parentScrollRef.current);
25975
26193
  }, []);
25976
- const toolbarElRef = (0, import_react21.useRef)(null);
25977
- const glowElRef = (0, import_react21.useRef)(null);
25978
- const hoveredImageRef = (0, import_react21.useRef)(null);
25979
- const hoveredImageHasTextOverlapRef = (0, import_react21.useRef)(false);
25980
- const dragOverElRef = (0, import_react21.useRef)(null);
25981
- const [mediaHover, setMediaHover] = (0, import_react21.useState)(null);
25982
- const [selectedAiSectionId, setSelectedAiSectionId] = (0, import_react21.useState)(null);
25983
- const selectedAiSectionIdRef = (0, import_react21.useRef)(null);
25984
- const handleAiSectionSelectionChange = (0, import_react21.useCallback)((id) => {
26194
+ const toolbarElRef = (0, import_react23.useRef)(null);
26195
+ const glowElRef = (0, import_react23.useRef)(null);
26196
+ const hoveredImageRef = (0, import_react23.useRef)(null);
26197
+ const hoveredImageHasTextOverlapRef = (0, import_react23.useRef)(false);
26198
+ const dragOverElRef = (0, import_react23.useRef)(null);
26199
+ const [mediaHover, setMediaHover] = (0, import_react23.useState)(null);
26200
+ const [selectedAiSectionId, setSelectedAiSectionId] = (0, import_react23.useState)(null);
26201
+ const selectedAiSectionIdRef = (0, import_react23.useRef)(null);
26202
+ const handleAiSectionSelectionChange = (0, import_react23.useCallback)((id) => {
25985
26203
  selectedAiSectionIdRef.current = id;
25986
26204
  setSelectedAiSectionId(id);
25987
26205
  }, []);
25988
- const [selectedMedia, setSelectedMedia] = (0, import_react21.useState)(null);
25989
- const selectedMediaElRef = (0, import_react21.useRef)(null);
25990
- const mediaKeyDropTokenRef = (0, import_react21.useRef)(0);
25991
- const selectedIconElRef = (0, import_react21.useRef)(null);
25992
- const selectedSocialElRef = (0, import_react21.useRef)(null);
25993
- const queueSectionKeyDrop = (0, import_react21.useCallback)((prev) => {
26206
+ const [selectedMedia, setSelectedMedia] = (0, import_react23.useState)(null);
26207
+ const selectedMediaElRef = (0, import_react23.useRef)(null);
26208
+ const mediaKeyDropTokenRef = (0, import_react23.useRef)(0);
26209
+ const selectedIconElRef = (0, import_react23.useRef)(null);
26210
+ const selectedSocialElRef = (0, import_react23.useRef)(null);
26211
+ const queueSectionKeyDrop = (0, import_react23.useCallback)((prev) => {
25994
26212
  const sectionEl = prev?.closest("[data-ohw-section]") ?? null;
25995
26213
  if (!sectionEl) return;
25996
26214
  const sectionInstanceId = instanceIdOf(movableUnit(sectionEl)) || null;
@@ -26011,31 +26229,31 @@ function OhhwellsBridge() {
26011
26229
  window.addEventListener("message", onQueueDrained);
26012
26230
  window.postMessage({ type: "ow:media-key-drop", token }, "*");
26013
26231
  }, []);
26014
- const clearMediaSelection = (0, import_react21.useCallback)(() => {
26232
+ const clearMediaSelection = (0, import_react23.useCallback)(() => {
26015
26233
  const prev = selectedMediaElRef.current;
26016
26234
  selectedMediaElRef.current = null;
26017
26235
  setSelectedMedia(null);
26018
26236
  queueSectionKeyDrop(prev);
26019
26237
  }, [queueSectionKeyDrop]);
26020
- const clearMediaSelectionRef = (0, import_react21.useRef)(clearMediaSelection);
26238
+ const clearMediaSelectionRef = (0, import_react23.useRef)(clearMediaSelection);
26021
26239
  clearMediaSelectionRef.current = clearMediaSelection;
26022
- const clearIconSelection = (0, import_react21.useCallback)(() => {
26240
+ const clearIconSelection = (0, import_react23.useCallback)(() => {
26023
26241
  const prev = selectedIconElRef.current;
26024
26242
  if (!prev) return;
26025
26243
  selectedIconElRef.current = null;
26026
26244
  queueSectionKeyDrop(prev);
26027
26245
  }, [queueSectionKeyDrop]);
26028
- const clearIconSelectionRef = (0, import_react21.useRef)(clearIconSelection);
26246
+ const clearIconSelectionRef = (0, import_react23.useRef)(clearIconSelection);
26029
26247
  clearIconSelectionRef.current = clearIconSelection;
26030
- const clearSocialSelection = (0, import_react21.useCallback)(() => {
26248
+ const clearSocialSelection = (0, import_react23.useCallback)(() => {
26031
26249
  const prev = selectedSocialElRef.current;
26032
26250
  if (!prev) return;
26033
26251
  selectedSocialElRef.current = null;
26034
26252
  queueSectionKeyDrop(prev);
26035
26253
  }, [queueSectionKeyDrop]);
26036
- const clearSocialSelectionRef = (0, import_react21.useRef)(clearSocialSelection);
26254
+ const clearSocialSelectionRef = (0, import_react23.useRef)(clearSocialSelection);
26037
26255
  clearSocialSelectionRef.current = clearSocialSelection;
26038
- const selectIconElement = (0, import_react21.useCallback)((el) => {
26256
+ const selectIconElement = (0, import_react23.useCallback)((el) => {
26039
26257
  if (selectedMediaElRef.current) clearMediaSelectionRef.current();
26040
26258
  selectedIconElRef.current = el;
26041
26259
  const sectionEl = el.closest("[data-ohw-section]");
@@ -26048,9 +26266,9 @@ function OhhwellsBridge() {
26048
26266
  keyLabel: "Icon"
26049
26267
  });
26050
26268
  }, []);
26051
- const selectIconElementRef = (0, import_react21.useRef)(selectIconElement);
26269
+ const selectIconElementRef = (0, import_react23.useRef)(selectIconElement);
26052
26270
  selectIconElementRef.current = selectIconElement;
26053
- const selectMediaElement = (0, import_react21.useCallback)((el) => {
26271
+ const selectMediaElement = (0, import_react23.useCallback)((el) => {
26054
26272
  const r2 = el.getBoundingClientRect();
26055
26273
  const video = el.dataset.ohwEditable === "video" ? el.querySelector("video") : null;
26056
26274
  selectedIconElRef.current = null;
@@ -26075,9 +26293,9 @@ function OhhwellsBridge() {
26075
26293
  keyLabel: el.dataset.ohwEditable === "video" ? "Video" : el.dataset.ohwEditable === "bg-image" ? "Background" : "Image"
26076
26294
  });
26077
26295
  }, []);
26078
- const selectMediaElementRef = (0, import_react21.useRef)(selectMediaElement);
26296
+ const selectMediaElementRef = (0, import_react23.useRef)(selectMediaElement);
26079
26297
  selectMediaElementRef.current = selectMediaElement;
26080
- (0, import_react21.useEffect)(() => {
26298
+ (0, import_react23.useEffect)(() => {
26081
26299
  if (!selectedMedia) return;
26082
26300
  const update = () => {
26083
26301
  const el = selectedMediaElRef.current;
@@ -26097,54 +26315,54 @@ function OhhwellsBridge() {
26097
26315
  window.removeEventListener("resize", update);
26098
26316
  };
26099
26317
  }, [selectedMedia !== null]);
26100
- const [carouselHover, setCarouselHover] = (0, import_react21.useState)(null);
26101
- const [uploadingRects, setUploadingRects] = (0, import_react21.useState)({});
26102
- const hoveredGapRef = (0, import_react21.useRef)(null);
26103
- const imageUnhoverTimerRef = (0, import_react21.useRef)(null);
26104
- const imageShowTimerRef = (0, import_react21.useRef)(null);
26105
- const editStylesRef = (0, import_react21.useRef)(null);
26106
- const activateRef = (0, import_react21.useRef)(() => {
26318
+ const [carouselHover, setCarouselHover] = (0, import_react23.useState)(null);
26319
+ const [uploadingRects, setUploadingRects] = (0, import_react23.useState)({});
26320
+ const hoveredGapRef = (0, import_react23.useRef)(null);
26321
+ const imageUnhoverTimerRef = (0, import_react23.useRef)(null);
26322
+ const imageShowTimerRef = (0, import_react23.useRef)(null);
26323
+ const editStylesRef = (0, import_react23.useRef)(null);
26324
+ const activateRef = (0, import_react23.useRef)(() => {
26107
26325
  });
26108
- const deactivateRef = (0, import_react21.useRef)(() => {
26326
+ const deactivateRef = (0, import_react23.useRef)(() => {
26109
26327
  });
26110
- const selectRef = (0, import_react21.useRef)(() => {
26328
+ const selectRef = (0, import_react23.useRef)(() => {
26111
26329
  });
26112
- const selectFrameRef = (0, import_react21.useRef)(() => {
26330
+ const selectFrameRef = (0, import_react23.useRef)(() => {
26113
26331
  });
26114
- const selectLogoRef = (0, import_react21.useRef)(() => {
26332
+ const selectLogoRef = (0, import_react23.useRef)(() => {
26115
26333
  });
26116
- const openLogoSizePanelRef = (0, import_react21.useRef)(() => {
26334
+ const openLogoSizePanelRef = (0, import_react23.useRef)(() => {
26117
26335
  });
26118
- const deselectRef = (0, import_react21.useRef)(() => {
26336
+ const deselectRef = (0, import_react23.useRef)(() => {
26119
26337
  });
26120
- const closeFloatingPanelOnlyRef = (0, import_react21.useRef)(() => {
26338
+ const closeFloatingPanelOnlyRef = (0, import_react23.useRef)(() => {
26121
26339
  });
26122
- const reselectNavigationItemRef = (0, import_react21.useRef)(() => {
26340
+ const reselectNavigationItemRef = (0, import_react23.useRef)(() => {
26123
26341
  });
26124
- const commitNavigationTextEditRef = (0, import_react21.useRef)(() => {
26342
+ const commitNavigationTextEditRef = (0, import_react23.useRef)(() => {
26125
26343
  });
26126
- const handleDeleteSelectedRef = (0, import_react21.useRef)(() => false);
26127
- const runPendingDeleteUndoRef = (0, import_react21.useRef)(() => false);
26128
- const isFooterFrameSelectionRef = (0, import_react21.useRef)(false);
26129
- const refreshActiveCommandsRef = (0, import_react21.useRef)(() => {
26344
+ const handleDeleteSelectedRef = (0, import_react23.useRef)(() => false);
26345
+ const runPendingDeleteUndoRef = (0, import_react23.useRef)(() => false);
26346
+ const isFooterFrameSelectionRef = (0, import_react23.useRef)(false);
26347
+ const refreshActiveCommandsRef = (0, import_react23.useRef)(() => {
26130
26348
  });
26131
- const postToParentRef = (0, import_react21.useRef)(postToParent2);
26349
+ const postToParentRef = (0, import_react23.useRef)(postToParent2);
26132
26350
  postToParentRef.current = postToParent2;
26133
- const aiSectionApiRef = (0, import_react21.useRef)(null);
26134
- const sectionsLoadedRef = (0, import_react21.useRef)(false);
26135
- const pendingScheduleConfigRequests = (0, import_react21.useRef)([]);
26136
- const [toolbarRect, setToolbarRect] = (0, import_react21.useState)(null);
26137
- const [formPickRect, setFormPickRect] = (0, import_react21.useState)(null);
26138
- const formPickElRef = (0, import_react21.useRef)(null);
26139
- const [formViewState, setFormViewStateUi] = (0, import_react21.useState)("default");
26140
- const [formPickCount, setFormPickCount] = (0, import_react21.useState)(null);
26141
- const [formHoverRect, setFormHoverRect] = (0, import_react21.useState)(null);
26142
- const formHoverElRef = (0, import_react21.useRef)(null);
26143
- const [fieldPickRect, setFieldPickRect] = (0, import_react21.useState)(null);
26144
- const fieldPickElRef = (0, import_react21.useRef)(null);
26145
- const [fieldPickState, setFieldPickState] = (0, import_react21.useState)(null);
26146
- const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0, import_react21.useState)(false);
26147
- const clearFormPick = (0, import_react21.useCallback)(() => {
26351
+ const aiSectionApiRef = (0, import_react23.useRef)(null);
26352
+ const sectionsLoadedRef = (0, import_react23.useRef)(false);
26353
+ const pendingScheduleConfigRequests = (0, import_react23.useRef)([]);
26354
+ const [toolbarRect, setToolbarRect] = (0, import_react23.useState)(null);
26355
+ const [formPickRect, setFormPickRect] = (0, import_react23.useState)(null);
26356
+ const formPickElRef = (0, import_react23.useRef)(null);
26357
+ const [formViewState, setFormViewStateUi] = (0, import_react23.useState)("default");
26358
+ const [formPickCount, setFormPickCount] = (0, import_react23.useState)(null);
26359
+ const [formHoverRect, setFormHoverRect] = (0, import_react23.useState)(null);
26360
+ const formHoverElRef = (0, import_react23.useRef)(null);
26361
+ const [fieldPickRect, setFieldPickRect] = (0, import_react23.useState)(null);
26362
+ const fieldPickElRef = (0, import_react23.useRef)(null);
26363
+ const [fieldPickState, setFieldPickState] = (0, import_react23.useState)(null);
26364
+ const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0, import_react23.useState)(false);
26365
+ const clearFormPick = (0, import_react23.useCallback)(() => {
26148
26366
  const form = formPickElRef.current;
26149
26367
  const editing = fieldPickElRef.current;
26150
26368
  if (commitPlaceholderEdit(editing) && editing) {
@@ -26164,7 +26382,7 @@ function OhhwellsBridge() {
26164
26382
  formPickElRef.current = null;
26165
26383
  setFormPickRect(null);
26166
26384
  }, []);
26167
- const clearFieldPick = (0, import_react21.useCallback)(() => {
26385
+ const clearFieldPick = (0, import_react23.useCallback)(() => {
26168
26386
  const wrapper = fieldPickElRef.current;
26169
26387
  if (commitPlaceholderEdit(wrapper) && wrapper) {
26170
26388
  const form = wrapper.closest('[data-ohw-editable="form"]');
@@ -26174,9 +26392,9 @@ function OhhwellsBridge() {
26174
26392
  setFieldPickRect(null);
26175
26393
  setFieldPickState(null);
26176
26394
  }, []);
26177
- const persistFieldsRef = (0, import_react21.useRef)(() => {
26395
+ const persistFieldsRef = (0, import_react23.useRef)(() => {
26178
26396
  });
26179
- const persistFields = (0, import_react21.useCallback)(
26397
+ const persistFields = (0, import_react23.useCallback)(
26180
26398
  (form) => {
26181
26399
  const key = formKeyOf(form);
26182
26400
  if (!key) return;
@@ -26187,7 +26405,7 @@ function OhhwellsBridge() {
26187
26405
  []
26188
26406
  );
26189
26407
  persistFieldsRef.current = persistFields;
26190
- const selectField = (0, import_react21.useCallback)((wrapper) => {
26408
+ const selectField = (0, import_react23.useCallback)((wrapper) => {
26191
26409
  if (fieldPickElRef.current && fieldPickElRef.current !== wrapper) {
26192
26410
  commitPlaceholderEdit(fieldPickElRef.current);
26193
26411
  }
@@ -26200,7 +26418,7 @@ function OhhwellsBridge() {
26200
26418
  setFieldPickState({ type: fieldTypeOf(wrapper), required: isFieldRequired(wrapper) });
26201
26419
  setFieldTypePickerOpen(false);
26202
26420
  }, []);
26203
- const withSelectedField = (0, import_react21.useCallback)(
26421
+ const withSelectedField = (0, import_react23.useCallback)(
26204
26422
  (run) => {
26205
26423
  const wrapper = fieldPickElRef.current;
26206
26424
  const form = formPickElRef.current;
@@ -26213,28 +26431,28 @@ function OhhwellsBridge() {
26213
26431
  },
26214
26432
  [persistFields]
26215
26433
  );
26216
- const handleFieldTypeChange = (0, import_react21.useCallback)(
26434
+ const handleFieldTypeChange = (0, import_react23.useCallback)(
26217
26435
  (type) => withSelectedField((_form, wrapper) => {
26218
26436
  applyFieldType(wrapper, type);
26219
26437
  selectField(wrapper);
26220
26438
  }),
26221
26439
  [selectField, withSelectedField]
26222
26440
  );
26223
- const handleFieldRequiredToggle = (0, import_react21.useCallback)(
26441
+ const handleFieldRequiredToggle = (0, import_react23.useCallback)(
26224
26442
  () => withSelectedField((_form, wrapper) => {
26225
26443
  setFieldRequired(wrapper, !isFieldRequired(wrapper));
26226
26444
  selectField(wrapper);
26227
26445
  }),
26228
26446
  [selectField, withSelectedField]
26229
26447
  );
26230
- const handleFieldDuplicate = (0, import_react21.useCallback)(
26448
+ const handleFieldDuplicate = (0, import_react23.useCallback)(
26231
26449
  () => withSelectedField((form, wrapper) => {
26232
26450
  const copy = duplicateField(form, wrapper);
26233
26451
  selectField(copy);
26234
26452
  }),
26235
26453
  [selectField, withSelectedField]
26236
26454
  );
26237
- const handleFieldDelete = (0, import_react21.useCallback)(
26455
+ const handleFieldDelete = (0, import_react23.useCallback)(
26238
26456
  () => withSelectedField((_form, wrapper) => {
26239
26457
  removeField(wrapper);
26240
26458
  clearFieldPick();
@@ -26242,7 +26460,7 @@ function OhhwellsBridge() {
26242
26460
  }),
26243
26461
  [clearFieldPick, withSelectedField]
26244
26462
  );
26245
- const handleAddField = (0, import_react21.useCallback)(
26463
+ const handleAddField = (0, import_react23.useCallback)(
26246
26464
  (type) => {
26247
26465
  const form = formPickElRef.current;
26248
26466
  if (!form) return;
@@ -26258,8 +26476,8 @@ function OhhwellsBridge() {
26258
26476
  },
26259
26477
  [persistFields, selectField]
26260
26478
  );
26261
- const fieldDragRef = (0, import_react21.useRef)(null);
26262
- const buildFieldDropSlots = (0, import_react21.useCallback)((form, draggedKey) => {
26479
+ const fieldDragRef = (0, import_react23.useRef)(null);
26480
+ const buildFieldDropSlots = (0, import_react23.useCallback)((form, draggedKey) => {
26263
26481
  const others = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== draggedKey);
26264
26482
  const slots = others.map((el) => {
26265
26483
  const rect = el.getBoundingClientRect();
@@ -26272,7 +26490,7 @@ function OhhwellsBridge() {
26272
26490
  }
26273
26491
  return slots;
26274
26492
  }, []);
26275
- const handleFieldDragStart = (0, import_react21.useCallback)(() => {
26493
+ const handleFieldDragStart = (0, import_react23.useCallback)(() => {
26276
26494
  const wrapper = fieldPickElRef.current;
26277
26495
  const form = formPickElRef.current;
26278
26496
  if (!wrapper || !form) return;
@@ -26281,18 +26499,18 @@ function OhhwellsBridge() {
26281
26499
  setFieldDragging(true);
26282
26500
  setFieldDropSlots(buildFieldDropSlots(form, key));
26283
26501
  }, [buildFieldDropSlots]);
26284
- const handleFieldDragEnd = (0, import_react21.useCallback)(() => {
26502
+ const handleFieldDragEnd = (0, import_react23.useCallback)(() => {
26285
26503
  fieldDragRef.current = null;
26286
26504
  setFieldDropIndex(null);
26287
26505
  setFieldDropSlots([]);
26288
26506
  setFieldDragging(false);
26289
26507
  }, []);
26290
- const [fieldDropIndex, setFieldDropIndex] = (0, import_react21.useState)(null);
26291
- const [fieldDropSlots, setFieldDropSlots] = (0, import_react21.useState)([]);
26292
- const [fieldDragging, setFieldDragging] = (0, import_react21.useState)(false);
26293
- const clearFormPickRef = (0, import_react21.useRef)(clearFormPick);
26508
+ const [fieldDropIndex, setFieldDropIndex] = (0, import_react23.useState)(null);
26509
+ const [fieldDropSlots, setFieldDropSlots] = (0, import_react23.useState)([]);
26510
+ const [fieldDragging, setFieldDragging] = (0, import_react23.useState)(false);
26511
+ const clearFormPickRef = (0, import_react23.useRef)(clearFormPick);
26294
26512
  clearFormPickRef.current = clearFormPick;
26295
- (0, import_react21.useEffect)(() => {
26513
+ (0, import_react23.useEffect)(() => {
26296
26514
  const el = fieldPickElRef.current;
26297
26515
  if (!el || fieldPickRect === null) return;
26298
26516
  const observer = new ResizeObserver(() => {
@@ -26301,7 +26519,7 @@ function OhhwellsBridge() {
26301
26519
  observer.observe(el);
26302
26520
  return () => observer.disconnect();
26303
26521
  }, [fieldPickRect !== null, fieldPickState]);
26304
- (0, import_react21.useEffect)(() => {
26522
+ (0, import_react23.useEffect)(() => {
26305
26523
  const el = formPickElRef.current;
26306
26524
  if (!el || formPickRect === null) return;
26307
26525
  const observer = new ResizeObserver(() => {
@@ -26310,25 +26528,25 @@ function OhhwellsBridge() {
26310
26528
  observer.observe(el);
26311
26529
  return () => observer.disconnect();
26312
26530
  }, [formPickRect !== null, formViewState]);
26313
- const [toolbarVariant, setToolbarVariant] = (0, import_react21.useState)("none");
26314
- const toolbarVariantRef = (0, import_react21.useRef)("none");
26531
+ const [toolbarVariant, setToolbarVariant] = (0, import_react23.useState)("none");
26532
+ const toolbarVariantRef = (0, import_react23.useRef)("none");
26315
26533
  toolbarVariantRef.current = toolbarVariant;
26316
- const [selectedIsCta, setSelectedIsCta] = (0, import_react21.useState)(false);
26317
- const [selectedIsSocial, setSelectedIsSocial] = (0, import_react21.useState)(false);
26318
- const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0, import_react21.useState)(false);
26319
- const [reorderHrefKey, setReorderHrefKey] = (0, import_react21.useState)(null);
26320
- const [reorderDragDisabled, setReorderDragDisabled] = (0, import_react21.useState)(false);
26321
- const [toggleState, setToggleState] = (0, import_react21.useState)(null);
26322
- const [maxBadge, setMaxBadge] = (0, import_react21.useState)(null);
26323
- const [activeCommands, setActiveCommands] = (0, import_react21.useState)(/* @__PURE__ */ new Set());
26324
- const [sectionGap, setSectionGap] = (0, import_react21.useState)(null);
26325
- const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react21.useState)(false);
26326
- const hoveredNavContainerRef = (0, import_react21.useRef)(null);
26327
- const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react21.useState)(null);
26328
- const hoveredItemElRef = (0, import_react21.useRef)(null);
26329
- const [hoveredItemRect, setHoveredItemRect] = (0, import_react21.useState)(null);
26330
- const [hoveredTextRect, setHoveredTextRect] = (0, import_react21.useState)(null);
26331
- (0, import_react21.useEffect)(() => {
26534
+ const [selectedIsCta, setSelectedIsCta] = (0, import_react23.useState)(false);
26535
+ const [selectedIsSocial, setSelectedIsSocial] = (0, import_react23.useState)(false);
26536
+ const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0, import_react23.useState)(false);
26537
+ const [reorderHrefKey, setReorderHrefKey] = (0, import_react23.useState)(null);
26538
+ const [reorderDragDisabled, setReorderDragDisabled] = (0, import_react23.useState)(false);
26539
+ const [toggleState, setToggleState] = (0, import_react23.useState)(null);
26540
+ const [maxBadge, setMaxBadge] = (0, import_react23.useState)(null);
26541
+ const [activeCommands, setActiveCommands] = (0, import_react23.useState)(/* @__PURE__ */ new Set());
26542
+ const [sectionGap, setSectionGap] = (0, import_react23.useState)(null);
26543
+ const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react23.useState)(false);
26544
+ const hoveredNavContainerRef = (0, import_react23.useRef)(null);
26545
+ const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react23.useState)(null);
26546
+ const hoveredItemElRef = (0, import_react23.useRef)(null);
26547
+ const [hoveredItemRect, setHoveredItemRect] = (0, import_react23.useState)(null);
26548
+ const [hoveredTextRect, setHoveredTextRect] = (0, import_react23.useState)(null);
26549
+ (0, import_react23.useEffect)(() => {
26332
26550
  const sync = () => {
26333
26551
  const el = document.querySelector(
26334
26552
  '[data-ohw-hovered]:not([contenteditable]):not([data-ohw-href-key]):not([data-ohw-editable="form"] *)'
@@ -26372,65 +26590,65 @@ function OhhwellsBridge() {
26372
26590
  });
26373
26591
  return () => observer.disconnect();
26374
26592
  }, []);
26375
- const siblingHintElRef = (0, import_react21.useRef)(null);
26376
- const [siblingHintRect, setSiblingHintRect] = (0, import_react21.useState)(null);
26377
- const [siblingHintRects, setSiblingHintRects] = (0, import_react21.useState)([]);
26378
- const [isItemDragging, setIsItemDragging] = (0, import_react21.useState)(false);
26379
- const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react21.useState)(false);
26593
+ const siblingHintElRef = (0, import_react23.useRef)(null);
26594
+ const [siblingHintRect, setSiblingHintRect] = (0, import_react23.useState)(null);
26595
+ const [siblingHintRects, setSiblingHintRects] = (0, import_react23.useState)([]);
26596
+ const [isItemDragging, setIsItemDragging] = (0, import_react23.useState)(false);
26597
+ const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react23.useState)(false);
26380
26598
  isFooterFrameSelectionRef.current = isFooterFrameSelection;
26381
- const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react21.useState)(null);
26382
- const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react21.useState)(null);
26383
- const footerDragRef = (0, import_react21.useRef)(null);
26384
- const [footerDropSlots, setFooterDropSlots] = (0, import_react21.useState)([]);
26385
- const [activeFooterDropIndex, setActiveFooterDropIndex] = (0, import_react21.useState)(null);
26386
- const [draggedItemRect, setDraggedItemRect] = (0, import_react21.useState)(null);
26387
- const footerPointerDragRef = (0, import_react21.useRef)(null);
26388
- const suppressNextClickRef = (0, import_react21.useRef)(false);
26389
- const suppressClickUntilRef = (0, import_react21.useRef)(0);
26390
- const [linkPopover, setLinkPopover] = (0, import_react21.useState)(null);
26391
- const linkPopoverSessionRef = (0, import_react21.useRef)(null);
26392
- const addNavAfterAnchorRef = (0, import_react21.useRef)(null);
26393
- const editContentRef = (0, import_react21.useRef)({});
26394
- const aiSectionsRef = (0, import_react21.useRef)("");
26395
- const aiFooterRef = (0, import_react21.useRef)("");
26396
- const applyTreeLocalRef = (0, import_react21.useRef)(
26599
+ const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react23.useState)(null);
26600
+ const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react23.useState)(null);
26601
+ const footerDragRef = (0, import_react23.useRef)(null);
26602
+ const [footerDropSlots, setFooterDropSlots] = (0, import_react23.useState)([]);
26603
+ const [activeFooterDropIndex, setActiveFooterDropIndex] = (0, import_react23.useState)(null);
26604
+ const [draggedItemRect, setDraggedItemRect] = (0, import_react23.useState)(null);
26605
+ const footerPointerDragRef = (0, import_react23.useRef)(null);
26606
+ const suppressNextClickRef = (0, import_react23.useRef)(false);
26607
+ const suppressClickUntilRef = (0, import_react23.useRef)(0);
26608
+ const [linkPopover, setLinkPopover] = (0, import_react23.useState)(null);
26609
+ const linkPopoverSessionRef = (0, import_react23.useRef)(null);
26610
+ const addNavAfterAnchorRef = (0, import_react23.useRef)(null);
26611
+ const editContentRef = (0, import_react23.useRef)({});
26612
+ const aiSectionsRef = (0, import_react23.useRef)("");
26613
+ const aiFooterRef = (0, import_react23.useRef)("");
26614
+ const applyTreeLocalRef = (0, import_react23.useRef)(
26397
26615
  null
26398
26616
  );
26399
- const applyFooterTreeLocalRef = (0, import_react21.useRef)(null);
26400
- const clearInteractionChromeRef = (0, import_react21.useRef)(() => {
26617
+ const applyFooterTreeLocalRef = (0, import_react23.useRef)(null);
26618
+ const clearInteractionChromeRef = (0, import_react23.useRef)(() => {
26401
26619
  });
26402
- const brandKitRef = (0, import_react21.useRef)("");
26403
- const stylesRef = (0, import_react21.useRef)("");
26404
- const appliedDrawerRef = (0, import_react21.useRef)(null);
26405
- const pendingDeleteUndoRef = (0, import_react21.useRef)(null);
26406
- const [floatingPanel, setFloatingPanel] = (0, import_react21.useState)(null);
26407
- const floatingPanelOpenRef = (0, import_react21.useRef)(false);
26408
- const floatingPanelRef = (0, import_react21.useRef)(null);
26620
+ const brandKitRef = (0, import_react23.useRef)("");
26621
+ const stylesRef = (0, import_react23.useRef)("");
26622
+ const appliedDrawerRef = (0, import_react23.useRef)(null);
26623
+ const pendingDeleteUndoRef = (0, import_react23.useRef)(null);
26624
+ const [floatingPanel, setFloatingPanel] = (0, import_react23.useState)(null);
26625
+ const floatingPanelOpenRef = (0, import_react23.useRef)(false);
26626
+ const floatingPanelRef = (0, import_react23.useRef)(null);
26409
26627
  floatingPanelRef.current = floatingPanel;
26410
- const setFloatingPanelRef = (0, import_react21.useRef)(setFloatingPanel);
26411
- const [floatingPanelPos, setFloatingPanelPos] = (0, import_react21.useState)(null);
26412
- const buttonCollectionDragRef = (0, import_react21.useRef)(null);
26413
- const buttonDropInsertIndexRef = (0, import_react21.useRef)(null);
26414
- const [buttonDropSlots, setButtonDropSlots] = (0, import_react21.useState)([]);
26415
- const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react21.useState)(null);
26416
- const buttonPointerDragRef = (0, import_react21.useRef)(null);
26417
- const [buttonStyleTick, setButtonStyleTick] = (0, import_react21.useState)(0);
26418
- const [logoSizeDraft, setLogoSizeDraft] = (0, import_react21.useState)(null);
26419
- const [editorViewport, setEditorViewport] = (0, import_react21.useState)("desktop");
26420
- const [parentScrollSnap, setParentScrollSnap] = (0, import_react21.useState)(null);
26421
- const [sitePages, setSitePages] = (0, import_react21.useState)([]);
26422
- const collectionItemsRef = (0, import_react21.useRef)(/* @__PURE__ */ new Map());
26423
- const [sectionsByPath, setSectionsByPath] = (0, import_react21.useState)({});
26424
- const sectionsPrefetchGenRef = (0, import_react21.useRef)(0);
26425
- const setLinkPopoverRef = (0, import_react21.useRef)(setLinkPopover);
26426
- const linkPopoverPanelRef = (0, import_react21.useRef)(null);
26427
- const linkPopoverOpenRef = (0, import_react21.useRef)(false);
26428
- const linkPopoverGraceUntilRef = (0, import_react21.useRef)(0);
26628
+ const setFloatingPanelRef = (0, import_react23.useRef)(setFloatingPanel);
26629
+ const [floatingPanelPos, setFloatingPanelPos] = (0, import_react23.useState)(null);
26630
+ const buttonCollectionDragRef = (0, import_react23.useRef)(null);
26631
+ const buttonDropInsertIndexRef = (0, import_react23.useRef)(null);
26632
+ const [buttonDropSlots, setButtonDropSlots] = (0, import_react23.useState)([]);
26633
+ const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react23.useState)(null);
26634
+ const buttonPointerDragRef = (0, import_react23.useRef)(null);
26635
+ const [buttonStyleTick, setButtonStyleTick] = (0, import_react23.useState)(0);
26636
+ const [logoSizeDraft, setLogoSizeDraft] = (0, import_react23.useState)(null);
26637
+ const [editorViewport, setEditorViewport] = (0, import_react23.useState)("desktop");
26638
+ const [parentScrollSnap, setParentScrollSnap] = (0, import_react23.useState)(null);
26639
+ const [sitePages, setSitePages] = (0, import_react23.useState)([]);
26640
+ const collectionItemsRef = (0, import_react23.useRef)(/* @__PURE__ */ new Map());
26641
+ const [sectionsByPath, setSectionsByPath] = (0, import_react23.useState)({});
26642
+ const sectionsPrefetchGenRef = (0, import_react23.useRef)(0);
26643
+ const setLinkPopoverRef = (0, import_react23.useRef)(setLinkPopover);
26644
+ const linkPopoverPanelRef = (0, import_react23.useRef)(null);
26645
+ const linkPopoverOpenRef = (0, import_react23.useRef)(false);
26646
+ const linkPopoverGraceUntilRef = (0, import_react23.useRef)(0);
26429
26647
  setLinkPopoverRef.current = setLinkPopover;
26430
26648
  setFloatingPanelRef.current = setFloatingPanel;
26431
26649
  linkPopoverSessionRef.current = linkPopover;
26432
26650
  floatingPanelOpenRef.current = Boolean(floatingPanel);
26433
- (0, import_react21.useEffect)(() => {
26651
+ (0, import_react23.useEffect)(() => {
26434
26652
  const syncViewport = () => {
26435
26653
  const next = window.innerWidth <= 480 ? "mobile" : "desktop";
26436
26654
  setEditorViewport((prev) => prev === next ? prev : next);
@@ -26439,7 +26657,7 @@ function OhhwellsBridge() {
26439
26657
  window.addEventListener("resize", syncViewport);
26440
26658
  return () => window.removeEventListener("resize", syncViewport);
26441
26659
  }, []);
26442
- (0, import_react21.useEffect)(() => {
26660
+ (0, import_react23.useEffect)(() => {
26443
26661
  setSectionOrderPersistHandler((entries) => {
26444
26662
  const currentPath = window.location.pathname;
26445
26663
  const merged = mergePageSectionOrder(editContentRef.current[SECTION_ORDER_KEY], currentPath, entries);
@@ -26449,7 +26667,7 @@ function OhhwellsBridge() {
26449
26667
  });
26450
26668
  return () => setSectionOrderPersistHandler(null);
26451
26669
  }, []);
26452
- (0, import_react21.useEffect)(() => {
26670
+ (0, import_react23.useEffect)(() => {
26453
26671
  setAiFooterMountOptions({
26454
26672
  resolvePageHref: (pageOrAnchorId) => {
26455
26673
  const [pageId, anchor] = pageOrAnchorId.split("#");
@@ -26512,7 +26730,7 @@ function OhhwellsBridge() {
26512
26730
  const bumpLinkPopoverGrace = () => {
26513
26731
  linkPopoverGraceUntilRef.current = Date.now() + 350;
26514
26732
  };
26515
- const runSectionsPrefetch = (0, import_react21.useCallback)((pages) => {
26733
+ const runSectionsPrefetch = (0, import_react23.useCallback)((pages) => {
26516
26734
  if (!isEditMode || shouldUseDevFixtures() || pages.length === 0) return;
26517
26735
  const gen = ++sectionsPrefetchGenRef.current;
26518
26736
  const paths = pages.map((p) => p.path);
@@ -26531,9 +26749,9 @@ function OhhwellsBridge() {
26531
26749
  );
26532
26750
  });
26533
26751
  }, [isEditMode, pathname]);
26534
- const runSectionsPrefetchRef = (0, import_react21.useRef)(runSectionsPrefetch);
26752
+ const runSectionsPrefetchRef = (0, import_react23.useRef)(runSectionsPrefetch);
26535
26753
  runSectionsPrefetchRef.current = runSectionsPrefetch;
26536
- (0, import_react21.useEffect)(() => {
26754
+ (0, import_react23.useEffect)(() => {
26537
26755
  if (!linkPopover) {
26538
26756
  document.documentElement.removeAttribute("data-ohw-link-popover-open");
26539
26757
  return;
@@ -26561,7 +26779,7 @@ function OhhwellsBridge() {
26561
26779
  document.documentElement.removeAttribute("data-ohw-link-popover-open");
26562
26780
  };
26563
26781
  }, [linkPopover, postToParent2]);
26564
- (0, import_react21.useEffect)(() => {
26782
+ (0, import_react23.useEffect)(() => {
26565
26783
  if (!isEditMode) return;
26566
26784
  const useFixtures = shouldUseDevFixtures();
26567
26785
  if (useFixtures) {
@@ -26587,7 +26805,7 @@ function OhhwellsBridge() {
26587
26805
  if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
26588
26806
  return () => window.removeEventListener("message", onSitePages);
26589
26807
  }, [isEditMode, postToParent2]);
26590
- (0, import_react21.useEffect)(() => {
26808
+ (0, import_react23.useEffect)(() => {
26591
26809
  if (!isEditMode) return;
26592
26810
  const deps = {
26593
26811
  getEditContent: () => editContentRef.current,
@@ -26624,14 +26842,14 @@ function OhhwellsBridge() {
26624
26842
  window.addEventListener("message", onPageMessage);
26625
26843
  return () => window.removeEventListener("message", onPageMessage);
26626
26844
  }, [isEditMode, postToParent2]);
26627
- (0, import_react21.useEffect)(() => {
26845
+ (0, import_react23.useEffect)(() => {
26628
26846
  if (!isEditMode || shouldUseDevFixtures()) return;
26629
26847
  void loadAllSectionsManifest().then((manifest) => {
26630
26848
  if (Object.keys(manifest).length === 0) return;
26631
26849
  setSectionsByPath((prev) => ({ ...manifest, ...prev }));
26632
26850
  });
26633
26851
  }, [isEditMode]);
26634
- (0, import_react21.useEffect)(() => {
26852
+ (0, import_react23.useEffect)(() => {
26635
26853
  const update = () => {
26636
26854
  const el = activeElRef.current ?? selectedElRef.current;
26637
26855
  if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
@@ -26655,10 +26873,10 @@ function OhhwellsBridge() {
26655
26873
  vvp.removeEventListener("resize", update);
26656
26874
  };
26657
26875
  }, []);
26658
- const refreshStateRules = (0, import_react21.useCallback)(() => {
26876
+ const refreshStateRules = (0, import_react23.useCallback)(() => {
26659
26877
  editStylesRef.current?.forceHover && (editStylesRef.current.forceHover.textContent = collectStateRules());
26660
26878
  }, []);
26661
- const processConfigRequest = (0, import_react21.useCallback)((insertAfterVal) => {
26879
+ const processConfigRequest = (0, import_react23.useCallback)((insertAfterVal) => {
26662
26880
  const tracker = getSectionsTracker();
26663
26881
  let entries = [];
26664
26882
  try {
@@ -26681,7 +26899,7 @@ function OhhwellsBridge() {
26681
26899
  }
26682
26900
  window.postMessage({ type: "ow:schedule-config", insertAfter: insertAfterVal, scheduleId: null }, "*");
26683
26901
  }, [isEditMode]);
26684
- const deactivate = (0, import_react21.useCallback)(() => {
26902
+ const deactivate = (0, import_react23.useCallback)(() => {
26685
26903
  const el = activeElRef.current;
26686
26904
  if (!el) return;
26687
26905
  const isFormBlock = el.dataset.ohwEditable === "form";
@@ -26747,12 +26965,12 @@ function OhhwellsBridge() {
26747
26965
  setToolbarShowEditLink(false);
26748
26966
  postToParent2({ type: "ow:exit-edit" });
26749
26967
  }, [postToParent2]);
26750
- const clearSelectedAttr = (0, import_react21.useCallback)(() => {
26968
+ const clearSelectedAttr = (0, import_react23.useCallback)(() => {
26751
26969
  document.querySelectorAll("[data-ohw-selected]").forEach((el) => {
26752
26970
  el.removeAttribute("data-ohw-selected");
26753
26971
  });
26754
26972
  }, []);
26755
- const deselect = (0, import_react21.useCallback)(() => {
26973
+ const deselect = (0, import_react23.useCallback)(() => {
26756
26974
  const nestedGroup = selectedElRef.current?.closest("[data-ohw-nav-children]") != null ? selectedElRef.current.closest("[data-ohw-nav-group]") : null;
26757
26975
  clearSelectedAttr();
26758
26976
  selectedElRef.current = null;
@@ -26788,20 +27006,20 @@ function OhhwellsBridge() {
26788
27006
  setToolbarVariant("none");
26789
27007
  }
26790
27008
  }, [clearSelectedAttr]);
26791
- const markSelected = (0, import_react21.useCallback)((el) => {
27009
+ const markSelected = (0, import_react23.useCallback)((el) => {
26792
27010
  clearSelectedAttr();
26793
27011
  el.removeAttribute("data-ohw-hovered");
26794
27012
  el.setAttribute("data-ohw-selected", "");
26795
27013
  }, [clearSelectedAttr]);
26796
- const isSelectedForHover = (0, import_react21.useCallback)((el) => {
27014
+ const isSelectedForHover = (0, import_react23.useCallback)((el) => {
26797
27015
  if (!el) return false;
26798
27016
  return [selectedElRef.current, activeElRef.current].some(
26799
27017
  (busy) => busy && (el === busy || busy.contains(el) || el.contains(busy))
26800
27018
  );
26801
27019
  }, []);
26802
- const isSelectedForHoverRef = (0, import_react21.useRef)(isSelectedForHover);
27020
+ const isSelectedForHoverRef = (0, import_react23.useRef)(isSelectedForHover);
26803
27021
  isSelectedForHoverRef.current = isSelectedForHover;
26804
- const resolveHrefKeyElement = (0, import_react21.useCallback)((hrefKey) => {
27022
+ const resolveHrefKeyElement = (0, import_react23.useCallback)((hrefKey) => {
26805
27023
  if (isFooterHrefKey(hrefKey)) {
26806
27024
  return document.querySelector(
26807
27025
  `footer [data-ohw-href-key="${CSS.escape(hrefKey)}"]`
@@ -26816,7 +27034,7 @@ function OhhwellsBridge() {
26816
27034
  `[data-ohw-href-key="${CSS.escape(hrefKey)}"]`
26817
27035
  );
26818
27036
  }, []);
26819
- const resyncSelectedNavigationItem = (0, import_react21.useCallback)(() => {
27037
+ const resyncSelectedNavigationItem = (0, import_react23.useCallback)(() => {
26820
27038
  const hrefKey = selectedHrefKeyRef.current;
26821
27039
  if (hrefKey) {
26822
27040
  const link = resolveHrefKeyElement(hrefKey);
@@ -26854,7 +27072,7 @@ function OhhwellsBridge() {
26854
27072
  );
26855
27073
  }
26856
27074
  }, [resolveHrefKeyElement]);
26857
- const reselectNavigationItem = (0, import_react21.useCallback)((navAnchor) => {
27075
+ const reselectNavigationItem = (0, import_react23.useCallback)((navAnchor) => {
26858
27076
  selectedElRef.current = navAnchor;
26859
27077
  selectedHrefKeyRef.current = navAnchor.getAttribute("data-ohw-href-key");
26860
27078
  selectedFooterColAttrRef.current = null;
@@ -26885,7 +27103,7 @@ function OhhwellsBridge() {
26885
27103
  setToolbarShowEditLink(false);
26886
27104
  setActiveCommands(/* @__PURE__ */ new Set());
26887
27105
  }, [markSelected]);
26888
- const commitNavigationTextEdit = (0, import_react21.useCallback)((navAnchor) => {
27106
+ const commitNavigationTextEdit = (0, import_react23.useCallback)((navAnchor) => {
26889
27107
  const el = activeElRef.current;
26890
27108
  if (!el) return;
26891
27109
  const key = el.dataset.ohwKey;
@@ -26918,7 +27136,7 @@ function OhhwellsBridge() {
26918
27136
  postToParent2({ type: "ow:exit-edit" });
26919
27137
  reselectNavigationItem(navAnchor);
26920
27138
  }, [postToParent2, reselectNavigationItem]);
26921
- const handleAddTopLevelNavItem = (0, import_react21.useCallback)(() => {
27139
+ const handleAddTopLevelNavItem = (0, import_react23.useCallback)(() => {
26922
27140
  const items = listNavbarRootItems();
26923
27141
  addNavAfterAnchorRef.current = items[items.length - 1] ?? null;
26924
27142
  deselectRef.current();
@@ -26930,7 +27148,7 @@ function OhhwellsBridge() {
26930
27148
  intent: "add-nav"
26931
27149
  });
26932
27150
  }, []);
26933
- const maybeWarnNavLinkDropdownConflict = (0, import_react21.useCallback)(
27151
+ const maybeWarnNavLinkDropdownConflict = (0, import_react23.useCallback)(
26934
27152
  (anchor) => {
26935
27153
  if (!isNavbarHrefKey(anchor.getAttribute("data-ohw-href-key"))) return;
26936
27154
  if (!navDropdownsOpenOnClick()) return;
@@ -26943,7 +27161,7 @@ function OhhwellsBridge() {
26943
27161
  },
26944
27162
  [postToParent2]
26945
27163
  );
26946
- const handleNavDropdownOpenChange = (0, import_react21.useCallback)((open) => {
27164
+ const handleNavDropdownOpenChange = (0, import_react23.useCallback)((open) => {
26947
27165
  const selected = selectedElRef.current;
26948
27166
  if (!selected || !isNavigationItem2(selected)) return;
26949
27167
  if (isNestedNavChild(selected)) return;
@@ -26959,7 +27177,7 @@ function OhhwellsBridge() {
26959
27177
  }
26960
27178
  });
26961
27179
  }, []);
26962
- const handleFooterHeadingVisibleChange = (0, import_react21.useCallback)(
27180
+ const handleFooterHeadingVisibleChange = (0, import_react23.useCallback)(
26963
27181
  (visible) => {
26964
27182
  const selected = selectedElRef.current;
26965
27183
  if (!selected || !isFooterFrameSelectionRef.current) return;
@@ -27012,7 +27230,7 @@ function OhhwellsBridge() {
27012
27230
  },
27013
27231
  [postToParent2]
27014
27232
  );
27015
- const enterEditOnNewItem = (0, import_react21.useCallback)((anchor) => {
27233
+ const enterEditOnNewItem = (0, import_react23.useCallback)((anchor) => {
27016
27234
  const label = anchor.querySelector('[data-ohw-editable="text"]');
27017
27235
  if (!label) {
27018
27236
  selectRef.current(anchor);
@@ -27021,8 +27239,8 @@ function OhhwellsBridge() {
27021
27239
  setNavGroupForceOpen(anchor, true);
27022
27240
  activateRef.current(label);
27023
27241
  }, []);
27024
- const pendingSocialAddRef = (0, import_react21.useRef)(null);
27025
- const handleAddChildItem = (0, import_react21.useCallback)(() => {
27242
+ const pendingSocialAddRef = (0, import_react23.useRef)(null);
27243
+ const handleAddChildItem = (0, import_react23.useCallback)(() => {
27026
27244
  const selected = selectedElRef.current;
27027
27245
  if (!selected) return;
27028
27246
  const socialsRow = isSocialsRow(selected) ? selected : findSocialsRow(selected);
@@ -27149,7 +27367,7 @@ function OhhwellsBridge() {
27149
27367
  });
27150
27368
  });
27151
27369
  }, [enterEditOnNewItem, isFooterFrameSelection, maybeWarnNavLinkDropdownConflict, postToParent2]);
27152
- const handleAddFooterColumn = (0, import_react21.useCallback)(() => {
27370
+ const handleAddFooterColumn = (0, import_react23.useCallback)(() => {
27153
27371
  if (document.querySelector("[data-ai-footer]")) {
27154
27372
  const state = parseAiFooterState(aiFooterRef.current);
27155
27373
  if (!state?.tree) return;
@@ -27205,7 +27423,7 @@ function OhhwellsBridge() {
27205
27423
  selectRef.current(result.firstLink);
27206
27424
  });
27207
27425
  }, [postToParent2]);
27208
- const clearFooterDragVisuals = (0, import_react21.useCallback)(() => {
27426
+ const clearFooterDragVisuals = (0, import_react23.useCallback)(() => {
27209
27427
  footerDragRef.current = null;
27210
27428
  setSiblingHintRects([]);
27211
27429
  setFooterDropSlots([]);
@@ -27214,7 +27432,7 @@ function OhhwellsBridge() {
27214
27432
  setIsItemDragging(false);
27215
27433
  unlockFooterDragInteraction();
27216
27434
  }, []);
27217
- const refreshFooterDragVisuals = (0, import_react21.useCallback)((session, activeSlot, clientX, clientY) => {
27435
+ const refreshFooterDragVisuals = (0, import_react23.useCallback)((session, activeSlot, clientX, clientY) => {
27218
27436
  const dragged = session.draggedEl;
27219
27437
  setDraggedItemRect(dragged.getBoundingClientRect());
27220
27438
  if (typeof clientX === "number" && typeof clientY === "number") {
@@ -27246,13 +27464,13 @@ function OhhwellsBridge() {
27246
27464
  const activeIdx = activeSlot ? slots.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
27247
27465
  setActiveFooterDropIndex(activeIdx >= 0 ? activeIdx : null);
27248
27466
  }, []);
27249
- const refreshFooterDragVisualsRef = (0, import_react21.useRef)(refreshFooterDragVisuals);
27467
+ const refreshFooterDragVisualsRef = (0, import_react23.useRef)(refreshFooterDragVisuals);
27250
27468
  refreshFooterDragVisualsRef.current = refreshFooterDragVisuals;
27251
- const commitFooterDragRef = (0, import_react21.useRef)(() => {
27469
+ const commitFooterDragRef = (0, import_react23.useRef)(() => {
27252
27470
  });
27253
- const beginFooterDragRef = (0, import_react21.useRef)(() => {
27471
+ const beginFooterDragRef = (0, import_react23.useRef)(() => {
27254
27472
  });
27255
- const beginFooterDrag = (0, import_react21.useCallback)(
27473
+ const beginFooterDrag = (0, import_react23.useCallback)(
27256
27474
  (session) => {
27257
27475
  const rect = session.draggedEl.getBoundingClientRect();
27258
27476
  session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
@@ -27272,7 +27490,7 @@ function OhhwellsBridge() {
27272
27490
  [refreshFooterDragVisuals]
27273
27491
  );
27274
27492
  beginFooterDragRef.current = beginFooterDrag;
27275
- const commitFooterDrag = (0, import_react21.useCallback)(
27493
+ const commitFooterDrag = (0, import_react23.useCallback)(
27276
27494
  (clientX, clientY) => {
27277
27495
  const session = footerDragRef.current;
27278
27496
  if (!session) {
@@ -27444,7 +27662,7 @@ function OhhwellsBridge() {
27444
27662
  [clearFooterDragVisuals, resolveHrefKeyElement, resyncSelectedNavigationItem]
27445
27663
  );
27446
27664
  commitFooterDragRef.current = commitFooterDrag;
27447
- const startFooterLinkDrag = (0, import_react21.useCallback)(
27665
+ const startFooterLinkDrag = (0, import_react23.useCallback)(
27448
27666
  (anchor, clientX, clientY, wasSelected) => {
27449
27667
  const hrefKey = anchor.getAttribute("data-ohw-href-key");
27450
27668
  if (!hrefKey) return false;
@@ -27480,7 +27698,7 @@ function OhhwellsBridge() {
27480
27698
  },
27481
27699
  [beginFooterDrag]
27482
27700
  );
27483
- const startFooterColumnDrag = (0, import_react21.useCallback)(
27701
+ const startFooterColumnDrag = (0, import_react23.useCallback)(
27484
27702
  (columnEl, clientX, clientY, wasSelected) => {
27485
27703
  const columns = listFooterColumns(columnEl);
27486
27704
  const idx = columns.indexOf(columnEl);
@@ -27500,7 +27718,7 @@ function OhhwellsBridge() {
27500
27718
  },
27501
27719
  [beginFooterDrag]
27502
27720
  );
27503
- const persistButtonCollectionDrag = (0, import_react21.useCallback)(
27721
+ const persistButtonCollectionDrag = (0, import_react23.useCallback)(
27504
27722
  (button, clientX) => {
27505
27723
  const insertIndex = buttonDropInsertIndexRef.current;
27506
27724
  if (insertIndex != null) insertButtonAtCollectionIndex(button, insertIndex);
@@ -27524,7 +27742,7 @@ function OhhwellsBridge() {
27524
27742
  },
27525
27743
  [postToParent2]
27526
27744
  );
27527
- const refreshButtonDragVisuals = (0, import_react21.useCallback)((button, clientX, clientY) => {
27745
+ const refreshButtonDragVisuals = (0, import_react23.useCallback)((button, clientX, clientY) => {
27528
27746
  const collection = buttonCollectionOf(button);
27529
27747
  if (!collection) {
27530
27748
  setButtonDropSlots([]);
@@ -27541,7 +27759,7 @@ function OhhwellsBridge() {
27541
27759
  setDraggedItemRect(button.getBoundingClientRect());
27542
27760
  if (selectedElRef.current === button) setToolbarRect(button.getBoundingClientRect());
27543
27761
  }, []);
27544
- const handleItemDragStart = (0, import_react21.useCallback)(
27762
+ const handleItemDragStart = (0, import_react23.useCallback)(
27545
27763
  (e) => {
27546
27764
  const selected = selectedElRef.current;
27547
27765
  if (!selected) {
@@ -27572,7 +27790,7 @@ function OhhwellsBridge() {
27572
27790
  },
27573
27791
  [startFooterColumnDrag, startFooterLinkDrag, startNavLinkDrag, refreshButtonDragVisuals]
27574
27792
  );
27575
- const handleItemDragEnd = (0, import_react21.useCallback)(
27793
+ const handleItemDragEnd = (0, import_react23.useCallback)(
27576
27794
  (e) => {
27577
27795
  const collectionButton = buttonCollectionDragRef.current;
27578
27796
  if (collectionButton) {
@@ -27603,7 +27821,7 @@ function OhhwellsBridge() {
27603
27821
  },
27604
27822
  [commitFooterDrag, commitNavDrag, navDragRef, persistButtonCollectionDrag]
27605
27823
  );
27606
- const handleItemChromePointerDown = (0, import_react21.useCallback)((e) => {
27824
+ const handleItemChromePointerDown = (0, import_react23.useCallback)((e) => {
27607
27825
  if (e.button !== 0) return;
27608
27826
  const selected = selectedElRef.current;
27609
27827
  if (!selected) return;
@@ -27644,7 +27862,7 @@ function OhhwellsBridge() {
27644
27862
  }
27645
27863
  if (armNavPressFromChrome(selected, e.clientX, e.clientY, e.pointerId)) return;
27646
27864
  }, [armNavPressFromChrome]);
27647
- const handleItemChromeClick = (0, import_react21.useCallback)((clientX, clientY) => {
27865
+ const handleItemChromeClick = (0, import_react23.useCallback)((clientX, clientY) => {
27648
27866
  if (suppressNextClickRef.current || Date.now() < suppressClickUntilRef.current) {
27649
27867
  suppressNextClickRef.current = false;
27650
27868
  return;
@@ -27657,7 +27875,7 @@ function OhhwellsBridge() {
27657
27875
  }, []);
27658
27876
  reselectNavigationItemRef.current = reselectNavigationItem;
27659
27877
  commitNavigationTextEditRef.current = commitNavigationTextEdit;
27660
- const select = (0, import_react21.useCallback)((anchor) => {
27878
+ const select = (0, import_react23.useCallback)((anchor) => {
27661
27879
  if (!isNavigationItem2(anchor)) return;
27662
27880
  if (activeElRef.current) deactivate();
27663
27881
  clearSocialSelectionRef.current();
@@ -27734,7 +27952,7 @@ function OhhwellsBridge() {
27734
27952
  setLogoSizeDraft(null);
27735
27953
  }
27736
27954
  }, [deactivate, markSelected]);
27737
- const selectFrame = (0, import_react21.useCallback)((el) => {
27955
+ const selectFrame = (0, import_react23.useCallback)((el) => {
27738
27956
  if (!isNavigationContainer(el)) return;
27739
27957
  if (activeElRef.current) deactivate();
27740
27958
  aiSectionApiRef.current?.selectFromElement(el);
@@ -27775,7 +27993,7 @@ function OhhwellsBridge() {
27775
27993
  setFloatingPanelPos(null);
27776
27994
  setLogoSizeDraft(null);
27777
27995
  }, [deactivate, markSelected, postToParent2]);
27778
- const selectLogo = (0, import_react21.useCallback)(
27996
+ const selectLogo = (0, import_react23.useCallback)(
27779
27997
  (logoEl) => {
27780
27998
  if (activeElRef.current) deactivate();
27781
27999
  selectedElRef.current = logoEl;
@@ -27804,7 +28022,7 @@ function OhhwellsBridge() {
27804
28022
  },
27805
28023
  [deactivate, markSelected]
27806
28024
  );
27807
- const openLogoSizePanel = (0, import_react21.useCallback)((logoEl) => {
28025
+ const openLogoSizePanel = (0, import_react23.useCallback)((logoEl) => {
27808
28026
  const placement = getLogoPlacement(logoEl);
27809
28027
  const draft = readLogoSizeState(editContentRef.current, placement);
27810
28028
  setLogoSizeDraft(draft);
@@ -27817,7 +28035,7 @@ function OhhwellsBridge() {
27817
28035
  placement
27818
28036
  });
27819
28037
  }, []);
27820
- const openSocialsDisplayPanel = (0, import_react21.useCallback)((row) => {
28038
+ const openSocialsDisplayPanel = (0, import_react23.useCallback)((row) => {
27821
28039
  setFloatingPanelPos(null);
27822
28040
  setParentScrollSnap(parentScrollRef.current);
27823
28041
  setFloatingPanel({
@@ -27828,7 +28046,7 @@ function OhhwellsBridge() {
27828
28046
  row
27829
28047
  });
27830
28048
  }, []);
27831
- const rememberButtonTokens = (0, import_react21.useCallback)(
28049
+ const rememberButtonTokens = (0, import_react23.useCallback)(
27832
28050
  (content, tokens, nodes) => {
27833
28051
  if (nodes.length === 0) return content;
27834
28052
  const next = { ...content };
@@ -27839,7 +28057,7 @@ function OhhwellsBridge() {
27839
28057
  },
27840
28058
  [postToParent2]
27841
28059
  );
27842
- const tokensForButton = (0, import_react21.useCallback)(
28060
+ const tokensForButton = (0, import_react23.useCallback)(
27843
28061
  (el, persistFallback = false) => {
27844
28062
  const stored = readStoredStyleTokens(editContentRef.current);
27845
28063
  if (stored) return stored;
@@ -27854,7 +28072,7 @@ function OhhwellsBridge() {
27854
28072
  },
27855
28073
  [rememberButtonTokens]
27856
28074
  );
27857
- const openButtonStylePanel = (0, import_react21.useCallback)(
28075
+ const openButtonStylePanel = (0, import_react23.useCallback)(
27858
28076
  (anchor) => {
27859
28077
  const id = buttonId(anchor);
27860
28078
  if (!id) return;
@@ -27872,7 +28090,7 @@ function OhhwellsBridge() {
27872
28090
  },
27873
28091
  [tokensForButton]
27874
28092
  );
27875
- const applySelectedButtonStyle = (0, import_react21.useCallback)(
28093
+ const applySelectedButtonStyle = (0, import_react23.useCallback)(
27876
28094
  (patch) => {
27877
28095
  const panel = floatingPanelRef.current;
27878
28096
  const id = panel?.kind === "button-style" ? panel.buttonId : null;
@@ -27890,7 +28108,7 @@ function OhhwellsBridge() {
27890
28108
  },
27891
28109
  [postToParent2]
27892
28110
  );
27893
- (0, import_react21.useEffect)(() => {
28111
+ (0, import_react23.useEffect)(() => {
27894
28112
  const onDragOver = (e) => {
27895
28113
  const dragged = buttonCollectionDragRef.current;
27896
28114
  if (!dragged) return;
@@ -27909,11 +28127,11 @@ function OhhwellsBridge() {
27909
28127
  document.removeEventListener("drop", onDrop);
27910
28128
  };
27911
28129
  }, [refreshButtonDragVisuals]);
27912
- const isEditModeRef = (0, import_react21.useRef)(false);
27913
- const requestMissingSocialIconsRef = (0, import_react21.useRef)(() => {
28130
+ const isEditModeRef = (0, import_react23.useRef)(false);
28131
+ const requestMissingSocialIconsRef = (0, import_react23.useRef)(() => {
27914
28132
  });
27915
- const askedSocialIconsRef = (0, import_react21.useRef)(/* @__PURE__ */ new Set());
27916
- const requestMissingSocialIcons = (0, import_react21.useCallback)(() => {
28133
+ const askedSocialIconsRef = (0, import_react23.useRef)(/* @__PURE__ */ new Set());
28134
+ const requestMissingSocialIcons = (0, import_react23.useCallback)(() => {
27917
28135
  const items = Array.from(document.querySelectorAll(`[${SOCIALS_ROW_ATTR}]`)).filter((row) => socialsDisplayFor(row, editContentRef.current).icon).flatMap((row) => {
27918
28136
  const missing = socialsMissingIcons(row);
27919
28137
  listSocialItems(row).forEach((item) => ensureIconSlot(item));
@@ -27925,7 +28143,7 @@ function OhhwellsBridge() {
27925
28143
  }, []);
27926
28144
  requestMissingSocialIconsRef.current = requestMissingSocialIcons;
27927
28145
  isEditModeRef.current = isEditMode;
27928
- const changeSocialsDisplay = (0, import_react21.useCallback)(
28146
+ const changeSocialsDisplay = (0, import_react23.useCallback)(
27929
28147
  (row, next) => {
27930
28148
  if (next.icon) {
27931
28149
  const missing = socialsMissingIcons(row);
@@ -27949,19 +28167,19 @@ function OhhwellsBridge() {
27949
28167
  },
27950
28168
  []
27951
28169
  );
27952
- const closeFloatingPanelOnly = (0, import_react21.useCallback)(() => {
28170
+ const closeFloatingPanelOnly = (0, import_react23.useCallback)(() => {
27953
28171
  setFloatingPanel(null);
27954
28172
  setFloatingPanelPos(null);
27955
28173
  setLogoSizeDraft(null);
27956
28174
  }, []);
27957
28175
  closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
27958
- const closeFloatingPanelAndDeselect = (0, import_react21.useCallback)(() => {
28176
+ const closeFloatingPanelAndDeselect = (0, import_react23.useCallback)(() => {
27959
28177
  setFloatingPanel(null);
27960
28178
  setFloatingPanelPos(null);
27961
28179
  setLogoSizeDraft(null);
27962
28180
  deselectRef.current();
27963
28181
  }, []);
27964
- (0, import_react21.useEffect)(() => {
28182
+ (0, import_react23.useEffect)(() => {
27965
28183
  const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
27966
28184
  if (!session || !logoSizeDraft) {
27967
28185
  postToParentRef.current({ type: "ow:logo-size-panel", open: false });
@@ -27980,7 +28198,7 @@ function OhhwellsBridge() {
27980
28198
  max: LOGO_SIZE_MAX
27981
28199
  });
27982
28200
  }, [floatingPanel, logoSizeDraft, editorViewport]);
27983
- const persistLogoSizeDraft = (0, import_react21.useCallback)(
28201
+ const persistLogoSizeDraft = (0, import_react23.useCallback)(
27984
28202
  (placement, draft) => {
27985
28203
  const desktopKey = LOGO_SIZE_DESKTOP_KEYS[placement];
27986
28204
  const mobileKey = LOGO_SIZE_MOBILE_KEYS[placement];
@@ -28020,7 +28238,7 @@ function OhhwellsBridge() {
28020
28238
  },
28021
28239
  [postToParent2]
28022
28240
  );
28023
- const activate = (0, import_react21.useCallback)((el, options) => {
28241
+ const activate = (0, import_react23.useCallback)((el, options) => {
28024
28242
  if (activeElRef.current === el) return;
28025
28243
  document.querySelectorAll("[data-ohw-hovered]").forEach((hovered) => {
28026
28244
  hovered.removeAttribute("data-ohw-hovered");
@@ -28118,8 +28336,8 @@ function OhhwellsBridge() {
28118
28336
  openLogoSizePanelRef.current = openLogoSizePanel;
28119
28337
  deselectRef.current = deselect;
28120
28338
  closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
28121
- const lastSiteWideScopeRef = (0, import_react21.useRef)(null);
28122
- (0, import_react21.useEffect)(() => {
28339
+ const lastSiteWideScopeRef = (0, import_react23.useRef)(null);
28340
+ (0, import_react23.useEffect)(() => {
28123
28341
  if (!isEditMode) {
28124
28342
  if (lastSiteWideScopeRef.current !== false) {
28125
28343
  lastSiteWideScopeRef.current = false;
@@ -28145,7 +28363,7 @@ function OhhwellsBridge() {
28145
28363
  isFooterFrameSelection,
28146
28364
  postToParent2
28147
28365
  ]);
28148
- (0, import_react21.useLayoutEffect)(() => {
28366
+ (0, import_react23.useLayoutEffect)(() => {
28149
28367
  if (!subdomain || isEditMode) {
28150
28368
  setFetchState("done");
28151
28369
  return;
@@ -28192,6 +28410,7 @@ function OhhwellsBridge() {
28192
28410
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28193
28411
  continue;
28194
28412
  }
28413
+ if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28195
28414
  if (applyVideoSettingNode(key, val)) continue;
28196
28415
  if (applyCarouselNode(key, val)) continue;
28197
28416
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28231,6 +28450,7 @@ function OhhwellsBridge() {
28231
28450
  });
28232
28451
  applyLinkByKey(key, val);
28233
28452
  }
28453
+ applySectionEmbeds(content);
28234
28454
  applyLogoFromContent(content);
28235
28455
  applyLogoSizes(content);
28236
28456
  reconcileNavbarItemsFromContent(content);
@@ -28297,7 +28517,7 @@ function OhhwellsBridge() {
28297
28517
  cancelled = true;
28298
28518
  };
28299
28519
  }, [subdomain, isEditMode]);
28300
- (0, import_react21.useEffect)(() => {
28520
+ (0, import_react23.useEffect)(() => {
28301
28521
  if (!isEditMode) return;
28302
28522
  const resolveIndex = (form, clientY) => {
28303
28523
  const wrappers = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== fieldDragRef.current?.key);
@@ -28338,7 +28558,7 @@ function OhhwellsBridge() {
28338
28558
  window.removeEventListener("drop", onDrop, true);
28339
28559
  };
28340
28560
  }, [buildFieldDropSlots, isEditMode, persistFields, selectField]);
28341
- (0, import_react21.useEffect)(() => {
28561
+ (0, import_react23.useEffect)(() => {
28342
28562
  if (!isEditMode) return;
28343
28563
  const mark = () => document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
28344
28564
  markFormFields(form);
@@ -28350,7 +28570,7 @@ function OhhwellsBridge() {
28350
28570
  });
28351
28571
  return () => observer.disconnect();
28352
28572
  }, [isEditMode, fetchState, pathname]);
28353
- (0, import_react21.useEffect)(() => {
28573
+ (0, import_react23.useEffect)(() => {
28354
28574
  if (!isEditMode) return;
28355
28575
  let saveTimer = null;
28356
28576
  const onInput = (e) => {
@@ -28372,14 +28592,14 @@ function OhhwellsBridge() {
28372
28592
  document.addEventListener("input", onInput, true);
28373
28593
  return () => document.removeEventListener("input", onInput, true);
28374
28594
  }, [isEditMode, persistFields]);
28375
- (0, import_react21.useEffect)(() => {
28595
+ (0, import_react23.useEffect)(() => {
28376
28596
  if (isEditMode || fetchState !== "done") return;
28377
28597
  const content = contentCache.get(subdomain) ?? {};
28378
28598
  document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
28379
28599
  reconcileFieldsFromContent(form, content);
28380
28600
  });
28381
28601
  }, [isEditMode, fetchState, subdomain]);
28382
- (0, import_react21.useEffect)(() => {
28602
+ (0, import_react23.useEffect)(() => {
28383
28603
  if (!isEditMode) return;
28384
28604
  const swallow = (e) => {
28385
28605
  const target = e.target;
@@ -28388,14 +28608,14 @@ function OhhwellsBridge() {
28388
28608
  document.addEventListener("submit", swallow, true);
28389
28609
  return () => document.removeEventListener("submit", swallow, true);
28390
28610
  }, [isEditMode]);
28391
- (0, import_react21.useEffect)(() => {
28611
+ (0, import_react23.useEffect)(() => {
28392
28612
  if (isEditMode || fetchState !== "done") return;
28393
28613
  console.log("env", process.env.NEXT_PUBLIC_FLOWOPS_API_URL);
28394
28614
  const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
28395
28615
  console.log({ apiUrl, subdomain });
28396
28616
  bindPublishedForms(apiUrl, subdomain, contentCache.get(subdomain) ?? {});
28397
28617
  }, [isEditMode, fetchState, subdomain]);
28398
- (0, import_react21.useEffect)(() => {
28618
+ (0, import_react23.useEffect)(() => {
28399
28619
  if (!subdomain || isEditMode) return;
28400
28620
  let debounceTimer = null;
28401
28621
  let observer = null;
@@ -28434,6 +28654,7 @@ function OhhwellsBridge() {
28434
28654
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28435
28655
  continue;
28436
28656
  }
28657
+ if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28437
28658
  if (applyVideoSettingNode(key, val)) continue;
28438
28659
  if (applyCarouselNode(key, val)) continue;
28439
28660
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28458,6 +28679,7 @@ function OhhwellsBridge() {
28458
28679
  });
28459
28680
  applyLinkByKey(key, val);
28460
28681
  }
28682
+ applySectionEmbeds(content);
28461
28683
  applyLogoFromContent(content);
28462
28684
  reconcileNavbarItemsFromContent(content);
28463
28685
  reconcileFooterOrderFromContent(content);
@@ -28513,16 +28735,16 @@ function OhhwellsBridge() {
28513
28735
  if (debounceTimer) clearTimeout(debounceTimer);
28514
28736
  };
28515
28737
  }, [subdomain, isEditMode, pathname]);
28516
- (0, import_react21.useLayoutEffect)(() => {
28738
+ (0, import_react23.useLayoutEffect)(() => {
28517
28739
  const el = document.getElementById("ohw-loader");
28518
28740
  if (!el) return;
28519
28741
  const visible = Boolean(subdomain) && fetchState !== "done";
28520
28742
  el.style.display = visible ? "flex" : "none";
28521
28743
  }, [subdomain, fetchState]);
28522
- (0, import_react21.useEffect)(() => {
28744
+ (0, import_react23.useEffect)(() => {
28523
28745
  postToParent2({ type: "ow:navigation", path: pathname });
28524
28746
  }, [pathname, postToParent2]);
28525
- (0, import_react21.useEffect)(() => {
28747
+ (0, import_react23.useEffect)(() => {
28526
28748
  if (!subdomain || isEditMode) return;
28527
28749
  const content = contentCache.get(subdomain);
28528
28750
  if (!content) return;
@@ -28540,7 +28762,7 @@ function OhhwellsBridge() {
28540
28762
  }
28541
28763
  applyAiFooterFromContent(content);
28542
28764
  }, [pathname, subdomain, isEditMode]);
28543
- (0, import_react21.useEffect)(() => {
28765
+ (0, import_react23.useEffect)(() => {
28544
28766
  if (!isEditMode) return;
28545
28767
  if (linkPopoverSessionRef.current?.intent === "add-nav") return;
28546
28768
  if (document.querySelector("[data-ohw-section-picker]")) return;
@@ -28548,12 +28770,12 @@ function OhhwellsBridge() {
28548
28770
  deselectRef.current();
28549
28771
  deactivateRef.current();
28550
28772
  }, [pathname, isEditMode]);
28551
- (0, import_react21.useEffect)(() => {
28773
+ (0, import_react23.useEffect)(() => {
28552
28774
  if (!isEditMode) return;
28553
28775
  initSectionInstancesFromContent(editContentRef.current, pathname);
28554
28776
  initItemInstancesFromContent(editContentRef.current);
28555
28777
  }, [pathname, isEditMode]);
28556
- (0, import_react21.useEffect)(() => {
28778
+ (0, import_react23.useEffect)(() => {
28557
28779
  if (!isEditMode) return;
28558
28780
  const observer = new MutationObserver(() => {
28559
28781
  const drawer = document.querySelector("[data-ohw-nav-drawer]");
@@ -28564,7 +28786,7 @@ function OhhwellsBridge() {
28564
28786
  observer.observe(document.body, { childList: true, subtree: true });
28565
28787
  return () => observer.disconnect();
28566
28788
  }, [isEditMode, pathname]);
28567
- (0, import_react21.useEffect)(() => {
28789
+ (0, import_react23.useEffect)(() => {
28568
28790
  const contentForNav = () => {
28569
28791
  if (isEditMode) return editContentRef.current;
28570
28792
  if (!subdomain) return {};
@@ -28637,7 +28859,7 @@ function OhhwellsBridge() {
28637
28859
  observer?.disconnect();
28638
28860
  };
28639
28861
  }, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
28640
- (0, import_react21.useEffect)(() => {
28862
+ (0, import_react23.useEffect)(() => {
28641
28863
  if (!isEditMode) return;
28642
28864
  let applying = false;
28643
28865
  let rafId = null;
@@ -28675,7 +28897,7 @@ function OhhwellsBridge() {
28675
28897
  observer.disconnect();
28676
28898
  };
28677
28899
  }, [isEditMode, pathname]);
28678
- (0, import_react21.useEffect)(() => {
28900
+ (0, import_react23.useEffect)(() => {
28679
28901
  if (!isEditMode) return;
28680
28902
  let lastPosted = 0;
28681
28903
  const measure = () => {
@@ -28704,7 +28926,7 @@ function OhhwellsBridge() {
28704
28926
  ro.disconnect();
28705
28927
  };
28706
28928
  }, [pathname, isEditMode, postToParent2]);
28707
- (0, import_react21.useEffect)(() => {
28929
+ (0, import_react23.useEffect)(() => {
28708
28930
  if (isEditMode) return;
28709
28931
  const handleClick = (e) => {
28710
28932
  if (!isPlainLeftClick(e)) return;
@@ -28718,7 +28940,7 @@ function OhhwellsBridge() {
28718
28940
  document.addEventListener("click", handleClick, true);
28719
28941
  return () => document.removeEventListener("click", handleClick, true);
28720
28942
  }, [isEditMode, router, pathname]);
28721
- (0, import_react21.useEffect)(() => {
28943
+ (0, import_react23.useEffect)(() => {
28722
28944
  if (!isEditMode) {
28723
28945
  editStylesRef.current?.base.remove();
28724
28946
  editStylesRef.current?.forceHover.remove();
@@ -30716,6 +30938,7 @@ function OhhwellsBridge() {
30716
30938
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
30717
30939
  continue;
30718
30940
  }
30941
+ if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
30719
30942
  if (applyVideoSettingNode(key, val)) continue;
30720
30943
  if (applyCarouselNode(key, val)) continue;
30721
30944
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -30741,6 +30964,7 @@ function OhhwellsBridge() {
30741
30964
  });
30742
30965
  applyLinkByKey(key, val);
30743
30966
  }
30967
+ applySectionEmbeds(content);
30744
30968
  applyLogoFromContent(content);
30745
30969
  applyLogoSizes(content);
30746
30970
  document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
@@ -32199,7 +32423,7 @@ function OhhwellsBridge() {
32199
32423
  if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
32200
32424
  };
32201
32425
  }, [isEditMode, refreshStateRules]);
32202
- (0, import_react21.useEffect)(() => {
32426
+ (0, import_react23.useEffect)(() => {
32203
32427
  if (!isEditMode) return;
32204
32428
  const THRESHOLD = 10;
32205
32429
  const resolveWasSelected = (el) => {
@@ -32355,7 +32579,7 @@ function OhhwellsBridge() {
32355
32579
  unlockFooterDragInteraction();
32356
32580
  };
32357
32581
  }, [isEditMode]);
32358
- (0, import_react21.useEffect)(() => {
32582
+ (0, import_react23.useEffect)(() => {
32359
32583
  if (!isEditMode) return;
32360
32584
  const THRESHOLD = 10;
32361
32585
  const onPointerDown = (e) => {
@@ -32446,7 +32670,7 @@ function OhhwellsBridge() {
32446
32670
  document.removeEventListener("selectstart", blockSelectStart, true);
32447
32671
  };
32448
32672
  }, [isEditMode, persistButtonCollectionDrag, refreshButtonDragVisuals]);
32449
- (0, import_react21.useEffect)(() => {
32673
+ (0, import_react23.useEffect)(() => {
32450
32674
  const handler = (e) => {
32451
32675
  if (e.data?.type !== "ow:request-schedule-config") return;
32452
32676
  const insertAfterVal = e.data.insertAfter;
@@ -32462,7 +32686,7 @@ function OhhwellsBridge() {
32462
32686
  window.addEventListener("message", handler);
32463
32687
  return () => window.removeEventListener("message", handler);
32464
32688
  }, [processConfigRequest]);
32465
- (0, import_react21.useEffect)(() => {
32689
+ (0, import_react23.useEffect)(() => {
32466
32690
  if (!isEditMode) return;
32467
32691
  document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
32468
32692
  el.removeAttribute("data-ohw-active-state");
@@ -32486,7 +32710,7 @@ function OhhwellsBridge() {
32486
32710
  postToParent2({
32487
32711
  type: "ow:ready",
32488
32712
  version: "1",
32489
- bridgeVersion: "0.1.160-next.427",
32713
+ bridgeVersion: "0.1.160-next.429",
32490
32714
  path: pathname,
32491
32715
  nodes: collectEditableNodes(editContentRef.current),
32492
32716
  sections
@@ -32498,13 +32722,13 @@ function OhhwellsBridge() {
32498
32722
  clearTimeout(timer);
32499
32723
  };
32500
32724
  }, [pathname, isEditMode, refreshStateRules, postToParent2]);
32501
- (0, import_react21.useEffect)(() => {
32725
+ (0, import_react23.useEffect)(() => {
32502
32726
  scrollToHashSectionWhenReady();
32503
32727
  const onHashChange = () => scrollToHashSectionWhenReady();
32504
32728
  window.addEventListener("hashchange", onHashChange);
32505
32729
  return () => window.removeEventListener("hashchange", onHashChange);
32506
32730
  }, [pathname]);
32507
- const handleCommand = (0, import_react21.useCallback)((cmd) => {
32731
+ const handleCommand = (0, import_react23.useCallback)((cmd) => {
32508
32732
  const el = activeElRef.current;
32509
32733
  const selBefore = window.getSelection();
32510
32734
  let savedOffsets = null;
@@ -32540,7 +32764,7 @@ function OhhwellsBridge() {
32540
32764
  if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
32541
32765
  refreshActiveCommandsRef.current();
32542
32766
  }, []);
32543
- (0, import_react21.useEffect)(() => {
32767
+ (0, import_react23.useEffect)(() => {
32544
32768
  const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
32545
32769
  if (!session || !logoSizeDraft) return;
32546
32770
  const onPanelAction = (e) => {
@@ -32578,7 +32802,7 @@ function OhhwellsBridge() {
32578
32802
  window.addEventListener("message", onPanelAction);
32579
32803
  return () => window.removeEventListener("message", onPanelAction);
32580
32804
  }, [floatingPanel, logoSizeDraft, editorViewport, persistLogoSizeDraft, closeFloatingPanelAndDeselect]);
32581
- const handleStateChange = (0, import_react21.useCallback)((state) => {
32805
+ const handleStateChange = (0, import_react23.useCallback)((state) => {
32582
32806
  if (!activeStateElRef.current) return;
32583
32807
  const el = activeStateElRef.current;
32584
32808
  if (state === "Default") {
@@ -32591,7 +32815,7 @@ function OhhwellsBridge() {
32591
32815
  }
32592
32816
  setToggleState((prev) => prev ? { ...prev, activeState: state } : null);
32593
32817
  }, [deactivate]);
32594
- const reselectAfterLinkPopover = (0, import_react21.useCallback)(
32818
+ const reselectAfterLinkPopover = (0, import_react23.useCallback)(
32595
32819
  (hrefKey) => {
32596
32820
  requestAnimationFrame(() => {
32597
32821
  const el = resolveHrefKeyElement(hrefKey);
@@ -32600,7 +32824,7 @@ function OhhwellsBridge() {
32600
32824
  },
32601
32825
  [resolveHrefKeyElement]
32602
32826
  );
32603
- const closeLinkPopover = (0, import_react21.useCallback)(() => {
32827
+ const closeLinkPopover = (0, import_react23.useCallback)(() => {
32604
32828
  const session = linkPopoverSessionRef.current;
32605
32829
  addNavAfterAnchorRef.current = null;
32606
32830
  setLinkPopover(null);
@@ -32608,9 +32832,9 @@ function OhhwellsBridge() {
32608
32832
  reselectAfterLinkPopover(session.key);
32609
32833
  }
32610
32834
  }, [reselectAfterLinkPopover]);
32611
- const closeLinkPopoverRef = (0, import_react21.useRef)(closeLinkPopover);
32835
+ const closeLinkPopoverRef = (0, import_react23.useRef)(closeLinkPopover);
32612
32836
  closeLinkPopoverRef.current = closeLinkPopover;
32613
- const openLinkPopoverForActive = (0, import_react21.useCallback)(() => {
32837
+ const openLinkPopoverForActive = (0, import_react23.useCallback)(() => {
32614
32838
  const hrefCtx = getHrefKeyFromElement(activeElRef.current);
32615
32839
  if (!hrefCtx) return;
32616
32840
  bumpLinkPopoverGrace();
@@ -32621,7 +32845,7 @@ function OhhwellsBridge() {
32621
32845
  });
32622
32846
  deactivate();
32623
32847
  }, [deactivate]);
32624
- const openLinkPopoverForSelected = (0, import_react21.useCallback)(() => {
32848
+ const openLinkPopoverForSelected = (0, import_react23.useCallback)(() => {
32625
32849
  const anchor = selectedElRef.current;
32626
32850
  if (!anchor) return;
32627
32851
  const key = anchor.getAttribute("data-ohw-href-key");
@@ -32638,7 +32862,7 @@ function OhhwellsBridge() {
32638
32862
  });
32639
32863
  deselect();
32640
32864
  }, [deselect]);
32641
- const handleSelectParent = (0, import_react21.useCallback)(() => {
32865
+ const handleSelectParent = (0, import_react23.useCallback)(() => {
32642
32866
  const selected = selectedElRef.current;
32643
32867
  if (!selected) return;
32644
32868
  if (toolbarVariantRef.current === "select-frame") {
@@ -32665,7 +32889,7 @@ function OhhwellsBridge() {
32665
32889
  }
32666
32890
  deselectRef.current();
32667
32891
  }, []);
32668
- const handleDuplicateSelected = (0, import_react21.useCallback)(() => {
32892
+ const handleDuplicateSelected = (0, import_react23.useCallback)(() => {
32669
32893
  const selected = selectedElRef.current;
32670
32894
  if (!selected || !isNavigationItem2(selected)) return;
32671
32895
  if (isCtaButton(selected)) {
@@ -32834,7 +33058,7 @@ function OhhwellsBridge() {
32834
33058
  });
32835
33059
  }
32836
33060
  }, [postToParent2, tokensForButton]);
32837
- const runPendingDeleteUndo = (0, import_react21.useCallback)(() => {
33061
+ const runPendingDeleteUndo = (0, import_react23.useCallback)(() => {
32838
33062
  const pending = pendingDeleteUndoRef.current;
32839
33063
  if (!pending) return false;
32840
33064
  pendingDeleteUndoRef.current = null;
@@ -32842,7 +33066,7 @@ function OhhwellsBridge() {
32842
33066
  enforceLinkHrefs();
32843
33067
  return true;
32844
33068
  }, []);
32845
- const handleDeleteSelected = (0, import_react21.useCallback)(() => {
33069
+ const handleDeleteSelected = (0, import_react23.useCallback)(() => {
32846
33070
  const selected = selectedElRef.current;
32847
33071
  if (!selected) return false;
32848
33072
  if (isCtaButton(selected)) {
@@ -32904,7 +33128,7 @@ function OhhwellsBridge() {
32904
33128
  }, [postToParent2]);
32905
33129
  handleDeleteSelectedRef.current = handleDeleteSelected;
32906
33130
  runPendingDeleteUndoRef.current = runPendingDeleteUndo;
32907
- const handleLinkPopoverSubmit = (0, import_react21.useCallback)(
33131
+ const handleLinkPopoverSubmit = (0, import_react23.useCallback)(
32908
33132
  (target) => {
32909
33133
  const session = linkPopoverSessionRef.current;
32910
33134
  if (!session) return;
@@ -32970,14 +33194,14 @@ function OhhwellsBridge() {
32970
33194
  const showEditLink = toolbarShowEditLink;
32971
33195
  const currentSections = sectionsByPath[pathname] ?? [];
32972
33196
  linkPopoverOpenRef.current = linkPopover !== null;
32973
- const handleMediaSelect = (0, import_react21.useCallback)((key) => {
33197
+ const handleMediaSelect = (0, import_react23.useCallback)((key) => {
32974
33198
  const el = hoveredImageRef.current?.dataset.ohwKey === key ? hoveredImageRef.current : Array.from(document.querySelectorAll(MEDIA_SELECTOR)).find(
32975
33199
  (m) => (m.dataset.ohwKey ?? "") === key
32976
33200
  ) ?? null;
32977
33201
  if (!el) return;
32978
33202
  selectMediaElementRef.current(el);
32979
33203
  }, []);
32980
- const handleMediaReplace = (0, import_react21.useCallback)(
33204
+ const handleMediaReplace = (0, import_react23.useCallback)(
32981
33205
  (key) => {
32982
33206
  postToParent2({
32983
33207
  type: "ow:image-pick",
@@ -32987,13 +33211,13 @@ function OhhwellsBridge() {
32987
33211
  },
32988
33212
  [postToParent2, mediaHover?.elementType, selectedMedia?.elementType]
32989
33213
  );
32990
- const handleEditCarousel = (0, import_react21.useCallback)(
33214
+ const handleEditCarousel = (0, import_react23.useCallback)(
32991
33215
  (key) => {
32992
33216
  postToParent2({ type: "ow:carousel-open", key, images: readCarouselValue(key) });
32993
33217
  },
32994
33218
  [postToParent2]
32995
33219
  );
32996
- const handleMediaFadeOutComplete = (0, import_react21.useCallback)((key) => {
33220
+ const handleMediaFadeOutComplete = (0, import_react23.useCallback)((key) => {
32997
33221
  setUploadingRects((prev) => {
32998
33222
  if (!(key in prev)) return prev;
32999
33223
  const next = { ...prev };
@@ -33001,7 +33225,7 @@ function OhhwellsBridge() {
33001
33225
  return next;
33002
33226
  });
33003
33227
  }, []);
33004
- const handleVideoSettingsChange = (0, import_react21.useCallback)(
33228
+ const handleVideoSettingsChange = (0, import_react23.useCallback)(
33005
33229
  (key, settings) => {
33006
33230
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
33007
33231
  const video = getVideoEl2(el);