@markopolo_ai_inc/markopolo-email-editor 1.0.68 → 1.0.70
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/README.md +27 -0
- package/core/package.json +7 -0
- package/lib/core/index.d.ts +110 -0
- package/lib/core/index.js +1 -0
- package/lib/core/index.mjs +1 -0
- package/lib/index.css +1 -1
- package/lib/index.js +1 -1
- package/lib/index.mjs +1 -1
- package/package.json +17 -2
package/README.md
CHANGED
|
@@ -28,6 +28,33 @@ import "@markopolo_ai_inc/markopolo-email-editor/lib/index.css";
|
|
|
28
28
|
|
|
29
29
|
---
|
|
30
30
|
|
|
31
|
+
## Lightweight `/core` entry (no React, no CSS)
|
|
32
|
+
|
|
33
|
+
If you only need the **helpers** — JSON↔HTML conversion, export, validation, template
|
|
34
|
+
scaffolding, API-config defaults — and **not** the `<EmailEditor />` component, import from
|
|
35
|
+
the `/core` subpath instead of the package root. It pulls in **no React component tree and
|
|
36
|
+
no stylesheet**, so it's a small fraction of the full bundle (~22 KB gzipped vs ~144 KB):
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
import {
|
|
40
|
+
exportNormalizerToHtml,
|
|
41
|
+
createDefaultTemplateData,
|
|
42
|
+
mergeMarkopoloApiConfig,
|
|
43
|
+
validateExportPayload,
|
|
44
|
+
TEMPLATE_DATA_SCHEMA,
|
|
45
|
+
utils, // { jsonToHtml, normalizeJson, updateJsonWithMlContent }
|
|
46
|
+
} from "@markopolo_ai_inc/markopolo-email-editor/core";
|
|
47
|
+
// No CSS import needed — /core ships no styles.
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
`/core` is a strict subset of the root export: every symbol it exposes is also available from
|
|
51
|
+
the package root, so you can mix `import EmailEditor from ".../markopolo-email-editor"` (the
|
|
52
|
+
editor) with `import { exportNormalizerToHtml } from ".../markopolo-email-editor/core"` (the
|
|
53
|
+
helpers) — ideally on routes where the editor is **lazy-loaded** so the helper-only paths never
|
|
54
|
+
pull the editor bundle.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
31
58
|
## Quick start
|
|
32
59
|
|
|
33
60
|
```jsx
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"//": "Redirect stub so `@markopolo_ai_inc/markopolo-email-editor/core` resolves under legacy/classic module resolution (TS moduleResolution:node, older bundlers) that ignore the root \"exports\" map. Modern resolvers use \"exports\" and never read this file. Points at the built lib/core artifacts.",
|
|
3
|
+
"main": "../lib/core/index.js",
|
|
4
|
+
"module": "../lib/core/index.mjs",
|
|
5
|
+
"types": "../lib/core/index.d.ts",
|
|
6
|
+
"sideEffects": false
|
|
7
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for the `/core` subpath entry — the React-free helper surface.
|
|
3
|
+
* Mirrors what `@markopolo_ai_inc/markopolo-email-editor/core` exports.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export declare const DEFAULT_MARKOPOLO_API_BASE_V1: string;
|
|
7
|
+
export declare const DEFAULT_ML_GENERATION_API_BASE_V1: string;
|
|
8
|
+
export declare const DEFAULT_EMAIL_TEMPLATE_ID: string;
|
|
9
|
+
export declare function mergeMarkopoloApiConfig(
|
|
10
|
+
partial?: Record<string, unknown>
|
|
11
|
+
): Record<string, unknown>;
|
|
12
|
+
|
|
13
|
+
export declare const utils: {
|
|
14
|
+
jsonToHtml(json: object | string): string;
|
|
15
|
+
normalizeJson(json: object | string): {
|
|
16
|
+
groups: Array<{
|
|
17
|
+
containerId: string;
|
|
18
|
+
containerType: string;
|
|
19
|
+
blocks: Array<{
|
|
20
|
+
id: string;
|
|
21
|
+
contentType: string;
|
|
22
|
+
value: string;
|
|
23
|
+
ai: {
|
|
24
|
+
prompt: string;
|
|
25
|
+
selectedSampleAiContent: string;
|
|
26
|
+
};
|
|
27
|
+
}>;
|
|
28
|
+
}>;
|
|
29
|
+
};
|
|
30
|
+
updateJsonWithMlContent(
|
|
31
|
+
json: object | string,
|
|
32
|
+
mlContent: Array<{
|
|
33
|
+
nodeId: string;
|
|
34
|
+
variations: Array<{ id: string; value: string }>;
|
|
35
|
+
}>
|
|
36
|
+
): object;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** A single validation/compliance finding produced by the export validators. */
|
|
40
|
+
export interface ExportIssue {
|
|
41
|
+
severity: string;
|
|
42
|
+
code: string;
|
|
43
|
+
message: string;
|
|
44
|
+
location?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface ExportPayload {
|
|
48
|
+
blockList: unknown[];
|
|
49
|
+
bodySettings: object | null;
|
|
50
|
+
aiContentRefs?: object;
|
|
51
|
+
fillProductSlots?: boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface ExportResult {
|
|
55
|
+
payload: ExportPayload;
|
|
56
|
+
issues: ExportIssue[];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Reads the current template from an EmailEditor ref (`ref.current.exportJson`)
|
|
61
|
+
* and optionally validates it. For image-URL reachability checks, use the async variant.
|
|
62
|
+
*/
|
|
63
|
+
export declare function exportTemplateJson(
|
|
64
|
+
emailEditorRef: { current?: { exportJson?: () => ExportPayload } | null },
|
|
65
|
+
options?: { validate?: boolean }
|
|
66
|
+
): ExportResult;
|
|
67
|
+
|
|
68
|
+
export declare function exportTemplateJsonAsync(
|
|
69
|
+
emailEditorRef: { current?: { exportJson?: () => ExportPayload } | null },
|
|
70
|
+
options?: { validate?: boolean }
|
|
71
|
+
): Promise<ExportResult>;
|
|
72
|
+
|
|
73
|
+
/** Synchronous, side-effect-free validation of an export payload. */
|
|
74
|
+
export declare function validateExportPayload(payload: {
|
|
75
|
+
blockList: unknown[];
|
|
76
|
+
bodySettings: object | null;
|
|
77
|
+
aiContentRefs?: object;
|
|
78
|
+
}): { issues: ExportIssue[] } & Record<string, unknown>;
|
|
79
|
+
|
|
80
|
+
/** Probes http(s) image-block URLs in the browser; resolves with reachability issues. */
|
|
81
|
+
export declare function validateImageUrlsReachable(
|
|
82
|
+
blockList: unknown[],
|
|
83
|
+
options?: Record<string, unknown>
|
|
84
|
+
): Promise<{ issues: ExportIssue[] } & Record<string, unknown>>;
|
|
85
|
+
|
|
86
|
+
/** Merges sync payload validation with async image-reachability checks. */
|
|
87
|
+
export declare function validateExportPayloadComplete(
|
|
88
|
+
payload: {
|
|
89
|
+
blockList: unknown[];
|
|
90
|
+
bodySettings: object | null;
|
|
91
|
+
aiContentRefs?: object;
|
|
92
|
+
},
|
|
93
|
+
imageOptions?: Record<string, unknown>
|
|
94
|
+
): Promise<{ issues: ExportIssue[] } & Record<string, unknown>>;
|
|
95
|
+
|
|
96
|
+
/** Converts a template/normalizer payload into a self-contained HTML email string. */
|
|
97
|
+
export declare function exportNormalizerToHtml(input: object | string): string;
|
|
98
|
+
|
|
99
|
+
export declare const TEMPLATE_DATA_SCHEMA: Readonly<{
|
|
100
|
+
keys: string[];
|
|
101
|
+
description: string;
|
|
102
|
+
}>;
|
|
103
|
+
|
|
104
|
+
export declare function createDefaultTemplateData(
|
|
105
|
+
overrides?: Record<string, unknown>
|
|
106
|
+
): Record<string, unknown>;
|
|
107
|
+
|
|
108
|
+
export declare function validateTemplateDataShape(
|
|
109
|
+
data: unknown
|
|
110
|
+
): { valid: boolean; issues: string[] } & Record<string, unknown>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t="https://api-alpha.markopolo.ai/v1",e="https://nbq-ml-api-stg.markopolo.ai/v1",n="95b48b5b-cf5e-486d-817e-9839d4c4e618";function o(n,o){const i=null!=(r=n)&&"string"==typeof r&&r.trim()?r.replace(/\/$/,""):t;var r;const l=function(t){return null!=t&&"string"==typeof t&&t.trim()?t.replace(/\/$/,""):e}(o);return{imageUploadEndpoint:`${i}/upload-file`,imageUploadQueryParams:{show:!1},imageUploadCompanyField:"comment",productsEndpoint:`${i}/knowledge-base/products`,universalEmailBlocksEndpoint:`${i}/universal-email-blocks`,mlEmailNodesEndpoint:`${l}/ml-service/content/generate-email-nodes`,mlEmailGenerateEndpoint:`${l}/ml-service/content/generate-email`}}function i(t){const e=String(t??"").trim();return/^(?:javascript|vbscript)\s*:/i.test(e)||/^data\s*:/i.test(e)}function r(t){let e=String(t??"").trim();if(!e)return"";if(i(e))return"";for(let t=0;t<e.length;t++){const n=e.charCodeAt(t),o=e[t];if(n<32||"<"===o||">"===o||'"'===o)return""}return e}function l(t){const e=String(t??"").trim().match(/^https?:\/\/(.+)/is);return!!e&&/^https?:\/\//i.test(e[1])}function a(t,e={}){const{allowMailtoTel:n=!0}=e,o=String(t??"").trim();if(!o)return null;if(i(o))return null;if(l(o))return null;if(n&&(/^mailto:/i.test(o)||/^tel:/i.test(o)))return o;const r=/^https?:\/\//i.test(o)?o:`https://${o.replace(/^\/+/,"")}`;return s(r,!1,e)?r:null}function s(t,e=!1,n={}){return null==c(t,e,n)}function c(t,e=!1,n={}){const{allowMailtoTel:o=!0}=n;if(null==t||""===String(t).trim())return e?null:"empty";const r=String(t).trim();if(i(r))return"blocked_scheme";if(l(r))return"duplicate_protocol";let a;if(/^https?:\/\//i.test(r)){const t=r.replace(/^https?:\/\//i,"");if(/^https?:\/\//i.test(t))return"duplicate_protocol";a=r}else a=o&&/^mailto:/i.test(r)||o&&/^tel:/i.test(r)?r:`https://${r}`;try{const t=new URL(a);return"http:"===t.protocol||"https:"===t.protocol?function(t){const e=String(t??"").trim().toLowerCase();return""!==e&&"http"!==e&&"https"!==e&&("localhost"===e||!!e.includes(":")||!!/^(?:\d{1,3}\.){3}\d{1,3}$/.test(e)||e.includes("."))}(t.hostname)?null:"missing_hostname_dot":o&&"mailto:"===t.protocol||o&&"tel:"===t.protocol?null:"invalid_protocol"}catch{return"invalid_url"}}function d(t){return!1!==t?.linkEnabled}const u={EMAIL_WIDTH:"email_width",CUSTOM_PX:"custom_px",FULL_BLEED:"full_bleed"};function m(t){const e=Math.round(Number(t));return!Number.isFinite(e)||e<=0?600:Math.min(1200,Math.max(280,e))}function p(t){return function(t){const e=t?.contentWidthMode;return Object.values(u).includes(e)?e:u.EMAIL_WIDTH}(t)===u.FULL_BLEED}const g={preHeader:"",contentWidth:600,stackColumnsOnMobile:!0,scaleFontOnMobile:!0,styles:{backgroundColor:"#F5F5F5",contentBg:"#FFFFFF",color:"#171717",headingColor:"#171717",linkColor:"#338AF3",fontFamily:"'Overused Grotesk', ui-sans-serif, system-ui, sans-serif"}};function f(t){const e=String(t??"").trim();return/^\{\{[A-Za-z_]\w*\}\}$/.test(e)}const y=/^\s*\{\{[\s\S]*\}\}\s*$/;function b(t){const e=String(t??"").trim();if(!e)return!1;if("#"===e)return!1;if(e.startsWith("#")&&e.length>1)return!1;if(y.test(e))return!1;if(f(e))return!1;const n=e.toLowerCase();return!n.startsWith("http://")&&!n.startsWith("https://")&&(!n.startsWith("mailto:")&&!n.startsWith("tel:")&&!n.startsWith("//"))}function k(t,e=!1){if(null==t||""===String(t).trim())return e;const n=String(t).trim();try{return/^https?:\/\//i.test(n)?new URL(n):new URL("https://"+n),!0}catch{return!1}}const h={text:"Text",heading:"Heading",button:"Button",image:"Image",video:"Video",avatar:"Profile image",menu:"Menu",social_link:"Social links",raw_html:"HTML"};const $={none:"Container",product:"Product",discount:"Discount",header:"Header",footer:"Footer",navigation_bar:"Navigation",introduction:"Introduction",hero:"Hero",hero_product:"Hero product",body:"Body",additional_product:"Additional product"};function x(t,e,n){const o=t.containerType??"none",i=function(t){const e=t??"none";return $[e]?$[e]:String(e).replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase())}(o);return n<=1?i:"none"===o?`${v(e+1)} section`:`${v(e+1)} ${i} block`}function v(t){const e=t%10,n=t%100;return 1===e&&11!==n?`${t}st`:2===e&&12!==n?`${t}nd`:3===e&&13!==n?`${t}rd`:`${t}th`}function S(t,e,n){const o=function(t){return h[t]?h[t]:String(t||"block").replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase())}(e),i=[...t],r=i.length>0?i.join(" → "):"Email body";return n?`${o} ("${n}") — ${r}`:`${o} — ${r}`}function w(t,e){const n=function(t){return null==t||"object"!=typeof t?{...g,styles:{...g.styles}}:{preHeader:null!=t.preHeader?t.preHeader:g.preHeader,contentWidth:m(null!=t.contentWidth?t.contentWidth:g.contentWidth),stackColumnsOnMobile:!1!==t.stackColumnsOnMobile,scaleFontOnMobile:!1!==t.scaleFontOnMobile,styles:{backgroundColor:null!=t.styles?.backgroundColor?t.styles.backgroundColor:g.styles.backgroundColor,contentBg:null!=t.styles?.contentBg?t.styles.contentBg:g.styles.contentBg,color:null!=t.styles?.color?t.styles.color:g.styles.color,headingColor:null!=t.styles?.headingColor?t.styles.headingColor:g.styles.headingColor,linkColor:null!=t.styles?.linkColor?t.styles.linkColor:g.styles.linkColor,fontFamily:null!=t.styles?.fontFamily?t.styles.fontFamily:g.styles.fontFamily}}}(t);("number"!=typeof n.contentWidth||!Number.isFinite(n.contentWidth)||n.contentWidth<=0)&&e.push({severity:"error",code:"body_content_width_invalid",message:"Body content width must be between 280 and 1200 px.",location:"Theme settings"});const o=n.styles;null!=o.backgroundColor&&""!==String(o.backgroundColor).trim()||e.push({severity:"error",code:"body_background_color_missing",message:"Theme background color is missing.",location:"Theme settings"}),null!=o.color&&""!==String(o.color).trim()||e.push({severity:"error",code:"body_text_color_missing",message:"Theme text color is missing.",location:"Theme settings"}),null!=o.fontFamily&&""!==String(o.fontFamily).trim()||e.push({severity:"error",code:"body_font_family_missing",message:"Theme font family is missing.",location:"Theme settings"})}function C(t,e){t.push(e)}function _(t){return null==t?"":String(t).replace(/&/gi,"&").replace(/"/gi,'"').replace(/'/g,"'").trim()}function A(t){if(null==t||"string"!=typeof t)return[];const e=[],n=/<a\b[^>]*?\bhref\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>"']+))/gi;let o=n.exec(t);for(;o;){const i=o[1]??o[2]??o[3]??"";e.push(_(i)),o=n.exec(t)}return e}function L(t,e=!0){const n=String(t??"").trim();return n?f(n)?null:c(n,!1,{allowMailtoTel:e}):null}function P(t,e,n){const o=t.linkURL,r=()=>S(e,"button",void 0),l=t.id??null;null==o||""===String(o).trim()?C(n,{severity:"warning",code:"button_empty_link",message:'Button link URL is empty; will be saved as href="https://".',location:r(),blockId:l}):i(o)?C(n,{severity:"error",code:"button_blocked_scheme",message:"Button link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s), mailto:, or tel: only.",location:r(),blockId:l}):f(o)||s(o,!1,{allowMailtoTel:!0})?!f(o)&&b(o)&&C(n,{severity:"warning",code:"button_link_missing_protocol",message:"Button link should start with https://, http://, mailto:, or tel: for reliable email clients.",location:r(),blockId:l}):C(n,{severity:"warning",code:"button_invalid_link",message:"Button link URL format is invalid.",location:r(),blockId:l}),function(t,e,n,o,{invalidCode:r,invalidMessage:l,blockedCode:a,blockedMessage:c,missingProtocolCode:d,missingProtocolMessage:u}){A(t??"").forEach((t,m)=>{const p=String(t??"").trim();""!==p&&(i(p)?C(e,{severity:"error",code:a,message:c,location:n(m),blockId:o}):s(p,!1,{allowMailtoTel:!0})?b(p)&&C(e,{severity:"warning",code:d,message:u,location:n(m),blockId:o}):C(e,{severity:"warning",code:r,message:l,location:n(m),blockId:o}))})}(t.text,n,t=>S(e,"button",`label link ${t+1}`),l,{invalidCode:"button_label_invalid_link",invalidMessage:"Button label link URL format is invalid.",blockedCode:"button_label_blocked_link_scheme",blockedMessage:"Button label link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s), mailto:, or tel: only.",missingProtocolCode:"button_label_link_missing_protocol",missingProtocolMessage:"Button label link should start with https://, http://, mailto:, or tel: for reliable email clients."})}const T=["product"];function B(t,e,n,o,r){(function(...t){const e=new Set,n=[];for(const o of t)if(null!=o&&""!==String(o).trim())for(const t of A(String(o))){const o=String(t).trim();o&&!e.has(o)&&(e.add(o),n.push(t))}return n})(t.text,t.dynamicSelectedContent).forEach((r,l)=>{const a=String(r??"").trim();""!==a&&(a.startsWith("#")||y.test(a)||(i(a)?C(n,{severity:"error",code:"text_blocked_link_scheme",message:"Text link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s), mailto:, or tel: only.",location:S(e,o,`link ${l+1}`),blockId:t.id??null}):s(a,!1,{allowMailtoTel:!0})?b(a)&&C(n,{severity:"warning",code:"text_link_missing_protocol",message:"Text link should start with https://, http://, mailto:, or tel: for reliable email clients.",location:S(e,o,`link ${l+1}`),blockId:t.id??null}):C(n,{severity:"warning",code:"text_invalid_link",message:"Text link URL format is invalid.",location:S(e,o,`link ${l+1}`),blockId:t.id??null})))});if("dynamic"!==(t.contentType??"static"))return;const l=t.dynamicSelectedContent,a=null!=t?.id?r?.[t.id]?.selectedContent:void 0;let c=null!=l&&""!==String(l).trim()?l:a;var d;null!=c&&""!==String(c).trim()||null==t.text||""===(null==(d=t.text)?"":String(d).replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim())||(c=t.text),null!=c&&""!==String(c).trim()||C(n,{severity:"warning",code:"dynamic_content_empty",message:"Dynamic content not generated; export will use static text if available.",location:S(e,o,void 0),blockId:t.id??null})}function I(t,e,n){const o=t.list||[],r=new Set;o.forEach((o,l)=>{const a=o.title||o.image||`link ${l+1}`,c=t=>S(e,"social_link",t||a),d=function(t){const e=String(t?.image||"").trim();if(e)return`img:${e}`;const n=String(t?.title||"").trim().toLowerCase();return n?`title:${n}`:null}(o);d&&(r.has(d)?C(n,{severity:"warning",code:"social_duplicate_platform",message:"Duplicate social platform in this block; only one entry per platform should be kept.",location:c(a),blockId:t.id??null}):r.add(d));const u=o.linkURL;if(null==u||""===String(u).trim()){const e=String(o?.title||"").trim()||`Item ${l+1}`;C(n,{severity:"warning",code:"social_empty_link",message:`${e} URL is empty — add https URL before sending; the icon still previews without an outbound link.`,location:c(a),blockId:t.id??null})}else i(u)?C(n,{severity:"error",code:"social_blocked_scheme",message:"Social link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s) URLs only (e.g. www.example.com or https://…).",location:c(a),blockId:t.id??null}):s(u,!1,{allowMailtoTel:!1})||C(n,{severity:"warning",code:"social_invalid_link",message:"Social link URL format is invalid.",location:c(a),blockId:t.id??null});const m=o.image;null==m||""===String(m).trim()?C(n,{severity:"warning",code:"social_empty_icon",message:"Social link icon URL is empty; icon will not display.",location:c(a),blockId:t.id??null}):k(m,!1)||C(n,{severity:"warning",code:"social_invalid_icon",message:"Social link icon URL format is invalid.",location:c(a),blockId:t.id??null})}),0===o.length&&C(n,{severity:"info",code:"social_no_links",message:"Social link block has no links.",location:S(e,"social_link",void 0),blockId:t.id??null})}function U(t,e,n,o,r){if(!Array.isArray(t))return;const l=t.length;t.forEach((t,a)=>{if(!t||"object"!=typeof t)return;if(!0===t.hidden)return;const c=t.key;if("column"===c){const i=x(t,a,l),s=[...e,i];return function(t,e,n){const o=t.containerType??"none";if(!T.includes(o))return;const i=t.children??[],r=t.columnProducts??[];i.forEach((o,l)=>{const a=r[l];if(null==a||"object"==typeof a&&!a.id){const o=i.length>1?`Column ${l+1} of ${i.length}`:"This column",r=[...e,o].join(" → ");C(n,{severity:"warning",code:"container_product_not_assigned",message:"A product is not assigned to this column; assign a product in Container settings.",location:r,blockId:t.id??null})}})}(t,s,n),void(Array.isArray(t.children)&&U(t.children,s,n,o,r))}if("content"===c){const i=l>1?`Column ${a+1} of ${l}`:null,s=i?[...e,i]:e;return void(Array.isArray(t.children)&&U(t.children,s,n,o,r))}switch(c){case"image":!function(t,e,n){const o=t.src,i=()=>S(e,"image",void 0);null!=o&&""!==String(o).trim()?(k(o,!1)||C(n,{severity:"warning",code:"image_invalid_src",message:"Image URL format is invalid.",location:i(),blockId:t.id??null}),d(t)&&L(t.linkURL,!0)&&C(n,{severity:"warning",code:"image_invalid_link",message:"Image link URL format is invalid.",location:i(),blockId:t.id??null}),null!=t.alt&&""!==String(t.alt).trim()||C(n,{severity:"info",code:"image_empty_alt",message:"Image alt text is empty; consider adding for accessibility.",location:i(),blockId:t.id??null})):C(n,{severity:"error",code:"image_empty_src",message:"Image URL is empty; the image will not display.",location:i(),blockId:t.id??null})}(t,e,n);break;case"video":!function(t,e,n){const o=()=>S(e,"video",void 0),i=null!=t.videoUrl?String(t.videoUrl).trim():"";i?k(i,!1)||C(n,{severity:"warning",code:"video_invalid_url",message:"Video URL format may be invalid.",location:o(),blockId:t.id??null}):C(n,{severity:"error",code:"video_empty_url",message:"Video URL is empty; the video will not display.",location:o(),blockId:t.id??null})}(t,e,n);break;case"avatar":!function(t,e,n){const o=t.src,i=()=>S(e,"avatar",void 0);null==o||""===String(o).trim()?C(n,{severity:"warning",code:"avatar_empty_src",message:"Avatar image URL is empty; avatar will not display.",location:i(),blockId:t.id??null}):k(o,!1)||C(n,{severity:"warning",code:"avatar_invalid_src",message:"Avatar image URL format is invalid.",location:i(),blockId:t.id??null}),L(t.linkURL,!0)&&C(n,{severity:"warning",code:"avatar_invalid_link",message:"Avatar link URL format is invalid.",location:i(),blockId:t.id??null})}(t,e,n);break;case"button":P(t,e,n);break;case"menu":!function(t,e,n){const o=t.list||[];o.forEach((o,r)=>{const l=String(o.label??"").trim()||`Item ${r+1}`,a=t=>S(e,"menu",t||`Item ${r+1}`);null!=o.label&&""!==String(o.label).trim()||C(n,{severity:"info",code:"menu_empty_label",message:'Navigation link label is empty; will display as "Link".',location:a(`item ${r+1}`),blockId:t.id??null});const c=o.url;null==c||""===String(c).trim()?C(n,{severity:"warning",code:"menu_empty_url",message:`"${l}" link URL is empty; will be saved as href="#". Add a destination URL (e.g. https://example.com) before sending.`,location:a(l),blockId:t.id??null}):i(c)?C(n,{severity:"error",code:"menu_blocked_scheme",message:`"${l}" link uses a blocked URL scheme (javascript:, data:, etc.). Use https://, mailto:, or tel: only.`,location:a(l),blockId:t.id??null}):s(c,!1,{allowMailtoTel:!0})?!f(c)&&b(c)&&C(n,{severity:"warning",code:"menu_item_url_missing_protocol",message:`"${l}" link should start with https://, http://, mailto:, or tel: for reliable email client support.`,location:a(l),blockId:t.id??null}):C(n,{severity:"warning",code:"menu_invalid_url",message:`"${l}" link URL is not valid. Use a full URL starting with https://example.com.`,location:a(l),blockId:t.id??null})}),0===o.length&&C(n,{severity:"info",code:"menu_no_items",message:"Menu block has no items.",location:S(e,"menu",void 0),blockId:t.id??null})}(t,e,n);break;case"social_link":I(t,e,n);break;case"raw_html":!function(t,e,n){const o=t.html;null!=o&&""!==String(o).trim()||C(n,{severity:"info",code:"raw_html_empty",message:"HTML block has no custom markup; export will include an empty wrapper.",location:S(e,"raw_html",void 0),blockId:t.id??null})}(t,e,n);break;case"text":B(t,e,n,"text",r);break;case"heading":B(t,e,n,"heading",r)}})}function N({blockList:t,bodySettings:e,aiContentRefs:n={}}){const o=[];return w(e,o),U(Array.isArray(t)?t:[],[],o,e,n),o}function E(){const t="undefined"!=typeof window&&null!=window?window:"undefined"!=typeof global&&null!=global?global:void 0;if(!t)return;const e=t.Image;return"function"==typeof e?e:void 0}const M=/^\{\{\s*[\w.]+\s*\}\}$/;function R(t){if(null==t||""===String(t).trim())return null;const e=String(t).trim();if(function(t){return null!=t&&"string"==typeof t&&M.test(t.trim())}(e))return null;if(/^https?:\/\//i.test(e))return k(e,!1)?e:null;if(e.startsWith("//")){const t=`https:${e}`;return k(t,!1)?t:null}return null}function F(t,e=[],n=t?.length??0){const o=[];return Array.isArray(t)?(t.forEach((t,i)=>{if(!t||"object"!=typeof t)return;if(!0===t.hidden)return;const r=t.key;if("column"===r){const r=x(t,i,n),l=[...e,r],a=t.children;return void o.push(...F(a,l,a?.length??0))}if("content"===r){const r=n>1?`Column ${i+1} of ${n}`:null,l=r?[...e,r]:e,a=t.children;return void o.push(...F(a,l,a?.length??0))}if("image"===r){const n=R(t.src);n&&o.push({url:n,location:S(e,"image",void 0),blockId:t.id??null})}}),o):o}function j(t,e=12e3){const n=E();if(!n)return Promise.resolve(!1);const o=String(t).trim();return o?new Promise(t=>{const i=new n;let r=!1;const l=e=>{r||(r=!0,clearTimeout(a),i.onload=null,i.onerror=null,t(e))},a=setTimeout(()=>l(!1),e);i.onload=()=>l(!0),i.onerror=()=>l(!1);try{i.src=o}catch{l(!1)}}):Promise.resolve(!1)}async function D(t,e={}){const{timeoutMs:n=12e3,concurrent:o=6}=e;if(!E())return[];const i=F(Array.isArray(t)?t:[]);if(0===i.length)return[];const r=new Map;for(const t of i)r.has(t.url)||r.set(t.url,[]),r.get(t.url).push(t.location);const l=[...r.keys()],a=new Map;let s=0;const c=Math.max(1,Math.min(o,l.length));await Promise.all(Array.from({length:c},()=>async function(){for(;s<l.length;){const t=s++,e=l[t],o=await j(e,n);a.set(e,o)}}()));const d=[];for(const[t,e]of r)if(!0!==a.get(t))for(const n of e)d.push({severity:"warning",code:"image_url_not_loadable",message:"Image URL could not be loaded or previewed; the link may be broken, expired, or blocked.",location:n,blockId:i.find(e=>e.url===t&&e.location===n)?.blockId??null});return d}async function z(t,e){return[...N(t),...await D(t?.blockList??[],e)]}var W={global:[{key:"CustomerName",token:"{{CustomerName}}",label:"Customer Name",labelKey:"variable_customer_name",type:"text",fallback:"Customer",source:"derived"},{key:"BrandName",token:"{{BrandName}}",label:"Brand Name",labelKey:"variable_brand_name",type:"text",fallback:"Company Name",source:"companyContext.name"},{key:"Tagline",token:"{{Tagline}}",label:"Tagline",labelKey:"variable_tagline",type:"text",fallback:"Your tagline here",source:"brandContext.tagline"},{key:"LogoUrl",token:"{{LogoUrl}}",label:"BrandLogo",labelKey:"variable_image_logo",type:"image",fallback:"https://via.placeholder.com/150x50/ffffff/333333?text=Logo",source:"brandContext.logo_url"},{key:"Website",token:"{{Website}}",label:"Website",labelKey:"variable_website",type:"text",fallback:"www.example.com",source:"companyContext.website"},{key:"Address",token:"{{Address}}",label:"Address",labelKey:"variable_address",type:"text",fallback:"",source:"companyContext.address"}],product:[{key:"ProductName",token:"{{ProductName}}",label:"Product Name",labelKey:"variable_product_name",type:"text",fallback:"Product Name",source:"content.products[].name"},{key:"ProductDescription",token:"{{ProductDescription}}",label:"Product Description",labelKey:"variable_product_description",type:"text",fallback:"Product description goes here.",source:"content.products[].description"},{key:"ProductImage",token:"{{ProductImage}}",label:"Product Image URL",labelKey:"variable_product_image",type:"image",fallback:"https://via.placeholder.com/300x300/eeeeee/666666?text=Product",source:"content.products[].image"},{key:"ProductLink",token:"{{ProductLink}}",label:"Product Link",labelKey:"variable_product_link",type:"url",fallback:"https://www.example.com",source:"content.products[].link"},{key:"ProductPrice",token:"{{ProductPrice}}",label:"Product Price (Amount)",labelKey:"variable_product_price",type:"number",fallback:"0",source:"content.products[].price.amount"},{key:"ProductCurrency",token:"{{ProductCurrency}}",label:"Product Currency",labelKey:"variable_product_currency",type:"text",fallback:"USD",source:"content.products[].price.currency"},{key:"ProductOldPrice",token:"{{ProductOldPrice}}",label:"Product Old Price",labelKey:"variable_product_old_price",type:"number",fallback:"0",source:"content.products[].old_price"},{key:"ProductNewPrice",token:"{{ProductNewPrice}}",label:"Product New Price",labelKey:"variable_product_new_price",type:"number",fallback:"0",source:"content.products[].new_price"},{key:"ProductPriceDisplay",token:"{{ProductPriceDisplay}}",label:"Product Price Display",labelKey:"variable_product_price_display",type:"text",fallback:"USD 0",source:"derived"}],discount:[{key:"DiscountValue",token:"{{DiscountValue}}",label:"Discount Value",labelKey:"variable_discount_value",type:"text",fallback:"20%",source:"content.discount.value"},{key:"DiscountCode",token:"{{DiscountCode}}",label:"Discount Code",labelKey:"variable_discount_code",type:"text",fallback:"SAVE20",source:"content.discount.code"},{key:"ValidUntil",token:"{{ValidUntil}}",label:"Valid Until",labelKey:"variable_valid_until",type:"date",fallback:"12-31-2025",source:"content.discount.valid_until"}]};const O="CustomerName",K="DiscountValue",H="DiscountCode",G="ValidUntil",V="CompanyName",J="Address",Z="Website",Y="BrandName",q="LogoUrl",X="Tagline",Q="HeroBanner",tt="FooterBanner",et="NavLabel",nt="NavUrl",ot="ProductName",it="ProductDescription",rt="ProductImage",lt="ProductLink",at="ProductPrice",st="ProductCurrency",ct="ProductOldPrice",dt="ProductNewPrice",ut="ProductPriceDisplay",mt="CTALabel",pt="CTAUrl",gt=new Set([ct,dt]);let ft=W;function yt(t,e=ft){return e&&Array.isArray(e[t])?e[t].map(t=>{return{...t,token:t.token||(e=t.key,`{{${e}}}`)};var e}):[]}let bt=[],kt=[],ht=[];!function(){bt=yt("global",ft),kt=yt("product",ft),ht=yt("discount",ft),[...bt,...kt,...ht].reduce((t,e)=>(t[e.key]=e,t),{}),ht.map(t=>({variableKey:t.key,labelKey:t.labelKey}));const t=kt.filter(t=>!gt.has(t.key));t.map(t=>({variableKey:t.key,labelKey:t.labelKey})),bt.map(t=>({value:t.token,label:t.label,key:t.key,labelKey:t.labelKey,source:t.source,type:t.type})),ht.map(t=>({value:t.token,label:t.label,key:t.key,labelKey:t.labelKey,source:t.source,type:t.type})),t.map(t=>({value:t.token,label:t.label,key:t.key,labelKey:t.labelKey,source:t.source,type:t.type}))}();const $t={[O]:"User",[K]:"20%",[H]:"SAVE20",[G]:"12-31-2025",[V]:"Company Name",[Y]:"Company Name",[J]:"",[Z]:"www.example.com",[q]:"https://via.placeholder.com/150x50/ffffff/333333?text=Logo",[X]:"Your tagline here",[Q]:"https://via.placeholder.com/600x200/eeeeee/666666?text=Hero",[tt]:"https://via.placeholder.com/600x100/eeeeee/666666?text=Footer",[et]:"Link",[nt]:"https://www.example.com",[ot]:"Product Name",[it]:"Product description goes here.",[rt]:"https://via.placeholder.com/300x300/eeeeee/666666?text=Product",[lt]:"https://www.example.com",[at]:"0",[st]:"USD",[ct]:"0",[dt]:"0",[ut]:"$0.00 USD",[mt]:"Shop Now",[pt]:"www.example.com"};function xt(t){return null==t||"string"!=typeof t?"":t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}const vt=new Set([ut]);function St(t,e,n={}){if(null==t||"string"!=typeof t)return"";const o=t.replace(/\{\{(\w+)\}\}/g,(t,o)=>{const i=Tt(e,o,n);return vt.has(o)?i:xt(i)});return null==(i=o)||"string"!=typeof i?i:i.replace(/^(<p[^>]*>\s*(?:<br\s*\/?>| )?\s*<\/p>\s*)+/i,"");var i}function wt(t){return $t[t]??"—"}const Ct=/^\{\{\s*[\w.]+\s*\}\}$/;function _t(t,e,{allowEmpty:n=!1}={}){if(null==t)return n?"":wt(e);const o=String(t).trim();return""===o?n?"":wt(e):function(t){return"string"==typeof t&&Ct.test(t.trim())}(o)?wt(e):o}const At={USD:"en-US",CAD:"en-CA",EUR:"de-DE",GBP:"en-GB",AUD:"en-AU",NZD:"en-NZ",SGD:"en-SG",INR:"en-IN",JPY:"ja-JP",CNY:"zh-CN",BDT:"bn-BD",AED:"ar-AE",SAR:"ar-SA"};function Lt(t){return function(t){return"string"==typeof t&&/^[A-Za-z]{3}$/.test(t.trim())}(t)?String(t).trim().toUpperCase():"USD"}function Pt(t,e){const n=function(t){if(null==t)return null;const e=String(t).replace(/,/g,"").trim();if(""===e)return null;const n=Number(e);return Number.isFinite(n)?n:null}(t);if(null==n)return null;const o=Lt(e),i=function(t){return At[t]??null}(o);if(!i)return null;const r=function(t){if(null==t)return 0;const e=String(t).trim().replace(/,/g,"");if(!e.includes("."))return 0;const[,n=""]=e.split(".");return Math.max(0,n.length)}(t);try{return`${new Intl.NumberFormat(i,{style:"currency",currency:o,minimumFractionDigits:r,maximumFractionDigits:r}).format(n)} ${o}`}catch{return null}}function Tt(t,e,n={}){if(!t)return wt(e);const{columnIndex:o,columnProduct:i}=n;let r=i;switch(!r&&t.content?.products&&"number"==typeof o&&(r=t.content.products[o]||null),e){case O:return wt(O);case K:return _t(t.content?.discount?.value,K);case H:return _t(t.content?.discount?.code,H);case G:return _t(t.content?.discount?.valid_until,G);case V:case Y:return _t(t.companyContext?.name,e);case J:return _t(t.companyContext?.address,J,{allowEmpty:!0});case Z:return _t(t.companyContext?.website,Z);case q:return _t(t.brandContext?.logo_url,q);case X:return _t(t.brandContext?.tagline,X);case Q:return _t(t.brandContext?.heroBanner,Q);case tt:return _t(t.brandContext?.footerBanner,tt);case et:case nt:return wt(e);case ot:return _t(r?.name,ot);case it:{const t=function(t){if(null==t)return"";const e=String(t).trim();if(!e)return"";const n=e.toLowerCase();return"none"===n||"null"===n||"undefined"===n?"":e}(r?.description);return t?_t(t,it,{allowEmpty:!0}):""}case rt:return _t(r?.image,rt);case lt:return _t(r?.link,lt);case at:return null!=r?.price&&"number"==typeof r.price||null!=r?.price&&"string"==typeof r.price?String(r.price):null!=r?.new_price?String(r.new_price):wt(at);case st:return _t(r?.currency,st);case ct:return _t(r?.old_price,ct);case dt:return null!=r?.new_price?_t(r.new_price,dt):null!=r?.price?_t(r.price,dt):wt(dt);case ut:{const t=Lt(r?.currency),e=null!=r?.price?r.price:r?.new_price,n=null!=r?.old_price||null!=r?.new_price,o=null!=r?.old_price?r.old_price:null,i=null!=r?.new_price?r.new_price:null!=r?.price?r.price:null;if(n&&(null!=o||null!=i)){const e=Pt(o,t),n=Pt(i,t),r=null!=(null!=e?e:null!=o?String(o):null)?xt(null!=e?e:null!=o?String(o):""):"";return[""!==r?`<span style="text-decoration: line-through;">${r}</span>`:"",null!=(null!=n?n:null!=i?String(i):null)?xt(null!=n?n:null!=i?String(i):""):""].filter(Boolean).join(" ")||wt(ut)}const l=Pt(e,t);return null!=l?xt(l):null!=e?xt(String(e)):wt(ut)}case mt:{const e=t.content?.cta?.text;return _t(e,mt)}case pt:{const e=t.content?.cta?.url;return _t(null!=e?e:t.companyContext?.website,pt)}default:return wt(e)}}function Bt(t,e,n={}){if(!t||!e)return t;const{useImportant:o=!1}=n,i=String(e).trim();if(!i)return t;const r=o?`color: ${i} !important`:`color: ${i}`;return String(t).replace(/<a\b([^>]*)>/gi,(t,e)=>{const n=e.match(/\sstyle\s*=\s*"([^"]*)"/i);if(n){const t=(n[1]||"").replace(/\s*color\s*:\s*[^;]+(!important)?\s*;?/gi,"").replace(/;\s*;/g,";").replace(/^\s*;|;\s*$/g,"").trim(),o=`${t?`${t}; `:""}${r};`;return`<a${e.replace(n[0],` style="${o}"`)}>`}const o=e.match(/\sstyle\s*=\s*'([^']*)'/i);if(o){const t=(o[1]||"").replace(/\s*color\s*:\s*[^;]+(!important)?\s*;?/gi,"").replace(/;\s*;/g,";").replace(/^\s*;|;\s*$/g,"").trim(),n=`${t?`${t}; `:""}${r};`;return`<a${e.replace(o[0],` style='${n}'`)}>`}return`<a${e} style="${r};">`})}const It=[{name:"Roboto",fallback:"Arial, sans-serif"},{name:"Open Sans",fallback:"Arial, sans-serif"},{name:"Lato",fallback:"Arial, sans-serif"},{name:"Montserrat",fallback:"Arial, sans-serif"},{name:"Poppins",fallback:"Arial, sans-serif"},{name:"Merriweather",fallback:"Georgia, serif"},{name:"Playfair Display",fallback:"Georgia, serif"},{name:"Cormorant Garamond",fallback:"Garamond, 'Times New Roman', serif"},{name:"Source Sans 3",fallback:"Arial, sans-serif"},{name:"Inter",fallback:"Arial, sans-serif"},{name:"Nunito",fallback:"Arial, sans-serif"},{name:"Nunito Sans",fallback:"Arial, sans-serif"},{name:"Raleway",fallback:"Arial, sans-serif"},{name:"Rubik",fallback:"Arial, sans-serif"},{name:"Work Sans",fallback:"Arial, sans-serif"},{name:"DM Sans",fallback:"Arial, sans-serif"},{name:"Manrope",fallback:"Arial, sans-serif"},{name:"Outfit",fallback:"Arial, sans-serif"},{name:"Plus Jakarta Sans",fallback:"Arial, sans-serif"},{name:"IBM Plex Sans",fallback:"Arial, sans-serif"},{name:"IBM Plex Serif",fallback:"Georgia, serif"},{name:"Noto Sans",fallback:"Arial, sans-serif"},{name:"Noto Serif",fallback:"Georgia, serif"},{name:"PT Sans",fallback:"Arial, sans-serif"},{name:"PT Serif",fallback:"Georgia, serif"},{name:"Ubuntu",fallback:"Arial, sans-serif"},{name:"Fira Sans",fallback:"Arial, sans-serif"},{name:"Barlow",fallback:"Arial, sans-serif"},{name:"Quicksand",fallback:"Arial, sans-serif"},{name:"Libre Baskerville",fallback:"Georgia, serif"},{name:"Libre Franklin",fallback:"Arial, sans-serif"},{name:"Crimson Pro",fallback:"Georgia, serif"},{name:"Lora",fallback:"Georgia, serif"},{name:"Space Grotesk",fallback:"Arial, sans-serif"},{name:"Archivo",fallback:"Arial, sans-serif"},{name:"Mulish",fallback:"Arial, sans-serif"},{name:"Figtree",fallback:"Arial, sans-serif"},{name:"Be Vietnam Pro",fallback:"Arial, sans-serif"},{name:"Sora",fallback:"Arial, sans-serif"},{name:"Josefin Sans",fallback:"Arial, sans-serif"}];function Ut(t){return`https://fonts.googleapis.com/css2?family=${(t=>String(t).trim().replace(/\s+/g,"+"))(t)}:wght@400;700&display=swap`}function Nt(t){if(!t)return"";const e=String(t).split(",")[0];return String(e??"").trim().replace(/^['"]|['"]$/g,"")}function Et(t){const e=String(t.name||"").trim(),n=String(t.url||"").trim();if(!e||!n)return"";const o=t.format?` format('${t.format}')`:"",i=t.weight?`font-weight:${t.weight};`:"",r=t.style?`font-style:${t.style};`:"";return`@font-face{font-family:${(t=>/\s/.test(String(t||""))?`'${String(t).replace(/'/g,"\\'")}'`:String(t))(e)};src:url('${n}')${o};${i}${r}}`}function Mt(t,e,n){const o=function(t,e){const n=new Set,o=t=>{null!=t&&""!==String(t).trim()&&n.add(String(t).trim())};o(e?.styles?.fontFamily);const i=t=>{Array.isArray(t)&&t.forEach(t=>{t&&"object"==typeof t&&(o(t?.styles?.desktop?.fontFamily),o(t?.styles?.mobile?.fontFamily),"image"===t.key&&Array.isArray(t.overlayItems)&&t.overlayItems.forEach(t=>{t&&"object"==typeof t&&o(t.fontFamily)}),Array.isArray(t.children)&&i(t.children))})};return i(t),[...n]}(t,e),i=new Set;o.forEach(t=>{const e=function(t){const e=Nt(t),n=It.find(t=>t.name.toLowerCase()===e.toLowerCase());return n?Ut(n.name):null}(t);e&&i.add(e)});const r=(Array.isArray(n?.brandContext?.customFonts)?n.brandContext.customFonts:[]).map(Et).filter(Boolean);return[...[...i].map(t=>`@import url('${t}');`),...r].join("\n")}function Rt(t){const e=String(t?.image||"").toLowerCase(),n=String(t?.title||"").toLowerCase().trim();return e.includes("/tc-x.svg")||e.includes("/brand-x.svg")||e.includes("/icons/x.svg")||e.includes("simple-icons")&&e.includes("/x.svg")||"x"===n||"twitter"===n}const Ft=["default","white","black","gray"];function jt(t){if(!t||"object"!=typeof t)return{};const{padding:e,paddingTop:n,paddingRight:o,paddingBottom:i,paddingLeft:r,...l}=t;return l}const Dt={small:21,medium:24,large:32},zt="https://unpkg.com/@tabler/icons@3.24.0/icons/outline",Wt={facebook:"brand-facebook",x:"brand-x",instagram:"brand-instagram",linkedin:"brand-linkedin",tiktok:"brand-tiktok",youtube:"brand-youtube",pinterest:"brand-pinterest"};function Ot(t){if(!t)return null;const e=Wt[t];return e?`${zt}/${e}.svg`:null}function Kt(t){if(!t)return null;if(Rt(t))return"x";const e=String(t.image||"").toLowerCase(),n=String(t.title||"").toLowerCase();return e.includes("facebook")||n.includes("facebook")?"facebook":e.includes("instagram")||n.includes("instagram")?"instagram":e.includes("linkedin")||n.includes("linkedin")?"linkedin":e.includes("tiktok")||n.includes("tiktok")?"tiktok":e.includes("youtube")||n.includes("youtube")?"youtube":e.includes("pinterest")||n.includes("pinterest")?"pinterest":null}const Ht="https://s.magecdn.com/social";const Gt={facebook:"tc-facebook.svg",x:"tc-x.svg",instagram:"tc-instagram.svg",linkedin:"tc-linkedin.svg",tiktok:"tc-tiktok.svg",youtube:"tc-youtube.svg",pinterest:"tc-pinterest.svg"};function Vt(t){const e=String(t||"").toLowerCase();return Ot("twitter"===e?"x":e)}function Jt(t){const e=function(t){switch(t){case"white":return"brightness(0) invert(1)";case"black":return"brightness(0)";case"gray":return"brightness(0) opacity(0.55)";default:return""}}(t);return e?{filter:e}:{}}function Zt(t,e,n){const o=Number(n)||Dt.medium,i={width:o,height:o,objectFit:"contain",display:"block",verticalAlign:"middle",flexShrink:0},r=e&&"default"!==e?e:"default",l=String(t?.image||"").trim(),a=function(t){return Ot(Kt(t))}(t),s=function(t){const e=Kt(t);if(!e)return null;const n=Gt[e];return n?`${Ht}/${n}`:null}(t);if(l&&!function(t){const e=String(t||"").trim().toLowerCase();return!(!e||!e.startsWith(String(Ht).toLowerCase())&&!e.startsWith(String(zt).toLowerCase())&&!e.includes("unpkg.com/@tabler/icons"))}(l))return{src:l,style:i};if("default"===r)return s?{src:s,style:i}:{src:l,style:i};if(a){if("white"===r)return{src:a,style:{...i,filter:"brightness(0) invert(1)"}};if("gray"===r)return{src:a,style:{...i,filter:"brightness(0) opacity(0.55)"}};if("black"===r)return{src:a,style:i}}return l?{src:l,style:{...i,...Jt(r)}}:{src:"",style:i}}function Yt(t,e,n){const{src:o,style:i}=Zt(t,e,n),r=Number(n)||Dt.medium,l=[`width:${r}px`,`height:${r}px`,"object-fit:contain","display:block","vertical-align:middle"];return"brightness(0) opacity(0.55)"===i.filter?l.push("opacity:0.55"):i.filter&&l.push(`filter:${i.filter}`),null!=i.opacity&&l.push(`opacity:${i.opacity}`),{src:o,styleAttr:l.join(";")}}const qt="ee_cb";function Xt(t){const e=String(t??"").trim();if(!e)return e;try{const t="undefined"!=typeof window&&window.location?.origin?window.location.origin:"http://localhost",n=new URL(e,t);n.searchParams.delete(qt);let o=n.toString();return o.endsWith("?")&&(o=o.slice(0,-1)),o}catch{return e.replace(new RegExp(`[?&]${qt}=\\d+`,"g"),"").replace(/\?&/g,"?").replace(/&&+/g,"&").replace(/[?&]$/,"")}}function Qt(t){const e=t??{};if(!1===e.containerBackgroundEnabled)return"";const n=Xt(e.containerBackgroundImage);if(!n||!String(n).trim())return"";return`background-image:url("${String(n??"").trim().replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"").replace(/\r/g,"")}");background-size:${{cover:"cover",contain:"contain",fill:"100% 100%"}[e.containerBackgroundSize||"cover"]||"cover"};background-position:${e.containerBackgroundPosition||"center center"};background-repeat:no-repeat;`}const te=["tl","tc","tr","ml","mc","mr","bl","bc","br"],ee={tl:{top:"10%",left:"8%",transform:"translate(0, 0)",textAlign:"left"},tc:{top:"10%",left:"50%",transform:"translate(-50%, 0)",textAlign:"center"},tr:{top:"10%",right:"8%",transform:"translate(0, 0)",textAlign:"right"},ml:{top:"50%",left:"8%",transform:"translate(0, -50%)",textAlign:"left"},mc:{top:"50%",left:"50%",transform:"translate(-50%, -50%)",textAlign:"center"},mr:{top:"50%",right:"8%",transform:"translate(0, -50%)",textAlign:"right"},bl:{bottom:"10%",left:"8%",transform:"translate(0, 0)",textAlign:"left"},bc:{bottom:"10%",left:"50%",transform:"translate(-50%, 0)",textAlign:"center"},br:{bottom:"10%",right:"8%",transform:"translate(0, 0)",textAlign:"right"}};function ne(t){const e=String(t??"bc").toLowerCase();return te.includes(e)?e:"bc"}function oe(){return"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})}const ie=[{key:"facebook",image:Vt("facebook"),title:"Facebook"},{key:"twitter",image:Vt("twitter"),title:"X"},{key:"instagram",image:Vt("instagram"),title:"Instagram"},{key:"linkedin",image:Vt("linkedin"),title:"LinkedIn"},{key:"tiktok",image:Vt("tiktok"),title:"TikTok"},{key:"youtube",image:Vt("youtube"),title:"YouTube"}];function re(t){const e=t?.socialPlatformKey;if(e&&"string"==typeof e&&ie.some(t=>t.key===e))return e;if(Rt(t))return"twitter";const n=String(t?.title??"").trim().toLowerCase(),o=String(t?.image??"").trim();for(const t of ie){if(n&&n===t.title.toLowerCase())return t.key;if("twitter"===t.key&&n&&("twitter"===n||"tweet"===n||"tw"===n))return"twitter";if(o&&o===t.image)return t.key}return null}function le(t,e){if(null==t||""===t)return"";const n=String(t);return e?n.replace(/\{\{(\w+)\}\}/g,(t,n)=>{const o=Tt(e,n,{});if(null==o)return`{{${n}}}`;const i=String(o);return i.startsWith("{{")?`{{${n}}}`:i}):n}function ae(t,e){if(null==t||""===t)return"";const n=String(t);return e?n.replace(/\{\{(\w+)\}\}/g,(t,n)=>{const o=Tt(e,n,{}),i=null!=o?String(o).trim():"";return!i||"—"===i||i.startsWith("{{")?t:i}):n}function se(t){return(Array.isArray(t)&&0!==t.length?t:function(t,e){const n=e&&"object"==typeof e&&!Array.isArray(e)?e:{},o=Array.isArray(t)?t:[],i=new Map,l=[];for(const t of o){const e=re(t);e?i.set(e,t):l.push(t)}return[...ie.map(t=>{const e=i.get(t.key),o=null!=n[t.key]?r(String(n[t.key]).trim()):"",l=null!=e?.linkURL?String(e.linkURL).trim():"",a=l?r(l):"",s=o||a||"";return{id:e?.id??oe(),image:e?.image||t.image,title:e?.title||t.title,linkURL:s,socialPlatformKey:t.key}}),...l]}([],{})).map(t=>({id:t?.id,image:t?.image??"",title:t?.title??"",linkURL:t?.linkURL??"",socialPlatformKey:t?.socialPlatformKey}))}function ce(t){return Array.isArray(t)&&0!==t.length?t.map(t=>({id:t?.id,label:t?.label??"",url:t?.url??"",target:"_blank"===t?.target?"_blank":"_self"})):[{id:oe(),label:"Privacy",url:"#",target:"_self"},{id:oe(),label:"Terms",url:"#",target:"_self"}]}const de=t=>String(t??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),ue=(t,e)=>{if(null==t||""===t)return e;if("number"==typeof t)return t;const n=parseInt(String(t).replace(/px/gi,""),10);return Number.isFinite(n)?n:e};function me(t,e,n){const o=t,i=o.styles?.desktop??{},r=Boolean(o.showBrand??!0),l=Boolean(o.showTagline??!0),s=Boolean(o.footerShowLogo??!1),c=function(t,e){const n="string"==typeof t?t.trim():String(t??"").trim();if(!n)return"";const o=/^\{\{(\w+)\}\}$/.exec(n);if(o&&e){const t=Tt(e,o[1],{});if(null!=t&&""!==String(t).trim()&&!String(t).startsWith("{{"))return String(t).trim()}return n}(o.footerLogoSrc??"",n),d=le(String(o.footerLogoAlt??"Logo").trim()||"Logo",n).trim()||"Logo",u=o.footerLogoLink??"",m=ue(o.footerLogoMaxWidthPercent,30),p=ue(o.footerLogoPaddingPx,24),g=Boolean(o.showAddress??!0),f=Boolean(o.showUnsubscribe??!0),y=Boolean(o.showSocial??!1),b=Boolean(o.showSecondaryLinks??!1),k=Boolean(o.showCopyright??!0),h=le(o.brandName??"",n),$=le(o.brandTagline??"",n).trim(),x=le(o.address??"",n),v=le(o.copyrightText??"",n),S=o.unsubscribeUrl||"{{unsubscribe_url}}",w=null!=o.unsubscribeBodyText&&""!==String(o.unsubscribeBodyText).trim()?String(o.unsubscribeBodyText):"You are receiving this email because you subscribed.",{unsubscribeLinkLabel:C}=function(t){let e=null!=t?.unsubscribeLinkLabel&&""!==String(t.unsubscribeLinkLabel).trim()?String(t.unsubscribeLinkLabel).trim():"";const n=String(t?.unsubscribeText??"").trim();if(!e&&n){const t=n.split(/\s*[·•]\s*/);e=t[0]?.trim()||""}return{unsubscribeLinkLabel:e||"Unsubscribe"}}(o),_=ce(o.secondaryLinks),A=se(o.footerSocialList),L=i.color??"#737373",P=null!=i.linkColor&&""!==String(i.linkColor).trim()?String(i.linkColor).trim():L,T=ue(i.fontSize,12),B=i.textAlign??"center",I=ue(i.paddingTop,28),U=ue(i.paddingRight,24),N=ue(i.paddingBottom,28),E=ue(i.paddingLeft,24),M=function(t){const e=null!=t?String(t).trim():"";return e&&"transparent"!==e.toLowerCase()?e:"#ffffff"}(i.contentBackground),R=Boolean(o.showDivider??!1),F=de(o.dividerColor??"#374151"),j=Boolean(o.showBorderTop??!1),D=ue(o.borderTopWidth,1),z=o.borderTopStyle??"solid",W=de(o.borderTopColor??"#e5e7eb"),O=j&&D>0?`${D}px ${z} ${W}`:"",K=e?.width??"100%",H=e?.styleConfig?.mobile?` class="${e.styleConfig.className}"`:"",G=e?.styleConfig?.desktop??"",V=`margin:0;color:${de(L)};font-size:${T}px;line-height:1.5;font-family:Arial,sans-serif;text-align:${de(B)};`,J=`color:${de(P)};text-decoration:underline;`,Z=[];let Y="";if(R&&(Y+=`<div style="border-top:1px solid ${F};margin-bottom:14px;width:100%;font-size:0;line-height:0;"> </div>`),s&&c.trim()){const t="left"===B?"left":"right"===B?"right":"center",e=`<img src="${de(c)}" alt="${de(d)}" width="570" style="max-width:${m}%;height:auto;display:inline-block;padding:${p}px;vertical-align:middle;border:0;outline:none;text-decoration:none;"/>`,o=a(ae(u,n)),i=o?`<a href="${de(o)}" target="_blank" rel="noopener noreferrer" style="text-decoration:none;line-height:0;display:inline-block;">${e}</a>`:e;Y+=`<div style="text-align:${de(t)};margin-bottom:10px;line-height:0;">${i}</div>`}if(r&&h.trim()&&(Y+=`<p style="${V}font-weight:600;margin:0 0 10px 0;">${de(h)}</p>`),l&&$&&(Y+=`<p style="${V}margin:0 0 10px 0;opacity:0.92;">${de($)}</p>`),g&&x.trim()&&(Y+=`<p style="${V}margin:0 0 10px 0;">${de(x)}</p>`),y){const t=Array.isArray(A)?A.filter(Boolean):[];if(t.length>0){const e=Dt.medium,o=t.map(t=>{const o=a(ae(t.linkURL,n),{allowMailtoTel:!1}),{src:i,styleAttr:r}=Yt(t,"default",e),l=`<img src="${de(i)}" alt="" width="${e}" height="${e}" style="${r}" border="0"/>`,s="text-decoration:none;display:inline-block;vertical-align:middle;line-height:0;margin:0 6px;";return o?`<a href="${de(o)}" target="_blank" rel="noopener noreferrer" style="${s}">${l}</a>`:`<span style="${s}">${l}</span>`}).join(""),i="left"===B?"left":"right"===B?"right":"center";Y+=`<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%" style="width:100%;border-collapse:collapse;margin-bottom:10px;"><tr><td align="${i}" style="text-align:${i};font-size:0;line-height:0;">${o}</td></tr></table>`}}if(f){const t=de(le(w,n)),e=de(le(C,n)),o=de(a(ae(S,n)));let i=`<p style="${V}margin:0 0 10px 0;word-break:break-word;">`;t&&(i+=`${t} `),i+=`<a href="${o}" style="${J}">${e}</a>`,i+="</p>",Y+=i}if(b&&_.length>0){let t=`<p style="${V}margin:0 0 10px 0;word-break:break-word;">`;_.forEach((e,o)=>{o>0&&(t+='<span style="padding:0 6px;">·</span>');const i=de(le(e.label,n)),r=de(a(ae(e.url,n))),l="_blank"===e.target?' target="_blank" rel="noopener noreferrer"':"";t+=`<a href="${r}" style="${J}"${l}>${i||`#${o+1}`}</a>`}),t+="</p>",Y+=t}if(k&&v.trim()){const t=Math.max(10,T-1);Y+=`<p style="${V}font-size:${t}px;margin:0;opacity:0.9;">${de(v)}</p>`}var q;return Z.push(`<td${H} style="width:${K};${G}">${q=Y,`<table role="presentation" cellpadding="0" cellspacing="0" border="0" width="100%" style="width:100%;"><tr><td align="${de(B)}" style="${V}text-align:${de(B)};background-color:${de(M)};padding:${I}px ${U}px ${N}px ${E}px;${O?`border-top:${O};`:""}">${q}</td></tr></table>`}</td>`),Z.join("")}function pe(t){if(null==t)return"";const e=String(t).trim().toLowerCase();return/^#[0-9a-f]{3}$/.test(e)?`#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}`:e}const ge=new Set(["fontWeight","opacity","zIndex"]),fe=t=>String(t??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),ye=t=>fe(t).replace(/"/g,""").replace(/'/g,"'"),be=(t,e="#")=>{if(null==t)return e;const n=String(t).trim();if(!n)return e;const o=n.toLowerCase();return/^\s*(?:javascript|vbscript):/i.test(o)||/^\s*data:/i.test(o)?e:/^https?:\/\//i.test(n)||/^mailto:/i.test(n)||/^tel:/i.test(n)?n:n.startsWith("//")?`https:${n}`:/^[a-z][a-z\d+.-]*:/i.test(n)?n:`https://${n.replace(/^\/+/,"")}`},ke=(t,e)=>{const n=new RegExp(/[A-Z]/g),o=t=>t.replace(n,t=>`-${t.toLowerCase()}`),i={desktop:e?.desktop??{},mobile:e?.mobile??{}};let r={className:t,desktop:"",mobile:""};for(let t of Object.entries(i.desktop))if(t[1]&&"contentBackground"!==t[0]&&"horizontalAlign"!==t[0]&&"containerBackgroundImage"!==t[0]&&"containerBackgroundSize"!==t[0]&&"containerBackgroundPosition"!==t[0]){const e="number"!=typeof t[1]||ge.has(t[0])?t[1]:t[1]+"px";r.desktop+=`${o(t[0])}:${e};`}if(Object.keys(i.mobile).length){let e="";for(let t of Object.entries(i.mobile))if(t[1]&&"contentBackground"!==t[0]&&"horizontalAlign"!==t[0]&&"containerBackgroundImage"!==t[0]&&"containerBackgroundSize"!==t[0]&&"containerBackgroundPosition"!==t[0]){const n="number"!=typeof t[1]||ge.has(t[0])?t[1]:t[1]+"px";e+=`${o(t[0])}:${n} !important;`}r.mobile+=`@media(max-width:620px){\n .${t} {\n ${e}\n }\n }`}return r};function he(t){if(!t||"object"!=typeof t)return{};const{marginLeft:e,marginTop:n,...o}=t;return o}function $e(t){const e=jt(t||{}),{linkColor:n,color:o,...i}=e,r=null!=n&&""!==String(n).trim()?String(n).trim():null,l=null!=o&&""!==String(o).trim()?String(o).trim():null,a=r??l;return null==a?i:{...i,color:a}}const xe=(t,e="",n=null)=>{const o=t.map((t,o)=>{let i={...t};const r=null!==n?`${n}-${o}`:`${o}`,l=t=>`e${r}-${t}`,a={desktop:t?.styles?.desktop??{},mobile:t?.styles?.mobile??{}},s="menu"===t.key?{desktop:$e(a.desktop),mobile:$e(a.mobile)}:"social_link"===t.key?{desktop:jt(a.desktop),mobile:jt(a.mobile)}:a;if(i.styleConfig=ke(l(t.key),s),i.contentStyles){const n={desktop:i.contentStyles?.desktop??{},mobile:i.contentStyles?.mobile??{}};let o=n;if(i.imageHostMarginStyleConfig=null,"image"===i.key){o={desktop:he(n.desktop),mobile:he(n.mobile)};const r={desktop:(n.desktop,{}),mobile:(n.mobile,{})};if(Object.keys(r.desktop).length||Object.keys(r.mobile).length){const n=ke(l(`${t.key}-hm`),r);i.imageHostMarginStyleConfig=n,n.mobile&&(e+=n.mobile)}}i.contentStyleConfig=ke(l(`${t.key}-c`),o),i.contentStyleConfig.mobile&&(e+=i.contentStyleConfig.mobile)}if("video"===i.key&&i.videoArea){const n={desktop:i.videoArea?.desktop??{},mobile:i.videoArea?.mobile??{}};i.videoAreaStyleConfig=ke(l(`${t.key}-va`),n),i.videoAreaStyleConfig.mobile&&(e+=i.videoAreaStyleConfig.mobile)}if(i.styleConfig.mobile&&(e+=i.styleConfig.mobile),t.hiddenOnMobile){const t=`@media(max-width:620px){.${i.styleConfig.className}{display:none !important;}}`;e+=t,i.styleConfig={...i.styleConfig,mobile:(i.styleConfig.mobile||"")+t}}if(s.desktop.contentBackground&&(i.contentStyleConfig||(i.contentStyleConfig={className:l(`${t.key}-c`),desktop:"",mobile:""}),i.contentStyleConfig.desktop+=`background-color:${s.desktop.contentBackground};`),s.mobile.contentBackground){i.contentStyleConfig||(i.contentStyleConfig={className:l(`${t.key}-c`),desktop:"",mobile:""});const n=`@media(max-width:620px){.${i.contentStyleConfig.className}{background-color:${s.mobile.contentBackground};}}`;i.contentStyleConfig.mobile=(i.contentStyleConfig.mobile||"")+n,e+=n}if("menu"===i.key){if("stack"===(t.mobileLayout??"stack")){const n=i.contentStyleConfig?.className??l(`${t.key}-c`);i.contentStyleConfig||(i.contentStyleConfig={className:n,desktop:"",mobile:""});const o=i.contentStyles?.desktop?.textAlign??i.contentStyles?.mobile?.textAlign??"center",r=String(o).toLowerCase(),a="left"===r?"flex-start":"right"===r?"flex-end":"center",s=["left","right","center","justify"].includes(r)?r:"center",c=t.linkGapPx,d=`@media(max-width:620px){\n.${n}{display:flex !important;flex-direction:column !important;align-items:${a} !important;flex-wrap:nowrap !important;}\n.${n}>span{display:none !important;}\n.${n}>a{display:block !important;width:100% !important;box-sizing:border-box !important;text-align:${s} !important;margin:0 0 ${"number"==typeof c&&Number.isFinite(c)&&c>=0?c:0}px 0 !important;}\n.${n}>a:last-child{margin-bottom:0 !important;}\n}`;i.contentStyleConfig.mobile=(i.contentStyleConfig.mobile||"")+d,e+=d}}if(t.children?.length){const{newBlockList:n,styles:o}=xe(t.children,"",r);e+=o,i.children=n}return{...i}});return{newBlockList:o,styles:e}};function ve(t){const e=t.contentStyleConfig?.desktop??"",n=function(t){const e=t.contentStyles?.desktop??{},n=t.contentStyles?.mobile??{},o=null!=e.textAlign&&""!==String(e.textAlign).trim()?e.textAlign:n.textAlign,i=null!=o&&""!==String(o).trim()?String(o).trim():"center";return"start"===i?"left":"end"===i?"right":i}(t);return/\btext-align\s*:/i.test(e)?e:`${e}text-align:${n};`}const Se=(t,e,n={},o=null)=>{let i=t.src||"";const r="string"==typeof t.src&&/^\{\{\s*[\w.]+\s*\}\}$/.test(t.src.trim())?t.src.trim():"";if(e&&r){const t=Tt(e,r.replace(/^\{\{\s*|\s*\}\}$/g,""),n);t&&!/^\{\{\s*[\w.]+\s*\}\}$/.test(String(t).trim())&&(i=t)}i=Xt(i);const l=ye(i),a=ye(t.alt||"Image"),s=null!=t.linkURL?String(t.linkURL).trim():"",c=Array.isArray(t.overlayItems)?t.overlayItems:[],u=c.some(t=>""!==String(t?.text??"").trim()),m=String(t.overlayText??"").trim(),p=Boolean(t.textOverlayEnabled)&&(u||""!==m)&&i,g=`${t.styleConfig?.desktop||""};max-width:100%;display:inline-block;vertical-align:top;`;let f=`<img src="${l}" alt="${a}" style="${g}" ${t.styleConfig?.mobile?`class="${t.styleConfig.className}"`:""}/>`;if(p){const e=function(t){const e=ne(t);return ee[e]}(ne(t.overlayPosition)),n=Object.entries({position:"absolute",...e,"z-index":"2","max-width":`${"number"==typeof t.overlayMaxWidth?t.overlayMaxWidth:100}%`,"box-sizing":"border-box","pointer-events":"none"}).map(([t,e])=>`${t}:${e};`).join(""),i="number"==typeof t.overlayPadding?t.overlayPadding:16,r=t.textShadowEnabled?"text-shadow:0 1px 3px rgba(0,0,0,0.55);":"";let s="";if(u){const e="number"==typeof t.overlayItemGap?t.overlayItemGap:8,n=c.filter(t=>String(t?.text??"").trim()).map(t=>{const e="number"==typeof t.fontSize?t.fontSize:16,n=ye(t.color||"#ffffff"),i=(t=>{switch(t){case"h1":case"h2":case"h3":return"700";case"subtitle":case"eyebrow":return"600";default:return"400"}})(t.kind),l=null!=t.fontFamily&&""!==String(t.fontFamily).trim()?String(t.fontFamily).trim():String(o?.styles?.fontFamily||"sans-serif").trim()||"sans-serif",a=ye(l),s=fe(String(t.text??""));return`<div style="color:${n};font-size:${e}px;font-weight:${i};line-height:1.35;font-family:${a};${r}">${s}</div>`});s=`<div style="display:flex;flex-direction:column;gap:${e}px;width:100%;padding:${i}px;">${n.join("")}</div>`}else{s=`<div style="color:${ye(t.overlayTextColor||"#ffffff")};font-size:${"number"==typeof t.overlayFontSize?t.overlayFontSize:18}px;font-weight:600;line-height:1.35;${t.overlayBoxBackground?`background-color:${ye(t.overlayBoxBackground)};padding:8px 12px;`:`padding:${i}px;`}${r}">${fe(m)}</div>`}f=`<div style="position:relative;display:inline-block;vertical-align:top;max-width:100%;overflow:hidden;line-height:0;">\n ${t.scrimEnabled?'<div style="position:absolute;left:0;top:0;width:100%;height:100%;z-index:1;pointer-events:none;background:linear-gradient(to top, rgba(0,0,0,0.65), rgba(0,0,0,0.12), transparent 55%);"></div>':""}\n <img src="${l}" alt="${a}" style="${g}position:relative;z-index:0;border-radius:0;" ${t.styleConfig?.mobile?`class="${t.styleConfig.className}"`:""}/>\n <div style="${n}">\n ${s}\n </div>\n </div>`}const y=d(t)&&""!==s?`<a href="${ye(be(s))}" target="_blank" rel="noopener noreferrer" style="text-decoration:none;display:inline-block;max-width:100%;">${f}</a>`:f,b=t.imageHostMarginStyleConfig,k=b&&(b.desktop||b.mobile)?`<div ${b.mobile?`class="${b.className}"`:""} style="display:inline-block;vertical-align:top;max-width:100%;${b.desktop||""}">${y}</div>`:y;return`<div ${t.contentStyleConfig.mobile?`class="${t.contentStyleConfig.className}"`:""} \n style="${ve(t)}">\n ${k}\n </div>`};const we="#2faade";function Ce(t){const e=String(t??"");return null!=(n=e)&&"string"==typeof n&&/<[a-zA-Z!/?]/.test(n.trim())?function(t){if(!t||!/<a\b/i.test(t))return t;const e=(t,e,n)=>{const o=(e[1]||"").replace(/\s*text-decoration(-line)?\s*:[^;]+;?/gi,"").replace(/^\s*;|;\s*$/g,"").trim(),i=(o?`${o}; `:"")+"text-decoration: none;",r='"'===n?` style="${i}"`:` style='${i}'`;return`<a${t.replace(e[0],r)}>`};return String(t).replace(/<a\b([^>]*)>/gi,(t,n)=>{const o=n.match(/\sstyle\s*=\s*"([^"]*)"/i);if(o)return e(n,o,'"');const i=n.match(/\sstyle\s*=\s*'([^']*)'/i);return i?e(n,i,"'"):`<a${n} style="text-decoration: none;">`})}(e):fe(e);var n}function _e(t){const e=t?.dynamicSelectedContent,n=t?.text??"";if(null==e)return String(n);const o=String(e);return""===o.trim()?String(n):o}const Ae=(t,e,n={})=>{let o=_e(t);e&&o&&(o=St(o,e,n));const i=t?.styles?.desktop??{},r=null!=i.linkColor&&""!==String(i.linkColor).trim();return o=Bt(o,r?String(i.linkColor).trim():we,{useImportant:r}),`<${t.type} ${t.styleConfig?.mobile?`class="${t.styleConfig.className}"`:""} \n style="${t.styleConfig?.desktop||""}">\n ${o}\n </${t.type}>`};const Le=(t,e,n={},o=null)=>{let i=t.text||"",r=t.linkURL||"";if(e){const o=i.match(/\{\{(\w+)\}\}/),l=t.labelVariable?t.labelVariable.replace(/^\{\{|\}\}$/g,"").trim():o?o[1]:void 0;if(l){const t=Tt(e,l,n);null==t||String(t).startsWith("{{")||(i=String(t))}if(t.urlVariable){const o=Tt(e,t.urlVariable.replace(/^\{\{|\}\}$/g,""),n);o&&!o.startsWith("{{")&&(r=String(o))}else{const t=String(r||"").trim().match(/^\{\{(\w+)\}\}$/);if(t){const o=Tt(e,t[1],n);o&&!String(o).startsWith("{{")&&(r=String(o))}}}const l=Ce(i),a=ye(be(r)),s=function(t){if(null==t||"object"!=typeof t)return"#111111";const e=t.brandContext,n=e&&"object"==typeof e?e.brand_color??e.brandColor??null:null,o=t.brandColor,i=("string"==typeof n&&""!==n.trim()?n:"string"==typeof o&&""!==o.trim()?o:null)??"#111111",r=String(i).trim();return""!==r?r:"#111111"}(e);let c=t.styleConfig.desktop||"";var d;!function(t,e){if(!function(t){return!(!t||"column"!==t.key||"product"!==t.containerType)&&"additional"!==t.productRole&&("image_left"===t.mainProductLayout||"image_stacked"!==t.mainProductLayout&&function(t){const e=t?.children?.[0]?.children?.[0];return"column"===e?.key&&"2-3"===e?.type}(t))}(e))return!1;const n=t.styles?.desktop?.backgroundColor;return null==n||""===String(n).trim()||pe(n)===pe("#111827")}(t,o)?(d=t.styles?.desktop?.backgroundColor,pe(d)===pe("#263d2d")&&(c=c.replace(/background-color:\s*[^;]+;?/gi,""))):c=c.replace(/background-color:\s*[^;]+;?/gi,"");const u=c.includes("background-color:")?"":`background-color:${s};`;return`<div ${t.contentStyleConfig.mobile?`class="${t.contentStyleConfig.className}"`:""} \n style="${t.contentStyleConfig.desktop}">\n <a ${t.styleConfig.mobile?`class="${t.styleConfig.className}"`:""} \n style="${c}${u}text-align:center;text-decoration:none;" target="_blank" rel="noopener noreferrer" href="${a}">${l}</a>\n </div>`};const Pe=t=>{const e=Array.isArray(t.list)?t.list.filter(Boolean):[];if(0===e.length)return"";const n=Boolean(t.showTextLabel),o=function(t){const e=t?.iconSize;if(e&&null!=Dt[e])return Dt[e];const n=Number(t?.imageWidth);return Number.isFinite(n)&&n>0?Math.round(n):Dt.medium}(t),i=Math.max(11,Math.round(.58*o)),r=function(t){const e="string"==typeof t?t:"gray";return Ft.includes(e)?e:"default"}(t.iconColor),l=t?.contentStyles?.desktop??{},s=l.textAlign||"center",c="justify"===s,d="right"===s?"right":"left"===s?"left":"center",u=l.columnGapPx,m="number"==typeof u&&Number.isFinite(u)&&u>=0?u:8,p=Math.max(0,Math.round(m/2)),g=t.styleConfig?.desktop||"",f=t.styleConfig?.mobile?` class="${t.styleConfig.className}"`:"",y=(t,e="")=>{const{title:l,linkURL:s}=t,c=a(s,{allowMailtoTel:!1}),{src:d,styleAttr:u}=Yt(t,r,o),m=n?u.replace(/display:\s*block/i,"display:inline-block"):u,p=`<img src="${ye(d)}" alt="${ye(l)}" width="${o}" height="${o}" style="${ye(m)}" border="0"${f}/>`,y=Rt(t)?"X":String(l??""),b=n?`<span style="font-size:${i}px;line-height:1.2;color:#525252;font-family:inherit;white-space:nowrap;display:inline-block;vertical-align:middle;margin-left:6px;">${fe(y)}</span>`:"",k=`text-decoration:none;display:inline-block;vertical-align:middle;line-height:0;${e}${g?`;${g}`:""}`;return c?`<a target="_blank" rel="noopener noreferrer" href="${ye(c)}" style="${k}">${p}${b}</a>`:`<span style="${k}">${p}${b}</span>`},b=`${t.contentStyleConfig?.desktop||""};text-align:${d};`,k=t.contentStyleConfig?.mobile?` class="${t.contentStyleConfig.className}"`:"";let h;if(c&&e.length>1){const t=(100/e.length).toFixed(4);h=`<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%" style="width:100%;border-collapse:collapse;"><tr>${e.map((n,o)=>{const i=0===o?"left":o===e.length-1?"right":"center";return`<td width="${t}%" style="width:${t}%;text-align:${i};vertical-align:middle;line-height:0;font-size:0;padding:0;">${y(n)}</td>`}).join("")}</tr></table>`}else h=e.map(t=>y(t,`margin:0 ${p}px;`)).join("");return`<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%" style="width:100%;border-collapse:collapse;"><tr><td${k} align="${d}" style="${b}">${h}</td></tr></table>`};const Te=(t,e,n,o,i,r)=>{let l="";const a={columnIndex:i??0,columnProduct:o?.columnProducts?.[r??0]??null};return t.forEach((t,s)=>{if("column"===t.key){const a=function(t){const e={...t?.desktop??{}},n=t?.mobile??{},o=String(e.containerBackgroundImage??"").trim(),i=String(n.containerBackgroundImage??"").trim();!o&&i&&(e.containerBackgroundImage=n.containerBackgroundImage,null!=n.containerBackgroundSize&&(e.containerBackgroundSize=n.containerBackgroundSize),null!=n.containerBackgroundPosition&&(e.containerBackgroundPosition=n.containerBackgroundPosition),void 0!==n.containerBackgroundEnabled&&(e.containerBackgroundEnabled=n.containerBackgroundEnabled));const r=e.minHeight,l=n.minHeight;return null!=r&&""!==String(r).trim()||null==l||""===String(l).trim()||(e.minHeight=l),e}(t.styles),c=t.styles?.desktop?.borderRadius,d=c?`border-radius:${"number"==typeof c?c+"px":c};`:"",u=d?"overflow:hidden;":"",g=Qt(a),f=function(t){if(null==t)return"";if("number"==typeof t&&Number.isFinite(t))return`min-height:${t}px;`;const e=String(t).trim();return e?/^\d+$/.test(e)?`min-height:${e}px;`:`min-height:${e};`:""}(a.minHeight),y=String(a.contentBackground??"").trim(),b=y&&"transparent"!==y.toLowerCase()?`background-color:${y};`:"",k=void 0!==r,h=p(e)||k?"100%":`${function(t){return m(t?.contentWidth)}(e)}px`,$=t.containerType&&"none"!==t.containerType?t:o,x=t.containerType&&"none"!==t.containerType?s:i,v=t.containerType&&"none"!==t.containerType?0:r,S="footer"===t.containerType&&t.footerUnifiedLayout?me(t,t.children?.find(t=>"content"===t.key)??t.children?.[0]??null,n):Te(t.children,e,n,$,x,v);if("discount"===t.containerType){const e=t.styles?.desktop??{},n=t=>"number"==typeof t?`${t}px`:String(t??""),o=[e.paddingTop?`padding-top:${n(e.paddingTop)};`:"",e.paddingRight?`padding-right:${n(e.paddingRight)};`:"",e.paddingBottom?`padding-bottom:${n(e.paddingBottom)};`:"",e.paddingLeft?`padding-left:${n(e.paddingLeft)};`:""].join(""),i=t.styleConfig.desktop.replace(/padding(?:-(?:top|right|bottom|left))?:[^;]+;?\s*/gi,""),r=o?`<tr><td style="${o}"><table role="presentation" cellpadding="0" cellspacing="0" border="0" style="width:100%;border-collapse:collapse;"><tbody><tr>${S}</tr></tbody></table></td></tr>`:`<tr>${S}</tr>`;l+=`<div ${t.styleConfig.mobile?`class="${t.styleConfig.className}"`:""}\n style="${i}width:100%;display:block;${u}">\n <table ${t.contentStyleConfig.mobile?`class="${t.contentStyleConfig.className}"`:""}\n style="width:100%;max-width:${h};margin:0 auto;${d}${t.contentStyleConfig?.desktop??""}${b}${g}${f}">\n <tbody>${r}</tbody>\n </table></div>`}else l+=`<div ${t.styleConfig.mobile?`class="${t.styleConfig.className}"`:""}\n style="${t.styleConfig.desktop}width:100%;display:block;${u}">\n <table ${t.contentStyleConfig.mobile?`class="${t.contentStyleConfig.className}"`:""}\n style="width:100%;max-width:${h};margin:0 auto;${d}${t.contentStyleConfig?.desktop??""}${b}${g}${f}">\n <tbody><tr>${S}</tr></tbody>\n </table></div>`}if("content"===t.key&&(l+=`<td ${t.styleConfig.mobile?`class="${t.styleConfig.className}"`:""} \n style="width:${t.width}; ${t.styleConfig.desktop}">${Te(t.children,e,n,o,i,s)}</td>`),"text"===t.key){const e=null!=o?{columnIndex:i??0,columnProduct:o?.columnProducts?.[r??0]??null}:a;t.type&&/^h[1-4]$/.test(t.type)?l+=Ae(t,n,e):l+=((t,e,n={},o=null)=>{let i=_e(t);e&&i&&(i=St(i,e,n));const r=t?.styles?.desktop??{},l=null!=r.linkColor&&""!==String(r.linkColor).trim();i=Bt(i,l?String(r.linkColor).trim():we,{useImportant:l});const a="footer"===o?.containerType,s=null==(c=i)||"string"!=typeof c?"":c.replace(/<[^>]+>/g,"").replace(/\s+/g," ").trim();var c;return!a||""!==s&&"{{Address}}"!==s&&"{{Tagline}}"!==s?`<div ${t.styleConfig?.mobile?`class="${t.styleConfig.className}"`:""} \n style="${t.styleConfig?.desktop||""}">${i}</div>`:""})(t,n,e,o)}if("heading"===t.key&&(l+=Ae(t,n,a)),"image"===t.key){l+=Se(t,n,null!=o?{columnIndex:i??0,columnProduct:o?.columnProducts?.[r??0]??null}:a,e)}if("video"===t.key&&(l+=(t=>{const e=null!=t.videoUrl?String(t.videoUrl).trim():"",n=function(t,e){const n="string"==typeof e?e.trim():"";if(n)return n;const o=function(t){if(!t||"string"!=typeof t)return null;const e=t.trim(),n=[/(?:youtube\.com\/watch\?[^#]*[&?]v=)([a-zA-Z0-9_-]{11})/,/youtube\.com\/watch\?v=([a-zA-Z0-9_-]{11})/,/youtu\.be\/([a-zA-Z0-9_-]{11})/,/youtube\.com\/embed\/([a-zA-Z0-9_-]{11})/,/youtube\.com\/shorts\/([a-zA-Z0-9_-]{11})/,/youtube-nocookie\.com\/embed\/([a-zA-Z0-9_-]{11})/];for(const t of n){const n=e.match(t);if(n?.[1])return n[1]}return null}(t||"");return o?`https://img.youtube.com/vi/${o}/hqdefault.jpg`:""}(e,null!=t.thumbnailUrl?String(t.thumbnailUrl).trim():""),o=e?be(e):"#",i=`${t.styleConfig?.desktop||""};max-width:100%;height:auto;display:block;border:0;`,r=t.contentStyleConfig?.desktop||"",l=t.videoAreaStyleConfig?.desktop||"";return`<div ${t.contentStyleConfig?.mobile?`class="${t.contentStyleConfig.className}"`:""} style="${r}">\n <div ${t.videoAreaStyleConfig?.mobile?`class="${t.videoAreaStyleConfig.className}"`:""} style="${l}">\n ${n?`<a href="${ye(o)}" target="_blank" rel="noopener noreferrer" style="text-decoration:none;display:inline-block;max-width:100%;line-height:0;"><img src="${ye(n)}" alt="${ye("Video")}" style="${i}"/></a>`:`<a href="${ye(o)}" target="_blank" rel="noopener noreferrer" style="display:inline-block;padding:14px 18px;background:#eeeeee;color:#333333;font-family:Arial,Helvetica,sans-serif;font-size:14px;font-weight:600;text-decoration:none;border-radius:4px;">Watch video</a>`}\n </div>\n</div>`})(t)),"button"===t.key){l+=Le(t,n,null!=o?{columnIndex:i??0,columnProduct:o?.columnProducts?.[r??0]??null}:a,o)}var c,d;"divider"===t.key&&(l+=`<div ${(c=t).contentStyleConfig.mobile?`class="${c.contentStyleConfig.className}"`:""} \n style="${c.contentStyleConfig.desktop}">\n <div ${c.styleConfig.mobile?`class="${c.styleConfig.className}"`:""} \n style="${c.styleConfig.desktop}"></div>\n </div>`),"spacer"===t.key&&(l+=(d=t,`<div ${d.contentStyleConfig?.mobile?`class="${d.contentStyleConfig.className}"`:""} \n style="${d.contentStyleConfig?.desktop||""}">\n <div ${d.styleConfig?.mobile?`class="${d.styleConfig.className}"`:""} \n style="${d.styleConfig?.desktop||""}"></div>\n </div>`)),"menu"===t.key&&(l+=(t=>{const e=t.list||[],n=null!=t.separator?String(t.separator):" | ",o=t.styleConfig?.desktop||"",i=t.contentStyleConfig?.desktop||"",r=t.linkGapPx,l="number"==typeof r&&Number.isFinite(r)&&r>=0?r:0,a=Boolean(t.linkUnderline),s=t.styles?.desktop??{},c=null!=s.fontSize&&Number.isFinite(Number(s.fontSize))?`${Number(s.fontSize)}px`:"14px",d=null!=s.color&&""!==String(s.color).trim()?String(s.color):"#333333";let u="";return e.forEach((t,e)=>{e>0&&(u+=`<span style="${l>0?`display:inline-block;margin-left:${l}px;margin-right:${l}px;font-size:${c};color:${d};`:`display:inline-block;padding-left:4px;padding-right:4px;font-size:${c};color:${d};`}">${fe(n)}</span>`);const i=be(t.url,"#"),r="_blank"===t.target?"_blank":"_self",s=fe(t.label||"Link"),m=a?"underline":"none";u+=`<a target="${r}" href="${ye(i)}" style="${o};text-decoration:${m};display:inline-block;">${s}</a>`}),`<div ${t.contentStyleConfig?.mobile?`class="${t.contentStyleConfig.className}"`:""} style="${i}">${u}</div>`})(t)),"avatar"===t.key&&(l+=(t=>{const e=t.src||"",n=t.alt||"Avatar",o=t.linkURL,i=t.styleConfig?.desktop||"",r=t.styles?.desktop?.width??64,l=`max-width:100%;width:${"number"==typeof r?r+"px":r};height:${"number"==typeof r?r+"px":r};object-fit:cover;border-radius:${t.styles?.desktop?.borderRadius??"50%"};${i}`,a=ye(e),s=ye(n),c=e?`<img src="${a}" alt="${s}" style="${l}" />`:`<div style="${l};background:#eee;display:flex;align-items:center;justify-content:center;"></div>`,d=t.contentStyleConfig?.desktop||"",u=o?`<a href="${ye(be(o))}" target="_blank" rel="noopener noreferrer">${c}</a>`:c;return`<div ${t.contentStyleConfig?.mobile?`class="${t.contentStyleConfig.className}"`:""} style="${d}">${u}</div>`})(t)),"social_link"===t.key&&(l+=Pe(t)),"raw_html"===t.key&&(l+=(t=>{const e=function(t){const e=t.match(/<body[^>]*>([\s\S]*?)<\/body>/i);return e?e[1]:/<html[\s>]/i.test(t)||/<!DOCTYPE/i.test(t)?t.replace(/<!DOCTYPE[^>]*>/gi,"").replace(/<html[^>]*>/gi,"").replace(/<\/html>/gi,"").replace(/<head[\s\S]*?<\/head>/gi,"").replace(/<\/?body[^>]*>/gi,"").trim():t}(t.html??""),n=t.contentStyleConfig?.desktop??"",o=t.contentStyleConfig?.mobile?`class="${t.contentStyleConfig.className}"`:"",i=t.contentStyles?.desktop??{},r=i.width,l=i.textAlign??"center";let a="";return null!=r&&"100%"!==String(r)&&"center"===l?a="margin-left:auto;margin-right:auto;":null!=r&&"100%"!==String(r)&&"right"===l?a="margin-left:auto;margin-right:0;":null==r||"100%"===String(r)||"left"!==l&&"justify"!==l||(a="margin-left:0;margin-right:auto;"),`<div ${o} style="${a}max-width:100%;${n}">${e}</div>`})(t)),"table"===t.key&&(l+=(t=>{const e=t.contentStyleConfig?.desktop||"",n=t.contentStyleConfig?.mobile?`class="${t.contentStyleConfig.className}"`:"",o=t.styles?.desktop??{},i="number"==typeof t.rows?t.rows:3,r="number"==typeof t.cols?t.cols:3,l=Boolean(t.headerRow),a=Boolean(t.headerCol),s=Boolean(t.stripedRows),c=o.fontSize??14,d=o.color??"#333333",u=o.borderStyle??"solid",m=o.borderWidth??1,p=o.borderColor??"#e0e0e0",g=o.cellPadding??8,f=o.textAlign??"left",y=o.headerBg??"#f5f5f5",b=o.headerColor??"#333333",k=o.stripedBg??"#fafafa",h="none"!==u?`${m}px ${u} ${p}`:"none",$=Array.from({length:i}).map((e,n)=>`<tr>${Array.from({length:r}).map((e,o)=>{const i=l&&0===n||a&&0===o,r=i?y:s&&!i&&n%2==0?k:"transparent",u=i?b:d,m=i?"600":"400",p=`${n}-${o}`,$=t.cells?.[p],x=l&&0===n||a&&0===o?"th":"td";let v="—";return"image"===$?.type&&String($.src??"").trim()?v=`<img src="${ye($.src)}" alt="${ye($.alt||"")}" style="max-width:100%;height:auto;display:block;border:0;"/>`:String($?.text??"").trim()&&(v=fe(String($.text))),`<${x} style="border:${h};padding:${g}px;font-size:${c}px;color:${u};text-align:${f};background-color:${r};font-weight:${m};vertical-align:top;">${v}</${x}>`}).join("")}</tr>`).join("");return`<div ${n} style="${e}"><table role="presentation" style="${t.styleConfig?.desktop||""};border-collapse:collapse;width:100%;table-layout:auto;"><tbody>${$}</tbody></table></div>`})(t))}),l},Be={preHeader:"",contentWidth:600,contentWidthMode:"email_width",stackColumnsOnMobile:!0,scaleFontOnMobile:!0,styles:{backgroundColor:"#F5F5F5",contentBg:"#FFFFFF",color:"#171717",headingColor:"#171717",linkColor:"#338AF3",fontFamily:"'Overused Grotesk', ui-sans-serif, system-ui, sans-serif"}},Ie=t=>Array.isArray(t)?t.filter(t=>!(t&&"object"==typeof t&&!0===t.hidden)).map(t=>t&&"object"==typeof t&&Array.isArray(t.children)?{...t,children:Ie(t.children)}:t):t,Ue=({bodySettings:t,blockList:e,templateData:n})=>{let o="";const i=((t,e)=>{if(!Array.isArray(t))return t;const n=e?.content?.products;if(!Array.isArray(n)||0===n.length)return t;const o=e?.content?.primaryProductId,i=(o?n.find(t=>t?.id===o):n[0])??n[0]??null;if(!i)return t;const r=n.filter(t=>t?.id!==i.id),l=t=>{if(!t||"object"!=typeof t)return t;const e=Array.isArray(t.children)?t.children.map(l):t.children;if("column"!==t.key||"product"!==t.containerType)return{...t,children:e};const n="additional"===t.productRole?"additional":"main",o=Math.max(Array.isArray(e)?e.length:0,Array.isArray(t.columnProducts)?t.columnProducts.length:0,1),a=Array.from({length:o},(t,e)=>"main"===n||0===r.length?i:r[e%r.length]);return{...t,children:e,columnProducts:a}};return t.map(l)})(Ie(e??[]),n),{newBlockList:r,styles:l}=xe(i);o=Te(r,t,n);const a=Mt(i,t,n);return`<html>\n <head>\n <meta charset="UTF-8">\n <title>email</title>\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <style type="text/css">\n *{\n margin: 0;\n padding: 0;\n border: none;\n box-sizing: border-box;\n }\n\n html,body {\n height:100%;\n overflow-y:auto;\n }\n\n table {\n width: 100%;\n color:unset;\n }\n\n table, tr, td {\n vertical-align: top;\n border-collapse: collapse;\n }\n\n h1,h2,h3,h4 {\n display: block;\n margin-block-start: 0px;\n margin-block-end: 0px;\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n font-weight: bold;\n ${t.styles?.headingColor?`color: ${t.styles.headingColor};`:""}\n }\n\n a {\n ${t.styles?.linkColor?`color: ${t.styles.linkColor};`:""}\n }\n\n @media(max-width:620px){\n${!1!==t.stackColumnsOnMobile?" td {\n display:inline-block;\n width:100% !important;\n }\n":""}${!1!==t.scaleFontOnMobile?" body { font-size: 16px !important; }\n":""} }\n ${a}\n ${l}\n</style>\n </head>\n <body>\n <div style="opacity:0;">${t.preHeader}</div>\n <div style="background-color:${t.styles.backgroundColor};color:${t.styles.color}; font-family:${t.styles.fontFamily};"> ${o}</div>\n </body>\n </html>`};function Ne(t){let e=t;if("string"==typeof t)try{e=JSON.parse(t)}catch(t){throw new Error("exportNormalizerToHtml: invalid JSON")}if(null==e)throw new Error("exportNormalizerToHtml: input is null or undefined");let n=[],o={...Be,styles:{...Be.styles}};Array.isArray(e)?n=e:"object"==typeof e&&(n=Array.isArray(e.blockList)?e.blockList:[],e.bodySettings&&"object"==typeof e.bodySettings&&(o={preHeader:null!=e.bodySettings.preHeader?e.bodySettings.preHeader:Be.preHeader,contentWidth:m(e.bodySettings.contentWidth??Be.contentWidth),contentWidthMode:e.bodySettings.contentWidthMode??Be.contentWidthMode,stackColumnsOnMobile:!1!==e.bodySettings.stackColumnsOnMobile,scaleFontOnMobile:!1!==e.bodySettings.scaleFontOnMobile,styles:{backgroundColor:e.bodySettings.styles?.backgroundColor??Be.styles.backgroundColor,contentBg:e.bodySettings.styles?.contentBg??Be.styles.contentBg,color:e.bodySettings.styles?.color??Be.styles.color,headingColor:e.bodySettings.styles?.headingColor??Be.styles.headingColor,linkColor:e.bodySettings.styles?.linkColor??Be.styles.linkColor,fontFamily:e.bodySettings.styles?.fontFamily??Be.styles.fontFamily}}));return`<!DOCTYPE html>\n${function(t){return t.replace(/\n/g," ").replace(/[ \t]{2,}/g," ").replace(/> </g,"><").trim()}(Ue({bodySettings:o,blockList:n,templateData:e.templateData}))}`}const Ee=Object.freeze({keys:["content","catalogProducts","companyContext","brandContext","companyId"],description:"templateData drives placeholders, product columns, and menu/social sync. content.products + content.primaryProductId, when non-empty, override product column assignments on load. catalogProducts (optional array) is the KB/catalog list for the product picker and for newly added preset product blocks; it does not replace columnProducts in a saved template when content.products is empty. companyContext.navigation_links and companyContext.social_links sync into menu/social blocks; brandContext (including brand_color) resolves branding tokens and CTA/button fallback colors in HTML export."});const Me=["Product","Discount"],Re=["text","image","button"];function Fe(t,e,n,o,i,r,l){if("column"===t.key&&t.containerType){const e=function(t){const e=t.toLowerCase();return"product"===e?"Product":"discount"===e?"Discount":"None"}(t.containerType),n=t.id??null;let a=o;"Product"===e&&(l.productIndex++,a=l.productIndex);for(const o of t.children??[])Fe(o,e,n,a,i,r,l);return}if("content"===t.key){for(const a of t.children??[])Fe(a,e,n,o,i,r,l);return}const a="dynamic"===t.contentType,s=Me.includes(e)&&Re.includes(t.key);if((a||s)&&n){let l=i.find(t=>t.containerId===n);l||(l={containerId:n,containerType:e,blocks:[]},i.push(l));const c=t.id?r[t.id]:void 0,d=function(t){return"image"===t.key?t.src??"":"button"===t.key?t.linkURL??"":t.text??""}(t);let u="";"Product"===e?u=function(t,e){const n=`product ${e}`;return t.includes("{{ProductImage}}")?`This block is meant for displaying the ${n} image`:t.includes("{{ProductName}}")?`This block is meant for displaying the ${n} name`:t.includes("{{ProductOldPrice}}")||t.includes("{{ProductNewPrice}}")?`This block is meant for displaying the ${n} original and discounted price`:t.includes("{{ProductPrice}}")||t.includes("{{ProductCurrency}}")?`This block is meant for displaying the ${n} price and currency`:t.includes("{{ProductDescription}}")?`This block is meant for displaying the ${n} description`:t.includes("{{ProductLink}}")?`This block is meant for displaying the ${n} link`:`This block is meant for displaying ${n} content`}(d,o):"Discount"===e&&(u=function(t){const e=[];return t.includes("{{DiscountValue}}")&&e.push("the discount value (e.g. 20% or $10)"),t.includes("{{DiscountCode}}")&&e.push("the discount/promo code"),t.includes("{{ValidUntil}}")&&e.push("the discount expiry date"),0===e.length?"This block is meant for displaying discount/offer information":`This block is meant for displaying ${e.join(", ")}`}(d));const m=c?.prompt||u,p=s&&!a;l.blocks.push({id:t.id??"",contentType:p||"dynamic"===t.contentType?"dynamic":"static",value:p?"":d,ai:{prompt:m,selectedSampleAiContent:p?"":c?.selectedContent??d}})}if(t.children)for(const a of t.children)Fe(a,e,n,o,i,r,l)}const je={text:"text",image:"src",button:"linkURL"};function De(t,e){if(0===e.size)return!0;if(t.id&&e.has(t.id)){const n=e.get(t.id),o=je[t.key];o&&(t[o]=n,e.delete(t.id))}if(t.children)for(const n of t.children)if(De(n,e))return!0;return 0===e.size}var ze=Object.freeze({__proto__:null,jsonToHtml:function(t){return Ne(t)},normalizeJson:function(t){const e="string"==typeof t?JSON.parse(t):t,n=[],o=e.aiContentRefs||{},i={productIndex:0},r=e.blockList||[];for(const t of r)Fe(t,"None",null,0,n,o,i);return{groups:n}},updateJsonWithMlContent:function(t,e){const n="string"==typeof t?JSON.parse(t):t,o=structuredClone(n),i=new Map;for(const t of e)t.variations.length>0&&i.set(t.nodeId,t.variations[0].value);const r=o.blockList||[];for(const t of r)if(De(t,i))break;return o}});exports.DEFAULT_EMAIL_TEMPLATE_ID=n,exports.DEFAULT_MARKOPOLO_API_BASE_V1=t,exports.DEFAULT_ML_GENERATION_API_BASE_V1=e,exports.TEMPLATE_DATA_SCHEMA=Ee,exports.createDefaultTemplateData=function(t={}){const e={name:"",website:"",navigation_links:[],social_links:{}},n={brand_color:"#111111",logo_url:"",tagline:"",heroBanner:"",footerBanner:""},o=null;return{content:{...{products:[],primaryProductId:null},...t.content&&"object"==typeof t.content?t.content:{}},companyContext:{...e,...t.companyContext&&"object"==typeof t.companyContext?t.companyContext:{}},brandContext:{...n,..."string"==typeof t.brandColor&&t.brandColor.trim()?{brand_color:t.brandColor.trim()}:{},...t.brandContext&&"object"==typeof t.brandContext?t.brandContext:{}},companyId:null!=t.companyId?t.companyId:o}},exports.exportNormalizerToHtml=Ne,exports.exportTemplateJson=function(t,e={}){const{validate:n=!0}=e,o=t?.current;if(!o||"function"!=typeof o.exportJson)throw new Error("exportTemplateJson: ref must be attached to EmailEditor (expected ref.current.exportJson to be a function).");const i=o.exportJson();if(!i||"object"!=typeof i)throw new Error("exportTemplateJson: exportJson() returned an invalid payload.");return{payload:i,issues:n?N({blockList:i.blockList,bodySettings:i.bodySettings,aiContentRefs:i.aiContentRefs}):[]}},exports.exportTemplateJsonAsync=async function(t,e={}){const{validate:n=!0,checkImages:o=!0,imageProbe:i}=e,r=t?.current;if(!r||"function"!=typeof r.exportJson)throw new Error("exportTemplateJsonAsync: ref must be attached to EmailEditor (expected ref.current.exportJson to be a function).");const l=r.exportJson();if(!l||"object"!=typeof l)throw new Error("exportTemplateJsonAsync: exportJson() returned an invalid payload.");return n?{payload:l,issues:o?await z({blockList:l.blockList,bodySettings:l.bodySettings,aiContentRefs:l.aiContentRefs},i):N({blockList:l.blockList,bodySettings:l.bodySettings,aiContentRefs:l.aiContentRefs})}:{payload:l,issues:[]}},exports.mergeMarkopoloApiConfig=function(i={}){const r=i&&"object"==typeof i?i:{},{apiBaseUrlV1:l,apiBaseV1:a,mlGenerationApiBaseUrlV1:s,mlApiBaseUrlV1:c,headers:d,mlEmailGenerateBnEndpoint:u,...m}=r,p=l||a||t,g="undefined"!=typeof process&&process.env?.REACT_APP_ML_API_BASE_V1,f=o(p,s||c||g||e),y="undefined"!=typeof process?String(process.env?.REACT_APP_EMAIL_TEMPLATE_ID??"").trim():"",b={...f,...m};b.mlEmailGenerateEndpoint&&String(b.mlEmailGenerateEndpoint).trim()||!u||(b.mlEmailGenerateEndpoint=String(u).replace(/\/generate-email\/bn\/?$/i,"/generate-email"));const k=String(b.emailTemplateId??"").trim()||y||n;return{...b,emailTemplateId:k,headers:{...b.headers||{},...d||{}}}},exports.utils=ze,exports.validateExportPayload=N,exports.validateExportPayloadComplete=z,exports.validateImageUrlsReachable=D,exports.validateTemplateDataShape=function(t){const e=[];if(null==t||"object"!=typeof t)return{ok:!1,warnings:["templateData must be a non-null object"]};const n=t;if(null!=n.content&&"object"!=typeof n.content)e.push("templateData.content should be an object when provided");else if(n.content&&"object"==typeof n.content){const t=n.content;null==t.products||Array.isArray(t.products)||e.push("templateData.content.products should be an array when provided")}if(null==n.catalogProducts||Array.isArray(n.catalogProducts)||e.push("templateData.catalogProducts should be an array when provided"),null!=n.companyContext&&"object"!=typeof n.companyContext&&e.push("templateData.companyContext should be an object when provided"),null!=n.brandContext&&"object"!=typeof n.brandContext&&e.push("templateData.brandContext should be an object when provided"),n.brandContext&&"object"==typeof n.brandContext){const t=n.brandContext;null!=t.brand_color&&"string"!=typeof t.brand_color&&e.push("templateData.brandContext.brand_color should be a string when provided")}return{ok:0===e.length,warnings:e}};
|