@charisol/plexo-sdk 1.0.43 → 1.0.44

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.
@@ -1,6 +1,6 @@
1
- import { c as e, d as t, f as n, i as r, m as i, p as a, t as o, u as s } from "./iconSvgStatic-DubpApuZ.js";
1
+ import { c as e, d as t, f as n, g as r, i, m as a, p as o, t as s, u as c } from "./iconSvgStatic-DKNX8fUj.js";
2
2
  //#region src/utilities/compilerClient.ts
3
- var c = {
3
+ var l = {
4
4
  facebook: "facebook",
5
5
  x: "twitter",
6
6
  twitter: "twitter",
@@ -8,25 +8,25 @@ var c = {
8
8
  instagram: "instagram",
9
9
  youtube: "youtube",
10
10
  pinterest: "pinterest"
11
- }, l = /* @__PURE__ */ new Set([
11
+ }, u = /* @__PURE__ */ new Set([
12
12
  "selectable",
13
13
  "draggable",
14
14
  "duplicatable",
15
15
  "deletable",
16
16
  "hideable",
17
17
  "locked"
18
- ]), u = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), d = (e = {}) => Object.entries(e).filter(([, e]) => e != null && String(e).trim() !== "").map(([e, t]) => `${e.replace(/([A-Z])/g, "-$1").toLowerCase()}:${String(t)};`).join(""), f = (...e) => e.map((e) => String(e ?? "").trim()).filter(Boolean).join(" "), p = (e, t) => {
18
+ ]), d = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), f = (e = {}) => Object.entries(e).filter(([, e]) => e != null && String(e).trim() !== "").map(([e, t]) => `${e.replace(/([A-Z])/g, "-$1").toLowerCase()}:${String(t)};`).join(""), p = (...e) => e.map((e) => String(e ?? "").trim()).filter(Boolean).join(" "), m = (e, t) => {
19
19
  let n = { ...e.attributes || {} };
20
- if (t === "email") for (let e of l) delete n[e];
20
+ if (t === "email") for (let e of u) delete n[e];
21
21
  return n;
22
- }, m = (e, t) => {
23
- let n = p(e, t), r = d(e.style || {}), i = f(n.htmlClassNames, n.htmlClass, n.validationClass, n.validationClassName), a = u(n.name || n.fieldName || "field"), o = u(n.placeholder || ""), s = n.required ? " required" : "";
24
- if (t === "email") return `<mj-table><tr><td style="padding:10px 12px;border:1px solid #d1d5db;border-radius:6px;color:#64748b;${r}">${o || a}</td></tr></mj-table>`;
25
- let c = u(n.inputType || n.type || (e.type === "input" ? n.kind || "text" : e.type)), l = n.htmlId ? ` id="${u(n.htmlId)}"` : "", m = i ? ` class="${u(i)}"` : "";
26
- return e.type === "textarea" ? `<textarea${l}${m} name="${a}" placeholder="${o}" style="${r}"${s}>${u(n.value || "")}</textarea>` : e.type === "select" ? `<select${l}${m} name="${a}" style="${r}"${s}>${(n.options || []).map((e) => `<option value="${u(e.value)}">${u(e.label)}</option>`).join("")}</select>` : `<input${l}${m} type="${c}" name="${a}" placeholder="${o}" value="${u(n.value || "")}" style="${r}"${s} />`;
27
22
  }, h = (e, t) => {
28
- let n = p(e, t), r = d(e.style || {}), i = f(n.htmlClassNames, n.htmlClass), a = n.htmlId ? ` id="${u(n.htmlId)}"` : "", o = i ? ` class="${u(i)}"` : "", s = u(n.actionUrl || n.action || "#"), c = u(n.method || "POST"), l = n.fields || [], h = u(n.submitLabel || "Submit");
29
- return t === "email" ? `<mj-table><tr><td style="${r}"><table role="presentation" width="100%">${l.map((e) => `<tr><td style="padding:8px 0;font-family:Arial,sans-serif;color:#334155;"><strong>${u(e.label || e.name || "Field")}</strong><br/><span style="display:inline-block;margin-top:4px;padding:10px 12px;border:1px solid #d1d5db;border-radius:6px;color:#64748b;">${u(e.placeholder || "") || "&nbsp;"}</span></td></tr>`).join("")}<tr><td style="padding-top:12px;"><a href="${u(n.href || n.submitHref || "#")}" style="display:inline-block;padding:10px 16px;background:#0f172a;color:#ffffff;text-decoration:none;border-radius:6px;">${h}</a></td></tr></table></td></tr></mj-table>` : `<form${a}${o} action="${s}" method="${c}" style="${r}">${l.map((t) => m({
23
+ let n = m(e, t), r = f(e.style || {}), i = p(n.htmlClassNames, n.htmlClass, n.validationClass, n.validationClassName), a = d(n.name || n.fieldName || "field"), o = d(n.placeholder || ""), s = n.required ? " required" : "";
24
+ if (t === "email") return `<mj-table><tr><td style="padding:10px 12px;border:1px solid #d1d5db;border-radius:6px;color:#64748b;${r}">${o || a}</td></tr></mj-table>`;
25
+ let c = d(n.inputType || n.type || (e.type === "input" ? n.kind || "text" : e.type)), l = n.htmlId ? ` id="${d(n.htmlId)}"` : "", u = i ? ` class="${d(i)}"` : "";
26
+ return e.type === "textarea" ? `<textarea${l}${u} name="${a}" placeholder="${o}" style="${r}"${s}>${d(n.value || "")}</textarea>` : e.type === "select" ? `<select${l}${u} name="${a}" style="${r}"${s}>${(n.options || []).map((e) => `<option value="${d(e.value)}">${d(e.label)}</option>`).join("")}</select>` : `<input${l}${u} type="${c}" name="${a}" placeholder="${o}" value="${d(n.value || "")}" style="${r}"${s} />`;
27
+ }, g = (e, t) => {
28
+ let n = m(e, t), r = f(e.style || {}), i = p(n.htmlClassNames, n.htmlClass), a = n.htmlId ? ` id="${d(n.htmlId)}"` : "", o = i ? ` class="${d(i)}"` : "", s = d(n.actionUrl || n.action || "#"), c = d(n.method || "POST"), l = n.fields || [], u = d(n.submitLabel || "Submit");
29
+ return t === "email" ? `<mj-table><tr><td style="${r}"><table role="presentation" width="100%">${l.map((e) => `<tr><td style="padding:8px 0;font-family:Arial,sans-serif;color:#334155;"><strong>${d(e.label || e.name || "Field")}</strong><br/><span style="display:inline-block;margin-top:4px;padding:10px 12px;border:1px solid #d1d5db;border-radius:6px;color:#64748b;">${d(e.placeholder || "") || "&nbsp;"}</span></td></tr>`).join("")}<tr><td style="padding-top:12px;"><a href="${d(n.href || n.submitHref || "#")}" style="display:inline-block;padding:10px 16px;background:#0f172a;color:#ffffff;text-decoration:none;border-radius:6px;">${u}</a></td></tr></table></td></tr></mj-table>` : `<form${a}${o} action="${s}" method="${c}" style="${r}">${l.map((t) => h({
30
30
  id: `${e.id}-${String(t.name || t.label || "field")}`,
31
31
  type: t.kind === "textarea" || t.kind === "select" ? t.kind : "input",
32
32
  style: {
@@ -34,88 +34,93 @@ var c = {
34
34
  ...t.style || {}
35
35
  },
36
36
  attributes: t
37
- }, "landing_page")).join("")}<button type="submit">${h}</button></form>`;
38
- }, g = (e = {}, t = {}) => {
37
+ }, "landing_page")).join("")}<button type="submit">${u}</button></form>`;
38
+ }, _ = (e = {}, t = {}) => {
39
39
  let n = [], r = e.fontSize || t.fontSize, i = e.fontWeight || t.fontWeight;
40
- return r && n.push(`font-size="${u(String(r))}"`), i && n.push(`font-weight="${u(String(i))}"`), e.color && n.push(`color="${u(String(e.color))}"`), e.fontFamily && n.push(`font-family="${u(String(e.fontFamily))}"`), e.lineHeight && n.push(`line-height="${u(String(e.lineHeight))}"`), e.letterSpacing && n.push(`letter-spacing="${u(String(e.letterSpacing))}"`), e.textAlign && n.push(`align="${u(String(e.textAlign))}"`), e.backgroundColor && n.push(`container-background-color="${u(String(e.backgroundColor))}"`), n.join(" ");
41
- }, _ = (l, _) => {
42
- let v = p(l, _), y = d(l.style || {}), b = v.htmlId ? ` id="${u(v.htmlId)}"` : "", x = f(v.htmlClassNames, v.htmlClass, _ === "landing_page" && v.hideOnMobile ? "hidden md:block" : ""), S = x ? ` class="${u(x)}"` : "", C = typeof v.customCss == "string" && v.customCss.trim() ? v.customCss.trim() : "", w = C && _ === "landing_page" ? `<style>${C}</style>` : "";
43
- if (l.type === "form_container") return `${w}${h(l, _)}`;
44
- if (l.type === "input" || l.type === "select" || l.type === "textarea") return `${w}${m(l, _)}`;
45
- if (_ === "email") {
46
- if (l.type === "button") {
47
- let e = u(v.href || "#"), t = u(v.text || "Button"), n = r(l).width, i = n === "auto" ? "" : ` width="${u(n)}"`;
48
- return `<mj-button href="${e}" css-class="${v.hideOnDesktop ? "desktop-hide" : ""}" padding="0" inner-padding="10px 16px"${i}>${t}</mj-button>`;
40
+ return r && n.push(`font-size="${d(String(r))}"`), i && n.push(`font-weight="${d(String(i))}"`), e.color && n.push(`color="${d(String(e.color))}"`), e.fontFamily && n.push(`font-family="${d(String(e.fontFamily))}"`), e.lineHeight && n.push(`line-height="${d(String(e.lineHeight))}"`), e.letterSpacing && n.push(`letter-spacing="${d(String(e.letterSpacing))}"`), e.textAlign && n.push(`align="${d(String(e.textAlign))}"`), e.backgroundColor && n.push(`container-background-color="${d(String(e.backgroundColor))}"`), n.join(" ");
41
+ }, v = (r, u) => {
42
+ let v = m(r, u), y = f(r.style || {}), b = v.htmlId ? ` id="${d(v.htmlId)}"` : "", x = p(v.htmlClassNames, v.htmlClass, u === "landing_page" && v.hideOnMobile ? "hidden md:block" : ""), S = x ? ` class="${d(x)}"` : "", C = typeof v.customCss == "string" && v.customCss.trim() ? v.customCss.trim() : "", w = C && u === "landing_page" ? `<style>${C}</style>` : "";
43
+ if (r.type === "form_container") return `${w}${g(r, u)}`;
44
+ if (r.type === "input" || r.type === "select" || r.type === "textarea") return `${w}${h(r, u)}`;
45
+ if (u === "email") {
46
+ if (r.type === "button") {
47
+ let e = d(v.href || "#"), t = d(v.text || "Button"), n = i(r).width, a = n === "auto" ? "" : ` width="${d(n)}"`;
48
+ return `<mj-button href="${e}" css-class="${v.hideOnDesktop ? "desktop-hide" : ""}" padding="0" inner-padding="10px 16px"${a}>${t}</mj-button>`;
49
49
  }
50
- if (l.type === "image") {
51
- let t = e(l), n = t.width && t.width !== "100%" ? ` width="${u(t.width)}"` : "", r = t.height && t.height !== "auto" ? ` height="${u(t.height)}"` : "";
52
- return `<mj-image src="${u(v.src || "")}" alt="${u(v.alt || "")}"${n}${r} />`;
50
+ if (r.type === "image") {
51
+ let t = e(r), n = t.width && t.width !== "100%" ? ` width="${d(t.width)}"` : "", i = t.height && t.height !== "auto" ? ` height="${d(t.height)}"` : "";
52
+ return `<mj-image src="${d(v.src || "")}" alt="${d(v.alt || "")}"${n}${i} />`;
53
53
  }
54
- if (l.type === "social") {
55
- let e = t(l), n = e.filter((e) => c[e.provider]), r = e.filter((e) => !c[e.provider]);
56
- return `${n.length ? `<mj-social font-size="13px" icon-size="30px" mode="horizontal">${n.map((e) => `<mj-social-element name="${c[e.provider]}" href="${u(e.url)}" background-color="${u(e.backgroundColor)}" color="${u(e.color)}"></mj-social-element>`).join("")}</mj-social>` : ""}${r.length ? `<mj-text align="center">${r.map((e) => `<a href="${u(e.url)}" style="color: ${u(e.color)}; text-decoration: none; margin: 0 6px;">${u(e.provider)}</a>`).join("")}</mj-text>` : ""}`;
54
+ if (r.type === "social") {
55
+ let e = t(r), n = e.filter((e) => l[e.provider]), i = e.filter((e) => !l[e.provider]);
56
+ return `${n.length ? `<mj-social font-size="13px" icon-size="30px" mode="horizontal">${n.map((e) => `<mj-social-element name="${l[e.provider]}" href="${d(e.url)}" background-color="${d(e.backgroundColor)}" color="${d(e.color)}"></mj-social-element>`).join("")}</mj-social>` : ""}${i.length ? `<mj-text align="center">${i.map((e) => `<a href="${d(e.url)}" style="color: ${d(e.color)}; text-decoration: none; margin: 0 6px;">${d(e.provider)}</a>`).join("")}</mj-text>` : ""}`;
57
57
  }
58
- if (l.type === "menu") return `<mj-navbar hamburger="hamburger">${s(l).map((e) => `<mj-navbar-link href="${u(e.href)}">${u(e.label)}</mj-navbar-link>`).join("")}</mj-navbar>`;
59
- if (l.type === "table") {
60
- let e = n(l), t = l.style || {}, r = `${t.borderWidth || "1px"} ${t.borderStyle || "solid"} ${t.borderColor || "#cbd5e1"}`, i = (n, i, a) => {
61
- let o = a ? "th" : "td", s = a ? t.headerBgColor || "#f8fafc" : e.striped && i % 2 == 1 ? "#f8fafc" : t.contentBgColor || "#ffffff", c = a ? t.headerTextColor || "#1e293b" : t.contentTextColor || "#475569";
62
- return `<tr>${n.map((e) => `<${o} style="padding: ${t.cellPadding || "8px"}; border: ${r}; background-color: ${s}; color: ${c};">${u(e) || "&nbsp;"}</${o}>`).join("")}</tr>`;
63
- }, a = +!!e.enableHeader, o = e.enableFooter ? e.cells.length - 1 : e.cells.length;
64
- return `<mj-table><table role="presentation" style="border-collapse: collapse; width: 100%;">${e.enableHeader && e.cells.length > 0 ? `<thead>${i(e.cells[0], 0, !0)}</thead>` : ""}<tbody>${e.cells.slice(a, Math.max(a, o)).map((e, t) => i(e, t, !1)).join("")}</tbody>${e.enableFooter && e.cells.length > a ? `<tfoot>${i(e.cells[e.cells.length - 1], e.cells.length - 1, !1)}</tfoot>` : ""}</table></mj-table>`;
58
+ if (r.type === "menu") return `<mj-navbar hamburger="hamburger">${c(r).map((e) => `<mj-navbar-link href="${d(e.href)}">${d(e.label)}</mj-navbar-link>`).join("")}</mj-navbar>`;
59
+ if (r.type === "table") {
60
+ let e = n(r), t = r.style || {}, i = `${t.borderWidth || "1px"} ${t.borderStyle || "solid"} ${t.borderColor || "#cbd5e1"}`, a = (n, r, a) => {
61
+ let o = a ? "th" : "td", s = a ? t.headerBgColor || "#f8fafc" : e.striped && r % 2 == 1 ? "#f8fafc" : t.contentBgColor || "#ffffff", c = a ? t.headerTextColor || "#1e293b" : t.contentTextColor || "#475569";
62
+ return `<tr>${n.map((e) => `<${o} style="padding: ${t.cellPadding || "8px"}; border: ${i}; background-color: ${s}; color: ${c};">${d(e) || "&nbsp;"}</${o}>`).join("")}</tr>`;
63
+ }, o = +!!e.enableHeader, s = e.enableFooter ? e.cells.length - 1 : e.cells.length;
64
+ return `<mj-table><table role="presentation" style="border-collapse: collapse; width: 100%;">${e.enableHeader && e.cells.length > 0 ? `<thead>${a(e.cells[0], 0, !0)}</thead>` : ""}<tbody>${e.cells.slice(o, Math.max(o, s)).map((e, t) => a(e, t, !1)).join("")}</tbody>${e.enableFooter && e.cells.length > o ? `<tfoot>${a(e.cells[e.cells.length - 1], e.cells.length - 1, !1)}</tfoot>` : ""}</table></mj-table>`;
65
65
  }
66
- if (l.type === "video") {
67
- let e = i(v.videoUrl), t = v.linkType === "email" ? `mailto:${v.href || ""}` : v.href || v.videoUrl || "#";
68
- return `<mj-image src="${u(e.thumbnailUrl)}" href="${u(t)}" alt="${u(v.alt || "Video preview")}" />`;
66
+ if (r.type === "video") {
67
+ let e = a(v.videoUrl), t = v.linkType === "email" ? `mailto:${v.href || ""}` : v.href || v.videoUrl || "#";
68
+ return `<mj-image src="${d(e.thumbnailUrl)}" href="${d(t)}" alt="${d(v.alt || "Video preview")}" />`;
69
69
  }
70
- if (l.type === "timer") {
71
- let e = a(v.targetDate), t = v.showLabels !== !1;
72
- return `<mj-text align="center"><div style="font-size: 28px; font-weight: 800;">${e.days}d ${e.hours}h ${e.minutes}m ${e.seconds}s</div>${t ? `<div style="font-size: 12px; color: #64748b;">Countdown to ${u(v.targetDate || "")}</div>` : ""}</mj-text>`;
70
+ if (r.type === "timer") {
71
+ let e = o(v.targetDate), t = v.showLabels !== !1;
72
+ return `<mj-text align="center"><div style="font-size: 28px; font-weight: 800;">${e.days}d ${e.hours}h ${e.minutes}m ${e.seconds}s</div>${t ? `<div style="font-size: 12px; color: #64748b;">Countdown to ${d(v.targetDate || "")}</div>` : ""}</mj-text>`;
73
73
  }
74
- if (l.type === "carousel") {
74
+ if (r.type === "carousel") {
75
75
  let e = Array.isArray(v.images) ? v.images : [];
76
- return e.length === 0 ? "<mj-text align=\"center\">No images in carousel</mj-text>" : `<mj-carousel>${e.map((e) => `<mj-carousel-image src="${u(e.src)}" alt="${u(e.alt || "")}" />`).join("")}</mj-carousel>`;
76
+ return e.length === 0 ? "<mj-text align=\"center\">No images in carousel</mj-text>" : `<mj-carousel>${e.map((e) => `<mj-carousel-image src="${d(e.src)}" alt="${d(e.alt || "")}" />`).join("")}</mj-carousel>`;
77
77
  }
78
- if (l.type === "icon") {
79
- let e = parseInt(String(v.iconSize || 48), 10) || 48, t = l.style?.color || "#1e293b";
80
- return `<mj-text align="center">${o(v.iconName, e, t)}</mj-text>`;
78
+ if (r.type === "icon") {
79
+ let e = parseInt(String(v.iconSize || 48), 10) || 48, t = r.style?.color || "#1e293b";
80
+ return `<mj-text align="center">${s(v.iconName, e, t)}</mj-text>`;
81
81
  }
82
- let d = v.hideOnDesktop ? "desktop-hide" : "";
83
- if (l.type === "heading" || l.type === "paragraph" || l.type === "text") {
84
- let e = l.type === "heading" ? {
82
+ let u = v.hideOnDesktop ? "desktop-hide" : "";
83
+ if (r.type === "heading" || r.type === "paragraph" || r.type === "text") {
84
+ let e = r.type === "heading" ? {
85
85
  fontSize: "24px",
86
86
  fontWeight: "700"
87
- } : { fontSize: "14px" }, t = g(l.style || {}, e);
88
- return `<mj-text${t ? ` ${t}` : ""} css-class="${d}">${u(v.text || "")}</mj-text>`;
87
+ } : { fontSize: "14px" }, t = _(r.style || {}, e);
88
+ return `<mj-text${t ? ` ${t}` : ""} css-class="${u}">${d(v.text || "")}</mj-text>`;
89
89
  }
90
- if (l.type === "spacer") {
91
- let e = l.style?.height || "24px";
92
- return `<mj-spacer height="${u(String(e))}" />`;
90
+ if (r.type === "spacer") {
91
+ let e = r.style?.height || "24px";
92
+ return `<mj-spacer height="${d(String(e))}" />`;
93
93
  }
94
- if (l.type === "divider") {
95
- let e = l.style || {};
96
- return `<mj-divider border-width="${u(String(e.borderWidth || "1px"))}" border-style="${u(String(e.borderStyle || "solid"))}" border-color="${u(String(e.borderColor || "#334155"))}" />`;
94
+ if (r.type === "divider") {
95
+ let e = r.style || {};
96
+ return `<mj-divider border-width="${d(String(e.borderWidth || "1px"))}" border-style="${d(String(e.borderStyle || "solid"))}" border-color="${d(String(e.borderColor || "#334155"))}" />`;
97
97
  }
98
- return l.type === "card" ? `<mj-text css-class="${d}"><strong style="display:block;margin-bottom:8px;">${u(v.title || "Card Title")}</strong><span style="font-size:14px;color:#64748b;">${u(v.description || "Card description.")}</span></mj-text>` : l.type === "html" ? `<mj-text css-class="${d}">${v.htmlContent || v.text || ""}</mj-text>` : `<mj-text${b}${S} css-class="${d}">${u(v.text || v.htmlContent || "")}</mj-text>`;
98
+ return r.type === "card" ? `<mj-text css-class="${u}"><strong style="display:block;margin-bottom:8px;">${d(v.title || "Card Title")}</strong><span style="font-size:14px;color:#64748b;">${d(v.description || "Card description.")}</span></mj-text>` : r.type === "html" ? `<mj-text css-class="${u}">${v.htmlContent || v.text || ""}</mj-text>` : `<mj-text${b}${S} css-class="${u}">${d(v.text || v.htmlContent || "")}</mj-text>`;
99
99
  }
100
- switch (l.type) {
101
- case "heading": return `${w}<h2${b}${S} style="${y}">${u(v.text || "Heading")}</h2>`;
100
+ switch (r.type) {
101
+ case "heading": return `${w}<h2${b}${S} style="${y}">${d(v.text || "Heading")}</h2>`;
102
102
  case "paragraph":
103
- case "text": return `${w}<p${b}${S} style="${y}">${u(v.text || "")}</p>`;
104
- case "button": return `${w}<a${b}${S} href="${u(v.href || "#")}" style="${y}">${u(v.text || "Button")}</a>`;
105
- case "image": return `${w}<img${b}${S} src="${u(v.src || "")}" alt="${u(v.alt || "")}" style="${y}" />`;
103
+ case "text": return `${w}<p${b}${S} style="${y}">${d(v.text || "")}</p>`;
104
+ case "button": return `${w}<a${b}${S} href="${d(v.href || "#")}" style="${y}">${d(v.text || "Button")}</a>`;
105
+ case "image": return `${w}<img${b}${S} src="${d(v.src || "")}" alt="${d(v.alt || "")}" style="${y}" />`;
106
106
  case "html": return `${w}<div${b}${S} style="${y}">${String(v.htmlContent || "")}</div>`;
107
- default: return `${w}<div${b}${S} style="${y}">${u(v.text || "")}</div>`;
107
+ default: return `${w}<div${b}${S} style="${y}">${d(v.text || "")}</div>`;
108
108
  }
109
- }, v = (e, t) => {
109
+ }, y = (e, t) => {
110
110
  if (t === "email") {
111
- let n = e.elements.map((e) => _(e, t)).join("");
112
- return `<mj-column width="${u(e.width || "100%")}">${n}</mj-column>`;
111
+ let n = e.elements.map((e) => v(e, t)).join("");
112
+ return `<mj-column width="${d(e.width || "100%")}">${n}</mj-column>`;
113
113
  }
114
- let n = d(e.styles || {}), r = e.elements.map((e) => _(e, t)).join(""), i = (Array.isArray(e.nestedRows) ? e.nestedRows : []).map((e) => y(e, t)).join("");
115
- return `<div style="width:${u(e.width || "100%")};${n}">${r}${i}</div>`;
116
- }, y = (e, t) => t === "email" ? `<mj-section css-class="${e.style?.hideOnDesktop ? "desktop-hide" : ""}">${e.columns.map((e) => v(e, t)).join("")}</mj-section>` : `<section style="display:flex;flex-wrap:wrap;${d(e.style || {})}">${e.columns.map((e) => v(e, t)).join("")}</section>`, b = (e, t) => {
117
- let n = (e.body?.rows || []).map((e) => y(e, t)).join(""), r = d(e.body?.style || {});
114
+ let n = f(e.styles || {}), i = new Map(e.elements.map((e) => [e.id, e])), a = new Map((Array.isArray(e.nestedRows) ? e.nestedRows : []).map((e) => [e.id, e])), o = r(e).map((e) => {
115
+ let n = i.get(e);
116
+ if (n) return v(n, t);
117
+ let r = a.get(e);
118
+ return r ? b(r, t) : "";
119
+ }).join("");
120
+ return `<div style="width:${d(e.width || "100%")};${n}">${o}</div>`;
121
+ }, b = (e, t) => t === "email" ? `<mj-section css-class="${e.style?.hideOnDesktop ? "desktop-hide" : ""}">${e.columns.map((e) => y(e, t)).join("")}</mj-section>` : `<section style="display:flex;flex-wrap:wrap;${f(e.style || {})}">${e.columns.map((e) => y(e, t)).join("")}</section>`, x = (e, t) => {
122
+ let n = (e.body?.rows || []).map((e) => b(e, t)).join(""), r = f(e.body?.style || {});
118
123
  return t === "email" ? `<mjml><mj-head><mj-style>.desktop-hide { display:none !important; max-height:0; overflow:hidden; }</mj-style></mj-head><mj-body><mj-section><mj-column><mj-text css-class="preheader" padding="0" font-size="1px" color="#ffffff">&nbsp;</mj-text></mj-column></mj-section>${n}</mj-body></mjml>` : `<!doctype html><html><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /></head><body style="${r}"><main>${n}</main></body></html>`;
119
124
  };
120
125
  //#endregion
121
- export { b as parseJsonToTargetFormat };
126
+ export { x as parseJsonToTargetFormat };
@@ -1,31 +1,41 @@
1
+ //#region src/utilities/columnOrder.ts
2
+ function e(e) {
3
+ let t = /* @__PURE__ */ new Set([...e.elements.map((e) => e.id), ...(e.nestedRows || []).map((e) => e.id)]), n = (e.childOrder || []).filter((e) => t.has(e)), r = new Set(n), i = [...e.elements.map((e) => e.id), ...(e.nestedRows || []).map((e) => e.id)].filter((e) => !r.has(e));
4
+ return [...n, ...i];
5
+ }
6
+ function t(e, t, n) {
7
+ let r = [...e], i = typeof n == "number" ? Math.max(0, Math.min(n, r.length)) : r.length;
8
+ return r.splice(i, 0, t), r;
9
+ }
10
+ //#endregion
1
11
  //#region src/utilities/elementResolvers.ts
2
- var e = (e) => e === "twitter" ? "x" : e;
3
- function t(t) {
4
- let n = t.attributes || {}, r = t.style || {};
5
- return (Array.isArray(n.links) ? n.links : []).filter((e) => e && typeof e == "object").map((t) => ({
6
- provider: e(String(t.provider || "")),
7
- url: typeof t.url == "string" && t.url.trim() ? t.url : "#",
8
- color: t.color || r.iconColor || "#475569",
9
- backgroundColor: t.backgroundColor || r.iconBackgroundColor || "#f8fafc",
10
- size: t.size || r.iconSize || "36px",
11
- iconType: (t.iconType || n.iconType) === "square" ? "square" : "circle"
12
+ var n = (e) => e === "twitter" ? "x" : e;
13
+ function r(e) {
14
+ let t = e.attributes || {}, r = e.style || {};
15
+ return (Array.isArray(t.links) ? t.links : []).filter((e) => e && typeof e == "object").map((e) => ({
16
+ provider: n(String(e.provider || "")),
17
+ url: typeof e.url == "string" && e.url.trim() ? e.url : "#",
18
+ color: e.color || r.iconColor || "#475569",
19
+ backgroundColor: e.backgroundColor || r.iconBackgroundColor || "#f8fafc",
20
+ size: e.size || r.iconSize || "36px",
21
+ iconType: (e.iconType || t.iconType) === "square" ? "square" : "circle"
12
22
  }));
13
23
  }
14
- function n(e) {
24
+ function i(e) {
15
25
  let t = e.attributes || {};
16
26
  return (Array.isArray(t.links) ? t.links : []).filter((e) => e && typeof e == "object").map((e) => ({
17
27
  label: typeof e.label == "string" && e.label.trim() ? e.label : "Link",
18
28
  href: typeof e.href == "string" && e.href.trim() ? e.href : "#"
19
29
  }));
20
30
  }
21
- function r(e) {
31
+ function a(e) {
22
32
  let t = e.style || {}, n = e.attributes || {};
23
33
  return {
24
34
  width: t.width || "100%",
25
35
  height: n.autoHeight === !1 && t.height || "auto"
26
36
  };
27
37
  }
28
- function i(e, t, n, r) {
38
+ function o(e, t, n, r) {
29
39
  if (e) return e;
30
40
  if (t) {
31
41
  let e = t.trim().split(/\s+/).filter(Boolean);
@@ -41,22 +51,22 @@ function i(e, t, n, r) {
41
51
  }
42
52
  return r;
43
53
  }
44
- function a(e) {
54
+ function s(e) {
45
55
  let t = e.style || {}, n = e.attributes || {};
46
56
  return {
47
57
  width: n.autoWidth === !1 ? t.width || "100%" : "auto",
48
58
  height: n.autoHeight === !1 && t.height || "auto"
49
59
  };
50
60
  }
51
- function o(e) {
61
+ function c(e) {
52
62
  let t = e.style || {};
53
63
  return (e.attributes || {}).autoHeight === !1 && t.height || "auto";
54
64
  }
55
- function s(e, t) {
65
+ function l(e, t) {
56
66
  let n = e.style || {};
57
67
  return (e.attributes || {}).autoHeight === !1 && n.height || t;
58
68
  }
59
- var c = [
69
+ var u = [
60
70
  "showLabel",
61
71
  "fontSize",
62
72
  "labelFontWeight",
@@ -67,16 +77,16 @@ var c = [
67
77
  "inputTextColor",
68
78
  "placeholderColor"
69
79
  ];
70
- function l(e) {
80
+ function d(e) {
71
81
  let t = null;
72
82
  return (Array.isArray(e) ? e : []).map((e) => {
73
83
  let n = e?.inheritStylesFromPrevious && t ? { ...e } : e;
74
- if (e?.inheritStylesFromPrevious && t) for (let e of c) n[e] = t[e];
84
+ if (e?.inheritStylesFromPrevious && t) for (let e of u) n[e] = t[e];
75
85
  return t = n, n;
76
86
  });
77
87
  }
78
- var u = (e) => String(Math.max(0, e)).padStart(2, "0");
79
- function d(e, t, n = Date.now()) {
88
+ var f = (e) => String(Math.max(0, e)).padStart(2, "0");
89
+ function p(e, t, n = Date.now()) {
80
90
  let r = e ? Date.parse(e) : NaN, i = Number.isNaN(r) ? n : r, a = i - n;
81
91
  if (a <= 0) return {
82
92
  days: "00",
@@ -86,33 +96,33 @@ function d(e, t, n = Date.now()) {
86
96
  isExpired: !0,
87
97
  targetTimestamp: i
88
98
  };
89
- let o = Math.floor(a / 1e3), s = Math.floor(o / 86400), c = Math.floor(o % 86400 / 3600), l = Math.floor(o % 3600 / 60), d = o % 60;
99
+ let o = Math.floor(a / 1e3), s = Math.floor(o / 86400), c = Math.floor(o % 86400 / 3600), l = Math.floor(o % 3600 / 60), u = o % 60;
90
100
  return {
91
- days: u(s),
92
- hours: u(c),
93
- minutes: u(l),
94
- seconds: u(d),
101
+ days: f(s),
102
+ hours: f(c),
103
+ minutes: f(l),
104
+ seconds: f(u),
95
105
  isExpired: !1,
96
106
  targetTimestamp: i
97
107
  };
98
108
  }
99
- var f = [
109
+ var m = [
100
110
  "youtube.com",
101
111
  "www.youtube.com",
102
112
  "youtu.be",
103
113
  "m.youtube.com"
104
114
  ];
105
- function p(e) {
115
+ function h(e) {
106
116
  return e.hostname === "youtu.be" ? e.pathname.slice(1).split("/")[0] || null : e.pathname.startsWith("/embed/") ? e.pathname.slice(7).split("/")[0] || null : e.pathname.startsWith("/shorts/") ? e.pathname.slice(8).split("/")[0] || null : e.searchParams.get("v");
107
117
  }
108
- function m(e) {
118
+ function g(e) {
109
119
  let t = e.pathname.match(/(\d+)/);
110
120
  return t ? t[1] : null;
111
121
  }
112
- var h = "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22640%22%20height%3D%22360%22%20viewBox%3D%220%200%20640%20360%22%3E%3Crect%20width%3D%22640%22%20height%3D%22360%22%20fill%3D%22%230f172a%22%2F%3E%3Ccircle%20cx%3D%22320%22%20cy%3D%22180%22%20r%3D%2248%22%20fill%3D%22%23ffffff%22%20opacity%3D%220.9%22%2F%3E%3Cpath%20d%3D%22M304%20156%20L356%20180%20L304%20204%20Z%22%20fill%3D%22%230f172a%22%2F%3E%3C%2Fsvg%3E";
113
- function g(e) {
122
+ var _ = "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22640%22%20height%3D%22360%22%20viewBox%3D%220%200%20640%20360%22%3E%3Crect%20width%3D%22640%22%20height%3D%22360%22%20fill%3D%22%230f172a%22%2F%3E%3Ccircle%20cx%3D%22320%22%20cy%3D%22180%22%20r%3D%2248%22%20fill%3D%22%23ffffff%22%20opacity%3D%220.9%22%2F%3E%3Cpath%20d%3D%22M304%20156%20L356%20180%20L304%20204%20Z%22%20fill%3D%22%230f172a%22%2F%3E%3C%2Fsvg%3E";
123
+ function v(e) {
114
124
  if (!e || typeof e != "string") return {
115
- thumbnailUrl: h,
125
+ thumbnailUrl: _,
116
126
  provider: "unknown"
117
127
  };
118
128
  let t;
@@ -120,34 +130,34 @@ function g(e) {
120
130
  t = new URL(e);
121
131
  } catch {
122
132
  return {
123
- thumbnailUrl: h,
133
+ thumbnailUrl: _,
124
134
  provider: "unknown"
125
135
  };
126
136
  }
127
- if (f.includes(t.hostname)) {
128
- let e = p(t);
137
+ if (m.includes(t.hostname)) {
138
+ let e = h(t);
129
139
  if (e) return {
130
140
  thumbnailUrl: `https://img.youtube.com/vi/${e}/hqdefault.jpg`,
131
141
  provider: "youtube"
132
142
  };
133
143
  }
134
144
  if (t.hostname === "vimeo.com" || t.hostname === "www.vimeo.com" || t.hostname === "player.vimeo.com") {
135
- let e = m(t);
145
+ let e = g(t);
136
146
  if (e) return {
137
147
  thumbnailUrl: `https://vumbnail.com/${e}.jpg`,
138
148
  provider: "vimeo"
139
149
  };
140
150
  }
141
151
  return {
142
- thumbnailUrl: h,
152
+ thumbnailUrl: _,
143
153
  provider: "unknown"
144
154
  };
145
155
  }
146
- function _(e, t) {
156
+ function y(e, t) {
147
157
  let n = e || "Star", r = n.replace(/[-_]([a-z0-9])/gi, (e, t) => t.toUpperCase()).replace(/^\w/, (e) => e.toUpperCase()), i = n.toLowerCase().replace(/[-_]/g, "");
148
158
  return t.includes(n) ? n : t.includes(r) ? r : t.includes(`${r}Icon`) ? `${r}Icon` : t.find((e) => e.toLowerCase().replace(/[-_]/g, "") === i) || "HelpCircle";
149
159
  }
150
- function v(e) {
160
+ function b(e) {
151
161
  let t = e.attributes || {}, n = Math.max(1, Number(t.rowCount) || 2), r = Math.max(1, Number(t.colCount) || 2), i = Array.isArray(t.cells) ? t.cells : [], a = [];
152
162
  for (let e = 0; e < n; e++) {
153
163
  let t = Array.isArray(i[e]) ? i[e] : [], n = [];
@@ -163,29 +173,29 @@ function v(e) {
163
173
  striped: !!t.striped
164
174
  };
165
175
  }
166
- var y = 8;
167
- function b(e, t, n) {
168
- let r = n < y && Array.isArray(e?.children) ? e.children : [];
176
+ var x = 8;
177
+ function S(e, t, n) {
178
+ let r = n < x && Array.isArray(e?.children) ? e.children : [];
169
179
  return {
170
180
  id: typeof e?.id == "string" && e.id ? e.id : `item-${t}`,
171
181
  title: typeof e?.title == "string" && e.title.trim() ? e.title : `Item ${t + 1}`,
172
182
  content: typeof e?.content == "string" ? e.content : "",
173
183
  defaultOpen: !!e?.defaultOpen,
174
- children: r.map((e, t) => b(e, t, n + 1))
184
+ children: r.map((e, t) => S(e, t, n + 1))
175
185
  };
176
186
  }
177
- function x(e, t) {
187
+ function C(e, t) {
178
188
  if (t !== "multi") {
179
189
  let t = !1;
180
190
  for (let n of e) n.defaultOpen && (t ? n.defaultOpen = !1 : t = !0);
181
191
  }
182
- for (let n of e) x(n.children, t);
192
+ for (let n of e) C(n.children, t);
183
193
  }
184
- function S(e) {
185
- let t = e.attributes || {}, n = t.mode === "multi" ? "multi" : "single", r = (Array.isArray(t.items) ? t.items : []).map((e, t) => b(e, t, 0));
186
- return x(r, n), r;
194
+ function w(e) {
195
+ let t = e.attributes || {}, n = t.mode === "multi" ? "multi" : "single", r = (Array.isArray(t.items) ? t.items : []).map((e, t) => S(e, t, 0));
196
+ return C(r, n), r;
187
197
  }
188
- function C(e, t, n) {
198
+ function T(e, t, n) {
189
199
  let r = JSON.parse(JSON.stringify(Array.isArray(e) ? e : [])), i = (e, t) => {
190
200
  let [r, ...a] = t;
191
201
  if (e[r]) {
@@ -203,7 +213,7 @@ function C(e, t, n) {
203
213
  }
204
214
  //#endregion
205
215
  //#region src/utilities/iconSvgStatic.ts
206
- var w = {
216
+ var E = {
207
217
  "a-arrow-down": [
208
218
  ["path", { d: "m14 12 4 4 4-4" }],
209
219
  ["path", { d: "M18 16V7" }],
@@ -15023,18 +15033,18 @@ var w = {
15023
15033
  y2: "11"
15024
15034
  }]
15025
15035
  ]
15026
- }, T = "circle-help";
15027
- function E(e) {
15036
+ }, D = "circle-help";
15037
+ function O(e) {
15028
15038
  return e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2").toLowerCase();
15029
15039
  }
15030
- function D(e) {
15031
- let t = e || "HelpCircle", n = E(t.replace(/^\w/, (e) => e.toUpperCase()));
15032
- if (w[n]) return n;
15040
+ function k(e) {
15041
+ let t = e || "HelpCircle", n = O(t.replace(/^\w/, (e) => e.toUpperCase()));
15042
+ if (E[n]) return n;
15033
15043
  let r = t.toLowerCase().replace(/[-_\s]/g, "");
15034
- return Object.keys(w).find((e) => e.replace(/-/g, "") === r) || T;
15044
+ return Object.keys(E).find((e) => e.replace(/-/g, "") === r) || D;
15035
15045
  }
15036
- function O(e, t, n) {
15037
- return `<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" stroke="${n}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${(w[D(e)] || w[T] || []).map(([e, t]) => `<${e} ${Object.entries(t).map(([e, t]) => `${e}="${String(t)}"`).join(" ")}></${e}>`).join("")}</svg>`;
15046
+ function A(e, t, n) {
15047
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" stroke="${n}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${(E[k(e)] || E[D] || []).map(([e, t]) => `<${e} ${Object.entries(t).map(([e, t]) => `${e}="${String(t)}"`).join(" ")}></${e}>`).join("")}</svg>`;
15038
15048
  }
15039
15049
  //#endregion
15040
- export { o as a, r as c, t as d, v as f, C as h, a as i, _ as l, g as m, S as n, l as o, d as p, i as r, s, O as t, n as u };
15050
+ export { t as _, c as a, a as c, r as d, b as f, e as g, T as h, s as i, y as l, v as m, w as n, d as o, p, o as r, l as s, A as t, i as u };