@ohhwells/bridge 0.1.179-next.476 → 0.1.180

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
@@ -8236,21 +8236,6 @@ function pricingCardFeatureCount(tree, index) {
8236
8236
  const target = findPricingCollection(tree)?.children?.[index];
8237
8237
  return target ? pricingFeatureList(target).length : 0;
8238
8238
  }
8239
- function prevailingFeatureIcon(features) {
8240
- const counts = /* @__PURE__ */ new Map();
8241
- for (const row of features) {
8242
- const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
8243
- const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
8244
- entry.count += 1;
8245
- counts.set(key, entry);
8246
- }
8247
- let best = null;
8248
- for (const entry of counts.values()) {
8249
- if (!best || entry.count > best.count) best = entry;
8250
- }
8251
- if (!best) return {};
8252
- return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
8253
- }
8254
8239
  function addPricingCardFeature(tree, index, text) {
8255
8240
  return withPricingCollection(tree, (collection) => {
8256
8241
  const children = collection.children;
@@ -8259,7 +8244,7 @@ function addPricingCardFeature(tree, index, text) {
8259
8244
  const features = pricingFeatureList(target);
8260
8245
  if (features.length >= PRICING_FEATURES_MAX) return false;
8261
8246
  target.slots = target.slots ?? {};
8262
- target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
8247
+ target.slots.features = [...features, { text }];
8263
8248
  return true;
8264
8249
  });
8265
8250
  }
@@ -9957,7 +9942,7 @@ var AI_MOBILE_CSS = [
9957
9942
  // page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
9958
9943
  // template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
9959
9944
  // an exact figure from (no live measurement exists), so this is a safe approximation, not a
9960
- // pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
9945
+ // pixel-exact fit. Horizontal spacing already comes from `data-ai-container`.
9961
9946
  '[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
9962
9947
  // A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
9963
9948
  // window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
@@ -9979,10 +9964,8 @@ var AI_MOBILE_CSS = [
9979
9964
  "[data-ai-section]{overflow-x:hidden}",
9980
9965
  // `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
9981
9966
  // full-bleed section's container sets, so a carousel/media hero that is edge-to-edge on desktop
9982
- // still got a 20px band of section background down both sides on a phone. The footer's own
9983
- // container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
9984
- "[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
9985
- "[data-ai-container]{padding:0 20px !important}",
9967
+ // still got a 20px band of section background down both sides on a phone.
9968
+ "[data-ai-container]:not([data-ai-full-bleed]){padding:0 20px !important}",
9986
9969
  "[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
9987
9970
  "[data-ai-cell]{width:100%;min-width:0}",
9988
9971
  // The rule above turns every row into a COLUMN flex container on phones, which silently breaks
@@ -10191,31 +10174,6 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
10191
10174
  function textAttrs(ctx, path) {
10192
10175
  return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
10193
10176
  }
10194
- var AI_RESPONSIVE_CSS = [
10195
- "@media (max-width: 960px) {",
10196
- " [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
10197
- ' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
10198
- "}",
10199
- "@media (max-width: 640px) {",
10200
- " [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
10201
- " [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
10202
- // Group containers flatten to a column on phones; span placements come along for free.
10203
- // `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
10204
- // the comment there. This sheet's copy is the narrower selector, so without the exemption it
10205
- // flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
10206
- // viewport with the heading/CTA in flow *under* the image, 219px of section background where the
10207
- // layered text used to be.
10208
- ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
10209
- ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
10210
- // `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
10211
- // is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
10212
- // a full-bleed hero gets its 20px side band back below 640px only — the one width where the
10213
- // other rule had already been taught to stand down.
10214
- " [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
10215
- " [data-ai-responsive] { overflow-x: hidden; }",
10216
- " [data-ai-responsive] img { max-width: 100%; }",
10217
- "}"
10218
- ].join("\n");
10219
10177
  var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
10220
10178
  function MediaBox({
10221
10179
  refValue,
@@ -10270,7 +10228,7 @@ function MediaBox({
10270
10228
  position: fill ? "absolute" : void 0,
10271
10229
  inset: fill ? 0 : void 0,
10272
10230
  width: fill ? "100%" : fixedSize ? "auto" : "100%",
10273
- height: fill ? "100%" : fixedSize ? height : void 0,
10231
+ height: fill ? "100%" : void 0,
10274
10232
  aspectRatio: fill ? void 0 : aspectRatio,
10275
10233
  minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
10276
10234
  borderRadius: radius,
@@ -11848,7 +11806,7 @@ function CollectionBlock({ node, ctx, path }) {
11848
11806
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
11849
11807
  "div",
11850
11808
  {
11851
- "data-ai-grid": String(itemsPerRow),
11809
+ "data-ai-grid": "",
11852
11810
  "data-ohw-pricing-collection": isPricing ? "" : void 0,
11853
11811
  style: {
11854
11812
  display: "grid",
@@ -12150,7 +12108,7 @@ function renderNode(node, ctx, path, ambientAlign) {
12150
12108
  },
12151
12109
  children: [
12152
12110
  i > 0 && ctx.heroOverlapFullBleed ? (
12153
- // The section's `data-ai-section-inner` gave up its max-width/gutter so the base
12111
+ // The section's `data-ai-container` gave up its max-width/gutter so the base
12154
12112
  // layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
12155
12113
  // scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
12156
12114
  // the full section width instead of reading at the usual content width.
@@ -12577,7 +12535,6 @@ function AiTreeRenderer({
12577
12535
  ...fillHeight ? { "data-ai-fill-height": "" } : {},
12578
12536
  ...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
12579
12537
  ...bgAttrs,
12580
- "data-ai-responsive": "",
12581
12538
  style: {
12582
12539
  position: "relative",
12583
12540
  padding: `${padCss} 0`,
@@ -12591,13 +12548,12 @@ function AiTreeRenderer({
12591
12548
  ...fillHeight ? { display: "grid" } : {}
12592
12549
  },
12593
12550
  children: [
12594
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("style", { children: AI_RESPONSIVE_CSS }),
12595
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("style", { children: AI_MOBILE_CSS }),
12596
12551
  isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
12552
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("style", { children: AI_MOBILE_CSS }),
12597
12553
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
12598
12554
  "div",
12599
12555
  {
12600
- "data-ai-section-inner": "",
12556
+ "data-ai-container": "",
12601
12557
  ...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
12602
12558
  style: {
12603
12559
  position: "relative",
@@ -12663,7 +12619,7 @@ function AiTreeRenderer({
12663
12619
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
12664
12620
  "div",
12665
12621
  {
12666
- "data-ai-columns": "",
12622
+ "data-ai-row": "",
12667
12623
  style: {
12668
12624
  display: "grid",
12669
12625
  gridTemplateColumns: "repeat(12, 1fr)",
@@ -13334,10 +13290,9 @@ function applyAiSectionsToDom(state, options) {
13334
13290
  if (existing && existing.serialized === serialized && existing.container.isConnected) {
13335
13291
  continue;
13336
13292
  }
13293
+ const isNewMount = !existing || !existing.container.isConnected;
13337
13294
  let container = existing?.container;
13338
- let isNewMount = false;
13339
13295
  if (!container || !container.isConnected) {
13340
- isNewMount = true;
13341
13296
  existing?.root.unmount();
13342
13297
  container?.remove();
13343
13298
  container = document.createElement("div");
@@ -13675,34 +13630,6 @@ function minSpanForFooterBlock(type) {
13675
13630
  return 3;
13676
13631
  }
13677
13632
  }
13678
- function readLiveSocialItems() {
13679
- const root = getFooterRoot();
13680
- const row = root?.querySelector("[data-ohw-socials-row]");
13681
- if (!row) return [];
13682
- const items = [];
13683
- for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
13684
- const href = anchor.getAttribute("href")?.trim() ?? "";
13685
- const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
13686
- const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
13687
- if (!platform || !/^https?:\/\//i.test(href)) continue;
13688
- items.push({ platform, href });
13689
- }
13690
- return items;
13691
- }
13692
- function syncSocialRowsFromDom(tree) {
13693
- const root = getFooterRoot();
13694
- if (!root) return;
13695
- const row = root.querySelector("[data-ohw-socials-row]");
13696
- const live = readLiveSocialItems();
13697
- if (row && live.length === 0) return;
13698
- for (const col of tree.columns) {
13699
- col.blocks = col.blocks.flatMap((block) => {
13700
- if (block.type !== "social-row") return [block];
13701
- if (!row) return [];
13702
- return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
13703
- });
13704
- }
13705
- }
13706
13633
  function collectBrandBlocks(tree) {
13707
13634
  const brand = [];
13708
13635
  for (const col of tree.columns) {
@@ -13948,7 +13875,6 @@ function textOf2(el) {
13948
13875
  }
13949
13876
  function syncFooterTreeLinksFromDom(tree) {
13950
13877
  const next = cloneTree2(tree);
13951
- syncSocialRowsFromDom(next);
13952
13878
  const domCols = listFooterColumns().map((col) => {
13953
13879
  const heading = getFooterColumnHeadingEl(col);
13954
13880
  const title = heading ? textOf2(heading) : void 0;
@@ -19539,16 +19465,7 @@ function ItemInteractionLayer({
19539
19465
  {
19540
19466
  "aria-hidden": true,
19541
19467
  className: "absolute inset-0",
19542
- style: {
19543
- ...getChromeStyle(state),
19544
- // Draw the stroke inside the measured rect so chromeGap={0} (dropdown options)
19545
- // does not stick past the list edges (OHH-919 QA).
19546
- boxSizing: "border-box",
19547
- borderRadius: CHROME_RADIUS,
19548
- // Soft ring still paints outside the border box — drop it when flush with the
19549
- // target so the blue frame stays within the row.
19550
- ...gap === 0 ? { boxShadow: "none" } : null
19551
- }
19468
+ style: { ...getChromeStyle(state), borderRadius: CHROME_RADIUS }
19552
19469
  }
19553
19470
  ),
19554
19471
  itemDragEnabled && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
@@ -19783,7 +19700,7 @@ function apiBase() {
19783
19700
  function bridgeVersion() {
19784
19701
  try {
19785
19702
  if (true) {
19786
- return "0.1.179-next.476";
19703
+ return "0.1.180";
19787
19704
  }
19788
19705
  } catch {
19789
19706
  }
@@ -19797,7 +19714,7 @@ function stampBridgeVersionOnDocument() {
19797
19714
  return;
19798
19715
  }
19799
19716
  try {
19800
- const v = true ? "0.1.179-next.476" : "";
19717
+ const v = true ? "0.1.180" : "";
19801
19718
  if (v) {
19802
19719
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
19803
19720
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -19876,42 +19793,32 @@ function armLoaderHangBeacon(subdomain, fetchState, hangMs = 15e3) {
19876
19793
  }
19877
19794
 
19878
19795
  // src/lib/form-fields.ts
19879
- var DEFAULT_DROPDOWN_OPTIONS = ["Option 1", "Option 2", "Option 3"];
19880
19796
  var FIELD_DEFAULTS = {
19881
19797
  "short-text": { label: "Short text", placeholder: "Type placeholder text..." },
19882
19798
  "long-text": { label: "Long text", placeholder: "How can we help?" },
19883
19799
  email: { label: "Email", placeholder: "hello@example.com" },
19884
- phone: { label: "Phone number", placeholder: "(555) 000-0000" },
19885
- dropdown: { label: "Dropdown", placeholder: "" }
19800
+ phone: { label: "Phone number", placeholder: "(555) 000-0000" }
19886
19801
  };
19887
19802
  var FIELD_TYPES = [
19888
19803
  { type: "short-text", label: "Short text" },
19889
19804
  { type: "long-text", label: "Long text" },
19890
19805
  { type: "email", label: "Email" },
19891
- { type: "phone", label: "Phone" },
19892
- { type: "dropdown", label: "Dropdown" }
19806
+ { type: "phone", label: "Phone" }
19893
19807
  ];
19894
19808
  var FIELD_ATTR = "data-ohw-form-field";
19895
19809
  var FIELD_TYPE_ATTR = "data-ohw-field-type";
19896
19810
  var PLACEHOLDER_EDIT_ATTR = "data-ohw-placeholder-edit";
19897
- var DROPDOWN_PANEL_ATTR = "data-ohw-dropdown-panel";
19898
- var DROPDOWN_OPTION_ATTR = "data-ohw-dropdown-option";
19899
- var DROPDOWN_OPEN_ATTR = "data-ohw-dropdown-open";
19900
- var DROPDOWN_OPTION_SELECTED_ATTR = "data-ohw-dropdown-option-selected";
19901
- var CONTROL_SELECTOR = "input, textarea, select";
19902
19811
  var seedFieldByForm = /* @__PURE__ */ new WeakMap();
19903
19812
  function fieldsKey(formKey) {
19904
19813
  return `${formKey}-fields`;
19905
19814
  }
19906
19815
  function inputTagFor(type) {
19907
- if (type === "dropdown") return { tag: "select" };
19908
19816
  if (type === "long-text") return { tag: "textarea" };
19909
19817
  if (type === "email") return { tag: "input", inputType: "email" };
19910
19818
  if (type === "phone") return { tag: "input", inputType: "tel" };
19911
19819
  return { tag: "input", inputType: "text" };
19912
19820
  }
19913
19821
  function inferType(input) {
19914
- if (input.tagName === "SELECT") return "dropdown";
19915
19822
  if (input.tagName === "TEXTAREA") return "long-text";
19916
19823
  const type = input.type;
19917
19824
  if (type === "email") return "email";
@@ -19927,7 +19834,7 @@ function ensureFieldLabel(wrapper, key) {
19927
19834
  }
19928
19835
  return existing;
19929
19836
  }
19930
- const input = fieldControlOf(wrapper);
19837
+ const input = fieldInputOf(wrapper);
19931
19838
  const label = document.createElement("label");
19932
19839
  label.setAttribute("data-ohw-editable", "text");
19933
19840
  label.setAttribute("data-ohw-key", `${key}-label`);
@@ -19937,7 +19844,7 @@ function ensureFieldLabel(wrapper, key) {
19937
19844
  label.style.fontSize = "13px";
19938
19845
  label.style.fontWeight = "500";
19939
19846
  label.style.lineHeight = "1.3";
19940
- const fromPlaceholder = input && "getAttribute" in input ? input.getAttribute("placeholder")?.trim() : void 0;
19847
+ const fromPlaceholder = input?.getAttribute("placeholder")?.trim();
19941
19848
  const text = fromPlaceholder && fromPlaceholder.length < 40 ? fromPlaceholder : key.replace(/[-_]/g, " ");
19942
19849
  label.textContent = text;
19943
19850
  if (input && input.parentElement === wrapper) wrapper.insertBefore(label, input);
@@ -19950,13 +19857,8 @@ function listFieldWrappers(form) {
19950
19857
  function getFieldWrapper(el) {
19951
19858
  return el?.closest(`[${FIELD_ATTR}]`) ?? null;
19952
19859
  }
19953
- function fieldControlOf(wrapper) {
19954
- return wrapper.querySelector(CONTROL_SELECTOR);
19955
- }
19956
19860
  function fieldInputOf(wrapper) {
19957
- const control = fieldControlOf(wrapper);
19958
- if (!control || control.tagName === "SELECT") return null;
19959
- return control;
19861
+ return wrapper.querySelector("input, textarea");
19960
19862
  }
19961
19863
  function fieldLabelOf(wrapper) {
19962
19864
  return wrapper.querySelector("label");
@@ -19968,236 +19870,17 @@ function fieldTypeOf(wrapper) {
19968
19870
  return wrapper.getAttribute(FIELD_TYPE_ATTR) ?? "short-text";
19969
19871
  }
19970
19872
  function isFieldRequired(wrapper) {
19971
- return fieldControlOf(wrapper)?.hasAttribute("required") ?? false;
19972
- }
19973
- function optionFallbackLabel(index) {
19974
- return `Option ${index + 1}`;
19975
- }
19976
- function normalizeOptionText(text, index) {
19977
- const trimmed = text.replace(/\u00a0/g, " ").trim();
19978
- return trimmed || optionFallbackLabel(index);
19979
- }
19980
- function isPromptOption(opt) {
19981
- return opt.disabled && opt.value === "";
19982
- }
19983
- function readDropdownPrompt(wrapper) {
19984
- const select = fieldControlOf(wrapper);
19985
- if (!select || select.tagName !== "SELECT") return "";
19986
- const prompt = Array.from(select.options).find(isPromptOption);
19987
- return (prompt?.textContent ?? "").replace(/\u00a0/g, " ").trim();
19988
- }
19989
- function readDropdownOptions(wrapper) {
19990
- const select = fieldControlOf(wrapper);
19991
- if (!select || select.tagName !== "SELECT") return [...DEFAULT_DROPDOWN_OPTIONS];
19992
- const options = Array.from(select.options).filter((opt) => !isPromptOption(opt)).map((opt, i) => normalizeOptionText(opt.textContent ?? "", i));
19993
- return options.length > 0 ? options : [...DEFAULT_DROPDOWN_OPTIONS];
19994
- }
19995
- function fillSelectOptions(select, options, prompt) {
19996
- const keepPrompt = prompt === void 0 ? (() => {
19997
- const existing = Array.from(select.options).find(isPromptOption);
19998
- return existing ? (existing.textContent ?? "").replace(/\u00a0/g, " ").trim() : "";
19999
- })() : (prompt ?? "").trim();
20000
- select.replaceChildren();
20001
- if (keepPrompt) {
20002
- const opt = document.createElement("option");
20003
- opt.value = "";
20004
- opt.disabled = true;
20005
- opt.selected = true;
20006
- opt.textContent = keepPrompt;
20007
- select.appendChild(opt);
20008
- }
20009
- options.forEach((text, i) => {
20010
- const opt = document.createElement("option");
20011
- const label = normalizeOptionText(text, i);
20012
- opt.value = label;
20013
- opt.textContent = label;
20014
- select.appendChild(opt);
20015
- });
20016
- if (!keepPrompt && select.options.length > 0) select.selectedIndex = 0;
20017
- }
20018
- function removeDropdownEditorPanel(wrapper) {
20019
- wrapper.querySelector(`[${DROPDOWN_PANEL_ATTR}]`)?.remove();
20020
- wrapper.removeAttribute(DROPDOWN_OPEN_ATTR);
20021
- }
20022
- function styleDropdownPanelFromSelect(panel, select) {
20023
- const cs = getComputedStyle(select);
20024
- panel.style.boxSizing = "border-box";
20025
- panel.style.width = "100%";
20026
- panel.style.marginTop = "4px";
20027
- panel.style.overflow = "hidden";
20028
- panel.style.borderStyle = cs.borderStyle || "solid";
20029
- panel.style.borderWidth = cs.borderWidth || "1px";
20030
- panel.style.borderColor = cs.borderColor;
20031
- panel.style.borderRadius = cs.borderRadius;
20032
- panel.style.backgroundColor = cs.backgroundColor;
20033
- panel.style.fontFamily = cs.fontFamily;
20034
- panel.style.fontSize = cs.fontSize;
20035
- panel.style.fontWeight = cs.fontWeight;
20036
- panel.style.lineHeight = cs.lineHeight;
20037
- panel.style.color = cs.color;
20038
- panel.style.boxShadow = cs.boxShadow && cs.boxShadow !== "none" ? cs.boxShadow : "0 8px 24px color-mix(in srgb, #000 12%, transparent)";
20039
- }
20040
- function styleDropdownOptionFromSelect(row, select) {
20041
- const cs = getComputedStyle(select);
20042
- row.style.paddingTop = cs.paddingTop || "10px";
20043
- row.style.paddingBottom = cs.paddingBottom || "10px";
20044
- row.style.paddingLeft = cs.paddingLeft || "12px";
20045
- row.style.paddingRight = cs.paddingRight || "12px";
20046
- row.style.fontFamily = cs.fontFamily;
20047
- row.style.fontSize = cs.fontSize;
20048
- row.style.fontWeight = cs.fontWeight;
20049
- row.style.lineHeight = cs.lineHeight;
20050
- row.style.color = cs.color;
20051
- row.style.background = "transparent";
20052
- row.style.border = "none";
20053
- row.style.outline = "none";
20054
- row.style.cursor = "text";
20055
- }
20056
- function syncDropdownPanel(wrapper) {
20057
- if (fieldTypeOf(wrapper) !== "dropdown") {
20058
- wrapper.querySelector(`[${DROPDOWN_PANEL_ATTR}]`)?.remove();
20059
- wrapper.removeAttribute(DROPDOWN_OPEN_ATTR);
20060
- return null;
20061
- }
20062
- const select = fieldControlOf(wrapper);
20063
- if (!select || select.tagName !== "SELECT") return null;
20064
- let panel = wrapper.querySelector(`[${DROPDOWN_PANEL_ATTR}]`);
20065
- if (!panel) {
20066
- panel = document.createElement("div");
20067
- panel.setAttribute(DROPDOWN_PANEL_ATTR, "");
20068
- select.after(panel);
20069
- }
20070
- styleDropdownPanelFromSelect(panel, select);
20071
- const options = readDropdownOptions(wrapper);
20072
- const selected = selectedDropdownOptionIndex(wrapper);
20073
- panel.replaceChildren();
20074
- options.forEach((text, i) => {
20075
- panel.appendChild(createDropdownOptionRow(text, i, select));
20076
- });
20077
- if (selected != null && selected >= 0 && selected < options.length) {
20078
- const row = panel.querySelector(`[${DROPDOWN_OPTION_ATTR}="${selected}"]`);
20079
- row?.setAttribute(DROPDOWN_OPTION_SELECTED_ATTR, "");
20080
- }
20081
- return panel;
20082
- }
20083
- function createDropdownOptionRow(text, index, select) {
20084
- const row = document.createElement("div");
20085
- row.setAttribute(DROPDOWN_OPTION_ATTR, String(index));
20086
- row.setAttribute("contenteditable", "true");
20087
- row.setAttribute("spellcheck", "false");
20088
- row.textContent = text;
20089
- styleDropdownOptionFromSelect(row, select);
20090
- return row;
20091
- }
20092
- function setDropdownPreviewOpen(wrapper, open) {
20093
- if (fieldTypeOf(wrapper) !== "dropdown") return;
20094
- if (open) {
20095
- if (!wrapper.hasAttribute(DROPDOWN_OPEN_ATTR) || !wrapper.querySelector(`[${DROPDOWN_PANEL_ATTR}]`)) {
20096
- syncDropdownPanel(wrapper);
20097
- }
20098
- wrapper.setAttribute(DROPDOWN_OPEN_ATTR, "");
20099
- } else {
20100
- removeDropdownEditorPanel(wrapper);
20101
- }
20102
- }
20103
- function isDropdownPreviewOpen(wrapper) {
20104
- return wrapper.hasAttribute(DROPDOWN_OPEN_ATTR);
20105
- }
20106
- function listDropdownOptionRows(wrapper) {
20107
- return Array.from(wrapper.querySelectorAll(`[${DROPDOWN_OPTION_ATTR}]`));
20108
- }
20109
- function getDropdownOptionIndex(el) {
20110
- const row = el?.closest(`[${DROPDOWN_OPTION_ATTR}]`);
20111
- if (!row) return null;
20112
- const raw = row.getAttribute(DROPDOWN_OPTION_ATTR);
20113
- if (raw == null || raw === "") return null;
20114
- const index = Number(raw);
20115
- return Number.isFinite(index) ? index : null;
20116
- }
20117
- function selectDropdownOption(wrapper, index) {
20118
- listDropdownOptionRows(wrapper).forEach((row, i) => {
20119
- if (i === index) row.setAttribute(DROPDOWN_OPTION_SELECTED_ATTR, "");
20120
- else row.removeAttribute(DROPDOWN_OPTION_SELECTED_ATTR);
20121
- });
20122
- }
20123
- function clearDropdownOptionSelection(wrapper) {
20124
- if (!wrapper) return;
20125
- listDropdownOptionRows(wrapper).forEach((row) => row.removeAttribute(DROPDOWN_OPTION_SELECTED_ATTR));
20126
- }
20127
- function selectedDropdownOptionIndex(wrapper) {
20128
- const row = wrapper.querySelector(`[${DROPDOWN_OPTION_SELECTED_ATTR}]`);
20129
- return getDropdownOptionIndex(row);
20130
- }
20131
- function commitDropdownOptionsFromPanel(wrapper, finalize = false) {
20132
- const select = fieldControlOf(wrapper);
20133
- if (!select || select.tagName !== "SELECT") return readDropdownOptions(wrapper);
20134
- const rows = listDropdownOptionRows(wrapper);
20135
- const options = rows.length > 0 ? rows.map((row, i) => {
20136
- const trimmed = (row.textContent ?? "").replace(/\u00a0/g, " ").trim();
20137
- return finalize ? normalizeOptionText(trimmed, i) : trimmed || optionFallbackLabel(i);
20138
- }) : readDropdownOptions(wrapper);
20139
- fillSelectOptions(select, options);
20140
- if (finalize) {
20141
- const panelRows = listDropdownOptionRows(wrapper);
20142
- const realCount = Array.from(select.options).filter(
20143
- (opt) => !isPromptOption(opt)
20144
- ).length;
20145
- if (panelRows.length !== realCount) {
20146
- syncDropdownPanel(wrapper);
20147
- } else {
20148
- panelRows.forEach((row, i) => {
20149
- const label = options[i] ?? optionFallbackLabel(i);
20150
- if (row.textContent !== label) row.textContent = label;
20151
- row.setAttribute(DROPDOWN_OPTION_ATTR, String(i));
20152
- });
20153
- }
20154
- }
20155
- return readDropdownOptions(wrapper);
20156
- }
20157
- function writeDropdownOptions(wrapper, options, prompt) {
20158
- const select = fieldControlOf(wrapper);
20159
- if (!select || select.tagName !== "SELECT") return;
20160
- const normalized = (options.length > 0 ? options : [...DEFAULT_DROPDOWN_OPTIONS]).map(
20161
- (text, i) => normalizeOptionText(text, i)
20162
- );
20163
- fillSelectOptions(select, normalized, prompt);
20164
- if (wrapper.querySelector(`[${DROPDOWN_PANEL_ATTR}]`)) syncDropdownPanel(wrapper);
20165
- }
20166
- function currentDropdownOptions(wrapper) {
20167
- const rows = listDropdownOptionRows(wrapper);
20168
- if (rows.length === 0) return readDropdownOptions(wrapper);
20169
- return rows.map((row, i) => normalizeOptionText(row.textContent ?? "", i));
20170
- }
20171
- function duplicateDropdownOption(wrapper, index) {
20172
- const options = currentDropdownOptions(wrapper);
20173
- if (index < 0 || index >= options.length) return index;
20174
- const next = [...options];
20175
- next.splice(index + 1, 0, options[index]);
20176
- writeDropdownOptions(wrapper, next);
20177
- selectDropdownOption(wrapper, index + 1);
20178
- return index + 1;
20179
- }
20180
- function removeDropdownOption(wrapper, index) {
20181
- const options = currentDropdownOptions(wrapper);
20182
- if (options.length <= 1 || index < 0 || index >= options.length) {
20183
- selectDropdownOption(wrapper, Math.max(0, Math.min(index, options.length - 1)));
20184
- return selectedDropdownOptionIndex(wrapper);
20185
- }
20186
- const next = options.filter((_, i) => i !== index);
20187
- writeDropdownOptions(wrapper, next);
20188
- const nextIndex = Math.min(index, next.length - 1);
20189
- selectDropdownOption(wrapper, nextIndex);
20190
- return nextIndex;
19873
+ return fieldInputOf(wrapper)?.hasAttribute("required") ?? false;
20191
19874
  }
20192
19875
  function markFormFields(form) {
20193
- form.querySelectorAll(CONTROL_SELECTOR).forEach((input) => {
19876
+ form.querySelectorAll("input, textarea").forEach((input) => {
20194
19877
  const type = input.type;
20195
19878
  if (type === "submit" || type === "button" || type === "reset" || type === "hidden" || type === "checkbox" || type === "radio") {
20196
19879
  return;
20197
19880
  }
20198
19881
  if (getFieldWrapper(input)) return;
20199
19882
  let wrapper = input;
20200
- while (wrapper.parentElement && wrapper.parentElement !== form && wrapper.parentElement.querySelectorAll(CONTROL_SELECTOR).length === 1) {
19883
+ while (wrapper.parentElement && wrapper.parentElement !== form && wrapper.parentElement.querySelectorAll("input, textarea").length === 1) {
20201
19884
  wrapper = wrapper.parentElement;
20202
19885
  }
20203
19886
  if (wrapper === input) {
@@ -20211,7 +19894,6 @@ function markFormFields(form) {
20211
19894
  wrapper.setAttribute(FIELD_ATTR, key);
20212
19895
  wrapper.setAttribute(FIELD_TYPE_ATTR, inferType(input));
20213
19896
  ensureFieldLabel(wrapper, key);
20214
- if (inferType(input) === "dropdown") removeDropdownEditorPanel(wrapper);
20215
19897
  syncRequiredMark(wrapper);
20216
19898
  });
20217
19899
  const wrappers = listFieldWrappers(form);
@@ -20222,21 +19904,16 @@ function markFormFields(form) {
20222
19904
  }
20223
19905
  function readFieldsFromDom(form) {
20224
19906
  return listFieldWrappers(form).map((wrapper) => {
20225
- const type = fieldTypeOf(wrapper);
20226
- const control = fieldControlOf(wrapper);
20227
- const isDropdown = type === "dropdown";
20228
- if (isDropdown) commitDropdownOptionsFromPanel(wrapper, true);
19907
+ const input = fieldInputOf(wrapper);
20229
19908
  return {
20230
19909
  key: fieldKeyOf(wrapper),
20231
- type,
19910
+ type: fieldTypeOf(wrapper),
20232
19911
  label: fieldLabelText(fieldLabelOf(wrapper)).trim(),
20233
19912
  // While a field is selected its placeholder text lives in the value (see
20234
19913
  // beginPlaceholderEdit), so reading the attribute would store an empty one — whoever
20235
19914
  // happens to save at that moment must still record what the owner typed.
20236
- // Dropdown: the disabled empty prompt (template placeholder), not an input placeholder.
20237
- placeholder: isDropdown ? readDropdownPrompt(wrapper) : control && control.tagName !== "SELECT" ? control.hasAttribute(PLACEHOLDER_EDIT_ATTR) ? control.value : control.getAttribute("placeholder") ?? "" : "",
20238
- required: Boolean(control?.hasAttribute("required")),
20239
- ...isDropdown ? { options: readDropdownOptions(wrapper) } : {}
19915
+ placeholder: input ? input.hasAttribute(PLACEHOLDER_EDIT_ATTR) ? input.value : input.getAttribute("placeholder") ?? "" : "",
19916
+ required: Boolean(input?.hasAttribute("required"))
20240
19917
  };
20241
19918
  });
20242
19919
  }
@@ -20254,8 +19931,8 @@ function isDefaultText(value, pick) {
20254
19931
  if (!trimmed) return true;
20255
19932
  return Object.values(FIELD_DEFAULTS).some((defaults) => pick(defaults) === trimmed);
20256
19933
  }
20257
- function applyFieldType(wrapper, type, options) {
20258
- const input = fieldControlOf(wrapper);
19934
+ function applyFieldType(wrapper, type) {
19935
+ const input = fieldInputOf(wrapper);
20259
19936
  if (!input) return;
20260
19937
  const defaults = FIELD_DEFAULTS[type];
20261
19938
  const placeholder = input.getAttribute("placeholder") ?? "";
@@ -20267,10 +19944,6 @@ function applyFieldType(wrapper, type, options) {
20267
19944
  };
20268
19945
  const { tag, inputType } = inputTagFor(type);
20269
19946
  wrapper.setAttribute(FIELD_TYPE_ATTR, type);
20270
- if (type !== "dropdown") {
20271
- wrapper.querySelector(`[${DROPDOWN_PANEL_ATTR}]`)?.remove();
20272
- wrapper.removeAttribute(DROPDOWN_OPEN_ATTR);
20273
- }
20274
19947
  const shedSize = (el) => {
20275
19948
  if (type === "long-text") return;
20276
19949
  el.style.removeProperty("height");
@@ -20282,40 +19955,28 @@ function applyFieldType(wrapper, type, options) {
20282
19955
  }
20283
19956
  };
20284
19957
  const applyDefaults = (el) => {
20285
- if (type === "dropdown") return;
20286
19958
  el.setAttribute("placeholder", defaults.placeholder);
20287
19959
  if (label && followsDefaults.label) {
20288
19960
  label.textContent = defaults.label;
20289
19961
  }
20290
19962
  };
20291
- const applyDropdown = (select) => {
20292
- const nextOptions = options && options.length > 0 ? options.map((text, i) => normalizeOptionText(text, i)) : [...DEFAULT_DROPDOWN_OPTIONS];
20293
- fillSelectOptions(select, nextOptions, options !== void 0 ? void 0 : null);
20294
- select.removeAttribute("placeholder");
20295
- if (label && followsDefaults.label) label.textContent = defaults.label;
20296
- if (wrapper.querySelector(`[${DROPDOWN_PANEL_ATTR}]`)) syncDropdownPanel(wrapper);
20297
- else removeDropdownEditorPanel(wrapper);
20298
- };
20299
19963
  if (input.tagName.toLowerCase() === tag) {
20300
19964
  if (inputType) input.type = inputType;
20301
19965
  shedSize(input);
20302
- if (type === "dropdown") applyDropdown(input);
20303
- else applyDefaults(input);
19966
+ applyDefaults(input);
20304
19967
  requireIfEmail(wrapper, type);
20305
19968
  return;
20306
19969
  }
20307
19970
  const next = document.createElement(tag);
20308
19971
  Array.from(input.attributes).forEach((attr) => {
20309
19972
  if (attr.name === "type") return;
20310
- if (tag === "select" && (attr.name === "value" || attr.name === "placeholder")) return;
20311
19973
  next.setAttribute(attr.name, attr.value);
20312
19974
  });
20313
19975
  if (inputType) next.setAttribute("type", inputType);
20314
19976
  shedSize(next);
20315
19977
  if (type === "long-text") next.setAttribute("rows", "4");
20316
19978
  input.replaceWith(next);
20317
- if (type === "dropdown") applyDropdown(next);
20318
- else applyDefaults(next);
19979
+ applyDefaults(next);
20319
19980
  requireIfEmail(wrapper, type);
20320
19981
  }
20321
19982
  function requireIfEmail(wrapper, type) {
@@ -20337,7 +19998,7 @@ function syncRequiredMark(wrapper) {
20337
19998
  else label.removeAttribute(REQUIRED_MARK_ATTR);
20338
19999
  }
20339
20000
  function setFieldRequired(wrapper, required) {
20340
- const input = fieldControlOf(wrapper);
20001
+ const input = fieldInputOf(wrapper);
20341
20002
  const label = fieldLabelOf(wrapper);
20342
20003
  if (!input) return;
20343
20004
  if (required) input.setAttribute("required", "");
@@ -20345,7 +20006,6 @@ function setFieldRequired(wrapper, required) {
20345
20006
  if (label) syncRequiredMark(wrapper);
20346
20007
  }
20347
20008
  function beginPlaceholderEdit(wrapper) {
20348
- if (fieldTypeOf(wrapper) === "dropdown") return;
20349
20009
  const input = fieldInputOf(wrapper);
20350
20010
  if (!input || input.hasAttribute(PLACEHOLDER_EDIT_ATTR)) return;
20351
20011
  input.style.setProperty("--ohw-placeholder-edit-color", getComputedStyle(input).color);
@@ -20355,11 +20015,6 @@ function beginPlaceholderEdit(wrapper) {
20355
20015
  }
20356
20016
  function commitPlaceholderEdit(wrapper) {
20357
20017
  if (!wrapper) return false;
20358
- if (fieldTypeOf(wrapper) === "dropdown") {
20359
- const before = readDropdownOptions(wrapper).join("\0");
20360
- const after = commitDropdownOptionsFromPanel(wrapper, true).join("\0");
20361
- return before !== after;
20362
- }
20363
20018
  const input = fieldInputOf(wrapper);
20364
20019
  if (!input || !input.hasAttribute(PLACEHOLDER_EDIT_ATTR)) return false;
20365
20020
  const typed = input.value;
@@ -20371,10 +20026,6 @@ function commitPlaceholderEdit(wrapper) {
20371
20026
  return previous !== typed;
20372
20027
  }
20373
20028
  function setFieldPlaceholder(wrapper, placeholder) {
20374
- if (fieldTypeOf(wrapper) === "dropdown") {
20375
- writeDropdownOptions(wrapper, readDropdownOptions(wrapper), placeholder || null);
20376
- return;
20377
- }
20378
20029
  fieldInputOf(wrapper)?.setAttribute("placeholder", placeholder);
20379
20030
  }
20380
20031
  function uniqueKey(form, base) {
@@ -20418,17 +20069,14 @@ function insertField(form, type) {
20418
20069
  }
20419
20070
  wrapper.setAttribute(FIELD_ATTR, key);
20420
20071
  wrapper.setAttribute(FIELD_TYPE_ATTR, type);
20421
- wrapper.removeAttribute(DROPDOWN_OPEN_ATTR);
20422
20072
  applyFieldType(wrapper, type);
20423
20073
  const defaults = FIELD_DEFAULTS[type];
20424
- const input = fieldControlOf(wrapper);
20074
+ const input = fieldInputOf(wrapper);
20425
20075
  if (input) {
20426
20076
  input.setAttribute("name", key);
20427
20077
  input.removeAttribute("required");
20428
- if (type !== "dropdown") {
20429
- input.setAttribute("placeholder", defaults.placeholder);
20430
- if (input.tagName !== "SELECT") input.value = "";
20431
- }
20078
+ input.setAttribute("placeholder", defaults.placeholder);
20079
+ input.value = "";
20432
20080
  }
20433
20081
  const label = ensureFieldLabel(wrapper, key);
20434
20082
  label.textContent = defaults.label;
@@ -20437,22 +20085,18 @@ function insertField(form, type) {
20437
20085
  return wrapper;
20438
20086
  }
20439
20087
  function duplicateField(form, wrapper) {
20440
- if (fieldTypeOf(wrapper) === "dropdown") commitDropdownOptionsFromPanel(wrapper);
20441
20088
  const copy = wrapper.cloneNode(true);
20442
20089
  const key = uniqueKey(form, `${fieldKeyOf(wrapper)}-copy`);
20443
20090
  copy.setAttribute(FIELD_ATTR, key);
20444
- copy.removeAttribute(DROPDOWN_OPEN_ATTR);
20445
- clearDropdownOptionSelection(copy);
20446
- const input = fieldControlOf(copy);
20091
+ const input = fieldInputOf(copy);
20447
20092
  if (input) {
20448
20093
  input.setAttribute("name", key);
20449
20094
  input.removeAttribute("data-ohw-key");
20450
- if (input.tagName !== "SELECT") input.value = "";
20095
+ input.value = "";
20451
20096
  }
20452
20097
  const label = fieldLabelOf(copy);
20453
20098
  if (label) label.setAttribute("data-ohw-key", `${key}-label`);
20454
20099
  wrapper.after(copy);
20455
- if (fieldTypeOf(copy) === "dropdown") removeDropdownEditorPanel(copy);
20456
20100
  return copy;
20457
20101
  }
20458
20102
  function removeField(wrapper) {
@@ -20491,27 +20135,16 @@ function reconcileFieldsFromContent(form, content) {
20491
20135
  wrapper = insertField(form, spec.type);
20492
20136
  if (!wrapper) return;
20493
20137
  wrapper.setAttribute(FIELD_ATTR, spec.key);
20494
- const input = fieldControlOf(wrapper);
20138
+ const input = fieldInputOf(wrapper);
20495
20139
  if (input) {
20496
20140
  input.setAttribute("name", spec.key);
20497
20141
  }
20498
20142
  fieldLabelOf(wrapper)?.setAttribute("data-ohw-key", `${spec.key}-label`);
20499
20143
  byKey.set(spec.key, wrapper);
20500
20144
  }
20501
- const dropdownWasOpen = wrapper.hasAttribute(DROPDOWN_OPEN_ATTR);
20502
- applyFieldType(wrapper, spec.type, spec.type === "dropdown" ? spec.options : void 0);
20145
+ applyFieldType(wrapper, spec.type);
20503
20146
  setFieldRequired(wrapper, spec.required);
20504
20147
  setFieldPlaceholder(wrapper, spec.placeholder);
20505
- if (spec.type === "dropdown") {
20506
- writeDropdownOptions(
20507
- wrapper,
20508
- spec.options?.length ? spec.options : [...DEFAULT_DROPDOWN_OPTIONS],
20509
- spec.placeholder || null
20510
- );
20511
- }
20512
- if (spec.type === "dropdown" && dropdownWasOpen) setDropdownPreviewOpen(wrapper, true);
20513
- else if (spec.type === "dropdown") removeDropdownEditorPanel(wrapper);
20514
- else wrapper.removeAttribute(DROPDOWN_OPEN_ATTR);
20515
20148
  const label = fieldLabelOf(wrapper);
20516
20149
  if (label && spec.label) label.textContent = spec.label.replace(/\s*\*\s*$/, "").trimEnd();
20517
20150
  syncRequiredMark(wrapper);
@@ -20534,14 +20167,11 @@ var TYPE_ICONS = {
20534
20167
  "short-text": import_lucide_react5.Type,
20535
20168
  "long-text": import_lucide_react5.TextQuote,
20536
20169
  email: import_lucide_react5.AtSign,
20537
- phone: import_lucide_react5.Phone,
20538
- dropdown: import_lucide_react5.ChevronDown
20170
+ phone: import_lucide_react5.Phone
20539
20171
  };
20540
20172
  function FormFieldToolbar({
20541
20173
  type,
20542
20174
  required,
20543
- dropdownOpen = null,
20544
- onDropdownOpenChange,
20545
20175
  onTypeChange,
20546
20176
  onRequiredToggle,
20547
20177
  onDuplicate,
@@ -20549,7 +20179,6 @@ function FormFieldToolbar({
20549
20179
  }) {
20550
20180
  const TypeIcon = TYPE_ICONS[type];
20551
20181
  const typeLabel = FIELD_TYPES.find((entry) => entry.type === type)?.label ?? "Short text";
20552
- const showDropdownToggle = type === "dropdown" && dropdownOpen !== null && dropdownOpen !== void 0;
20553
20182
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
20554
20183
  "div",
20555
20184
  {
@@ -20601,131 +20230,29 @@ function FormFieldToolbar({
20601
20230
  ]
20602
20231
  }
20603
20232
  ),
20604
- showDropdownToggle ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
20605
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "mx-0.5 h-5 w-px bg-border" }),
20606
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
20607
- ToggleGroup,
20233
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "mx-0.5 h-5 w-px bg-border" }),
20234
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(DropdownMenu, { children: [
20235
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
20236
+ "button",
20608
20237
  {
20609
- value: dropdownOpen ? "open" : "closed",
20610
- onValueChange: () => {
20611
- },
20612
- className: "h-7 gap-0.5 rounded-[calc(var(--radius,0.5rem)-2px)] bg-muted p-0.5",
20613
- onMouseDown: (e) => {
20614
- e.preventDefault();
20615
- e.stopPropagation();
20616
- },
20617
- children: [
20618
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
20619
- ToggleGroupItem,
20620
- {
20621
- value: "closed",
20622
- size: "sm",
20623
- "aria-label": "Closed",
20624
- className: "h-6 min-w-0 px-2 text-xs font-medium",
20625
- onMouseDown: (e) => {
20626
- e.preventDefault();
20627
- e.stopPropagation();
20628
- if (dropdownOpen !== false) onDropdownOpenChange?.(false);
20629
- },
20630
- onClick: (e) => {
20631
- e.preventDefault();
20632
- e.stopPropagation();
20633
- },
20634
- children: "Closed"
20635
- }
20636
- ),
20637
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
20638
- ToggleGroupItem,
20639
- {
20640
- value: "open",
20641
- size: "sm",
20642
- "aria-label": "Open",
20643
- className: "h-6 min-w-0 px-2 text-xs font-medium",
20644
- onMouseDown: (e) => {
20645
- e.preventDefault();
20646
- e.stopPropagation();
20647
- if (dropdownOpen !== true) onDropdownOpenChange?.(true);
20648
- },
20649
- onClick: (e) => {
20650
- e.preventDefault();
20651
- e.stopPropagation();
20652
- },
20653
- children: "Open"
20654
- }
20655
- )
20656
- ]
20238
+ type: "button",
20239
+ title: "More",
20240
+ "aria-label": "More",
20241
+ className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/70",
20242
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react5.MoreHorizontal, { size: 15, "aria-hidden": true })
20657
20243
  }
20658
- )
20659
- ] }) : null,
20660
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "mx-0.5 h-5 w-px bg-border" }),
20661
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
20662
- "button",
20663
- {
20664
- type: "button",
20665
- title: "Duplicate",
20666
- "aria-label": "Duplicate",
20667
- onClick: onDuplicate,
20668
- className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/70",
20669
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react5.Copy, { size: 15, strokeWidth: 1.75, "aria-hidden": true })
20670
- }
20671
- ),
20672
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
20673
- "button",
20674
- {
20675
- type: "button",
20676
- title: "Delete",
20677
- "aria-label": "Delete",
20678
- onClick: onDelete,
20679
- className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/70",
20680
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react5.Trash2, { size: 15, strokeWidth: 1.75, "aria-hidden": true })
20681
- }
20682
- )
20683
- ]
20684
- }
20685
- );
20686
- }
20687
- function DropdownOptionToolbar({
20688
- canDelete,
20689
- onDuplicate,
20690
- onDelete
20691
- }) {
20692
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
20693
- "div",
20694
- {
20695
- "data-ohw-dropdown-option-toolbar": "",
20696
- className: "pointer-events-auto flex items-center gap-0.5 whitespace-nowrap rounded-lg border border-border bg-background p-1 shadow-md",
20697
- children: [
20698
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
20699
- "button",
20700
- {
20701
- type: "button",
20702
- title: "Duplicate",
20703
- "aria-label": "Duplicate",
20704
- onMouseDown: (e) => {
20705
- e.preventDefault();
20706
- e.stopPropagation();
20707
- onDuplicate();
20708
- },
20709
- className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/70",
20710
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react5.Copy, { size: 15, strokeWidth: 1.75, "aria-hidden": true })
20711
- }
20712
- ),
20713
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
20714
- "button",
20715
- {
20716
- type: "button",
20717
- title: "Delete",
20718
- "aria-label": "Delete",
20719
- disabled: !canDelete,
20720
- onMouseDown: (e) => {
20721
- e.preventDefault();
20722
- e.stopPropagation();
20723
- if (canDelete) onDelete();
20724
- },
20725
- className: "flex h-7 w-7 items-center justify-center rounded-md transition-colors " + (canDelete ? "text-foreground hover:bg-muted/70" : "cursor-not-allowed text-muted-foreground opacity-40"),
20726
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react5.Trash2, { size: 15, strokeWidth: 1.75, "aria-hidden": true })
20727
- }
20728
- )
20244
+ ) }),
20245
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(DropdownMenuContent, { align: "start", sideOffset: 8, className: "min-w-42.5 p-1", children: [
20246
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(DropdownMenuItem, { onSelect: onDuplicate, className: "rounded-md py-2 text-[13px]", children: [
20247
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react5.Copy, { size: 14, strokeWidth: 1.75, className: "shrink-0", "aria-hidden": true }),
20248
+ "Duplicate"
20249
+ ] }),
20250
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(DropdownMenuItem, { variant: "destructive", onSelect: onDelete, className: "rounded-md py-2 text-[13px]", children: [
20251
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react5.Trash2, { size: 14, strokeWidth: 1.75, className: "shrink-0", "aria-hidden": true }),
20252
+ "Delete"
20253
+ ] })
20254
+ ] })
20255
+ ] })
20729
20256
  ]
20730
20257
  }
20731
20258
  );
@@ -20868,7 +20395,6 @@ function MediaOverlay({
20868
20395
  (prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
20869
20396
  );
20870
20397
  }, [isVideo]);
20871
- const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
20872
20398
  const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
20873
20399
  const box = {
20874
20400
  position: "fixed",
@@ -20967,9 +20493,10 @@ function MediaOverlay({
20967
20493
  className: "flex items-center justify-center cursor-pointer",
20968
20494
  style: {
20969
20495
  ...box,
20970
- // Bare media takes the click: the first selects it, the next opens the picker. Text on
20971
- // top and cueOnly let clicks fall through. Navbar, logo and buttons over a hero image
20972
- // never reach here: probeImageAt dismisses the overlay before it can cover them.
20496
+ // When text overlays this media, let clicks fall THROUGH to the text underneath. In the
20497
+ // parent this needed a whole `ow:click-at` round-trip to re-hit-test inside the iframe;
20498
+ // in-document, pointer-events does it natively. The button below opts back in, so
20499
+ // Replace still works.
20973
20500
  pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
20974
20501
  // Selected: a firm component ring with no wash, so the image reads as chosen rather
20975
20502
  // than hovered. Hover keeps the existing tinted preview.
@@ -20997,18 +20524,15 @@ function MediaOverlay({
20997
20524
  },
20998
20525
  children: [
20999
20526
  isVideo ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react6.Film, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react6.ImageIcon, { size: 14 }),
21000
- replaceLabel
20527
+ isVideo ? "Replace video" : "Replace image"
21001
20528
  ]
21002
20529
  }
21003
20530
  ),
21004
- showChrome && replaceMode !== "none" && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
20531
+ replaceMode === "none" || cueOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
21005
20532
  "div",
21006
20533
  {
21007
20534
  className: "flex items-center gap-1.5",
21008
- style: {
21009
- // Parent overlay is pointer-events:none; controls opt back in (unless text sits on top).
21010
- pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto"
21011
- },
20535
+ style: { pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto" },
21012
20536
  onClick: (e) => e.stopPropagation(),
21013
20537
  children: [
21014
20538
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
@@ -21017,7 +20541,7 @@ function MediaOverlay({
21017
20541
  "data-ohw-media-overlay": "",
21018
20542
  variant: "outline",
21019
20543
  size: "sm",
21020
- "aria-label": replaceLabel,
20544
+ "aria-label": isVideo ? "Replace video" : "Replace image",
21021
20545
  className: "gap-1.5 cursor-pointer hover:bg-background",
21022
20546
  style: {
21023
20547
  ...OVERLAY_BUTTON_STYLE,
@@ -21038,7 +20562,7 @@ function MediaOverlay({
21038
20562
  },
21039
20563
  children: [
21040
20564
  isVideo ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react6.Film, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react6.ImageIcon, { size: 14 }),
21041
- replaceMode === "full" ? replaceLabel : null
20565
+ replaceMode === "full" ? isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image" : null
21042
20566
  ]
21043
20567
  }
21044
20568
  ),
@@ -21696,7 +21220,7 @@ function AiSectionOverlay({
21696
21220
 
21697
21221
  // src/ui/ai-section/AiMediaStripOverlay.tsx
21698
21222
  var import_react15 = require("react");
21699
- var import_lucide_react10 = require("lucide-react");
21223
+ var import_lucide_react9 = require("lucide-react");
21700
21224
 
21701
21225
  // src/lib/ai-media-strip-tree.ts
21702
21226
  var MEDIA_STRIP_ITEM_MIN = 1;
@@ -21810,6 +21334,14 @@ function setMediaStripItemAsset(tree, index, assetId) {
21810
21334
  return true;
21811
21335
  });
21812
21336
  }
21337
+ function setMediaStripItemAlt(tree, index, alt) {
21338
+ return withMediaStrip(tree, (block) => {
21339
+ const items = block.items;
21340
+ if (index < 0 || index >= items.length) return false;
21341
+ items[index] = { ...items[index], alt };
21342
+ return true;
21343
+ });
21344
+ }
21813
21345
  function setMediaStripItemLink(tree, index, link) {
21814
21346
  return withMediaStrip(tree, (block) => {
21815
21347
  const items = block.items;
@@ -21827,117 +21359,11 @@ function setMediaStripItemLink(tree, index, link) {
21827
21359
  });
21828
21360
  }
21829
21361
 
21830
- // src/ui/dialog.tsx
21831
- var React10 = __toESM(require("react"), 1);
21832
- var import_radix_ui6 = require("radix-ui");
21833
- var import_lucide_react9 = require("lucide-react");
21834
- var import_jsx_runtime21 = require("react/jsx-runtime");
21835
- function Dialog2({
21836
- ...props
21837
- }) {
21838
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
21839
- }
21840
- function DialogPortal({
21841
- ...props
21842
- }) {
21843
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
21844
- }
21845
- function DialogOverlay({
21846
- className,
21847
- ...props
21848
- }) {
21849
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21850
- import_radix_ui6.Dialog.Overlay,
21851
- {
21852
- "data-slot": "dialog-overlay",
21853
- "data-ohw-link-modal-root": "",
21854
- className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
21855
- ...props
21856
- }
21857
- );
21858
- }
21859
- var DialogContent = React10.forwardRef(
21860
- ({ className, children, showCloseButton = true, container, ...props }, ref) => {
21861
- const positionMode = container ? "absolute" : "fixed";
21862
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogPortal, { container: container ?? void 0, children: [
21863
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
21864
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
21865
- import_radix_ui6.Dialog.Content,
21866
- {
21867
- ref,
21868
- "data-slot": "dialog-content",
21869
- className: cn(
21870
- positionMode,
21871
- "left-1/2 top-1/2 z-[2147483647] flex w-full max-w-[448px] -translate-x-1/2 -translate-y-1/2 flex-col overflow-visible",
21872
- "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
21873
- container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
21874
- className
21875
- ),
21876
- onMouseDown: (e) => e.stopPropagation(),
21877
- ...props,
21878
- children: [
21879
- children,
21880
- showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21881
- import_radix_ui6.Dialog.Close,
21882
- {
21883
- type: "button",
21884
- className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
21885
- "aria-label": "Close",
21886
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.X, { size: 16, "aria-hidden": true })
21887
- }
21888
- ) : null
21889
- ]
21890
- }
21891
- )
21892
- ] });
21893
- }
21894
- );
21895
- DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
21896
- function DialogHeader({
21897
- className,
21898
- ...props
21899
- }) {
21900
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
21901
- }
21902
- function DialogFooter({
21903
- className,
21904
- ...props
21905
- }) {
21906
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21907
- "div",
21908
- {
21909
- className: cn("flex items-center justify-end gap-2", className),
21910
- ...props
21911
- }
21912
- );
21913
- }
21914
- var DialogTitle = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21915
- import_radix_ui6.Dialog.Title,
21916
- {
21917
- ref,
21918
- className: cn(
21919
- "text-lg font-semibold leading-none tracking-tight text-card-foreground",
21920
- className
21921
- ),
21922
- ...props
21923
- }
21924
- ));
21925
- DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
21926
- var DialogDescription = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21927
- import_radix_ui6.Dialog.Description,
21928
- {
21929
- ref,
21930
- className: cn("text-sm text-muted-foreground", className),
21931
- ...props
21932
- }
21933
- ));
21934
- DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
21935
- var DialogClose = import_radix_ui6.Dialog.Close;
21936
-
21937
21362
  // src/ui/ai-section/AiMediaStripOverlay.tsx
21938
- var import_jsx_runtime22 = require("react/jsx-runtime");
21939
- var PRIMARY3 = "var(--ohw-primary, #0885FE)";
21940
- var CHROME_SELECTOR = "[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review], [data-ohw-more-menu]";
21363
+ var import_jsx_runtime21 = require("react/jsx-runtime");
21364
+ var PRIMARY3 = "#0885FE";
21365
+ var OHW_BLUE = `var(--ohw-primary, ${PRIMARY3})`;
21366
+ var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
21941
21367
  function findMediaStripItemElement(sectionId, index) {
21942
21368
  const sectionEl2 = findByInstanceId(sectionId);
21943
21369
  if (!sectionEl2) return null;
@@ -21947,35 +21373,14 @@ function findMediaStripItemElement(sectionId, index) {
21947
21373
  }
21948
21374
  return null;
21949
21375
  }
21950
- function itemRefFromTarget(target) {
21951
- if (!(target instanceof Element)) return null;
21952
- if (target.closest(CHROME_SELECTOR)) return null;
21953
- const itemEl = target.closest("[data-ohw-media-strip-item]");
21954
- if (!itemEl) return null;
21955
- const sectionEl2 = itemEl.closest("[data-ohw-section]");
21956
- const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
21957
- const sectionId = unit ? instanceIdOf(unit) || null : null;
21958
- const index = Number(itemEl.dataset.ohwMediaStripIndex);
21959
- if (!sectionId || Number.isNaN(index)) return null;
21960
- return { sectionId, index };
21961
- }
21962
- function sameRef(a, b) {
21963
- return a?.sectionId === b?.sectionId && a?.index === b?.index;
21964
- }
21965
- function rectOf(el) {
21376
+ function readRect2(ref) {
21377
+ const el = ref && findMediaStripItemElement(ref.sectionId, ref.index);
21966
21378
  if (!el) return null;
21967
21379
  const r2 = el.getBoundingClientRect();
21968
21380
  if (r2.width <= 0 || r2.height <= 0) return null;
21969
21381
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
21970
21382
  }
21971
- function readRect2(ref) {
21972
- return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
21973
- }
21974
- function readStripRect(ref) {
21975
- const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
21976
- return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
21977
- }
21978
- function useLiveItemRect(ref, strip = false) {
21383
+ function useLiveItemRect(ref) {
21979
21384
  const [rect, setRect] = (0, import_react15.useState)(null);
21980
21385
  (0, import_react15.useEffect)(() => {
21981
21386
  if (!ref) {
@@ -21983,7 +21388,7 @@ function useLiveItemRect(ref, strip = false) {
21983
21388
  return;
21984
21389
  }
21985
21390
  const update = () => {
21986
- const next = strip ? readStripRect(ref) : readRect2(ref);
21391
+ const next = readRect2(ref);
21987
21392
  setRect(
21988
21393
  (prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
21989
21394
  );
@@ -21998,49 +21403,9 @@ function useLiveItemRect(ref, strip = false) {
21998
21403
  window.removeEventListener("resize", update);
21999
21404
  clearInterval(interval);
22000
21405
  };
22001
- }, [ref?.sectionId, ref?.index, strip]);
21406
+ }, [ref?.sectionId, ref?.index]);
22002
21407
  return rect;
22003
21408
  }
22004
- var TOOLBAR_STRIP_GAP = 52;
22005
- var TOOLBAR_STRIP_GAP_MOBILE = 42;
22006
- var TOOLBAR_EDGE_MARGIN2 = 4;
22007
- function StripToolbarSlot({ stripRect, children }) {
22008
- const slotRef = (0, import_react15.useRef)(null);
22009
- const [shift, setShift] = (0, import_react15.useState)(0);
22010
- const centerX = stripRect.left + stripRect.width / 2;
22011
- (0, import_react15.useLayoutEffect)(() => {
22012
- const slot = slotRef.current;
22013
- if (!slot) return;
22014
- const clamp = () => {
22015
- const w = slot.offsetWidth;
22016
- if (w <= 0) return;
22017
- const half = w / 2;
22018
- const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
22019
- setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
22020
- };
22021
- clamp();
22022
- const ro = new ResizeObserver(clamp);
22023
- ro.observe(slot);
22024
- return () => ro.disconnect();
22025
- }, [centerX, children]);
22026
- const mobile = window.innerWidth <= 480;
22027
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
22028
- "div",
22029
- {
22030
- ref: slotRef,
22031
- "data-ohw-bridge": "",
22032
- "data-ohw-item-interaction": "",
22033
- className: "pointer-events-auto fixed",
22034
- style: {
22035
- top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
22036
- left: centerX + shift,
22037
- transform: "translate(-50%, -100%)",
22038
- zIndex: 2147483645
22039
- },
22040
- children
22041
- }
22042
- );
22043
- }
22044
21409
  function requestValidateTree(postToParent2, tree) {
22045
21410
  return new Promise((resolve) => {
22046
21411
  const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
@@ -22077,72 +21442,116 @@ function requestAssetPick(postToParent2) {
22077
21442
  postToParent2({ type: "ow:asset-pick", id });
22078
21443
  });
22079
21444
  }
22080
- function ToolbarAction({
21445
+ function Pill({
22081
21446
  label,
22082
21447
  onClick,
22083
- disabled = false,
22084
- active = false,
22085
- children
21448
+ disabled,
21449
+ active
22086
21450
  }) {
22087
- const button = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
22088
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
22089
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: button }) : button }),
22090
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
22091
- ] });
22092
- }
22093
- function ToolbarSeparator() {
22094
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
21451
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21452
+ "button",
21453
+ {
21454
+ type: "button",
21455
+ onClick,
21456
+ disabled,
21457
+ style: {
21458
+ height: 28,
21459
+ padding: "0 10px",
21460
+ display: "inline-flex",
21461
+ alignItems: "center",
21462
+ gap: 4,
21463
+ borderRadius: 999,
21464
+ border: "none",
21465
+ cursor: disabled ? "default" : "pointer",
21466
+ background: active ? OHW_BLUE_DARK : "#ffffff",
21467
+ color: active ? "#ffffff" : OHW_BLUE_DARK,
21468
+ opacity: disabled ? 0.4 : 1,
21469
+ fontSize: 12,
21470
+ lineHeight: "16px",
21471
+ fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
21472
+ whiteSpace: "nowrap",
21473
+ flex: "0 0 auto"
21474
+ },
21475
+ children: label
21476
+ }
21477
+ );
22095
21478
  }
22096
- function OptionMenu({
22097
- label,
22098
- value,
22099
- options,
22100
- onChange
22101
- }) {
22102
- const current = options.find((o) => o.value === value) ?? options[0];
22103
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
22104
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground", children: label }),
22105
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenu, { modal: false, children: [
22106
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
22107
- "button",
22108
- {
22109
- type: "button",
22110
- "aria-label": label,
22111
- className: "inline-flex h-8 min-w-[76px] items-center gap-[7px] rounded-[6px] bg-transparent px-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted data-[state=open]:bg-muted",
22112
- children: [
22113
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex-1 text-left", children: current.label }),
22114
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
22115
- ]
22116
- }
22117
- ) }),
22118
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
22119
- const selected = option.value === value;
22120
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
22121
- DropdownMenuItem,
21479
+ function AltInput({ value, onCommit }) {
21480
+ const [draft, setDraft] = (0, import_react15.useState)(value);
21481
+ (0, import_react15.useEffect)(() => setDraft(value), [value]);
21482
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
21483
+ "div",
21484
+ {
21485
+ style: {
21486
+ display: "flex",
21487
+ alignItems: "center",
21488
+ gap: 6,
21489
+ height: 28,
21490
+ padding: "0 12px",
21491
+ borderRadius: 999,
21492
+ background: "#ffffff",
21493
+ width: "100%",
21494
+ maxWidth: 260,
21495
+ boxSizing: "border-box"
21496
+ },
21497
+ children: [
21498
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21499
+ "span",
22122
21500
  {
22123
- role: "menuitemradio",
22124
- "aria-checked": selected,
22125
- onSelect: () => onChange(option.value),
22126
- className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
22127
- children: [
22128
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: option.label }),
22129
- selected && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Check, { size: 16, className: "text-bridge-primary" })
22130
- ]
22131
- },
22132
- option.value
22133
- );
22134
- }) })
22135
- ] })
22136
- ] });
21501
+ style: {
21502
+ flex: "0 0 auto",
21503
+ color: OHW_BLUE_DARK,
21504
+ fontSize: 10,
21505
+ fontWeight: 700,
21506
+ textTransform: "uppercase",
21507
+ letterSpacing: 0.4
21508
+ },
21509
+ children: "Alt"
21510
+ }
21511
+ ),
21512
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21513
+ "input",
21514
+ {
21515
+ type: "text",
21516
+ value: draft,
21517
+ onChange: (e) => setDraft(e.target.value),
21518
+ onBlur: () => {
21519
+ if (draft !== value) onCommit(draft);
21520
+ },
21521
+ onKeyDown: (e) => {
21522
+ if (e.key === "Enter") e.currentTarget.blur();
21523
+ if (e.key === "Escape") {
21524
+ setDraft(value);
21525
+ e.currentTarget.blur();
21526
+ }
21527
+ },
21528
+ placeholder: "Describe this image",
21529
+ "aria-label": "Image alt text",
21530
+ style: {
21531
+ flex: 1,
21532
+ minWidth: 0,
21533
+ border: "none",
21534
+ outline: "none",
21535
+ background: "transparent",
21536
+ fontSize: 12,
21537
+ lineHeight: "16px",
21538
+ fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
21539
+ color: "#1f2937"
21540
+ }
21541
+ }
21542
+ )
21543
+ ]
21544
+ }
21545
+ );
22137
21546
  }
22138
21547
  var VARIANTS = [
22139
21548
  { value: "logos", label: "Logos" },
22140
21549
  { value: "reel", label: "Reel" }
22141
21550
  ];
22142
21551
  var ALIGNS = [
22143
- { value: "left", label: "Align left", Icon: import_lucide_react10.AlignLeft },
22144
- { value: "center", label: "Align center", Icon: import_lucide_react10.AlignCenter },
22145
- { value: "right", label: "Align right", Icon: import_lucide_react10.AlignRight }
21552
+ { value: "left", label: "Left" },
21553
+ { value: "center", label: "Center" },
21554
+ { value: "right", label: "Right" }
22146
21555
  ];
22147
21556
  var HOVERS = [
22148
21557
  { value: "none", label: "None" },
@@ -22150,104 +21559,104 @@ var HOVERS = [
22150
21559
  { value: "zoom", label: "Zoom" },
22151
21560
  { value: "fade", label: "Fade" }
22152
21561
  ];
21562
+ var TREATMENTS = [
21563
+ { value: "color", label: "Color" },
21564
+ { value: "grayscale", label: "Grayscale" }
21565
+ ];
22153
21566
  var HTTP_URL_RE = /^https?:\/\/\S+$/i;
22154
- function LinkModal({
22155
- href,
22156
- linkTarget,
22157
- onClose,
22158
- onSave
22159
- }) {
22160
- const [draft, setDraft] = (0, import_react15.useState)(href);
22161
- const [newTab, setNewTab] = (0, import_react15.useState)(linkTarget !== "same-tab");
21567
+ function LinkInput({ value, onCommit }) {
21568
+ const [draft, setDraft] = (0, import_react15.useState)(value);
22162
21569
  const [invalid, setInvalid] = (0, import_react15.useState)(false);
22163
- const save = () => {
21570
+ (0, import_react15.useEffect)(() => {
21571
+ setDraft(value);
21572
+ setInvalid(false);
21573
+ }, [value]);
21574
+ const commit2 = () => {
22164
21575
  const next = draft.trim();
22165
- if (next && !HTTP_URL_RE.test(next)) {
22166
- setInvalid(true);
22167
- return;
22168
- }
22169
- onSave(next, newTab ? "new-tab" : "same-tab");
22170
- onClose();
21576
+ if (next === value) return setInvalid(false);
21577
+ if (next && !HTTP_URL_RE.test(next)) return setInvalid(true);
21578
+ setInvalid(false);
21579
+ onCommit(next);
22171
21580
  };
22172
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Dialog2, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DialogContent, { "data-ohw-link-modal-root": "", className: "max-w-[400px] gap-4 p-5", children: [
22173
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DialogTitle, { className: "text-base", children: "Image link" }) }),
22174
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col gap-3", children: [
22175
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
22176
- "input",
22177
- {
22178
- autoFocus: true,
22179
- type: "text",
22180
- inputMode: "url",
22181
- value: draft,
22182
- onChange: (e) => {
22183
- setDraft(e.target.value);
22184
- setInvalid(false);
22185
- },
22186
- onKeyDown: (e) => {
22187
- if (e.key === "Enter") save();
22188
- },
22189
- placeholder: "https://example.com",
22190
- "aria-label": "Image link URL",
22191
- "aria-invalid": invalid,
22192
- className: cn(
22193
- "h-9 w-full rounded-[6px] border border-border bg-background px-3 text-[13px] text-foreground outline-none placeholder:text-muted-foreground/70 focus:border-bridge-primary",
22194
- invalid && "border-destructive focus:border-destructive"
22195
- )
22196
- }
22197
- ),
22198
- invalid && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
22199
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
22200
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
22201
- "Open in new tab"
22202
- ] })
22203
- ] }),
22204
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DialogFooter, { children: [
22205
- href && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
22206
- "button",
22207
- {
22208
- type: "button",
22209
- onClick: () => {
22210
- onSave("", "new-tab");
22211
- onClose();
22212
- },
22213
- className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
22214
- children: "Remove link"
22215
- }
22216
- ),
22217
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
22218
- "button",
22219
- {
22220
- type: "button",
22221
- onClick: onClose,
22222
- className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
22223
- children: "Cancel"
22224
- }
22225
- ),
22226
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
22227
- "button",
22228
- {
22229
- type: "button",
22230
- onClick: save,
22231
- className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
22232
- children: "Save"
22233
- }
22234
- )
22235
- ] })
22236
- ] }) });
21581
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
21582
+ "div",
21583
+ {
21584
+ style: {
21585
+ display: "flex",
21586
+ alignItems: "center",
21587
+ gap: 6,
21588
+ height: 28,
21589
+ padding: "0 12px",
21590
+ borderRadius: 999,
21591
+ background: "#ffffff",
21592
+ width: "100%",
21593
+ maxWidth: 260,
21594
+ boxSizing: "border-box",
21595
+ boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
21596
+ },
21597
+ children: [
21598
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21599
+ "span",
21600
+ {
21601
+ style: {
21602
+ flex: "0 0 auto",
21603
+ color: OHW_BLUE_DARK,
21604
+ fontSize: 10,
21605
+ fontWeight: 700,
21606
+ textTransform: "uppercase",
21607
+ letterSpacing: 0.4
21608
+ },
21609
+ children: "Link"
21610
+ }
21611
+ ),
21612
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21613
+ "input",
21614
+ {
21615
+ type: "text",
21616
+ inputMode: "url",
21617
+ value: draft,
21618
+ onChange: (e) => setDraft(e.target.value),
21619
+ onBlur: commit2,
21620
+ onKeyDown: (e) => {
21621
+ if (e.key === "Enter") e.currentTarget.blur();
21622
+ if (e.key === "Escape") {
21623
+ setDraft(value);
21624
+ setInvalid(false);
21625
+ e.currentTarget.blur();
21626
+ }
21627
+ },
21628
+ placeholder: "https://example.com",
21629
+ "aria-label": "Image link URL",
21630
+ "aria-invalid": invalid,
21631
+ style: {
21632
+ flex: 1,
21633
+ minWidth: 0,
21634
+ border: "none",
21635
+ outline: "none",
21636
+ background: "transparent",
21637
+ fontSize: 12,
21638
+ lineHeight: "16px",
21639
+ fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
21640
+ color: "#1f2937"
21641
+ }
21642
+ }
21643
+ )
21644
+ ]
21645
+ }
21646
+ );
22237
21647
  }
22238
21648
  function MediaStripToolbar({
22239
21649
  entry,
22240
21650
  index,
22241
21651
  pending,
22242
21652
  error,
22243
- itemEditOn,
22244
- onToggleItemEdit,
22245
21653
  onSetVariant,
22246
21654
  onSetAlign,
22247
21655
  onSetHover,
22248
21656
  onSetTreatment,
22249
21657
  onResize,
22250
- onOpenLink,
21658
+ onSetAlt,
21659
+ onSetLink,
22251
21660
  onAddItem,
22252
21661
  onRemoveItem,
22253
21662
  onChangeImage,
@@ -22256,102 +21665,81 @@ function MediaStripToolbar({
22256
21665
  }) {
22257
21666
  const items = mediaStripItems(entry.tree);
22258
21667
  const itemCount = items.length;
21668
+ const currentAlt = items[index]?.alt ?? "";
21669
+ const currentHref2 = items[index]?.href ?? "";
21670
+ const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
22259
21671
  const slots = findMediaStripSlots(entry.tree);
22260
21672
  const variant = slots?.variant === "reel" ? "reel" : "logos";
22261
21673
  const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
22262
21674
  const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
22263
21675
  const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
22264
21676
  const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
22265
- const mobile = window.innerWidth <= 480;
22266
- const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
22267
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
21677
+ const isMobile = window.innerWidth <= 480;
21678
+ const rowStyle = isMobile ? {
21679
+ display: "flex",
21680
+ gap: 6,
21681
+ flexWrap: "nowrap",
21682
+ justifyContent: "center",
21683
+ overflowX: "auto",
21684
+ WebkitOverflowScrolling: "touch",
21685
+ width: "100%",
21686
+ scrollbarWidth: "none"
21687
+ } : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
21688
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
22268
21689
  "div",
22269
21690
  {
22270
21691
  "data-ohw-bridge": "",
22271
21692
  "data-ohw-toolbar": "",
22272
21693
  onMouseDown: (e) => e.stopPropagation(),
22273
- className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
22274
- style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
21694
+ style: {
21695
+ display: "flex",
21696
+ flexDirection: "column",
21697
+ gap: 6,
21698
+ alignItems: "center",
21699
+ background: OHW_BLUE,
21700
+ padding: 8,
21701
+ borderRadius: 12,
21702
+ boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
21703
+ pointerEvents: pending ? "none" : "auto",
21704
+ opacity: pending ? 0.6 : 1,
21705
+ maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
21706
+ },
22275
21707
  children: [
22276
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
22277
- "div",
22278
- {
22279
- className: cn(
22280
- "flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
22281
- "shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
22282
- mobile ? "flex-wrap justify-center" : "flex-nowrap"
22283
- ),
22284
- children: [
22285
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
22286
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
22287
- CustomToolbarButton,
22288
- {
22289
- type: "button",
22290
- "aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
22291
- "aria-pressed": itemEditOn,
22292
- onClick: onToggleItemEdit,
22293
- className: "group size-8",
22294
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
22295
- import_lucide_react10.Star,
22296
- {
22297
- size: 16,
22298
- fill: "currentColor",
22299
- strokeWidth: 0,
22300
- className: cn(
22301
- "transition-colors",
22302
- itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
22303
- ),
22304
- style: { pointerEvents: "none" }
22305
- }
22306
- )
22307
- }
22308
- ) }),
22309
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
22310
- ] }),
22311
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator, {}),
22312
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Image, { size: 16, style: { pointerEvents: "none" } }) }),
22313
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Link, { size: 16, style: { pointerEvents: "none" } }) }),
22314
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ArrowLeft, { size: 16, style: { pointerEvents: "none" } }) }),
22315
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
22316
- ToolbarAction,
22317
- {
22318
- label: gatedLabel("Move right"),
22319
- onClick: onMoveRight,
22320
- disabled: !itemEditOn || index >= itemCount - 1,
22321
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ArrowRight, { size: 16, style: { pointerEvents: "none" } })
22322
- }
22323
- ),
22324
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
22325
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator, {}),
22326
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
22327
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
22328
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
22329
- ToolbarAction,
22330
- {
22331
- label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
22332
- active: treatment === "grayscale",
22333
- onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
22334
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Palette, { size: 16, style: { pointerEvents: "none" } })
22335
- }
22336
- ),
22337
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator, {}),
22338
- ALIGNS.map(({ value, label, Icon }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction, { label, active: align === value, onClick: () => onSetAlign(value), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon, { size: 16, style: { pointerEvents: "none" } }) }, value)),
22339
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator, {}),
22340
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Minus, { size: 16, style: { pointerEvents: "none" } }) }),
22341
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
22342
- sizeValue,
22343
- "px"
22344
- ] }),
22345
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
22346
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator, {}),
22347
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
22348
- ]
22349
- }
22350
- ),
22351
- error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
21708
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: rowStyle, children: [
21709
+ VARIANTS.map((v) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Pill, { label: v.label, active: variant === v.value, onClick: () => onSetVariant(v.value) }, v.value)),
21710
+ ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Pill, { label: a.label, active: align === a.value, onClick: () => onSetAlign(a.value) }, a.value))
21711
+ ] }),
21712
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: rowStyle, children: [
21713
+ HOVERS.map((h) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Pill, { label: h.label, active: hover === h.value, onClick: () => onSetHover(h.value) }, h.value)),
21714
+ TREATMENTS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Pill, { label: t.label, active: treatment === t.value, onClick: () => onSetTreatment(t.value) }, t.value))
21715
+ ] }),
21716
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
21717
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Pill, { label: "\u2212", onClick: () => onResize(-8) }),
21718
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { style: { color: "#ffffff", fontSize: 12, minWidth: 34, textAlign: "center" }, children: [
21719
+ sizeValue,
21720
+ "px"
21721
+ ] }),
21722
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Pill, { label: "+", onClick: () => onResize(8) })
21723
+ ] }),
21724
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AltInput, { value: currentAlt, onCommit: onSetAlt }) }),
21725
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(LinkInput, { value: currentHref2, onCommit: (href) => onSetLink(href, currentTarget) }) }),
21726
+ currentHref2 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: rowStyle, children: [
21727
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Pill, { label: "New tab", active: currentTarget === "new-tab", onClick: () => onSetLink(currentHref2, "new-tab") }),
21728
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Pill, { label: "Same tab", active: currentTarget === "same-tab", onClick: () => onSetLink(currentHref2, "same-tab") })
21729
+ ] }),
21730
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: rowStyle, children: [
21731
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Pill, { label: "Change Image", onClick: onChangeImage }),
21732
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Pill, { label: "+ Item", onClick: onAddItem }),
21733
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Pill, { label: "\u2212 Item", onClick: onRemoveItem, disabled: itemCount <= 1 })
21734
+ ] }),
21735
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: rowStyle, children: [
21736
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Pill, { label: "\u2190 Move", onClick: onMoveLeft, disabled: index <= 0 }),
21737
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Pill, { label: "\u2192 Move", onClick: onMoveRight, disabled: index >= itemCount - 1 })
21738
+ ] }),
21739
+ error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
22352
21740
  ]
22353
21741
  }
22354
- ) });
21742
+ );
22355
21743
  }
22356
21744
  function findMediaStripSlots(tree) {
22357
21745
  const stack = tree.rows.flatMap((row) => row.blocks);
@@ -22370,23 +21758,31 @@ function AiMediaStripOverlay({
22370
21758
  }) {
22371
21759
  const [hover, setHover] = (0, import_react15.useState)(null);
22372
21760
  const [active, setActive] = (0, import_react15.useState)(null);
22373
- const [itemEditOn, setItemEditOn] = (0, import_react15.useState)(false);
22374
- const [linkOpen, setLinkOpen] = (0, import_react15.useState)(false);
22375
21761
  const [pending, setPending] = (0, import_react15.useState)(false);
22376
21762
  const [error, setError] = (0, import_react15.useState)(null);
22377
21763
  const activeRef = (0, import_react15.useRef)(null);
22378
21764
  activeRef.current = active;
22379
- const linkOpenRef = (0, import_react15.useRef)(false);
22380
- linkOpenRef.current = linkOpen;
22381
21765
  (0, import_react15.useEffect)(() => {
22382
21766
  const onMove = (e) => {
22383
- const ref = itemRefFromTarget(e.target);
22384
21767
  const t = e.target;
22385
- const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
22386
- setHover((prev) => {
22387
- const next = ref && !overEditable ? ref : null;
22388
- return sameRef(prev, next) ? prev : next;
22389
- });
21768
+ if (!(t instanceof HTMLElement)) return;
21769
+ if (t.closest("[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review]")) {
21770
+ return;
21771
+ }
21772
+ const itemEl = t.closest("[data-ohw-media-strip-item]");
21773
+ if (!itemEl) {
21774
+ setHover(null);
21775
+ return;
21776
+ }
21777
+ const sectionEl2 = itemEl.closest("[data-ohw-section]");
21778
+ const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
21779
+ const sectionId = unit ? instanceIdOf(unit) || null : null;
21780
+ const index = Number(itemEl.dataset.ohwMediaStripIndex);
21781
+ if (!sectionId || Number.isNaN(index)) {
21782
+ setHover(null);
21783
+ return;
21784
+ }
21785
+ setHover({ sectionId, index });
22390
21786
  };
22391
21787
  const onLeave = () => setHover(null);
22392
21788
  document.addEventListener("mousemove", onMove, { passive: true });
@@ -22398,25 +21794,23 @@ function AiMediaStripOverlay({
22398
21794
  }, []);
22399
21795
  (0, import_react15.useEffect)(() => {
22400
21796
  const onClick = (e) => {
21797
+ const current = activeRef.current;
21798
+ if (!current) return;
22401
21799
  const t = e.target;
22402
- if (!(t instanceof Element)) return;
22403
- if (t.closest(CHROME_SELECTOR)) return;
22404
- const ref = itemRefFromTarget(t);
22405
- if (sameRef(activeRef.current, ref)) return;
22406
- if (ref) clearInteractionChromeRef.current();
22407
- setItemEditOn(false);
21800
+ if (!(t instanceof HTMLElement)) return;
21801
+ if (t.closest("[data-ohw-item-interaction]")) return;
21802
+ const itemEl = findMediaStripItemElement(current.sectionId, current.index);
21803
+ if (itemEl && itemEl.contains(t)) return;
21804
+ setActive(null);
22408
21805
  setError(null);
22409
- setActive(ref);
22410
21806
  };
22411
21807
  document.addEventListener("click", onClick, true);
22412
21808
  return () => document.removeEventListener("click", onClick, true);
22413
- }, [clearInteractionChromeRef]);
21809
+ }, []);
22414
21810
  (0, import_react15.useEffect)(() => {
22415
21811
  const onBlur = () => {
22416
21812
  if (!activeRef.current) return;
22417
21813
  setActive(null);
22418
- setItemEditOn(false);
22419
- setLinkOpen(false);
22420
21814
  setError(null);
22421
21815
  };
22422
21816
  window.addEventListener("blur", onBlur);
@@ -22426,10 +21820,7 @@ function AiMediaStripOverlay({
22426
21820
  const onKeyDown = (e) => {
22427
21821
  if (e.key !== "Escape") return;
22428
21822
  if (!activeRef.current) return;
22429
- if (linkOpenRef.current) return;
22430
- if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
22431
21823
  setActive(null);
22432
- setItemEditOn(false);
22433
21824
  setError(null);
22434
21825
  };
22435
21826
  document.addEventListener("keydown", onKeyDown);
@@ -22463,133 +21854,137 @@ function AiMediaStripOverlay({
22463
21854
  tree: nextTree,
22464
21855
  label: entry.label,
22465
21856
  media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
22466
- ...entry.brand ? { brand: entry.brand } : {},
22467
- // The user is already looking at the strip they just edited — recentering the viewport
22468
- // on every edit reads as the section jumping around.
22469
- skipScrollIntoView: true
21857
+ ...entry.brand ? { brand: entry.brand } : {}
22470
21858
  });
22471
21859
  return true;
22472
21860
  },
22473
21861
  [findEntry, postToParent2, applyTreeLocalRef]
22474
21862
  );
22475
21863
  const activeEntry = active ? findEntry(active.sectionId) : null;
21864
+ const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
22476
21865
  const activeItemRect = useLiveItemRect(active);
22477
- const activeStripRect = useLiveItemRect(active, true);
22478
- const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
22479
- const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
22480
- const activeItem = active ? activeItems[active.index] : void 0;
22481
- const activeHref = activeItem?.href ?? "";
22482
- const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
22483
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
22484
- hoverRect && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
22485
- activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
22486
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
22487
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
22488
- MediaStripToolbar,
22489
- {
22490
- entry: activeEntry,
22491
- index: active.index,
22492
- pending,
22493
- error,
22494
- itemEditOn,
22495
- onToggleItemEdit: () => setItemEditOn((on) => !on),
22496
- onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
22497
- onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
22498
- onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
22499
- onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
22500
- onResize: (delta) => {
22501
- const slots = findMediaStripSlots(activeEntry.tree);
22502
- const variant = slots?.variant === "reel" ? "reel" : "logos";
22503
- const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
22504
- void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
22505
- },
22506
- onOpenLink: () => setLinkOpen(true),
22507
- onAddItem: () => {
22508
- void requestAssetPick(postToParent2).then((picked) => {
22509
- if (!picked) return;
22510
- const item = { assetId: picked.assetId, alt: "Logo" };
21866
+ const TOOLBAR_APPROX_H = 170;
21867
+ const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
21868
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
21869
+ hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21870
+ "button",
21871
+ {
21872
+ type: "button",
21873
+ "data-ohw-toolbar": "",
21874
+ onClick: () => {
21875
+ clearInteractionChromeRef.current();
21876
+ setActive(hover);
21877
+ },
21878
+ "aria-label": "Configure media item",
21879
+ style: {
21880
+ position: "fixed",
21881
+ top: hoverHandleRect.top + 8,
21882
+ left: hoverHandleRect.left + hoverHandleRect.width - 36,
21883
+ width: 28,
21884
+ height: 28,
21885
+ borderRadius: 8,
21886
+ border: `1.5px dashed ${PRIMARY3}`,
21887
+ background: "#ffffff",
21888
+ color: PRIMARY3,
21889
+ display: "flex",
21890
+ alignItems: "center",
21891
+ justifyContent: "center",
21892
+ cursor: "pointer",
21893
+ zIndex: 2147483643,
21894
+ fontSize: 14,
21895
+ fontWeight: 700
21896
+ },
21897
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Star, { size: 14, style: { pointerEvents: "none" } })
21898
+ }
21899
+ ),
21900
+ activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21901
+ ItemInteractionLayer,
21902
+ {
21903
+ rect: activeItemRect,
21904
+ state: toolbarState,
21905
+ toolbar: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21906
+ MediaStripToolbar,
21907
+ {
21908
+ entry: activeEntry,
21909
+ index: active.index,
21910
+ pending,
21911
+ error,
21912
+ onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
21913
+ onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
21914
+ onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
21915
+ onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
21916
+ onResize: (delta) => {
21917
+ const slots = findMediaStripSlots(activeEntry.tree);
21918
+ const variant = slots?.variant === "reel" ? "reel" : "logos";
21919
+ const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
21920
+ void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
21921
+ },
21922
+ onSetAlt: (alt) => {
21923
+ void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
21924
+ },
21925
+ onSetLink: (href, linkTarget) => {
22511
21926
  void runMutation(
22512
21927
  active.sectionId,
22513
- (tree) => addMediaStripItem(tree, item, active.index),
22514
- { [picked.assetId]: picked.url }
22515
- ).then((applied) => {
22516
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
21928
+ (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
21929
+ );
21930
+ },
21931
+ onAddItem: () => {
21932
+ void requestAssetPick(postToParent2).then((picked) => {
21933
+ if (!picked) return;
21934
+ const item = { assetId: picked.assetId, alt: "Logo" };
21935
+ void runMutation(
21936
+ active.sectionId,
21937
+ (tree) => addMediaStripItem(tree, item, active.index),
21938
+ { [picked.assetId]: picked.url }
21939
+ ).then((applied) => {
21940
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
21941
+ });
22517
21942
  });
22518
- });
22519
- },
22520
- onChangeImage: () => {
22521
- void requestAssetPick(postToParent2).then((picked) => {
22522
- if (!picked) return;
22523
- void runMutation(
22524
- active.sectionId,
22525
- (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
22526
- { [picked.assetId]: picked.url }
21943
+ },
21944
+ onChangeImage: () => {
21945
+ void requestAssetPick(postToParent2).then((picked) => {
21946
+ if (!picked) return;
21947
+ void runMutation(
21948
+ active.sectionId,
21949
+ (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
21950
+ { [picked.assetId]: picked.url }
21951
+ );
21952
+ });
21953
+ },
21954
+ onRemoveItem: () => {
21955
+ void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
21956
+ (applied) => {
21957
+ if (applied) setActive(null);
21958
+ }
22527
21959
  );
22528
- });
22529
- },
22530
- onRemoveItem: () => {
22531
- void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
22532
- (applied) => {
22533
- if (applied) setActive(null);
22534
- }
22535
- );
22536
- },
22537
- onMoveLeft: () => {
22538
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
22539
- (applied) => {
22540
- if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
22541
- }
22542
- );
22543
- },
22544
- onMoveRight: () => {
22545
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
22546
- (applied) => {
22547
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
22548
- }
22549
- );
22550
- }
22551
- }
22552
- ) }),
22553
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
22554
- "div",
22555
- {
22556
- "data-ohw-bridge": "",
22557
- "data-ohw-item-interaction": "",
22558
- "aria-hidden": true,
22559
- className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
22560
- style: {
22561
- top: activeItemRect.top + activeItemRect.height + 10,
22562
- left: activeItemRect.left - 5,
22563
- background: PRIMARY3,
22564
- zIndex: 2147483644
22565
- },
22566
- children: "Media item"
22567
- }
22568
- ),
22569
- linkOpen && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
22570
- LinkModal,
22571
- {
22572
- href: activeHref,
22573
- linkTarget: activeTarget,
22574
- onClose: () => setLinkOpen(false),
22575
- onSave: (href, linkTarget) => {
22576
- void runMutation(
22577
- active.sectionId,
22578
- (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
22579
- );
21960
+ },
21961
+ onMoveLeft: () => {
21962
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
21963
+ (applied) => {
21964
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
21965
+ }
21966
+ );
21967
+ },
21968
+ onMoveRight: () => {
21969
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
21970
+ (applied) => {
21971
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
21972
+ }
21973
+ );
21974
+ }
22580
21975
  }
22581
- }
22582
- )
22583
- ] })
21976
+ )
21977
+ }
21978
+ )
22584
21979
  ] });
22585
21980
  }
22586
21981
 
22587
21982
  // src/ui/ai-section/AiPricingCardOverlay.tsx
22588
21983
  var import_react16 = require("react");
22589
- var import_lucide_react11 = require("lucide-react");
22590
- var import_jsx_runtime23 = require("react/jsx-runtime");
21984
+ var import_lucide_react10 = require("lucide-react");
21985
+ var import_jsx_runtime22 = require("react/jsx-runtime");
22591
21986
  var PRIMARY4 = "var(--ohw-primary, #0885FE)";
22592
- var CHROME_SELECTOR2 = "[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review], [data-ohw-more-menu]";
21987
+ var CHROME_SELECTOR = "[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review], [data-ohw-more-menu]";
22593
21988
  function findPricingCardElement(sectionId, index) {
22594
21989
  const sectionEl2 = findByInstanceId(sectionId);
22595
21990
  if (!sectionEl2) return null;
@@ -22601,7 +21996,7 @@ function findPricingCardElement(sectionId, index) {
22601
21996
  }
22602
21997
  function cardRefFromTarget(target) {
22603
21998
  if (!(target instanceof Element)) return null;
22604
- if (target.closest(CHROME_SELECTOR2)) return null;
21999
+ if (target.closest(CHROME_SELECTOR)) return null;
22605
22000
  const cardEl = target.closest("[data-ohw-pricing-card]");
22606
22001
  if (!cardEl) return null;
22607
22002
  const sectionEl2 = cardEl.closest("[data-ohw-section]");
@@ -22611,21 +22006,21 @@ function cardRefFromTarget(target) {
22611
22006
  if (!sectionId || Number.isNaN(index)) return null;
22612
22007
  return { sectionId, index };
22613
22008
  }
22614
- function sameRef2(a, b) {
22009
+ function sameRef(a, b) {
22615
22010
  return a?.sectionId === b?.sectionId && a?.index === b?.index;
22616
22011
  }
22617
- function rectOf2(el) {
22012
+ function rectOf(el) {
22618
22013
  if (!el) return null;
22619
22014
  const r2 = el.getBoundingClientRect();
22620
22015
  if (r2.width <= 0 || r2.height <= 0) return null;
22621
22016
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
22622
22017
  }
22623
22018
  function readRect3(ref) {
22624
- return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
22019
+ return rectOf(ref && findPricingCardElement(ref.sectionId, ref.index));
22625
22020
  }
22626
22021
  function readGridRect(ref) {
22627
22022
  const card = ref && findPricingCardElement(ref.sectionId, ref.index);
22628
- return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
22023
+ return rectOf(card?.closest("[data-ohw-pricing-collection]") ?? card);
22629
22024
  }
22630
22025
  function useLiveCardRect(ref, grid = false) {
22631
22026
  const [rect, setRect] = (0, import_react16.useState)(null);
@@ -22655,7 +22050,7 @@ function useLiveCardRect(ref, grid = false) {
22655
22050
  }
22656
22051
  var TOOLBAR_GRID_GAP = 52;
22657
22052
  var TOOLBAR_GRID_GAP_MOBILE = 42;
22658
- var TOOLBAR_EDGE_MARGIN3 = 4;
22053
+ var TOOLBAR_EDGE_MARGIN2 = 4;
22659
22054
  function GridToolbarSlot({ gridRect, children }) {
22660
22055
  const slotRef = (0, import_react16.useRef)(null);
22661
22056
  const [shift, setShift] = (0, import_react16.useState)(0);
@@ -22667,7 +22062,7 @@ function GridToolbarSlot({ gridRect, children }) {
22667
22062
  const w = slot.offsetWidth;
22668
22063
  if (w <= 0) return;
22669
22064
  const half = w / 2;
22670
- const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
22065
+ const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
22671
22066
  setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
22672
22067
  };
22673
22068
  clamp();
@@ -22676,7 +22071,7 @@ function GridToolbarSlot({ gridRect, children }) {
22676
22071
  return () => ro.disconnect();
22677
22072
  }, [centerX, children]);
22678
22073
  const mobile = window.innerWidth <= 480;
22679
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
22074
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
22680
22075
  "div",
22681
22076
  {
22682
22077
  ref: slotRef,
@@ -22711,7 +22106,7 @@ function requestValidateTree2(postToParent2, tree) {
22711
22106
  });
22712
22107
  }
22713
22108
  function StyleSwatch({ style }) {
22714
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
22109
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
22715
22110
  "span",
22716
22111
  {
22717
22112
  "aria-hidden": true,
@@ -22725,35 +22120,35 @@ function StyleSwatch({ style }) {
22725
22120
  );
22726
22121
  }
22727
22122
  function ButtonGlyph() {
22728
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
22729
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
22730
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
22123
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
22124
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
22125
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
22731
22126
  ] });
22732
22127
  }
22733
22128
  function FeatureGlyph({ mode }) {
22734
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
22735
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
22736
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
22737
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
22738
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
22739
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
22740
- mode === "add" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
22129
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
22130
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
22131
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
22132
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
22133
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
22134
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
22135
+ mode === "add" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
22741
22136
  ] });
22742
22137
  }
22743
- function ToolbarAction2({
22138
+ function ToolbarAction({
22744
22139
  label,
22745
22140
  onClick,
22746
22141
  disabled = false,
22747
22142
  children
22748
22143
  }) {
22749
- const button = /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
22750
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Tooltip, { children: [
22751
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "inline-flex", children: button }) : button }),
22752
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
22144
+ const button = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
22145
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
22146
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: button }) : button }),
22147
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
22753
22148
  ] });
22754
22149
  }
22755
- function ToolbarSeparator2() {
22756
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
22150
+ function ToolbarSeparator() {
22151
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
22757
22152
  }
22758
22153
  function CardStyleMenu({
22759
22154
  value,
@@ -22761,7 +22156,7 @@ function CardStyleMenu({
22761
22156
  disabled = false
22762
22157
  }) {
22763
22158
  const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
22764
- const trigger = /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
22159
+ const trigger = /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
22765
22160
  "button",
22766
22161
  {
22767
22162
  type: "button",
@@ -22772,28 +22167,28 @@ function CardStyleMenu({
22772
22167
  disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
22773
22168
  ),
22774
22169
  children: [
22775
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(StyleSwatch, { style: current.value }),
22776
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "flex-1 text-left", children: current.label }),
22777
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
22170
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: current.value }),
22171
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex-1 text-left", children: current.label }),
22172
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
22778
22173
  ]
22779
22174
  }
22780
22175
  );
22781
22176
  if (disabled) {
22782
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
22783
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
22784
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Tooltip, { children: [
22785
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "inline-flex", children: trigger }) }),
22786
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
22177
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
22178
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
22179
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
22180
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: trigger }) }),
22181
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
22787
22182
  ] })
22788
22183
  ] });
22789
22184
  }
22790
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
22791
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
22792
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(DropdownMenu, { modal: false, children: [
22793
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DropdownMenuTrigger, { asChild: true, children: trigger }),
22794
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
22185
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
22186
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
22187
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenu, { modal: false, children: [
22188
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuTrigger, { asChild: true, children: trigger }),
22189
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
22795
22190
  const selected = style.value === value;
22796
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
22191
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
22797
22192
  DropdownMenuItem,
22798
22193
  {
22799
22194
  role: "menuitemradio",
@@ -22801,9 +22196,9 @@ function CardStyleMenu({
22801
22196
  onSelect: () => onChange(style.value),
22802
22197
  className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
22803
22198
  children: [
22804
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(StyleSwatch, { style: style.value }),
22805
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: style.label }),
22806
- selected && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Check, { size: 16, className: "text-bridge-primary" })
22199
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: style.value }),
22200
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: style.label }),
22201
+ selected && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Check, { size: 16, className: "text-bridge-primary" })
22807
22202
  ]
22808
22203
  },
22809
22204
  style.value
@@ -22833,7 +22228,7 @@ function PricingCardToolbar({
22833
22228
  const style = pricingCardStyle(entry.tree, index);
22834
22229
  const featuredTag = pricingCardFeaturedTag(entry.tree, index);
22835
22230
  const mobile = window.innerWidth <= 480;
22836
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
22231
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
22837
22232
  "div",
22838
22233
  {
22839
22234
  "data-ohw-bridge": "",
@@ -22845,7 +22240,7 @@ function PricingCardToolbar({
22845
22240
  ),
22846
22241
  style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
22847
22242
  children: [
22848
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
22243
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
22849
22244
  "div",
22850
22245
  {
22851
22246
  className: cn(
@@ -22854,8 +22249,8 @@ function PricingCardToolbar({
22854
22249
  mobile ? "flex-wrap justify-center" : "flex-nowrap"
22855
22250
  ),
22856
22251
  children: [
22857
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Tooltip, { children: [
22858
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
22252
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
22253
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
22859
22254
  CustomToolbarButton,
22860
22255
  {
22861
22256
  type: "button",
@@ -22863,8 +22258,8 @@ function PricingCardToolbar({
22863
22258
  "aria-pressed": featuredTag,
22864
22259
  onClick: () => onSetFeaturedTag(!featuredTag),
22865
22260
  className: "group size-8",
22866
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
22867
- import_lucide_react11.Star,
22261
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
22262
+ import_lucide_react10.Star,
22868
22263
  {
22869
22264
  size: 16,
22870
22265
  fill: "currentColor",
@@ -22878,25 +22273,25 @@ function PricingCardToolbar({
22878
22273
  )
22879
22274
  }
22880
22275
  ) }),
22881
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
22276
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
22882
22277
  ] }),
22883
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ToolbarSeparator2, {}),
22884
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
22885
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ToolbarSeparator2, {}),
22886
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ButtonGlyph, {}) }),
22887
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ToolbarAction2, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "relative inline-flex", children: [
22888
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ButtonGlyph, {}),
22889
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Minus, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
22278
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator, {}),
22279
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
22280
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator, {}),
22281
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}) }),
22282
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "relative inline-flex", children: [
22283
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}),
22284
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Minus, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
22890
22285
  ] }) }),
22891
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ToolbarAction2, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(FeatureGlyph, { mode: "add" }) }),
22892
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ToolbarAction2, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(FeatureGlyph, { mode: "remove" }) }),
22893
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ToolbarSeparator2, {}),
22894
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ToolbarAction2, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
22895
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ToolbarAction2, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Minus, { size: 16, style: { pointerEvents: "none" } }) })
22286
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FeatureGlyph, { mode: "add" }) }),
22287
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FeatureGlyph, { mode: "remove" }) }),
22288
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator, {}),
22289
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
22290
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Minus, { size: 16, style: { pointerEvents: "none" } }) })
22896
22291
  ]
22897
22292
  }
22898
22293
  ),
22899
- error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
22294
+ error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
22900
22295
  ]
22901
22296
  }
22902
22297
  ) });
@@ -22930,7 +22325,7 @@ function AiPricingCardOverlay({
22930
22325
  const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
22931
22326
  setHover((prev) => {
22932
22327
  const next = ref && !overEditable ? ref : null;
22933
- return sameRef2(prev, next) ? prev : next;
22328
+ return sameRef(prev, next) ? prev : next;
22934
22329
  });
22935
22330
  };
22936
22331
  const onLeave = () => setHover(null);
@@ -22945,10 +22340,10 @@ function AiPricingCardOverlay({
22945
22340
  const onClick = (e) => {
22946
22341
  const t = e.target;
22947
22342
  if (!(t instanceof Element)) return;
22948
- if (t.closest(CHROME_SELECTOR2)) return;
22343
+ if (t.closest(CHROME_SELECTOR)) return;
22949
22344
  const ref = cardRefFromTarget(t);
22950
- setActive((prev) => sameRef2(prev, ref) ? prev : ref);
22951
- if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
22345
+ setActive((prev) => sameRef(prev, ref) ? prev : ref);
22346
+ if (!ref || !sameRef(activeRef.current, ref)) setError(null);
22952
22347
  };
22953
22348
  document.addEventListener("click", onClick, true);
22954
22349
  return () => document.removeEventListener("click", onClick, true);
@@ -23013,12 +22408,12 @@ function AiPricingCardOverlay({
23013
22408
  const activeEntry = active ? findEntry(active.sectionId) : null;
23014
22409
  const activeCardRect = useLiveCardRect(active);
23015
22410
  const activeGridRect = useLiveCardRect(active, true);
23016
- const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
23017
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
23018
- hoverRect && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
23019
- activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
23020
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
23021
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
22411
+ const hoverRect = useLiveCardRect(hover && !sameRef(hover, active) ? hover : null);
22412
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
22413
+ hoverRect && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
22414
+ activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
22415
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
22416
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
23022
22417
  PricingCardToolbar,
23023
22418
  {
23024
22419
  entry: activeEntry,
@@ -23046,7 +22441,7 @@ function AiPricingCardOverlay({
23046
22441
  onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
23047
22442
  }
23048
22443
  ) }),
23049
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
22444
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
23050
22445
  "div",
23051
22446
  {
23052
22447
  "data-ohw-bridge": "",
@@ -23068,7 +22463,7 @@ function AiPricingCardOverlay({
23068
22463
 
23069
22464
  // src/ui/ai-section/AiVideoOverlay.tsx
23070
22465
  var import_react17 = require("react");
23071
- var import_lucide_react12 = require("lucide-react");
22466
+ var import_lucide_react11 = require("lucide-react");
23072
22467
 
23073
22468
  // src/lib/ai-video-tree.ts
23074
22469
  function resolveVideoBlock(tree, path) {
@@ -23111,10 +22506,10 @@ function clearVideo(tree, path) {
23111
22506
  }
23112
22507
 
23113
22508
  // src/ui/ai-section/AiVideoOverlay.tsx
23114
- var import_jsx_runtime24 = require("react/jsx-runtime");
22509
+ var import_jsx_runtime23 = require("react/jsx-runtime");
23115
22510
  var PRIMARY5 = "#0885FE";
23116
- var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
23117
- var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
22511
+ var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY5})`;
22512
+ var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
23118
22513
  function findVideoBlockElement(sectionId, path) {
23119
22514
  const sectionEl2 = findByInstanceId(sectionId);
23120
22515
  if (!sectionEl2) return null;
@@ -23174,12 +22569,12 @@ function requestValidateTree3(postToParent2, tree) {
23174
22569
  postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
23175
22570
  });
23176
22571
  }
23177
- function Pill({
22572
+ function Pill2({
23178
22573
  label,
23179
22574
  onClick,
23180
22575
  disabled
23181
22576
  }) {
23182
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
22577
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
23183
22578
  "button",
23184
22579
  {
23185
22580
  type: "button",
@@ -23195,7 +22590,7 @@ function Pill({
23195
22590
  border: "none",
23196
22591
  cursor: disabled ? "default" : "pointer",
23197
22592
  background: "#ffffff",
23198
- color: OHW_BLUE_DARK,
22593
+ color: OHW_BLUE_DARK2,
23199
22594
  opacity: disabled ? 0.4 : 1,
23200
22595
  fontSize: 12,
23201
22596
  lineHeight: "16px",
@@ -23238,8 +22633,8 @@ function VideoUrlInput({ value, onCommit }) {
23238
22633
  onCommit(id);
23239
22634
  }
23240
22635
  };
23241
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
23242
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
22636
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
22637
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
23243
22638
  "div",
23244
22639
  {
23245
22640
  style: {
@@ -23255,12 +22650,12 @@ function VideoUrlInput({ value, onCommit }) {
23255
22650
  boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
23256
22651
  },
23257
22652
  children: [
23258
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
22653
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
23259
22654
  "span",
23260
22655
  {
23261
22656
  style: {
23262
22657
  flex: "0 0 auto",
23263
- color: OHW_BLUE_DARK,
22658
+ color: OHW_BLUE_DARK2,
23264
22659
  fontSize: 10,
23265
22660
  lineHeight: "16px",
23266
22661
  fontWeight: 700,
@@ -23270,7 +22665,7 @@ function VideoUrlInput({ value, onCommit }) {
23270
22665
  children: "Video"
23271
22666
  }
23272
22667
  ),
23273
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
22668
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
23274
22669
  "input",
23275
22670
  {
23276
22671
  type: "text",
@@ -23307,7 +22702,7 @@ function VideoUrlInput({ value, onCommit }) {
23307
22702
  ]
23308
22703
  }
23309
22704
  ),
23310
- invalid && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
22705
+ invalid && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
23311
22706
  ] });
23312
22707
  }
23313
22708
  function VideoToolbar({
@@ -23317,7 +22712,7 @@ function VideoToolbar({
23317
22712
  onSetVideoId,
23318
22713
  onRemove
23319
22714
  }) {
23320
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
22715
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
23321
22716
  "div",
23322
22717
  {
23323
22718
  "data-ohw-bridge": "",
@@ -23329,7 +22724,7 @@ function VideoToolbar({
23329
22724
  gap: 6,
23330
22725
  alignItems: "center",
23331
22726
  width: 280,
23332
- background: OHW_BLUE,
22727
+ background: OHW_BLUE2,
23333
22728
  padding: 8,
23334
22729
  borderRadius: 12,
23335
22730
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -23337,9 +22732,9 @@ function VideoToolbar({
23337
22732
  opacity: pending ? 0.6 : 1
23338
22733
  },
23339
22734
  children: [
23340
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
23341
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
23342
- error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
22735
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
22736
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pill2, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
22737
+ error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
23343
22738
  ]
23344
22739
  }
23345
22740
  );
@@ -23459,8 +22854,8 @@ function AiVideoOverlay({
23459
22854
  const activeBlockRect = useLiveBlockRect(active);
23460
22855
  const TOOLBAR_APPROX_H = 90;
23461
22856
  const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
23462
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
23463
- hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
22857
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
22858
+ hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
23464
22859
  "button",
23465
22860
  {
23466
22861
  type: "button",
@@ -23488,15 +22883,15 @@ function AiVideoOverlay({
23488
22883
  fontSize: 14,
23489
22884
  fontWeight: 700
23490
22885
  },
23491
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Star, { size: 14, style: { pointerEvents: "none" } })
22886
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Star, { size: 14, style: { pointerEvents: "none" } })
23492
22887
  }
23493
22888
  ),
23494
- activeBlockRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
22889
+ activeBlockRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
23495
22890
  ItemInteractionLayer,
23496
22891
  {
23497
22892
  rect: activeBlockRect,
23498
22893
  state: toolbarState,
23499
- toolbar: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
22894
+ toolbar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
23500
22895
  VideoToolbar,
23501
22896
  {
23502
22897
  videoId: videoIdAt(activeEntry.tree, active.path),
@@ -23520,7 +22915,7 @@ function AiVideoOverlay({
23520
22915
 
23521
22916
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
23522
22917
  var import_react18 = require("react");
23523
- var import_lucide_react13 = require("lucide-react");
22918
+ var import_lucide_react12 = require("lucide-react");
23524
22919
 
23525
22920
  // src/lib/ai-carousel-tree.ts
23526
22921
  function isCarouselBlock(node) {
@@ -23571,10 +22966,10 @@ function setCarouselAutoplay(tree, on) {
23571
22966
  }
23572
22967
 
23573
22968
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
23574
- var import_jsx_runtime25 = require("react/jsx-runtime");
22969
+ var import_jsx_runtime24 = require("react/jsx-runtime");
23575
22970
  var PRIMARY6 = "#0885FE";
23576
- var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
23577
- var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
22971
+ var OHW_BLUE3 = `var(--ohw-primary, ${PRIMARY6})`;
22972
+ var OHW_BLUE_DARK3 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
23578
22973
  function findCarouselItemElement(sectionId, index) {
23579
22974
  const sectionEl2 = findByInstanceId(sectionId);
23580
22975
  if (!sectionEl2) return null;
@@ -23653,8 +23048,8 @@ function requestAssetPick2(postToParent2) {
23653
23048
  postToParent2({ type: "ow:asset-pick", id });
23654
23049
  });
23655
23050
  }
23656
- function Pill2({ label, onClick, disabled }) {
23657
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
23051
+ function Pill3({ label, onClick, disabled }) {
23052
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
23658
23053
  "button",
23659
23054
  {
23660
23055
  type: "button",
@@ -23670,7 +23065,7 @@ function Pill2({ label, onClick, disabled }) {
23670
23065
  border: "none",
23671
23066
  cursor: disabled ? "default" : "pointer",
23672
23067
  background: "#ffffff",
23673
- color: OHW_BLUE_DARK2,
23068
+ color: OHW_BLUE_DARK3,
23674
23069
  opacity: disabled ? 0.4 : 1,
23675
23070
  fontSize: 12,
23676
23071
  lineHeight: "16px",
@@ -23688,7 +23083,7 @@ function TogglePill({
23688
23083
  onToggle,
23689
23084
  disabled
23690
23085
  }) {
23691
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
23086
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
23692
23087
  "button",
23693
23088
  {
23694
23089
  type: "button",
@@ -23707,7 +23102,7 @@ function TogglePill({
23707
23102
  border: "none",
23708
23103
  cursor: disabled ? "default" : "pointer",
23709
23104
  background: "#ffffff",
23710
- color: OHW_BLUE_DARK2,
23105
+ color: OHW_BLUE_DARK3,
23711
23106
  opacity: disabled ? 0.4 : 1,
23712
23107
  fontSize: 12,
23713
23108
  lineHeight: "16px",
@@ -23717,7 +23112,7 @@ function TogglePill({
23717
23112
  },
23718
23113
  children: [
23719
23114
  label,
23720
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
23115
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
23721
23116
  "span",
23722
23117
  {
23723
23118
  "aria-hidden": true,
@@ -23730,10 +23125,10 @@ function TogglePill({
23730
23125
  // Off is a grey track, not a washed-out blue: the pill's own white background already
23731
23126
  // carries the brand colour in the text, and a pale blue track next to it read as
23732
23127
  // "disabled control" rather than "switch that is off".
23733
- background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
23128
+ background: on ? OHW_BLUE_DARK3 : "#CBD5E1",
23734
23129
  transition: "background 120ms ease"
23735
23130
  },
23736
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
23131
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
23737
23132
  "span",
23738
23133
  {
23739
23134
  style: {
@@ -23762,7 +23157,7 @@ function CarouselSlideToolbar({
23762
23157
  onChangeImage,
23763
23158
  onToggleAutoplay
23764
23159
  }) {
23765
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
23160
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
23766
23161
  "div",
23767
23162
  {
23768
23163
  "data-ohw-bridge": "",
@@ -23773,7 +23168,7 @@ function CarouselSlideToolbar({
23773
23168
  flexDirection: "column",
23774
23169
  gap: 6,
23775
23170
  alignItems: "center",
23776
- background: OHW_BLUE2,
23171
+ background: OHW_BLUE3,
23777
23172
  padding: 8,
23778
23173
  borderRadius: 12,
23779
23174
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -23785,11 +23180,11 @@ function CarouselSlideToolbar({
23785
23180
  pointerEvents: pending ? "none" : "auto"
23786
23181
  },
23787
23182
  children: [
23788
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
23789
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Pill2, { label: "Change Image", onClick: onChangeImage }),
23790
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
23183
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
23184
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Pill3, { label: "Change Image", onClick: onChangeImage }),
23185
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
23791
23186
  ] }),
23792
- error && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
23187
+ error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
23793
23188
  ]
23794
23189
  }
23795
23190
  );
@@ -23929,8 +23324,8 @@ function AiFadeCarouselOverlay({
23929
23324
  const activeItemRect = useLiveItemRect2(active);
23930
23325
  const TOOLBAR_APPROX_H = 90;
23931
23326
  const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
23932
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
23933
- hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
23327
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
23328
+ hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
23934
23329
  "button",
23935
23330
  {
23936
23331
  type: "button",
@@ -23959,10 +23354,10 @@ function AiFadeCarouselOverlay({
23959
23354
  fontSize: 14,
23960
23355
  fontWeight: 700
23961
23356
  },
23962
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react13.Star, { size: 14, style: { pointerEvents: "none" } })
23357
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Star, { size: 14, style: { pointerEvents: "none" } })
23963
23358
  }
23964
23359
  ),
23965
- swapping && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
23360
+ swapping && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
23966
23361
  "div",
23967
23362
  {
23968
23363
  ref: skeletonRef,
@@ -23980,15 +23375,15 @@ function AiFadeCarouselOverlay({
23980
23375
  zIndex: 2147483646,
23981
23376
  pointerEvents: "none"
23982
23377
  },
23983
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("style", { children: MEDIA_SKELETON_CSS })
23378
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("style", { children: MEDIA_SKELETON_CSS })
23984
23379
  }
23985
23380
  ),
23986
- activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
23381
+ activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
23987
23382
  ItemInteractionLayer,
23988
23383
  {
23989
23384
  rect: activeItemRect,
23990
23385
  state: toolbarState,
23991
- toolbar: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
23386
+ toolbar: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
23992
23387
  CarouselSlideToolbar,
23993
23388
  {
23994
23389
  pending,
@@ -24226,6 +23621,113 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
24226
23621
  // src/ui/link-modal/LinkPopover.tsx
24227
23622
  var import_react22 = require("react");
24228
23623
 
23624
+ // src/ui/dialog.tsx
23625
+ var React10 = __toESM(require("react"), 1);
23626
+ var import_radix_ui6 = require("radix-ui");
23627
+ var import_lucide_react13 = require("lucide-react");
23628
+ var import_jsx_runtime25 = require("react/jsx-runtime");
23629
+ function Dialog2({
23630
+ ...props
23631
+ }) {
23632
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
23633
+ }
23634
+ function DialogPortal({
23635
+ ...props
23636
+ }) {
23637
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
23638
+ }
23639
+ function DialogOverlay({
23640
+ className,
23641
+ ...props
23642
+ }) {
23643
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
23644
+ import_radix_ui6.Dialog.Overlay,
23645
+ {
23646
+ "data-slot": "dialog-overlay",
23647
+ "data-ohw-link-modal-root": "",
23648
+ className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
23649
+ ...props
23650
+ }
23651
+ );
23652
+ }
23653
+ var DialogContent = React10.forwardRef(
23654
+ ({ className, children, showCloseButton = true, container, ...props }, ref) => {
23655
+ const positionMode = container ? "absolute" : "fixed";
23656
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DialogPortal, { container: container ?? void 0, children: [
23657
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
23658
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
23659
+ import_radix_ui6.Dialog.Content,
23660
+ {
23661
+ ref,
23662
+ "data-slot": "dialog-content",
23663
+ className: cn(
23664
+ positionMode,
23665
+ "left-1/2 top-1/2 z-[2147483647] flex w-full max-w-[448px] -translate-x-1/2 -translate-y-1/2 flex-col overflow-visible",
23666
+ "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
23667
+ container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
23668
+ className
23669
+ ),
23670
+ onMouseDown: (e) => e.stopPropagation(),
23671
+ ...props,
23672
+ children: [
23673
+ children,
23674
+ showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
23675
+ import_radix_ui6.Dialog.Close,
23676
+ {
23677
+ type: "button",
23678
+ className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
23679
+ "aria-label": "Close",
23680
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react13.X, { size: 16, "aria-hidden": true })
23681
+ }
23682
+ ) : null
23683
+ ]
23684
+ }
23685
+ )
23686
+ ] });
23687
+ }
23688
+ );
23689
+ DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
23690
+ function DialogHeader({
23691
+ className,
23692
+ ...props
23693
+ }) {
23694
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
23695
+ }
23696
+ function DialogFooter({
23697
+ className,
23698
+ ...props
23699
+ }) {
23700
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
23701
+ "div",
23702
+ {
23703
+ className: cn("flex items-center justify-end gap-2", className),
23704
+ ...props
23705
+ }
23706
+ );
23707
+ }
23708
+ var DialogTitle = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
23709
+ import_radix_ui6.Dialog.Title,
23710
+ {
23711
+ ref,
23712
+ className: cn(
23713
+ "text-lg font-semibold leading-none tracking-tight text-card-foreground",
23714
+ className
23715
+ ),
23716
+ ...props
23717
+ }
23718
+ ));
23719
+ DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
23720
+ var DialogDescription = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
23721
+ import_radix_ui6.Dialog.Description,
23722
+ {
23723
+ ref,
23724
+ className: cn("text-sm text-muted-foreground", className),
23725
+ ...props
23726
+ }
23727
+ ));
23728
+ DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
23729
+ var DialogClose = import_radix_ui6.Dialog.Close;
23730
+
24229
23731
  // src/ui/link-modal/LinkEditorPanel.tsx
24230
23732
  var import_lucide_react17 = require("lucide-react");
24231
23733
 
@@ -25329,7 +24831,6 @@ function shouldUseDevFixtures() {
25329
24831
  function getLogoElement(el) {
25330
24832
  const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
25331
24833
  if (marked) return marked;
25332
- if (el.closest('[data-ohw-editable="icon"]')) return null;
25333
24834
  const root = el.closest("nav, [data-ohw-nav-root], footer");
25334
24835
  if (!root) return null;
25335
24836
  const anchor = el.closest("a");
@@ -27780,7 +27281,7 @@ function isIconEditable(el) {
27780
27281
  return el.dataset.ohwEditable === "icon";
27781
27282
  }
27782
27283
  var MEDIA_SELECTOR = '[data-ohw-editable="image"], [data-ohw-editable="bg-image"], [data-ohw-editable="video"]';
27783
- var EDITOR_CHROME_SELECTOR = '[data-ohw-toolbar], [data-ohw-form-toolbar], [data-ohw-field-toolbar], [data-ohw-dropdown-option-toolbar], [data-ohw-item-toolbar], [data-ohw-more-menu], [data-ohw-state-toggle], [data-ohw-max-badge], [data-slot="dropdown-menu-content"], [data-slot="dropdown-menu-item"]';
27284
+ var EDITOR_CHROME_SELECTOR = '[data-ohw-toolbar], [data-ohw-form-toolbar], [data-ohw-field-toolbar], [data-ohw-item-toolbar], [data-ohw-more-menu], [data-ohw-state-toggle], [data-ohw-max-badge], [data-slot="dropdown-menu-content"], [data-slot="dropdown-menu-item"]';
27784
27285
  function isOverEditorChrome(x, y) {
27785
27286
  return document.elementsFromPoint(x, y).some((el) => el instanceof HTMLElement && el.matches(EDITOR_CHROME_SELECTOR));
27786
27287
  }
@@ -28146,7 +27647,7 @@ function getNavigationSelectionParent(el) {
28146
27647
  if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
28147
27648
  return resolveFooterLinksContainerFrom(el);
28148
27649
  }
28149
- if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isFooterLinksContainer(el) || isInferredFooterGroup2(el)) {
27650
+ if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
28150
27651
  return getNavigationRoot(el);
28151
27652
  }
28152
27653
  return null;
@@ -28368,6 +27869,7 @@ var ICONS = {
28368
27869
  insertUnorderedList: '<line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/>',
28369
27870
  insertOrderedList: '<line x1="10" y1="6" x2="21" y2="6"/><line x1="10" y1="12" x2="21" y2="12"/><line x1="10" y1="18" x2="21" y2="18"/><path d="M4 6h1v4"/><path d="M4 10h2"/><path d="M6 18H4c0-1 2-2 2-3s-1-1.5-2-1"/>'
28370
27871
  };
27872
+ var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
28371
27873
  var SELECTION_CHROME_GAP2 = 4;
28372
27874
  var TOOLBAR_STROKE_GAP2 = 4;
28373
27875
  var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
@@ -28465,7 +27967,7 @@ function applyVisibleViewport(el, parentScroll) {
28465
27967
  el.style.top = `${top}px`;
28466
27968
  el.style.height = `${height}px`;
28467
27969
  }
28468
- var TOOLBAR_EDGE_MARGIN4 = 4;
27970
+ var TOOLBAR_EDGE_MARGIN3 = 4;
28469
27971
  function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
28470
27972
  const isAbove = transform.includes("translateY(-100%)");
28471
27973
  let visualTop = isAbove ? top - approxH : top;
@@ -28492,8 +27994,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
28492
27994
  function clampToolbarLeft(centerX, toolbarWidth) {
28493
27995
  const half = toolbarWidth / 2;
28494
27996
  return Math.max(
28495
- TOOLBAR_EDGE_MARGIN4 + half,
28496
- Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
27997
+ TOOLBAR_EDGE_MARGIN3 + half,
27998
+ Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half)
28497
27999
  );
28498
28000
  }
28499
28001
  function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
@@ -29168,14 +28670,10 @@ function OhhwellsBridge() {
29168
28670
  const [fieldPickRect, setFieldPickRect] = (0, import_react27.useState)(null);
29169
28671
  const fieldPickElRef = (0, import_react27.useRef)(null);
29170
28672
  const [fieldPickState, setFieldPickState] = (0, import_react27.useState)(null);
29171
- const [dropdownOptionPick, setDropdownOptionPick] = (0, import_react27.useState)(null);
29172
28673
  const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0, import_react27.useState)(false);
29173
28674
  const clearFormPick = (0, import_react27.useCallback)(() => {
29174
28675
  const form = formPickElRef.current;
29175
28676
  const editing = fieldPickElRef.current;
29176
- if (editing && fieldTypeOf(editing) === "dropdown") {
29177
- setDropdownPreviewOpen(editing, false);
29178
- }
29179
28677
  if (commitPlaceholderEdit(editing) && editing) {
29180
28678
  const owner = editing.closest('[data-ohw-editable="form"]');
29181
28679
  if (owner) persistFieldsRef.current(owner);
@@ -29187,7 +28685,6 @@ function OhhwellsBridge() {
29187
28685
  setFormViewStateUi("default");
29188
28686
  setFormPickCount(null);
29189
28687
  setFieldTypePickerOpen(false);
29190
- setDropdownOptionPick(null);
29191
28688
  fieldPickElRef.current = null;
29192
28689
  setFieldPickRect(null);
29193
28690
  setFieldPickState(null);
@@ -29196,14 +28693,10 @@ function OhhwellsBridge() {
29196
28693
  }, []);
29197
28694
  const clearFieldPick = (0, import_react27.useCallback)(() => {
29198
28695
  const wrapper = fieldPickElRef.current;
29199
- if (wrapper && fieldTypeOf(wrapper) === "dropdown") {
29200
- setDropdownPreviewOpen(wrapper, false);
29201
- }
29202
28696
  if (commitPlaceholderEdit(wrapper) && wrapper) {
29203
28697
  const form = wrapper.closest('[data-ohw-editable="form"]');
29204
28698
  if (form) persistFieldsRef.current(form);
29205
28699
  }
29206
- setDropdownOptionPick(null);
29207
28700
  fieldPickElRef.current = null;
29208
28701
  setFieldPickRect(null);
29209
28702
  setFieldPickState(null);
@@ -29221,50 +28714,17 @@ function OhhwellsBridge() {
29221
28714
  []
29222
28715
  );
29223
28716
  persistFieldsRef.current = persistFields;
29224
- const refreshDropdownOptionPick = (0, import_react27.useCallback)((wrapper, index) => {
29225
- if (index == null || fieldTypeOf(wrapper) !== "dropdown") {
29226
- clearDropdownOptionSelection(wrapper);
29227
- setDropdownOptionPick(null);
29228
- return;
29229
- }
29230
- selectDropdownOption(wrapper, index);
29231
- const row = listDropdownOptionRows(wrapper)[index];
29232
- if (!row) {
29233
- setDropdownOptionPick(null);
29234
- return;
29235
- }
29236
- setDropdownOptionPick({
29237
- index,
29238
- rect: row.getBoundingClientRect(),
29239
- canDelete: listDropdownOptionRows(wrapper).length > 1
29240
- });
29241
- setFieldPickRect(null);
29242
- }, []);
29243
28717
  const selectField = (0, import_react27.useCallback)((wrapper) => {
29244
28718
  if (fieldPickElRef.current && fieldPickElRef.current !== wrapper) {
29245
- const prev = fieldPickElRef.current;
29246
- if (fieldTypeOf(prev) === "dropdown") setDropdownPreviewOpen(prev, false);
29247
- commitPlaceholderEdit(prev);
28719
+ commitPlaceholderEdit(fieldPickElRef.current);
29248
28720
  }
29249
28721
  syncRequiredMark(wrapper);
29250
- const type = fieldTypeOf(wrapper);
29251
- if (type === "dropdown") {
29252
- syncDropdownPanel(wrapper);
29253
- if (!isDropdownPreviewOpen(wrapper)) setDropdownPreviewOpen(wrapper, false);
29254
- } else {
29255
- beginPlaceholderEdit(wrapper);
29256
- }
28722
+ beginPlaceholderEdit(wrapper);
29257
28723
  formHoverElRef.current = null;
29258
28724
  setFormHoverRect(null);
29259
- setDropdownOptionPick(null);
29260
- clearDropdownOptionSelection(wrapper);
29261
28725
  fieldPickElRef.current = wrapper;
29262
28726
  setFieldPickRect(wrapper.getBoundingClientRect());
29263
- setFieldPickState({
29264
- type,
29265
- required: isFieldRequired(wrapper),
29266
- dropdownOpen: type === "dropdown" ? isDropdownPreviewOpen(wrapper) : null
29267
- });
28727
+ setFieldPickState({ type: fieldTypeOf(wrapper), required: isFieldRequired(wrapper) });
29268
28728
  setFieldTypePickerOpen(false);
29269
28729
  }, []);
29270
28730
  const withSelectedField = (0, import_react27.useCallback)(
@@ -29294,31 +28754,6 @@ function OhhwellsBridge() {
29294
28754
  }),
29295
28755
  [selectField, withSelectedField]
29296
28756
  );
29297
- const handleFieldDropdownOpenChange = (0, import_react27.useCallback)((open) => {
29298
- const wrapper = fieldPickElRef.current;
29299
- if (!wrapper || fieldTypeOf(wrapper) !== "dropdown") return;
29300
- if (!open) {
29301
- commitDropdownOptionsFromPanel(wrapper, true);
29302
- const form = formPickElRef.current;
29303
- if (form) persistFieldsRef.current(form);
29304
- }
29305
- setDropdownPreviewOpen(wrapper, open);
29306
- setDropdownOptionPick(null);
29307
- clearDropdownOptionSelection(wrapper);
29308
- suppressNextClickRef.current = true;
29309
- suppressClickUntilRef.current = Date.now() + 400;
29310
- setFieldPickRect(wrapper.getBoundingClientRect());
29311
- setFieldPickState({
29312
- type: "dropdown",
29313
- required: isFieldRequired(wrapper),
29314
- dropdownOpen: open
29315
- });
29316
- requestAnimationFrame(() => {
29317
- if (fieldPickElRef.current === wrapper) {
29318
- setFieldPickRect(wrapper.getBoundingClientRect());
29319
- }
29320
- });
29321
- }, []);
29322
28757
  const handleFieldDuplicate = (0, import_react27.useCallback)(
29323
28758
  () => withSelectedField((form, wrapper) => {
29324
28759
  const copy = duplicateField(form, wrapper);
@@ -29334,28 +28769,6 @@ function OhhwellsBridge() {
29334
28769
  }),
29335
28770
  [clearFieldPick, withSelectedField]
29336
28771
  );
29337
- const handleDropdownOptionDuplicate = (0, import_react27.useCallback)(() => {
29338
- const wrapper = fieldPickElRef.current;
29339
- const form = formPickElRef.current;
29340
- if (!wrapper || !form || !dropdownOptionPick) return;
29341
- suppressNextClickRef.current = true;
29342
- suppressClickUntilRef.current = Date.now() + 400;
29343
- const nextIndex = duplicateDropdownOption(wrapper, dropdownOptionPick.index);
29344
- persistFields(form);
29345
- setDropdownPreviewOpen(wrapper, true);
29346
- requestAnimationFrame(() => refreshDropdownOptionPick(wrapper, nextIndex));
29347
- }, [dropdownOptionPick, persistFields, refreshDropdownOptionPick]);
29348
- const handleDropdownOptionDelete = (0, import_react27.useCallback)(() => {
29349
- const wrapper = fieldPickElRef.current;
29350
- const form = formPickElRef.current;
29351
- if (!wrapper || !form || !dropdownOptionPick || !dropdownOptionPick.canDelete) return;
29352
- suppressNextClickRef.current = true;
29353
- suppressClickUntilRef.current = Date.now() + 400;
29354
- const nextIndex = removeDropdownOption(wrapper, dropdownOptionPick.index);
29355
- persistFields(form);
29356
- setDropdownPreviewOpen(wrapper, true);
29357
- requestAnimationFrame(() => refreshDropdownOptionPick(wrapper, nextIndex));
29358
- }, [dropdownOptionPick, persistFields, refreshDropdownOptionPick]);
29359
28772
  const handleAddField = (0, import_react27.useCallback)(
29360
28773
  (type) => {
29361
28774
  const form = formPickElRef.current;
@@ -29494,6 +28907,21 @@ function OhhwellsBridge() {
29494
28907
  const [isItemDragging, setIsItemDragging] = (0, import_react27.useState)(false);
29495
28908
  const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react27.useState)(false);
29496
28909
  isFooterFrameSelectionRef.current = isFooterFrameSelection;
28910
+ const [floatingPanel, setFloatingPanel] = (0, import_react27.useState)(null);
28911
+ const floatingPanelOpenRef = (0, import_react27.useRef)(false);
28912
+ floatingPanelOpenRef.current = floatingPanel !== null;
28913
+ const floatingPanelRef = (0, import_react27.useRef)(null);
28914
+ floatingPanelRef.current = floatingPanel;
28915
+ const [floatingPanelPos, setFloatingPanelPos] = (0, import_react27.useState)(null);
28916
+ const buttonCollectionDragRef = (0, import_react27.useRef)(null);
28917
+ const buttonDropInsertIndexRef = (0, import_react27.useRef)(null);
28918
+ const [buttonDropSlots, setButtonDropSlots] = (0, import_react27.useState)([]);
28919
+ const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react27.useState)(null);
28920
+ const buttonPointerDragRef = (0, import_react27.useRef)(null);
28921
+ const [buttonStyleTick, setButtonStyleTick] = (0, import_react27.useState)(0);
28922
+ const [logoSizeDraft, setLogoSizeDraft] = (0, import_react27.useState)(null);
28923
+ const [editorViewport, setEditorViewport] = (0, import_react27.useState)("desktop");
28924
+ const [parentScrollSnap, setParentScrollSnap] = (0, import_react27.useState)(null);
29497
28925
  const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react27.useState)(null);
29498
28926
  const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react27.useState)(null);
29499
28927
  const footerDragRef = (0, import_react27.useRef)(null);
@@ -29520,21 +28948,6 @@ function OhhwellsBridge() {
29520
28948
  const stylesRef = (0, import_react27.useRef)("");
29521
28949
  const appliedDrawerRef = (0, import_react27.useRef)(null);
29522
28950
  const pendingDeleteUndoRef = (0, import_react27.useRef)(null);
29523
- const [floatingPanel, setFloatingPanel] = (0, import_react27.useState)(null);
29524
- const floatingPanelOpenRef = (0, import_react27.useRef)(false);
29525
- const floatingPanelRef = (0, import_react27.useRef)(null);
29526
- floatingPanelRef.current = floatingPanel;
29527
- const setFloatingPanelRef = (0, import_react27.useRef)(setFloatingPanel);
29528
- const [floatingPanelPos, setFloatingPanelPos] = (0, import_react27.useState)(null);
29529
- const buttonCollectionDragRef = (0, import_react27.useRef)(null);
29530
- const buttonDropInsertIndexRef = (0, import_react27.useRef)(null);
29531
- const [buttonDropSlots, setButtonDropSlots] = (0, import_react27.useState)([]);
29532
- const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react27.useState)(null);
29533
- const buttonPointerDragRef = (0, import_react27.useRef)(null);
29534
- const [buttonStyleTick, setButtonStyleTick] = (0, import_react27.useState)(0);
29535
- const [logoSizeDraft, setLogoSizeDraft] = (0, import_react27.useState)(null);
29536
- const [editorViewport, setEditorViewport] = (0, import_react27.useState)("desktop");
29537
- const [parentScrollSnap, setParentScrollSnap] = (0, import_react27.useState)(null);
29538
28951
  const [sitePages, setSitePages] = (0, import_react27.useState)([]);
29539
28952
  const collectionItemsRef = (0, import_react27.useRef)(/* @__PURE__ */ new Map());
29540
28953
  const [sectionsByPath, setSectionsByPath] = (0, import_react27.useState)({});
@@ -29544,18 +28957,7 @@ function OhhwellsBridge() {
29544
28957
  const linkPopoverOpenRef = (0, import_react27.useRef)(false);
29545
28958
  const linkPopoverGraceUntilRef = (0, import_react27.useRef)(0);
29546
28959
  setLinkPopoverRef.current = setLinkPopover;
29547
- setFloatingPanelRef.current = setFloatingPanel;
29548
28960
  linkPopoverSessionRef.current = linkPopover;
29549
- floatingPanelOpenRef.current = Boolean(floatingPanel);
29550
- (0, import_react27.useEffect)(() => {
29551
- const syncViewport = () => {
29552
- const next = window.innerWidth <= 480 ? "mobile" : "desktop";
29553
- setEditorViewport((prev) => prev === next ? prev : next);
29554
- };
29555
- syncViewport();
29556
- window.addEventListener("resize", syncViewport);
29557
- return () => window.removeEventListener("resize", syncViewport);
29558
- }, []);
29559
28961
  (0, import_react27.useEffect)(() => {
29560
28962
  setSectionOrderPersistHandler((entries) => {
29561
28963
  const currentPath = window.location.pathname;
@@ -31298,7 +30700,6 @@ function OhhwellsBridge() {
31298
30700
  applyAiFooterFromContent(content);
31299
30701
  if (typeof content[STYLE_STORE_KEY] === "string") {
31300
30702
  stylesRef.current = content[STYLE_STORE_KEY];
31301
- document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
31302
30703
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
31303
30704
  }
31304
30705
  applyBrandChrome(content);
@@ -31309,12 +30710,12 @@ function OhhwellsBridge() {
31309
30710
  if (key === "__ohw_sections") continue;
31310
30711
  if (key === AI_SECTIONS_KEY) continue;
31311
30712
  if (key === AI_FOOTER_KEY) continue;
31312
- if (key === LOGO_PLACEHOLDER_KEY) continue;
31313
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
31314
30713
  if (key === BRAND_KIT_KEY) continue;
31315
30714
  if (key === STYLE_STORE_KEY) continue;
31316
30715
  if (BRAND_CHROME_KEYS.has(key)) continue;
30716
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
31317
30717
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
30718
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
31318
30719
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
31319
30720
  continue;
31320
30721
  }
@@ -31484,32 +30885,8 @@ function OhhwellsBridge() {
31484
30885
  if (!isEditMode) return;
31485
30886
  let saveTimer = null;
31486
30887
  const onInput = (e) => {
31487
- const target = e.target;
31488
- if (!target) return;
31489
- const optionIndex = getDropdownOptionIndex(target);
31490
- if (optionIndex != null) {
31491
- const wrapper2 = getFieldWrapper(target);
31492
- if (!wrapper2 || wrapper2 !== fieldPickElRef.current) return;
31493
- if (saveTimer) clearTimeout(saveTimer);
31494
- const owner2 = wrapper2.closest('[data-ohw-editable="form"]');
31495
- saveTimer = setTimeout(() => {
31496
- const form = owner2 ?? formPickElRef.current;
31497
- if (!form) return;
31498
- commitDropdownOptionsFromPanel(wrapper2);
31499
- persistFields(form);
31500
- const row = listDropdownOptionRows(wrapper2)[optionIndex];
31501
- if (row) {
31502
- setDropdownOptionPick({
31503
- index: optionIndex,
31504
- rect: row.getBoundingClientRect(),
31505
- canDelete: listDropdownOptionRows(wrapper2).length > 1
31506
- });
31507
- }
31508
- }, 400);
31509
- return;
31510
- }
31511
- const input = target;
31512
- if (!("value" in input)) return;
30888
+ const input = e.target;
30889
+ if (!input || !("value" in input)) return;
31513
30890
  const wrapper = getFieldWrapper(input);
31514
30891
  if (!wrapper || wrapper !== fieldPickElRef.current) return;
31515
30892
  if (saveTimer) clearTimeout(saveTimer);
@@ -31573,18 +30950,17 @@ function OhhwellsBridge() {
31573
30950
  }
31574
30951
  applyAiFooterFromContent(content);
31575
30952
  if (typeof content[STYLE_STORE_KEY] === "string") {
31576
- document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
31577
30953
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
31578
30954
  }
31579
30955
  for (const [key, val] of Object.entries(content)) {
31580
30956
  if (key === "__ohw_sections") continue;
31581
30957
  if (key === AI_SECTIONS_KEY) continue;
31582
30958
  if (key === AI_FOOTER_KEY) continue;
31583
- if (key === LOGO_PLACEHOLDER_KEY) continue;
31584
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
31585
30959
  if (key === BRAND_KIT_KEY) continue;
31586
30960
  if (key === STYLE_STORE_KEY) continue;
31587
30961
  if (BRAND_CHROME_KEYS.has(key)) continue;
30962
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
30963
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
31588
30964
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
31589
30965
  continue;
31590
30966
  }
@@ -31856,11 +31232,26 @@ function OhhwellsBridge() {
31856
31232
  const t2 = setTimeout(measure, 500);
31857
31233
  const ro = new ResizeObserver(schedule);
31858
31234
  ro.observe(document.body);
31235
+ let lastWidth = window.innerWidth;
31236
+ let resizeTimers = [];
31237
+ const clearResizeTimers = () => {
31238
+ resizeTimers.forEach(clearTimeout);
31239
+ resizeTimers = [];
31240
+ };
31241
+ const handleResize = () => {
31242
+ if (window.innerWidth === lastWidth) return;
31243
+ lastWidth = window.innerWidth;
31244
+ clearResizeTimers();
31245
+ resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
31246
+ };
31247
+ window.addEventListener("resize", handleResize);
31859
31248
  return () => {
31860
31249
  clearTimeout(t1);
31861
31250
  clearTimeout(t2);
31862
31251
  if (raf != null) cancelAnimationFrame(raf);
31863
31252
  ro.disconnect();
31253
+ clearResizeTimers();
31254
+ window.removeEventListener("resize", handleResize);
31864
31255
  };
31865
31256
  }, [pathname, isEditMode, postToParent2]);
31866
31257
  (0, import_react27.useEffect)(() => {
@@ -32021,7 +31412,6 @@ function OhhwellsBridge() {
32021
31412
  field can be picked and hovered from anywhere inside it (OHH-642). */
32022
31413
  [data-ohw-editable="form"] [data-ohw-form-field] input,
32023
31414
  [data-ohw-editable="form"] [data-ohw-form-field] textarea,
32024
- [data-ohw-editable="form"] [data-ohw-form-field] select,
32025
31415
  [data-ohw-editable="form"] [data-ohw-form-field] label {
32026
31416
  pointer-events: auto !important;
32027
31417
  cursor: pointer !important;
@@ -32035,35 +31425,10 @@ function OhhwellsBridge() {
32035
31425
  max-width: 100% !important;
32036
31426
  }
32037
31427
  [data-ohw-editable="form"] [data-ohw-form-field] input,
32038
- [data-ohw-editable="form"] [data-ohw-form-field] textarea,
32039
- [data-ohw-editable="form"] [data-ohw-form-field] select {
31428
+ [data-ohw-editable="form"] [data-ohw-form-field] textarea {
32040
31429
  box-sizing: border-box !important;
32041
31430
  width: 100% !important;
32042
31431
  }
32043
- /* Dropdown field editor (OHH-919): Closed = select alone; Open = select + panel below.
32044
- Caret only \u2014 keep the template's own background/border/type on the select. */
32045
- [data-ohw-editable="form"] [data-ohw-form-field][data-ohw-field-type="dropdown"] select {
32046
- appearance: none !important;
32047
- -webkit-appearance: none !important;
32048
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2378716C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") !important;
32049
- background-repeat: no-repeat !important;
32050
- background-position: right 12px center !important;
32051
- padding-right: 36px !important;
32052
- pointer-events: none !important;
32053
- }
32054
- [data-ohw-editable="form"] [data-ohw-form-field][data-ohw-dropdown-open] select {
32055
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2378716C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='18 15 12 9 6 15'/%3E%3C/svg%3E") !important;
32056
- }
32057
- [data-ohw-editable="form"] [data-ohw-form-field] [data-ohw-dropdown-panel] {
32058
- display: none !important;
32059
- }
32060
- [data-ohw-editable="form"] [data-ohw-form-field][data-ohw-dropdown-open] [data-ohw-dropdown-panel] {
32061
- display: block !important;
32062
- }
32063
- [data-ohw-editable="form"] [data-ohw-dropdown-option] {
32064
- cursor: text !important;
32065
- outline: none !important;
32066
- }
32067
31432
  /* Somewhere to click the block itself, on every side (OHH-642) \u2014 editor only. */
32068
31433
  [data-ohw-editable="form"] {
32069
31434
  padding: 18px !important;
@@ -32071,14 +31436,13 @@ function OhhwellsBridge() {
32071
31436
  flex-wrap: wrap !important;
32072
31437
  align-items: flex-end !important;
32073
31438
  }
32074
- /* Width floor for horizontal rows \u2014 never flex-basis. On a column form
32075
- 'flex-basis: 12rem' becomes HEIGHT and fields grow empty space (OHH-919). */
31439
+ /* Generated forms are excluded: they are always a single column, so the 12rem
31440
+ flex BASIS \u2014 a minimum width in a horizontal row \u2014 reads as a 12rem HEIGHT
31441
+ there and inflates every field to the tallest one's size. */
32076
31442
  [data-ohw-editable="form"]:not([data-ai-form]) [data-ohw-form-field] {
32077
- flex: 1 1 auto !important;
31443
+ flex: 1 1 12rem !important;
32078
31444
  min-width: min(12rem, 100%) !important;
32079
31445
  max-width: 100% !important;
32080
- height: auto !important;
32081
- align-self: flex-start !important;
32082
31446
  }
32083
31447
  /* Placeholder text lives in the value while selected. currentColor inside color-mix
32084
31448
  resolves to the *inherited* color, so reverse-print footers washed it out on white
@@ -32184,13 +31548,6 @@ function OhhwellsBridge() {
32184
31548
  if (target.closest("[data-ohw-state-toggle]")) return;
32185
31549
  if (target.closest("[data-ohw-max-badge]")) return;
32186
31550
  if (isInsideLinkEditor(target)) return;
32187
- if (isInsideFloatingPanel(target)) return;
32188
- if (target.closest("[data-ohw-form-toolbar]")) return;
32189
- if (target.closest(
32190
- '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
32191
- )) {
32192
- return;
32193
- }
32194
31551
  if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
32195
31552
  clearMediaSelectionRef.current();
32196
31553
  }
@@ -32214,6 +31571,8 @@ function OhhwellsBridge() {
32214
31571
  return;
32215
31572
  }
32216
31573
  }
31574
+ if (isInsideFloatingPanel(target)) return;
31575
+ if (target.closest("[data-ohw-form-toolbar]")) return;
32217
31576
  const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
32218
31577
  if (collectionItem) {
32219
31578
  e.preventDefault();
@@ -32226,7 +31585,7 @@ function OhhwellsBridge() {
32226
31585
  return;
32227
31586
  }
32228
31587
  if (target.closest(
32229
- '[data-ohw-field-toolbar], [data-ohw-dropdown-option-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
31588
+ '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
32230
31589
  )) {
32231
31590
  return;
32232
31591
  }
@@ -32236,26 +31595,8 @@ function OhhwellsBridge() {
32236
31595
  if (formEl && formKeyOf(formEl) && !onSuccessText && !isCtaButton(target)) {
32237
31596
  const fieldEl = getFieldWrapper(target);
32238
31597
  if (fieldEl) {
32239
- const optionIndex = getDropdownOptionIndex(target);
32240
- if (optionIndex != null && fieldTypeOf(fieldEl) === "dropdown" && isDropdownPreviewOpen(fieldEl)) {
32241
- deactivateRef.current();
32242
- deselectRef.current();
32243
- formPickElRef.current = formEl;
32244
- setFormPickRect(null);
32245
- if (fieldPickElRef.current !== fieldEl) selectField(fieldEl);
32246
- setDropdownPreviewOpen(fieldEl, true);
32247
- setFieldPickState({
32248
- type: "dropdown",
32249
- required: isFieldRequired(fieldEl),
32250
- dropdownOpen: true
32251
- });
32252
- refreshDropdownOptionPick(fieldEl, optionIndex);
32253
- return;
32254
- }
32255
31598
  const label = target.closest("label");
32256
- if (label && fieldPickElRef.current === fieldEl && selectedDropdownOptionIndex(fieldEl) == null) {
32257
- return;
32258
- }
31599
+ if (label && fieldPickElRef.current === fieldEl) return;
32259
31600
  e.preventDefault();
32260
31601
  e.stopPropagation();
32261
31602
  deactivateRef.current();
@@ -32263,9 +31604,7 @@ function OhhwellsBridge() {
32263
31604
  formPickElRef.current = formEl;
32264
31605
  setFormPickRect(null);
32265
31606
  selectField(fieldEl);
32266
- if (!label && fieldTypeOf(fieldEl) !== "dropdown") {
32267
- fieldEl.querySelector("input, textarea")?.focus();
32268
- }
31607
+ if (!label) fieldEl.querySelector("input, textarea")?.focus();
32269
31608
  return;
32270
31609
  }
32271
31610
  clearFieldPick();
@@ -32413,13 +31752,9 @@ function OhhwellsBridge() {
32413
31752
  if (isIconEditable(editable) && !getSocialItem(editable)) {
32414
31753
  e.preventDefault();
32415
31754
  e.stopPropagation();
31755
+ selectIconElementRef.current(editable);
32416
31756
  const aiIcon = editable.hasAttribute("data-ai-icon");
32417
31757
  const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
32418
- if (aiIcon) {
32419
- aiSectionApiRef.current?.selectFromElement(editable);
32420
- } else {
32421
- selectIconElementRef.current(editable);
32422
- }
32423
31758
  postToParentRef.current({
32424
31759
  type: "ow:icon-pick",
32425
31760
  key: editable.dataset.ohwKey ?? "",
@@ -32647,9 +31982,6 @@ function OhhwellsBridge() {
32647
31982
  setHoveredItemRect(null);
32648
31983
  hoveredNavContainerRef.current = null;
32649
31984
  setHoveredNavContainerRect(null);
32650
- siblingHintElRef.current = null;
32651
- setSiblingHintRect(null);
32652
- setSiblingHintRects([]);
32653
31985
  return;
32654
31986
  }
32655
31987
  {
@@ -32772,6 +32104,7 @@ function OhhwellsBridge() {
32772
32104
  hoveredNavContainerRef.current = null;
32773
32105
  setHoveredNavContainerRect(null);
32774
32106
  hoveredItemElRef.current = editable;
32107
+ setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
32775
32108
  }
32776
32109
  }
32777
32110
  }
@@ -33478,11 +32811,7 @@ function OhhwellsBridge() {
33478
32811
  };
33479
32812
  const handleMouseMove = (e) => {
33480
32813
  const { clientX, clientY } = e;
33481
- if (pointOwnedByFloatingPanel(clientX, clientY)) {
33482
- dismissImageHover();
33483
- clearImageHover();
33484
- return;
33485
- }
32814
+ if (pointOwnedByFloatingPanel(clientX, clientY)) return;
33486
32815
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
33487
32816
  document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
33488
32817
  formHoverElRef.current = null;
@@ -33511,12 +32840,7 @@ function OhhwellsBridge() {
33511
32840
  setHoveredItemRect(null);
33512
32841
  hoveredNavContainerRef.current = null;
33513
32842
  setHoveredNavContainerRect(null);
33514
- siblingHintElRef.current = null;
33515
- setSiblingHintRect(null);
33516
- setSiblingHintRects([]);
33517
32843
  dismissImageHover();
33518
- clearImageHover();
33519
- setSectionGap(null);
33520
32844
  return;
33521
32845
  }
33522
32846
  if (probeSocialsRowAt(clientX, clientY)) return;
@@ -33528,11 +32852,7 @@ function OhhwellsBridge() {
33528
32852
  if (e.data?.type !== "ow:pointer-sync") return;
33529
32853
  const { clientX, clientY } = e.data;
33530
32854
  if (typeof clientX !== "number" || typeof clientY !== "number") return;
33531
- if (pointOwnedByFloatingPanel(clientX, clientY)) {
33532
- dismissImageHover();
33533
- clearImageHover();
33534
- return;
33535
- }
32855
+ if (pointOwnedByFloatingPanel(clientX, clientY)) return;
33536
32856
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
33537
32857
  if (probeSocialsRowAt(clientX, clientY)) return;
33538
32858
  probeSectionGapAt(clientX, clientY);
@@ -33912,7 +33232,6 @@ function OhhwellsBridge() {
33912
33232
  applyAiFooterFromContent(content);
33913
33233
  if (typeof content[STYLE_STORE_KEY] === "string") {
33914
33234
  stylesRef.current = content[STYLE_STORE_KEY];
33915
- document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
33916
33235
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
33917
33236
  }
33918
33237
  applyBrandChrome(content);
@@ -33927,12 +33246,12 @@ function OhhwellsBridge() {
33927
33246
  }
33928
33247
  if (key === AI_SECTIONS_KEY) continue;
33929
33248
  if (key === AI_FOOTER_KEY) continue;
33930
- if (key === LOGO_PLACEHOLDER_KEY) continue;
33931
- if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
33932
33249
  if (key === BRAND_KIT_KEY) continue;
33933
33250
  if (key === STYLE_STORE_KEY) continue;
33934
33251
  if (BRAND_CHROME_KEYS.has(key)) continue;
33252
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
33935
33253
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
33254
+ if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
33936
33255
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
33937
33256
  continue;
33938
33257
  }
@@ -34605,12 +33924,6 @@ function OhhwellsBridge() {
34605
33924
  closeLinkPopoverRef.current();
34606
33925
  return;
34607
33926
  }
34608
- if (floatingPanelOpenRef.current) {
34609
- setFloatingPanelRef.current(null);
34610
- deselectRef.current();
34611
- deactivateRef.current();
34612
- return;
34613
- }
34614
33927
  deselectRef.current();
34615
33928
  deactivateRef.current();
34616
33929
  clearMediaSelectionRef.current();
@@ -35440,10 +34753,10 @@ function OhhwellsBridge() {
35440
34753
  window.removeEventListener("message", handleDuplicateSection);
35441
34754
  window.removeEventListener("message", handleDeactivate);
35442
34755
  window.removeEventListener("message", handleSelectNav);
34756
+ document.documentElement.removeAttribute("data-ohw-panel-dragging");
35443
34757
  window.removeEventListener("message", handleToastAction);
35444
34758
  window.removeEventListener("message", handleFormCount);
35445
34759
  window.removeEventListener("message", handleUiEscape);
35446
- document.documentElement.removeAttribute("data-ohw-panel-dragging");
35447
34760
  autoSaveTimers.current.forEach(clearTimeout);
35448
34761
  autoSaveTimers.current.clear();
35449
34762
  if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
@@ -35737,7 +35050,7 @@ function OhhwellsBridge() {
35737
35050
  postToParent2({
35738
35051
  type: "ow:ready",
35739
35052
  version: "1",
35740
- bridgeVersion: "0.1.179-next.476",
35053
+ bridgeVersion: "0.1.180",
35741
35054
  path: pathname,
35742
35055
  nodes: collectEditableNodes(editContentRef.current),
35743
35056
  sections
@@ -36721,7 +36034,7 @@ function OhhwellsBridge() {
36721
36034
  chromeGap: formHoverElRef.current && getFieldWrapper(formHoverElRef.current) ? 8 : 24
36722
36035
  }
36723
36036
  ),
36724
- fieldPickRect && fieldPickState && !dropdownOptionPick && !isItemDragging && toolbarVariant !== "rich-text" && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
36037
+ fieldPickRect && fieldPickState && !isItemDragging && toolbarVariant !== "rich-text" && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
36725
36038
  ItemInteractionLayer,
36726
36039
  {
36727
36040
  rect: fieldPickRect,
@@ -36738,8 +36051,6 @@ function OhhwellsBridge() {
36738
36051
  {
36739
36052
  type: fieldPickState.type,
36740
36053
  required: fieldPickState.required,
36741
- dropdownOpen: fieldPickState.dropdownOpen,
36742
- onDropdownOpenChange: handleFieldDropdownOpenChange,
36743
36054
  onTypeChange: handleFieldTypeChange,
36744
36055
  onRequiredToggle: handleFieldRequiredToggle,
36745
36056
  onDuplicate: handleFieldDuplicate,
@@ -36748,25 +36059,6 @@ function OhhwellsBridge() {
36748
36059
  )
36749
36060
  }
36750
36061
  ),
36751
- dropdownOptionPick && !isItemDragging && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
36752
- ItemInteractionLayer,
36753
- {
36754
- rect: dropdownOptionPick.rect,
36755
- state: "active-top",
36756
- itemDragSurface: false,
36757
- toolbarAlign: "center",
36758
- chromeGap: 0,
36759
- showHandle: false,
36760
- toolbar: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
36761
- DropdownOptionToolbar,
36762
- {
36763
- canDelete: dropdownOptionPick.canDelete,
36764
- onDuplicate: handleDropdownOptionDuplicate,
36765
- onDelete: handleDropdownOptionDelete
36766
- }
36767
- )
36768
- }
36769
- ),
36770
36062
  fieldDragging ? fieldDropSlots.map((slot, i) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
36771
36063
  "div",
36772
36064
  {