@kontakto/email-template-editor 2.2.2 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,12 +1,13 @@
1
1
  import DOMPurify from 'dompurify';
2
2
  import { marked, Renderer } from 'marked';
3
- import React58, { createContext, forwardRef, useRef, useEffect, useImperativeHandle, useMemo, useContext, useState, useCallback, useLayoutEffect, Fragment } from 'react';
3
+ import React62, { createContext, forwardRef, useRef, useEffect, useImperativeHandle, useMemo, useContext, useState, useCallback, useLayoutEffect, Fragment } from 'react';
4
4
  import { z } from 'zod';
5
5
  import { renderToStaticMarkup as renderToStaticMarkup$1 } from 'react-dom/server';
6
+ import Handlebars from 'handlebars';
6
7
  import { createTheme, alpha, lighten, darken } from '@mui/material/styles';
7
- import { MenuItem, Stack, ThemeProvider, CssBaseline, useTheme, Drawer, Box, Tabs, Tab, Typography, Tooltip, IconButton, TextField, InputAdornment, Chip, CircularProgress, Alert, Divider as Divider$1, ToggleButtonGroup, ToggleButton, Snackbar, Dialog, DialogTitle, DialogContent, DialogActions, Button as Button$1, InputBase, AlertTitle, FormControlLabel, Switch, InputLabel, Menu, Slider, ButtonBase, Popper, Paper, Fade } from '@mui/material';
8
+ import { MenuItem, Stack, ThemeProvider, CssBaseline, useTheme, Drawer, Box, Tabs, Tab, Typography, Tooltip, IconButton, TextField, InputAdornment, Chip, CircularProgress, Alert, ToggleButtonGroup, ToggleButton, Snackbar, Menu, ListItemIcon, ListItemText, Divider as Divider$1, Dialog, DialogTitle, DialogContent, Button as Button$1, DialogActions, List, ListItemButton, InputBase, AlertTitle, FormControlLabel, Switch, InputLabel, Slider, ButtonBase, Popper, Paper, Fade } from '@mui/material';
8
9
  import { create } from 'zustand';
9
- import { AddOutlined, SearchOutlined, MonitorOutlined, PhoneIphoneOutlined, LibraryAddOutlined, ContentCopyOutlined, DriveFileRenameOutlineOutlined, FileUploadOutlined, FileDownloadOutlined, DeleteOutlined, EditOutlined, PreviewOutlined, CodeOutlined, SubjectOutlined, DataObjectOutlined, Add, SaveOutlined, LastPageOutlined, AppRegistrationOutlined, CloudUploadOutlined, FirstPageOutlined, MenuOutlined, InputOutlined, DeleteOutline, RoundedCornerOutlined, AspectRatioOutlined, HeightOutlined, CollectionsOutlined, ErrorOutlineOutlined, VerticalAlignTopOutlined, VerticalAlignCenterOutlined, VerticalAlignBottomOutlined, SpaceBarOutlined, CloseOutlined, AlignVerticalTopOutlined, AlignVerticalBottomOutlined, AlignHorizontalLeftOutlined, AlignHorizontalRightOutlined, FormatAlignLeftOutlined, FormatAlignCenterOutlined, FormatAlignRightOutlined, FormatLineSpacingOutlined, TextFieldsOutlined, FormatBoldOutlined, FormatItalicOutlined, LinkOutlined, ArrowUpwardOutlined, ArrowDownwardOutlined, HMobiledataOutlined, NotesOutlined, SmartButtonOutlined, ImageOutlined, AccountCircleOutlined, ContactMailOutlined, BusinessOutlined, HorizontalRuleOutlined, Crop32Outlined, HtmlOutlined, ViewColumnOutlined } from '@mui/icons-material';
10
+ import { AddOutlined, SearchOutlined, MonitorOutlined, PhoneIphoneOutlined, MoreVertOutlined, DriveFileRenameOutlineOutlined, ContentCopyOutlined, LibraryAddOutlined, FileUploadOutlined, FileDownloadOutlined, DeleteOutlined, InsertDriveFileOutlined, DescriptionOutlined, EditOutlined, PreviewOutlined, CodeOutlined, SubjectOutlined, DataObjectOutlined, LastPageOutlined, AppRegistrationOutlined, CloudUploadOutlined, SaveOutlined, SaveAsOutlined, ViewColumnSharp, ExpandMore, ChevronRight, KeyboardArrowUp, KeyboardArrowDown, FirstPageOutlined, MenuOutlined, GridOnOutlined, SquareOutlined, InputOutlined, DeleteOutline, RoundedCornerOutlined, AspectRatioOutlined, HeightOutlined, CollectionsOutlined, ErrorOutlineOutlined, VerticalAlignTopOutlined, VerticalAlignCenterOutlined, VerticalAlignBottomOutlined, SpaceBarOutlined, BusinessOutlined, ViewColumnOutlined, HtmlOutlined, Crop32Outlined, HorizontalRuleOutlined, ContactMailOutlined, AccountCircleOutlined, ImageOutlined, SmartButtonOutlined, NotesOutlined, HMobiledataOutlined, DashboardOutlined, CloseOutlined, AlignVerticalTopOutlined, AlignVerticalBottomOutlined, AlignHorizontalLeftOutlined, AlignHorizontalRightOutlined, FormatAlignLeftOutlined, FormatAlignCenterOutlined, FormatAlignRightOutlined, FormatLineSpacingOutlined, TextFieldsOutlined, FormatBoldOutlined, FormatItalicOutlined, LinkOutlined, ArrowUpwardOutlined, ArrowDownwardOutlined } from '@mui/icons-material';
10
11
  import { HexColorPicker, HexColorInput } from 'react-colorful';
11
12
  import hljs from 'highlight.js';
12
13
  import jsonHighlighter from 'highlight.js/lib/languages/json';
@@ -180,7 +181,7 @@ function renderInlineMarkdownString(str) {
180
181
  function EmailMarkdown(_a) {
181
182
  var _b = _a, { markdown } = _b, props = __objRest(_b, ["markdown"]);
182
183
  const data = useMemo(() => renderMarkdownString(markdown), [markdown]);
183
- return /* @__PURE__ */ React58.createElement("div", __spreadProps(__spreadValues({}, props), { dangerouslySetInnerHTML: { __html: data } }));
184
+ return /* @__PURE__ */ React62.createElement("div", __spreadProps(__spreadValues({}, props), { dangerouslySetInnerHTML: { __html: data } }));
184
185
  }
185
186
  var FONT_FAMILY_SCHEMA = z.enum([
186
187
  "MODERN_SANS",
@@ -260,9 +261,9 @@ function Text({ style, props }) {
260
261
  };
261
262
  const text = (_g = props == null ? void 0 : props.text) != null ? _g : TextPropsDefaults.text;
262
263
  if (props == null ? void 0 : props.markdown) {
263
- return /* @__PURE__ */ React58.createElement(EmailMarkdown, { style: wStyle, markdown: text });
264
+ return /* @__PURE__ */ React62.createElement(EmailMarkdown, { style: wStyle, markdown: text });
264
265
  }
265
- return /* @__PURE__ */ React58.createElement("div", { style: wStyle }, text);
266
+ return /* @__PURE__ */ React62.createElement("div", { style: wStyle }, text);
266
267
  }
267
268
  var PADDING_SCHEMA2 = z.object({
268
269
  top: z.number(),
@@ -311,7 +312,7 @@ function Avatar({ style, props }) {
311
312
  textAlign: (_e = style == null ? void 0 : style.textAlign) != null ? _e : void 0,
312
313
  padding: getPadding2(style == null ? void 0 : style.padding)
313
314
  };
314
- return /* @__PURE__ */ React58.createElement("div", { style: sectionStyle }, /* @__PURE__ */ React58.createElement(
315
+ return /* @__PURE__ */ React62.createElement("div", { style: sectionStyle }, /* @__PURE__ */ React62.createElement(
315
316
  "img",
316
317
  {
317
318
  alt,
@@ -463,14 +464,14 @@ function Button({ style, props }) {
463
464
  padding: `${padding[0]}px ${padding[1]}px`,
464
465
  textDecoration: "none"
465
466
  };
466
- return /* @__PURE__ */ React58.createElement("div", { style: wrapperStyle }, /* @__PURE__ */ React58.createElement("a", { href: url, style: linkStyle, target: "_blank" }, /* @__PURE__ */ React58.createElement(
467
+ return /* @__PURE__ */ React62.createElement("div", { style: wrapperStyle }, /* @__PURE__ */ React62.createElement("a", { href: url, style: linkStyle, target: "_blank" }, /* @__PURE__ */ React62.createElement(
467
468
  "span",
468
469
  {
469
470
  dangerouslySetInnerHTML: {
470
471
  __html: `<!--[if mso]><i style="letter-spacing: ${padding[1]}px;mso-font-width:-100%;mso-text-raise:${textRaise}" hidden>&nbsp;</i><![endif]-->`
471
472
  }
472
473
  }
473
- ), /* @__PURE__ */ React58.createElement("span", null, text), /* @__PURE__ */ React58.createElement(
474
+ ), /* @__PURE__ */ React62.createElement("span", null, text), /* @__PURE__ */ React62.createElement(
474
475
  "span",
475
476
  {
476
477
  dangerouslySetInnerHTML: {
@@ -519,7 +520,7 @@ function ColumnsContainer({ style, columns, props }) {
519
520
  contentAlignment: (_d = props == null ? void 0 : props.contentAlignment) != null ? _d : ColumnsContainerPropsDefaults.contentAlignment,
520
521
  fixedWidths: props == null ? void 0 : props.fixedWidths
521
522
  };
522
- return /* @__PURE__ */ React58.createElement("div", { style: wStyle }, /* @__PURE__ */ React58.createElement(
523
+ return /* @__PURE__ */ React62.createElement("div", { style: wStyle }, /* @__PURE__ */ React62.createElement(
523
524
  "table",
524
525
  {
525
526
  align: "center",
@@ -528,7 +529,7 @@ function ColumnsContainer({ style, columns, props }) {
528
529
  border: 0,
529
530
  style: { tableLayout: "fixed", borderCollapse: "collapse" }
530
531
  },
531
- /* @__PURE__ */ React58.createElement("tbody", { style: { width: "100%" } }, /* @__PURE__ */ React58.createElement("tr", { style: { width: "100%" } }, /* @__PURE__ */ React58.createElement(TableCell, { index: 0, props: blockProps, columns }), /* @__PURE__ */ React58.createElement(TableCell, { index: 1, props: blockProps, columns }), /* @__PURE__ */ React58.createElement(TableCell, { index: 2, props: blockProps, columns })))
532
+ /* @__PURE__ */ React62.createElement("tbody", { style: { width: "100%" } }, /* @__PURE__ */ React62.createElement("tr", { style: { width: "100%" } }, /* @__PURE__ */ React62.createElement(TableCell, { index: 0, props: blockProps, columns }), /* @__PURE__ */ React62.createElement(TableCell, { index: 1, props: blockProps, columns }), /* @__PURE__ */ React62.createElement(TableCell, { index: 2, props: blockProps, columns })))
532
533
  ));
533
534
  }
534
535
  function TableCell({ index, props, columns }) {
@@ -546,7 +547,7 @@ function TableCell({ index, props, columns }) {
546
547
  width: (_d = (_c = props.fixedWidths) == null ? void 0 : _c[index]) != null ? _d : void 0
547
548
  };
548
549
  const children = (_e = columns && columns[index]) != null ? _e : null;
549
- return /* @__PURE__ */ React58.createElement("td", { style }, children);
550
+ return /* @__PURE__ */ React62.createElement("td", { style }, children);
550
551
  }
551
552
  function getPaddingBefore(index, { columnsGap, columnsCount }) {
552
553
  if (index === 0) {
@@ -608,9 +609,9 @@ function Container({ style, children }) {
608
609
  padding: getPadding5(style == null ? void 0 : style.padding)
609
610
  };
610
611
  if (!children) {
611
- return /* @__PURE__ */ React58.createElement("div", { style: wStyle });
612
+ return /* @__PURE__ */ React62.createElement("div", { style: wStyle });
612
613
  }
613
- return /* @__PURE__ */ React58.createElement("div", { style: wStyle }, children);
614
+ return /* @__PURE__ */ React62.createElement("div", { style: wStyle }, children);
614
615
  }
615
616
  var container_default = Container;
616
617
  var COLOR_SCHEMA5 = z.string().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional();
@@ -644,7 +645,7 @@ function Divider({ style, props }) {
644
645
  };
645
646
  const borderTopWidth = (_b = props == null ? void 0 : props.lineHeight) != null ? _b : DividerPropsDefaults.lineHeight;
646
647
  const borderTopColor = (_c = props == null ? void 0 : props.lineColor) != null ? _c : DividerPropsDefaults.lineColor;
647
- return /* @__PURE__ */ React58.createElement("div", { style: st }, /* @__PURE__ */ React58.createElement(
648
+ return /* @__PURE__ */ React62.createElement("div", { style: st }, /* @__PURE__ */ React62.createElement(
648
649
  "hr",
649
650
  {
650
651
  style: {
@@ -742,11 +743,11 @@ function Heading({ props, style }) {
742
743
  const renderProps = isMarkdown ? { style: hStyle, dangerouslySetInnerHTML: { __html: html2 != null ? html2 : "" } } : { style: hStyle, children: text };
743
744
  switch (level) {
744
745
  case "h1":
745
- return /* @__PURE__ */ React58.createElement("h1", __spreadValues({}, renderProps));
746
+ return /* @__PURE__ */ React62.createElement("h1", __spreadValues({}, renderProps));
746
747
  case "h2":
747
- return /* @__PURE__ */ React58.createElement("h2", __spreadValues({}, renderProps));
748
+ return /* @__PURE__ */ React62.createElement("h2", __spreadValues({}, renderProps));
748
749
  case "h3":
749
- return /* @__PURE__ */ React58.createElement("h3", __spreadValues({}, renderProps));
750
+ return /* @__PURE__ */ React62.createElement("h3", __spreadValues({}, renderProps));
750
751
  }
751
752
  }
752
753
  function getFontSize(level) {
@@ -828,9 +829,9 @@ function Html({ style, props }) {
828
829
  padding: getPadding8(style == null ? void 0 : style.padding)
829
830
  };
830
831
  if (!children) {
831
- return /* @__PURE__ */ React58.createElement("div", { style: cssStyle });
832
+ return /* @__PURE__ */ React62.createElement("div", { style: cssStyle });
832
833
  }
833
- return /* @__PURE__ */ React58.createElement("div", { style: cssStyle, dangerouslySetInnerHTML: { __html: children } });
834
+ return /* @__PURE__ */ React62.createElement("div", { style: cssStyle, dangerouslySetInnerHTML: { __html: children } });
834
835
  }
835
836
  var html_default = Html;
836
837
  var PADDING_SCHEMA9 = z.object({
@@ -866,7 +867,7 @@ function Image({ style, props }) {
866
867
  const linkHref = (_c = props == null ? void 0 : props.linkHref) != null ? _c : null;
867
868
  const width = (_d = props == null ? void 0 : props.width) != null ? _d : void 0;
868
869
  const height = (_e = props == null ? void 0 : props.height) != null ? _e : void 0;
869
- const imageElement = /* @__PURE__ */ React58.createElement(
870
+ const imageElement = /* @__PURE__ */ React62.createElement(
870
871
  "img",
871
872
  {
872
873
  alt: (_f = props == null ? void 0 : props.alt) != null ? _f : "",
@@ -886,9 +887,9 @@ function Image({ style, props }) {
886
887
  }
887
888
  );
888
889
  if (!linkHref) {
889
- return /* @__PURE__ */ React58.createElement("div", { style: sectionStyle }, imageElement);
890
+ return /* @__PURE__ */ React62.createElement("div", { style: sectionStyle }, imageElement);
890
891
  }
891
- return /* @__PURE__ */ React58.createElement("div", { style: sectionStyle }, /* @__PURE__ */ React58.createElement("a", { href: linkHref, style: { textDecoration: "none" }, target: "_blank" }, imageElement));
892
+ return /* @__PURE__ */ React62.createElement("div", { style: sectionStyle }, /* @__PURE__ */ React62.createElement("a", { href: linkHref, style: { textDecoration: "none" }, target: "_blank" }, imageElement));
892
893
  }
893
894
  var image_default = Image;
894
895
  var FONT_FAMILY_SCHEMA5 = z.enum([
@@ -1034,7 +1035,7 @@ function Signature({ style, props }) {
1034
1035
  color: linkColor,
1035
1036
  textDecoration: "none"
1036
1037
  };
1037
- const imageElement = imageUrl ? /* @__PURE__ */ React58.createElement(
1038
+ const imageElement = imageUrl ? /* @__PURE__ */ React62.createElement(
1038
1039
  "img",
1039
1040
  {
1040
1041
  src: imageUrl,
@@ -1053,18 +1054,18 @@ function Signature({ style, props }) {
1053
1054
  }
1054
1055
  ) : null;
1055
1056
  const contactParts = [];
1056
- if (email) contactParts.push(/* @__PURE__ */ React58.createElement("a", { key: "email", href: `mailto:${email}`, style: linkStyle }, email));
1057
- if (phone) contactParts.push(/* @__PURE__ */ React58.createElement("a", { key: "phone", href: `tel:${phone}`, style: linkStyle }, phone));
1057
+ if (email) contactParts.push(/* @__PURE__ */ React62.createElement("a", { key: "email", href: `mailto:${email}`, style: linkStyle }, email));
1058
+ if (phone) contactParts.push(/* @__PURE__ */ React62.createElement("a", { key: "phone", href: `tel:${phone}`, style: linkStyle }, phone));
1058
1059
  if (website) {
1059
1060
  const href = website.startsWith("http") ? website : `https://${website}`;
1060
- contactParts.push(/* @__PURE__ */ React58.createElement("a", { key: "website", href, style: linkStyle, target: "_blank" }, website));
1061
+ contactParts.push(/* @__PURE__ */ React62.createElement("a", { key: "website", href, style: linkStyle, target: "_blank" }, website));
1061
1062
  }
1062
- const textContent = /* @__PURE__ */ React58.createElement("div", null, name && /* @__PURE__ */ React58.createElement("p", { style: nameStyle }, name), title && /* @__PURE__ */ React58.createElement("p", { style: detailStyle }, title), company && /* @__PURE__ */ React58.createElement("p", { style: detailStyle }, company), address && /* @__PURE__ */ React58.createElement("p", { style: detailStyle }, address), contactParts.length > 0 && /* @__PURE__ */ React58.createElement("p", { style: __spreadProps(__spreadValues({}, detailStyle), { marginTop: 4 }) }, contactParts.map((part, i) => /* @__PURE__ */ React58.createElement(React58.Fragment, { key: i }, i > 0 && /* @__PURE__ */ React58.createElement("span", { style: detailStyle }, " \xB7 "), part))));
1063
- const greetingElement = greeting ? /* @__PURE__ */ React58.createElement("p", { style: greetingStyle }, greeting) : null;
1063
+ const textContent = /* @__PURE__ */ React62.createElement("div", null, name && /* @__PURE__ */ React62.createElement("p", { style: nameStyle }, name), title && /* @__PURE__ */ React62.createElement("p", { style: detailStyle }, title), company && /* @__PURE__ */ React62.createElement("p", { style: detailStyle }, company), address && /* @__PURE__ */ React62.createElement("p", { style: detailStyle }, address), contactParts.length > 0 && /* @__PURE__ */ React62.createElement("p", { style: __spreadProps(__spreadValues({}, detailStyle), { marginTop: 4 }) }, contactParts.map((part, i) => /* @__PURE__ */ React62.createElement(React62.Fragment, { key: i }, i > 0 && /* @__PURE__ */ React62.createElement("span", { style: detailStyle }, " \xB7 "), part))));
1064
+ const greetingElement = greeting ? /* @__PURE__ */ React62.createElement("p", { style: greetingStyle }, greeting) : null;
1064
1065
  if (layout === "vertical") {
1065
- return /* @__PURE__ */ React58.createElement("div", { style: wrapperStyle }, greetingElement, imageElement && /* @__PURE__ */ React58.createElement("div", { style: { marginBottom: 12 } }, imageElement), textContent);
1066
+ return /* @__PURE__ */ React62.createElement("div", { style: wrapperStyle }, greetingElement, imageElement && /* @__PURE__ */ React62.createElement("div", { style: { marginBottom: 12 } }, imageElement), textContent);
1066
1067
  }
1067
- return /* @__PURE__ */ React58.createElement("div", { style: wrapperStyle }, greetingElement, /* @__PURE__ */ React58.createElement("table", { cellPadding: "0", cellSpacing: "0", border: 0, role: "presentation" }, /* @__PURE__ */ React58.createElement("tbody", null, /* @__PURE__ */ React58.createElement("tr", null, imageElement && /* @__PURE__ */ React58.createElement("td", { style: { verticalAlign: "middle", paddingRight: 16 } }, imageElement), /* @__PURE__ */ React58.createElement("td", { style: { verticalAlign: "middle" } }, textContent)))));
1068
+ return /* @__PURE__ */ React62.createElement("div", { style: wrapperStyle }, greetingElement, /* @__PURE__ */ React62.createElement("table", { cellPadding: "0", cellSpacing: "0", border: 0, role: "presentation" }, /* @__PURE__ */ React62.createElement("tbody", null, /* @__PURE__ */ React62.createElement("tr", null, imageElement && /* @__PURE__ */ React62.createElement("td", { style: { verticalAlign: "middle", paddingRight: 16 } }, imageElement), /* @__PURE__ */ React62.createElement("td", { style: { verticalAlign: "middle" } }, textContent)))));
1068
1069
  }
1069
1070
  var signature_default = Signature;
1070
1071
  var SpacerPropsSchema = z.object({
@@ -1081,13 +1082,13 @@ function Spacer({ props }) {
1081
1082
  const style = {
1082
1083
  height: (_a = props == null ? void 0 : props.height) != null ? _a : SpacerPropsDefaults.height
1083
1084
  };
1084
- return /* @__PURE__ */ React58.createElement("div", { style });
1085
+ return /* @__PURE__ */ React62.createElement("div", { style });
1085
1086
  }
1086
1087
  var spacer_default = Spacer;
1087
1088
  function buildBlockComponent(blocks) {
1088
1089
  return function BlockComponent({ type, data }) {
1089
1090
  const Component = blocks[type].Component;
1090
- return /* @__PURE__ */ React58.createElement(Component, __spreadValues({}, data));
1091
+ return /* @__PURE__ */ React62.createElement(Component, __spreadValues({}, data));
1091
1092
  };
1092
1093
  }
1093
1094
  function buildBlockConfigurationSchema(blocks) {
@@ -1108,6 +1109,38 @@ function buildBlockConfigurationDictionary(blocks) {
1108
1109
  // src/core/utils.ts
1109
1110
  var DocumentBlocksDictionary = "DocumentBlocksDictionary";
1110
1111
  var BlockConfiguration = "BlockConfiguration";
1112
+ var editorHandlebars = Handlebars.create();
1113
+ editorHandlebars.registerHelper("formatDate", function(value, format) {
1114
+ if (value === null || value === void 0 || value === "") return "";
1115
+ const date = value instanceof Date ? value : new Date(String(value));
1116
+ if (Number.isNaN(date.getTime())) return String(value);
1117
+ const spec = typeof format === "string" ? format : void 0;
1118
+ if (!spec || spec === "iso") return date.toISOString();
1119
+ if (spec === "date") return date.toLocaleDateString();
1120
+ if (spec === "time") return date.toLocaleTimeString();
1121
+ if (spec === "datetime") return date.toLocaleString();
1122
+ return date.toLocaleDateString(void 0, { dateStyle: spec });
1123
+ });
1124
+ editorHandlebars.registerHelper("formatNumber", function(value, options) {
1125
+ if (value === null || value === void 0 || value === "") return "";
1126
+ const num = typeof value === "number" ? value : Number(value);
1127
+ if (Number.isNaN(num)) return String(value);
1128
+ const hashOpts = options && typeof options === "object" && "hash" in options ? options.hash : {};
1129
+ try {
1130
+ return new Intl.NumberFormat(void 0, {
1131
+ style: hashOpts.style,
1132
+ currency: hashOpts.currency,
1133
+ minimumFractionDigits: hashOpts.minimumFractionDigits,
1134
+ maximumFractionDigits: hashOpts.maximumFractionDigits
1135
+ }).format(num);
1136
+ } catch (e) {
1137
+ return String(num);
1138
+ }
1139
+ });
1140
+ function evaluateHandlebars(source, context) {
1141
+ const template = editorHandlebars.compile(source, { strict: false, noEscape: false });
1142
+ return template(context);
1143
+ }
1111
1144
  var BasePropsShape = ColumnsContainerPropsSchema.shape.props.unwrap().unwrap().shape;
1112
1145
  var ColumnsContainerPropsSchema2 = z.object({
1113
1146
  style: ColumnsContainerPropsSchema.shape.style,
@@ -1124,9 +1157,9 @@ function ColumnsContainerReader({ style, props }) {
1124
1157
  const _a = props != null ? props : {}, { columns } = _a, restProps = __objRest(_a, ["columns"]);
1125
1158
  let cols = void 0;
1126
1159
  if (columns) {
1127
- cols = columns.map((col) => col.childrenIds.map((childId) => /* @__PURE__ */ React58.createElement(ReaderBlock, { key: childId, id: childId })));
1160
+ cols = columns.map((col) => col.childrenIds.map((childId) => /* @__PURE__ */ React62.createElement(ReaderBlock, { key: childId, id: childId })));
1128
1161
  }
1129
- return /* @__PURE__ */ React58.createElement(columns_container_default, { props: restProps, columns: cols, style });
1162
+ return /* @__PURE__ */ React62.createElement(columns_container_default, { props: restProps, columns: cols, style });
1130
1163
  }
1131
1164
  var ContainerPropsSchema2 = z.object({
1132
1165
  style: ContainerPropsSchema.shape.style,
@@ -1137,7 +1170,7 @@ var ContainerPropsSchema2 = z.object({
1137
1170
  function ContainerReader({ style, props }) {
1138
1171
  var _a;
1139
1172
  const childrenIds = (_a = props == null ? void 0 : props.childrenIds) != null ? _a : [];
1140
- return /* @__PURE__ */ React58.createElement(container_default, { style }, childrenIds.map((childId) => /* @__PURE__ */ React58.createElement(ReaderBlock, { key: childId, id: childId })));
1173
+ return /* @__PURE__ */ React62.createElement(container_default, { style }, childrenIds.map((childId) => /* @__PURE__ */ React62.createElement(ReaderBlock, { key: childId, id: childId })));
1141
1174
  }
1142
1175
  var COLOR_SCHEMA9 = z.string().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional();
1143
1176
  var FONT_FAMILY_SCHEMA6 = z.enum([
@@ -1210,9 +1243,9 @@ function EmailLayoutReader(props) {
1210
1243
  margin: "0"
1211
1244
  };
1212
1245
  if (props.backdropDisabled) {
1213
- return /* @__PURE__ */ React58.createElement("div", { style: baseStyle }, childrenIds.map((childId) => /* @__PURE__ */ React58.createElement(ReaderBlock, { key: childId, id: childId })));
1246
+ return /* @__PURE__ */ React62.createElement("div", { style: baseStyle }, childrenIds.map((childId) => /* @__PURE__ */ React62.createElement(ReaderBlock, { key: childId, id: childId })));
1214
1247
  }
1215
- return /* @__PURE__ */ React58.createElement(
1248
+ return /* @__PURE__ */ React62.createElement(
1216
1249
  "div",
1217
1250
  {
1218
1251
  style: __spreadProps(__spreadValues({}, baseStyle), {
@@ -1222,7 +1255,7 @@ function EmailLayoutReader(props) {
1222
1255
  width: "100%"
1223
1256
  })
1224
1257
  },
1225
- /* @__PURE__ */ React58.createElement(
1258
+ /* @__PURE__ */ React62.createElement(
1226
1259
  "table",
1227
1260
  {
1228
1261
  align: "center",
@@ -1240,7 +1273,7 @@ function EmailLayoutReader(props) {
1240
1273
  cellPadding: "0",
1241
1274
  border: 0
1242
1275
  },
1243
- /* @__PURE__ */ React58.createElement("tbody", null, /* @__PURE__ */ React58.createElement("tr", { style: { width: "100%" } }, /* @__PURE__ */ React58.createElement("td", null, childrenIds.map((childId) => /* @__PURE__ */ React58.createElement(ReaderBlock, { key: childId, id: childId })))))
1276
+ /* @__PURE__ */ React62.createElement("tbody", null, /* @__PURE__ */ React62.createElement("tr", { style: { width: "100%" } }, /* @__PURE__ */ React62.createElement("td", null, childrenIds.map((childId) => /* @__PURE__ */ React62.createElement(ReaderBlock, { key: childId, id: childId })))))
1244
1277
  )
1245
1278
  );
1246
1279
  }
@@ -1252,7 +1285,7 @@ function useReaderDocument() {
1252
1285
  }
1253
1286
  function ReaderBlock({ id }) {
1254
1287
  const document2 = useReaderDocument();
1255
- return document2[id] ? /* @__PURE__ */ React58.createElement(BaseReaderBlock, __spreadValues({}, document2[id])) : null;
1288
+ return document2[id] ? /* @__PURE__ */ React62.createElement(BaseReaderBlock, __spreadValues({}, document2[id])) : null;
1256
1289
  }
1257
1290
  var READER_DICTIONARY = buildBlockConfigurationDictionary({
1258
1291
  ColumnsContainer: {
@@ -1309,21 +1342,25 @@ var ReaderBlockSchema = buildBlockConfigurationSchema(READER_DICTIONARY);
1309
1342
  var ReaderDocumentSchema = z.record(z.string(), ReaderBlockSchema);
1310
1343
  var BaseReaderBlock = buildBlockComponent(READER_DICTIONARY);
1311
1344
  function Reader({ document: document2, rootBlockId }) {
1312
- return /* @__PURE__ */ React58.createElement(ReaderContext.Provider, { value: document2 }, /* @__PURE__ */ React58.createElement(ReaderBlock, { id: rootBlockId }));
1345
+ return /* @__PURE__ */ React62.createElement(ReaderContext.Provider, { value: document2 }, /* @__PURE__ */ React62.createElement(ReaderBlock, { id: rootBlockId }));
1313
1346
  }
1314
1347
 
1315
1348
  // src/email-builder/renderers/render-to-static-markup.tsx
1316
- function renderToStaticMarkup(document2, { rootBlockId }) {
1317
- return "<!DOCTYPE html>" + renderToStaticMarkup$1(
1318
- /* @__PURE__ */ React58.createElement("html", null, /* @__PURE__ */ React58.createElement("body", null, /* @__PURE__ */ React58.createElement(Reader, { document: document2, rootBlockId })))
1349
+ function renderToStaticMarkup(document2, { rootBlockId, variables }) {
1350
+ const html2 = "<!DOCTYPE html>" + renderToStaticMarkup$1(
1351
+ /* @__PURE__ */ React62.createElement("html", null, /* @__PURE__ */ React62.createElement("body", null, /* @__PURE__ */ React62.createElement(Reader, { document: document2, rootBlockId })))
1319
1352
  );
1353
+ if (!variables) return html2;
1354
+ return evaluateHandlebars(html2, variables);
1320
1355
  }
1321
1356
 
1322
1357
  // src/email-builder/renderers/render-to-text.ts
1323
- function renderToText(document2, { rootBlockId }) {
1358
+ function renderToText(document2, { rootBlockId, variables }) {
1324
1359
  const lines = [];
1325
1360
  renderBlock(document2, rootBlockId, lines);
1326
- return lines.join("\n").replace(/\n{3,}/g, "\n\n").trim() + "\n";
1361
+ const text = lines.join("\n").replace(/\n{3,}/g, "\n\n").trim() + "\n";
1362
+ if (!variables) return text;
1363
+ return evaluateHandlebars(text, variables);
1327
1364
  }
1328
1365
  function renderBlock(document2, blockId, lines) {
1329
1366
  var _a;
@@ -1984,7 +2021,10 @@ var editorStateStore = create(() => ({
1984
2021
  inspectorDrawerOpen: true,
1985
2022
  samplesDrawerOpen: true,
1986
2023
  persistenceEnabled: false,
1987
- lastFocusedEditable: null
2024
+ lastFocusedEditable: null,
2025
+ hoveredBlockId: null,
2026
+ draggingBlock: null,
2027
+ workspaceBackground: "checkerboard"
1988
2028
  }));
1989
2029
  function useDocument() {
1990
2030
  return editorStateStore((s) => s.document);
@@ -2063,6 +2103,27 @@ function useLastFocusedEditable() {
2063
2103
  function getLastFocusedEditable() {
2064
2104
  return editorStateStore.getState().lastFocusedEditable;
2065
2105
  }
2106
+ function useHoveredBlockId() {
2107
+ return editorStateStore((s) => s.hoveredBlockId);
2108
+ }
2109
+ function setHoveredBlockId(hoveredBlockId) {
2110
+ return editorStateStore.setState({ hoveredBlockId });
2111
+ }
2112
+ function useDraggingBlock() {
2113
+ return editorStateStore((s) => s.draggingBlock);
2114
+ }
2115
+ function getDraggingBlock() {
2116
+ return editorStateStore.getState().draggingBlock;
2117
+ }
2118
+ function setDraggingBlock(draggingBlock) {
2119
+ return editorStateStore.setState({ draggingBlock });
2120
+ }
2121
+ function useWorkspaceBackground() {
2122
+ return editorStateStore((s) => s.workspaceBackground);
2123
+ }
2124
+ function setWorkspaceBackground(workspaceBackground) {
2125
+ return editorStateStore.setState({ workspaceBackground });
2126
+ }
2066
2127
  function setLastFocusedEditable(lastFocusedEditable) {
2067
2128
  return editorStateStore.setState({ lastFocusedEditable });
2068
2129
  }
@@ -2137,7 +2198,7 @@ var EmailEditorProvider = ({
2137
2198
  registerSaveListener,
2138
2199
  setCurrentTemplate
2139
2200
  }), [currentTemplateId, currentTemplateName, currentTemplateKind, saveTemplate, loadTemplate, registerSaveListener, setCurrentTemplate]);
2140
- return /* @__PURE__ */ React58.createElement(EmailEditorContext.Provider, { value }, children);
2201
+ return /* @__PURE__ */ React62.createElement(EmailEditorContext.Provider, { value }, children);
2141
2202
  };
2142
2203
  var useEmailEditor = () => {
2143
2204
  const context = useContext(EmailEditorContext);
@@ -2151,20 +2212,20 @@ function ImageCallbacksProvider({
2151
2212
  callbacks,
2152
2213
  children
2153
2214
  }) {
2154
- return /* @__PURE__ */ React58.createElement(ImageCallbacksContext.Provider, { value: callbacks }, children);
2215
+ return /* @__PURE__ */ React62.createElement(ImageCallbacksContext.Provider, { value: callbacks }, children);
2155
2216
  }
2156
2217
  function useImageCallbacks() {
2157
2218
  return useContext(ImageCallbacksContext);
2158
2219
  }
2159
2220
  function BaseSidebarPanel({ title, children }) {
2160
- return /* @__PURE__ */ React58.createElement(Box, { p: 2 }, /* @__PURE__ */ React58.createElement(Typography, { variant: "overline", color: "text.secondary", sx: { display: "block", mb: 2 } }, title), /* @__PURE__ */ React58.createElement(Stack, { spacing: 5, mb: 3 }, children));
2221
+ return /* @__PURE__ */ React62.createElement(Box, { p: 2 }, /* @__PURE__ */ React62.createElement(Typography, { variant: "overline", color: "text.secondary", sx: { display: "block", mb: 2 } }, title), /* @__PURE__ */ React62.createElement(Stack, { spacing: 5, mb: 3 }, children));
2161
2222
  }
2162
2223
  function RadioGroupInput({ label, children, defaultValue, onChange }) {
2163
2224
  const [value, setValue] = useState(defaultValue);
2164
2225
  useEffect(() => {
2165
2226
  setValue(defaultValue);
2166
2227
  }, [defaultValue]);
2167
- return /* @__PURE__ */ React58.createElement(Stack, { alignItems: "flex-start" }, /* @__PURE__ */ React58.createElement(InputLabel, { shrink: true }, label), /* @__PURE__ */ React58.createElement(
2228
+ return /* @__PURE__ */ React62.createElement(Stack, { alignItems: "flex-start" }, /* @__PURE__ */ React62.createElement(InputLabel, { shrink: true }, label), /* @__PURE__ */ React62.createElement(
2168
2229
  ToggleButtonGroup,
2169
2230
  {
2170
2231
  exclusive: true,
@@ -2184,7 +2245,7 @@ function RadioGroupInput({ label, children, defaultValue, onChange }) {
2184
2245
  }
2185
2246
  function RawSliderInput(_a) {
2186
2247
  var _b = _a, { iconLabel, value, setValue, units } = _b, props = __objRest(_b, ["iconLabel", "value", "setValue", "units"]);
2187
- return /* @__PURE__ */ React58.createElement(Stack, { direction: "row", alignItems: "center", spacing: 2, justifyContent: "space-between", width: "100%" }, /* @__PURE__ */ React58.createElement(Box, { sx: { minWidth: 24, lineHeight: 1, flexShrink: 0 } }, iconLabel), /* @__PURE__ */ React58.createElement(
2248
+ return /* @__PURE__ */ React62.createElement(Stack, { direction: "row", alignItems: "center", spacing: 2, justifyContent: "space-between", width: "100%" }, /* @__PURE__ */ React62.createElement(Box, { sx: { minWidth: 24, lineHeight: 1, flexShrink: 0 } }, iconLabel), /* @__PURE__ */ React62.createElement(
2188
2249
  Slider,
2189
2250
  __spreadProps(__spreadValues({}, props), {
2190
2251
  value,
@@ -2195,14 +2256,14 @@ function RawSliderInput(_a) {
2195
2256
  setValue(value2);
2196
2257
  }
2197
2258
  })
2198
- ), /* @__PURE__ */ React58.createElement(Box, { sx: { minWidth: 32, textAlign: "right", flexShrink: 0 } }, /* @__PURE__ */ React58.createElement(Typography, { variant: "body2", color: "text.secondary", sx: { lineHeight: 1 } }, value, units)));
2259
+ ), /* @__PURE__ */ React62.createElement(Box, { sx: { minWidth: 32, textAlign: "right", flexShrink: 0 } }, /* @__PURE__ */ React62.createElement(Typography, { variant: "body2", color: "text.secondary", sx: { lineHeight: 1 } }, value, units)));
2199
2260
  }
2200
2261
 
2201
2262
  // src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/slider-input.tsx
2202
2263
  function SliderInput(_a) {
2203
2264
  var _b = _a, { label, defaultValue, onChange } = _b, props = __objRest(_b, ["label", "defaultValue", "onChange"]);
2204
2265
  const [value, setValue] = useState(defaultValue);
2205
- return /* @__PURE__ */ React58.createElement(Stack, { spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React58.createElement(InputLabel, { shrink: true }, label), /* @__PURE__ */ React58.createElement(
2266
+ return /* @__PURE__ */ React62.createElement(Stack, { spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React62.createElement(InputLabel, { shrink: true }, label), /* @__PURE__ */ React62.createElement(
2206
2267
  RawSliderInput,
2207
2268
  __spreadValues({
2208
2269
  value,
@@ -2219,7 +2280,7 @@ function TextInput({ helperText, label, placeholder, rows, InputProps: InputProp
2219
2280
  useEffect(() => {
2220
2281
  setValue(defaultValue);
2221
2282
  }, [defaultValue]);
2222
- return /* @__PURE__ */ React58.createElement(
2283
+ return /* @__PURE__ */ React62.createElement(
2223
2284
  TextField,
2224
2285
  {
2225
2286
  fullWidth: true,
@@ -2245,7 +2306,7 @@ var TILE_BUTTON = {
2245
2306
  };
2246
2307
  function Swatch({ paletteColors, value, onChange }) {
2247
2308
  const renderButton2 = (colorValue) => {
2248
- return /* @__PURE__ */ React58.createElement(
2309
+ return /* @__PURE__ */ React62.createElement(
2249
2310
  Button$1,
2250
2311
  {
2251
2312
  key: colorValue,
@@ -2264,7 +2325,7 @@ function Swatch({ paletteColors, value, onChange }) {
2264
2325
  }
2265
2326
  );
2266
2327
  };
2267
- return /* @__PURE__ */ React58.createElement(Box, { width: "100%", sx: { display: "grid", gap: 1, gridTemplateColumns: "1fr 1fr 1fr 1fr 1fr 1fr" } }, paletteColors.map((c) => renderButton2(c)));
2328
+ return /* @__PURE__ */ React62.createElement(Box, { width: "100%", sx: { display: "grid", gap: 1, gridTemplateColumns: "1fr 1fr 1fr 1fr 1fr 1fr" } }, paletteColors.map((c) => renderButton2(c)));
2268
2329
  }
2269
2330
 
2270
2331
  // src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/color-input/picker.tsx
@@ -2331,7 +2392,7 @@ var SX = {
2331
2392
  }
2332
2393
  };
2333
2394
  function Picker({ value, onChange }) {
2334
- return /* @__PURE__ */ React58.createElement(Stack, { spacing: 1, sx: SX }, /* @__PURE__ */ React58.createElement(HexColorPicker, { color: value, onChange }), /* @__PURE__ */ React58.createElement(Swatch, { paletteColors: DEFAULT_PRESET_COLORS, value, onChange }), /* @__PURE__ */ React58.createElement(Box, { pt: 1 }, /* @__PURE__ */ React58.createElement(HexColorInput, { prefixed: true, color: value, onChange })));
2395
+ return /* @__PURE__ */ React62.createElement(Stack, { spacing: 1, sx: SX }, /* @__PURE__ */ React62.createElement(HexColorPicker, { color: value, onChange }), /* @__PURE__ */ React62.createElement(Swatch, { paletteColors: DEFAULT_PRESET_COLORS, value, onChange }), /* @__PURE__ */ React62.createElement(Box, { pt: 1 }, /* @__PURE__ */ React62.createElement(HexColorInput, { prefixed: true, color: value, onChange })));
2335
2396
  }
2336
2397
 
2337
2398
  // src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/color-input/base-color-input.tsx
@@ -2356,7 +2417,7 @@ function ColorInput({ label, defaultValue, onChange, nullable }) {
2356
2417
  if (typeof value !== "string" || value.trim().length === 0) {
2357
2418
  return null;
2358
2419
  }
2359
- return /* @__PURE__ */ React58.createElement(
2420
+ return /* @__PURE__ */ React62.createElement(
2360
2421
  ButtonBase,
2361
2422
  {
2362
2423
  onClick: () => {
@@ -2364,16 +2425,16 @@ function ColorInput({ label, defaultValue, onChange, nullable }) {
2364
2425
  onChange(null);
2365
2426
  }
2366
2427
  },
2367
- /* @__PURE__ */ React58.createElement(CloseOutlined, { fontSize: "small", sx: { color: "grey.600" } })
2428
+ /* @__PURE__ */ React62.createElement(CloseOutlined, { fontSize: "small", sx: { color: "grey.600" } })
2368
2429
  );
2369
2430
  };
2370
2431
  const renderOpenButton = () => {
2371
2432
  if (value) {
2372
- return /* @__PURE__ */ React58.createElement(ButtonBase, { onClick: handleClickOpen, sx: __spreadProps(__spreadValues({}, BUTTON_SX), { bgcolor: value }) });
2433
+ return /* @__PURE__ */ React62.createElement(ButtonBase, { onClick: handleClickOpen, sx: __spreadProps(__spreadValues({}, BUTTON_SX), { bgcolor: value }) });
2373
2434
  }
2374
- return /* @__PURE__ */ React58.createElement(ButtonBase, { onClick: handleClickOpen, sx: __spreadValues({}, BUTTON_SX) }, /* @__PURE__ */ React58.createElement(AddOutlined, { fontSize: "small" }));
2435
+ return /* @__PURE__ */ React62.createElement(ButtonBase, { onClick: handleClickOpen, sx: __spreadValues({}, BUTTON_SX) }, /* @__PURE__ */ React62.createElement(AddOutlined, { fontSize: "small" }));
2375
2436
  };
2376
- return /* @__PURE__ */ React58.createElement(Stack, { alignItems: "flex-start" }, /* @__PURE__ */ React58.createElement(InputLabel, { sx: { mb: 0.5 } }, label), /* @__PURE__ */ React58.createElement(Stack, { direction: "row", spacing: 1 }, renderOpenButton(), renderResetButton()), /* @__PURE__ */ React58.createElement(
2437
+ return /* @__PURE__ */ React62.createElement(Stack, { alignItems: "flex-start" }, /* @__PURE__ */ React62.createElement(InputLabel, { sx: { mb: 0.5 } }, label), /* @__PURE__ */ React62.createElement(Stack, { direction: "row", spacing: 1 }, renderOpenButton(), renderResetButton()), /* @__PURE__ */ React62.createElement(
2377
2438
  Menu,
2378
2439
  {
2379
2440
  anchorEl,
@@ -2383,7 +2444,7 @@ function ColorInput({ label, defaultValue, onChange, nullable }) {
2383
2444
  sx: { height: "auto", padding: 0 }
2384
2445
  }
2385
2446
  },
2386
- /* @__PURE__ */ React58.createElement(
2447
+ /* @__PURE__ */ React62.createElement(
2387
2448
  Picker,
2388
2449
  {
2389
2450
  value: value || "",
@@ -2398,10 +2459,10 @@ function ColorInput({ label, defaultValue, onChange, nullable }) {
2398
2459
 
2399
2460
  // src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/color-input/index.tsx
2400
2461
  function ColorInput2(props) {
2401
- return /* @__PURE__ */ React58.createElement(ColorInput, __spreadProps(__spreadValues({}, props), { nullable: false }));
2462
+ return /* @__PURE__ */ React62.createElement(ColorInput, __spreadProps(__spreadValues({}, props), { nullable: false }));
2402
2463
  }
2403
2464
  function NullableColorInput(props) {
2404
- return /* @__PURE__ */ React58.createElement(ColorInput, __spreadProps(__spreadValues({}, props), { nullable: true }));
2465
+ return /* @__PURE__ */ React62.createElement(ColorInput, __spreadProps(__spreadValues({}, props), { nullable: true }));
2405
2466
  }
2406
2467
 
2407
2468
  // src/editor/blocks/helpers/font-family.ts
@@ -2454,13 +2515,13 @@ var FONT_FAMILIES = [
2454
2515
  ];
2455
2516
 
2456
2517
  // src/app/inspector-drawer/configuration-panel/input-panels/helpers/inputs/font-family.tsx
2457
- var OPTIONS = FONT_FAMILIES.map((option) => /* @__PURE__ */ React58.createElement(MenuItem, { key: option.key, value: option.key, sx: { fontFamily: option.value } }, option.label));
2518
+ var OPTIONS = FONT_FAMILIES.map((option) => /* @__PURE__ */ React62.createElement(MenuItem, { key: option.key, value: option.key, sx: { fontFamily: option.value } }, option.label));
2458
2519
  function NullableFontFamily({ label, onChange, defaultValue }) {
2459
2520
  const [value, setValue] = useState(defaultValue != null ? defaultValue : "inherit");
2460
2521
  useEffect(() => {
2461
2522
  setValue(defaultValue != null ? defaultValue : "inherit");
2462
2523
  }, [defaultValue]);
2463
- return /* @__PURE__ */ React58.createElement(
2524
+ return /* @__PURE__ */ React62.createElement(
2464
2525
  TextField,
2465
2526
  {
2466
2527
  select: true,
@@ -2473,7 +2534,7 @@ function NullableFontFamily({ label, onChange, defaultValue }) {
2473
2534
  onChange(v === null ? null : v);
2474
2535
  }
2475
2536
  },
2476
- /* @__PURE__ */ React58.createElement(MenuItem, { value: "inherit" }, "Match email settings"),
2537
+ /* @__PURE__ */ React62.createElement(MenuItem, { value: "inherit" }, "Match email settings"),
2477
2538
  OPTIONS
2478
2539
  );
2479
2540
  }
@@ -2486,10 +2547,10 @@ function FontSizeInput({ label, defaultValue, onChange }) {
2486
2547
  setValue(value2);
2487
2548
  onChange(value2);
2488
2549
  };
2489
- return /* @__PURE__ */ React58.createElement(Stack, { spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React58.createElement(InputLabel, { shrink: true }, label), /* @__PURE__ */ React58.createElement(
2550
+ return /* @__PURE__ */ React62.createElement(Stack, { spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React62.createElement(InputLabel, { shrink: true }, label), /* @__PURE__ */ React62.createElement(
2490
2551
  RawSliderInput,
2491
2552
  {
2492
- iconLabel: /* @__PURE__ */ React58.createElement(TextFieldsOutlined, { sx: { fontSize: 16 } }),
2553
+ iconLabel: /* @__PURE__ */ React62.createElement(TextFieldsOutlined, { sx: { fontSize: 16 } }),
2493
2554
  value,
2494
2555
  setValue: handleChange,
2495
2556
  units: "px",
@@ -2504,7 +2565,7 @@ function FontWeightInput({ label, defaultValue, onChange }) {
2504
2565
  useEffect(() => {
2505
2566
  setValue(defaultValue);
2506
2567
  }, [defaultValue]);
2507
- return /* @__PURE__ */ React58.createElement(
2568
+ return /* @__PURE__ */ React62.createElement(
2508
2569
  RadioGroupInput,
2509
2570
  {
2510
2571
  label,
@@ -2514,8 +2575,8 @@ function FontWeightInput({ label, defaultValue, onChange }) {
2514
2575
  onChange(fontWeight);
2515
2576
  }
2516
2577
  },
2517
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "normal" }, "Regular"),
2518
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "bold" }, "Bold")
2578
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "normal" }, "Regular"),
2579
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "bold" }, "Bold")
2519
2580
  );
2520
2581
  }
2521
2582
  function LetterSpacingInput({ label, defaultValue, onChange }) {
@@ -2527,10 +2588,10 @@ function LetterSpacingInput({ label, defaultValue, onChange }) {
2527
2588
  setValue(v);
2528
2589
  onChange(v === 0 ? null : v);
2529
2590
  };
2530
- return /* @__PURE__ */ React58.createElement(Stack, { spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React58.createElement(InputLabel, { shrink: true }, label), /* @__PURE__ */ React58.createElement(
2591
+ return /* @__PURE__ */ React62.createElement(Stack, { spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React62.createElement(InputLabel, { shrink: true }, label), /* @__PURE__ */ React62.createElement(
2531
2592
  RawSliderInput,
2532
2593
  {
2533
- iconLabel: /* @__PURE__ */ React58.createElement(SpaceBarOutlined, { sx: { fontSize: 16 } }),
2594
+ iconLabel: /* @__PURE__ */ React62.createElement(SpaceBarOutlined, { sx: { fontSize: 16 } }),
2534
2595
  value,
2535
2596
  setValue: handleChange,
2536
2597
  units: "px",
@@ -2549,10 +2610,10 @@ function LineHeightInput({ label, defaultValue, onChange }) {
2549
2610
  setValue(v);
2550
2611
  onChange(v === 0 ? null : v);
2551
2612
  };
2552
- return /* @__PURE__ */ React58.createElement(Stack, { spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React58.createElement(InputLabel, { shrink: true }, label), /* @__PURE__ */ React58.createElement(
2613
+ return /* @__PURE__ */ React62.createElement(Stack, { spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React62.createElement(InputLabel, { shrink: true }, label), /* @__PURE__ */ React62.createElement(
2553
2614
  RawSliderInput,
2554
2615
  {
2555
- iconLabel: /* @__PURE__ */ React58.createElement(FormatLineSpacingOutlined, { sx: { fontSize: 16 } }),
2616
+ iconLabel: /* @__PURE__ */ React62.createElement(FormatLineSpacingOutlined, { sx: { fontSize: 16 } }),
2556
2617
  value,
2557
2618
  setValue: handleChange,
2558
2619
  units: "",
@@ -2581,10 +2642,10 @@ function PaddingInput({ label, defaultValue, onChange }) {
2581
2642
  setValue(v);
2582
2643
  onChange(v);
2583
2644
  }
2584
- return /* @__PURE__ */ React58.createElement(Stack, { spacing: 2, alignItems: "flex-start", pb: 1 }, /* @__PURE__ */ React58.createElement(InputLabel, { shrink: true }, label), /* @__PURE__ */ React58.createElement(
2645
+ return /* @__PURE__ */ React62.createElement(Stack, { spacing: 2, alignItems: "flex-start", pb: 1 }, /* @__PURE__ */ React62.createElement(InputLabel, { shrink: true }, label), /* @__PURE__ */ React62.createElement(
2585
2646
  RawSliderInput,
2586
2647
  {
2587
- iconLabel: /* @__PURE__ */ React58.createElement(AlignVerticalTopOutlined, { sx: { fontSize: 16 } }),
2648
+ iconLabel: /* @__PURE__ */ React62.createElement(AlignVerticalTopOutlined, { sx: { fontSize: 16 } }),
2588
2649
  value: value.top,
2589
2650
  setValue: (num) => handleChange("top", num),
2590
2651
  units: "px",
@@ -2593,10 +2654,10 @@ function PaddingInput({ label, defaultValue, onChange }) {
2593
2654
  max: 80,
2594
2655
  marks: true
2595
2656
  }
2596
- ), /* @__PURE__ */ React58.createElement(
2657
+ ), /* @__PURE__ */ React62.createElement(
2597
2658
  RawSliderInput,
2598
2659
  {
2599
- iconLabel: /* @__PURE__ */ React58.createElement(AlignVerticalBottomOutlined, { sx: { fontSize: 16 } }),
2660
+ iconLabel: /* @__PURE__ */ React62.createElement(AlignVerticalBottomOutlined, { sx: { fontSize: 16 } }),
2600
2661
  value: value.bottom,
2601
2662
  setValue: (num) => handleChange("bottom", num),
2602
2663
  units: "px",
@@ -2605,10 +2666,10 @@ function PaddingInput({ label, defaultValue, onChange }) {
2605
2666
  max: 80,
2606
2667
  marks: true
2607
2668
  }
2608
- ), /* @__PURE__ */ React58.createElement(
2669
+ ), /* @__PURE__ */ React62.createElement(
2609
2670
  RawSliderInput,
2610
2671
  {
2611
- iconLabel: /* @__PURE__ */ React58.createElement(AlignHorizontalLeftOutlined, { sx: { fontSize: 16 } }),
2672
+ iconLabel: /* @__PURE__ */ React62.createElement(AlignHorizontalLeftOutlined, { sx: { fontSize: 16 } }),
2612
2673
  value: value.left,
2613
2674
  setValue: (num) => handleChange("left", num),
2614
2675
  units: "px",
@@ -2617,10 +2678,10 @@ function PaddingInput({ label, defaultValue, onChange }) {
2617
2678
  max: 80,
2618
2679
  marks: true
2619
2680
  }
2620
- ), /* @__PURE__ */ React58.createElement(
2681
+ ), /* @__PURE__ */ React62.createElement(
2621
2682
  RawSliderInput,
2622
2683
  {
2623
- iconLabel: /* @__PURE__ */ React58.createElement(AlignHorizontalRightOutlined, { sx: { fontSize: 16 } }),
2684
+ iconLabel: /* @__PURE__ */ React62.createElement(AlignHorizontalRightOutlined, { sx: { fontSize: 16 } }),
2624
2685
  value: value.right,
2625
2686
  setValue: (num) => handleChange("right", num),
2626
2687
  units: "px",
@@ -2636,7 +2697,7 @@ function TextAlignInput({ label, defaultValue, onChange }) {
2636
2697
  useEffect(() => {
2637
2698
  setValue(defaultValue != null ? defaultValue : "left");
2638
2699
  }, [defaultValue]);
2639
- return /* @__PURE__ */ React58.createElement(
2700
+ return /* @__PURE__ */ React62.createElement(
2640
2701
  RadioGroupInput,
2641
2702
  {
2642
2703
  label,
@@ -2646,9 +2707,9 @@ function TextAlignInput({ label, defaultValue, onChange }) {
2646
2707
  onChange(value2);
2647
2708
  }
2648
2709
  },
2649
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "left" }, /* @__PURE__ */ React58.createElement(FormatAlignLeftOutlined, { fontSize: "small" })),
2650
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "center" }, /* @__PURE__ */ React58.createElement(FormatAlignCenterOutlined, { fontSize: "small" })),
2651
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "right" }, /* @__PURE__ */ React58.createElement(FormatAlignRightOutlined, { fontSize: "small" }))
2710
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "left" }, /* @__PURE__ */ React62.createElement(FormatAlignLeftOutlined, { fontSize: "small" })),
2711
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "center" }, /* @__PURE__ */ React62.createElement(FormatAlignCenterOutlined, { fontSize: "small" })),
2712
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "right" }, /* @__PURE__ */ React62.createElement(FormatAlignRightOutlined, { fontSize: "small" }))
2652
2713
  );
2653
2714
  }
2654
2715
 
@@ -2661,14 +2722,14 @@ function SingleStylePropertyPanel({ name, value, onChange }) {
2661
2722
  };
2662
2723
  switch (name) {
2663
2724
  case "backgroundColor":
2664
- return /* @__PURE__ */ React58.createElement(NullableColorInput, { label: "Background color", defaultValue, onChange: handleChange });
2725
+ return /* @__PURE__ */ React62.createElement(NullableColorInput, { label: "Background color", defaultValue, onChange: handleChange });
2665
2726
  case "borderColor":
2666
- return /* @__PURE__ */ React58.createElement(NullableColorInput, { label: "Border color", defaultValue, onChange: handleChange });
2727
+ return /* @__PURE__ */ React62.createElement(NullableColorInput, { label: "Border color", defaultValue, onChange: handleChange });
2667
2728
  case "borderRadius":
2668
- return /* @__PURE__ */ React58.createElement(
2729
+ return /* @__PURE__ */ React62.createElement(
2669
2730
  SliderInput,
2670
2731
  {
2671
- iconLabel: /* @__PURE__ */ React58.createElement(RoundedCornerOutlined, null),
2732
+ iconLabel: /* @__PURE__ */ React62.createElement(RoundedCornerOutlined, null),
2672
2733
  units: "px",
2673
2734
  step: 4,
2674
2735
  marks: true,
@@ -2680,27 +2741,27 @@ function SingleStylePropertyPanel({ name, value, onChange }) {
2680
2741
  }
2681
2742
  );
2682
2743
  case "color":
2683
- return /* @__PURE__ */ React58.createElement(NullableColorInput, { label: "Text color", defaultValue, onChange: handleChange });
2744
+ return /* @__PURE__ */ React62.createElement(NullableColorInput, { label: "Text color", defaultValue, onChange: handleChange });
2684
2745
  case "fontFamily":
2685
- return /* @__PURE__ */ React58.createElement(NullableFontFamily, { label: "Font family", defaultValue, onChange: handleChange });
2746
+ return /* @__PURE__ */ React62.createElement(NullableFontFamily, { label: "Font family", defaultValue, onChange: handleChange });
2686
2747
  case "fontSize":
2687
- return /* @__PURE__ */ React58.createElement(FontSizeInput, { label: "Font size", defaultValue, onChange: handleChange });
2748
+ return /* @__PURE__ */ React62.createElement(FontSizeInput, { label: "Font size", defaultValue, onChange: handleChange });
2688
2749
  case "fontWeight":
2689
- return /* @__PURE__ */ React58.createElement(FontWeightInput, { label: "Font weight", defaultValue, onChange: handleChange });
2750
+ return /* @__PURE__ */ React62.createElement(FontWeightInput, { label: "Font weight", defaultValue, onChange: handleChange });
2690
2751
  case "lineHeight":
2691
- return /* @__PURE__ */ React58.createElement(LineHeightInput, { label: "Line height", defaultValue, onChange: handleChange });
2752
+ return /* @__PURE__ */ React62.createElement(LineHeightInput, { label: "Line height", defaultValue, onChange: handleChange });
2692
2753
  case "letterSpacing":
2693
- return /* @__PURE__ */ React58.createElement(LetterSpacingInput, { label: "Letter spacing", defaultValue, onChange: handleChange });
2754
+ return /* @__PURE__ */ React62.createElement(LetterSpacingInput, { label: "Letter spacing", defaultValue, onChange: handleChange });
2694
2755
  case "textAlign":
2695
- return /* @__PURE__ */ React58.createElement(TextAlignInput, { label: "Alignment", defaultValue, onChange: handleChange });
2756
+ return /* @__PURE__ */ React62.createElement(TextAlignInput, { label: "Alignment", defaultValue, onChange: handleChange });
2696
2757
  case "padding":
2697
- return /* @__PURE__ */ React58.createElement(PaddingInput, { label: "Padding", defaultValue, onChange: handleChange });
2758
+ return /* @__PURE__ */ React62.createElement(PaddingInput, { label: "Padding", defaultValue, onChange: handleChange });
2698
2759
  }
2699
2760
  }
2700
2761
 
2701
2762
  // src/app/inspector-drawer/configuration-panel/input-panels/helpers/style-inputs/multi-style-property-panel.tsx
2702
2763
  function MultiStylePropertyPanel({ names, value, onChange }) {
2703
- return /* @__PURE__ */ React58.createElement(React58.Fragment, null, names.map((name) => /* @__PURE__ */ React58.createElement(SingleStylePropertyPanel, { key: name, name, value: value || {}, onChange })));
2764
+ return /* @__PURE__ */ React62.createElement(React62.Fragment, null, names.map((name) => /* @__PURE__ */ React62.createElement(SingleStylePropertyPanel, { key: name, name, value: value || {}, onChange })));
2704
2765
  }
2705
2766
 
2706
2767
  // src/app/inspector-drawer/configuration-panel/input-panels/avatar-sidebar-panel.tsx
@@ -2720,11 +2781,11 @@ function AvatarSidebarPanel({ data, setData }) {
2720
2781
  const imageUrl = (_d = (_c = data.props) == null ? void 0 : _c.imageUrl) != null ? _d : AvatarPropsDefaults.imageUrl;
2721
2782
  const alt = (_f = (_e = data.props) == null ? void 0 : _e.alt) != null ? _f : AvatarPropsDefaults.alt;
2722
2783
  const shape = (_h = (_g = data.props) == null ? void 0 : _g.shape) != null ? _h : AvatarPropsDefaults.shape;
2723
- return /* @__PURE__ */ React58.createElement(BaseSidebarPanel, { title: "Avatar block" }, /* @__PURE__ */ React58.createElement(
2784
+ return /* @__PURE__ */ React62.createElement(BaseSidebarPanel, { title: "Avatar block" }, /* @__PURE__ */ React62.createElement(
2724
2785
  SliderInput,
2725
2786
  {
2726
2787
  label: "Size",
2727
- iconLabel: /* @__PURE__ */ React58.createElement(AspectRatioOutlined, { sx: { color: "text.secondary" } }),
2788
+ iconLabel: /* @__PURE__ */ React62.createElement(AspectRatioOutlined, { sx: { color: "text.secondary" } }),
2728
2789
  units: "px",
2729
2790
  step: 3,
2730
2791
  min: 32,
@@ -2734,7 +2795,7 @@ function AvatarSidebarPanel({ data, setData }) {
2734
2795
  updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { size: size2 }) }));
2735
2796
  }
2736
2797
  }
2737
- ), /* @__PURE__ */ React58.createElement(
2798
+ ), /* @__PURE__ */ React62.createElement(
2738
2799
  RadioGroupInput,
2739
2800
  {
2740
2801
  label: "Shape",
@@ -2743,10 +2804,10 @@ function AvatarSidebarPanel({ data, setData }) {
2743
2804
  updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { shape: shape2 }) }));
2744
2805
  }
2745
2806
  },
2746
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "circle" }, "Circle"),
2747
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "square" }, "Square"),
2748
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "rounded" }, "Rounded")
2749
- ), /* @__PURE__ */ React58.createElement(
2807
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "circle" }, "Circle"),
2808
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "square" }, "Square"),
2809
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "rounded" }, "Rounded")
2810
+ ), /* @__PURE__ */ React62.createElement(
2750
2811
  TextInput,
2751
2812
  {
2752
2813
  label: "Image URL",
@@ -2755,7 +2816,7 @@ function AvatarSidebarPanel({ data, setData }) {
2755
2816
  updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { imageUrl: imageUrl2 }) }));
2756
2817
  }
2757
2818
  }
2758
- ), /* @__PURE__ */ React58.createElement(
2819
+ ), /* @__PURE__ */ React62.createElement(
2759
2820
  TextInput,
2760
2821
  {
2761
2822
  label: "Alt text",
@@ -2764,7 +2825,7 @@ function AvatarSidebarPanel({ data, setData }) {
2764
2825
  updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { alt: alt2 }) }));
2765
2826
  }
2766
2827
  }
2767
- ), /* @__PURE__ */ React58.createElement(
2828
+ ), /* @__PURE__ */ React62.createElement(
2768
2829
  MultiStylePropertyPanel,
2769
2830
  {
2770
2831
  names: ["textAlign", "padding"],
@@ -2792,65 +2853,65 @@ function ButtonSidebarPanel({ data, setData }) {
2792
2853
  const buttonStyle = (_j = (_i = data.props) == null ? void 0 : _i.buttonStyle) != null ? _j : ButtonPropsDefaults.buttonStyle;
2793
2854
  const buttonTextColor = (_l = (_k = data.props) == null ? void 0 : _k.buttonTextColor) != null ? _l : ButtonPropsDefaults.buttonTextColor;
2794
2855
  const buttonBackgroundColor = (_n = (_m = data.props) == null ? void 0 : _m.buttonBackgroundColor) != null ? _n : ButtonPropsDefaults.buttonBackgroundColor;
2795
- return /* @__PURE__ */ React58.createElement(BaseSidebarPanel, { title: "Button block" }, /* @__PURE__ */ React58.createElement(
2856
+ return /* @__PURE__ */ React62.createElement(BaseSidebarPanel, { title: "Button block" }, /* @__PURE__ */ React62.createElement(
2796
2857
  TextInput,
2797
2858
  {
2798
2859
  label: "Text",
2799
2860
  defaultValue: text,
2800
2861
  onChange: (text2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { text: text2 }) }))
2801
2862
  }
2802
- ), /* @__PURE__ */ React58.createElement(
2863
+ ), /* @__PURE__ */ React62.createElement(
2803
2864
  TextInput,
2804
2865
  {
2805
2866
  label: "Url",
2806
2867
  defaultValue: url,
2807
2868
  onChange: (url2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { url: url2 }) }))
2808
2869
  }
2809
- ), /* @__PURE__ */ React58.createElement(
2870
+ ), /* @__PURE__ */ React62.createElement(
2810
2871
  RadioGroupInput,
2811
2872
  {
2812
2873
  label: "Width",
2813
2874
  defaultValue: fullWidth ? "FULL_WIDTH" : "AUTO",
2814
2875
  onChange: (v) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { fullWidth: v === "FULL_WIDTH" }) }))
2815
2876
  },
2816
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "FULL_WIDTH" }, "Full"),
2817
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "AUTO" }, "Auto")
2818
- ), /* @__PURE__ */ React58.createElement(
2877
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "FULL_WIDTH" }, "Full"),
2878
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "AUTO" }, "Auto")
2879
+ ), /* @__PURE__ */ React62.createElement(
2819
2880
  RadioGroupInput,
2820
2881
  {
2821
2882
  label: "Size",
2822
2883
  defaultValue: size,
2823
2884
  onChange: (size2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { size: size2 }) }))
2824
2885
  },
2825
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "x-small" }, "Xs"),
2826
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "small" }, "Sm"),
2827
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "medium" }, "Md"),
2828
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "large" }, "Lg")
2829
- ), /* @__PURE__ */ React58.createElement(
2886
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "x-small" }, "Xs"),
2887
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "small" }, "Sm"),
2888
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "medium" }, "Md"),
2889
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "large" }, "Lg")
2890
+ ), /* @__PURE__ */ React62.createElement(
2830
2891
  RadioGroupInput,
2831
2892
  {
2832
2893
  label: "Style",
2833
2894
  defaultValue: buttonStyle,
2834
2895
  onChange: (buttonStyle2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { buttonStyle: buttonStyle2 }) }))
2835
2896
  },
2836
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "rectangle" }, "Rectangle"),
2837
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "rounded" }, "Rounded"),
2838
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "pill" }, "Pill")
2839
- ), /* @__PURE__ */ React58.createElement(
2897
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "rectangle" }, "Rectangle"),
2898
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "rounded" }, "Rounded"),
2899
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "pill" }, "Pill")
2900
+ ), /* @__PURE__ */ React62.createElement(
2840
2901
  ColorInput2,
2841
2902
  {
2842
2903
  label: "Text color",
2843
2904
  defaultValue: buttonTextColor,
2844
2905
  onChange: (buttonTextColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { buttonTextColor: buttonTextColor2 }) }))
2845
2906
  }
2846
- ), /* @__PURE__ */ React58.createElement(
2907
+ ), /* @__PURE__ */ React62.createElement(
2847
2908
  ColorInput2,
2848
2909
  {
2849
2910
  label: "Button color",
2850
2911
  defaultValue: buttonBackgroundColor,
2851
2912
  onChange: (buttonBackgroundColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { buttonBackgroundColor: buttonBackgroundColor2 }) }))
2852
2913
  }
2853
- ), /* @__PURE__ */ React58.createElement(
2914
+ ), /* @__PURE__ */ React62.createElement(
2854
2915
  MultiStylePropertyPanel,
2855
2916
  {
2856
2917
  names: [
@@ -2885,7 +2946,7 @@ function TextDimensionInput({ label, defaultValue, onChange }) {
2885
2946
  const value = parseInt(ev.target.value);
2886
2947
  onChange(isNaN(value) ? null : value);
2887
2948
  };
2888
- return /* @__PURE__ */ React58.createElement(
2949
+ return /* @__PURE__ */ React62.createElement(
2889
2950
  TextField,
2890
2951
  {
2891
2952
  fullWidth: true,
@@ -2896,7 +2957,7 @@ function TextDimensionInput({ label, defaultValue, onChange }) {
2896
2957
  placeholder: "auto",
2897
2958
  size: "small",
2898
2959
  InputProps: {
2899
- endAdornment: /* @__PURE__ */ React58.createElement(Typography, { variant: "body2", color: "text.secondary" }, "px")
2960
+ endAdornment: /* @__PURE__ */ React62.createElement(Typography, { variant: "body2", color: "text.secondary" }, "px")
2900
2961
  }
2901
2962
  }
2902
2963
  );
@@ -2918,7 +2979,7 @@ function ColumnWidthsInput({ defaultValue, onChange }) {
2918
2979
  };
2919
2980
  let column3 = null;
2920
2981
  {
2921
- column3 = /* @__PURE__ */ React58.createElement(
2982
+ column3 = /* @__PURE__ */ React62.createElement(
2922
2983
  TextDimensionInput,
2923
2984
  {
2924
2985
  label: "Column 3",
@@ -2929,7 +2990,7 @@ function ColumnWidthsInput({ defaultValue, onChange }) {
2929
2990
  }
2930
2991
  );
2931
2992
  }
2932
- return /* @__PURE__ */ React58.createElement(Stack, { direction: "row", spacing: 1 }, /* @__PURE__ */ React58.createElement(
2993
+ return /* @__PURE__ */ React62.createElement(Stack, { direction: "row", spacing: 1 }, /* @__PURE__ */ React62.createElement(
2933
2994
  TextDimensionInput,
2934
2995
  {
2935
2996
  label: "Column 1",
@@ -2938,7 +2999,7 @@ function ColumnWidthsInput({ defaultValue, onChange }) {
2938
2999
  setIndexValue(0, v);
2939
3000
  }
2940
3001
  }
2941
- ), /* @__PURE__ */ React58.createElement(
3002
+ ), /* @__PURE__ */ React62.createElement(
2942
3003
  TextDimensionInput,
2943
3004
  {
2944
3005
  label: "Column 2",
@@ -2963,7 +3024,7 @@ function ColumnsContainerPanel({ data, setData }) {
2963
3024
  setErrors(res.error);
2964
3025
  }
2965
3026
  };
2966
- return /* @__PURE__ */ React58.createElement(BaseSidebarPanel, { title: "Columns block" }, /* @__PURE__ */ React58.createElement(
3027
+ return /* @__PURE__ */ React62.createElement(BaseSidebarPanel, { title: "Columns block" }, /* @__PURE__ */ React62.createElement(
2967
3028
  RadioGroupInput,
2968
3029
  {
2969
3030
  label: "Number of columns",
@@ -2972,9 +3033,9 @@ function ColumnsContainerPanel({ data, setData }) {
2972
3033
  updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { columnsCount: v === "2" ? 2 : 3 }) }));
2973
3034
  }
2974
3035
  },
2975
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "2" }, "2"),
2976
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "3" }, "3")
2977
- ), /* @__PURE__ */ React58.createElement(
3036
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "2" }, "2"),
3037
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "3" }, "3")
3038
+ ), /* @__PURE__ */ React62.createElement(
2978
3039
  ColumnWidthsInput,
2979
3040
  {
2980
3041
  defaultValue: (_b = data.props) == null ? void 0 : _b.fixedWidths,
@@ -2982,11 +3043,11 @@ function ColumnsContainerPanel({ data, setData }) {
2982
3043
  updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { fixedWidths }) }));
2983
3044
  }
2984
3045
  }
2985
- ), /* @__PURE__ */ React58.createElement(
3046
+ ), /* @__PURE__ */ React62.createElement(
2986
3047
  SliderInput,
2987
3048
  {
2988
3049
  label: "Columns gap",
2989
- iconLabel: /* @__PURE__ */ React58.createElement(SpaceBarOutlined, { sx: { color: "text.secondary" } }),
3050
+ iconLabel: /* @__PURE__ */ React62.createElement(SpaceBarOutlined, { sx: { color: "text.secondary" } }),
2990
3051
  units: "px",
2991
3052
  step: 4,
2992
3053
  marks: true,
@@ -2995,7 +3056,7 @@ function ColumnsContainerPanel({ data, setData }) {
2995
3056
  defaultValue: (_d = (_c = data.props) == null ? void 0 : _c.columnsGap) != null ? _d : 0,
2996
3057
  onChange: (columnsGap) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { columnsGap }) }))
2997
3058
  }
2998
- ), /* @__PURE__ */ React58.createElement(
3059
+ ), /* @__PURE__ */ React62.createElement(
2999
3060
  RadioGroupInput,
3000
3061
  {
3001
3062
  label: "Alignment",
@@ -3004,10 +3065,10 @@ function ColumnsContainerPanel({ data, setData }) {
3004
3065
  updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { contentAlignment }) }));
3005
3066
  }
3006
3067
  },
3007
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "top" }, /* @__PURE__ */ React58.createElement(VerticalAlignTopOutlined, { fontSize: "small" })),
3008
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "middle" }, /* @__PURE__ */ React58.createElement(VerticalAlignCenterOutlined, { fontSize: "small" })),
3009
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "bottom" }, /* @__PURE__ */ React58.createElement(VerticalAlignBottomOutlined, { fontSize: "small" }))
3010
- ), /* @__PURE__ */ React58.createElement(
3068
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "top" }, /* @__PURE__ */ React62.createElement(VerticalAlignTopOutlined, { fontSize: "small" })),
3069
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "middle" }, /* @__PURE__ */ React62.createElement(VerticalAlignCenterOutlined, { fontSize: "small" })),
3070
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "bottom" }, /* @__PURE__ */ React62.createElement(VerticalAlignBottomOutlined, { fontSize: "small" }))
3071
+ ), /* @__PURE__ */ React62.createElement(
3011
3072
  MultiStylePropertyPanel,
3012
3073
  {
3013
3074
  names: ["backgroundColor", "padding"],
@@ -3036,7 +3097,7 @@ function ContainerSidebarPanel({ data, setData }) {
3036
3097
  setErrors(res.error);
3037
3098
  }
3038
3099
  };
3039
- return /* @__PURE__ */ React58.createElement(BaseSidebarPanel, { title: "Container block" }, /* @__PURE__ */ React58.createElement(
3100
+ return /* @__PURE__ */ React62.createElement(BaseSidebarPanel, { title: "Container block" }, /* @__PURE__ */ React62.createElement(
3040
3101
  MultiStylePropertyPanel,
3041
3102
  {
3042
3103
  names: ["backgroundColor", "borderColor", "borderRadius", "padding"],
@@ -3059,18 +3120,18 @@ function DividerSidebarPanel({ data, setData }) {
3059
3120
  };
3060
3121
  const lineColor = (_b = (_a = data.props) == null ? void 0 : _a.lineColor) != null ? _b : DividerPropsDefaults.lineColor;
3061
3122
  const lineHeight = (_d = (_c = data.props) == null ? void 0 : _c.lineHeight) != null ? _d : DividerPropsDefaults.lineHeight;
3062
- return /* @__PURE__ */ React58.createElement(BaseSidebarPanel, { title: "Divider block" }, /* @__PURE__ */ React58.createElement(
3123
+ return /* @__PURE__ */ React62.createElement(BaseSidebarPanel, { title: "Divider block" }, /* @__PURE__ */ React62.createElement(
3063
3124
  ColorInput2,
3064
3125
  {
3065
3126
  label: "Color",
3066
3127
  defaultValue: lineColor,
3067
3128
  onChange: (lineColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { lineColor: lineColor2 }) }))
3068
3129
  }
3069
- ), /* @__PURE__ */ React58.createElement(
3130
+ ), /* @__PURE__ */ React62.createElement(
3070
3131
  SliderInput,
3071
3132
  {
3072
3133
  label: "Height",
3073
- iconLabel: /* @__PURE__ */ React58.createElement(HeightOutlined, { sx: { color: "text.secondary" } }),
3134
+ iconLabel: /* @__PURE__ */ React62.createElement(HeightOutlined, { sx: { color: "text.secondary" } }),
3074
3135
  units: "px",
3075
3136
  step: 1,
3076
3137
  min: 1,
@@ -3078,7 +3139,7 @@ function DividerSidebarPanel({ data, setData }) {
3078
3139
  defaultValue: lineHeight,
3079
3140
  onChange: (lineHeight2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { lineHeight: lineHeight2 }) }))
3080
3141
  }
3081
- ), /* @__PURE__ */ React58.createElement(
3142
+ ), /* @__PURE__ */ React62.createElement(
3082
3143
  MultiStylePropertyPanel,
3083
3144
  {
3084
3145
  names: ["backgroundColor", "padding"],
@@ -3122,11 +3183,11 @@ function BooleanInput({ label, defaultValue, onChange }) {
3122
3183
  useEffect(() => {
3123
3184
  setValue(defaultValue);
3124
3185
  }, [defaultValue]);
3125
- return /* @__PURE__ */ React58.createElement(
3186
+ return /* @__PURE__ */ React62.createElement(
3126
3187
  FormControlLabel,
3127
3188
  {
3128
3189
  label,
3129
- control: /* @__PURE__ */ React58.createElement(
3190
+ control: /* @__PURE__ */ React62.createElement(
3130
3191
  Switch,
3131
3192
  {
3132
3193
  checked: value,
@@ -3154,38 +3215,38 @@ function EmailLayoutSidebarFields({ data, setData }) {
3154
3215
  }
3155
3216
  };
3156
3217
  const backdropDisabled = (_a = data.backdropDisabled) != null ? _a : false;
3157
- return /* @__PURE__ */ React58.createElement(BaseSidebarPanel, { title: "Global" }, /* @__PURE__ */ React58.createElement(
3218
+ return /* @__PURE__ */ React62.createElement(BaseSidebarPanel, { title: "Global" }, /* @__PURE__ */ React62.createElement(
3158
3219
  BooleanInput,
3159
3220
  {
3160
3221
  label: "Disable backdrop",
3161
3222
  defaultValue: backdropDisabled,
3162
3223
  onChange: (backdropDisabled2) => updateData(__spreadProps(__spreadValues({}, data), { backdropDisabled: backdropDisabled2 }))
3163
3224
  }
3164
- ), !backdropDisabled && /* @__PURE__ */ React58.createElement(React58.Fragment, null, /* @__PURE__ */ React58.createElement(
3225
+ ), !backdropDisabled && /* @__PURE__ */ React62.createElement(React62.Fragment, null, /* @__PURE__ */ React62.createElement(
3165
3226
  ColorInput2,
3166
3227
  {
3167
3228
  label: "Backdrop color",
3168
3229
  defaultValue: (_b = data.backdropColor) != null ? _b : "#F5F5F5",
3169
3230
  onChange: (backdropColor) => updateData(__spreadProps(__spreadValues({}, data), { backdropColor }))
3170
3231
  }
3171
- ), /* @__PURE__ */ React58.createElement(
3232
+ ), /* @__PURE__ */ React62.createElement(
3172
3233
  ColorInput2,
3173
3234
  {
3174
3235
  label: "Canvas color",
3175
3236
  defaultValue: (_c = data.canvasColor) != null ? _c : "#FFFFFF",
3176
3237
  onChange: (canvasColor) => updateData(__spreadProps(__spreadValues({}, data), { canvasColor }))
3177
3238
  }
3178
- ), /* @__PURE__ */ React58.createElement(
3239
+ ), /* @__PURE__ */ React62.createElement(
3179
3240
  NullableColorInput,
3180
3241
  {
3181
3242
  label: "Canvas border color",
3182
3243
  defaultValue: (_d = data.borderColor) != null ? _d : null,
3183
3244
  onChange: (borderColor) => updateData(__spreadProps(__spreadValues({}, data), { borderColor }))
3184
3245
  }
3185
- ), /* @__PURE__ */ React58.createElement(
3246
+ ), /* @__PURE__ */ React62.createElement(
3186
3247
  SliderInput,
3187
3248
  {
3188
- iconLabel: /* @__PURE__ */ React58.createElement(RoundedCornerOutlined, null),
3249
+ iconLabel: /* @__PURE__ */ React62.createElement(RoundedCornerOutlined, null),
3189
3250
  units: "px",
3190
3251
  step: 4,
3191
3252
  marks: true,
@@ -3195,14 +3256,14 @@ function EmailLayoutSidebarFields({ data, setData }) {
3195
3256
  defaultValue: (_e = data.borderRadius) != null ? _e : 0,
3196
3257
  onChange: (borderRadius) => updateData(__spreadProps(__spreadValues({}, data), { borderRadius }))
3197
3258
  }
3198
- )), /* @__PURE__ */ React58.createElement(
3259
+ )), /* @__PURE__ */ React62.createElement(
3199
3260
  NullableFontFamily,
3200
3261
  {
3201
3262
  label: "Font family",
3202
3263
  defaultValue: "MODERN_SANS",
3203
3264
  onChange: (fontFamily) => updateData(__spreadProps(__spreadValues({}, data), { fontFamily }))
3204
3265
  }
3205
- ), /* @__PURE__ */ React58.createElement(
3266
+ ), /* @__PURE__ */ React62.createElement(
3206
3267
  ColorInput2,
3207
3268
  {
3208
3269
  label: "Text color",
@@ -3223,7 +3284,7 @@ function HeadingSidebarPanel({ data, setData }) {
3223
3284
  setErrors(res.error);
3224
3285
  }
3225
3286
  };
3226
- return /* @__PURE__ */ React58.createElement(BaseSidebarPanel, { title: "Heading block" }, /* @__PURE__ */ React58.createElement(
3287
+ return /* @__PURE__ */ React62.createElement(BaseSidebarPanel, { title: "Heading block" }, /* @__PURE__ */ React62.createElement(
3227
3288
  TextInput,
3228
3289
  {
3229
3290
  label: "Content",
@@ -3233,7 +3294,7 @@ function HeadingSidebarPanel({ data, setData }) {
3233
3294
  updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { text }) }));
3234
3295
  }
3235
3296
  }
3236
- ), /* @__PURE__ */ React58.createElement(
3297
+ ), /* @__PURE__ */ React62.createElement(
3237
3298
  RadioGroupInput,
3238
3299
  {
3239
3300
  label: "Level",
@@ -3242,10 +3303,10 @@ function HeadingSidebarPanel({ data, setData }) {
3242
3303
  updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { level }) }));
3243
3304
  }
3244
3305
  },
3245
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "h1" }, "H1"),
3246
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "h2" }, "H2"),
3247
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "h3" }, "H3")
3248
- ), /* @__PURE__ */ React58.createElement(
3306
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "h1" }, "H1"),
3307
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "h2" }, "H2"),
3308
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "h3" }, "H3")
3309
+ ), /* @__PURE__ */ React62.createElement(
3249
3310
  MultiStylePropertyPanel,
3250
3311
  {
3251
3312
  names: [
@@ -3275,7 +3336,7 @@ function HtmlSidebarPanel({ data, setData }) {
3275
3336
  setErrors(res.error);
3276
3337
  }
3277
3338
  };
3278
- return /* @__PURE__ */ React58.createElement(BaseSidebarPanel, { title: "Html block" }, /* @__PURE__ */ React58.createElement(
3339
+ return /* @__PURE__ */ React62.createElement(BaseSidebarPanel, { title: "Html block" }, /* @__PURE__ */ React62.createElement(
3279
3340
  TextInput,
3280
3341
  {
3281
3342
  label: "Content",
@@ -3283,7 +3344,7 @@ function HtmlSidebarPanel({ data, setData }) {
3283
3344
  defaultValue: (_b = (_a = data.props) == null ? void 0 : _a.contents) != null ? _b : "",
3284
3345
  onChange: (contents) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { contents }) }))
3285
3346
  }
3286
- ), /* @__PURE__ */ React58.createElement(
3347
+ ), /* @__PURE__ */ React62.createElement(
3287
3348
  MultiStylePropertyPanel,
3288
3349
  {
3289
3350
  names: ["color", "backgroundColor", "fontFamily", "fontSize", "textAlign", "padding"],
@@ -3340,7 +3401,7 @@ function ImageLibraryDialog({ open, onClose, onPick }) {
3340
3401
  setBusy(false);
3341
3402
  }
3342
3403
  });
3343
- return /* @__PURE__ */ React58.createElement(Dialog, { open, onClose, maxWidth: "md", fullWidth: true }, /* @__PURE__ */ React58.createElement(DialogTitle, null, "Image library"), /* @__PURE__ */ React58.createElement(DialogContent, { dividers: true }, /* @__PURE__ */ React58.createElement(
3404
+ return /* @__PURE__ */ React62.createElement(Dialog, { open, onClose, maxWidth: "md", fullWidth: true }, /* @__PURE__ */ React62.createElement(DialogTitle, null, "Image library"), /* @__PURE__ */ React62.createElement(DialogContent, { dividers: true }, /* @__PURE__ */ React62.createElement(
3344
3405
  TextField,
3345
3406
  {
3346
3407
  fullWidth: true,
@@ -3350,11 +3411,11 @@ function ImageLibraryDialog({ open, onClose, onPick }) {
3350
3411
  onChange: (e) => setQuery(e.target.value),
3351
3412
  autoFocus: true,
3352
3413
  InputProps: {
3353
- startAdornment: /* @__PURE__ */ React58.createElement(InputAdornment, { position: "start" }, /* @__PURE__ */ React58.createElement(SearchOutlined, { fontSize: "small" }))
3414
+ startAdornment: /* @__PURE__ */ React62.createElement(InputAdornment, { position: "start" }, /* @__PURE__ */ React62.createElement(SearchOutlined, { fontSize: "small" }))
3354
3415
  },
3355
3416
  sx: { mb: 2 }
3356
3417
  }
3357
- ), error && /* @__PURE__ */ React58.createElement(Alert, { severity: "error", sx: { mb: 2 } }, error), busy && !images && /* @__PURE__ */ React58.createElement(Stack, { alignItems: "center", sx: { py: 4 } }, /* @__PURE__ */ React58.createElement(CircularProgress, { size: 28 })), filtered && filtered.length === 0 && /* @__PURE__ */ React58.createElement(Typography, { variant: "body2", sx: { color: "text.secondary", textAlign: "center", py: 4 } }, query ? "No images match your search." : "No images in the library yet."), filtered && filtered.length > 0 && /* @__PURE__ */ React58.createElement(
3418
+ ), error && /* @__PURE__ */ React62.createElement(Alert, { severity: "error", sx: { mb: 2 } }, error), busy && !images && /* @__PURE__ */ React62.createElement(Stack, { alignItems: "center", sx: { py: 4 } }, /* @__PURE__ */ React62.createElement(CircularProgress, { size: 28 })), filtered && filtered.length === 0 && /* @__PURE__ */ React62.createElement(Typography, { variant: "body2", sx: { color: "text.secondary", textAlign: "center", py: 4 } }, query ? "No images match your search." : "No images in the library yet."), filtered && filtered.length > 0 && /* @__PURE__ */ React62.createElement(
3358
3419
  Box,
3359
3420
  {
3360
3421
  sx: {
@@ -3363,7 +3424,7 @@ function ImageLibraryDialog({ open, onClose, onPick }) {
3363
3424
  gap: 1.5
3364
3425
  }
3365
3426
  },
3366
- filtered.map((img) => /* @__PURE__ */ React58.createElement(
3427
+ filtered.map((img) => /* @__PURE__ */ React62.createElement(
3367
3428
  ImageTile,
3368
3429
  {
3369
3430
  key: img.url,
@@ -3372,7 +3433,7 @@ function ImageLibraryDialog({ open, onClose, onPick }) {
3372
3433
  onDelete: deleteImage ? () => handleDelete(img.url) : void 0
3373
3434
  }
3374
3435
  ))
3375
- )), /* @__PURE__ */ React58.createElement(DialogActions, null, /* @__PURE__ */ React58.createElement(Button$1, { onClick: onClose }, "Close")));
3436
+ )), /* @__PURE__ */ React62.createElement(DialogActions, null, /* @__PURE__ */ React62.createElement(Button$1, { onClick: onClose }, "Close")));
3376
3437
  }
3377
3438
  function ImageTile({
3378
3439
  image,
@@ -3382,7 +3443,7 @@ function ImageTile({
3382
3443
  var _a, _b;
3383
3444
  const src = (_a = image.thumbnailUrl) != null ? _a : image.url;
3384
3445
  const label = image.alt || image.url.split("/").pop() || "image";
3385
- return /* @__PURE__ */ React58.createElement(
3446
+ return /* @__PURE__ */ React62.createElement(
3386
3447
  Box,
3387
3448
  {
3388
3449
  sx: {
@@ -3398,7 +3459,7 @@ function ImageTile({
3398
3459
  },
3399
3460
  onClick: onPick
3400
3461
  },
3401
- /* @__PURE__ */ React58.createElement(
3462
+ /* @__PURE__ */ React62.createElement(
3402
3463
  Box,
3403
3464
  {
3404
3465
  component: "img",
@@ -3407,8 +3468,8 @@ function ImageTile({
3407
3468
  sx: { display: "block", width: "100%", aspectRatio: "1 / 1", objectFit: "cover", backgroundColor: "#f5f5f5" }
3408
3469
  }
3409
3470
  ),
3410
- /* @__PURE__ */ React58.createElement(Box, { sx: { p: 0.75, fontSize: 11, color: "text.secondary", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, label),
3411
- onDelete && /* @__PURE__ */ React58.createElement(Tooltip, { title: "Delete from library" }, /* @__PURE__ */ React58.createElement(
3471
+ /* @__PURE__ */ React62.createElement(Box, { sx: { p: 0.75, fontSize: 11, color: "text.secondary", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" } }, label),
3472
+ onDelete && /* @__PURE__ */ React62.createElement(Tooltip, { title: "Delete from library" }, /* @__PURE__ */ React62.createElement(
3412
3473
  IconButton,
3413
3474
  {
3414
3475
  size: "small",
@@ -3428,7 +3489,7 @@ function ImageTile({
3428
3489
  },
3429
3490
  "aria-label": "Delete image"
3430
3491
  },
3431
- /* @__PURE__ */ React58.createElement(DeleteOutline, { fontSize: "small" })
3492
+ /* @__PURE__ */ React62.createElement(DeleteOutline, { fontSize: "small" })
3432
3493
  ))
3433
3494
  );
3434
3495
  }
@@ -3481,13 +3542,13 @@ function ImageSidebarPanel({ data, setData }) {
3481
3542
  });
3482
3543
  const url = (_b = (_a = data.props) == null ? void 0 : _a.url) != null ? _b : "";
3483
3544
  const showHttpWarning = isHttpUrl(url);
3484
- return /* @__PURE__ */ React58.createElement(BaseSidebarPanel, { title: "Image block" }, (uploadImage || loadImages) && /* @__PURE__ */ React58.createElement(Stack, { direction: "row", spacing: 1 }, uploadImage && /* @__PURE__ */ React58.createElement(React58.Fragment, null, /* @__PURE__ */ React58.createElement(
3545
+ return /* @__PURE__ */ React62.createElement(BaseSidebarPanel, { title: "Image block" }, (uploadImage || loadImages) && /* @__PURE__ */ React62.createElement(Stack, { direction: "row", spacing: 1 }, uploadImage && /* @__PURE__ */ React62.createElement(React62.Fragment, null, /* @__PURE__ */ React62.createElement(
3485
3546
  Button$1,
3486
3547
  {
3487
3548
  fullWidth: true,
3488
3549
  variant: "outlined",
3489
3550
  size: "small",
3490
- startIcon: uploading ? /* @__PURE__ */ React58.createElement(CircularProgress, { size: 14 }) : /* @__PURE__ */ React58.createElement(CloudUploadOutlined, { fontSize: "small" }),
3551
+ startIcon: uploading ? /* @__PURE__ */ React62.createElement(CircularProgress, { size: 14 }) : /* @__PURE__ */ React62.createElement(CloudUploadOutlined, { fontSize: "small" }),
3491
3552
  disabled: uploading,
3492
3553
  onClick: () => {
3493
3554
  var _a2;
@@ -3495,7 +3556,7 @@ function ImageSidebarPanel({ data, setData }) {
3495
3556
  }
3496
3557
  },
3497
3558
  uploading ? "Uploading\u2026" : "Upload"
3498
- ), /* @__PURE__ */ React58.createElement(
3559
+ ), /* @__PURE__ */ React62.createElement(
3499
3560
  "input",
3500
3561
  {
3501
3562
  ref: fileInputRef,
@@ -3509,17 +3570,17 @@ function ImageSidebarPanel({ data, setData }) {
3509
3570
  if (file) yield handleFile(file);
3510
3571
  })
3511
3572
  }
3512
- )), loadImages && /* @__PURE__ */ React58.createElement(
3573
+ )), loadImages && /* @__PURE__ */ React62.createElement(
3513
3574
  Button$1,
3514
3575
  {
3515
3576
  fullWidth: true,
3516
3577
  variant: "outlined",
3517
3578
  size: "small",
3518
- startIcon: /* @__PURE__ */ React58.createElement(CollectionsOutlined, { fontSize: "small" }),
3579
+ startIcon: /* @__PURE__ */ React62.createElement(CollectionsOutlined, { fontSize: "small" }),
3519
3580
  onClick: () => setLibraryOpen(true)
3520
3581
  },
3521
3582
  "Library"
3522
- )), uploadError && /* @__PURE__ */ React58.createElement(Alert, { severity: "error", onClose: () => setUploadError(null), sx: { mt: 1 } }, uploadError), /* @__PURE__ */ React58.createElement(
3583
+ )), uploadError && /* @__PURE__ */ React62.createElement(Alert, { severity: "error", onClose: () => setUploadError(null), sx: { mt: 1 } }, uploadError), /* @__PURE__ */ React62.createElement(
3523
3584
  TextInput,
3524
3585
  {
3525
3586
  label: "Source URL",
@@ -3529,14 +3590,14 @@ function ImageSidebarPanel({ data, setData }) {
3529
3590
  updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { url: next }) }));
3530
3591
  }
3531
3592
  }
3532
- ), showHttpWarning && /* @__PURE__ */ React58.createElement(Box, { sx: { mt: -1, mb: 1, display: "flex", alignItems: "flex-start", gap: 0.75 } }, /* @__PURE__ */ React58.createElement(ErrorOutlineOutlined, { fontSize: "small", sx: { color: "warning.main", mt: "2px" } }), /* @__PURE__ */ React58.createElement(Box, { sx: { fontSize: 12, color: "warning.dark" } }, "Non-HTTPS URL: Gmail and other clients strip mixed content. Use https:// for reliable delivery.")), /* @__PURE__ */ React58.createElement(
3593
+ ), showHttpWarning && /* @__PURE__ */ React62.createElement(Box, { sx: { mt: -1, mb: 1, display: "flex", alignItems: "flex-start", gap: 0.75 } }, /* @__PURE__ */ React62.createElement(ErrorOutlineOutlined, { fontSize: "small", sx: { color: "warning.main", mt: "2px" } }), /* @__PURE__ */ React62.createElement(Box, { sx: { fontSize: 12, color: "warning.dark" } }, "Non-HTTPS URL: Gmail and other clients strip mixed content. Use https:// for reliable delivery.")), /* @__PURE__ */ React62.createElement(
3533
3594
  TextInput,
3534
3595
  {
3535
3596
  label: "Alt text",
3536
3597
  defaultValue: (_d = (_c = data.props) == null ? void 0 : _c.alt) != null ? _d : "",
3537
3598
  onChange: (alt) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { alt }) }))
3538
3599
  }
3539
- ), /* @__PURE__ */ React58.createElement(
3600
+ ), /* @__PURE__ */ React62.createElement(
3540
3601
  TextInput,
3541
3602
  {
3542
3603
  label: "Click through URL",
@@ -3546,38 +3607,38 @@ function ImageSidebarPanel({ data, setData }) {
3546
3607
  updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { linkHref }) }));
3547
3608
  }
3548
3609
  }
3549
- ), /* @__PURE__ */ React58.createElement(Stack, { direction: "row", spacing: 2 }, /* @__PURE__ */ React58.createElement(
3610
+ ), /* @__PURE__ */ React62.createElement(Stack, { direction: "row", spacing: 2 }, /* @__PURE__ */ React62.createElement(
3550
3611
  TextDimensionInput,
3551
3612
  {
3552
3613
  label: "Width",
3553
3614
  defaultValue: (_g = data.props) == null ? void 0 : _g.width,
3554
3615
  onChange: (width) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { width }) }))
3555
3616
  }
3556
- ), /* @__PURE__ */ React58.createElement(
3617
+ ), /* @__PURE__ */ React62.createElement(
3557
3618
  TextDimensionInput,
3558
3619
  {
3559
3620
  label: "Height",
3560
3621
  defaultValue: (_h = data.props) == null ? void 0 : _h.height,
3561
3622
  onChange: (height) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { height }) }))
3562
3623
  }
3563
- )), /* @__PURE__ */ React58.createElement(
3624
+ )), /* @__PURE__ */ React62.createElement(
3564
3625
  RadioGroupInput,
3565
3626
  {
3566
3627
  label: "Alignment",
3567
3628
  defaultValue: (_j = (_i = data.props) == null ? void 0 : _i.contentAlignment) != null ? _j : "middle",
3568
3629
  onChange: (contentAlignment) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { contentAlignment }) }))
3569
3630
  },
3570
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "top" }, /* @__PURE__ */ React58.createElement(VerticalAlignTopOutlined, { fontSize: "small" })),
3571
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "middle" }, /* @__PURE__ */ React58.createElement(VerticalAlignCenterOutlined, { fontSize: "small" })),
3572
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "bottom" }, /* @__PURE__ */ React58.createElement(VerticalAlignBottomOutlined, { fontSize: "small" }))
3573
- ), /* @__PURE__ */ React58.createElement(
3631
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "top" }, /* @__PURE__ */ React62.createElement(VerticalAlignTopOutlined, { fontSize: "small" })),
3632
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "middle" }, /* @__PURE__ */ React62.createElement(VerticalAlignCenterOutlined, { fontSize: "small" })),
3633
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "bottom" }, /* @__PURE__ */ React62.createElement(VerticalAlignBottomOutlined, { fontSize: "small" }))
3634
+ ), /* @__PURE__ */ React62.createElement(
3574
3635
  MultiStylePropertyPanel,
3575
3636
  {
3576
3637
  names: ["backgroundColor", "textAlign", "padding"],
3577
3638
  value: data.style,
3578
3639
  onChange: (style) => updateData(__spreadProps(__spreadValues({}, data), { style }))
3579
3640
  }
3580
- ), loadImages && /* @__PURE__ */ React58.createElement(
3641
+ ), loadImages && /* @__PURE__ */ React62.createElement(
3581
3642
  ImageLibraryDialog,
3582
3643
  {
3583
3644
  open: libraryOpen,
@@ -3616,74 +3677,74 @@ function SignatureSidebarPanel({ data, setData }) {
3616
3677
  const nameColor = (_z = (_y = data.props) == null ? void 0 : _y.nameColor) != null ? _z : SignaturePropsDefaults.nameColor;
3617
3678
  const textColor = (_B = (_A = data.props) == null ? void 0 : _A.textColor) != null ? _B : SignaturePropsDefaults.textColor;
3618
3679
  const linkColor = (_D = (_C = data.props) == null ? void 0 : _C.linkColor) != null ? _D : SignaturePropsDefaults.linkColor;
3619
- return /* @__PURE__ */ React58.createElement(BaseSidebarPanel, { title: "Signature block" }, /* @__PURE__ */ React58.createElement(
3680
+ return /* @__PURE__ */ React62.createElement(BaseSidebarPanel, { title: "Signature block" }, /* @__PURE__ */ React62.createElement(
3620
3681
  TextInput,
3621
3682
  {
3622
3683
  label: "Greeting",
3623
3684
  defaultValue: greeting,
3624
3685
  onChange: (greeting2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { greeting: greeting2 }) }))
3625
3686
  }
3626
- ), /* @__PURE__ */ React58.createElement(
3687
+ ), /* @__PURE__ */ React62.createElement(
3627
3688
  TextInput,
3628
3689
  {
3629
3690
  label: "Name",
3630
3691
  defaultValue: name,
3631
3692
  onChange: (name2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { name: name2 }) }))
3632
3693
  }
3633
- ), /* @__PURE__ */ React58.createElement(
3694
+ ), /* @__PURE__ */ React62.createElement(
3634
3695
  TextInput,
3635
3696
  {
3636
3697
  label: "Title",
3637
3698
  defaultValue: title,
3638
3699
  onChange: (title2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { title: title2 }) }))
3639
3700
  }
3640
- ), /* @__PURE__ */ React58.createElement(
3701
+ ), /* @__PURE__ */ React62.createElement(
3641
3702
  TextInput,
3642
3703
  {
3643
3704
  label: "Company",
3644
3705
  defaultValue: company,
3645
3706
  onChange: (company2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { company: company2 }) }))
3646
3707
  }
3647
- ), /* @__PURE__ */ React58.createElement(
3708
+ ), /* @__PURE__ */ React62.createElement(
3648
3709
  TextInput,
3649
3710
  {
3650
3711
  label: "Address",
3651
3712
  defaultValue: address,
3652
3713
  onChange: (address2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { address: address2 }) }))
3653
3714
  }
3654
- ), /* @__PURE__ */ React58.createElement(
3715
+ ), /* @__PURE__ */ React62.createElement(
3655
3716
  TextInput,
3656
3717
  {
3657
3718
  label: "Email",
3658
3719
  defaultValue: email,
3659
3720
  onChange: (email2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { email: email2 }) }))
3660
3721
  }
3661
- ), /* @__PURE__ */ React58.createElement(
3722
+ ), /* @__PURE__ */ React62.createElement(
3662
3723
  TextInput,
3663
3724
  {
3664
3725
  label: "Phone",
3665
3726
  defaultValue: phone,
3666
3727
  onChange: (phone2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { phone: phone2 }) }))
3667
3728
  }
3668
- ), /* @__PURE__ */ React58.createElement(
3729
+ ), /* @__PURE__ */ React62.createElement(
3669
3730
  TextInput,
3670
3731
  {
3671
3732
  label: "Website",
3672
3733
  defaultValue: website,
3673
3734
  onChange: (website2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { website: website2 }) }))
3674
3735
  }
3675
- ), /* @__PURE__ */ React58.createElement(
3736
+ ), /* @__PURE__ */ React62.createElement(
3676
3737
  TextInput,
3677
3738
  {
3678
3739
  label: "Image URL",
3679
3740
  defaultValue: imageUrl,
3680
3741
  onChange: (imageUrl2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { imageUrl: imageUrl2 }) }))
3681
3742
  }
3682
- ), /* @__PURE__ */ React58.createElement(
3743
+ ), /* @__PURE__ */ React62.createElement(
3683
3744
  SliderInput,
3684
3745
  {
3685
3746
  label: "Image size",
3686
- iconLabel: /* @__PURE__ */ React58.createElement(AspectRatioOutlined, { sx: { color: "text.secondary" } }),
3747
+ iconLabel: /* @__PURE__ */ React62.createElement(AspectRatioOutlined, { sx: { color: "text.secondary" } }),
3687
3748
  units: "px",
3688
3749
  step: 4,
3689
3750
  min: 32,
@@ -3691,47 +3752,47 @@ function SignatureSidebarPanel({ data, setData }) {
3691
3752
  defaultValue: imageSize,
3692
3753
  onChange: (imageSize2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { imageSize: imageSize2 }) }))
3693
3754
  }
3694
- ), /* @__PURE__ */ React58.createElement(
3755
+ ), /* @__PURE__ */ React62.createElement(
3695
3756
  RadioGroupInput,
3696
3757
  {
3697
3758
  label: "Image shape",
3698
3759
  defaultValue: imageShape,
3699
3760
  onChange: (imageShape2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { imageShape: imageShape2 }) }))
3700
3761
  },
3701
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "circle" }, "Circle"),
3702
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "square" }, "Square"),
3703
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "rounded" }, "Rounded")
3704
- ), /* @__PURE__ */ React58.createElement(
3762
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "circle" }, "Circle"),
3763
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "square" }, "Square"),
3764
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "rounded" }, "Rounded")
3765
+ ), /* @__PURE__ */ React62.createElement(
3705
3766
  RadioGroupInput,
3706
3767
  {
3707
3768
  label: "Layout",
3708
3769
  defaultValue: layout,
3709
3770
  onChange: (layout2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { layout: layout2 }) }))
3710
3771
  },
3711
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "horizontal" }, "Horizontal"),
3712
- /* @__PURE__ */ React58.createElement(ToggleButton, { value: "vertical" }, "Vertical")
3713
- ), /* @__PURE__ */ React58.createElement(
3772
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "horizontal" }, "Horizontal"),
3773
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "vertical" }, "Vertical")
3774
+ ), /* @__PURE__ */ React62.createElement(
3714
3775
  ColorInput2,
3715
3776
  {
3716
3777
  label: "Name color",
3717
3778
  defaultValue: nameColor,
3718
3779
  onChange: (nameColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { nameColor: nameColor2 }) }))
3719
3780
  }
3720
- ), /* @__PURE__ */ React58.createElement(
3781
+ ), /* @__PURE__ */ React62.createElement(
3721
3782
  ColorInput2,
3722
3783
  {
3723
3784
  label: "Text color",
3724
3785
  defaultValue: textColor,
3725
3786
  onChange: (textColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { textColor: textColor2 }) }))
3726
3787
  }
3727
- ), /* @__PURE__ */ React58.createElement(
3788
+ ), /* @__PURE__ */ React62.createElement(
3728
3789
  ColorInput2,
3729
3790
  {
3730
3791
  label: "Link color",
3731
3792
  defaultValue: linkColor,
3732
3793
  onChange: (linkColor2) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { linkColor: linkColor2 }) }))
3733
3794
  }
3734
- ), /* @__PURE__ */ React58.createElement(
3795
+ ), /* @__PURE__ */ React62.createElement(
3735
3796
  MultiStylePropertyPanel,
3736
3797
  {
3737
3798
  names: ["backgroundColor", "fontFamily", "padding"],
@@ -3752,11 +3813,11 @@ function SpacerSidebarPanel({ data, setData }) {
3752
3813
  setErrors(res.error);
3753
3814
  }
3754
3815
  };
3755
- return /* @__PURE__ */ React58.createElement(BaseSidebarPanel, { title: "Spacer block" }, /* @__PURE__ */ React58.createElement(
3816
+ return /* @__PURE__ */ React62.createElement(BaseSidebarPanel, { title: "Spacer block" }, /* @__PURE__ */ React62.createElement(
3756
3817
  SliderInput,
3757
3818
  {
3758
3819
  label: "Height",
3759
- iconLabel: /* @__PURE__ */ React58.createElement(HeightOutlined, { sx: { color: "text.secondary" } }),
3820
+ iconLabel: /* @__PURE__ */ React62.createElement(HeightOutlined, { sx: { color: "text.secondary" } }),
3760
3821
  units: "px",
3761
3822
  step: 4,
3762
3823
  min: 4,
@@ -3778,7 +3839,7 @@ function TextSidebarPanel({ data, setData }) {
3778
3839
  setErrors(res.error);
3779
3840
  }
3780
3841
  };
3781
- return /* @__PURE__ */ React58.createElement(BaseSidebarPanel, { title: "Text block" }, /* @__PURE__ */ React58.createElement(
3842
+ return /* @__PURE__ */ React62.createElement(BaseSidebarPanel, { title: "Text block" }, /* @__PURE__ */ React62.createElement(
3782
3843
  TextInput,
3783
3844
  {
3784
3845
  label: "Content",
@@ -3786,14 +3847,14 @@ function TextSidebarPanel({ data, setData }) {
3786
3847
  defaultValue: (_b = (_a = data.props) == null ? void 0 : _a.text) != null ? _b : "",
3787
3848
  onChange: (text) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { text }) }))
3788
3849
  }
3789
- ), /* @__PURE__ */ React58.createElement(
3850
+ ), /* @__PURE__ */ React62.createElement(
3790
3851
  BooleanInput,
3791
3852
  {
3792
3853
  label: "Markdown",
3793
3854
  defaultValue: (_d = (_c = data.props) == null ? void 0 : _c.markdown) != null ? _d : false,
3794
3855
  onChange: (markdown) => updateData(__spreadProps(__spreadValues({}, data), { props: __spreadProps(__spreadValues({}, data.props), { markdown }) }))
3795
3856
  }
3796
- ), /* @__PURE__ */ React58.createElement(
3857
+ ), /* @__PURE__ */ React62.createElement(
3797
3858
  MultiStylePropertyPanel,
3798
3859
  {
3799
3860
  names: [
@@ -3815,7 +3876,7 @@ function TextSidebarPanel({ data, setData }) {
3815
3876
 
3816
3877
  // src/app/inspector-drawer/configuration-panel/index.tsx
3817
3878
  function renderMessage(val) {
3818
- return /* @__PURE__ */ React58.createElement(Box, { sx: { m: 3, p: 1, border: "1px dashed", borderColor: "divider" } }, /* @__PURE__ */ React58.createElement(Typography, { color: "text.secondary" }, val));
3879
+ return /* @__PURE__ */ React62.createElement(Box, { sx: { m: 3, p: 1, border: "1px dashed", borderColor: "divider" } }, /* @__PURE__ */ React62.createElement(Typography, { color: "text.secondary" }, val));
3819
3880
  }
3820
3881
  function ConfigurationPanel() {
3821
3882
  const document2 = useDocument();
@@ -3831,55 +3892,55 @@ function ConfigurationPanel() {
3831
3892
  const { data, type } = block;
3832
3893
  switch (type) {
3833
3894
  case "Avatar":
3834
- return /* @__PURE__ */ React58.createElement(AvatarSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
3895
+ return /* @__PURE__ */ React62.createElement(AvatarSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
3835
3896
  case "Button":
3836
- return /* @__PURE__ */ React58.createElement(ButtonSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
3897
+ return /* @__PURE__ */ React62.createElement(ButtonSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
3837
3898
  case "ColumnsContainer":
3838
- return /* @__PURE__ */ React58.createElement(ColumnsContainerPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
3899
+ return /* @__PURE__ */ React62.createElement(ColumnsContainerPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
3839
3900
  case "Container":
3840
- return /* @__PURE__ */ React58.createElement(ContainerSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
3901
+ return /* @__PURE__ */ React62.createElement(ContainerSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
3841
3902
  case "Divider":
3842
- return /* @__PURE__ */ React58.createElement(DividerSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
3903
+ return /* @__PURE__ */ React62.createElement(DividerSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
3843
3904
  case "Heading":
3844
- return /* @__PURE__ */ React58.createElement(HeadingSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
3905
+ return /* @__PURE__ */ React62.createElement(HeadingSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
3845
3906
  case "Html":
3846
- return /* @__PURE__ */ React58.createElement(HtmlSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
3907
+ return /* @__PURE__ */ React62.createElement(HtmlSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
3847
3908
  case "Image":
3848
- return /* @__PURE__ */ React58.createElement(ImageSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
3909
+ return /* @__PURE__ */ React62.createElement(ImageSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
3849
3910
  case "EmailLayout":
3850
- return /* @__PURE__ */ React58.createElement(EmailLayoutSidebarFields, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
3911
+ return /* @__PURE__ */ React62.createElement(EmailLayoutSidebarFields, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
3851
3912
  case "Spacer":
3852
- return /* @__PURE__ */ React58.createElement(SpacerSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
3913
+ return /* @__PURE__ */ React62.createElement(SpacerSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
3853
3914
  case "Signature":
3854
- return /* @__PURE__ */ React58.createElement(SignatureSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
3915
+ return /* @__PURE__ */ React62.createElement(SignatureSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
3855
3916
  case "Text":
3856
- return /* @__PURE__ */ React58.createElement(TextSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
3917
+ return /* @__PURE__ */ React62.createElement(TextSidebarPanel, { key: selectedBlockId, data, setData: (data2) => setBlock({ type, data: data2 }) });
3857
3918
  default:
3858
- return /* @__PURE__ */ React58.createElement("pre", null, JSON.stringify(block, null, " "));
3919
+ return /* @__PURE__ */ React62.createElement("pre", null, JSON.stringify(block, null, " "));
3859
3920
  }
3860
3921
  }
3861
3922
  function StylesPanel() {
3862
3923
  const block = useDocument().root;
3863
3924
  if (!block) {
3864
- return /* @__PURE__ */ React58.createElement("p", null, "Block not found");
3925
+ return /* @__PURE__ */ React62.createElement("p", null, "Block not found");
3865
3926
  }
3866
3927
  const { data, type } = block;
3867
3928
  if (type !== "EmailLayout") {
3868
3929
  throw new Error('Expected "root" element to be of type EmailLayout');
3869
3930
  }
3870
- return /* @__PURE__ */ React58.createElement(EmailLayoutSidebarFields, { key: "root", data, setData: (data2) => setDocument({ root: { type, data: data2 } }) });
3931
+ return /* @__PURE__ */ React62.createElement(EmailLayoutSidebarFields, { key: "root", data, setData: (data2) => setDocument({ root: { type, data: data2 } }) });
3871
3932
  }
3872
3933
  function TemplateDownloadButton() {
3873
3934
  const doc = useDocument();
3874
3935
  const href = useMemo(() => {
3875
3936
  return `data:text/plain,${encodeURIComponent(JSON.stringify(doc, null, " "))}`;
3876
3937
  }, [doc]);
3877
- return /* @__PURE__ */ React58.createElement(
3938
+ return /* @__PURE__ */ React62.createElement(
3878
3939
  Button$1,
3879
3940
  {
3880
3941
  variant: "outlined",
3881
3942
  color: "primary",
3882
- startIcon: /* @__PURE__ */ React58.createElement(FileDownloadOutlined, null),
3943
+ startIcon: /* @__PURE__ */ React62.createElement(FileDownloadOutlined, null),
3883
3944
  href,
3884
3945
  download: "emailTemplate.json",
3885
3946
  fullWidth: true
@@ -3893,6 +3954,7 @@ function TemplatePanel({ deleteTemplate, copyTemplate }) {
3893
3954
  const { currentTemplateId, currentTemplateName } = useEmailEditor();
3894
3955
  const document2 = useDocument();
3895
3956
  const persistenceEnabled = usePersistenceEnabled();
3957
+ const workspaceBackground = useWorkspaceBackground();
3896
3958
  const handleDelete = () => {
3897
3959
  if (!currentTemplateId || !window.confirm("Are you sure you want to delete this template?")) {
3898
3960
  return;
@@ -3910,10 +3972,21 @@ function TemplatePanel({ deleteTemplate, copyTemplate }) {
3910
3972
  window.alert("Template copied successfully!");
3911
3973
  }
3912
3974
  };
3975
+ const workspaceToggle = /* @__PURE__ */ React62.createElement(BaseSidebarPanel, { title: "Editor appearance" }, /* @__PURE__ */ React62.createElement(Stack, { spacing: 1 }, /* @__PURE__ */ React62.createElement(Typography, { variant: "caption", sx: { color: "text.secondary" } }, "Workspace background"), /* @__PURE__ */ React62.createElement(
3976
+ ToggleButtonGroup,
3977
+ {
3978
+ value: workspaceBackground,
3979
+ exclusive: true,
3980
+ size: "small",
3981
+ onChange: (_, v) => v && setWorkspaceBackground(v)
3982
+ },
3983
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "checkerboard", sx: { textTransform: "none", gap: 0.75 } }, /* @__PURE__ */ React62.createElement(GridOnOutlined, { fontSize: "small" }), "Checkerboard"),
3984
+ /* @__PURE__ */ React62.createElement(ToggleButton, { value: "solid", sx: { textTransform: "none", gap: 0.75 } }, /* @__PURE__ */ React62.createElement(SquareOutlined, { fontSize: "small" }), "Solid")
3985
+ ), /* @__PURE__ */ React62.createElement(Typography, { variant: "caption", sx: { color: "text.disabled" } }, "Editor-only \u2014 never reaches the rendered email.")));
3913
3986
  if (!currentTemplateId) {
3914
- return /* @__PURE__ */ React58.createElement(BaseSidebarPanel, { title: "Template" }, "No template selected");
3987
+ return /* @__PURE__ */ React62.createElement(React62.Fragment, null, /* @__PURE__ */ React62.createElement(BaseSidebarPanel, { title: "Template" }, "No template selected"), workspaceToggle);
3915
3988
  }
3916
- return /* @__PURE__ */ React58.createElement(React58.Fragment, null, /* @__PURE__ */ React58.createElement(BaseSidebarPanel, { title: "Template" }, /* @__PURE__ */ React58.createElement(Stack, { spacing: 2 }, !persistenceEnabled && /* @__PURE__ */ React58.createElement(
3989
+ return /* @__PURE__ */ React62.createElement(React62.Fragment, null, /* @__PURE__ */ React62.createElement(BaseSidebarPanel, { title: "Template" }, /* @__PURE__ */ React62.createElement(Stack, { spacing: 2 }, !persistenceEnabled && /* @__PURE__ */ React62.createElement(
3917
3990
  Typography,
3918
3991
  {
3919
3992
  variant: "body2",
@@ -3926,29 +3999,29 @@ function TemplatePanel({ deleteTemplate, copyTemplate }) {
3926
3999
  }
3927
4000
  },
3928
4001
  "Save functionality is disabled. To enable saving, provide the necessary callback functions."
3929
- ), persistenceEnabled && /* @__PURE__ */ React58.createElement(React58.Fragment, null, /* @__PURE__ */ React58.createElement(
4002
+ ), persistenceEnabled && /* @__PURE__ */ React62.createElement(React62.Fragment, null, /* @__PURE__ */ React62.createElement(
3930
4003
  Button$1,
3931
4004
  {
3932
4005
  variant: "outlined",
3933
4006
  color: "primary",
3934
- startIcon: /* @__PURE__ */ React58.createElement(ContentCopyOutlined, null),
4007
+ startIcon: /* @__PURE__ */ React62.createElement(ContentCopyOutlined, null),
3935
4008
  onClick: handleCopyToSamples,
3936
4009
  fullWidth: true,
3937
4010
  disabled: !copyTemplate
3938
4011
  },
3939
4012
  "Save as Sample Template"
3940
- ), /* @__PURE__ */ React58.createElement(
4013
+ ), /* @__PURE__ */ React62.createElement(
3941
4014
  Button$1,
3942
4015
  {
3943
4016
  variant: "outlined",
3944
4017
  color: "error",
3945
- startIcon: /* @__PURE__ */ React58.createElement(DeleteOutlined, null),
4018
+ startIcon: /* @__PURE__ */ React62.createElement(DeleteOutlined, null),
3946
4019
  onClick: handleDelete,
3947
4020
  fullWidth: true,
3948
4021
  disabled: !deleteTemplate
3949
4022
  },
3950
4023
  "Delete Template"
3951
- )))), persistenceEnabled && /* @__PURE__ */ React58.createElement(BaseSidebarPanel, { title: "Export" }, /* @__PURE__ */ React58.createElement(Stack, { spacing: 2 }, /* @__PURE__ */ React58.createElement(TemplateDownloadButton, null))));
4024
+ )))), persistenceEnabled && /* @__PURE__ */ React62.createElement(BaseSidebarPanel, { title: "Export" }, /* @__PURE__ */ React62.createElement(Stack, { spacing: 2 }, /* @__PURE__ */ React62.createElement(TemplateDownloadButton, null))), workspaceToggle);
3952
4025
  }
3953
4026
 
3954
4027
  // src/app/variables/variable-utils.ts
@@ -4122,7 +4195,7 @@ function VariablesPanel() {
4122
4195
  const lastFocused = useLastFocusedEditable();
4123
4196
  const root = document2.root;
4124
4197
  if (!root || root.type !== "EmailLayout") {
4125
- return /* @__PURE__ */ React58.createElement(Box, { p: 2 }, /* @__PURE__ */ React58.createElement(Alert, { severity: "info" }, "Open a template to manage variables."));
4198
+ return /* @__PURE__ */ React62.createElement(Box, { p: 2 }, /* @__PURE__ */ React62.createElement(Alert, { severity: "info" }, "Open a template to manage variables."));
4126
4199
  }
4127
4200
  const data = root.data;
4128
4201
  const variables = ((_a = data.variables) != null ? _a : []).map((v) => {
@@ -4217,7 +4290,7 @@ function VariablesPanel() {
4217
4290
  } catch (e) {
4218
4291
  }
4219
4292
  });
4220
- return /* @__PURE__ */ React58.createElement(Box, { p: 2 }, /* @__PURE__ */ React58.createElement(Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", sx: { mb: 1 } }, /* @__PURE__ */ React58.createElement(Typography, { variant: "subtitle1", sx: { fontWeight: 600 } }, "Variables"), /* @__PURE__ */ React58.createElement(Tooltip, { title: "Add variable" }, /* @__PURE__ */ React58.createElement(IconButton, { size: "small", onClick: add, "aria-label": "Add variable" }, /* @__PURE__ */ React58.createElement(AddOutlined, { fontSize: "small" })))), /* @__PURE__ */ React58.createElement(Typography, { variant: "caption", sx: { color: "text.secondary", display: "block", mb: 2 } }, "Declared variables travel with the template. Reference them in subject and body as", " ", /* @__PURE__ */ React58.createElement(Box, { component: "code", sx: { fontFamily: "monospace" } }, "{{name}}"), ". In Preview mode, tokens render with the sample values below."), undeclared.length > 0 && /* @__PURE__ */ React58.createElement(Alert, { severity: "warning", sx: { mb: 2 } }, /* @__PURE__ */ React58.createElement(AlertTitle, { sx: { fontSize: 13 } }, "Undeclared in body"), /* @__PURE__ */ React58.createElement(Stack, { direction: "row", spacing: 0.5, useFlexGap: true, flexWrap: "wrap" }, undeclared.map((name) => /* @__PURE__ */ React58.createElement(
4293
+ return /* @__PURE__ */ React62.createElement(Box, { p: 2 }, /* @__PURE__ */ React62.createElement(Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", sx: { mb: 1 } }, /* @__PURE__ */ React62.createElement(Typography, { variant: "subtitle1", sx: { fontWeight: 600 } }, "Variables"), /* @__PURE__ */ React62.createElement(Tooltip, { title: "Add variable" }, /* @__PURE__ */ React62.createElement(IconButton, { size: "small", onClick: add, "aria-label": "Add variable" }, /* @__PURE__ */ React62.createElement(AddOutlined, { fontSize: "small" })))), /* @__PURE__ */ React62.createElement(Typography, { variant: "caption", sx: { color: "text.secondary", display: "block", mb: 2 } }, "Declared variables travel with the template. Reference them in subject and body as", " ", /* @__PURE__ */ React62.createElement(Box, { component: "code", sx: { fontFamily: "monospace" } }, "{{name}}"), ". In Preview mode, tokens render with the sample values below."), undeclared.length > 0 && /* @__PURE__ */ React62.createElement(Alert, { severity: "warning", sx: { mb: 2 } }, /* @__PURE__ */ React62.createElement(AlertTitle, { sx: { fontSize: 13 } }, "Undeclared in body"), /* @__PURE__ */ React62.createElement(Stack, { direction: "row", spacing: 0.5, useFlexGap: true, flexWrap: "wrap" }, undeclared.map((name) => /* @__PURE__ */ React62.createElement(
4221
4294
  Chip,
4222
4295
  {
4223
4296
  key: name,
@@ -4225,12 +4298,12 @@ function VariablesPanel() {
4225
4298
  label: name,
4226
4299
  onClick: () => addFromToken(name),
4227
4300
  onDelete: () => addFromToken(name),
4228
- deleteIcon: /* @__PURE__ */ React58.createElement(AddOutlined, null),
4301
+ deleteIcon: /* @__PURE__ */ React62.createElement(AddOutlined, null),
4229
4302
  sx: { fontFamily: "monospace" }
4230
4303
  }
4231
- ))), /* @__PURE__ */ React58.createElement(Typography, { variant: "caption", sx: { color: "text.secondary", display: "block", mt: 0.5 } }, "Click a token to declare it.")), variables.length === 0 ? /* @__PURE__ */ React58.createElement(Typography, { variant: "body2", sx: { color: "text.secondary" } }, "No variables declared. Click + to add one.") : /* @__PURE__ */ React58.createElement(Stack, { spacing: 2 }, variables.map((v, i) => {
4304
+ ))), /* @__PURE__ */ React62.createElement(Typography, { variant: "caption", sx: { color: "text.secondary", display: "block", mt: 0.5 } }, "Click a token to declare it.")), variables.length === 0 ? /* @__PURE__ */ React62.createElement(Typography, { variant: "body2", sx: { color: "text.secondary" } }, "No variables declared. Click + to add one.") : /* @__PURE__ */ React62.createElement(Stack, { spacing: 2 }, variables.map((v, i) => {
4232
4305
  var _a2;
4233
- return /* @__PURE__ */ React58.createElement(
4306
+ return /* @__PURE__ */ React62.createElement(
4234
4307
  VariableRow,
4235
4308
  {
4236
4309
  key: i,
@@ -4281,7 +4354,7 @@ function VariableRow({
4281
4354
  onCommitRename(draftName.trim());
4282
4355
  }
4283
4356
  };
4284
- return /* @__PURE__ */ React58.createElement(Stack, { spacing: 0.75, sx: { pb: 1, borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React58.createElement(Stack, { direction: "row", spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React58.createElement(
4357
+ return /* @__PURE__ */ React62.createElement(Stack, { spacing: 0.75, sx: { pb: 1, borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React62.createElement(Stack, { direction: "row", spacing: 1, alignItems: "flex-start" }, /* @__PURE__ */ React62.createElement(
4285
4358
  TextField,
4286
4359
  {
4287
4360
  label: "Name",
@@ -4306,7 +4379,7 @@ function VariableRow({
4306
4379
  error: Boolean(nameError),
4307
4380
  helperText: nameError != null ? nameError : " "
4308
4381
  }
4309
- ), /* @__PURE__ */ React58.createElement(Stack, { direction: "row", spacing: 0.25, sx: { mt: 0.5 } }, /* @__PURE__ */ React58.createElement(Tooltip, { title: "Copy {{name}}" }, /* @__PURE__ */ React58.createElement("span", null, /* @__PURE__ */ React58.createElement(
4382
+ ), /* @__PURE__ */ React62.createElement(Stack, { direction: "row", spacing: 0.25, sx: { mt: 0.5 } }, /* @__PURE__ */ React62.createElement(Tooltip, { title: "Copy {{name}}" }, /* @__PURE__ */ React62.createElement("span", null, /* @__PURE__ */ React62.createElement(
4310
4383
  IconButton,
4311
4384
  {
4312
4385
  size: "small",
@@ -4314,8 +4387,8 @@ function VariableRow({
4314
4387
  disabled: !hasName,
4315
4388
  "aria-label": `Copy ${variable.name || "variable"} token`
4316
4389
  },
4317
- /* @__PURE__ */ React58.createElement(ContentCopyOutlined, { fontSize: "small" })
4318
- ))), /* @__PURE__ */ React58.createElement(Tooltip, { title: canInsert ? "Insert at cursor" : "Focus a text field first" }, /* @__PURE__ */ React58.createElement("span", null, /* @__PURE__ */ React58.createElement(
4390
+ /* @__PURE__ */ React62.createElement(ContentCopyOutlined, { fontSize: "small" })
4391
+ ))), /* @__PURE__ */ React62.createElement(Tooltip, { title: canInsert ? "Insert at cursor" : "Focus a text field first" }, /* @__PURE__ */ React62.createElement("span", null, /* @__PURE__ */ React62.createElement(
4319
4392
  IconButton,
4320
4393
  {
4321
4394
  size: "small",
@@ -4323,16 +4396,16 @@ function VariableRow({
4323
4396
  disabled: !hasName || !canInsert,
4324
4397
  "aria-label": `Insert ${variable.name || "variable"} at cursor`
4325
4398
  },
4326
- /* @__PURE__ */ React58.createElement(InputOutlined, { fontSize: "small" })
4327
- ))), /* @__PURE__ */ React58.createElement(Tooltip, { title: "Remove" }, /* @__PURE__ */ React58.createElement(
4399
+ /* @__PURE__ */ React62.createElement(InputOutlined, { fontSize: "small" })
4400
+ ))), /* @__PURE__ */ React62.createElement(Tooltip, { title: "Remove" }, /* @__PURE__ */ React62.createElement(
4328
4401
  IconButton,
4329
4402
  {
4330
4403
  size: "small",
4331
4404
  onClick: onRemove,
4332
4405
  "aria-label": `Remove ${variable.name || "variable"}`
4333
4406
  },
4334
- /* @__PURE__ */ React58.createElement(DeleteOutline, { fontSize: "small" })
4335
- )))), /* @__PURE__ */ React58.createElement(
4407
+ /* @__PURE__ */ React62.createElement(DeleteOutline, { fontSize: "small" })
4408
+ )))), /* @__PURE__ */ React62.createElement(
4336
4409
  TextField,
4337
4410
  {
4338
4411
  label: "Description",
@@ -4342,7 +4415,7 @@ function VariableRow({
4342
4415
  onChange: (e) => onChangeDescription(e.target.value),
4343
4416
  placeholder: "Optional"
4344
4417
  }
4345
- ), /* @__PURE__ */ React58.createElement(
4418
+ ), /* @__PURE__ */ React62.createElement(
4346
4419
  TextField,
4347
4420
  {
4348
4421
  label: "Sample value",
@@ -4352,7 +4425,7 @@ function VariableRow({
4352
4425
  onChange: (e) => onChangeSampleValue(e.target.value),
4353
4426
  placeholder: "Shown in Preview mode",
4354
4427
  InputProps: {
4355
- startAdornment: /* @__PURE__ */ React58.createElement(
4428
+ startAdornment: /* @__PURE__ */ React62.createElement(
4356
4429
  DataObjectOutlined,
4357
4430
  {
4358
4431
  fontSize: "small",
@@ -4361,7 +4434,7 @@ function VariableRow({
4361
4434
  )
4362
4435
  }
4363
4436
  }
4364
- ), /* @__PURE__ */ React58.createElement(Stack, { direction: "row", spacing: 0.5, sx: { pt: 0.25 } }, hasName && (unused ? /* @__PURE__ */ React58.createElement(Chip, { size: "small", color: "warning", variant: "outlined", label: "Unused in body" }) : /* @__PURE__ */ React58.createElement(
4437
+ ), /* @__PURE__ */ React62.createElement(Stack, { direction: "row", spacing: 0.5, sx: { pt: 0.25 } }, hasName && (unused ? /* @__PURE__ */ React62.createElement(Chip, { size: "small", color: "warning", variant: "outlined", label: "Unused in body" }) : /* @__PURE__ */ React62.createElement(
4365
4438
  Chip,
4366
4439
  {
4367
4440
  size: "small",
@@ -4385,13 +4458,13 @@ function InspectorDrawer({
4385
4458
  const renderCurrentSidebarPanel = () => {
4386
4459
  switch (selectedSidebarTab) {
4387
4460
  case "block-configuration":
4388
- return /* @__PURE__ */ React58.createElement(ConfigurationPanel, null);
4461
+ return /* @__PURE__ */ React62.createElement(ConfigurationPanel, null);
4389
4462
  case "styles":
4390
- return /* @__PURE__ */ React58.createElement(StylesPanel, null);
4463
+ return /* @__PURE__ */ React62.createElement(StylesPanel, null);
4391
4464
  case "variables":
4392
- return /* @__PURE__ */ React58.createElement(VariablesPanel, null);
4465
+ return /* @__PURE__ */ React62.createElement(VariablesPanel, null);
4393
4466
  case "template-settings":
4394
- return /* @__PURE__ */ React58.createElement(
4467
+ return /* @__PURE__ */ React62.createElement(
4395
4468
  TemplatePanel,
4396
4469
  {
4397
4470
  deleteTemplate,
@@ -4400,7 +4473,7 @@ function InspectorDrawer({
4400
4473
  );
4401
4474
  }
4402
4475
  };
4403
- return /* @__PURE__ */ React58.createElement(
4476
+ return /* @__PURE__ */ React62.createElement(
4404
4477
  Drawer,
4405
4478
  {
4406
4479
  variant: "persistent",
@@ -4422,7 +4495,7 @@ function InspectorDrawer({
4422
4495
  width: inspectorDrawerOpen ? INSPECTOR_DRAWER_WIDTH : 0
4423
4496
  }
4424
4497
  },
4425
- /* @__PURE__ */ React58.createElement(Box, { sx: { width: INSPECTOR_DRAWER_WIDTH, height: 49, borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React58.createElement(Box, { px: 1 }, /* @__PURE__ */ React58.createElement(
4498
+ /* @__PURE__ */ React62.createElement(Box, { sx: { width: INSPECTOR_DRAWER_WIDTH, height: 49, borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React62.createElement(Box, { px: 1 }, /* @__PURE__ */ React62.createElement(
4426
4499
  Tabs,
4427
4500
  {
4428
4501
  value: selectedSidebarTab,
@@ -4430,12 +4503,12 @@ function InspectorDrawer({
4430
4503
  variant: "fullWidth",
4431
4504
  sx: { "& .MuiTab-root": { minWidth: 0, px: 1, fontSize: 13 } }
4432
4505
  },
4433
- /* @__PURE__ */ React58.createElement(Tab, { value: "styles", label: "Styles" }),
4434
- /* @__PURE__ */ React58.createElement(Tab, { value: "block-configuration", label: "Inspect" }),
4435
- /* @__PURE__ */ React58.createElement(Tab, { value: "variables", label: "Variables" }),
4436
- /* @__PURE__ */ React58.createElement(Tab, { value: "template-settings", label: "Settings" })
4506
+ /* @__PURE__ */ React62.createElement(Tab, { value: "styles", label: "Styles" }),
4507
+ /* @__PURE__ */ React62.createElement(Tab, { value: "block-configuration", label: "Inspect" }),
4508
+ /* @__PURE__ */ React62.createElement(Tab, { value: "variables", label: "Variables" }),
4509
+ /* @__PURE__ */ React62.createElement(Tab, { value: "template-settings", label: "Settings" })
4437
4510
  ))),
4438
- /* @__PURE__ */ React58.createElement(Box, { sx: { width: INSPECTOR_DRAWER_WIDTH, height: "calc(100% - 49px)", overflow: "auto" } }, renderCurrentSidebarPanel())
4511
+ /* @__PURE__ */ React62.createElement(Box, { sx: { width: INSPECTOR_DRAWER_WIDTH, height: "calc(100% - 49px)", overflow: "auto" } }, renderCurrentSidebarPanel())
4439
4512
  );
4440
4513
  }
4441
4514
  var SnackbarContext = createContext(null);
@@ -4456,7 +4529,7 @@ function SnackbarProvider({ children }) {
4456
4529
  const handleClose = () => {
4457
4530
  setMessage(null);
4458
4531
  };
4459
- return /* @__PURE__ */ React58.createElement(SnackbarContext.Provider, { value: { showMessage } }, children, /* @__PURE__ */ React58.createElement(
4532
+ return /* @__PURE__ */ React62.createElement(SnackbarContext.Provider, { value: { showMessage } }, children, /* @__PURE__ */ React62.createElement(
4460
4533
  Snackbar,
4461
4534
  {
4462
4535
  anchorOrigin: { vertical: "top", horizontal: "center" },
@@ -4504,6 +4577,16 @@ function TemplateRow({
4504
4577
  }) {
4505
4578
  const { setCurrentTemplate } = useEmailEditor();
4506
4579
  const [hover, setHover] = useState(false);
4580
+ const [menuAnchor, setMenuAnchor] = useState(null);
4581
+ const closeMenu = () => setMenuAnchor(null);
4582
+ const openMenu = (e) => {
4583
+ e.stopPropagation();
4584
+ setMenuAnchor(e.currentTarget);
4585
+ };
4586
+ const runAction = (fn) => () => {
4587
+ closeMenu();
4588
+ fn == null ? void 0 : fn();
4589
+ };
4507
4590
  const handleClick = () => __async(null, null, function* () {
4508
4591
  try {
4509
4592
  const content = yield templateLoader();
@@ -4522,7 +4605,7 @@ function TemplateRow({
4522
4605
  const hasActions = Boolean(
4523
4606
  onDuplicate || onRename || onDelete || onPromote || onDemote || onDuplicateAsTemplate
4524
4607
  );
4525
- return /* @__PURE__ */ React58.createElement(
4608
+ return /* @__PURE__ */ React62.createElement(
4526
4609
  Box,
4527
4610
  {
4528
4611
  role: "button",
@@ -4548,7 +4631,7 @@ function TemplateRow({
4548
4631
  "&:focus-visible": { outline: "2px solid", outlineColor: "primary.main" }
4549
4632
  }
4550
4633
  },
4551
- /* @__PURE__ */ React58.createElement(Stack, { direction: "row", alignItems: "flex-start", spacing: 1 }, /* @__PURE__ */ React58.createElement(Box, { sx: { flexGrow: 1, minWidth: 0 } }, /* @__PURE__ */ React58.createElement(Stack, { direction: "row", alignItems: "baseline", spacing: 1, sx: { minWidth: 0 } }, /* @__PURE__ */ React58.createElement(
4634
+ /* @__PURE__ */ React62.createElement(Stack, { direction: "row", alignItems: "flex-start", spacing: 1 }, /* @__PURE__ */ React62.createElement(Box, { sx: { flexGrow: 1, minWidth: 0, pr: hasActions ? 3 : 0 } }, /* @__PURE__ */ React62.createElement(Stack, { direction: "row", alignItems: "baseline", spacing: 1, sx: { minWidth: 0 } }, /* @__PURE__ */ React62.createElement(
4552
4635
  Typography,
4553
4636
  {
4554
4637
  variant: "body2",
@@ -4562,14 +4645,14 @@ function TemplateRow({
4562
4645
  title: template.slug
4563
4646
  },
4564
4647
  template.slug
4565
- ), updated && /* @__PURE__ */ React58.createElement(
4648
+ ), updated && !hasActions && /* @__PURE__ */ React62.createElement(
4566
4649
  Typography,
4567
4650
  {
4568
4651
  variant: "caption",
4569
4652
  sx: { color: "text.secondary", flexShrink: 0, fontSize: "0.7rem" }
4570
4653
  },
4571
4654
  updated
4572
- )), template.description && /* @__PURE__ */ React58.createElement(
4655
+ )), template.description && /* @__PURE__ */ React62.createElement(
4573
4656
  Typography,
4574
4657
  {
4575
4658
  variant: "caption",
@@ -4583,7 +4666,7 @@ function TemplateRow({
4583
4666
  }
4584
4667
  },
4585
4668
  template.description
4586
- ), template.tags && template.tags.length > 0 && /* @__PURE__ */ React58.createElement(Stack, { direction: "row", spacing: 0.5, sx: { mt: 0.5, flexWrap: "wrap", gap: 0.5 } }, template.tags.map((tag) => /* @__PURE__ */ React58.createElement(
4669
+ ), template.tags && template.tags.length > 0 && /* @__PURE__ */ React62.createElement(Stack, { direction: "row", spacing: 0.5, sx: { mt: 0.5, flexWrap: "wrap", gap: 0.5 } }, template.tags.map((tag) => /* @__PURE__ */ React62.createElement(
4587
4670
  Chip,
4588
4671
  {
4589
4672
  key: tag,
@@ -4592,164 +4675,807 @@ function TemplateRow({
4592
4675
  sx: { height: 18, fontSize: "0.65rem", "& .MuiChip-label": { px: 0.75 } }
4593
4676
  }
4594
4677
  ))))),
4595
- hasActions && hover && /* @__PURE__ */ React58.createElement(
4596
- Stack,
4678
+ hasActions && /* @__PURE__ */ React62.createElement(React62.Fragment, null, /* @__PURE__ */ React62.createElement(Tooltip, { title: "More" }, /* @__PURE__ */ React62.createElement(
4679
+ IconButton,
4597
4680
  {
4598
- direction: "row",
4599
- spacing: 0.25,
4600
- onClick: stop,
4681
+ size: "small",
4682
+ onClick: openMenu,
4683
+ "aria-label": "Row actions",
4684
+ "aria-haspopup": "menu",
4685
+ "aria-expanded": Boolean(menuAnchor) || void 0,
4601
4686
  sx: {
4602
4687
  position: "absolute",
4603
4688
  top: 4,
4604
4689
  right: 4,
4605
- bgcolor: "background.paper",
4606
- borderRadius: 1,
4607
- boxShadow: 1,
4608
- p: 0.25
4690
+ opacity: hover || isCurrent || Boolean(menuAnchor) ? 1 : 0.45,
4691
+ transition: "opacity 120ms"
4609
4692
  }
4610
4693
  },
4611
- onDuplicateAsTemplate && /* @__PURE__ */ React58.createElement(Tooltip, { title: "Duplicate as template" }, /* @__PURE__ */ React58.createElement(
4612
- IconButton,
4613
- {
4614
- size: "small",
4615
- onClick: (e) => {
4616
- stop(e);
4617
- onDuplicateAsTemplate();
4618
- }
4619
- },
4620
- /* @__PURE__ */ React58.createElement(LibraryAddOutlined, { fontSize: "small" })
4621
- )),
4622
- onDuplicate && /* @__PURE__ */ React58.createElement(Tooltip, { title: "Duplicate" }, /* @__PURE__ */ React58.createElement(
4623
- IconButton,
4624
- {
4625
- size: "small",
4626
- onClick: (e) => {
4627
- stop(e);
4628
- onDuplicate();
4629
- }
4630
- },
4631
- /* @__PURE__ */ React58.createElement(ContentCopyOutlined, { fontSize: "small" })
4632
- )),
4633
- onRename && /* @__PURE__ */ React58.createElement(Tooltip, { title: "Rename" }, /* @__PURE__ */ React58.createElement(
4634
- IconButton,
4635
- {
4636
- size: "small",
4637
- onClick: (e) => {
4638
- stop(e);
4639
- onRename();
4640
- }
4694
+ /* @__PURE__ */ React62.createElement(MoreVertOutlined, { fontSize: "small" })
4695
+ )), /* @__PURE__ */ React62.createElement(
4696
+ Menu,
4697
+ {
4698
+ anchorEl: menuAnchor,
4699
+ open: Boolean(menuAnchor),
4700
+ onClose: closeMenu,
4701
+ onClick: stop,
4702
+ anchorOrigin: { vertical: "bottom", horizontal: "right" },
4703
+ transformOrigin: { vertical: "top", horizontal: "right" },
4704
+ slotProps: { paper: { sx: { minWidth: 200 } } }
4705
+ },
4706
+ onRename && /* @__PURE__ */ React62.createElement(MenuItem, { onClick: runAction(onRename) }, /* @__PURE__ */ React62.createElement(ListItemIcon, null, /* @__PURE__ */ React62.createElement(DriveFileRenameOutlineOutlined, { fontSize: "small" })), /* @__PURE__ */ React62.createElement(ListItemText, null, "Edit name & tags\u2026")),
4707
+ onDuplicate && /* @__PURE__ */ React62.createElement(MenuItem, { onClick: runAction(onDuplicate) }, /* @__PURE__ */ React62.createElement(ListItemIcon, null, /* @__PURE__ */ React62.createElement(ContentCopyOutlined, { fontSize: "small" })), /* @__PURE__ */ React62.createElement(ListItemText, null, "Duplicate")),
4708
+ onDuplicateAsTemplate && /* @__PURE__ */ React62.createElement(MenuItem, { onClick: runAction(onDuplicateAsTemplate) }, /* @__PURE__ */ React62.createElement(ListItemIcon, null, /* @__PURE__ */ React62.createElement(LibraryAddOutlined, { fontSize: "small" })), /* @__PURE__ */ React62.createElement(ListItemText, null, "Duplicate as template")),
4709
+ onPromote && /* @__PURE__ */ React62.createElement(MenuItem, { onClick: runAction(onPromote) }, /* @__PURE__ */ React62.createElement(ListItemIcon, null, /* @__PURE__ */ React62.createElement(FileUploadOutlined, { fontSize: "small" })), /* @__PURE__ */ React62.createElement(ListItemText, null, "Promote to sample")),
4710
+ onDemote && /* @__PURE__ */ React62.createElement(MenuItem, { onClick: runAction(onDemote) }, /* @__PURE__ */ React62.createElement(ListItemIcon, null, /* @__PURE__ */ React62.createElement(FileDownloadOutlined, { fontSize: "small" })), /* @__PURE__ */ React62.createElement(ListItemText, null, "Demote to template")),
4711
+ onDelete && [
4712
+ /* @__PURE__ */ React62.createElement(Divider$1, { key: "divider" }),
4713
+ /* @__PURE__ */ React62.createElement(MenuItem, { key: "delete", onClick: runAction(onDelete), sx: { color: "error.main" } }, /* @__PURE__ */ React62.createElement(ListItemIcon, { sx: { color: "error.main" } }, /* @__PURE__ */ React62.createElement(DeleteOutlined, { fontSize: "small" })), /* @__PURE__ */ React62.createElement(ListItemText, null, "Delete"))
4714
+ ]
4715
+ ))
4716
+ );
4717
+ }
4718
+
4719
+ // src/editor/blocks/helpers/move-block.ts
4720
+ function sameParent(a, b) {
4721
+ if (a.kind !== b.kind || a.parentId !== b.parentId) return false;
4722
+ if (a.kind === "ColumnsContainer" && b.kind === "ColumnsContainer") {
4723
+ return a.columnIndex === b.columnIndex;
4724
+ }
4725
+ return true;
4726
+ }
4727
+ function getChildrenIds(doc, ref) {
4728
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
4729
+ const block = doc[ref.parentId];
4730
+ if (!block) return [];
4731
+ if (ref.kind === "EmailLayout") return (_b = (_a = block.data) == null ? void 0 : _a.childrenIds) != null ? _b : [];
4732
+ if (ref.kind === "Container") return (_e = (_d = (_c = block.data) == null ? void 0 : _c.props) == null ? void 0 : _d.childrenIds) != null ? _e : [];
4733
+ const col = (_h = (_g = (_f = block.data) == null ? void 0 : _f.props) == null ? void 0 : _g.columns) == null ? void 0 : _h[ref.columnIndex];
4734
+ return (_i = col == null ? void 0 : col.childrenIds) != null ? _i : [];
4735
+ }
4736
+ function patchChildrenIds(block, ref, newIds) {
4737
+ var _a, _b, _c;
4738
+ if (ref.kind === "EmailLayout") {
4739
+ return __spreadProps(__spreadValues({}, block), { data: __spreadProps(__spreadValues({}, block.data), { childrenIds: newIds }) });
4740
+ }
4741
+ if (ref.kind === "Container") {
4742
+ return __spreadProps(__spreadValues({}, block), {
4743
+ data: __spreadProps(__spreadValues({}, block.data), { props: __spreadProps(__spreadValues({}, block.data.props), { childrenIds: newIds }) })
4744
+ });
4745
+ }
4746
+ const columns = ((_c = (_b = (_a = block.data) == null ? void 0 : _a.props) == null ? void 0 : _b.columns) != null ? _c : []).map(
4747
+ (c, i) => i === ref.columnIndex ? __spreadProps(__spreadValues({}, c), { childrenIds: newIds }) : c
4748
+ );
4749
+ return __spreadProps(__spreadValues({}, block), { data: __spreadProps(__spreadValues({}, block.data), { props: __spreadProps(__spreadValues({}, block.data.props), { columns }) }) });
4750
+ }
4751
+ function isDescendant(doc, ancestorId, candidateId) {
4752
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
4753
+ if (ancestorId === candidateId) return true;
4754
+ const block = doc[ancestorId];
4755
+ if (!block) return false;
4756
+ const direct = [];
4757
+ if (block.type === "EmailLayout") direct.push(...(_b = (_a = block.data) == null ? void 0 : _a.childrenIds) != null ? _b : []);
4758
+ if (block.type === "Container") direct.push(...(_e = (_d = (_c = block.data) == null ? void 0 : _c.props) == null ? void 0 : _d.childrenIds) != null ? _e : []);
4759
+ if (block.type === "ColumnsContainer") {
4760
+ for (const col of (_h = (_g = (_f = block.data) == null ? void 0 : _f.props) == null ? void 0 : _g.columns) != null ? _h : []) {
4761
+ direct.push(...(_i = col.childrenIds) != null ? _i : []);
4762
+ }
4763
+ }
4764
+ for (const childId of direct) {
4765
+ if (isDescendant(doc, childId, candidateId)) return true;
4766
+ }
4767
+ return false;
4768
+ }
4769
+ function buildMovePatch(doc, sourceId, sourceParent, targetParent, targetIndex) {
4770
+ var _a, _b, _c;
4771
+ if (isDescendant(doc, sourceId, targetParent.parentId)) return null;
4772
+ const srcIds = getChildrenIds(doc, sourceParent);
4773
+ const sourceIndex = srcIds.indexOf(sourceId);
4774
+ if (sourceIndex < 0) return null;
4775
+ if (sameParent(sourceParent, targetParent)) {
4776
+ const arr = [...srcIds];
4777
+ arr.splice(sourceIndex, 1);
4778
+ let insertAt2 = targetIndex;
4779
+ if (insertAt2 > sourceIndex) insertAt2 -= 1;
4780
+ if (insertAt2 < 0) insertAt2 = 0;
4781
+ if (insertAt2 > arr.length) insertAt2 = arr.length;
4782
+ arr.splice(insertAt2, 0, sourceId);
4783
+ if (arr.every((id, i) => id === srcIds[i])) return null;
4784
+ const sourceBlock2 = doc[sourceParent.parentId];
4785
+ return {
4786
+ [sourceParent.parentId]: patchChildrenIds(sourceBlock2, sourceParent, arr)
4787
+ };
4788
+ }
4789
+ const newSrcIds = [...srcIds];
4790
+ newSrcIds.splice(sourceIndex, 1);
4791
+ const tgtIds = getChildrenIds(doc, targetParent);
4792
+ const newTgtIds = [...tgtIds];
4793
+ let insertAt = targetIndex;
4794
+ if (insertAt < 0) insertAt = 0;
4795
+ if (insertAt > newTgtIds.length) insertAt = newTgtIds.length;
4796
+ newTgtIds.splice(insertAt, 0, sourceId);
4797
+ if (sourceParent.parentId === targetParent.parentId) {
4798
+ const block = doc[sourceParent.parentId];
4799
+ const columns = ((_c = (_b = (_a = block.data) == null ? void 0 : _a.props) == null ? void 0 : _b.columns) != null ? _c : []).map((c, i) => {
4800
+ if (sourceParent.kind === "ColumnsContainer" && i === sourceParent.columnIndex) {
4801
+ return __spreadProps(__spreadValues({}, c), { childrenIds: newSrcIds });
4802
+ }
4803
+ if (targetParent.kind === "ColumnsContainer" && i === targetParent.columnIndex) {
4804
+ return __spreadProps(__spreadValues({}, c), { childrenIds: newTgtIds });
4805
+ }
4806
+ return c;
4807
+ });
4808
+ return {
4809
+ [sourceParent.parentId]: __spreadProps(__spreadValues({}, block), {
4810
+ data: __spreadProps(__spreadValues({}, block.data), { props: __spreadProps(__spreadValues({}, block.data.props), { columns }) })
4811
+ })
4812
+ };
4813
+ }
4814
+ const sourceBlock = doc[sourceParent.parentId];
4815
+ const targetBlock = doc[targetParent.parentId];
4816
+ return {
4817
+ [sourceParent.parentId]: patchChildrenIds(sourceBlock, sourceParent, newSrcIds),
4818
+ [targetParent.parentId]: patchChildrenIds(targetBlock, targetParent, newTgtIds)
4819
+ };
4820
+ }
4821
+
4822
+ // src/app/templates-drawer/outline-panel.tsx
4823
+ var ROOT_BLOCK_ID2 = "root";
4824
+ var PREVIEW_MAX = 36;
4825
+ function iconForType(type) {
4826
+ switch (type) {
4827
+ case "EmailLayout":
4828
+ return /* @__PURE__ */ React62.createElement(DashboardOutlined, { fontSize: "small" });
4829
+ case "Heading":
4830
+ return /* @__PURE__ */ React62.createElement(HMobiledataOutlined, { fontSize: "small" });
4831
+ case "Text":
4832
+ return /* @__PURE__ */ React62.createElement(NotesOutlined, { fontSize: "small" });
4833
+ case "Button":
4834
+ return /* @__PURE__ */ React62.createElement(SmartButtonOutlined, { fontSize: "small" });
4835
+ case "Image":
4836
+ return /* @__PURE__ */ React62.createElement(ImageOutlined, { fontSize: "small" });
4837
+ case "Avatar":
4838
+ return /* @__PURE__ */ React62.createElement(AccountCircleOutlined, { fontSize: "small" });
4839
+ case "Signature":
4840
+ return /* @__PURE__ */ React62.createElement(ContactMailOutlined, { fontSize: "small" });
4841
+ case "Divider":
4842
+ return /* @__PURE__ */ React62.createElement(HorizontalRuleOutlined, { fontSize: "small" });
4843
+ case "Spacer":
4844
+ return /* @__PURE__ */ React62.createElement(Crop32Outlined, { fontSize: "small" });
4845
+ case "Html":
4846
+ return /* @__PURE__ */ React62.createElement(HtmlOutlined, { fontSize: "small" });
4847
+ case "Container":
4848
+ return /* @__PURE__ */ React62.createElement(LibraryAddOutlined, { fontSize: "small" });
4849
+ case "ColumnsContainer":
4850
+ return /* @__PURE__ */ React62.createElement(ViewColumnOutlined, { fontSize: "small" });
4851
+ default:
4852
+ return /* @__PURE__ */ React62.createElement(BusinessOutlined, { fontSize: "small" });
4853
+ }
4854
+ }
4855
+ function previewText(text) {
4856
+ if (!text) return void 0;
4857
+ const trimmed = text.trim().replace(/\s+/g, " ");
4858
+ if (!trimmed) return void 0;
4859
+ return trimmed.length > PREVIEW_MAX ? trimmed.slice(0, PREVIEW_MAX - 1) + "\u2026" : trimmed;
4860
+ }
4861
+ function buildNode(id, doc, ctx) {
4862
+ var _a, _b, _c, _d, _e, _f;
4863
+ const block = doc[id];
4864
+ if (!block) return null;
4865
+ const type = block.type;
4866
+ const data = (_a = block.data) != null ? _a : {};
4867
+ const props = (_b = data.props) != null ? _b : {};
4868
+ const baseMeta = ctx ? { parent: ctx.parent, indexInParent: ctx.indexInParent, siblingsCount: ctx.siblingsCount } : {};
4869
+ switch (type) {
4870
+ case "EmailLayout": {
4871
+ const ids = (_c = data.childrenIds) != null ? _c : [];
4872
+ const parentForChildren = { kind: "EmailLayout", parentId: "root" };
4873
+ const children = ids.map(
4874
+ (childId, i) => buildNode(childId, doc, {
4875
+ parent: parentForChildren,
4876
+ indexInParent: i,
4877
+ siblingsCount: ids.length
4878
+ })
4879
+ ).filter((n) => n !== null);
4880
+ return {
4881
+ id,
4882
+ label: "Canvas",
4883
+ icon: iconForType("EmailLayout"),
4884
+ children,
4885
+ containerChildrenRef: parentForChildren
4886
+ };
4887
+ }
4888
+ case "Container": {
4889
+ const ids = (_d = props.childrenIds) != null ? _d : [];
4890
+ const parentForChildren = { kind: "Container", parentId: id };
4891
+ const children = ids.map(
4892
+ (childId, i) => buildNode(childId, doc, {
4893
+ parent: parentForChildren,
4894
+ indexInParent: i,
4895
+ siblingsCount: ids.length
4896
+ })
4897
+ ).filter((n) => n !== null);
4898
+ const count = children.length;
4899
+ return __spreadValues({
4900
+ id,
4901
+ label: "Container",
4902
+ preview: count === 1 ? "1 child" : `${count} children`,
4903
+ icon: iconForType("Container"),
4904
+ children,
4905
+ containerChildrenRef: parentForChildren
4906
+ }, baseMeta);
4907
+ }
4908
+ case "ColumnsContainer": {
4909
+ const columns = (_e = props.columns) != null ? _e : [];
4910
+ const children = [];
4911
+ columns.forEach((col, colIdx) => {
4912
+ var _a2;
4913
+ const colIds = (_a2 = col.childrenIds) != null ? _a2 : [];
4914
+ const parentForCol = {
4915
+ kind: "ColumnsContainer",
4916
+ parentId: id,
4917
+ columnIndex: colIdx
4918
+ };
4919
+ const colChildren = colIds.map(
4920
+ (childId, i) => buildNode(childId, doc, {
4921
+ parent: parentForCol,
4922
+ indexInParent: i,
4923
+ siblingsCount: colIds.length
4924
+ })
4925
+ ).filter((n) => n !== null);
4926
+ children.push({
4927
+ id: `${id}::col${colIdx}`,
4928
+ label: `Column ${colIdx + 1}`,
4929
+ preview: colChildren.length === 1 ? "1 child" : `${colChildren.length} children`,
4930
+ icon: /* @__PURE__ */ React62.createElement(ViewColumnSharp, { fontSize: "small", sx: { opacity: 0.6 } }),
4931
+ children: colChildren,
4932
+ containerChildrenRef: parentForCol
4933
+ });
4934
+ });
4935
+ return __spreadValues({
4936
+ id,
4937
+ label: "Columns",
4938
+ preview: `${columns.length} columns`,
4939
+ icon: iconForType("ColumnsContainer"),
4940
+ children
4941
+ }, baseMeta);
4942
+ }
4943
+ case "Text":
4944
+ case "Heading":
4945
+ case "Button":
4946
+ return __spreadValues({ id, label: type, preview: previewText(props.text), icon: iconForType(type) }, baseMeta);
4947
+ case "Html":
4948
+ return __spreadValues({ id, label: "Html", preview: previewText(props.contents), icon: iconForType("Html") }, baseMeta);
4949
+ case "Image":
4950
+ return __spreadValues({
4951
+ id,
4952
+ label: "Image",
4953
+ preview: (_f = previewText(props.alt)) != null ? _f : previewText(props.url),
4954
+ icon: iconForType("Image")
4955
+ }, baseMeta);
4956
+ case "Avatar":
4957
+ return __spreadValues({ id, label: "Avatar", preview: previewText(props.imageUrl), icon: iconForType("Avatar") }, baseMeta);
4958
+ case "Divider":
4959
+ return __spreadValues({ id, label: "Divider", icon: iconForType("Divider") }, baseMeta);
4960
+ case "Spacer":
4961
+ return __spreadValues({
4962
+ id,
4963
+ label: "Spacer",
4964
+ preview: props.height ? `${props.height}px` : void 0,
4965
+ icon: iconForType("Spacer")
4966
+ }, baseMeta);
4967
+ case "Signature":
4968
+ return __spreadValues({ id, label: "Signature", preview: previewText(props.name), icon: iconForType("Signature") }, baseMeta);
4969
+ default:
4970
+ return __spreadValues({ id, label: type, icon: iconForType(type) }, baseMeta);
4971
+ }
4972
+ }
4973
+ var DRAG_MIME = "application/x-email-editor-block";
4974
+ function OutlinePanel() {
4975
+ const document2 = useDocument();
4976
+ const selectedBlockId = useSelectedBlockId();
4977
+ const [dragging, setDragging] = useState(null);
4978
+ const tree = buildNode(ROOT_BLOCK_ID2, document2);
4979
+ const performMove = (payload, targetParent, targetIndex) => {
4980
+ const patch = buildMovePatch(
4981
+ document2,
4982
+ payload.sourceId,
4983
+ payload.sourceParent,
4984
+ targetParent,
4985
+ targetIndex
4986
+ );
4987
+ if (patch) {
4988
+ setDocument(patch);
4989
+ setSelectedBlockId(payload.sourceId);
4990
+ }
4991
+ };
4992
+ return /* @__PURE__ */ React62.createElement(Box, null, /* @__PURE__ */ React62.createElement(Typography, { variant: "subtitle2", component: "h2", sx: { fontWeight: "bold", mb: 0.5, px: 0.5 } }, "Outline"), /* @__PURE__ */ React62.createElement(Typography, { variant: "caption", sx: { display: "block", color: "text.secondary", px: 0.5, mb: 1 } }, "Click a row to select. Drag a row to reorder or move it into a container."), tree ? /* @__PURE__ */ React62.createElement(
4993
+ OutlineRow,
4994
+ {
4995
+ node: tree,
4996
+ depth: 0,
4997
+ selectedBlockId,
4998
+ document: document2,
4999
+ dragging,
5000
+ setDragging,
5001
+ performMove
5002
+ }
5003
+ ) : /* @__PURE__ */ React62.createElement(Typography, { variant: "body2", sx: { color: "text.secondary", px: 0.5 } }, "Nothing to outline."));
5004
+ }
5005
+ function OutlineRow({
5006
+ node,
5007
+ depth,
5008
+ selectedBlockId,
5009
+ document: document2,
5010
+ dragging,
5011
+ setDragging,
5012
+ performMove
5013
+ }) {
5014
+ const [expanded, setExpanded] = useState(true);
5015
+ const [dropPos, setDropPos] = useState(null);
5016
+ const hasChildren = Boolean(node.children && node.children.length > 0);
5017
+ const isSelectable = !node.id.includes("::");
5018
+ const isSelected = isSelectable && selectedBlockId === node.id;
5019
+ const canMove = isSelectable && node.parent !== void 0 && node.indexInParent !== void 0 && node.siblingsCount !== void 0;
5020
+ const canMoveUp = canMove && node.indexInParent > 0;
5021
+ const canMoveDown = canMove && node.indexInParent < node.siblingsCount - 1;
5022
+ const isDragSource = (dragging == null ? void 0 : dragging.sourceId) === node.id;
5023
+ const draggable = canMove;
5024
+ const handleDragStart = (e) => {
5025
+ if (!draggable || !node.parent) return;
5026
+ const payload = { sourceId: node.id, sourceParent: node.parent };
5027
+ e.dataTransfer.setData(DRAG_MIME, JSON.stringify(payload));
5028
+ e.dataTransfer.setData("text/plain", node.label);
5029
+ e.dataTransfer.effectAllowed = "move";
5030
+ setDragging(payload);
5031
+ };
5032
+ const handleDragEnd = () => setDragging(null);
5033
+ const computeDropPos = (e) => {
5034
+ if (!dragging) return null;
5035
+ const rect = e.currentTarget.getBoundingClientRect();
5036
+ const y = e.clientY - rect.top;
5037
+ const h = rect.height || 28;
5038
+ const canDropInside = Boolean(node.containerChildrenRef);
5039
+ if (canDropInside && y > h * 0.25 && y < h * 0.75) return "inside";
5040
+ if (y < h * 0.5) return "before";
5041
+ return "after";
5042
+ };
5043
+ const handleDragOver = (e) => {
5044
+ if (!dragging) return;
5045
+ if (dragging.sourceId === node.id) {
5046
+ setDropPos(null);
5047
+ return;
5048
+ }
5049
+ if (node.containerChildrenRef && isDescendant(document2, dragging.sourceId, node.id)) {
5050
+ setDropPos(null);
5051
+ return;
5052
+ }
5053
+ const pos = computeDropPos(e);
5054
+ if (!pos) {
5055
+ setDropPos(null);
5056
+ return;
5057
+ }
5058
+ if ((pos === "before" || pos === "after") && !node.parent) {
5059
+ setDropPos(null);
5060
+ return;
5061
+ }
5062
+ e.preventDefault();
5063
+ e.dataTransfer.dropEffect = "move";
5064
+ setDropPos(pos);
5065
+ };
5066
+ const handleDragLeave = () => setDropPos(null);
5067
+ const handleDrop = (e) => {
5068
+ if (!dragging || !dropPos) return;
5069
+ e.preventDefault();
5070
+ let targetParent;
5071
+ let targetIndex = 0;
5072
+ if (dropPos === "inside" && node.containerChildrenRef) {
5073
+ targetParent = node.containerChildrenRef;
5074
+ targetIndex = Number.MAX_SAFE_INTEGER;
5075
+ } else if ((dropPos === "before" || dropPos === "after") && node.parent) {
5076
+ targetParent = node.parent;
5077
+ targetIndex = node.indexInParent + (dropPos === "after" ? 1 : 0);
5078
+ }
5079
+ if (targetParent) performMove(dragging, targetParent, targetIndex);
5080
+ setDropPos(null);
5081
+ setDragging(null);
5082
+ };
5083
+ const handleMove = (delta) => {
5084
+ if (!canMove || !node.parent) return;
5085
+ const nextIndex = node.indexInParent + delta;
5086
+ const patch = buildMovePatch(document2, node.id, node.parent, node.parent, nextIndex + (delta > 0 ? 1 : 0));
5087
+ if (patch) setDocument(patch);
5088
+ };
5089
+ return /* @__PURE__ */ React62.createElement(React62.Fragment, null, /* @__PURE__ */ React62.createElement(Box, { sx: { position: "relative" } }, dropPos === "before" && /* @__PURE__ */ React62.createElement(DropLine, { depth }), /* @__PURE__ */ React62.createElement(
5090
+ Stack,
5091
+ {
5092
+ direction: "row",
5093
+ alignItems: "center",
5094
+ spacing: 0.5,
5095
+ draggable,
5096
+ onDragStart: handleDragStart,
5097
+ onDragEnd: handleDragEnd,
5098
+ onDragOver: handleDragOver,
5099
+ onDragLeave: handleDragLeave,
5100
+ onDrop: handleDrop,
5101
+ onClick: () => isSelectable && setSelectedBlockId(node.id),
5102
+ onMouseEnter: () => isSelectable && !dragging && setHoveredBlockId(node.id),
5103
+ onMouseLeave: () => isSelectable && setHoveredBlockId(null),
5104
+ sx: {
5105
+ pl: `${depth * 12 + 4}px`,
5106
+ pr: 0.5,
5107
+ py: 0.25,
5108
+ minHeight: 28,
5109
+ borderRadius: 0.75,
5110
+ cursor: isSelectable ? draggable ? "grab" : "pointer" : "default",
5111
+ backgroundColor: isSelected ? "action.selected" : dropPos === "inside" ? "rgba(25, 118, 210, 0.12)" : "transparent",
5112
+ opacity: isDragSource ? 0.5 : 1,
5113
+ outline: dropPos === "inside" ? "1.5px solid rgba(25, 118, 210, 0.7)" : void 0,
5114
+ transition: "background-color 80ms, outline-color 80ms",
5115
+ "&:hover": {
5116
+ backgroundColor: isSelected ? "action.selected" : "action.hover"
4641
5117
  },
4642
- /* @__PURE__ */ React58.createElement(DriveFileRenameOutlineOutlined, { fontSize: "small" })
4643
- )),
4644
- onPromote && /* @__PURE__ */ React58.createElement(Tooltip, { title: "Promote to sample" }, /* @__PURE__ */ React58.createElement(
4645
- IconButton,
4646
- {
4647
- size: "small",
4648
- onClick: (e) => {
4649
- stop(e);
4650
- onPromote();
4651
- }
5118
+ "&:hover .outline-move-btns": { opacity: 1 },
5119
+ userSelect: "none"
5120
+ }
5121
+ },
5122
+ hasChildren ? /* @__PURE__ */ React62.createElement(
5123
+ Box,
5124
+ {
5125
+ role: "button",
5126
+ "aria-label": expanded ? "Collapse" : "Expand",
5127
+ onClick: (e) => {
5128
+ e.stopPropagation();
5129
+ setExpanded((v) => !v);
4652
5130
  },
4653
- /* @__PURE__ */ React58.createElement(FileUploadOutlined, { fontSize: "small" })
4654
- )),
4655
- onDemote && /* @__PURE__ */ React58.createElement(Tooltip, { title: "Demote to template" }, /* @__PURE__ */ React58.createElement(
5131
+ sx: { display: "flex", alignItems: "center", cursor: "pointer" }
5132
+ },
5133
+ expanded ? /* @__PURE__ */ React62.createElement(ExpandMore, { fontSize: "small" }) : /* @__PURE__ */ React62.createElement(ChevronRight, { fontSize: "small" })
5134
+ ) : /* @__PURE__ */ React62.createElement(Box, { sx: { width: 20 } }),
5135
+ /* @__PURE__ */ React62.createElement(
5136
+ Box,
5137
+ {
5138
+ sx: {
5139
+ display: "flex",
5140
+ alignItems: "center",
5141
+ color: isSelected ? "primary.main" : "text.secondary",
5142
+ flexShrink: 0
5143
+ }
5144
+ },
5145
+ node.icon
5146
+ ),
5147
+ /* @__PURE__ */ React62.createElement(
5148
+ Typography,
5149
+ {
5150
+ variant: "body2",
5151
+ sx: {
5152
+ fontWeight: 600,
5153
+ color: isSelected ? "primary.main" : "text.primary",
5154
+ flexShrink: 0
5155
+ }
5156
+ },
5157
+ node.label
5158
+ ),
5159
+ node.preview && /* @__PURE__ */ React62.createElement(
5160
+ Typography,
5161
+ {
5162
+ variant: "body2",
5163
+ sx: {
5164
+ color: "text.secondary",
5165
+ overflow: "hidden",
5166
+ textOverflow: "ellipsis",
5167
+ whiteSpace: "nowrap",
5168
+ flex: 1,
5169
+ minWidth: 0
5170
+ }
5171
+ },
5172
+ "\u2014 ",
5173
+ node.preview
5174
+ ),
5175
+ canMove && /* @__PURE__ */ React62.createElement(
5176
+ Box,
5177
+ {
5178
+ className: "outline-move-btns",
5179
+ sx: {
5180
+ display: "flex",
5181
+ ml: "auto",
5182
+ opacity: isSelected ? 1 : 0,
5183
+ transition: "opacity 120ms"
5184
+ }
5185
+ },
5186
+ /* @__PURE__ */ React62.createElement(Tooltip, { title: "Move up" }, /* @__PURE__ */ React62.createElement("span", null, /* @__PURE__ */ React62.createElement(
4656
5187
  IconButton,
4657
5188
  {
4658
5189
  size: "small",
5190
+ disabled: !canMoveUp,
4659
5191
  onClick: (e) => {
4660
- stop(e);
4661
- onDemote();
4662
- }
5192
+ e.stopPropagation();
5193
+ handleMove(-1);
5194
+ },
5195
+ "aria-label": `Move ${node.label} up`,
5196
+ sx: { p: 0.25 }
4663
5197
  },
4664
- /* @__PURE__ */ React58.createElement(FileDownloadOutlined, { fontSize: "small" })
4665
- )),
4666
- onDelete && /* @__PURE__ */ React58.createElement(Tooltip, { title: "Delete" }, /* @__PURE__ */ React58.createElement(
5198
+ /* @__PURE__ */ React62.createElement(KeyboardArrowUp, { fontSize: "small" })
5199
+ ))),
5200
+ /* @__PURE__ */ React62.createElement(Tooltip, { title: "Move down" }, /* @__PURE__ */ React62.createElement("span", null, /* @__PURE__ */ React62.createElement(
4667
5201
  IconButton,
4668
5202
  {
4669
5203
  size: "small",
5204
+ disabled: !canMoveDown,
4670
5205
  onClick: (e) => {
4671
- stop(e);
4672
- onDelete();
4673
- }
5206
+ e.stopPropagation();
5207
+ handleMove(1);
5208
+ },
5209
+ "aria-label": `Move ${node.label} down`,
5210
+ sx: { p: 0.25 }
4674
5211
  },
4675
- /* @__PURE__ */ React58.createElement(DeleteOutlined, { fontSize: "small" })
4676
- ))
5212
+ /* @__PURE__ */ React62.createElement(KeyboardArrowDown, { fontSize: "small" })
5213
+ )))
5214
+ )
5215
+ ), dropPos === "after" && /* @__PURE__ */ React62.createElement(DropLine, { depth })), hasChildren && expanded && /* @__PURE__ */ React62.createElement(Box, null, node.children.map((child) => /* @__PURE__ */ React62.createElement(
5216
+ OutlineRow,
5217
+ {
5218
+ key: child.id,
5219
+ node: child,
5220
+ depth: depth + 1,
5221
+ selectedBlockId,
5222
+ document: document2,
5223
+ dragging,
5224
+ setDragging,
5225
+ performMove
5226
+ }
5227
+ ))));
5228
+ }
5229
+ function DropLine({ depth }) {
5230
+ return /* @__PURE__ */ React62.createElement(
5231
+ Box,
5232
+ {
5233
+ sx: {
5234
+ position: "relative",
5235
+ height: 0
5236
+ }
5237
+ },
5238
+ /* @__PURE__ */ React62.createElement(
5239
+ Box,
5240
+ {
5241
+ sx: {
5242
+ position: "absolute",
5243
+ left: `${depth * 12 + 24}px`,
5244
+ right: 4,
5245
+ top: -1,
5246
+ height: 2,
5247
+ backgroundColor: "primary.main",
5248
+ borderRadius: 1,
5249
+ pointerEvents: "none"
5250
+ }
5251
+ }
4677
5252
  )
4678
5253
  );
4679
5254
  }
5255
+ function NewTemplatePickerDialog({
5256
+ open,
5257
+ kind,
5258
+ samples,
5259
+ existingSlugs,
5260
+ defaultName,
5261
+ onClose,
5262
+ onCreate
5263
+ }) {
5264
+ const [name, setName] = useState("");
5265
+ const [selectedStarter, setSelectedStarter] = useState(null);
5266
+ const [error, setError] = useState(null);
5267
+ const [busy, setBusy] = useState(false);
5268
+ useEffect(() => {
5269
+ if (open) {
5270
+ setName(defaultName != null ? defaultName : kind === "sample" ? "New sample" : "New template");
5271
+ setSelectedStarter(null);
5272
+ setError(null);
5273
+ setBusy(false);
5274
+ }
5275
+ }, [open, defaultName, kind]);
5276
+ const validate = () => {
5277
+ const trimmed = name.trim();
5278
+ if (!trimmed) return "Name is required";
5279
+ if (existingSlugs.some((s) => s.toLowerCase() === trimmed.toLowerCase())) {
5280
+ return kind === "sample" ? "A sample with this name already exists" : "A template with this name already exists";
5281
+ }
5282
+ return null;
5283
+ };
5284
+ const handleCreate = () => __async(null, null, function* () {
5285
+ const err = validate();
5286
+ if (err) {
5287
+ setError(err);
5288
+ return;
5289
+ }
5290
+ setBusy(true);
5291
+ try {
5292
+ const ok = yield onCreate(name.trim(), selectedStarter);
5293
+ if (ok) onClose();
5294
+ } finally {
5295
+ setBusy(false);
5296
+ }
5297
+ });
5298
+ const pickable = samples.filter((s) => s.id !== "empty-email");
5299
+ return /* @__PURE__ */ React62.createElement(Dialog, { open, onClose: busy ? void 0 : onClose, maxWidth: "sm", fullWidth: true }, /* @__PURE__ */ React62.createElement(DialogTitle, null, kind === "sample" ? "New sample" : "New template"), /* @__PURE__ */ React62.createElement(DialogContent, { dividers: true }, /* @__PURE__ */ React62.createElement(Typography, { variant: "subtitle2", sx: { mb: 1 } }, "Start from"), /* @__PURE__ */ React62.createElement(
5300
+ List,
5301
+ {
5302
+ dense: true,
5303
+ sx: {
5304
+ mb: 2,
5305
+ border: 1,
5306
+ borderColor: "divider",
5307
+ borderRadius: 1,
5308
+ py: 0,
5309
+ maxHeight: 260,
5310
+ overflowY: "auto"
5311
+ }
5312
+ },
5313
+ /* @__PURE__ */ React62.createElement(
5314
+ ListItemButton,
5315
+ {
5316
+ selected: selectedStarter === null,
5317
+ onClick: () => setSelectedStarter(null)
5318
+ },
5319
+ /* @__PURE__ */ React62.createElement(Box, { sx: { display: "flex", alignItems: "center", gap: 1.5, flex: 1 } }, /* @__PURE__ */ React62.createElement(InsertDriveFileOutlined, { fontSize: "small", sx: { color: "text.secondary" } }), /* @__PURE__ */ React62.createElement(ListItemText, { primary: "Blank", secondary: "Start from an empty email" }))
5320
+ ),
5321
+ pickable.map((s) => /* @__PURE__ */ React62.createElement(
5322
+ ListItemButton,
5323
+ {
5324
+ key: s.id,
5325
+ selected: selectedStarter === s.id,
5326
+ onClick: () => setSelectedStarter(s.id)
5327
+ },
5328
+ /* @__PURE__ */ React62.createElement(Box, { sx: { display: "flex", alignItems: "center", gap: 1.5, flex: 1 } }, /* @__PURE__ */ React62.createElement(DescriptionOutlined, { fontSize: "small", sx: { color: "text.secondary" } }), /* @__PURE__ */ React62.createElement(ListItemText, { primary: s.slug, secondary: s.description }))
5329
+ ))
5330
+ ), /* @__PURE__ */ React62.createElement(
5331
+ TextField,
5332
+ {
5333
+ autoFocus: true,
5334
+ fullWidth: true,
5335
+ size: "small",
5336
+ label: "Name",
5337
+ value: name,
5338
+ onChange: (e) => {
5339
+ setName(e.target.value);
5340
+ if (error) setError(null);
5341
+ },
5342
+ onKeyDown: (e) => {
5343
+ if (e.key === "Enter" && !busy) void handleCreate();
5344
+ },
5345
+ error: Boolean(error),
5346
+ helperText: error != null ? error : " ",
5347
+ disabled: busy
5348
+ }
5349
+ )), /* @__PURE__ */ React62.createElement(DialogActions, null, /* @__PURE__ */ React62.createElement(Button$1, { onClick: onClose, disabled: busy }, "Cancel"), /* @__PURE__ */ React62.createElement(Button$1, { variant: "contained", onClick: handleCreate, disabled: busy }, busy ? "Creating\u2026" : `Create ${kind}`)));
5350
+ }
4680
5351
  function RenameDialog({
4681
5352
  open,
4682
5353
  currentSlug,
5354
+ currentTags = [],
4683
5355
  existingSlugs,
4684
5356
  onClose,
4685
5357
  onSubmit
4686
5358
  }) {
4687
- const [value, setValue] = useState(currentSlug);
5359
+ const [slug, setSlug] = useState(currentSlug);
5360
+ const [tags, setTags] = useState(currentTags);
5361
+ const [tagInput, setTagInput] = useState("");
4688
5362
  const [error, setError] = useState(null);
4689
5363
  const [submitting, setSubmitting] = useState(false);
4690
5364
  useEffect(() => {
4691
5365
  if (open) {
4692
- setValue(currentSlug);
5366
+ setSlug(currentSlug);
5367
+ setTags(currentTags);
5368
+ setTagInput("");
4693
5369
  setError(null);
4694
5370
  setSubmitting(false);
4695
5371
  }
4696
- }, [open, currentSlug]);
4697
- const handleChange = (e) => {
4698
- setValue(e.target.value);
4699
- setError(null);
5372
+ }, [open, currentSlug, currentTags]);
5373
+ const addTag = () => {
5374
+ const trimmed = tagInput.trim();
5375
+ if (!trimmed) return;
5376
+ if (tags.some((t) => t.toLowerCase() === trimmed.toLowerCase())) {
5377
+ setTagInput("");
5378
+ return;
5379
+ }
5380
+ setTags([...tags, trimmed]);
5381
+ setTagInput("");
4700
5382
  };
5383
+ const removeTag = (tag) => setTags(tags.filter((t) => t !== tag));
5384
+ const tagsUnchanged = tags.length === currentTags.length && tags.every((t, i) => t === currentTags[i]);
4701
5385
  const handleSubmit = () => __async(null, null, function* () {
4702
- const trimmed = value.trim();
4703
- if (!trimmed) {
5386
+ const trimmedSlug = slug.trim();
5387
+ if (!trimmedSlug) {
4704
5388
  setError("Please enter a name");
4705
5389
  return;
4706
5390
  }
4707
- if (trimmed === currentSlug) {
4708
- onClose();
5391
+ const slugChanged = trimmedSlug !== currentSlug;
5392
+ if (slugChanged && existingSlugs.some((s) => s.toLowerCase() === trimmedSlug.toLowerCase())) {
5393
+ setError("A template with this name already exists");
4709
5394
  return;
4710
5395
  }
4711
- if (existingSlugs.some((s) => s.toLowerCase() === trimmed.toLowerCase())) {
4712
- setError("A template with this name already exists");
5396
+ if (!slugChanged && tagsUnchanged) {
5397
+ onClose();
4713
5398
  return;
4714
5399
  }
4715
5400
  setSubmitting(true);
4716
5401
  try {
4717
- yield onSubmit(trimmed);
5402
+ yield onSubmit(trimmedSlug, { tags });
4718
5403
  onClose();
4719
5404
  } catch (e) {
4720
- console.error("Error renaming template:", e);
4721
- setError("Failed to rename template");
5405
+ console.error("Error updating template details:", e);
5406
+ setError("Failed to update template details");
4722
5407
  } finally {
4723
5408
  setSubmitting(false);
4724
5409
  }
4725
5410
  });
4726
- return /* @__PURE__ */ React58.createElement(Dialog, { open, onClose, maxWidth: "sm", fullWidth: true }, /* @__PURE__ */ React58.createElement(DialogTitle, null, "Rename template"), /* @__PURE__ */ React58.createElement(DialogContent, null, /* @__PURE__ */ React58.createElement(
5411
+ return /* @__PURE__ */ React62.createElement(Dialog, { open, onClose: submitting ? void 0 : onClose, maxWidth: "sm", fullWidth: true }, /* @__PURE__ */ React62.createElement(DialogTitle, null, "Edit details"), /* @__PURE__ */ React62.createElement(DialogContent, null, /* @__PURE__ */ React62.createElement(
4727
5412
  TextField,
4728
5413
  {
4729
5414
  autoFocus: true,
4730
5415
  margin: "dense",
4731
- label: "Slug",
5416
+ label: "Name",
4732
5417
  fullWidth: true,
4733
5418
  variant: "outlined",
4734
- value,
4735
- onChange: handleChange,
5419
+ value: slug,
5420
+ onChange: (e) => {
5421
+ setSlug(e.target.value);
5422
+ setError(null);
5423
+ },
4736
5424
  error: !!error,
4737
- helperText: error,
5425
+ helperText: error != null ? error : " ",
4738
5426
  disabled: submitting,
4739
5427
  onKeyPress: (e) => {
4740
- if (e.key === "Enter" && !submitting) {
4741
- handleSubmit();
5428
+ if (e.key === "Enter" && !submitting) handleSubmit();
5429
+ }
5430
+ }
5431
+ ), /* @__PURE__ */ React62.createElement(Typography, { variant: "caption", sx: { color: "text.secondary", display: "block", mt: 1, mb: 0.5 } }, "Tags"), tags.length > 0 ? /* @__PURE__ */ React62.createElement(Stack, { direction: "row", spacing: 0.5, sx: { flexWrap: "wrap", gap: 0.5, mb: 1 } }, tags.map((tag) => /* @__PURE__ */ React62.createElement(
5432
+ Chip,
5433
+ {
5434
+ key: tag,
5435
+ label: tag,
5436
+ size: "small",
5437
+ onDelete: submitting ? void 0 : () => removeTag(tag)
5438
+ }
5439
+ ))) : /* @__PURE__ */ React62.createElement(Typography, { variant: "caption", sx: { color: "text.disabled", display: "block", mb: 1 } }, "No tags yet. Suggested: ", /* @__PURE__ */ React62.createElement("i", null, "transactional"), ", ", /* @__PURE__ */ React62.createElement("i", null, "marketing"), "."), /* @__PURE__ */ React62.createElement(
5440
+ TextField,
5441
+ {
5442
+ size: "small",
5443
+ fullWidth: true,
5444
+ placeholder: "Add a tag and press Enter",
5445
+ value: tagInput,
5446
+ onChange: (e) => setTagInput(e.target.value),
5447
+ disabled: submitting,
5448
+ onKeyDown: (e) => {
5449
+ if (e.key === "Enter" || e.key === ",") {
5450
+ e.preventDefault();
5451
+ addTag();
5452
+ } else if (e.key === "Backspace" && !tagInput && tags.length > 0) {
5453
+ e.preventDefault();
5454
+ removeTag(tags[tags.length - 1]);
4742
5455
  }
5456
+ },
5457
+ InputProps: {
5458
+ endAdornment: /* @__PURE__ */ React62.createElement(InputAdornment, { position: "end" }, /* @__PURE__ */ React62.createElement(
5459
+ Button$1,
5460
+ {
5461
+ size: "small",
5462
+ onClick: addTag,
5463
+ disabled: !tagInput.trim() || submitting,
5464
+ startIcon: /* @__PURE__ */ React62.createElement(AddOutlined, { fontSize: "small" }),
5465
+ sx: { textTransform: "none" }
5466
+ },
5467
+ "Add"
5468
+ ))
4743
5469
  }
4744
5470
  }
4745
- )), /* @__PURE__ */ React58.createElement(DialogActions, null, /* @__PURE__ */ React58.createElement(Button$1, { onClick: onClose, disabled: submitting }, "Cancel"), /* @__PURE__ */ React58.createElement(
5471
+ ), /* @__PURE__ */ React62.createElement(Box, { sx: { minHeight: 8 } })), /* @__PURE__ */ React62.createElement(DialogActions, null, /* @__PURE__ */ React62.createElement(Button$1, { onClick: onClose, disabled: submitting }, "Cancel"), /* @__PURE__ */ React62.createElement(
4746
5472
  Button$1,
4747
5473
  {
4748
5474
  onClick: handleSubmit,
4749
5475
  variant: "contained",
4750
- disabled: !value.trim() || submitting
5476
+ disabled: !slug.trim() || submitting
4751
5477
  },
4752
- submitting ? "Renaming..." : "Rename"
5478
+ submitting ? "Saving\u2026" : "Save"
4753
5479
  )));
4754
5480
  }
4755
5481
  function SaveTemplateDialog({
@@ -4811,7 +5537,7 @@ function SaveTemplateDialog({
4811
5537
  setInternalError("");
4812
5538
  onClose();
4813
5539
  };
4814
- return /* @__PURE__ */ React58.createElement(
5540
+ return /* @__PURE__ */ React62.createElement(
4815
5541
  Dialog,
4816
5542
  {
4817
5543
  open,
@@ -4819,8 +5545,8 @@ function SaveTemplateDialog({
4819
5545
  maxWidth: "sm",
4820
5546
  fullWidth: true
4821
5547
  },
4822
- /* @__PURE__ */ React58.createElement(DialogTitle, null, "Save Email Template"),
4823
- /* @__PURE__ */ React58.createElement(DialogContent, null, /* @__PURE__ */ React58.createElement(Box, { sx: { pt: 1 } }, /* @__PURE__ */ React58.createElement(
5548
+ /* @__PURE__ */ React62.createElement(DialogTitle, null, "Save Email Template"),
5549
+ /* @__PURE__ */ React62.createElement(DialogContent, null, /* @__PURE__ */ React62.createElement(Box, { sx: { pt: 1 } }, /* @__PURE__ */ React62.createElement(
4824
5550
  TextField,
4825
5551
  {
4826
5552
  autoFocus: true,
@@ -4842,7 +5568,7 @@ function SaveTemplateDialog({
4842
5568
  disabled: isSubmitting
4843
5569
  }
4844
5570
  ))),
4845
- /* @__PURE__ */ React58.createElement(DialogActions, null, /* @__PURE__ */ React58.createElement(Button$1, { onClick: handleCancel, disabled: isSubmitting }, "Cancel"), /* @__PURE__ */ React58.createElement(
5571
+ /* @__PURE__ */ React62.createElement(DialogActions, null, /* @__PURE__ */ React62.createElement(Button$1, { onClick: handleCancel, disabled: isSubmitting }, "Cancel"), /* @__PURE__ */ React62.createElement(
4846
5572
  Button$1,
4847
5573
  {
4848
5574
  onClick: handleSave,
@@ -4908,7 +5634,7 @@ function SamplesDrawer({
4908
5634
  setTemplateKind,
4909
5635
  saveAs
4910
5636
  }) {
4911
- var _a;
5637
+ var _a, _b;
4912
5638
  const samplesDrawerOpen = useSamplesDrawerOpen();
4913
5639
  const { setCurrentTemplate, loadTemplate: ctxLoadTemplate } = useEmailEditor();
4914
5640
  const { showMessage } = useSnackbar();
@@ -4917,12 +5643,14 @@ function SamplesDrawer({
4917
5643
  const [loadingSamples, setLoadingSamples] = useState(false);
4918
5644
  const [loadingTemplates, setLoadingTemplates] = useState(false);
4919
5645
  const [templatesError, setTemplatesError] = useState(null);
5646
+ const [activeLeftTab, setActiveLeftTab] = useState("templates");
4920
5647
  const [search, setSearch] = useState("");
4921
5648
  const [sortKey, setSortKey] = useState("updatedAt");
4922
5649
  const [activeTags, setActiveTags] = useState([]);
4923
5650
  const [renameTarget, setRenameTarget] = useState(null);
4924
5651
  const [pendingSaveAs, setPendingSaveAs] = useState(null);
4925
5652
  const [newError, setNewError] = useState(null);
5653
+ const [pickerKind, setPickerKind] = useState(null);
4926
5654
  const handleLoadTemplate = (templateId) => __async(null, null, function* () {
4927
5655
  if (templateId === "empty-email") {
4928
5656
  return empty_email_message_default;
@@ -4982,27 +5710,34 @@ function SamplesDrawer({
4982
5710
  };
4983
5711
  }, [samples, templates]);
4984
5712
  const allTags = useMemo(() => {
4985
- var _a2;
5713
+ var _a2, _b2;
4986
5714
  const set = /* @__PURE__ */ new Set();
4987
- for (const t of templateRows) {
4988
- (_a2 = t.tags) == null ? void 0 : _a2.forEach((tag) => set.add(tag));
4989
- }
5715
+ for (const t of templateRows) (_a2 = t.tags) == null ? void 0 : _a2.forEach((tag) => set.add(tag));
5716
+ for (const s of sampleRows) (_b2 = s.tags) == null ? void 0 : _b2.forEach((tag) => set.add(tag));
4990
5717
  return Array.from(set).sort();
4991
- }, [templateRows]);
4992
- const filteredTemplates = useMemo(() => {
5718
+ }, [templateRows, sampleRows]);
5719
+ const matchesSearchAndTags = useMemo(() => {
4993
5720
  const term = search.trim().toLowerCase();
4994
- const matchSearch = (t) => {
4995
- if (!term) return true;
4996
- const haystack = [t.slug, t.description, t.subject].filter(Boolean).join(" ").toLowerCase();
4997
- return haystack.includes(term);
4998
- };
4999
- const matchTags = (t) => {
5000
- if (activeTags.length === 0) return true;
5001
- if (!t.tags || t.tags.length === 0) return false;
5002
- return activeTags.every((tag) => t.tags.includes(tag));
5721
+ return (t) => {
5722
+ if (term) {
5723
+ const haystack = [t.slug, t.description, t.subject].filter(Boolean).join(" ").toLowerCase();
5724
+ if (!haystack.includes(term)) return false;
5725
+ }
5726
+ if (activeTags.length > 0) {
5727
+ if (!t.tags || t.tags.length === 0) return false;
5728
+ if (!activeTags.every((tag) => t.tags.includes(tag))) return false;
5729
+ }
5730
+ return true;
5003
5731
  };
5004
- return templateRows.filter((t) => matchSearch(t) && matchTags(t)).slice().sort((a, b) => compareTemplates(a, b, sortKey));
5005
- }, [templateRows, search, activeTags, sortKey]);
5732
+ }, [search, activeTags]);
5733
+ const filteredTemplates = useMemo(
5734
+ () => templateRows.filter(matchesSearchAndTags).slice().sort((a, b) => compareTemplates(a, b, sortKey)),
5735
+ [templateRows, matchesSearchAndTags, sortKey]
5736
+ );
5737
+ const filteredSamples = useMemo(
5738
+ () => sampleRows.filter(matchesSearchAndTags).slice().sort((a, b) => compareTemplates(a, b, sortKey)),
5739
+ [sampleRows, matchesSearchAndTags, sortKey]
5740
+ );
5006
5741
  const toggleTag = (tag) => {
5007
5742
  setActiveTags((prev) => prev.includes(tag) ? prev.filter((t) => t !== tag) : [...prev, tag]);
5008
5743
  };
@@ -5029,16 +5764,19 @@ function SamplesDrawer({
5029
5764
  deleteTemplate(template.id);
5030
5765
  showMessage("Template deleted");
5031
5766
  };
5032
- const handleRenameSubmit = (newSlug) => __async(null, null, function* () {
5767
+ const handleRenameSubmit = (newSlug, opts) => __async(null, null, function* () {
5033
5768
  if (!renameTarget || !renameTemplate) return;
5034
- yield renameTemplate(renameTarget.id, newSlug);
5035
- setTemplates(
5036
- (prev) => prev.map((t) => t.id === renameTarget.id ? __spreadProps(__spreadValues({}, t), { slug: newSlug }) : t)
5037
- );
5769
+ yield renameTemplate(renameTarget.id, newSlug, opts);
5770
+ const patch = (t) => {
5771
+ var _a2;
5772
+ return t.id === renameTarget.id ? __spreadProps(__spreadValues({}, t), { slug: newSlug, tags: (_a2 = opts == null ? void 0 : opts.tags) != null ? _a2 : t.tags }) : t;
5773
+ };
5774
+ setTemplates((prev) => prev.map(patch));
5775
+ setSamples((prev) => prev.map(patch));
5038
5776
  if (currentTemplateId === renameTarget.id) {
5039
5777
  setCurrentTemplate(renameTarget.id, newSlug);
5040
5778
  }
5041
- showMessage("Template renamed");
5779
+ showMessage("Details saved");
5042
5780
  });
5043
5781
  const flipKindLocally = (id, kind) => {
5044
5782
  setTemplates((prev) => prev.map((t) => t.id === id ? __spreadProps(__spreadValues({}, t), { kind }) : t));
@@ -5100,15 +5838,48 @@ function SamplesDrawer({
5100
5838
  return false;
5101
5839
  }
5102
5840
  });
5103
- const openNewTemplateDialog = () => {
5104
- setNewError(null);
5105
- setPendingSaveAs({ content: empty_email_message_default, defaultName: "New Template" });
5841
+ const openNewPicker = (kind) => {
5842
+ setPickerKind(kind);
5106
5843
  };
5844
+ const handleCreateFromPicker = (name, starterId) => __async(null, null, function* () {
5845
+ if (!saveAs) return false;
5846
+ const kind = pickerKind != null ? pickerKind : "template";
5847
+ try {
5848
+ let content = empty_email_message_default;
5849
+ if (starterId !== null) {
5850
+ content = yield handleLoadTemplate(starterId);
5851
+ if (!content) {
5852
+ showMessage("Could not load the selected sample");
5853
+ return false;
5854
+ }
5855
+ }
5856
+ const { id, slug } = yield saveAs(name, buildSavePayload(content));
5857
+ if (kind === "sample" && setTemplateKind) {
5858
+ try {
5859
+ yield setTemplateKind(id, "sample");
5860
+ flipKindLocally(id, "sample");
5861
+ } catch (e) {
5862
+ console.error("Failed to mark new row as sample:", e);
5863
+ }
5864
+ }
5865
+ resetDocument(content);
5866
+ setCurrentTemplate(id, slug, kind);
5867
+ ctxLoadTemplate(content, id, slug, kind);
5868
+ showMessage(kind === "sample" ? "New sample created" : "New template created");
5869
+ window.location.hash = `#template/${id}`;
5870
+ yield refreshTemplates();
5871
+ return true;
5872
+ } catch (e) {
5873
+ console.error("Error creating:", e);
5874
+ showMessage("Error creating");
5875
+ return false;
5876
+ }
5877
+ });
5107
5878
  if (!enabled) {
5108
5879
  return null;
5109
5880
  }
5110
5881
  const existingSlugs = templates.map((t) => t.slug);
5111
- return /* @__PURE__ */ React58.createElement(React58.Fragment, null, /* @__PURE__ */ React58.createElement(
5882
+ return /* @__PURE__ */ React62.createElement(React62.Fragment, null, /* @__PURE__ */ React62.createElement(
5112
5883
  Drawer,
5113
5884
  {
5114
5885
  variant: "persistent",
@@ -5123,7 +5894,7 @@ function SamplesDrawer({
5123
5894
  transitionDuration: { enter: enterDuration, exit: exitDuration },
5124
5895
  sx: { width: samplesDrawerOpen ? SAMPLES_DRAWER_WIDTH : 0 }
5125
5896
  },
5126
- /* @__PURE__ */ React58.createElement(
5897
+ /* @__PURE__ */ React62.createElement(
5127
5898
  Stack,
5128
5899
  {
5129
5900
  py: 1,
@@ -5133,27 +5904,39 @@ function SamplesDrawer({
5133
5904
  spacing: 1.5,
5134
5905
  sx: { overflowY: "auto" }
5135
5906
  },
5136
- /* @__PURE__ */ React58.createElement(Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", sx: { pt: 1 } }, /* @__PURE__ */ React58.createElement(Typography, { variant: "h6", component: "h1" }, "Templates"), saveAs && /* @__PURE__ */ React58.createElement(Tooltip, { title: "New template" }, /* @__PURE__ */ React58.createElement(
5907
+ /* @__PURE__ */ React62.createElement(Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", sx: { pt: 1 } }, /* @__PURE__ */ React62.createElement(Typography, { variant: "h6", component: "h1" }, "Library"), saveAs && (activeLeftTab === "templates" || activeLeftTab === "samples") && /* @__PURE__ */ React62.createElement(Tooltip, { title: activeLeftTab === "samples" ? "New sample" : "New template" }, /* @__PURE__ */ React62.createElement(
5137
5908
  IconButton,
5138
5909
  {
5139
5910
  size: "small",
5140
- onClick: openNewTemplateDialog,
5141
- "aria-label": "New template"
5911
+ onClick: () => openNewPicker(activeLeftTab === "samples" ? "sample" : "template"),
5912
+ "aria-label": activeLeftTab === "samples" ? "New sample" : "New template"
5142
5913
  },
5143
- /* @__PURE__ */ React58.createElement(AddOutlined, { fontSize: "small" })
5914
+ /* @__PURE__ */ React62.createElement(AddOutlined, { fontSize: "small" })
5144
5915
  ))),
5145
- loadTemplates && /* @__PURE__ */ React58.createElement(React58.Fragment, null, /* @__PURE__ */ React58.createElement(
5916
+ /* @__PURE__ */ React62.createElement(
5917
+ Tabs,
5918
+ {
5919
+ value: activeLeftTab,
5920
+ onChange: (_, v) => setActiveLeftTab(v),
5921
+ variant: "fullWidth",
5922
+ sx: { minHeight: 36, "& .MuiTab-root": { minHeight: 36, minWidth: 0, px: 1, fontSize: 13 } }
5923
+ },
5924
+ /* @__PURE__ */ React62.createElement(Tab, { value: "templates", label: "Templates", disabled: !loadTemplates }),
5925
+ /* @__PURE__ */ React62.createElement(Tab, { value: "samples", label: "Samples" }),
5926
+ /* @__PURE__ */ React62.createElement(Tab, { value: "outline", label: "Outline" })
5927
+ ),
5928
+ activeLeftTab === "outline" ? /* @__PURE__ */ React62.createElement(OutlinePanel, null) : /* @__PURE__ */ React62.createElement(React62.Fragment, null, /* @__PURE__ */ React62.createElement(
5146
5929
  TextField,
5147
5930
  {
5148
5931
  size: "small",
5149
- placeholder: "Search templates",
5932
+ placeholder: activeLeftTab === "templates" ? "Search templates" : "Search samples",
5150
5933
  value: search,
5151
5934
  onChange: (e) => setSearch(e.target.value),
5152
5935
  InputProps: {
5153
- startAdornment: /* @__PURE__ */ React58.createElement(InputAdornment, { position: "start" }, /* @__PURE__ */ React58.createElement(SearchOutlined, { fontSize: "small" }))
5936
+ startAdornment: /* @__PURE__ */ React62.createElement(InputAdornment, { position: "start" }, /* @__PURE__ */ React62.createElement(SearchOutlined, { fontSize: "small" }))
5154
5937
  }
5155
5938
  }
5156
- ), /* @__PURE__ */ React58.createElement(
5939
+ ), /* @__PURE__ */ React62.createElement(
5157
5940
  TextField,
5158
5941
  {
5159
5942
  select: true,
@@ -5162,8 +5945,18 @@ function SamplesDrawer({
5162
5945
  value: sortKey,
5163
5946
  onChange: (e) => setSortKey(e.target.value)
5164
5947
  },
5165
- SORT_OPTIONS.map((opt) => /* @__PURE__ */ React58.createElement(MenuItem, { key: opt.value, value: opt.value }, opt.label))
5166
- ), allTags.length > 0 && /* @__PURE__ */ React58.createElement(Stack, { direction: "row", sx: { flexWrap: "wrap", gap: 0.5 } }, allTags.map((tag) => /* @__PURE__ */ React58.createElement(
5948
+ SORT_OPTIONS.map((opt) => /* @__PURE__ */ React62.createElement(MenuItem, { key: opt.value, value: opt.value }, opt.label))
5949
+ ), allTags.length > 0 && /* @__PURE__ */ React62.createElement(Stack, { direction: "row", sx: { flexWrap: "wrap", gap: 0.5 } }, /* @__PURE__ */ React62.createElement(
5950
+ Chip,
5951
+ {
5952
+ label: "All",
5953
+ size: "small",
5954
+ clickable: true,
5955
+ color: activeTags.length === 0 ? "primary" : "default",
5956
+ variant: activeTags.length === 0 ? "filled" : "outlined",
5957
+ onClick: () => setActiveTags([])
5958
+ }
5959
+ ), allTags.map((tag) => /* @__PURE__ */ React62.createElement(
5167
5960
  Chip,
5168
5961
  {
5169
5962
  key: tag,
@@ -5174,7 +5967,7 @@ function SamplesDrawer({
5174
5967
  variant: activeTags.includes(tag) ? "filled" : "outlined",
5175
5968
  onClick: () => toggleTag(tag)
5176
5969
  }
5177
- ))), /* @__PURE__ */ React58.createElement(Box, null, /* @__PURE__ */ React58.createElement(Typography, { variant: "subtitle2", component: "h2", sx: { fontWeight: "bold", mb: 0.5 } }, "Your Templates"), loadingTemplates ? /* @__PURE__ */ React58.createElement(Stack, { alignItems: "center", width: "100%", py: 2 }, /* @__PURE__ */ React58.createElement(CircularProgress, { size: 24 })) : templatesError ? /* @__PURE__ */ React58.createElement(Alert, { severity: "error", sx: { my: 1 } }, templatesError) : filteredTemplates.length > 0 ? /* @__PURE__ */ React58.createElement(Stack, { spacing: 0.25, sx: { width: "100%" } }, filteredTemplates.map((template) => /* @__PURE__ */ React58.createElement(
5970
+ ))), activeLeftTab === "templates" ? /* @__PURE__ */ React62.createElement(Box, null, loadingTemplates ? /* @__PURE__ */ React62.createElement(Stack, { alignItems: "center", width: "100%", py: 2 }, /* @__PURE__ */ React62.createElement(CircularProgress, { size: 24 })) : templatesError ? /* @__PURE__ */ React62.createElement(Alert, { severity: "error", sx: { my: 1 } }, templatesError) : filteredTemplates.length > 0 ? /* @__PURE__ */ React62.createElement(Stack, { spacing: 0.25, sx: { width: "100%" } }, filteredTemplates.map((template) => /* @__PURE__ */ React62.createElement(
5178
5971
  TemplateRow,
5179
5972
  {
5180
5973
  key: template.id,
@@ -5186,8 +5979,7 @@ function SamplesDrawer({
5186
5979
  onDelete: deleteTemplate ? () => handleDelete(template) : void 0,
5187
5980
  onPromote: setTemplateKind ? () => handleSetKind(template, "sample") : void 0
5188
5981
  }
5189
- ))) : /* @__PURE__ */ React58.createElement(Typography, { variant: "body2", sx: { color: "text.secondary", py: 1 } }, templateRows.length === 0 ? "No saved templates yet" : "No templates match your filters")), /* @__PURE__ */ React58.createElement(Divider$1, null)),
5190
- /* @__PURE__ */ React58.createElement(Box, null, /* @__PURE__ */ React58.createElement(Typography, { variant: "subtitle2", component: "h2", sx: { fontWeight: "bold", mb: 0.5 } }, "Sample Templates"), loadingSamples ? /* @__PURE__ */ React58.createElement(Stack, { alignItems: "center", width: "100%", py: 2 }, /* @__PURE__ */ React58.createElement(CircularProgress, { size: 24 })) : sampleRows.length > 0 ? /* @__PURE__ */ React58.createElement(Stack, { spacing: 0.25, sx: { width: "100%" } }, sampleRows.map((sample) => /* @__PURE__ */ React58.createElement(
5982
+ ))) : /* @__PURE__ */ React62.createElement(Typography, { variant: "body2", sx: { color: "text.secondary", py: 1 } }, templateRows.length === 0 ? "No saved templates yet" : "No templates match your filters")) : /* @__PURE__ */ React62.createElement(Box, null, loadingSamples ? /* @__PURE__ */ React62.createElement(Stack, { alignItems: "center", width: "100%", py: 2 }, /* @__PURE__ */ React62.createElement(CircularProgress, { size: 24 })) : filteredSamples.length > 0 ? /* @__PURE__ */ React62.createElement(Stack, { spacing: 0.25, sx: { width: "100%" } }, filteredSamples.map((sample) => /* @__PURE__ */ React62.createElement(
5191
5983
  TemplateRow,
5192
5984
  {
5193
5985
  key: sample.id,
@@ -5195,20 +5987,23 @@ function SamplesDrawer({
5195
5987
  isCurrent: currentTemplateId === sample.id,
5196
5988
  templateLoader: () => handleLoadTemplate(sample.id),
5197
5989
  onDuplicateAsTemplate: saveAs ? () => handleDuplicateAsTemplate(sample) : void 0,
5198
- onDemote: setTemplateKind && sample.id !== "empty-email" ? () => handleSetKind(sample, "template") : void 0
5990
+ onRename: renameTemplate ? () => setRenameTarget(sample) : void 0,
5991
+ onDelete: deleteTemplate ? () => handleDelete(sample) : void 0,
5992
+ onDemote: setTemplateKind ? () => handleSetKind(sample, "template") : void 0
5199
5993
  }
5200
- ))) : /* @__PURE__ */ React58.createElement(Typography, { variant: "body2", sx: { color: "text.secondary", py: 1 } }, "No samples available"))
5994
+ ))) : /* @__PURE__ */ React62.createElement(Typography, { variant: "body2", sx: { color: "text.secondary", py: 1 } }, sampleRows.length === 0 ? "No samples available" : "No samples match your filters")))
5201
5995
  )
5202
- ), renameTarget && /* @__PURE__ */ React58.createElement(
5996
+ ), renameTarget && /* @__PURE__ */ React62.createElement(
5203
5997
  RenameDialog,
5204
5998
  {
5205
5999
  open: !!renameTarget,
5206
6000
  currentSlug: renameTarget.slug,
6001
+ currentTags: (_a = renameTarget.tags) != null ? _a : [],
5207
6002
  existingSlugs: existingSlugs.filter((s) => s !== renameTarget.slug),
5208
6003
  onClose: () => setRenameTarget(null),
5209
6004
  onSubmit: handleRenameSubmit
5210
6005
  }
5211
- ), /* @__PURE__ */ React58.createElement(
6006
+ ), /* @__PURE__ */ React62.createElement(
5212
6007
  SaveTemplateDialog,
5213
6008
  {
5214
6009
  open: !!pendingSaveAs,
@@ -5218,9 +6013,19 @@ function SamplesDrawer({
5218
6013
  },
5219
6014
  onSave: handleSaveAsSubmit,
5220
6015
  onNameChange: () => setNewError(null),
5221
- defaultName: (_a = pendingSaveAs == null ? void 0 : pendingSaveAs.defaultName) != null ? _a : "New Template",
6016
+ defaultName: (_b = pendingSaveAs == null ? void 0 : pendingSaveAs.defaultName) != null ? _b : "New Template",
5222
6017
  error: newError
5223
6018
  }
6019
+ ), /* @__PURE__ */ React62.createElement(
6020
+ NewTemplatePickerDialog,
6021
+ {
6022
+ open: pickerKind !== null,
6023
+ kind: pickerKind != null ? pickerKind : "template",
6024
+ samples: sampleRows,
6025
+ existingSlugs: pickerKind === "sample" ? sampleRows.map((s) => s.slug) : templateRows.map((t) => t.slug),
6026
+ onClose: () => setPickerKind(null),
6027
+ onCreate: handleCreateFromPicker
6028
+ }
5224
6029
  ));
5225
6030
  }
5226
6031
  var BUTTON_SX2 = { p: 1.5, display: "flex", flexDirection: "column" };
@@ -5235,7 +6040,7 @@ var ICON_SX = {
5235
6040
  borderColor: "cadet.300"
5236
6041
  };
5237
6042
  function BlockTypeButton({ label, icon, onClick }) {
5238
- return /* @__PURE__ */ React58.createElement(
6043
+ return /* @__PURE__ */ React62.createElement(
5239
6044
  Button$1,
5240
6045
  {
5241
6046
  sx: BUTTON_SX2,
@@ -5244,14 +6049,14 @@ function BlockTypeButton({ label, icon, onClick }) {
5244
6049
  onClick();
5245
6050
  }
5246
6051
  },
5247
- /* @__PURE__ */ React58.createElement(Box, { sx: ICON_SX }, icon),
5248
- /* @__PURE__ */ React58.createElement(Typography, { variant: "body2" }, label)
6052
+ /* @__PURE__ */ React62.createElement(Box, { sx: ICON_SX }, icon),
6053
+ /* @__PURE__ */ React62.createElement(Typography, { variant: "body2" }, label)
5249
6054
  );
5250
6055
  }
5251
6056
  var BUTTONS = [
5252
6057
  {
5253
6058
  label: "Heading",
5254
- icon: /* @__PURE__ */ React58.createElement(HMobiledataOutlined, null),
6059
+ icon: /* @__PURE__ */ React62.createElement(HMobiledataOutlined, null),
5255
6060
  block: () => ({
5256
6061
  type: "Heading",
5257
6062
  data: {
@@ -5264,7 +6069,7 @@ var BUTTONS = [
5264
6069
  },
5265
6070
  {
5266
6071
  label: "Text",
5267
- icon: /* @__PURE__ */ React58.createElement(NotesOutlined, null),
6072
+ icon: /* @__PURE__ */ React62.createElement(NotesOutlined, null),
5268
6073
  block: () => ({
5269
6074
  type: "Text",
5270
6075
  data: {
@@ -5278,7 +6083,7 @@ var BUTTONS = [
5278
6083
  },
5279
6084
  {
5280
6085
  label: "Button",
5281
- icon: /* @__PURE__ */ React58.createElement(SmartButtonOutlined, null),
6086
+ icon: /* @__PURE__ */ React62.createElement(SmartButtonOutlined, null),
5282
6087
  block: () => ({
5283
6088
  type: "Button",
5284
6089
  data: {
@@ -5292,7 +6097,7 @@ var BUTTONS = [
5292
6097
  },
5293
6098
  {
5294
6099
  label: "Image",
5295
- icon: /* @__PURE__ */ React58.createElement(ImageOutlined, null),
6100
+ icon: /* @__PURE__ */ React62.createElement(ImageOutlined, null),
5296
6101
  block: () => ({
5297
6102
  type: "Image",
5298
6103
  data: {
@@ -5308,7 +6113,7 @@ var BUTTONS = [
5308
6113
  },
5309
6114
  {
5310
6115
  label: "Avatar",
5311
- icon: /* @__PURE__ */ React58.createElement(AccountCircleOutlined, null),
6116
+ icon: /* @__PURE__ */ React62.createElement(AccountCircleOutlined, null),
5312
6117
  block: () => ({
5313
6118
  type: "Avatar",
5314
6119
  data: {
@@ -5322,7 +6127,7 @@ var BUTTONS = [
5322
6127
  },
5323
6128
  {
5324
6129
  label: "Personal Signature",
5325
- icon: /* @__PURE__ */ React58.createElement(ContactMailOutlined, null),
6130
+ icon: /* @__PURE__ */ React62.createElement(ContactMailOutlined, null),
5326
6131
  block: () => ({
5327
6132
  type: "Signature",
5328
6133
  data: {
@@ -5344,7 +6149,7 @@ var BUTTONS = [
5344
6149
  },
5345
6150
  {
5346
6151
  label: "Company Signature",
5347
- icon: /* @__PURE__ */ React58.createElement(BusinessOutlined, null),
6152
+ icon: /* @__PURE__ */ React62.createElement(BusinessOutlined, null),
5348
6153
  block: () => ({
5349
6154
  type: "Signature",
5350
6155
  data: {
@@ -5364,7 +6169,7 @@ var BUTTONS = [
5364
6169
  },
5365
6170
  {
5366
6171
  label: "Divider",
5367
- icon: /* @__PURE__ */ React58.createElement(HorizontalRuleOutlined, null),
6172
+ icon: /* @__PURE__ */ React62.createElement(HorizontalRuleOutlined, null),
5368
6173
  block: () => ({
5369
6174
  type: "Divider",
5370
6175
  data: {
@@ -5377,7 +6182,7 @@ var BUTTONS = [
5377
6182
  },
5378
6183
  {
5379
6184
  label: "Spacer",
5380
- icon: /* @__PURE__ */ React58.createElement(Crop32Outlined, null),
6185
+ icon: /* @__PURE__ */ React62.createElement(Crop32Outlined, null),
5381
6186
  block: () => ({
5382
6187
  type: "Spacer",
5383
6188
  data: {}
@@ -5385,7 +6190,7 @@ var BUTTONS = [
5385
6190
  },
5386
6191
  {
5387
6192
  label: "Html",
5388
- icon: /* @__PURE__ */ React58.createElement(HtmlOutlined, null),
6193
+ icon: /* @__PURE__ */ React62.createElement(HtmlOutlined, null),
5389
6194
  block: () => ({
5390
6195
  type: "Html",
5391
6196
  data: {
@@ -5400,7 +6205,7 @@ var BUTTONS = [
5400
6205
  },
5401
6206
  {
5402
6207
  label: "Columns",
5403
- icon: /* @__PURE__ */ React58.createElement(ViewColumnOutlined, null),
6208
+ icon: /* @__PURE__ */ React62.createElement(ViewColumnOutlined, null),
5404
6209
  block: () => ({
5405
6210
  type: "ColumnsContainer",
5406
6211
  data: {
@@ -5415,7 +6220,7 @@ var BUTTONS = [
5415
6220
  },
5416
6221
  {
5417
6222
  label: "Container",
5418
- icon: /* @__PURE__ */ React58.createElement(LibraryAddOutlined, null),
6223
+ icon: /* @__PURE__ */ React62.createElement(LibraryAddOutlined, null),
5419
6224
  block: () => ({
5420
6225
  type: "Container",
5421
6226
  data: {
@@ -5439,7 +6244,7 @@ function BlocksMenu({ anchorEl, setAnchorEl, onSelect }) {
5439
6244
  if (anchorEl === null) {
5440
6245
  return null;
5441
6246
  }
5442
- return /* @__PURE__ */ React58.createElement(
6247
+ return /* @__PURE__ */ React62.createElement(
5443
6248
  Menu,
5444
6249
  {
5445
6250
  open: true,
@@ -5448,7 +6253,7 @@ function BlocksMenu({ anchorEl, setAnchorEl, onSelect }) {
5448
6253
  anchorOrigin: { vertical: "bottom", horizontal: "center" },
5449
6254
  transformOrigin: { vertical: "top", horizontal: "center" }
5450
6255
  },
5451
- /* @__PURE__ */ React58.createElement(Box, { sx: { p: 1, display: "grid", gridTemplateColumns: "1fr 1fr 1fr 1fr" } }, BUTTONS.map((k, i) => /* @__PURE__ */ React58.createElement(BlockTypeButton, { key: i, label: k.label, icon: k.icon, onClick: () => onClick(k.block()) })))
6256
+ /* @__PURE__ */ React62.createElement(Box, { sx: { p: 1, display: "grid", gridTemplateColumns: "1fr 1fr 1fr 1fr" } }, BUTTONS.map((k, i) => /* @__PURE__ */ React62.createElement(BlockTypeButton, { key: i, label: k.label, icon: k.icon, onClick: () => onClick(k.block()) })))
5452
6257
  );
5453
6258
  }
5454
6259
  function DividerButton({ buttonElement, onClick }) {
@@ -5475,7 +6280,7 @@ function DividerButton({ buttonElement, onClick }) {
5475
6280
  window.removeEventListener("mousemove", listener);
5476
6281
  };
5477
6282
  }, [buttonElement, setVisible]);
5478
- return /* @__PURE__ */ React58.createElement(Fade, { in: visible }, /* @__PURE__ */ React58.createElement(
6283
+ return /* @__PURE__ */ React62.createElement(Fade, { in: visible }, /* @__PURE__ */ React62.createElement(
5479
6284
  IconButton,
5480
6285
  {
5481
6286
  size: "small",
@@ -5498,11 +6303,11 @@ function DividerButton({ buttonElement, onClick }) {
5498
6303
  onClick();
5499
6304
  }
5500
6305
  },
5501
- /* @__PURE__ */ React58.createElement(AddOutlined, { fontSize: "small" })
6306
+ /* @__PURE__ */ React62.createElement(AddOutlined, { fontSize: "small" })
5502
6307
  ));
5503
6308
  }
5504
6309
  function PlaceholderButton({ onClick }) {
5505
- return /* @__PURE__ */ React58.createElement(
6310
+ return /* @__PURE__ */ React62.createElement(
5506
6311
  ButtonBase,
5507
6312
  {
5508
6313
  onClick: (ev) => {
@@ -5518,7 +6323,7 @@ function PlaceholderButton({ onClick }) {
5518
6323
  bgcolor: "rgba(0,0,0, 0.05)"
5519
6324
  }
5520
6325
  },
5521
- /* @__PURE__ */ React58.createElement(
6326
+ /* @__PURE__ */ React62.createElement(
5522
6327
  AddOutlined,
5523
6328
  {
5524
6329
  sx: {
@@ -5542,19 +6347,29 @@ function AddBlockButton({ onSelect, placeholder }) {
5542
6347
  };
5543
6348
  const renderButton2 = () => {
5544
6349
  if (placeholder) {
5545
- return /* @__PURE__ */ React58.createElement(PlaceholderButton, { onClick: handleButtonClick });
6350
+ return /* @__PURE__ */ React62.createElement(PlaceholderButton, { onClick: handleButtonClick });
5546
6351
  } else {
5547
- return /* @__PURE__ */ React58.createElement(DividerButton, { buttonElement, onClick: handleButtonClick });
6352
+ return /* @__PURE__ */ React62.createElement(DividerButton, { buttonElement, onClick: handleButtonClick });
5548
6353
  }
5549
6354
  };
5550
- return /* @__PURE__ */ React58.createElement(React58.Fragment, null, /* @__PURE__ */ React58.createElement("div", { ref: setButtonElement, style: { position: "relative" } }, renderButton2()), /* @__PURE__ */ React58.createElement(BlocksMenu, { anchorEl: menuAnchorEl, setAnchorEl: setMenuAnchorEl, onSelect }));
6355
+ return /* @__PURE__ */ React62.createElement(React62.Fragment, null, /* @__PURE__ */ React62.createElement("div", { ref: setButtonElement, style: { position: "relative" } }, renderButton2()), /* @__PURE__ */ React62.createElement(BlocksMenu, { anchorEl: menuAnchorEl, setAnchorEl: setMenuAnchorEl, onSelect }));
6356
+ }
6357
+ var BlockParentContext = createContext(null);
6358
+ function BlockParentProvider({
6359
+ info,
6360
+ children
6361
+ }) {
6362
+ return /* @__PURE__ */ React62.createElement(BlockParentContext.Provider, { value: info }, children);
6363
+ }
6364
+ function useBlockParent() {
6365
+ return useContext(BlockParentContext);
5551
6366
  }
5552
6367
 
5553
6368
  // src/editor/blocks/helpers/editor-children-ids/index.tsx
5554
6369
  function generateId() {
5555
6370
  return `block-${Date.now()}`;
5556
6371
  }
5557
- function EditorChildrenIds({ childrenIds, onChange }) {
6372
+ function EditorChildrenIds({ childrenIds, onChange, parentRef }) {
5558
6373
  const appendBlock = (block) => {
5559
6374
  const blockId = generateId();
5560
6375
  return onChange({
@@ -5574,9 +6389,62 @@ function EditorChildrenIds({ childrenIds, onChange }) {
5574
6389
  });
5575
6390
  };
5576
6391
  if (!childrenIds || childrenIds.length === 0) {
5577
- return /* @__PURE__ */ React58.createElement(AddBlockButton, { placeholder: true, onSelect: appendBlock });
6392
+ return /* @__PURE__ */ React62.createElement(React62.Fragment, null, /* @__PURE__ */ React62.createElement(AddBlockButton, { placeholder: true, onSelect: appendBlock }), parentRef && /* @__PURE__ */ React62.createElement(CanvasDropZone, { parentRef, targetIndex: 0, placeholder: true }));
5578
6393
  }
5579
- return /* @__PURE__ */ React58.createElement(React58.Fragment, null, childrenIds.map((childId, i) => /* @__PURE__ */ React58.createElement(Fragment, { key: childId }, /* @__PURE__ */ React58.createElement(AddBlockButton, { onSelect: (block) => insertBlock(block, i) }), /* @__PURE__ */ React58.createElement(EditorBlock, { id: childId }))), /* @__PURE__ */ React58.createElement(AddBlockButton, { onSelect: appendBlock }));
6394
+ return /* @__PURE__ */ React62.createElement(React62.Fragment, null, childrenIds.map((childId, i) => /* @__PURE__ */ React62.createElement(Fragment, { key: childId }, /* @__PURE__ */ React62.createElement(AddBlockButton, { onSelect: (block) => insertBlock(block, i) }), parentRef && /* @__PURE__ */ React62.createElement(CanvasDropZone, { parentRef, targetIndex: i }), parentRef ? /* @__PURE__ */ React62.createElement(BlockParentProvider, { info: { parent: parentRef, indexInParent: i } }, /* @__PURE__ */ React62.createElement(EditorBlock, { id: childId })) : /* @__PURE__ */ React62.createElement(EditorBlock, { id: childId }))), /* @__PURE__ */ React62.createElement(AddBlockButton, { onSelect: appendBlock }), parentRef && /* @__PURE__ */ React62.createElement(CanvasDropZone, { parentRef, targetIndex: childrenIds.length }));
6395
+ }
6396
+ function CanvasDropZone({
6397
+ parentRef,
6398
+ targetIndex,
6399
+ placeholder = false
6400
+ }) {
6401
+ const document2 = useDocument();
6402
+ const dragging = useDraggingBlock();
6403
+ const [over, setOver] = useState(false);
6404
+ if (!dragging) return null;
6405
+ if (isDescendant(document2, dragging.sourceId, parentRef.parentId)) return null;
6406
+ const handleDragOver = (e) => {
6407
+ e.preventDefault();
6408
+ e.dataTransfer.dropEffect = "move";
6409
+ setOver(true);
6410
+ };
6411
+ const handleDragLeave = () => setOver(false);
6412
+ const handleDrop = (e) => {
6413
+ e.preventDefault();
6414
+ e.stopPropagation();
6415
+ setOver(false);
6416
+ const payload = getDraggingBlock();
6417
+ if (!payload) return;
6418
+ const patch = buildMovePatch(
6419
+ document2,
6420
+ payload.sourceId,
6421
+ payload.sourceParent,
6422
+ parentRef,
6423
+ targetIndex
6424
+ );
6425
+ if (patch) {
6426
+ setDocument(patch);
6427
+ setSelectedBlockId(payload.sourceId);
6428
+ }
6429
+ setDraggingBlock(null);
6430
+ };
6431
+ return /* @__PURE__ */ React62.createElement(
6432
+ Box,
6433
+ {
6434
+ onDragOver: handleDragOver,
6435
+ onDragLeave: handleDragLeave,
6436
+ onDrop: handleDrop,
6437
+ sx: {
6438
+ height: placeholder ? 64 : over ? 16 : 8,
6439
+ mx: placeholder ? 2 : 3,
6440
+ my: placeholder ? 0 : over ? 0.5 : 0,
6441
+ borderRadius: 1,
6442
+ backgroundColor: over ? "rgba(25, 118, 210, 0.16)" : "transparent",
6443
+ outline: over ? "1.5px dashed rgba(25, 118, 210, 0.8)" : void 0,
6444
+ transition: "height 80ms, background-color 80ms, outline-color 80ms"
6445
+ }
6446
+ }
6447
+ );
5580
6448
  }
5581
6449
 
5582
6450
  // src/editor/blocks/columns-container/columns-container-editor.tsx
@@ -5603,15 +6471,36 @@ function ColumnsContainerEditor({ style, props }) {
5603
6471
  });
5604
6472
  setSelectedBlockId(blockId);
5605
6473
  };
5606
- return /* @__PURE__ */ React58.createElement(
6474
+ return /* @__PURE__ */ React62.createElement(
5607
6475
  columns_container_default,
5608
6476
  {
5609
6477
  props: restProps,
5610
6478
  style,
5611
6479
  columns: [
5612
- /* @__PURE__ */ React58.createElement(EditorChildrenIds, { childrenIds: (_b = columns == null ? void 0 : columns[0]) == null ? void 0 : _b.childrenIds, onChange: (change) => updateColumn(0, change) }),
5613
- /* @__PURE__ */ React58.createElement(EditorChildrenIds, { childrenIds: (_c = columns == null ? void 0 : columns[1]) == null ? void 0 : _c.childrenIds, onChange: (change) => updateColumn(1, change) }),
5614
- /* @__PURE__ */ React58.createElement(EditorChildrenIds, { childrenIds: (_d = columns == null ? void 0 : columns[2]) == null ? void 0 : _d.childrenIds, onChange: (change) => updateColumn(2, change) })
6480
+ /* @__PURE__ */ React62.createElement(
6481
+ EditorChildrenIds,
6482
+ {
6483
+ childrenIds: (_b = columns == null ? void 0 : columns[0]) == null ? void 0 : _b.childrenIds,
6484
+ parentRef: { kind: "ColumnsContainer", parentId: currentBlockId, columnIndex: 0 },
6485
+ onChange: (change) => updateColumn(0, change)
6486
+ }
6487
+ ),
6488
+ /* @__PURE__ */ React62.createElement(
6489
+ EditorChildrenIds,
6490
+ {
6491
+ childrenIds: (_c = columns == null ? void 0 : columns[1]) == null ? void 0 : _c.childrenIds,
6492
+ parentRef: { kind: "ColumnsContainer", parentId: currentBlockId, columnIndex: 1 },
6493
+ onChange: (change) => updateColumn(1, change)
6494
+ }
6495
+ ),
6496
+ /* @__PURE__ */ React62.createElement(
6497
+ EditorChildrenIds,
6498
+ {
6499
+ childrenIds: (_d = columns == null ? void 0 : columns[2]) == null ? void 0 : _d.childrenIds,
6500
+ parentRef: { kind: "ColumnsContainer", parentId: currentBlockId, columnIndex: 2 },
6501
+ onChange: (change) => updateColumn(2, change)
6502
+ }
6503
+ )
5615
6504
  ]
5616
6505
  }
5617
6506
  );
@@ -5621,10 +6510,11 @@ function ContainerEditor({ style, props }) {
5621
6510
  const childrenIds = (_a = props == null ? void 0 : props.childrenIds) != null ? _a : [];
5622
6511
  const document2 = useDocument();
5623
6512
  const currentBlockId = useCurrentBlockId();
5624
- return /* @__PURE__ */ React58.createElement(container_default, { style }, /* @__PURE__ */ React58.createElement(
6513
+ return /* @__PURE__ */ React62.createElement(container_default, { style }, /* @__PURE__ */ React62.createElement(
5625
6514
  EditorChildrenIds,
5626
6515
  {
5627
6516
  childrenIds,
6517
+ parentRef: { kind: "Container", parentId: currentBlockId },
5628
6518
  onChange: ({ block, blockId, childrenIds: childrenIds2 }) => {
5629
6519
  setDocument({
5630
6520
  [blockId]: block,
@@ -5821,10 +6711,11 @@ function EmailLayoutEditor(props) {
5821
6711
  lineHeight: "1.5",
5822
6712
  margin: "0"
5823
6713
  };
5824
- const editorChildren = /* @__PURE__ */ React58.createElement(
6714
+ const editorChildren = /* @__PURE__ */ React62.createElement(
5825
6715
  EditorChildrenIds,
5826
6716
  {
5827
6717
  childrenIds,
6718
+ parentRef: { kind: "EmailLayout", parentId: "root" },
5828
6719
  onChange: ({ block, blockId, childrenIds: childrenIds2 }) => {
5829
6720
  setDocument({
5830
6721
  [blockId]: block,
@@ -5839,61 +6730,87 @@ function EmailLayoutEditor(props) {
5839
6730
  }
5840
6731
  }
5841
6732
  );
6733
+ const WORKSPACE_BG = "#e7e8ec";
6734
+ const CARD_MAX_WIDTH = 664;
6735
+ const cardStyle = {
6736
+ maxWidth: CARD_MAX_WIDTH,
6737
+ margin: "0 auto",
6738
+ borderRadius: 12,
6739
+ boxShadow: "0 1px 2px rgba(33, 36, 67, 0.05), 0 8px 24px rgba(33, 36, 67, 0.08)"
6740
+ };
5842
6741
  if (props.backdropDisabled) {
5843
- return /* @__PURE__ */ React58.createElement(
6742
+ return /* @__PURE__ */ React62.createElement(
5844
6743
  "div",
5845
6744
  {
5846
6745
  onClick: () => {
5847
6746
  setSelectedBlockId(null);
5848
6747
  },
5849
6748
  style: __spreadProps(__spreadValues({}, baseStyle), {
5850
- backgroundColor: "#F5F5F5",
6749
+ backgroundColor: WORKSPACE_BG,
5851
6750
  padding: "32px",
5852
6751
  width: "100%",
5853
6752
  minHeight: "100%"
5854
6753
  })
5855
6754
  },
5856
- /* @__PURE__ */ React58.createElement("div", { style: { maxWidth: "600px" } }, editorChildren)
6755
+ /* @__PURE__ */ React62.createElement(
6756
+ "div",
6757
+ {
6758
+ style: __spreadProps(__spreadValues({}, cardStyle), {
6759
+ backgroundColor: "#F5F5F5",
6760
+ padding: "32px"
6761
+ })
6762
+ },
6763
+ /* @__PURE__ */ React62.createElement("div", { style: { maxWidth: "600px", margin: "0 auto" } }, editorChildren)
6764
+ )
5857
6765
  );
5858
6766
  }
5859
- return /* @__PURE__ */ React58.createElement(
6767
+ return /* @__PURE__ */ React62.createElement(
5860
6768
  "div",
5861
6769
  {
5862
6770
  onClick: () => {
5863
6771
  setSelectedBlockId(null);
5864
6772
  },
5865
6773
  style: __spreadProps(__spreadValues({}, baseStyle), {
5866
- backgroundColor: (_c = props.backdropColor) != null ? _c : "#F5F5F5",
5867
- padding: "32px 0",
6774
+ backgroundColor: WORKSPACE_BG,
6775
+ padding: "32px 16px",
5868
6776
  width: "100%",
5869
6777
  minHeight: "100%"
5870
6778
  })
5871
6779
  },
5872
- /* @__PURE__ */ React58.createElement(
5873
- "table",
6780
+ /* @__PURE__ */ React62.createElement(
6781
+ "div",
5874
6782
  {
5875
- align: "center",
5876
- width: "100%",
5877
- style: {
5878
- margin: "0 auto",
5879
- maxWidth: "600px",
5880
- backgroundColor: (_d = props.canvasColor) != null ? _d : "#FFFFFF",
5881
- borderRadius: (_e = props.borderRadius) != null ? _e : void 0,
5882
- overflow: props.borderRadius ? "hidden" : void 0,
5883
- border: (() => {
5884
- const v = props.borderColor;
5885
- if (!v) {
5886
- return void 0;
5887
- }
5888
- return `1px solid ${v}`;
5889
- })()
5890
- },
5891
- role: "presentation",
5892
- cellSpacing: "0",
5893
- cellPadding: "0",
5894
- border: 0
6783
+ style: __spreadProps(__spreadValues({}, cardStyle), {
6784
+ backgroundColor: (_c = props.backdropColor) != null ? _c : "#F5F5F5",
6785
+ padding: "32px 0"
6786
+ })
5895
6787
  },
5896
- /* @__PURE__ */ React58.createElement("tbody", null, /* @__PURE__ */ React58.createElement("tr", { style: { width: "100%" } }, /* @__PURE__ */ React58.createElement("td", null, editorChildren)))
6788
+ /* @__PURE__ */ React62.createElement(
6789
+ "table",
6790
+ {
6791
+ align: "center",
6792
+ width: "100%",
6793
+ style: {
6794
+ margin: "0 auto",
6795
+ maxWidth: "600px",
6796
+ backgroundColor: (_d = props.canvasColor) != null ? _d : "#FFFFFF",
6797
+ borderRadius: (_e = props.borderRadius) != null ? _e : void 0,
6798
+ overflow: props.borderRadius ? "hidden" : void 0,
6799
+ border: (() => {
6800
+ const v = props.borderColor;
6801
+ if (!v) {
6802
+ return void 0;
6803
+ }
6804
+ return `1px solid ${v}`;
6805
+ })()
6806
+ },
6807
+ role: "presentation",
6808
+ cellSpacing: "0",
6809
+ cellPadding: "0",
6810
+ border: 0
6811
+ },
6812
+ /* @__PURE__ */ React62.createElement("tbody", null, /* @__PURE__ */ React62.createElement("tr", { style: { width: "100%" } }, /* @__PURE__ */ React62.createElement("td", null, editorChildren)))
6813
+ )
5897
6814
  )
5898
6815
  );
5899
6816
  }
@@ -6052,34 +6969,54 @@ function TuneMenu({ blockId }) {
6052
6969
  resetDocument(nDocument);
6053
6970
  setSelectedBlockId(blockId);
6054
6971
  };
6055
- return /* @__PURE__ */ React58.createElement(Paper, { sx, onClick: (ev) => ev.stopPropagation() }, /* @__PURE__ */ React58.createElement(Stack, null, /* @__PURE__ */ React58.createElement(Tooltip, { title: "Move up", placement: "left-start" }, /* @__PURE__ */ React58.createElement(IconButton, { onClick: () => handleMoveClick("up"), sx: { color: "text.primary" } }, /* @__PURE__ */ React58.createElement(ArrowUpwardOutlined, { fontSize: "small" }))), /* @__PURE__ */ React58.createElement(Tooltip, { title: "Move down", placement: "left-start" }, /* @__PURE__ */ React58.createElement(IconButton, { onClick: () => handleMoveClick("down"), sx: { color: "text.primary" } }, /* @__PURE__ */ React58.createElement(ArrowDownwardOutlined, { fontSize: "small" }))), /* @__PURE__ */ React58.createElement(Tooltip, { title: "Copy block", placement: "left-start" }, /* @__PURE__ */ React58.createElement(IconButton, { onClick: handleCopyClick, sx: { color: "text.primary" } }, /* @__PURE__ */ React58.createElement(ContentCopyOutlined, { fontSize: "small" }))), /* @__PURE__ */ React58.createElement(Tooltip, { title: "Delete", placement: "left-start" }, /* @__PURE__ */ React58.createElement(IconButton, { onClick: handleDeleteClick, sx: { color: "text.primary" } }, /* @__PURE__ */ React58.createElement(DeleteOutlined, { fontSize: "small" })))));
6972
+ return /* @__PURE__ */ React62.createElement(Paper, { sx, onClick: (ev) => ev.stopPropagation() }, /* @__PURE__ */ React62.createElement(Stack, null, /* @__PURE__ */ React62.createElement(Tooltip, { title: "Move up", placement: "left-start" }, /* @__PURE__ */ React62.createElement(IconButton, { onClick: () => handleMoveClick("up"), sx: { color: "text.primary" } }, /* @__PURE__ */ React62.createElement(ArrowUpwardOutlined, { fontSize: "small" }))), /* @__PURE__ */ React62.createElement(Tooltip, { title: "Move down", placement: "left-start" }, /* @__PURE__ */ React62.createElement(IconButton, { onClick: () => handleMoveClick("down"), sx: { color: "text.primary" } }, /* @__PURE__ */ React62.createElement(ArrowDownwardOutlined, { fontSize: "small" }))), /* @__PURE__ */ React62.createElement(Tooltip, { title: "Copy block", placement: "left-start" }, /* @__PURE__ */ React62.createElement(IconButton, { onClick: handleCopyClick, sx: { color: "text.primary" } }, /* @__PURE__ */ React62.createElement(ContentCopyOutlined, { fontSize: "small" }))), /* @__PURE__ */ React62.createElement(Tooltip, { title: "Delete", placement: "left-start" }, /* @__PURE__ */ React62.createElement(IconButton, { onClick: handleDeleteClick, sx: { color: "text.primary" } }, /* @__PURE__ */ React62.createElement(DeleteOutlined, { fontSize: "small" })))));
6056
6973
  }
6057
6974
 
6058
6975
  // src/editor/blocks/helpers/block-wrappers/editor-block-wrapper.tsx
6059
6976
  function EditorBlockWrapper({ children }) {
6060
6977
  const selectedBlockId = useSelectedBlockId();
6978
+ const hoveredBlockId = useHoveredBlockId();
6979
+ const draggingBlock = useDraggingBlock();
6980
+ const blockParent = useBlockParent();
6061
6981
  const [mouseInside, setMouseInside] = useState(false);
6062
6982
  const blockId = useCurrentBlockId();
6983
+ const isBeingDragged = (draggingBlock == null ? void 0 : draggingBlock.sourceId) === blockId;
6063
6984
  let outline;
6064
6985
  if (selectedBlockId === blockId) {
6065
6986
  outline = "2px solid rgba(0,121,204, 1)";
6066
- } else if (mouseInside) {
6987
+ } else if (mouseInside && !draggingBlock || hoveredBlockId === blockId) {
6067
6988
  outline = "2px solid rgba(0,121,204, 0.3)";
6068
6989
  }
6069
6990
  const renderMenu = () => {
6070
6991
  if (selectedBlockId !== blockId) {
6071
6992
  return null;
6072
6993
  }
6073
- return /* @__PURE__ */ React58.createElement(TuneMenu, { blockId });
6994
+ return /* @__PURE__ */ React62.createElement(TuneMenu, { blockId });
6995
+ };
6996
+ const draggable = Boolean(blockParent);
6997
+ const handleDragStart = (e) => {
6998
+ if (!blockParent) return;
6999
+ e.stopPropagation();
7000
+ e.dataTransfer.effectAllowed = "move";
7001
+ e.dataTransfer.setData("text/plain", blockId);
7002
+ setDraggingBlock({ sourceId: blockId, sourceParent: blockParent.parent });
7003
+ };
7004
+ const handleDragEnd = () => {
7005
+ setDraggingBlock(null);
6074
7006
  };
6075
- return /* @__PURE__ */ React58.createElement(
7007
+ return /* @__PURE__ */ React62.createElement(
6076
7008
  Box,
6077
7009
  {
7010
+ draggable,
7011
+ onDragStart: handleDragStart,
7012
+ onDragEnd: handleDragEnd,
6078
7013
  sx: {
6079
7014
  position: "relative",
6080
7015
  maxWidth: "100%",
6081
7016
  outlineOffset: "-1px",
6082
- outline
7017
+ outline,
7018
+ opacity: isBeingDragged ? 0.4 : 1,
7019
+ cursor: draggable ? draggingBlock ? "grabbing" : "default" : "default"
6083
7020
  },
6084
7021
  onMouseEnter: (ev) => {
6085
7022
  setMouseInside(true);
@@ -6212,7 +7149,7 @@ function ButtonEditor({ style, props }) {
6212
7149
  selectionEnd: (_b2 = el.selectionEnd) != null ? _b2 : el.value.length
6213
7150
  });
6214
7151
  };
6215
- return /* @__PURE__ */ React58.createElement("div", { style: wrapperStyle }, /* @__PURE__ */ React58.createElement(
7152
+ return /* @__PURE__ */ React62.createElement("div", { style: wrapperStyle }, /* @__PURE__ */ React62.createElement(
6216
7153
  "input",
6217
7154
  {
6218
7155
  type: "text",
@@ -6229,7 +7166,7 @@ function ButtonEditor({ style, props }) {
6229
7166
  }
6230
7167
  ));
6231
7168
  }
6232
- return /* @__PURE__ */ React58.createElement("div", { style: wrapperStyle }, /* @__PURE__ */ React58.createElement("span", { style: linkStyle }, /* @__PURE__ */ React58.createElement("span", null, text)));
7169
+ return /* @__PURE__ */ React62.createElement("div", { style: wrapperStyle }, /* @__PURE__ */ React62.createElement("span", { style: linkStyle }, /* @__PURE__ */ React62.createElement("span", null, text)));
6233
7170
  }
6234
7171
  function useMarkdownToolbar({ text, isSelected, commitText, trackSelection }) {
6235
7172
  const textareaRef = useRef(null);
@@ -6373,7 +7310,7 @@ function InlineFormattingToolbar({
6373
7310
  }
6374
7311
  }, [linkPrompt]);
6375
7312
  const preventBlur = (e) => e.preventDefault();
6376
- return /* @__PURE__ */ React58.createElement(Popper, { open: visible, anchorEl, placement: "top-start", style: { zIndex: 1300 } }, /* @__PURE__ */ React58.createElement(Paper, { elevation: 4, sx: { px: 0.5, py: 0.25, mb: 0.5 }, onMouseDown: preventBlur }, linkPrompt ? /* @__PURE__ */ React58.createElement(Stack, { direction: "row", alignItems: "center", spacing: 0.5, sx: { px: 0.5 } }, /* @__PURE__ */ React58.createElement(
7313
+ return /* @__PURE__ */ React62.createElement(Popper, { open: visible, anchorEl, placement: "top-start", style: { zIndex: 1300 } }, /* @__PURE__ */ React62.createElement(Paper, { elevation: 4, sx: { px: 0.5, py: 0.25, mb: 0.5 }, onMouseDown: preventBlur }, linkPrompt ? /* @__PURE__ */ React62.createElement(Stack, { direction: "row", alignItems: "center", spacing: 0.5, sx: { px: 0.5 } }, /* @__PURE__ */ React62.createElement(
6377
7314
  TextField,
6378
7315
  {
6379
7316
  inputRef,
@@ -6395,7 +7332,7 @@ function InlineFormattingToolbar({
6395
7332
  },
6396
7333
  sx: { width: 220 }
6397
7334
  }
6398
- )) : /* @__PURE__ */ React58.createElement(Stack, { direction: "row", spacing: 0.25 }, /* @__PURE__ */ React58.createElement(IconButton, { size: "small", onClick: onBold, title: "Bold (Cmd+B)", "aria-label": "Bold" }, /* @__PURE__ */ React58.createElement(FormatBoldOutlined, { fontSize: "small" })), /* @__PURE__ */ React58.createElement(IconButton, { size: "small", onClick: onItalic, title: "Italic (Cmd+I)", "aria-label": "Italic" }, /* @__PURE__ */ React58.createElement(FormatItalicOutlined, { fontSize: "small" })), /* @__PURE__ */ React58.createElement(IconButton, { size: "small", onClick: onLinkRequest, title: "Link (Cmd+K)", "aria-label": "Link" }, /* @__PURE__ */ React58.createElement(LinkOutlined, { fontSize: "small" })))));
7335
+ )) : /* @__PURE__ */ React62.createElement(Stack, { direction: "row", spacing: 0.25 }, /* @__PURE__ */ React62.createElement(IconButton, { size: "small", onClick: onBold, title: "Bold (Cmd+B)", "aria-label": "Bold" }, /* @__PURE__ */ React62.createElement(FormatBoldOutlined, { fontSize: "small" })), /* @__PURE__ */ React62.createElement(IconButton, { size: "small", onClick: onItalic, title: "Italic (Cmd+I)", "aria-label": "Italic" }, /* @__PURE__ */ React62.createElement(FormatItalicOutlined, { fontSize: "small" })), /* @__PURE__ */ React62.createElement(IconButton, { size: "small", onClick: onLinkRequest, title: "Link (Cmd+K)", "aria-label": "Link" }, /* @__PURE__ */ React62.createElement(LinkOutlined, { fontSize: "small" })))));
6399
7336
  }
6400
7337
 
6401
7338
  // src/editor/blocks/heading/heading-editor.tsx
@@ -6550,7 +7487,7 @@ function HeadingEditor({ style, props }) {
6550
7487
  if (textareaRef.current) adjustTextareaHeight(textareaRef.current);
6551
7488
  }, [localText, isSelected]);
6552
7489
  if (isSelected) {
6553
- return /* @__PURE__ */ React58.createElement(React58.Fragment, null, /* @__PURE__ */ React58.createElement(
7490
+ return /* @__PURE__ */ React62.createElement(React62.Fragment, null, /* @__PURE__ */ React62.createElement(
6554
7491
  "textarea",
6555
7492
  {
6556
7493
  ref: textareaRef,
@@ -6568,7 +7505,7 @@ function HeadingEditor({ style, props }) {
6568
7505
  rows: 1,
6569
7506
  onInput: (e) => adjustTextareaHeight(e.target)
6570
7507
  }
6571
- ), /* @__PURE__ */ React58.createElement(InlineFormattingToolbar, __spreadValues({ anchorEl: textareaRef.current }, toolbarProps)));
7508
+ ), /* @__PURE__ */ React62.createElement(InlineFormattingToolbar, __spreadValues({ anchorEl: textareaRef.current }, toolbarProps)));
6572
7509
  }
6573
7510
  const headingProps = isMarkdown ? {
6574
7511
  ref: displayRef,
@@ -6577,11 +7514,11 @@ function HeadingEditor({ style, props }) {
6577
7514
  } : { ref: displayRef, style: hStyle, children: textContent };
6578
7515
  switch (level) {
6579
7516
  case "h1":
6580
- return /* @__PURE__ */ React58.createElement("h1", __spreadValues({}, headingProps));
7517
+ return /* @__PURE__ */ React62.createElement("h1", __spreadValues({}, headingProps));
6581
7518
  case "h2":
6582
- return /* @__PURE__ */ React58.createElement("h2", __spreadValues({}, headingProps));
7519
+ return /* @__PURE__ */ React62.createElement("h2", __spreadValues({}, headingProps));
6583
7520
  case "h3":
6584
- return /* @__PURE__ */ React58.createElement("h3", __spreadValues({}, headingProps));
7521
+ return /* @__PURE__ */ React62.createElement("h3", __spreadValues({}, headingProps));
6585
7522
  }
6586
7523
  }
6587
7524
  function HtmlEditor({ style, props }) {
@@ -6646,7 +7583,7 @@ function HtmlEditor({ style, props }) {
6646
7583
  selectionEnd: (_b2 = el.selectionEnd) != null ? _b2 : el.value.length
6647
7584
  });
6648
7585
  };
6649
- return /* @__PURE__ */ React58.createElement("div", { style: cssStyle }, /* @__PURE__ */ React58.createElement(
7586
+ return /* @__PURE__ */ React62.createElement("div", { style: cssStyle }, /* @__PURE__ */ React62.createElement(
6650
7587
  "textarea",
6651
7588
  {
6652
7589
  value: localContents,
@@ -6666,9 +7603,9 @@ function HtmlEditor({ style, props }) {
6666
7603
  ));
6667
7604
  }
6668
7605
  if (!contents) {
6669
- return /* @__PURE__ */ React58.createElement("div", { style: cssStyle });
7606
+ return /* @__PURE__ */ React62.createElement("div", { style: cssStyle });
6670
7607
  }
6671
- return /* @__PURE__ */ React58.createElement("div", { style: cssStyle, dangerouslySetInnerHTML: { __html: contents } });
7608
+ return /* @__PURE__ */ React62.createElement("div", { style: cssStyle, dangerouslySetInnerHTML: { __html: contents } });
6672
7609
  }
6673
7610
  function getImageBorderRadius2(shape, size) {
6674
7611
  switch (shape) {
@@ -6783,7 +7720,7 @@ function SignatureEditor({ style, props }) {
6783
7720
  backgroundColor: (_p = style == null ? void 0 : style.backgroundColor) != null ? _p : void 0,
6784
7721
  padding: (style == null ? void 0 : style.padding) ? `${style.padding.top}px ${style.padding.right}px ${style.padding.bottom}px ${style.padding.left}px` : void 0
6785
7722
  };
6786
- const imageElement = imageUrl ? /* @__PURE__ */ React58.createElement(
7723
+ const imageElement = imageUrl ? /* @__PURE__ */ React62.createElement(
6787
7724
  "img",
6788
7725
  {
6789
7726
  src: imageUrl,
@@ -6801,7 +7738,7 @@ function SignatureEditor({ style, props }) {
6801
7738
  }
6802
7739
  }
6803
7740
  ) : null;
6804
- const greetingElement = isSelected ? /* @__PURE__ */ React58.createElement("div", { onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React58.createElement(
7741
+ const greetingElement = isSelected ? /* @__PURE__ */ React62.createElement("div", { onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React62.createElement(
6805
7742
  "input",
6806
7743
  {
6807
7744
  value: localGreeting,
@@ -6812,8 +7749,8 @@ function SignatureEditor({ style, props }) {
6812
7749
  placeholder: "Greeting (e.g. Best regards,)",
6813
7750
  style: __spreadValues(__spreadValues({}, inputBase), greetingStyle)
6814
7751
  }
6815
- )) : greeting ? /* @__PURE__ */ React58.createElement("p", { style: greetingStyle }, greeting) : null;
6816
- const textContent = isSelected ? /* @__PURE__ */ React58.createElement("div", { onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React58.createElement(
7752
+ )) : greeting ? /* @__PURE__ */ React62.createElement("p", { style: greetingStyle }, greeting) : null;
7753
+ const textContent = isSelected ? /* @__PURE__ */ React62.createElement("div", { onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React62.createElement(
6817
7754
  "input",
6818
7755
  {
6819
7756
  value: localName,
@@ -6824,7 +7761,7 @@ function SignatureEditor({ style, props }) {
6824
7761
  placeholder: "Name",
6825
7762
  style: __spreadValues(__spreadValues({}, inputBase), nameStyle)
6826
7763
  }
6827
- ), /* @__PURE__ */ React58.createElement(
7764
+ ), /* @__PURE__ */ React62.createElement(
6828
7765
  "input",
6829
7766
  {
6830
7767
  value: localTitle,
@@ -6835,7 +7772,7 @@ function SignatureEditor({ style, props }) {
6835
7772
  placeholder: "Title",
6836
7773
  style: __spreadValues(__spreadValues({}, inputBase), detailStyle)
6837
7774
  }
6838
- ), /* @__PURE__ */ React58.createElement(
7775
+ ), /* @__PURE__ */ React62.createElement(
6839
7776
  "input",
6840
7777
  {
6841
7778
  value: localCompany,
@@ -6846,7 +7783,7 @@ function SignatureEditor({ style, props }) {
6846
7783
  placeholder: "Company",
6847
7784
  style: __spreadValues(__spreadValues({}, inputBase), detailStyle)
6848
7785
  }
6849
- ), /* @__PURE__ */ React58.createElement(
7786
+ ), /* @__PURE__ */ React62.createElement(
6850
7787
  "input",
6851
7788
  {
6852
7789
  value: localAddress,
@@ -6857,7 +7794,7 @@ function SignatureEditor({ style, props }) {
6857
7794
  placeholder: "Address",
6858
7795
  style: __spreadValues(__spreadValues({}, inputBase), detailStyle)
6859
7796
  }
6860
- ), /* @__PURE__ */ React58.createElement(
7797
+ ), /* @__PURE__ */ React62.createElement(
6861
7798
  "input",
6862
7799
  {
6863
7800
  value: localEmail,
@@ -6868,7 +7805,7 @@ function SignatureEditor({ style, props }) {
6868
7805
  placeholder: "Email",
6869
7806
  style: __spreadProps(__spreadValues(__spreadValues({}, inputBase), linkStyle), { marginTop: 4, display: "block" })
6870
7807
  }
6871
- ), /* @__PURE__ */ React58.createElement(
7808
+ ), /* @__PURE__ */ React62.createElement(
6872
7809
  "input",
6873
7810
  {
6874
7811
  value: localPhone,
@@ -6879,7 +7816,7 @@ function SignatureEditor({ style, props }) {
6879
7816
  placeholder: "Phone",
6880
7817
  style: __spreadProps(__spreadValues(__spreadValues({}, inputBase), linkStyle), { display: "block" })
6881
7818
  }
6882
- ), /* @__PURE__ */ React58.createElement(
7819
+ ), /* @__PURE__ */ React62.createElement(
6883
7820
  "input",
6884
7821
  {
6885
7822
  value: localWebsite,
@@ -6890,11 +7827,11 @@ function SignatureEditor({ style, props }) {
6890
7827
  placeholder: "Website",
6891
7828
  style: __spreadProps(__spreadValues(__spreadValues({}, inputBase), linkStyle), { display: "block" })
6892
7829
  }
6893
- )) : /* @__PURE__ */ React58.createElement("div", null, name && /* @__PURE__ */ React58.createElement("p", { style: nameStyle }, name), title && /* @__PURE__ */ React58.createElement("p", { style: detailStyle }, title), company && /* @__PURE__ */ React58.createElement("p", { style: detailStyle }, company), address && /* @__PURE__ */ React58.createElement("p", { style: detailStyle }, address), (email || phone || website) && /* @__PURE__ */ React58.createElement("p", { style: __spreadProps(__spreadValues({}, detailStyle), { marginTop: 4 }) }, email && /* @__PURE__ */ React58.createElement("span", { style: linkStyle }, email), email && (phone || website) && /* @__PURE__ */ React58.createElement("span", { style: detailStyle }, " \xB7 "), phone && /* @__PURE__ */ React58.createElement("span", { style: linkStyle }, phone), phone && website && /* @__PURE__ */ React58.createElement("span", { style: detailStyle }, " \xB7 "), website && /* @__PURE__ */ React58.createElement("span", { style: linkStyle }, website)), !name && !title && !company && !email && !phone && !website && /* @__PURE__ */ React58.createElement("p", { style: detailStyle }, "Click to edit signature"));
7830
+ )) : /* @__PURE__ */ React62.createElement("div", null, name && /* @__PURE__ */ React62.createElement("p", { style: nameStyle }, name), title && /* @__PURE__ */ React62.createElement("p", { style: detailStyle }, title), company && /* @__PURE__ */ React62.createElement("p", { style: detailStyle }, company), address && /* @__PURE__ */ React62.createElement("p", { style: detailStyle }, address), (email || phone || website) && /* @__PURE__ */ React62.createElement("p", { style: __spreadProps(__spreadValues({}, detailStyle), { marginTop: 4 }) }, email && /* @__PURE__ */ React62.createElement("span", { style: linkStyle }, email), email && (phone || website) && /* @__PURE__ */ React62.createElement("span", { style: detailStyle }, " \xB7 "), phone && /* @__PURE__ */ React62.createElement("span", { style: linkStyle }, phone), phone && website && /* @__PURE__ */ React62.createElement("span", { style: detailStyle }, " \xB7 "), website && /* @__PURE__ */ React62.createElement("span", { style: linkStyle }, website)), !name && !title && !company && !email && !phone && !website && /* @__PURE__ */ React62.createElement("p", { style: detailStyle }, "Click to edit signature"));
6894
7831
  if (layout === "vertical") {
6895
- return /* @__PURE__ */ React58.createElement("div", { style: wrapperStyle }, greetingElement, imageElement && /* @__PURE__ */ React58.createElement("div", { style: { marginBottom: 12 } }, imageElement), textContent);
7832
+ return /* @__PURE__ */ React62.createElement("div", { style: wrapperStyle }, greetingElement, imageElement && /* @__PURE__ */ React62.createElement("div", { style: { marginBottom: 12 } }, imageElement), textContent);
6896
7833
  }
6897
- return /* @__PURE__ */ React58.createElement("div", { style: wrapperStyle }, greetingElement, /* @__PURE__ */ React58.createElement("table", { cellPadding: "0", cellSpacing: "0", border: 0, role: "presentation" }, /* @__PURE__ */ React58.createElement("tbody", null, /* @__PURE__ */ React58.createElement("tr", null, imageElement && /* @__PURE__ */ React58.createElement("td", { style: { verticalAlign: "middle", paddingRight: 16 } }, imageElement), /* @__PURE__ */ React58.createElement("td", { style: { verticalAlign: "middle" } }, textContent)))));
7834
+ return /* @__PURE__ */ React62.createElement("div", { style: wrapperStyle }, greetingElement, /* @__PURE__ */ React62.createElement("table", { cellPadding: "0", cellSpacing: "0", border: 0, role: "presentation" }, /* @__PURE__ */ React62.createElement("tbody", null, /* @__PURE__ */ React62.createElement("tr", null, imageElement && /* @__PURE__ */ React62.createElement("td", { style: { verticalAlign: "middle", paddingRight: 16 } }, imageElement), /* @__PURE__ */ React62.createElement("td", { style: { verticalAlign: "middle" } }, textContent)))));
6898
7835
  }
6899
7836
  function getFontFamily10(fontFamily) {
6900
7837
  switch (fontFamily) {
@@ -7038,7 +7975,7 @@ function TextEditor({ style, props }) {
7038
7975
  if (textareaRef.current) adjustTextareaHeight(textareaRef.current);
7039
7976
  }, [localText, isSelected]);
7040
7977
  if (isSelected) {
7041
- return /* @__PURE__ */ React58.createElement(React58.Fragment, null, /* @__PURE__ */ React58.createElement(
7978
+ return /* @__PURE__ */ React62.createElement(React62.Fragment, null, /* @__PURE__ */ React62.createElement(
7042
7979
  "textarea",
7043
7980
  {
7044
7981
  ref: textareaRef,
@@ -7056,10 +7993,10 @@ function TextEditor({ style, props }) {
7056
7993
  rows: 1,
7057
7994
  onInput: (e) => adjustTextareaHeight(e.target)
7058
7995
  }
7059
- ), /* @__PURE__ */ React58.createElement(InlineFormattingToolbar, __spreadValues({ anchorEl: textareaRef.current }, toolbarProps)));
7996
+ ), /* @__PURE__ */ React62.createElement(InlineFormattingToolbar, __spreadValues({ anchorEl: textareaRef.current }, toolbarProps)));
7060
7997
  }
7061
7998
  if (isMarkdown) {
7062
- return /* @__PURE__ */ React58.createElement(
7999
+ return /* @__PURE__ */ React62.createElement(
7063
8000
  "div",
7064
8001
  {
7065
8002
  ref: displayRef,
@@ -7068,34 +8005,34 @@ function TextEditor({ style, props }) {
7068
8005
  }
7069
8006
  );
7070
8007
  }
7071
- return /* @__PURE__ */ React58.createElement("div", { ref: displayRef, style: wStyle }, textContent);
8008
+ return /* @__PURE__ */ React62.createElement("div", { ref: displayRef, style: wStyle }, textContent);
7072
8009
  }
7073
8010
 
7074
8011
  // src/editor/core.tsx
7075
8012
  var EDITOR_DICTIONARY = buildBlockConfigurationDictionary({
7076
8013
  Avatar: {
7077
8014
  schema: AvatarPropsSchema,
7078
- Component: (props) => /* @__PURE__ */ React58.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React58.createElement(avatar_default, __spreadValues({}, props)))
8015
+ Component: (props) => /* @__PURE__ */ React62.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React62.createElement(avatar_default, __spreadValues({}, props)))
7079
8016
  },
7080
8017
  Button: {
7081
8018
  schema: ButtonPropsSchema,
7082
- Component: (props) => /* @__PURE__ */ React58.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React58.createElement(ButtonEditor, __spreadValues({}, props)))
8019
+ Component: (props) => /* @__PURE__ */ React62.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React62.createElement(ButtonEditor, __spreadValues({}, props)))
7083
8020
  },
7084
8021
  Container: {
7085
8022
  schema: container_props_schema_default,
7086
- Component: (props) => /* @__PURE__ */ React58.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React58.createElement(ContainerEditor, __spreadValues({}, props)))
8023
+ Component: (props) => /* @__PURE__ */ React62.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React62.createElement(ContainerEditor, __spreadValues({}, props)))
7087
8024
  },
7088
8025
  ColumnsContainer: {
7089
8026
  schema: columns_container_props_schema_default2,
7090
- Component: (props) => /* @__PURE__ */ React58.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React58.createElement(ColumnsContainerEditor, __spreadValues({}, props)))
8027
+ Component: (props) => /* @__PURE__ */ React62.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React62.createElement(ColumnsContainerEditor, __spreadValues({}, props)))
7091
8028
  },
7092
8029
  Heading: {
7093
8030
  schema: HeadingPropsSchema,
7094
- Component: (props) => /* @__PURE__ */ React58.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React58.createElement(HeadingEditor, __spreadValues({}, props)))
8031
+ Component: (props) => /* @__PURE__ */ React62.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React62.createElement(HeadingEditor, __spreadValues({}, props)))
7095
8032
  },
7096
8033
  Html: {
7097
8034
  schema: HtmlPropsSchema,
7098
- Component: (props) => /* @__PURE__ */ React58.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React58.createElement(HtmlEditor, __spreadValues({}, props)))
8035
+ Component: (props) => /* @__PURE__ */ React62.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React62.createElement(HtmlEditor, __spreadValues({}, props)))
7099
8036
  },
7100
8037
  Image: {
7101
8038
  schema: ImagePropsSchema,
@@ -7107,28 +8044,28 @@ var EDITOR_DICTIONARY = buildBlockConfigurationDictionary({
7107
8044
  linkHref: null
7108
8045
  })
7109
8046
  });
7110
- return /* @__PURE__ */ React58.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React58.createElement(image_default, __spreadValues({}, props)));
8047
+ return /* @__PURE__ */ React62.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React62.createElement(image_default, __spreadValues({}, props)));
7111
8048
  }
7112
8049
  },
7113
8050
  Text: {
7114
8051
  schema: TextPropsSchema,
7115
- Component: (props) => /* @__PURE__ */ React58.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React58.createElement(TextEditor, __spreadValues({}, props)))
8052
+ Component: (props) => /* @__PURE__ */ React62.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React62.createElement(TextEditor, __spreadValues({}, props)))
7116
8053
  },
7117
8054
  EmailLayout: {
7118
8055
  schema: email_layout_props_schema_default,
7119
- Component: (p) => /* @__PURE__ */ React58.createElement(EmailLayoutEditor, __spreadValues({}, p))
8056
+ Component: (p) => /* @__PURE__ */ React62.createElement(EmailLayoutEditor, __spreadValues({}, p))
7120
8057
  },
7121
8058
  Spacer: {
7122
8059
  schema: SpacerPropsSchema,
7123
- Component: (props) => /* @__PURE__ */ React58.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React58.createElement(spacer_default, __spreadValues({}, props)))
8060
+ Component: (props) => /* @__PURE__ */ React62.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React62.createElement(spacer_default, __spreadValues({}, props)))
7124
8061
  },
7125
8062
  Divider: {
7126
8063
  schema: DividerPropsSchema,
7127
- Component: (props) => /* @__PURE__ */ React58.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React58.createElement(divider_default, __spreadValues({}, props)))
8064
+ Component: (props) => /* @__PURE__ */ React62.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React62.createElement(divider_default, __spreadValues({}, props)))
7128
8065
  },
7129
8066
  Signature: {
7130
8067
  schema: SignaturePropsSchema,
7131
- Component: (props) => /* @__PURE__ */ React58.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React58.createElement(SignatureEditor, __spreadValues({}, props)))
8068
+ Component: (props) => /* @__PURE__ */ React62.createElement(EditorBlockWrapper, null, /* @__PURE__ */ React62.createElement(SignatureEditor, __spreadValues({}, props)))
7132
8069
  }
7133
8070
  });
7134
8071
  var EditorBlock2 = buildBlockComponent(EDITOR_DICTIONARY);
@@ -7144,7 +8081,7 @@ function EditorBlock({ id }) {
7144
8081
  if (!block) {
7145
8082
  throw new Error("Could not find block");
7146
8083
  }
7147
- return /* @__PURE__ */ React58.createElement(EditorBlockContext.Provider, { value: id }, /* @__PURE__ */ React58.createElement(EditorBlock2, __spreadValues({}, block)));
8084
+ return /* @__PURE__ */ React62.createElement(EditorBlockContext.Provider, { value: id }, /* @__PURE__ */ React62.createElement(EditorBlock2, __spreadValues({}, block)));
7148
8085
  }
7149
8086
  function ToggleInspectorPanelButton() {
7150
8087
  const inspectorDrawerOpen = useInspectorDrawerOpen();
@@ -7152,20 +8089,20 @@ function ToggleInspectorPanelButton() {
7152
8089
  toggleInspectorDrawerOpen();
7153
8090
  };
7154
8091
  if (inspectorDrawerOpen) {
7155
- return /* @__PURE__ */ React58.createElement(IconButton, { onClick: handleClick }, /* @__PURE__ */ React58.createElement(LastPageOutlined, { fontSize: "small" }));
8092
+ return /* @__PURE__ */ React62.createElement(IconButton, { onClick: handleClick }, /* @__PURE__ */ React62.createElement(LastPageOutlined, { fontSize: "small" }));
7156
8093
  }
7157
- return /* @__PURE__ */ React58.createElement(IconButton, { onClick: handleClick }, /* @__PURE__ */ React58.createElement(AppRegistrationOutlined, { fontSize: "small" }));
8094
+ return /* @__PURE__ */ React62.createElement(IconButton, { onClick: handleClick }, /* @__PURE__ */ React62.createElement(AppRegistrationOutlined, { fontSize: "small" }));
7158
8095
  }
7159
8096
  function useIcon() {
7160
8097
  const samplesDrawerOpen = useSamplesDrawerOpen();
7161
8098
  if (samplesDrawerOpen) {
7162
- return /* @__PURE__ */ React58.createElement(FirstPageOutlined, { fontSize: "small" });
8099
+ return /* @__PURE__ */ React62.createElement(FirstPageOutlined, { fontSize: "small" });
7163
8100
  }
7164
- return /* @__PURE__ */ React58.createElement(MenuOutlined, { fontSize: "small" });
8101
+ return /* @__PURE__ */ React62.createElement(MenuOutlined, { fontSize: "small" });
7165
8102
  }
7166
8103
  function ToggleSamplesPanelButton() {
7167
8104
  const icon = useIcon();
7168
- return /* @__PURE__ */ React58.createElement(IconButton, { onClick: toggleSamplesDrawerOpen }, icon);
8105
+ return /* @__PURE__ */ React62.createElement(IconButton, { onClick: toggleSamplesDrawerOpen }, icon);
7169
8106
  }
7170
8107
  function formatHtml(html2, spaces = 2) {
7171
8108
  try {
@@ -7227,7 +8164,7 @@ function HighlightedCodePanel({ type, value }) {
7227
8164
  if (code === null) {
7228
8165
  return null;
7229
8166
  }
7230
- return /* @__PURE__ */ React58.createElement(
8167
+ return /* @__PURE__ */ React62.createElement(
7231
8168
  "pre",
7232
8169
  {
7233
8170
  style: {
@@ -7253,17 +8190,17 @@ function HighlightedCodePanel({ type, value }) {
7253
8190
  function HtmlPanel() {
7254
8191
  const document2 = useDocument();
7255
8192
  const code = useMemo(() => renderToStaticMarkup(document2, { rootBlockId: "root" }), [document2]);
7256
- return /* @__PURE__ */ React58.createElement(HighlightedCodePanel, { type: "html", value: code });
8193
+ return /* @__PURE__ */ React62.createElement(HighlightedCodePanel, { type: "html", value: code });
7257
8194
  }
7258
8195
  function JsonPanel() {
7259
8196
  const document2 = useDocument();
7260
8197
  const code = useMemo(() => JSON.stringify(document2, null, " "), [document2]);
7261
- return /* @__PURE__ */ React58.createElement(HighlightedCodePanel, { type: "json", value: code });
8198
+ return /* @__PURE__ */ React62.createElement(HighlightedCodePanel, { type: "json", value: code });
7262
8199
  }
7263
8200
  function TextPanel() {
7264
8201
  const document2 = useDocument();
7265
8202
  const text = useMemo(() => renderToText(document2, { rootBlockId: "root" }), [document2]);
7266
- return /* @__PURE__ */ React58.createElement(
8203
+ return /* @__PURE__ */ React62.createElement(
7267
8204
  "pre",
7268
8205
  {
7269
8206
  style: {
@@ -7299,185 +8236,184 @@ function MainTabsGroup() {
7299
8236
  setSelectedMainTab("editor");
7300
8237
  }
7301
8238
  };
7302
- return /* @__PURE__ */ React58.createElement(Tabs, { value: selectedMainTab, onChange: handleChange }, /* @__PURE__ */ React58.createElement(
8239
+ return /* @__PURE__ */ React62.createElement(Tabs, { value: selectedMainTab, onChange: handleChange }, /* @__PURE__ */ React62.createElement(
7303
8240
  Tab,
7304
8241
  {
7305
8242
  value: "editor",
7306
- label: /* @__PURE__ */ React58.createElement(Tooltip, { title: "Edit" }, /* @__PURE__ */ React58.createElement(EditOutlined, { fontSize: "small" }))
8243
+ label: /* @__PURE__ */ React62.createElement(Tooltip, { title: "Edit" }, /* @__PURE__ */ React62.createElement(EditOutlined, { fontSize: "small" }))
7307
8244
  }
7308
- ), /* @__PURE__ */ React58.createElement(
8245
+ ), /* @__PURE__ */ React62.createElement(
7309
8246
  Tab,
7310
8247
  {
7311
8248
  value: "preview",
7312
- label: /* @__PURE__ */ React58.createElement(Tooltip, { title: "Preview" }, /* @__PURE__ */ React58.createElement(PreviewOutlined, { fontSize: "small" }))
8249
+ label: /* @__PURE__ */ React62.createElement(Tooltip, { title: "Preview" }, /* @__PURE__ */ React62.createElement(PreviewOutlined, { fontSize: "small" }))
7313
8250
  }
7314
- ), /* @__PURE__ */ React58.createElement(
8251
+ ), /* @__PURE__ */ React62.createElement(
7315
8252
  Tab,
7316
8253
  {
7317
8254
  value: "html",
7318
- label: /* @__PURE__ */ React58.createElement(Tooltip, { title: "HTML output" }, /* @__PURE__ */ React58.createElement(CodeOutlined, { fontSize: "small" }))
8255
+ label: /* @__PURE__ */ React62.createElement(Tooltip, { title: "HTML output" }, /* @__PURE__ */ React62.createElement(CodeOutlined, { fontSize: "small" }))
7319
8256
  }
7320
- ), /* @__PURE__ */ React58.createElement(
8257
+ ), /* @__PURE__ */ React62.createElement(
7321
8258
  Tab,
7322
8259
  {
7323
8260
  value: "text",
7324
- label: /* @__PURE__ */ React58.createElement(Tooltip, { title: "Plain text output" }, /* @__PURE__ */ React58.createElement(SubjectOutlined, { fontSize: "small" }))
8261
+ label: /* @__PURE__ */ React62.createElement(Tooltip, { title: "Plain text output" }, /* @__PURE__ */ React62.createElement(SubjectOutlined, { fontSize: "small" }))
7325
8262
  }
7326
- ), /* @__PURE__ */ React58.createElement(
8263
+ ), /* @__PURE__ */ React62.createElement(
7327
8264
  Tab,
7328
8265
  {
7329
8266
  value: "json",
7330
- label: /* @__PURE__ */ React58.createElement(Tooltip, { title: "JSON output" }, /* @__PURE__ */ React58.createElement(DataObjectOutlined, { fontSize: "small" }))
8267
+ label: /* @__PURE__ */ React62.createElement(Tooltip, { title: "JSON output" }, /* @__PURE__ */ React62.createElement(DataObjectOutlined, { fontSize: "small" }))
7331
8268
  }
7332
8269
  ));
7333
8270
  }
7334
- function SaveButton({ loadTemplates, saveAs }) {
7335
- const { saveTemplate, currentTemplateId, currentTemplateKind, setCurrentTemplate } = useEmailEditor();
8271
+ function SaveBar({ loadTemplates, saveAs }) {
8272
+ const {
8273
+ saveTemplate,
8274
+ currentTemplateId,
8275
+ currentTemplateName,
8276
+ currentTemplateKind,
8277
+ setCurrentTemplate,
8278
+ loadTemplate: ctxLoadTemplate
8279
+ } = useEmailEditor();
7336
8280
  const { showMessage } = useSnackbar();
7337
- const [saveDialogOpen, setSaveDialogOpen] = useState(false);
7338
8281
  const document2 = useDocument();
8282
+ const [dialogMode, setDialogMode] = useState(null);
8283
+ const [nameError, setNameError] = useState(null);
8284
+ const hasOpenRow = Boolean(currentTemplateId);
7339
8285
  const isSample = currentTemplateKind === "sample";
7340
- const handleSave = () => __async(null, null, function* () {
8286
+ const primaryLabel = hasOpenRow ? "Save" : "Save as new\u2026";
8287
+ const handlePrimary = () => __async(null, null, function* () {
7341
8288
  try {
7342
- if (!currentTemplateId || isSample) {
7343
- setSaveDialogOpen(true);
8289
+ if (!hasOpenRow) {
8290
+ setNameError(null);
8291
+ setDialogMode("save-as");
7344
8292
  return;
7345
8293
  }
7346
8294
  saveTemplate();
7347
- showMessage("Template saved successfully!");
7348
- if (loadTemplates) {
7349
- yield loadTemplates();
7350
- }
7351
- } catch (error) {
7352
- console.error("Error saving template:", error);
7353
- showMessage("Error saving template");
8295
+ showMessage(isSample ? "Sample saved" : "Template saved");
8296
+ if (loadTemplates) yield loadTemplates();
8297
+ } catch (e) {
8298
+ console.error("Error saving:", e);
8299
+ showMessage("Error saving");
7354
8300
  }
7355
8301
  });
7356
- const handleSaveAs = (templateName) => __async(null, null, function* () {
8302
+ const handleSaveAs = (name) => __async(null, null, function* () {
8303
+ if (!saveAs) return false;
7357
8304
  try {
7358
- if (saveAs) {
7359
- const { id: templateId, slug } = yield saveAs(templateName, buildSavePayload(document2));
7360
- setCurrentTemplate(templateId, slug, "template");
7361
- if (loadTemplates) {
7362
- yield loadTemplates();
7363
- }
7364
- showMessage("Template saved successfully!");
7365
- setSaveDialogOpen(false);
7366
- window.location.hash = `#template/${templateId}`;
7367
- return true;
7368
- }
7369
- return false;
7370
- } catch (error) {
7371
- console.error("Error saving template:", error);
7372
- showMessage("Error saving template");
8305
+ const starterContent = dialogMode === "new-blank" ? empty_email_message_default : document2;
8306
+ const { id, slug } = yield saveAs(name, buildSavePayload(starterContent));
8307
+ resetDocument(starterContent);
8308
+ setCurrentTemplate(id, slug, "template");
8309
+ ctxLoadTemplate(starterContent, id, slug, "template");
8310
+ if (loadTemplates) yield loadTemplates();
8311
+ showMessage(dialogMode === "new-blank" ? "New template created" : "Template saved");
8312
+ window.location.hash = `#template/${id}`;
8313
+ return true;
8314
+ } catch (e) {
8315
+ console.error("Error in saveAs:", e);
8316
+ showMessage("Error saving");
7373
8317
  return false;
7374
8318
  }
7375
8319
  });
7376
- return /* @__PURE__ */ React58.createElement(React58.Fragment, null, /* @__PURE__ */ React58.createElement(
7377
- IconButton,
8320
+ return /* @__PURE__ */ React62.createElement(React62.Fragment, null, /* @__PURE__ */ React62.createElement(
8321
+ Box,
7378
8322
  {
7379
- onClick: handleSave,
7380
8323
  sx: {
7381
- backgroundColor: "grey.100",
7382
- "&:hover": {
7383
- backgroundColor: "grey.200"
7384
- }
8324
+ position: "sticky",
8325
+ bottom: 0,
8326
+ display: "flex",
8327
+ justifyContent: "center",
8328
+ pointerEvents: "none",
8329
+ zIndex: 2,
8330
+ pb: 3
7385
8331
  }
7386
8332
  },
7387
- /* @__PURE__ */ React58.createElement(Tooltip, { title: isSample ? "Save as new template" : "Save template" }, /* @__PURE__ */ React58.createElement(SaveOutlined, { fontSize: "small" }))
7388
- ), /* @__PURE__ */ React58.createElement(
7389
- SaveTemplateDialog,
7390
- {
7391
- open: saveDialogOpen,
7392
- onClose: () => setSaveDialogOpen(false),
7393
- onSave: handleSaveAs,
7394
- defaultName: isSample ? "New Template" : "New Template"
7395
- }
7396
- ));
7397
- }
7398
- function NewTemplateButton({ loadTemplates, saveAs }) {
7399
- const { setCurrentTemplate, loadTemplate } = useEmailEditor();
7400
- const { showMessage } = useSnackbar();
7401
- const [saveDialogOpen, setSaveDialogOpen] = useState(false);
7402
- const [templates, setTemplates] = useState([]);
7403
- const [nameError, setNameError] = useState(null);
7404
- const fetchTemplates = () => __async(null, null, function* () {
7405
- if (loadTemplates) {
7406
- try {
7407
- const result = yield loadTemplates();
7408
- setTemplates(result);
7409
- return result;
7410
- } catch (error) {
7411
- console.error("Error loading templates:", error);
7412
- }
7413
- }
7414
- return [];
7415
- });
7416
- const handleNewTemplate = () => __async(null, null, function* () {
7417
- yield fetchTemplates();
7418
- setNameError(null);
7419
- setSaveDialogOpen(true);
7420
- });
7421
- const validateTemplateName = (name) => {
7422
- const nameExists = templates.some(
7423
- (template) => template.slug.toLowerCase() === name.toLowerCase()
7424
- );
7425
- if (nameExists) {
7426
- setNameError("A template with this name already exists");
7427
- return false;
7428
- }
7429
- setNameError(null);
7430
- return true;
7431
- };
7432
- const handleNameChange = () => {
7433
- setNameError(null);
7434
- };
7435
- const handleCreateTemplate = (templateName) => __async(null, null, function* () {
7436
- if (!validateTemplateName(templateName)) {
7437
- return false;
7438
- }
7439
- try {
7440
- if (saveAs) {
7441
- const { id: templateId, slug } = yield saveAs(templateName, buildSavePayload(empty_email_message_default));
7442
- resetDocument(empty_email_message_default);
7443
- setCurrentTemplate(templateId, slug, "template");
7444
- loadTemplate(empty_email_message_default, templateId, slug, "template");
7445
- if (loadTemplates) {
7446
- yield loadTemplates();
7447
- }
7448
- showMessage("New template created!");
7449
- window.location.hash = `#template/${templateId}`;
7450
- return true;
7451
- }
7452
- } catch (error) {
7453
- console.error("Error creating template:", error);
7454
- showMessage("Error creating template");
7455
- }
7456
- return false;
7457
- });
7458
- return /* @__PURE__ */ React58.createElement(React58.Fragment, null, /* @__PURE__ */ React58.createElement(
7459
- IconButton,
7460
- {
7461
- onClick: handleNewTemplate,
7462
- sx: {
7463
- backgroundColor: "grey.100",
7464
- "&:hover": {
7465
- backgroundColor: "grey.200"
8333
+ /* @__PURE__ */ React62.createElement(
8334
+ Box,
8335
+ {
8336
+ sx: {
8337
+ pointerEvents: "auto",
8338
+ display: "inline-flex",
8339
+ alignItems: "center",
8340
+ gap: 1.25,
8341
+ px: 2,
8342
+ py: 1.25,
8343
+ backgroundColor: "background.paper",
8344
+ borderRadius: 999,
8345
+ boxShadow: "0 2px 6px rgba(33, 36, 67, 0.06), 0 16px 40px rgba(33, 36, 67, 0.14)"
7466
8346
  }
7467
- }
7468
- },
7469
- /* @__PURE__ */ React58.createElement(Tooltip, { title: "New template" }, /* @__PURE__ */ React58.createElement(Add, { fontSize: "small" }))
7470
- ), /* @__PURE__ */ React58.createElement(
8347
+ },
8348
+ hasOpenRow && currentTemplateName && /* @__PURE__ */ React62.createElement(
8349
+ Box,
8350
+ {
8351
+ sx: {
8352
+ pl: 1,
8353
+ pr: 1,
8354
+ fontSize: 14,
8355
+ color: "text.secondary",
8356
+ maxWidth: 220,
8357
+ whiteSpace: "nowrap",
8358
+ overflow: "hidden",
8359
+ textOverflow: "ellipsis"
8360
+ },
8361
+ title: currentTemplateName
8362
+ },
8363
+ isSample ? "Sample \xB7 " : "",
8364
+ /* @__PURE__ */ React62.createElement(Box, { component: "span", sx: { color: "text.primary", fontWeight: 600 } }, currentTemplateName)
8365
+ ),
8366
+ /* @__PURE__ */ React62.createElement(Tooltip, { title: hasOpenRow ? `Save changes${isSample ? " to this sample" : ""}` : "Save as a new template" }, /* @__PURE__ */ React62.createElement(
8367
+ Button$1,
8368
+ {
8369
+ variant: "contained",
8370
+ size: "large",
8371
+ startIcon: /* @__PURE__ */ React62.createElement(SaveOutlined, null),
8372
+ onClick: handlePrimary,
8373
+ sx: { borderRadius: 999, textTransform: "none", px: 2.5, fontSize: 15, fontWeight: 600 }
8374
+ },
8375
+ primaryLabel
8376
+ )),
8377
+ hasOpenRow && saveAs && /* @__PURE__ */ React62.createElement(Tooltip, { title: "Save as a new template" }, /* @__PURE__ */ React62.createElement(
8378
+ Button$1,
8379
+ {
8380
+ variant: "outlined",
8381
+ size: "large",
8382
+ startIcon: /* @__PURE__ */ React62.createElement(SaveAsOutlined, null),
8383
+ onClick: () => {
8384
+ setNameError(null);
8385
+ setDialogMode("save-as");
8386
+ },
8387
+ sx: { borderRadius: 999, textTransform: "none", px: 2, fontSize: 14 }
8388
+ },
8389
+ "Save as\u2026"
8390
+ )),
8391
+ saveAs && /* @__PURE__ */ React62.createElement(Tooltip, { title: "Start a fresh template" }, /* @__PURE__ */ React62.createElement(
8392
+ Button$1,
8393
+ {
8394
+ variant: "text",
8395
+ size: "large",
8396
+ startIcon: /* @__PURE__ */ React62.createElement(AddOutlined, null),
8397
+ onClick: () => {
8398
+ setNameError(null);
8399
+ setDialogMode("new-blank");
8400
+ },
8401
+ sx: { borderRadius: 999, textTransform: "none", px: 2, fontSize: 14, color: "text.secondary" }
8402
+ },
8403
+ "New"
8404
+ ))
8405
+ )
8406
+ ), /* @__PURE__ */ React62.createElement(
7471
8407
  SaveTemplateDialog,
7472
8408
  {
7473
- open: saveDialogOpen,
8409
+ open: dialogMode !== null,
7474
8410
  onClose: () => {
7475
- setSaveDialogOpen(false);
8411
+ setDialogMode(null);
7476
8412
  setNameError(null);
7477
8413
  },
7478
- onSave: handleCreateTemplate,
7479
- onNameChange: handleNameChange,
7480
- defaultName: "New Template",
8414
+ onSave: handleSaveAs,
8415
+ onNameChange: () => setNameError(null),
8416
+ defaultName: dialogMode === "new-blank" ? "New Template" : currentTemplateName ? `${currentTemplateName} (Copy)` : "New Template",
7481
8417
  error: nameError
7482
8418
  }
7483
8419
  ));
@@ -7505,7 +8441,7 @@ function SubjectInput() {
7505
8441
  selectionEnd: (_b = target.selectionEnd) != null ? _b : target.value.length
7506
8442
  });
7507
8443
  };
7508
- return /* @__PURE__ */ React58.createElement(
8444
+ return /* @__PURE__ */ React62.createElement(
7509
8445
  Box,
7510
8446
  {
7511
8447
  sx: {
@@ -7522,8 +8458,8 @@ function SubjectInput() {
7522
8458
  gap: 1.5
7523
8459
  }
7524
8460
  },
7525
- /* @__PURE__ */ React58.createElement(Box, { sx: { color: "text.secondary", fontSize: 13, fontWeight: 600, minWidth: 56 } }, "Subject"),
7526
- /* @__PURE__ */ React58.createElement(
8461
+ /* @__PURE__ */ React62.createElement(Box, { sx: { color: "text.secondary", fontSize: 13, fontWeight: 600, minWidth: 56 } }, "Subject"),
8462
+ /* @__PURE__ */ React62.createElement(
7527
8463
  InputBase,
7528
8464
  {
7529
8465
  fullWidth: true,
@@ -7549,7 +8485,7 @@ function SubjectPreview() {
7549
8485
  if (!subject) return null;
7550
8486
  const samples = buildSampleValueMap((_b = data.variables) != null ? _b : []);
7551
8487
  const rendered = substituteSampleValues(subject, samples);
7552
- return /* @__PURE__ */ React58.createElement(
8488
+ return /* @__PURE__ */ React62.createElement(
7553
8489
  Box,
7554
8490
  {
7555
8491
  sx: {
@@ -7566,8 +8502,8 @@ function SubjectPreview() {
7566
8502
  gap: 1.5
7567
8503
  }
7568
8504
  },
7569
- /* @__PURE__ */ React58.createElement(Box, { sx: { color: "text.secondary", fontSize: 13, fontWeight: 600, minWidth: 56 } }, "Subject"),
7570
- /* @__PURE__ */ React58.createElement(Box, { sx: { fontSize: 14 } }, rendered)
8505
+ /* @__PURE__ */ React62.createElement(Box, { sx: { color: "text.secondary", fontSize: 13, fontWeight: 600, minWidth: 56 } }, "Subject"),
8506
+ /* @__PURE__ */ React62.createElement(Box, { sx: { fontSize: 14 } }, rendered)
7571
8507
  );
7572
8508
  }
7573
8509
  function generateId3() {
@@ -7640,7 +8576,7 @@ function ImageDropPasteHandler({ enabled, children }) {
7640
8576
  window.addEventListener("paste", handlePaste);
7641
8577
  return () => window.removeEventListener("paste", handlePaste);
7642
8578
  }, [active, uploadImage]);
7643
- if (!active) return /* @__PURE__ */ React58.createElement(React58.Fragment, null, children);
8579
+ if (!active) return /* @__PURE__ */ React62.createElement(React62.Fragment, null, children);
7644
8580
  const onDragEnter = (e) => {
7645
8581
  var _a, _b;
7646
8582
  if (!Array.from((_b = (_a = e.dataTransfer) == null ? void 0 : _a.items) != null ? _b : []).some((i) => i.kind === "file")) return;
@@ -7673,7 +8609,7 @@ function ImageDropPasteHandler({ enabled, children }) {
7673
8609
  setUploading(false);
7674
8610
  }
7675
8611
  });
7676
- return /* @__PURE__ */ React58.createElement(
8612
+ return /* @__PURE__ */ React62.createElement(
7677
8613
  Box,
7678
8614
  {
7679
8615
  ref: wrapperRef,
@@ -7684,7 +8620,7 @@ function ImageDropPasteHandler({ enabled, children }) {
7684
8620
  sx: { position: "relative" }
7685
8621
  },
7686
8622
  children,
7687
- (dragging || uploading) && /* @__PURE__ */ React58.createElement(
8623
+ (dragging || uploading) && /* @__PURE__ */ React62.createElement(
7688
8624
  Box,
7689
8625
  {
7690
8626
  sx: {
@@ -7703,17 +8639,20 @@ function ImageDropPasteHandler({ enabled, children }) {
7703
8639
  zIndex: 10
7704
8640
  }
7705
8641
  },
7706
- /* @__PURE__ */ React58.createElement(Box, { sx: { display: "flex", alignItems: "center", gap: 1, fontWeight: 600, fontSize: 14 } }, /* @__PURE__ */ React58.createElement(CloudUploadOutlined, null), uploading ? "Uploading\u2026" : "Drop image to insert")
8642
+ /* @__PURE__ */ React62.createElement(Box, { sx: { display: "flex", alignItems: "center", gap: 1, fontWeight: 600, fontSize: 14 } }, /* @__PURE__ */ React62.createElement(CloudUploadOutlined, null), uploading ? "Uploading\u2026" : "Drop image to insert")
7707
8643
  )
7708
8644
  );
7709
8645
  }
7710
8646
 
7711
8647
  // src/app/email-canvas/index.tsx
8648
+ var WORKSPACE_SOLID = "#e7e8ec";
8649
+ var WORKSPACE_CHECKERBOARD = "repeating-conic-gradient(#eceef2 0% 25%, #dfe1e6 0% 50%) 50% / 24px 24px";
7712
8650
  function TemplatePanel2({ loadTemplates, saveAs, samplesDrawerEnabled = true }) {
7713
8651
  const document2 = useDocument();
7714
8652
  const selectedMainTab = useSelectedMainTab();
7715
8653
  const selectedScreenSize = useSelectedScreenSize();
7716
8654
  const persistenceEnabled = usePersistenceEnabled();
8655
+ const workspaceBackground = useWorkspaceBackground();
7717
8656
  let mainBoxSx = {
7718
8657
  height: "100%"
7719
8658
  };
@@ -7740,7 +8679,7 @@ function TemplatePanel2({ loadTemplates, saveAs, samplesDrawerEnabled = true })
7740
8679
  var _a;
7741
8680
  switch (selectedMainTab) {
7742
8681
  case "editor":
7743
- return /* @__PURE__ */ React58.createElement(Box, { sx: mainBoxSx }, /* @__PURE__ */ React58.createElement(EditorBlock, { id: "root" }));
8682
+ return /* @__PURE__ */ React62.createElement(Box, { sx: mainBoxSx }, /* @__PURE__ */ React62.createElement(EditorBlock, { id: "root" }));
7744
8683
  case "preview": {
7745
8684
  const rootBlock = document2.root;
7746
8685
  const layoutData = rootBlock && rootBlock.type === "EmailLayout" ? rootBlock.data : void 0;
@@ -7748,18 +8687,18 @@ function TemplatePanel2({ loadTemplates, saveAs, samplesDrawerEnabled = true })
7748
8687
  (_a = layoutData == null ? void 0 : layoutData.variables) != null ? _a : []
7749
8688
  );
7750
8689
  const previewDoc = applySampleValuesToDocument(document2, samples);
7751
- return /* @__PURE__ */ React58.createElement(Box, { sx: mainBoxSx }, /* @__PURE__ */ React58.createElement(Reader, { document: previewDoc, rootBlockId: "root" }));
8690
+ return /* @__PURE__ */ React62.createElement(Box, { sx: mainBoxSx }, /* @__PURE__ */ React62.createElement(Reader, { document: previewDoc, rootBlockId: "root" }));
7752
8691
  }
7753
8692
  case "html":
7754
- return /* @__PURE__ */ React58.createElement(HtmlPanel, null);
8693
+ return /* @__PURE__ */ React62.createElement(HtmlPanel, null);
7755
8694
  case "text":
7756
- return /* @__PURE__ */ React58.createElement(TextPanel, null);
8695
+ return /* @__PURE__ */ React62.createElement(TextPanel, null);
7757
8696
  case "json":
7758
- return /* @__PURE__ */ React58.createElement(JsonPanel, null);
8697
+ return /* @__PURE__ */ React62.createElement(JsonPanel, null);
7759
8698
  }
7760
8699
  };
7761
8700
  const showSaveButtons = persistenceEnabled;
7762
- return /* @__PURE__ */ React58.createElement(React58.Fragment, null, /* @__PURE__ */ React58.createElement(
8701
+ return /* @__PURE__ */ React62.createElement(React62.Fragment, null, /* @__PURE__ */ React62.createElement(
7763
8702
  Stack,
7764
8703
  {
7765
8704
  sx: {
@@ -7776,13 +8715,28 @@ function TemplatePanel2({ loadTemplates, saveAs, samplesDrawerEnabled = true })
7776
8715
  justifyContent: "space-between",
7777
8716
  alignItems: "center"
7778
8717
  },
7779
- samplesDrawerEnabled && /* @__PURE__ */ React58.createElement(ToggleSamplesPanelButton, null),
7780
- /* @__PURE__ */ React58.createElement(Stack, { px: 2, direction: "row", gap: 2, width: "100%", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React58.createElement(Stack, { direction: "row", spacing: 2 }, /* @__PURE__ */ React58.createElement(MainTabsGroup, null)), /* @__PURE__ */ React58.createElement(Stack, { direction: "row", spacing: 2 }, /* @__PURE__ */ React58.createElement(ToggleButtonGroup, { value: selectedScreenSize, exclusive: true, size: "small", onChange: handleScreenSizeChange }, /* @__PURE__ */ React58.createElement(ToggleButton, { value: "desktop" }, /* @__PURE__ */ React58.createElement(Tooltip, { title: "Desktop view" }, /* @__PURE__ */ React58.createElement(MonitorOutlined, { fontSize: "small" }))), /* @__PURE__ */ React58.createElement(ToggleButton, { value: "mobile" }, /* @__PURE__ */ React58.createElement(Tooltip, { title: "Mobile view" }, /* @__PURE__ */ React58.createElement(PhoneIphoneOutlined, { fontSize: "small" })))), showSaveButtons && /* @__PURE__ */ React58.createElement(React58.Fragment, null, /* @__PURE__ */ React58.createElement(NewTemplateButton, { loadTemplates, saveAs }), /* @__PURE__ */ React58.createElement(SaveButton, { loadTemplates, saveAs })))),
7781
- /* @__PURE__ */ React58.createElement(ToggleInspectorPanelButton, null)
7782
- ), selectedMainTab === "editor" && /* @__PURE__ */ React58.createElement(SubjectInput, null), selectedMainTab === "preview" && /* @__PURE__ */ React58.createElement(SubjectPreview, null), /* @__PURE__ */ React58.createElement(ImageDropPasteHandler, { enabled: selectedMainTab === "editor" }, /* @__PURE__ */ React58.createElement(Box, { sx: {
7783
- paddingBottom: "50px",
7784
- minWidth: 370
7785
- } }, renderMainPanel())));
8718
+ samplesDrawerEnabled && /* @__PURE__ */ React62.createElement(ToggleSamplesPanelButton, null),
8719
+ /* @__PURE__ */ React62.createElement(Stack, { px: 2, direction: "row", gap: 2, width: "100%", justifyContent: "space-between", alignItems: "center" }, /* @__PURE__ */ React62.createElement(Stack, { direction: "row", spacing: 2 }, /* @__PURE__ */ React62.createElement(MainTabsGroup, null)), /* @__PURE__ */ React62.createElement(Stack, { direction: "row", spacing: 2 }, /* @__PURE__ */ React62.createElement(ToggleButtonGroup, { value: selectedScreenSize, exclusive: true, size: "small", onChange: handleScreenSizeChange }, /* @__PURE__ */ React62.createElement(ToggleButton, { value: "desktop" }, /* @__PURE__ */ React62.createElement(Tooltip, { title: "Desktop view" }, /* @__PURE__ */ React62.createElement(MonitorOutlined, { fontSize: "small" }))), /* @__PURE__ */ React62.createElement(ToggleButton, { value: "mobile" }, /* @__PURE__ */ React62.createElement(Tooltip, { title: "Mobile view" }, /* @__PURE__ */ React62.createElement(PhoneIphoneOutlined, { fontSize: "small" })))))),
8720
+ /* @__PURE__ */ React62.createElement(ToggleInspectorPanelButton, null)
8721
+ ), selectedMainTab === "editor" && /* @__PURE__ */ React62.createElement(SubjectInput, null), selectedMainTab === "preview" && /* @__PURE__ */ React62.createElement(SubjectPreview, null), /* @__PURE__ */ React62.createElement(ImageDropPasteHandler, { enabled: selectedMainTab === "editor" }, /* @__PURE__ */ React62.createElement(
8722
+ Box,
8723
+ {
8724
+ sx: {
8725
+ flexGrow: 1,
8726
+ display: "flex",
8727
+ flexDirection: "column",
8728
+ paddingBottom: "16px",
8729
+ minWidth: 370,
8730
+ // Fills to the bottom of the viewport in editor mode so the
8731
+ // workspace gray doesn't end midway under a short email.
8732
+ // 49px toolbar + 49px subject bar = 98px fixed chrome above.
8733
+ minHeight: selectedMainTab === "editor" ? "calc(100vh - 98px)" : void 0,
8734
+ background: selectedMainTab === "editor" ? workspaceBackground === "checkerboard" ? WORKSPACE_CHECKERBOARD : WORKSPACE_SOLID : void 0
8735
+ }
8736
+ },
8737
+ /* @__PURE__ */ React62.createElement(Box, { sx: { flexGrow: 1 } }, renderMainPanel()),
8738
+ showSaveButtons && selectedMainTab === "editor" && /* @__PURE__ */ React62.createElement(SaveBar, { loadTemplates, saveAs })
8739
+ )));
7786
8740
  }
7787
8741
 
7788
8742
  // src/app/index.tsx
@@ -7863,7 +8817,7 @@ var EmailEditorInternal = forwardRef((props, ref) => {
7863
8817
  return getDocument();
7864
8818
  }
7865
8819
  }));
7866
- return /* @__PURE__ */ React58.createElement(Stack, { position: "relative", id: "drawer-container", sx: { minHeight } }, /* @__PURE__ */ React58.createElement(
8820
+ return /* @__PURE__ */ React62.createElement(Stack, { position: "relative", id: "drawer-container", sx: { minHeight } }, /* @__PURE__ */ React62.createElement(
7867
8821
  InspectorDrawer,
7868
8822
  {
7869
8823
  enterDuration: drawerEnterDuration,
@@ -7871,7 +8825,7 @@ var EmailEditorInternal = forwardRef((props, ref) => {
7871
8825
  deleteTemplate,
7872
8826
  copyTemplate
7873
8827
  }
7874
- ), /* @__PURE__ */ React58.createElement(
8828
+ ), /* @__PURE__ */ React62.createElement(
7875
8829
  SamplesDrawer,
7876
8830
  {
7877
8831
  enterDuration: drawerEnterDuration,
@@ -7887,7 +8841,7 @@ var EmailEditorInternal = forwardRef((props, ref) => {
7887
8841
  setTemplateKind,
7888
8842
  saveAs
7889
8843
  }
7890
- ), /* @__PURE__ */ React58.createElement(
8844
+ ), /* @__PURE__ */ React62.createElement(
7891
8845
  Stack,
7892
8846
  {
7893
8847
  sx: {
@@ -7896,7 +8850,7 @@ var EmailEditorInternal = forwardRef((props, ref) => {
7896
8850
  transition: [marginLeftTransition, marginRightTransition].join(", ")
7897
8851
  }
7898
8852
  },
7899
- /* @__PURE__ */ React58.createElement(TemplatePanel2, { loadTemplates, saveAs, samplesDrawerEnabled })
8853
+ /* @__PURE__ */ React62.createElement(TemplatePanel2, { loadTemplates, saveAs, samplesDrawerEnabled })
7900
8854
  ));
7901
8855
  });
7902
8856
  var EmailEditor = forwardRef((props, ref) => {
@@ -7940,7 +8894,7 @@ var EmailEditor = forwardRef((props, ref) => {
7940
8894
  () => ({ uploadImage, loadImages, deleteImage }),
7941
8895
  [uploadImage, loadImages, deleteImage]
7942
8896
  );
7943
- return /* @__PURE__ */ React58.createElement(ThemeProvider, { theme: theme || theme_default }, /* @__PURE__ */ React58.createElement(CssBaseline, null), /* @__PURE__ */ React58.createElement("div", { style: { height: "100%", overflow: "auto" } }, /* @__PURE__ */ React58.createElement(SnackbarProvider, null, /* @__PURE__ */ React58.createElement(ImageCallbacksProvider, { callbacks: imageCallbacks }, /* @__PURE__ */ React58.createElement(
8897
+ return /* @__PURE__ */ React62.createElement(ThemeProvider, { theme: theme || theme_default }, /* @__PURE__ */ React62.createElement(CssBaseline, null), /* @__PURE__ */ React62.createElement("div", { style: { height: "100%", overflow: "auto" } }, /* @__PURE__ */ React62.createElement(SnackbarProvider, null, /* @__PURE__ */ React62.createElement(ImageCallbacksProvider, { callbacks: imageCallbacks }, /* @__PURE__ */ React62.createElement(
7944
8898
  EmailEditorProvider,
7945
8899
  {
7946
8900
  initialTemplate: resolvedTemplate,
@@ -7949,7 +8903,7 @@ var EmailEditor = forwardRef((props, ref) => {
7949
8903
  onSave,
7950
8904
  onChange
7951
8905
  },
7952
- /* @__PURE__ */ React58.createElement(
8906
+ /* @__PURE__ */ React62.createElement(
7953
8907
  EmailEditorInternal,
7954
8908
  {
7955
8909
  ref,
@@ -7973,6 +8927,6 @@ var EmailEditor = forwardRef((props, ref) => {
7973
8927
  EmailEditor.displayName = "EmailEditor";
7974
8928
  EmailEditorInternal.displayName = "EmailEditorInternal";
7975
8929
 
7976
- export { avatar_default as Avatar, AvatarProps, AvatarPropsDefaults, AvatarPropsSchema, BlockConfiguration, button_default as Button, ButtonProps, ButtonPropsDefaults, ButtonPropsSchema, columns_container_default as ColumnsContainer, ColumnsContainerProps, ColumnsContainerPropsSchema, ColumnsContainerReader, container_default as Container, ContainerProps, ContainerPropsSchema, ContainerReader, divider_default as Divider, DividerProps, DividerPropsDefaults, DividerPropsSchema, DocumentBlocksDictionary, EmailEditor, EmailEditorProvider, EmailLayoutPropsSchema, EmailLayoutReader, EmailMarkdown, heading_default as Heading, HeadingProps, HeadingPropsDefaults, HeadingPropsSchema, html_default as Html, HtmlProps, HtmlPropsSchema, image_default as Image, ImageProps, ImagePropsSchema, Reader, ReaderBlock, ReaderBlockSchema, ReaderDocumentSchema, signature_default as Signature, SignatureProps, SignaturePropsDefaults, SignaturePropsSchema, spacer_default as Spacer, SpacerProps, SpacerPropsDefaults, SpacerPropsSchema, TemplateVariableSchema, Text, TextProps, TextPropsDefaults, TextPropsSchema, buildBlockComponent, buildBlockConfigurationDictionary, buildBlockConfigurationSchema, htmlToEditorConfig, renderToStaticMarkup, renderToText, theme_default as theme, useEmailEditor };
8930
+ export { avatar_default as Avatar, AvatarProps, AvatarPropsDefaults, AvatarPropsSchema, BlockConfiguration, button_default as Button, ButtonProps, ButtonPropsDefaults, ButtonPropsSchema, columns_container_default as ColumnsContainer, ColumnsContainerProps, ColumnsContainerPropsSchema, ColumnsContainerReader, container_default as Container, ContainerProps, ContainerPropsSchema, ContainerReader, divider_default as Divider, DividerProps, DividerPropsDefaults, DividerPropsSchema, DocumentBlocksDictionary, EmailEditor, EmailEditorProvider, EmailLayoutPropsSchema, EmailLayoutReader, EmailMarkdown, heading_default as Heading, HeadingProps, HeadingPropsDefaults, HeadingPropsSchema, html_default as Html, HtmlProps, HtmlPropsSchema, image_default as Image, ImageProps, ImagePropsSchema, Reader, ReaderBlock, ReaderBlockSchema, ReaderDocumentSchema, signature_default as Signature, SignatureProps, SignaturePropsDefaults, SignaturePropsSchema, spacer_default as Spacer, SpacerProps, SpacerPropsDefaults, SpacerPropsSchema, TemplateVariableSchema, Text, TextProps, TextPropsDefaults, TextPropsSchema, buildBlockComponent, buildBlockConfigurationDictionary, buildBlockConfigurationSchema, editorHandlebars, evaluateHandlebars, htmlToEditorConfig, renderToStaticMarkup, renderToText, theme_default as theme, useEmailEditor };
7977
8931
  //# sourceMappingURL=index.js.map
7978
8932
  //# sourceMappingURL=index.js.map