@markopolo_ai_inc/markopolo-email-editor 1.0.71 → 1.0.72
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/lib/core/index.js +1 -1
- package/lib/core/index.mjs +1 -1
- package/lib/index.js +1 -1
- package/lib/index.mjs +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{createContext as t,useContext as n,useCallback as o,useMemo as l,useState as a,useRef as i,useEffect as r,Fragment as s,useLayoutEffect as c,forwardRef as d,useReducer as u,useImperativeHandle as p}from"react";import{notification as m,Modal as g,Input as h,Badge as y,Switch as b,Popover as f,Button as _,InputNumber as k,Tooltip as v,Spin as w,Select as x,message as S,AutoComplete as C,Slider as N,Dropdown as L,Tag as T}from"antd";import{FontAwesomeIcon as B}from"@fortawesome/react-fontawesome";import{faInfoCircle as A,faBold as I,faItalic as $,faUnderline as P,faStrikethrough as R,faListOl as M,faListUl as D,faLink as U,faUnlink as E,faExpandAlt as z,faCompressAlt as F,faImage as O,faUser as W,faVideo as j,faEyeSlash as H,faChevronUp as K,faChevronDown as V,faCopy as G,faStar as q,faTrash as J,faArrowsAlt as Y,faSquare as X,faWindowMaximize as Z,faWindowMinimize as Q,faCube as ee,faTag as te,faColumns as ne,faTable as oe,faCode as le,faShareAlt as ae,faBars as ie,faArrowsAltV as re,faGripLines as se,faFont as ce,faCog as de,faMinus as ue,faPlus as pe,faCloudUploadAlt as me,faSyncAlt as ge,faAlignLeft as he,faAlignCenter as ye,faAlignRight as be,faAlignJustify as fe,faGripVertical as _e,faExclamationTriangle as ke,faCheckCircle as ve,faExclamationCircle as we,faEllipsisV as xe,faEye as Se,faChevronLeft as Ce,faChevronRight as Ne,faEnvelopeOpenText as Le,faHeading as Te,faShareAltSquare as Be,faMinusSquare as Ae,faFile as Ie,faTh as $e,faLayerGroup as Pe,faEnvelope as Re,faSpinner as Me,faUndo as De,faRedo as Ue,faDesktop as Ee,faMobileAlt as ze,faPaperPlane as Fe,faExternalLinkAlt as Oe,faSave as We,faFileExport as je,faFileCode as He,faKeyboard as Ke,faAdjust as Ve}from"@fortawesome/free-solid-svg-icons";import{motion as Ge}from"framer-motion";import{jsx as qe,jsxs as Je,Fragment as Ye}from"react/jsx-runtime";import{createPortal as Xe}from"react-dom";import{ChromePicker as Ze}from"react-color";function Qe(e){const t=String(e??"").trim();return/^(?:javascript|vbscript)\s*:/i.test(t)||/^data\s*:/i.test(t)}function et(e){let t=String(e??"").trim();if(!t)return"";if(Qe(t))return"";for(let e=0;e<t.length;e++){const n=t.charCodeAt(e),o=t[e];if(n<32||"<"===o||">"===o||'"'===o)return""}return t}function tt(e){const t=String(e??"").trim().match(/^https?:\/\/(.+)/is);return!!t&&/^https?:\/\//i.test(t[1])}function nt(e,t={}){const{allowMailtoTel:n=!0}=t,o=String(e??"").trim();if(!o)return null;if(Qe(o))return null;if(tt(o))return null;if(n&&(/^mailto:/i.test(o)||/^tel:/i.test(o)))return o;const l=/^https?:\/\//i.test(o)?o:`https://${o.replace(/^\/+/,"")}`;return ot(l,!1,t)?l:null}function ot(e,t=!1,n={}){return null==lt(e,t,n)}function lt(e,t=!1,n={}){const{allowMailtoTel:o=!0}=n;if(null==e||""===String(e).trim())return t?null:"empty";const l=String(e).trim();if(Qe(l))return"blocked_scheme";if(tt(l))return"duplicate_protocol";let a;if(/^https?:\/\//i.test(l)){const e=l.replace(/^https?:\/\//i,"");if(/^https?:\/\//i.test(e))return"duplicate_protocol";a=l}else a=o&&/^mailto:/i.test(l)||o&&/^tel:/i.test(l)?l:`https://${l}`;try{const e=new URL(a);return"http:"===e.protocol||"https:"===e.protocol?function(e){const t=String(e??"").trim().toLowerCase();return""!==t&&"http"!==t&&"https"!==t&&("localhost"===t||!!t.includes(":")||!!/^(?:\d{1,3}\.){3}\d{1,3}$/.test(t)||t.includes("."))}(e.hostname)?null:"missing_hostname_dot":o&&"mailto:"===e.protocol||o&&"tel:"===e.protocol?null:"invalid_protocol"}catch{return"invalid_url"}}function at(e){const t=String(e?.image||"").toLowerCase(),n=String(e?.title||"").toLowerCase().trim();return t.includes("/tc-x.svg")||t.includes("/brand-x.svg")||t.includes("/icons/x.svg")||t.includes("simple-icons")&&t.includes("/x.svg")||"x"===n||"twitter"===n}const it=["default","white","black","gray"];function rt(e){const t="string"==typeof e?e:"gray";return it.includes(t)?t:"default"}function st(e){if(!e||"object"!=typeof e)return{};const{padding:t,paddingTop:n,paddingRight:o,paddingBottom:l,paddingLeft:a,...i}=e;return i}const ct={small:21,medium:24,large:32},dt="https://unpkg.com/@tabler/icons@3.24.0/icons/outline",ut={facebook:"brand-facebook",x:"brand-x",instagram:"brand-instagram",linkedin:"brand-linkedin",tiktok:"brand-tiktok",youtube:"brand-youtube",pinterest:"brand-pinterest"};function pt(e){if(!e)return null;const t=ut[e];return t?`${dt}/${t}.svg`:null}const mt={left:"flex-start",center:"center",right:"flex-end",justify:"space-between"};function gt(e){const t=e&&"object"==typeof e?{...e}:{},n=t.columnGapPx,o="number"==typeof n&&Number.isFinite(n)&&n>=0?n:8;delete t.columnGapPx;const l=t.textAlign||"center";delete t.textAlign;const a=mt[l]||mt.left;return{...t,display:"flex",width:"100%",maxWidth:"100%",boxSizing:"border-box",flexDirection:"row",flexWrap:"wrap",alignItems:"center",justifyContent:a,columnGap:o,rowGap:0}}function ht(e){if(!e)return null;if(at(e))return"x";const t=String(e.image||"").toLowerCase(),n=String(e.title||"").toLowerCase();return t.includes("facebook")||n.includes("facebook")?"facebook":t.includes("instagram")||n.includes("instagram")?"instagram":t.includes("linkedin")||n.includes("linkedin")?"linkedin":t.includes("tiktok")||n.includes("tiktok")?"tiktok":t.includes("youtube")||n.includes("youtube")?"youtube":t.includes("pinterest")||n.includes("pinterest")?"pinterest":null}const yt="https://s.magecdn.com/social";const bt={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 ft(e){const t=String(e||"").toLowerCase();return pt("twitter"===t?"x":t)}function _t(e){const t=e?.iconSize;if(t&&null!=ct[t])return ct[t];const n=Number(e?.imageWidth);return Number.isFinite(n)&&n>0?Math.round(n):ct.medium}function kt(e){const t=function(e){switch(e){case"white":return"brightness(0) invert(1)";case"black":return"brightness(0)";case"gray":return"brightness(0) opacity(0.55)";default:return""}}(e);return t?{filter:t}:{}}function vt(e,t,n){const o=Number(n)||ct.medium,l={width:o,height:o,objectFit:"contain",display:"block",verticalAlign:"middle",flexShrink:0},a=t&&"default"!==t?t:"default",i=String(e?.image||"").trim(),r=function(e){return pt(ht(e))}(e),s=function(e){const t=ht(e);if(!t)return null;const n=bt[t];return n?`${yt}/${n}`:null}(e);if(i&&!function(e){const t=String(e||"").trim().toLowerCase();return!(!t||!t.startsWith(String(yt).toLowerCase())&&!t.startsWith(String(dt).toLowerCase())&&!t.includes("unpkg.com/@tabler/icons"))}(i))return{src:i,style:l};if("default"===a)return s?{src:s,style:l}:{src:i,style:l};if(r){if("white"===a)return{src:r,style:{...l,filter:"brightness(0) invert(1)"}};if("gray"===a)return{src:r,style:{...l,filter:"brightness(0) opacity(0.55)"}};if("black"===a)return{src:r,style:l}}return i?{src:i,style:{...l,...kt(a)}}:{src:"",style:l}}function wt(e,t,n){const{src:o,style:l}=vt(e,t,n),a=Number(n)||ct.medium,i=[`width:${a}px`,`height:${a}px`,"object-fit:contain","display:block","vertical-align:middle"];return"brightness(0) opacity(0.55)"===l.filter?i.push("opacity:0.55"):l.filter&&i.push(`filter:${l.filter}`),null!=l.opacity&&i.push(`opacity:${l.opacity}`),{src:o,styleAttr:i.join(";")}}const xt=e=>{const t=e.constructor===Array?[]:{};for(let n in e)e.hasOwnProperty(n)&&(e[n]&&"object"==typeof e[n]?(t[n]=e[n].constructor===Array?[]:{},t[n]=xt(e[n])):t[n]=e[n]);return t},St=(e,t)=>{let n=null;return function(){n||(n=setTimeout(()=>{e.apply(this,arguments),n=null},t))}};function Ct(e,t={}){if(null==e||"string"!=typeof e)return e;const n=null!=t.fontSize?Number(t.fontSize):14,o=null!=t.fontFamily?String(t.fontFamily):"sans-serif",l=null!=t.color?String(t.color):"",a=["direction: ltr",`font-size: ${n}px`,`font-family: ${o}`];l&&a.push(`color: ${l}`);const i=t.fontWeight;null!=i&&""!==String(i).trim()&&a.push(`font-weight: ${i}`);const r=t.fontStretch;null!=r&&""!==String(r).trim()&&"normal"!==String(r).toLowerCase()&&a.push(`font-stretch: ${r}`);const s=t.textTransform;null!=s&&""!==String(s).trim()&&"none"!==String(s).toLowerCase()&&a.push(`text-transform: ${s}`);const c=a.join("; ");let d=function(e){if(null==e||"string"!=typeof e)return e;let t=e.replace(/\sstyle\s*=\s*["']([^"']*)["']/gi,(e,t)=>{const n=t.replace(/\s*font-size\s*:[^;]+;?/gi,"").replace(/\s*font-family\s*:[^;]+;?/gi,"").replace(/\s*color\s*:[^;]+;?/gi,"").replace(/^;\s*|;\s*$/g,"").trim();return n?` style="${n}"`:""}),n="";for(let e=0;e<20&&n!==t;e++)n=t,t=t.replace(/<font(\s[^>]*)?>([\s\S]*?)<\/font>/gi,"$2");return t}(e.trim());const u=/^<span(?:\s[^>]*)?>([\s\S]*)<\/span>$/i.exec(d.trim()),p=/^<div(?:\s[^>]*)?>([\s\S]*)<\/div>$/i.exec(d.trim());return u?d=u[1]:p&&(d=p[1]),`<span style="${c}">${d}</span>`}function Nt(){return"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function Lt(e){if(!e||"object"!=typeof e)return;e.id||(e.id=Nt());const t=e.children;Array.isArray(t)&&t.forEach(Lt)}function Tt(e){if(!e||"object"!=typeof e)return;e.id=Nt();const t=e.children;Array.isArray(t)&&t.forEach(Tt)}function Bt(e){if(!e||"object"!=typeof e)return e;const t=xt(e);return Tt(t),t}const At=[{key:"facebook",image:ft("facebook"),title:"Facebook"},{key:"twitter",image:ft("twitter"),title:"X"},{key:"instagram",image:ft("instagram"),title:"Instagram"},{key:"linkedin",image:ft("linkedin"),title:"LinkedIn"},{key:"tiktok",image:ft("tiktok"),title:"TikTok"},{key:"youtube",image:ft("youtube"),title:"YouTube"}];function It(e){const t=e?.socialPlatformKey;if(t&&"string"==typeof t&&At.some(e=>e.key===t))return t;if(at(e))return"twitter";const n=String(e?.title??"").trim().toLowerCase(),o=String(e?.image??"").trim();for(const e of At){if(n&&n===e.title.toLowerCase())return e.key;if("twitter"===e.key&&n&&("twitter"===n||"tweet"===n||"tw"===n))return"twitter";if(o&&o===e.image)return e.key}return null}function $t(e,t){const n=t&&"object"==typeof t&&!Array.isArray(t)?t:{},o=Array.isArray(e)?e:[],l=new Map,a=[];for(const e of o){const t=It(e);t?l.set(t,e):a.push(e)}return[...At.map(e=>{const t=l.get(e.key),o=null!=n[e.key]?et(String(n[e.key]).trim()):"",a=null!=t?.linkURL?String(t.linkURL).trim():"",i=a?et(a):"",r=o||i||"";return{id:t?.id??Nt(),image:t?.image||e.image,title:t?.title||e.title,linkURL:r,socialPlatformKey:e.key}}),...a]}const Pt=[{label:"Link 1",url:"#",target:"_blank"},{label:"Link 2",url:"#",target:"_blank"},{label:"Link 3",url:"#",target:"_blank"}];function Rt(e,t){if(!e)return e;const n=t&&"object"==typeof t?t:{},o=n?.companyContext?.navigation_links,l=Array.isArray(o)&&o.length>0,a=n?.companyContext?.social_links,i=Object.values(e).some(e=>e&&"menu"===e.key&&!1!==e.useNavigationLinks),r=Object.values(e).some(e=>e&&"social_link"===e.key),s=Object.values(e).some(e=>e&&"column"===e.key&&"footer"===e.containerType&&e.footerUnifiedLayout&&!1!==e.footerUseCompanySocial);if(!i&&!r&&!s)return e;const c={...e};let d=!1;return Object.keys(e).forEach(t=>{const n=e[t];if(n){if("menu"===n.key&&!1!==n.useNavigationLinks){const e=l?o.map(e=>function(e){if(!e||"object"!=typeof e)return{label:"Link",url:"#",target:"_self"};const t=e.label??e.name??e.title??"Link",n="string"==typeof t?t:null!=t?String(t):"Link",o=e.url??e.href??e.link??e.uri??"";return{label:n||"Link",url:("string"==typeof o?o.trim():null!=o?String(o).trim():"")||"#",target:"_blank"===e.target||"_self"===e.target?e.target:"_self"}}(e)):Pt;c[t]={...n,list:e},d=!0}if("social_link"===n.key&&!1!==n.useCompanySocialLinks){const e=$t(n.list??[],a??{}),o={...n,list:e};JSON.stringify({...n,list:n.list??[]})!==JSON.stringify(o)&&(c[t]=o,d=!0)}if("column"===n.key&&"footer"===n.containerType&&n.footerUnifiedLayout&&!1!==n.footerUseCompanySocial){const e=function(e,t){return $t(e,t)}(n.footerSocialList??[],a??{});JSON.stringify(n.footerSocialList??[])!==JSON.stringify(e)&&(c[t]={...n,footerSocialList:e},d=!0)}}}),d?c:e}const Mt=280,Dt=1200,Ut={EMAIL_WIDTH:"email_width",CUSTOM_PX:"custom_px",FULL_BLEED:"full_bleed"};function Et(e){const t=Math.round(Number(e));return!Number.isFinite(t)||t<=0?600:Math.min(Dt,Math.max(Mt,t))}function zt(e){const t=e?.contentWidthMode;return Object.values(Ut).includes(t)?t:Ut.EMAIL_WIDTH}function Ft(e){return Et(e?.contentWidth)}function Ot(e){return zt(e)===Ut.FULL_BLEED}function Wt(e="Drag block here",t){return{id:t||Nt(),name:e,key:"empty",width:"100%",styles:{desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0},mobile:{}}}}function jt(e){const t={},n=[];function o(e){if(e&&"object"==typeof e)if(e.id||(e.id=Nt()),"column"===e.key){const n=(e.children||[]).map(e=>{e.id||(e.id=Nt());const t=[];return(e.children||[]).forEach(e=>{e.id||(e.id=Nt()),o(e),t.push(e.id)}),{id:e.id,width:e.width,styles:e.styles,childrenIds:t}}),{children:l,...a}=e;t[e.id]={...a,cells:n}}else t[e.id]=e}return(e||[]).forEach(e=>{e.id||(e.id=Nt()),o(e),n.push(e.id)}),{blockMap:t,rootOrder:n}}function Ht(e,t){function n(t){const o=e[t];if(!o)return null;if("column"===o.key){const e=(o.cells||[]).map(e=>({id:e.id,name:"Content",key:"content",width:e.width,styles:e.styles,children:(e.childrenIds||[]).map(e=>n(e)).filter(Boolean)})),{cells:t,...l}=o;return{...l,children:e}}return{...o}}return(t||[]).map(e=>n(e)).filter(Boolean)}function Kt(e,t){const n=t[e];if(!n)return null;if("column"!==n.key)return n;const o=(n.cells||[]).map(e=>({id:e.id,name:"Content",key:"content",width:e.width,styles:e.styles,children:(e.childrenIds||[]).map(e=>{const n=t[e];return n?"column"===n.key?Kt(e,t):n:null}).filter(Boolean)})),{cells:l,...a}=n;return{...a,children:o}}function Vt(e,t,n){function o(t){const l=e[t];if(!l||"column"!==l.key)return null;for(let a=0;a<(l.cells||[]).length;a++){const i=l.cells[a];for(let l=0;l<(i.childrenIds||[]).length;l++){if(i.childrenIds[l]===n)return{containerId:t,cellIndex:a,itemIndex:l};const r=e[i.childrenIds[l]];if(r&&"column"===r.key){const e=o(i.childrenIds[l]);if(e)return e}}}return null}for(const e of t||[]){const t=o(e);if(t)return t}return null}function Gt(e,t,n){const o=(t||[]).indexOf(n);if(-1!==o){const t=e[n];return{containerBlock:t??null,containerType:t?.containerType??"none",cellIndex:0,isRoot:!0,rootIndex:o}}const l=Vt(e,t,n);if(!l)return{containerBlock:null,containerType:"none",cellIndex:0,isRoot:!1};const a=e[l.containerId];return{containerBlock:a??null,containerType:a?.containerType??"none",cellIndex:l.cellIndex,isRoot:!1}}function qt(e,t,n){const o=(t||[]).indexOf(n);if(-1!==o){const t=e[n];return[{containerBlock:t??null,containerType:t?.containerType??"none",cellIndex:0,isRoot:!0,rootIndex:o}]}function l(t,o=[]){const a=e[t];if(!a||"column"!==a.key)return null;for(let t=0;t<(a.cells||[]).length;t++){const i=a.cells[t];for(let r=0;r<(i.childrenIds||[]).length;r++){const s=i.childrenIds[r];if(s===n)return[{containerBlock:a,containerType:a?.containerType??"none",cellIndex:t,isRoot:!1},...o];const c=e[s];if(c&&"column"===c.key){const e=l(s,[{containerBlock:a,containerType:a?.containerType??"none",cellIndex:t,isRoot:!1},...o]);if(e)return e}}}return null}for(const e of t||[]){const t=l(e,[]);if(t)return t}return[]}function Jt(e,t,n){const o=qt(e,t,n),l=o.find(e=>e?.containerType&&"none"!==e.containerType)||o[0]||null,a=l?.cellIndex??0,i=l?.containerBlock??null,r=i?.columnProducts?.[a]??null,s=Array.isArray(i?.columnProducts)?i.columnProducts.find(e=>null!=e)??null:null;return{containerType:l?.containerType??"none",columnIndex:a,columnProduct:r??s,containerBlock:i,lineage:o}}function Yt(e,t,n,o,l){const a=e[t];if(!a)return e;const i=a.cells.map((e,t)=>{if(t!==n)return e;const a=[...e.childrenIds];return a[o]=l,{...e,childrenIds:a}});return{...e,[t]:{...a,cells:i}}}function Xt(e,t,n,o){const l=e[t];if(!l)return{blockMap:e,removedId:null};const a=l.cells[n];if(!a)return{blockMap:e,removedId:null};const i=a.childrenIds[o],r=[...a.childrenIds];r.splice(o,1);const s=l.cells.map((e,t)=>t===n?{...e,childrenIds:r}:e);return{blockMap:{...e,[t]:{...l,cells:s}},removedId:i}}function Zt(e,t,n,o,l){const a=e[t];if(!a)return e;const i=a.cells[n];if(!i)return e;const r=[...i.childrenIds];r.splice(o,0,l);const s=a.cells.map((e,t)=>t===n?{...e,childrenIds:r}:e);return{...e,[t]:{...a,cells:s}}}function Qt(e,t,n,o){if(!n||!e[n]||0===o)return null;const l=t.indexOf(n);if(-1!==l){const n=l+o;if(n<0||n>=t.length)return null;const a=[...t],[i]=a.splice(l,1);return a.splice(n,0,i),{nextMap:e,nextRootOrder:a}}const a=Vt(e,t,n);if(!a)return null;const{containerId:i,cellIndex:r,itemIndex:s}=a,c=e[i],d=[...c.cells[r].childrenIds],u=s+o;if(u<0||u>=d.length)return null;const[p]=d.splice(s,1);d.splice(u,0,p);const m=c.cells.map((e,t)=>t===r?{...e,childrenIds:d}:e);return{nextMap:{...e,[i]:{...c,cells:m}},nextRootOrder:t}}function en(e,t){const n={...e};return function e(t){const o=n[t];o&&("column"===o.key&&(o.cells||[]).forEach(t=>(t.childrenIds||[]).forEach(t=>e(t))),delete n[t])}(t),n}function tn(e,t={}){if(!e||"column"!==e.key||!Array.isArray(e.cells))return null;const n=(o=t)&&"object"==typeof o?Array.isArray(o)?o.reduce((e,t)=>(t&&"object"==typeof t&&t.id&&(e[t.id]=t),e),{}):{...o}:{};var o;const l=xt(e);delete l.children,delete l.blockMap,delete l.blockSnapshotMap;const a={...n,[l.id]:l};function i(e){e&&!a[e]&&(a[e]=Wt("…",e))}return function e(t){if(t&&"column"===t.key&&Array.isArray(t.cells))for(const n of t.cells)for(const t of n.childrenIds||[]){i(t);const n=a[t];n&&"column"===n.key&&e(n)}}(l),{blockMap:a,rootId:l.id}}function nn(e,t){if(!t)return{newBlockMap:e,rootId:null};if("column"===t.key){const n=Array.isArray(t.children)&&t.children.length>0;if(Array.isArray(t.cells)&&t.cells.length>0&&!n){const n=tn(t,t.blockMap||t.blockSnapshotMap||{});if(n?.blockMap&&n.rootId){const t=Ht(n.blockMap,[n.rootId])[0];if(t){const{blockMap:n,rootOrder:o}=jt([t]);return{newBlockMap:{...e,...n},rootId:o[0]??null}}}}const{blockMap:o,rootOrder:l}=jt([t]);return{newBlockMap:{...e,...o},rootId:l[0]??null}}return{newBlockMap:{...e,[t.id]:t},rootId:t.id}}const on="SET_BLOCK_LIST",ln="SET_BLOCKS",an="SET_IS_DRAG_START",rn="SET_ACTION_TYPE",sn="SET_PREVIEW_MODE",cn="SET_CURRENT_ITEM",dn="SET_BODY_SETTINGS",un="SET_FILL_PRODUCT_SLOTS",pn="SET_SELECTION_RANGE",mn="SET_TEXT_RANGE",gn="SET_LANGUAGE",hn="SET_LANGUAGE_LIBRARIES",yn="SET_TEMPLATE_VARIABLES",bn="UNDO",fn="REDO",_n=e=>({type:rn,actionType:e}),kn=e=>({type:cn,currentItem:e}),vn=(e,t={})=>({type:yn,templateData:e,skipUndo:Boolean(t.skipUndo)}),wn={},xn=[],Sn={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"}},Cn=!0,Nn={blockMap:wn,rootOrder:xn,blockList:[],isDragStart:!1,actionType:"firstRender",previewMode:"desktop",currentItem:null,bodySettings:Sn,fillProductSlots:Cn,selectionRange:null,textRange:null,language:"en",languageLibraries:{},templateData:null,undoStack:[],redoStack:[]},Ln=t();function Tn(e,t,n){const o=Rt(t,e.templateData),l=Ht(o,n);let{currentItem:a}=e;if(a?.id&&o[a.id]){const e=Kt(a.id,o);e&&e!==a.data&&(a={...a,data:e})}return{...e,blockMap:o,rootOrder:n,blockList:l,currentItem:a}}function Bn(e){return e?{...e,data:e.data&&"object"==typeof e.data?xt(e.data):e.data}:null}function An(e){return{blockMap:xt(e.blockMap||wn),rootOrder:[...e.rootOrder||xn],bodySettings:xt(e.bodySettings||Sn),fillProductSlots:void 0!==e.fillProductSlots?!1!==e.fillProductSlots:Cn,currentItem:Bn(e.currentItem),templateData:null==e.templateData?null:xt(e.templateData)}}function In(e){return JSON.stringify(e,(e,t)=>t&&"object"==typeof t&&!Array.isArray(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function $n(e,t){if(t)return e;const n=An(e),o=e.undoStack[e.undoStack.length-1];return o&&function(e,t){if(!e||!t)return!1;try{return In(e)===In(t)}catch{return!1}}(n,o)?e:{...e,undoStack:[...e.undoStack,n].slice(-50),redoStack:[]}}function Pn(e,t){const n=t.templateData,o=Rt(xt(t.blockMap||wn),n),l=[...t.rootOrder||xn],a=Ht(o,l);let i=Bn(t.currentItem);if(i?.id&&o[i.id]){const e=Kt(i.id,o);e&&(i={...i,data:e})}const r=xt(t.bodySettings||Sn);return{...e,blockMap:o,rootOrder:l,blockList:a,bodySettings:{...r,contentWidth:Et(r.contentWidth)},fillProductSlots:void 0!==t.fillProductSlots?!1!==t.fillProductSlots:Cn,currentItem:i,templateData:n}}function Rn(e,t){switch(t.type){case ln:return Tn($n(e,t.skipUndo),t.blockMap,t.rootOrder);case on:{const n=$n(e,t.skipUndo),{blockMap:o,rootOrder:l}=jt(t.blockList);return Tn(n,o,l)}case an:return{...e,isDragStart:t.isDragStart};case rn:return{...e,actionType:t.actionType};case sn:return{...e,previewMode:t.previewMode};case cn:{let n=t.currentItem;if(n?.id&&e.blockMap[n.id]){const t=Kt(n.id,e.blockMap);t&&(n={...n,data:t})}return{...e,currentItem:n}}case dn:{const n=$n(e,t.skipUndo),o={...n.bodySettings,...t.bodySettings};return{...n,bodySettings:{...o,contentWidth:Et(o.contentWidth)}}}case un:return{...$n(e,t.skipUndo),fillProductSlots:!1!==t.fillProductSlots};case pn:return{...e,selectionRange:t.selectionRange};case mn:return{...e,textRange:t.textRange};case gn:return{...e,language:t.language};case hn:return{...e,languageLibraries:t.languageLibraries};case yn:{const n=$n(e,t.skipUndo),o=t.templateData,l=Rt(n.blockMap,o),a=Ht(l,n.rootOrder);let{currentItem:i}=n;if(i?.id&&l[i.id]){const e=Kt(i.id,l);e&&(i={...i,data:e})}return{...n,templateData:o,blockMap:l,blockList:a,currentItem:i}}case bn:{if(!e.undoStack.length)return e;const t=e.undoStack[e.undoStack.length-1],n=e.undoStack.slice(0,-1),o=An(e),l=[...e.redoStack,o].slice(-50);return{...Pn(e,t),undoStack:n,redoStack:l,actionType:"undo"}}case fn:{if(!e.redoStack.length)return e;const t=e.redoStack[e.redoStack.length-1],n=e.redoStack.slice(0,-1),o=An(e),l=[...e.undoStack,o].slice(-50);return{...Pn(e,t),undoStack:l,redoStack:n,actionType:"redo"}}default:return e}}function Mn(e){if(null==e)return"";const t=String(e).trim();if(!t)return"";const n=t.toLowerCase();return"none"===n||"null"===n||"undefined"===n?"":t}var Dn={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 Un="CustomerName",En="DiscountValue",zn="DiscountCode",Fn="ValidUntil",On="CompanyName",Wn="Address",jn="Website",Hn="BrandName",Kn="LogoUrl",Vn="Tagline",Gn="HeroBanner",qn="FooterBanner",Jn="NavLabel",Yn="NavUrl",Xn="ProductName",Zn="ProductDescription",Qn="ProductImage",eo="ProductLink",to="ProductPrice",no="ProductCurrency",oo="ProductOldPrice",lo="ProductNewPrice",ao="ProductPriceDisplay",io="CTALabel",ro="CTAUrl",so=new Set([oo,lo]);function co(e){return`{{${e}}}`}const uo=Dn;let po=uo;function mo(e,t=po){return t&&Array.isArray(t[e])?t[e].map(e=>({...e,token:e.token||co(e.key)})):[]}let go=[],ho=[],yo=[],bo={},fo=[],_o=[],ko=[];function vo(){go=mo("global",po),ho=mo("product",po),yo=mo("discount",po),bo=[...go,...ho,...yo].reduce((e,t)=>(e[t.key]=t,e),{}),fo=yo.map(e=>({variableKey:e.key,labelKey:e.labelKey}));const e=ho.filter(e=>!so.has(e.key));_o=e.map(e=>({variableKey:e.key,labelKey:e.labelKey})),ko=go.map(e=>({value:e.token,label:e.label,key:e.key,labelKey:e.labelKey,source:e.source,type:e.type})),yo.map(e=>({value:e.token,label:e.label,key:e.key,labelKey:e.labelKey,source:e.source,type:e.type})),e.map(e=>({value:e.token,label:e.label,key:e.key,labelKey:e.labelKey,source:e.source,type:e.type}))}vo();const wo={[Un]:"User",[En]:"20%",[zn]:"SAVE20",[Fn]:"12-31-2025",[On]:"Company Name",[Hn]:"Company Name",[Wn]:"",[jn]:"www.example.com",[Kn]:"https://via.placeholder.com/150x50/ffffff/333333?text=Logo",[Vn]:"Your tagline here",[Gn]:"https://via.placeholder.com/600x200/eeeeee/666666?text=Hero",[qn]:"https://via.placeholder.com/600x100/eeeeee/666666?text=Footer",[Jn]:"Link",[Yn]:"https://www.example.com",[Xn]:"Product Name",[Zn]:"Product description goes here.",[Qn]:"https://via.placeholder.com/300x300/eeeeee/666666?text=Product",[eo]:"https://www.example.com",[to]:"0",[no]:"USD",[oo]:"0",[lo]:"0",[ao]:"$0.00 USD",[io]:"Shop Now",[ro]:"www.example.com"};function xo(e){return null==e||"string"!=typeof e?"":e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}const So=new Set([ao]);function Co(e,t,n={}){if(null==e||"string"!=typeof e)return"";const o=e.replace(/\{\{(\w+)\}\}/g,(e,o)=>{const l=$o(t,o,n);return So.has(o)?l:xo(l)});return null==(l=o)||"string"!=typeof l?l:l.replace(/^(<p[^>]*>\s*(?:<br\s*\/?>| )?\s*<\/p>\s*)+/i,"");var l}function No(e){return wo[e]??"—"}const Lo=/^\{\{\s*[\w.]+\s*\}\}$/;function To(e,t,{allowEmpty:n=!1}={}){if(null==e)return n?"":No(t);const o=String(e).trim();return""===o?n?"":No(t):function(e){return"string"==typeof e&&Lo.test(e.trim())}(o)?No(t):o}const Bo={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 Ao(e){return function(e){return"string"==typeof e&&/^[A-Za-z]{3}$/.test(e.trim())}(e)?String(e).trim().toUpperCase():"USD"}function Io(e,t){const n=function(e){if(null==e)return null;const t=String(e).replace(/,/g,"").trim();if(""===t)return null;const n=Number(t);return Number.isFinite(n)?n:null}(e);if(null==n)return null;const o=Ao(t),l=function(e){return Bo[e]??null}(o);if(!l)return null;const a=function(e){if(null==e)return 0;const t=String(e).trim().replace(/,/g,"");if(!t.includes("."))return 0;const[,n=""]=t.split(".");return Math.max(0,n.length)}(e);try{return`${new Intl.NumberFormat(l,{style:"currency",currency:o,minimumFractionDigits:a,maximumFractionDigits:a}).format(n)} ${o}`}catch{return null}}function $o(e,t,n={}){if(!e)return No(t);const{columnIndex:o,columnProduct:l}=n;let a=l;switch(!a&&e.content?.products&&"number"==typeof o&&(a=e.content.products[o]||null),t){case Un:return No(Un);case En:return To(e.content?.discount?.value,En);case zn:return To(e.content?.discount?.code,zn);case Fn:return To(e.content?.discount?.valid_until,Fn);case On:case Hn:return To(e.companyContext?.name,t);case Wn:return To(e.companyContext?.address,Wn,{allowEmpty:!0});case jn:return To(e.companyContext?.website,jn);case Kn:return To(e.brandContext?.logo_url,Kn);case Vn:return To(e.brandContext?.tagline,Vn);case Gn:return To(e.brandContext?.heroBanner,Gn);case qn:return To(e.brandContext?.footerBanner,qn);case Jn:case Yn:return No(t);case Xn:return To(a?.name,Xn);case Zn:{const e=Mn(a?.description);return e?To(e,Zn,{allowEmpty:!0}):""}case Qn:return To(a?.image,Qn);case eo:return To(a?.link,eo);case to:return null!=a?.price&&"number"==typeof a.price||null!=a?.price&&"string"==typeof a.price?String(a.price):null!=a?.new_price?String(a.new_price):No(to);case no:return To(a?.currency,no);case oo:return To(a?.old_price,oo);case lo:return null!=a?.new_price?To(a.new_price,lo):null!=a?.price?To(a.price,lo):No(lo);case ao:{const e=Ao(a?.currency),t=null!=a?.price?a.price:a?.new_price,n=null!=a?.old_price||null!=a?.new_price,o=null!=a?.old_price?a.old_price:null,l=null!=a?.new_price?a.new_price:null!=a?.price?a.price:null;if(n&&(null!=o||null!=l)){const t=Io(o,e),n=Io(l,e),a=null!=(null!=t?t:null!=o?String(o):null)?xo(null!=t?t:null!=o?String(o):""):"";return[""!==a?`<span style="text-decoration: line-through;">${a}</span>`:"",null!=(null!=n?n:null!=l?String(l):null)?xo(null!=n?n:null!=l?String(l):""):""].filter(Boolean).join(" ")||No(ao)}const i=Io(t,e);return null!=i?xo(i):null!=t?xo(String(t)):No(ao)}case io:{const t=e.content?.cta?.text;return To(t,io)}case ro:{const t=e.content?.cta?.url;return To(null!=t?t:e.companyContext?.website,ro)}default:return No(t)}}const Po=[{variableKey:Kn,labelKey:"variable_image_logo"},{variableKey:Gn,labelKey:"variable_image_hero_banner"},{variableKey:qn,labelKey:"variable_image_footer_banner"}],Ro=[{variableKey:Qn,labelKey:"variable_image_product_image"}],Mo=[{variableKey:io,labelKey:"variable_cta_label"}],Do=[{variableKey:ro,labelKey:"variable_cta_url"}],Uo=[{variableKey:eo,labelKey:"variable_product_link"},{variableKey:jn,labelKey:"variable_website"}];function Eo(e,t,n,o={}){let l=[];return"discount"===t?l=[...fo]:"product"===t&&(l=[..._o]),l.map(({variableKey:e,labelKey:t})=>({...bo[e]||{},variableKey:e,labelKey:t,value:co(e),pasteValue:$o(n,e,o)}))}function zo(e,t,n,o={},l=[]){const a="none"===t?ko.map(e=>({...e,pasteValue:$o(n,e.key,o)})):Eo(0,t,n,o),i=(l||[]).filter(e=>e&&e.containerType&&"none"!==e.containerType).flatMap(e=>Eo(0,e.containerType,n,e.context||{})),r=new Set,s=[];return[...a,...i].forEach(e=>{const t=e.variableKey||e.key||e.value;t&&!r.has(t)&&(r.add(t),s.push(e))}),s}const Fo={display_text:"DisplayText",introduction:"Introduction",heading:"Heading",subheading:"Subheading",products_description:"ProductDescription"};function Oo(e,t,n,o){return{value:co(e),labelKey:t,variableKey:e,key:e,type:"image",pasteValue:$o(n,e,o)}}function Wo(e,t,n={}){const o=Po.map(({variableKey:e,labelKey:o})=>Oo(e,o,t,n));if("product"===e){const e=Ro.map(({variableKey:e,labelKey:o})=>Oo(e,o,t,n));return[...o,...e]}return o}function jo(e){return!1!==e?.linkEnabled}function Ho(e,t,n={}){if(!e||!t)return e;const{useImportant:o=!1}=n,l=String(t).trim();if(!l)return e;const a=o?`color: ${l} !important`:`color: ${l}`;return String(e).replace(/<a\b([^>]*)>/gi,(e,t)=>{const n=t.match(/\sstyle\s*=\s*"([^"]*)"/i);if(n){const e=(n[1]||"").replace(/\s*color\s*:\s*[^;]+(!important)?\s*;?/gi,"").replace(/;\s*;/g,";").replace(/^\s*;|;\s*$/g,"").trim(),o=`${e?`${e}; `:""}${a};`;return`<a${t.replace(n[0],` style="${o}"`)}>`}const o=t.match(/\sstyle\s*=\s*'([^']*)'/i);if(o){const e=(o[1]||"").replace(/\s*color\s*:\s*[^;]+(!important)?\s*;?/gi,"").replace(/;\s*;/g,";").replace(/^\s*;|;\s*$/g,"").trim(),n=`${e?`${e}; `:""}${a};`;return`<a${t.replace(o[0],` style='${n}'`)}>`}return`<a${t} style="${a};">`})}const Ko=[{name:"Sans Serif (Generic)",stack:"sans-serif"},{name:"Overused Grotesk",stack:"'Overused Grotesk', ui-sans-serif, system-ui, sans-serif"},{name:"Arial",stack:"Arial, Helvetica, sans-serif"},{name:"Helvetica",stack:"Helvetica, Arial, sans-serif"},{name:"Georgia",stack:"Georgia, Times New Roman, serif"},{name:"Times New Roman",stack:"'Times New Roman', Times, serif"},{name:"Verdana",stack:"Verdana, Geneva, sans-serif"},{name:"Tahoma",stack:"Tahoma, Geneva, sans-serif"},{name:"Trebuchet MS",stack:"'Trebuchet MS', Helvetica, Arial, sans-serif"},{name:"Courier New",stack:"'Courier New', Courier, monospace"},{name:"Palatino",stack:"'Palatino Linotype', Palatino, serif"},{name:"Garamond",stack:"Garamond, 'Times New Roman', serif"},{name:"Lucida",stack:"'Lucida Sans Unicode', 'Lucida Grande', sans-serif"}],Vo=[{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"}],Go=e=>/\s/.test(String(e||""))?`'${String(e).replace(/'/g,"\\'")}'`:String(e);function qo(e){return`https://fonts.googleapis.com/css2?family=${(e=>String(e).trim().replace(/\s+/g,"+"))(e)}:wght@400;700&display=swap`}function Jo(e){const t=e?.brandContext?.customFonts;return Array.isArray(t)?t.filter(e=>e&&"object"==typeof e&&e.name&&e.url).map(e=>({label:`${e.name} (Brand Kit)`,value:`${Go(e.name)}, Arial, sans-serif`,primaryName:String(e.name),source:"custom",url:String(e.url),format:e.format?String(e.format):void 0,weight:null!=e.weight?String(e.weight):void 0,style:e.style?String(e.style):void 0})):[]}function Yo(e){return[...Ko.map(e=>({label:e.name,value:e.stack,primaryName:e.name,source:"system"})),...Vo.map(e=>({label:`${e.name} (Google)`,value:`${Go(e.name)}, ${e.fallback}`,primaryName:e.name,source:"google"})),...Jo(e)]}function Xo(e){if(!e)return"";const t=String(e).split(",")[0];return String(t??"").trim().replace(/^['"]|['"]$/g,"")}function Zo(e,t){const n=Yo(t),o=Xo(e).toLowerCase(),l=n.find(e=>e.primaryName.toLowerCase()===o);return l?l.value:e}function Qo(e,t){const n=Yo(t),o=Zo(e,t),l=Xo(o).toLowerCase(),a=n.find(e=>e.primaryName.toLowerCase()===l||e.value===o);return a?a.label:"sans-serif"===l?"Sans Serif (Generic)":o}function el(e){const t=String(e.name||"").trim(),n=String(e.url||"").trim();if(!t||!n)return"";const o=e.format?` format('${e.format}')`:"",l=e.weight?`font-weight:${e.weight};`:"",a=e.style?`font-style:${e.style};`:"";return`@font-face{font-family:${Go(t)};src:url('${n}')${o};${l}${a}}`}function tl(e,t,n){const o=function(e,t){const n=new Set,o=e=>{null!=e&&""!==String(e).trim()&&n.add(String(e).trim())};o(t?.styles?.fontFamily);const l=e=>{Array.isArray(e)&&e.forEach(e=>{e&&"object"==typeof e&&(o(e?.styles?.desktop?.fontFamily),o(e?.styles?.mobile?.fontFamily),"image"===e.key&&Array.isArray(e.overlayItems)&&e.overlayItems.forEach(e=>{e&&"object"==typeof e&&o(e.fontFamily)}),Array.isArray(e.children)&&l(e.children))})};return l(e),[...n]}(e,t),l=new Set;o.forEach(e=>{const t=function(e){const t=Xo(e),n=Vo.find(e=>e.name.toLowerCase()===t.toLowerCase());return n?qo(n.name):null}(e);t&&l.add(t)});const a=(Array.isArray(n?.brandContext?.customFonts)?n.brandContext.customFonts:[]).map(el).filter(Boolean);return[...[...l].map(e=>`@import url('${e}');`),...a].join("\n")}const nl="ee_cb";function ol(e){const t=String(e??"").trim();if(!t)return t;if(/^\{\{/u.test(t)||/^data:/iu.test(t))return t;try{const e="undefined"!=typeof window&&window.location?.origin?window.location.origin:"http://localhost",n=new URL(t,e);return n.searchParams.set(nl,String(Date.now())),n.toString()}catch{const e=t.includes("?")?"&":"?";return`${t}${e}${nl}=${Date.now()}`}}function ll(e){const t=String(e??"").trim();if(!t)return t;try{const e="undefined"!=typeof window&&window.location?.origin?window.location.origin:"http://localhost",n=new URL(t,e);n.searchParams.delete(nl);let o=n.toString();return o.endsWith("?")&&(o=o.slice(0,-1)),o}catch{return t.replace(new RegExp(`[?&]${nl}=\\d+`,"g"),"").replace(/\?&/g,"?").replace(/&&+/g,"&").replace(/[?&]$/,"")}}const al=[{value:"cover",labelKey:"container_bg_size_cover"},{value:"contain",labelKey:"container_bg_size_contain"},{value:"fill",labelKey:"container_bg_size_fill"}],il=["left top","center top","right top","left center","center center","right center","left bottom","center bottom","right bottom"];function rl(e){return String(e??"").trim().replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"").replace(/\r/g,"")}function sl(e,t){const n=e?.containerBackgroundEnabled,o=e?.containerBackgroundImage,l=o&&String(o).trim();if(!1===n||!l)return{background:t};const a={cover:"cover",contain:"contain",fill:"100% 100%"}[e?.containerBackgroundSize||"cover"]||"cover",i=e?.containerBackgroundPosition||"center center";return{backgroundColor:t,backgroundImage:`url("${rl(l)}")`,backgroundSize:a,backgroundPosition:i,backgroundRepeat:"no-repeat"}}const cl=["tl","tc","tr","ml","mc","mr","bl","bc","br"],dl={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 ul(e){const t=String(e??"bc").toLowerCase();return cl.includes(t)?t:"bc"}function pl(e){const t=ul(e);return dl[t]}function ml(e,t){const n="string"==typeof t?t.trim():"";if(n)return n;const o=function(e){if(!e||"string"!=typeof e)return null;const t=e.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 e of n){const n=t.match(e);if(n?.[1])return n[1]}return null}(e||"");return o?`https://img.youtube.com/vi/${o}/hqdefault.jpg`:""}function gl(e){const t=null!=e?String(e).trim():"";return t&&"transparent"!==t.toLowerCase()?t:"#ffffff"}const hl=e=>null==e||""===String(e).trim();function yl(e,t){const n="string"==typeof e?e.trim():String(e??"").trim();if(!n)return"";const o=/^\{\{(\w+)\}\}$/.exec(n);if(o&&t){const e=$o(t,o[1],{});if(null!=e&&""!==String(e).trim()&&!String(e).startsWith("{{"))return String(e).trim()}return n}function bl(e,t){if(null==e||""===e)return"";const n=String(e);return t?n.replace(/\{\{(\w+)\}\}/g,(e,n)=>{const o=$o(t,n,{});if(null==o)return`{{${n}}}`;const l=String(o);return l.startsWith("{{")?`{{${n}}}`:l}):n}function fl(e,t){if(null==e||""===e)return"";const n=String(e);return t?n.replace(/\{\{(\w+)\}\}/g,(e,n)=>{const o=$o(t,n,{}),l=null!=o?String(o).trim():"";return!l||"—"===l||l.startsWith("{{")?e:l}):n}const _l=()=>[{id:Nt(),label:"Privacy",url:"#",target:"_self"},{id:Nt(),label:"Terms",url:"#",target:"_self"}],kl="You are receiving this email because you subscribed.";function vl(e){let t=null!=e?.unsubscribeLinkLabel&&""!==String(e.unsubscribeLinkLabel).trim()?String(e.unsubscribeLinkLabel).trim():"";const n=String(e?.unsubscribeText??"").trim();if(!t&&n){const e=n.split(/\s*[·•]\s*/);t=e[0]?.trim()||""}return{unsubscribeLinkLabel:t||"Unsubscribe"}}function wl(e){return(Array.isArray(e)&&0!==e.length?e:$t([],{})).map(e=>({id:e?.id,image:e?.image??"",title:e?.title??"",linkURL:e?.linkURL??"",socialPlatformKey:e?.socialPlatformKey}))}function xl(e){return Array.isArray(e)&&0!==e.length?e.map(e=>({id:e?.id,label:e?.label??"",url:e?.url??"",target:"_blank"===e?.target?"_blank":"_self"})):_l()}const Sl=e=>String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),Cl=(e,t)=>{if(null==e||""===e)return t;if("number"==typeof e)return e;const n=parseInt(String(e).replace(/px/gi,""),10);return Number.isFinite(n)?n:t};const Nl="#111827";function Ll(e){if(null==e)return"";const t=String(e).trim().toLowerCase();return/^#[0-9a-f]{3}$/.test(t)?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:t}function Tl(e){return Ll(e)===Ll("#263d2d")}function Bl(e){if(null==e||"object"!=typeof e)return"#111111";const t=e.brandContext,n=t&&"object"==typeof t?t.brand_color??t.brandColor??null:null,o=e.brandColor,l=("string"==typeof n&&""!==n.trim()?n:"string"==typeof o&&""!==o.trim()?o:null)??"#111111",a=String(l).trim();return""!==a?a:"#111111"}const Al=new Set(["fontWeight","opacity","zIndex"]),Il=e=>String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),$l=e=>Il(e).replace(/"/g,""").replace(/'/g,"'"),Pl=(e,t="#")=>{if(null==e)return t;const n=String(e).trim();if(!n)return t;const o=n.toLowerCase();return/^\s*(?:javascript|vbscript):/i.test(o)||/^\s*data:/i.test(o)?t:/^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(/^\/+/,"")}`},Rl=(e,t)=>{const n=new RegExp(/[A-Z]/g),o=e=>e.replace(n,e=>`-${e.toLowerCase()}`),l={desktop:t?.desktop??{},mobile:t?.mobile??{}};let a={className:e,desktop:"",mobile:""};for(let e of Object.entries(l.desktop))if(e[1]&&"contentBackground"!==e[0]&&"horizontalAlign"!==e[0]&&"containerBackgroundImage"!==e[0]&&"containerBackgroundSize"!==e[0]&&"containerBackgroundPosition"!==e[0]){const t="number"!=typeof e[1]||Al.has(e[0])?e[1]:e[1]+"px";a.desktop+=`${o(e[0])}:${t};`}if(Object.keys(l.mobile).length){let t="";for(let e of Object.entries(l.mobile))if(e[1]&&"contentBackground"!==e[0]&&"horizontalAlign"!==e[0]&&"containerBackgroundImage"!==e[0]&&"containerBackgroundSize"!==e[0]&&"containerBackgroundPosition"!==e[0]){const n="number"!=typeof e[1]||Al.has(e[0])?e[1]:e[1]+"px";t+=`${o(e[0])}:${n} !important;`}a.mobile+=`@media(max-width:620px){\n .${e} {\n ${t}\n }\n }`}return a};function Ml(e){if(!e||"object"!=typeof e)return{};const{marginLeft:t,marginTop:n,...o}=e;return o}function Dl(e){const t=st(e||{}),{linkColor:n,color:o,...l}=t,a=null!=n&&""!==String(n).trim()?String(n).trim():null,i=null!=o&&""!==String(o).trim()?String(o).trim():null,r=a??i;return null==r?l:{...l,color:r}}const Ul=(e,t="",n=null)=>{const o=e.map((e,o)=>{let l={...e};const a=null!==n?`${n}-${o}`:`${o}`,i=e=>`e${a}-${e}`,r={desktop:e?.styles?.desktop??{},mobile:e?.styles?.mobile??{}},s="menu"===e.key?{desktop:Dl(r.desktop),mobile:Dl(r.mobile)}:"social_link"===e.key?{desktop:st(r.desktop),mobile:st(r.mobile)}:r;if(l.styleConfig=Rl(i(e.key),s),l.contentStyles){const n={desktop:l.contentStyles?.desktop??{},mobile:l.contentStyles?.mobile??{}};let o=n;if(l.imageHostMarginStyleConfig=null,"image"===l.key){o={desktop:Ml(n.desktop),mobile:Ml(n.mobile)};const a={desktop:(n.desktop,{}),mobile:(n.mobile,{})};if(Object.keys(a.desktop).length||Object.keys(a.mobile).length){const n=Rl(i(`${e.key}-hm`),a);l.imageHostMarginStyleConfig=n,n.mobile&&(t+=n.mobile)}}l.contentStyleConfig=Rl(i(`${e.key}-c`),o),l.contentStyleConfig.mobile&&(t+=l.contentStyleConfig.mobile)}if("video"===l.key&&l.videoArea){const n={desktop:l.videoArea?.desktop??{},mobile:l.videoArea?.mobile??{}};l.videoAreaStyleConfig=Rl(i(`${e.key}-va`),n),l.videoAreaStyleConfig.mobile&&(t+=l.videoAreaStyleConfig.mobile)}if(l.styleConfig.mobile&&(t+=l.styleConfig.mobile),e.hiddenOnMobile){const e=`@media(max-width:620px){.${l.styleConfig.className}{display:none !important;}}`;t+=e,l.styleConfig={...l.styleConfig,mobile:(l.styleConfig.mobile||"")+e}}if(s.desktop.contentBackground&&(l.contentStyleConfig||(l.contentStyleConfig={className:i(`${e.key}-c`),desktop:"",mobile:""}),l.contentStyleConfig.desktop+=`background-color:${s.desktop.contentBackground};`),s.mobile.contentBackground){l.contentStyleConfig||(l.contentStyleConfig={className:i(`${e.key}-c`),desktop:"",mobile:""});const n=`@media(max-width:620px){.${l.contentStyleConfig.className}{background-color:${s.mobile.contentBackground};}}`;l.contentStyleConfig.mobile=(l.contentStyleConfig.mobile||"")+n,t+=n}if("menu"===l.key){if("stack"===(e.mobileLayout??"stack")){const n=l.contentStyleConfig?.className??i(`${e.key}-c`);l.contentStyleConfig||(l.contentStyleConfig={className:n,desktop:"",mobile:""});const o=l.contentStyles?.desktop?.textAlign??l.contentStyles?.mobile?.textAlign??"center",a=String(o).toLowerCase(),r="left"===a?"flex-start":"right"===a?"flex-end":"center",s=["left","right","center","justify"].includes(a)?a:"center",c=e.linkGapPx,d=`@media(max-width:620px){\n.${n}{display:flex !important;flex-direction:column !important;align-items:${r} !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}`;l.contentStyleConfig.mobile=(l.contentStyleConfig.mobile||"")+d,t+=d}}if(e.children?.length){const{newBlockList:n,styles:o}=Ul(e.children,"",a);t+=o,l.children=n}return{...l}});return{newBlockList:o,styles:t}};function El(e){const t=e.contentStyleConfig?.desktop??"",n=function(e){const t=e.contentStyles?.desktop??{},n=e.contentStyles?.mobile??{},o=null!=t.textAlign&&""!==String(t.textAlign).trim()?t.textAlign:n.textAlign,l=null!=o&&""!==String(o).trim()?String(o).trim():"center";return"start"===l?"left":"end"===l?"right":l}(e);return/\btext-align\s*:/i.test(t)?t:`${t}text-align:${n};`}const zl="#2faade";function Fl(e){const t=String(e??"");return null!=(n=t)&&"string"==typeof n&&/<[a-zA-Z!/?]/.test(n.trim())?function(e){if(!e||!/<a\b/i.test(e))return e;const t=(e,t,n)=>{const o=(t[1]||"").replace(/\s*text-decoration(-line)?\s*:[^;]+;?/gi,"").replace(/^\s*;|;\s*$/g,"").trim(),l=(o?`${o}; `:"")+"text-decoration: none;",a='"'===n?` style="${l}"`:` style='${l}'`;return`<a${e.replace(t[0],a)}>`};return String(e).replace(/<a\b([^>]*)>/gi,(e,n)=>{const o=n.match(/\sstyle\s*=\s*"([^"]*)"/i);if(o)return t(n,o,'"');const l=n.match(/\sstyle\s*=\s*'([^']*)'/i);return l?t(n,l,"'"):`<a${n} style="text-decoration: none;">`})}(t):Il(t);var n}function Ol(e){const t=e?.dynamicSelectedContent,n=e?.text??"";if(null==t)return String(n);const o=String(t);return""===o.trim()?String(n):o}const Wl=(e,t,n={})=>{let o=Ol(e);t&&o&&(o=Co(o,t,n));const l=e?.styles?.desktop??{},a=null!=l.linkColor&&""!==String(l.linkColor).trim();return o=Ho(o,a?String(l.linkColor).trim():zl,{useImportant:a}),`<${e.type} ${e.styleConfig?.mobile?`class="${e.styleConfig.className}"`:""} \n style="${e.styleConfig?.desktop||""}">\n ${o}\n </${e.type}>`};const jl=(e,t,n={},o=null)=>{let l=e.text||"",a=e.linkURL||"";if(t){const o=l.match(/\{\{(\w+)\}\}/),i=e.labelVariable?e.labelVariable.replace(/^\{\{|\}\}$/g,"").trim():o?o[1]:void 0;if(i){const e=$o(t,i,n);null==e||String(e).startsWith("{{")||(l=String(e))}if(e.urlVariable){const o=$o(t,e.urlVariable.replace(/^\{\{|\}\}$/g,""),n);o&&!o.startsWith("{{")&&(a=String(o))}else{const e=String(a||"").trim().match(/^\{\{(\w+)\}\}$/);if(e){const o=$o(t,e[1],n);o&&!String(o).startsWith("{{")&&(a=String(o))}}}const i=Fl(l),r=$l(Pl(a)),s=Bl(t);let c=e.styleConfig.desktop||"";!function(e,t){if(!function(e){return!(!e||"column"!==e.key||"product"!==e.containerType)&&"additional"!==e.productRole&&("image_left"===e.mainProductLayout||"image_stacked"!==e.mainProductLayout&&function(e){const t=e?.children?.[0]?.children?.[0];return"column"===t?.key&&"2-3"===t?.type}(e))}(t))return!1;const n=e.styles?.desktop?.backgroundColor;return null==n||""===String(n).trim()||Ll(n)===Ll(Nl)}(e,o)?Tl(e.styles?.desktop?.backgroundColor)&&(c=c.replace(/background-color:\s*[^;]+;?/gi,"")):c=c.replace(/background-color:\s*[^;]+;?/gi,"");const d=c.includes("background-color:")?"":`background-color:${s};`;return`<div ${e.contentStyleConfig.mobile?`class="${e.contentStyleConfig.className}"`:""} \n style="${e.contentStyleConfig.desktop}">\n <a ${e.styleConfig.mobile?`class="${e.styleConfig.className}"`:""} \n style="${c}${d}text-align:center;text-decoration:none;" target="_blank" rel="noopener noreferrer" href="${r}">${i}</a>\n </div>`};const Hl=(e,t,n,o,l,a)=>{let i="";const r={columnIndex:l??0,columnProduct:o?.columnProducts?.[a??0]??null};return e.forEach((e,s)=>{if("column"===e.key){const r=function(e){const t={...e?.desktop??{}},n=e?.mobile??{},o=String(t.containerBackgroundImage??"").trim(),l=String(n.containerBackgroundImage??"").trim();!o&&l&&(t.containerBackgroundImage=n.containerBackgroundImage,null!=n.containerBackgroundSize&&(t.containerBackgroundSize=n.containerBackgroundSize),null!=n.containerBackgroundPosition&&(t.containerBackgroundPosition=n.containerBackgroundPosition),void 0!==n.containerBackgroundEnabled&&(t.containerBackgroundEnabled=n.containerBackgroundEnabled));const a=t.minHeight,i=n.minHeight;return null!=a&&""!==String(a).trim()||null==i||""===String(i).trim()||(t.minHeight=i),t}(e.styles),c=e.styles?.desktop?.borderRadius,d=c?`border-radius:${"number"==typeof c?c+"px":c};`:"",u=d?"overflow:hidden;":"",p=function(e){const t=e??{};if(!1===t.containerBackgroundEnabled)return"";const n=ll(t.containerBackgroundImage);return n&&String(n).trim()?`background-image:url("${rl(n)}");background-size:${{cover:"cover",contain:"contain",fill:"100% 100%"}[t.containerBackgroundSize||"cover"]||"cover"};background-position:${t.containerBackgroundPosition||"center center"};background-repeat:no-repeat;`:""}(r),m=function(e){if(null==e)return"";if("number"==typeof e&&Number.isFinite(e))return`min-height:${e}px;`;const t=String(e).trim();return t?/^\d+$/.test(t)?`min-height:${t}px;`:`min-height:${t};`:""}(r.minHeight),g=String(r.contentBackground??"").trim(),h=g&&"transparent"!==g.toLowerCase()?`background-color:${g};`:"",y=void 0!==a,b=Ot(t)||y?"100%":`${Ft(t)}px`,f=e.containerType&&"none"!==e.containerType?e:o,_=e.containerType&&"none"!==e.containerType?s:l,k=e.containerType&&"none"!==e.containerType?0:a,v="footer"===e.containerType&&e.footerUnifiedLayout?function(e,t,n){const o=e,l=o.styles?.desktop??{},a=Boolean(o.showBrand??!0),i=Boolean(o.showTagline??!0),r=Boolean(o.footerShowLogo??!1),s=yl(o.footerLogoSrc??"",n),c=bl(String(o.footerLogoAlt??"Logo").trim()||"Logo",n).trim()||"Logo",d=o.footerLogoLink??"",u=Cl(o.footerLogoMaxWidthPercent,30),p=Cl(o.footerLogoPaddingPx,24),m=Boolean(o.showAddress??!0),g=Boolean(o.showUnsubscribe??!0),h=Boolean(o.showSocial??!1),y=Boolean(o.showSecondaryLinks??!1),b=Boolean(o.showCopyright??!0),f=bl(o.brandName??"",n),_=bl(o.brandTagline??"",n).trim(),k=bl(o.address??"",n),v=bl(o.copyrightText??"",n),w=o.unsubscribeUrl||"{{unsubscribe_url}}",x=null!=o.unsubscribeBodyText&&""!==String(o.unsubscribeBodyText).trim()?String(o.unsubscribeBodyText):kl,{unsubscribeLinkLabel:S}=vl(o),C=xl(o.secondaryLinks),N=wl(o.footerSocialList),L=l.color??"#737373",T=null!=l.linkColor&&""!==String(l.linkColor).trim()?String(l.linkColor).trim():L,B=Cl(l.fontSize,12),A=l.textAlign??"center",I=Cl(l.paddingTop,28),$=Cl(l.paddingRight,24),P=Cl(l.paddingBottom,28),R=Cl(l.paddingLeft,24),M=gl(l.contentBackground),D=Boolean(o.showDivider??!1),U=Sl(o.dividerColor??"#374151"),E=Boolean(o.showBorderTop??!1),z=Cl(o.borderTopWidth,1),F=o.borderTopStyle??"solid",O=Sl(o.borderTopColor??"#e5e7eb"),W=E&&z>0?`${z}px ${F} ${O}`:"",j=t?.width??"100%",H=t?.styleConfig?.mobile?` class="${t.styleConfig.className}"`:"",K=t?.styleConfig?.desktop??"",V=`margin:0;color:${Sl(L)};font-size:${B}px;line-height:1.5;font-family:Arial,sans-serif;text-align:${Sl(A)};`,G=`color:${Sl(T)};text-decoration:underline;`,q=[];let J="";if(D&&(J+=`<div style="border-top:1px solid ${U};margin-bottom:14px;width:100%;font-size:0;line-height:0;"> </div>`),r&&s.trim()){const e="left"===A?"left":"right"===A?"right":"center",t=`<img src="${Sl(s)}" alt="${Sl(c)}" width="570" style="max-width:${u}%;height:auto;display:inline-block;padding:${p}px;vertical-align:middle;border:0;outline:none;text-decoration:none;"/>`,o=nt(fl(d,n)),l=o?`<a href="${Sl(o)}" target="_blank" rel="noopener noreferrer" style="text-decoration:none;line-height:0;display:inline-block;">${t}</a>`:t;J+=`<div style="text-align:${Sl(e)};margin-bottom:10px;line-height:0;">${l}</div>`}if(a&&f.trim()&&(J+=`<p style="${V}font-weight:600;margin:0 0 10px 0;">${Sl(f)}</p>`),i&&_&&(J+=`<p style="${V}margin:0 0 10px 0;opacity:0.92;">${Sl(_)}</p>`),m&&k.trim()&&(J+=`<p style="${V}margin:0 0 10px 0;">${Sl(k)}</p>`),h){const e=Array.isArray(N)?N.filter(Boolean):[];if(e.length>0){const t=ct.medium,o=e.map(e=>{const o=nt(fl(e.linkURL,n),{allowMailtoTel:!1}),{src:l,styleAttr:a}=wt(e,"default",t),i=`<img src="${Sl(l)}" alt="" width="${t}" height="${t}" style="${a}" border="0"/>`,r="text-decoration:none;display:inline-block;vertical-align:middle;line-height:0;margin:0 6px;";return o?`<a href="${Sl(o)}" target="_blank" rel="noopener noreferrer" style="${r}">${i}</a>`:`<span style="${r}">${i}</span>`}).join(""),l="left"===A?"left":"right"===A?"right":"center";J+=`<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%" style="width:100%;border-collapse:collapse;margin-bottom:10px;"><tr><td align="${l}" style="text-align:${l};font-size:0;line-height:0;">${o}</td></tr></table>`}}if(g){const e=Sl(bl(x,n)),t=Sl(bl(S,n));let o=`<p style="${V}margin:0 0 10px 0;word-break:break-word;">`;e&&(o+=`${e} `),o+=`<a href="${Sl(nt(fl(w,n)))}" style="${G}">${t}</a>`,o+="</p>",J+=o}if(y&&C.length>0){let e=`<p style="${V}margin:0 0 10px 0;word-break:break-word;">`;C.forEach((t,o)=>{o>0&&(e+='<span style="padding:0 6px;">·</span>');const l=Sl(bl(t.label,n)),a=Sl(nt(fl(t.url,n))),i="_blank"===t.target?' target="_blank" rel="noopener noreferrer"':"";e+=`<a href="${a}" style="${G}"${i}>${l||`#${o+1}`}</a>`}),e+="</p>",J+=e}if(b&&v.trim()){J+=`<p style="${V}font-size:${Math.max(10,B-1)}px;margin:0;opacity:0.9;">${Sl(v)}</p>`}var Y;return q.push(`<td${H} style="width:${j};${K}">${Y=J,`<table role="presentation" cellpadding="0" cellspacing="0" border="0" width="100%" style="width:100%;"><tr><td align="${Sl(A)}" style="${V}text-align:${Sl(A)};background-color:${Sl(M)};padding:${I}px ${$}px ${P}px ${R}px;${W?`border-top:${W};`:""}">${Y}</td></tr></table>`}</td>`),q.join("")}(e,e.children?.find(e=>"content"===e.key)??e.children?.[0]??null,n):Hl(e.children,t,n,f,_,k);if("discount"===e.containerType){const t=e.styles?.desktop??{},n=e=>"number"==typeof e?`${e}px`:String(e??""),o=[t.paddingTop?`padding-top:${n(t.paddingTop)};`:"",t.paddingRight?`padding-right:${n(t.paddingRight)};`:"",t.paddingBottom?`padding-bottom:${n(t.paddingBottom)};`:"",t.paddingLeft?`padding-left:${n(t.paddingLeft)};`:""].join(""),l=e.styleConfig.desktop.replace(/padding(?:-(?:top|right|bottom|left))?:[^;]+;?\s*/gi,""),a=o?`<tr><td style="${o}"><table role="presentation" cellpadding="0" cellspacing="0" border="0" style="width:100%;border-collapse:collapse;"><tbody><tr>${v}</tr></tbody></table></td></tr>`:`<tr>${v}</tr>`;i+=`<div ${e.styleConfig.mobile?`class="${e.styleConfig.className}"`:""}\n style="${l}width:100%;display:block;${u}">\n <table ${e.contentStyleConfig.mobile?`class="${e.contentStyleConfig.className}"`:""}\n style="width:100%;max-width:${b};margin:0 auto;${d}${e.contentStyleConfig?.desktop??""}${h}${p}${m}">\n <tbody>${a}</tbody>\n </table></div>`}else i+=`<div ${e.styleConfig.mobile?`class="${e.styleConfig.className}"`:""}\n style="${e.styleConfig.desktop}width:100%;display:block;${u}">\n <table ${e.contentStyleConfig.mobile?`class="${e.contentStyleConfig.className}"`:""}\n style="width:100%;max-width:${b};margin:0 auto;${d}${e.contentStyleConfig?.desktop??""}${h}${p}${m}">\n <tbody><tr>${v}</tr></tbody>\n </table></div>`}if("content"===e.key&&(i+=`<td ${e.styleConfig.mobile?`class="${e.styleConfig.className}"`:""} \n style="width:${e.width}; ${e.styleConfig.desktop}">${Hl(e.children,t,n,o,l,s)}</td>`),"text"===e.key){const t=null!=o?{columnIndex:l??0,columnProduct:o?.columnProducts?.[a??0]??null}:r;e.type&&/^h[1-4]$/.test(e.type)?i+=Wl(e,n,t):i+=((e,t,n={},o=null)=>{let l=Ol(e);t&&l&&(l=Co(l,t,n));const a=e?.styles?.desktop??{},i=null!=a.linkColor&&""!==String(a.linkColor).trim();l=Ho(l,i?String(a.linkColor).trim():zl,{useImportant:i});const r="footer"===o?.containerType,s=null==(c=l)||"string"!=typeof c?"":c.replace(/<[^>]+>/g,"").replace(/\s+/g," ").trim();var c;return!r||""!==s&&"{{Address}}"!==s&&"{{Tagline}}"!==s?`<div ${e.styleConfig?.mobile?`class="${e.styleConfig.className}"`:""} \n style="${e.styleConfig?.desktop||""}">${l}</div>`:""})(e,n,t,o)}if("heading"===e.key&&(i+=Wl(e,n,r)),"image"===e.key){i+=((e,t,n={},o=null)=>{let l=e.src||"";const a="string"==typeof e.src&&/^\{\{\s*[\w.]+\s*\}\}$/.test(e.src.trim())?e.src.trim():"";if(t&&a){const e=$o(t,a.replace(/^\{\{\s*|\s*\}\}$/g,""),n);e&&!/^\{\{\s*[\w.]+\s*\}\}$/.test(String(e).trim())&&(l=e)}l=ll(l);const i=$l(l),r=$l(e.alt||"Image"),s=null!=e.linkURL?String(e.linkURL).trim():"",c=Array.isArray(e.overlayItems)?e.overlayItems:[],d=c.some(e=>""!==String(e?.text??"").trim()),u=String(e.overlayText??"").trim(),p=Boolean(e.textOverlayEnabled)&&(d||""!==u)&&l,m=`${e.styleConfig?.desktop||""};max-width:100%;display:inline-block;vertical-align:top;`;let g=`<img src="${i}" alt="${r}" style="${m}" ${e.styleConfig?.mobile?`class="${e.styleConfig.className}"`:""}/>`;if(p){const t=pl(ul(e.overlayPosition)),n=Object.entries({position:"absolute",...t,"z-index":"2","max-width":`${"number"==typeof e.overlayMaxWidth?e.overlayMaxWidth:100}%`,"box-sizing":"border-box","pointer-events":"none"}).map(([e,t])=>`${e}:${t};`).join(""),l="number"==typeof e.overlayPadding?e.overlayPadding:16,a=e.textShadowEnabled?"text-shadow:0 1px 3px rgba(0,0,0,0.55);":"";let s="";if(d){const t="number"==typeof e.overlayItemGap?e.overlayItemGap:8,n=c.filter(e=>String(e?.text??"").trim()).map(e=>{const t="number"==typeof e.fontSize?e.fontSize:16,n=$l(e.color||"#ffffff"),l=(e=>{switch(e){case"h1":case"h2":case"h3":return"700";case"subtitle":case"eyebrow":return"600";default:return"400"}})(e.kind),i=null!=e.fontFamily&&""!==String(e.fontFamily).trim()?String(e.fontFamily).trim():String(o?.styles?.fontFamily||"sans-serif").trim()||"sans-serif",r=$l(i),s=Il(String(e.text??""));return`<div style="color:${n};font-size:${t}px;font-weight:${l};line-height:1.35;font-family:${r};${a}">${s}</div>`});s=`<div style="display:flex;flex-direction:column;gap:${t}px;width:100%;padding:${l}px;">${n.join("")}</div>`}else s=`<div style="color:${$l(e.overlayTextColor||"#ffffff")};font-size:${"number"==typeof e.overlayFontSize?e.overlayFontSize:18}px;font-weight:600;line-height:1.35;${e.overlayBoxBackground?`background-color:${$l(e.overlayBoxBackground)};padding:8px 12px;`:`padding:${l}px;`}${a}">${Il(u)}</div>`;g=`<div style="position:relative;display:inline-block;vertical-align:top;max-width:100%;overflow:hidden;line-height:0;">\n ${e.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="${i}" alt="${r}" style="${m}position:relative;z-index:0;border-radius:0;" ${e.styleConfig?.mobile?`class="${e.styleConfig.className}"`:""}/>\n <div style="${n}">\n ${s}\n </div>\n </div>`}const h=jo(e)&&""!==s?`<a href="${$l(Pl(s))}" target="_blank" rel="noopener noreferrer" style="text-decoration:none;display:inline-block;max-width:100%;">${g}</a>`:g,y=e.imageHostMarginStyleConfig,b=y&&(y.desktop||y.mobile)?`<div ${y.mobile?`class="${y.className}"`:""} style="display:inline-block;vertical-align:top;max-width:100%;${y.desktop||""}">${h}</div>`:h;return`<div ${e.contentStyleConfig.mobile?`class="${e.contentStyleConfig.className}"`:""} \n style="${El(e)}">\n ${b}\n </div>`})(e,n,null!=o?{columnIndex:l??0,columnProduct:o?.columnProducts?.[a??0]??null}:r,t)}if("video"===e.key&&(i+=(e=>{const t=null!=e.videoUrl?String(e.videoUrl).trim():"",n=ml(t,null!=e.thumbnailUrl?String(e.thumbnailUrl).trim():""),o=t?Pl(t):"#",l=`${e.styleConfig?.desktop||""};max-width:100%;height:auto;display:block;border:0;`,a=e.contentStyleConfig?.desktop||"",i=e.videoAreaStyleConfig?.desktop||"";return`<div ${e.contentStyleConfig?.mobile?`class="${e.contentStyleConfig.className}"`:""} style="${a}">\n <div ${e.videoAreaStyleConfig?.mobile?`class="${e.videoAreaStyleConfig.className}"`:""} style="${i}">\n ${n?`<a href="${$l(o)}" target="_blank" rel="noopener noreferrer" style="text-decoration:none;display:inline-block;max-width:100%;line-height:0;"><img src="${$l(n)}" alt="${$l("Video")}" style="${l}"/></a>`:`<a href="${$l(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>`})(e)),"button"===e.key){i+=jl(e,n,null!=o?{columnIndex:l??0,columnProduct:o?.columnProducts?.[a??0]??null}:r,o)}var c,d;"divider"===e.key&&(i+=`<div ${(c=e).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"===e.key&&(i+=(d=e,`<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"===e.key&&(i+=(e=>{const t=e.list||[],n=null!=e.separator?String(e.separator):" | ",o=e.styleConfig?.desktop||"",l=e.contentStyleConfig?.desktop||"",a=e.linkGapPx,i="number"==typeof a&&Number.isFinite(a)&&a>=0?a:0,r=Boolean(e.linkUnderline),s=e.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 t.forEach((e,t)=>{t>0&&(u+=`<span style="${i>0?`display:inline-block;margin-left:${i}px;margin-right:${i}px;font-size:${c};color:${d};`:`display:inline-block;padding-left:4px;padding-right:4px;font-size:${c};color:${d};`}">${Il(n)}</span>`);const l=Pl(e.url,"#"),a="_blank"===e.target?"_blank":"_self",s=Il(e.label||"Link"),p=r?"underline":"none";u+=`<a target="${a}" href="${$l(l)}" style="${o};text-decoration:${p};display:inline-block;">${s}</a>`}),`<div ${e.contentStyleConfig?.mobile?`class="${e.contentStyleConfig.className}"`:""} style="${l}">${u}</div>`})(e)),"avatar"===e.key&&(i+=(e=>{const t=e.src||"",n=e.alt||"Avatar",o=e.linkURL,l=e.styleConfig?.desktop||"",a=e.styles?.desktop?.width??64,i=`max-width:100%;width:${"number"==typeof a?a+"px":a};height:${"number"==typeof a?a+"px":a};object-fit:cover;border-radius:${e.styles?.desktop?.borderRadius??"50%"};${l}`,r=$l(t),s=$l(n),c=t?`<img src="${r}" alt="${s}" style="${i}" />`:`<div style="${i};background:#eee;display:flex;align-items:center;justify-content:center;"></div>`,d=e.contentStyleConfig?.desktop||"",u=o?`<a href="${$l(Pl(o))}" target="_blank" rel="noopener noreferrer">${c}</a>`:c;return`<div ${e.contentStyleConfig?.mobile?`class="${e.contentStyleConfig.className}"`:""} style="${d}">${u}</div>`})(e)),"social_link"===e.key&&(i+=(e=>{const t=Array.isArray(e.list)?e.list.filter(Boolean):[];if(0===t.length)return"";const n=Boolean(e.showTextLabel),o=_t(e),l=Math.max(11,Math.round(.58*o)),a=rt(e.iconColor),i=e?.contentStyles?.desktop??{},r=i.textAlign||"center",s="justify"===r,c="right"===r?"right":"left"===r?"left":"center",d=i.columnGapPx,u="number"==typeof d&&Number.isFinite(d)&&d>=0?d:8,p=Math.max(0,Math.round(u/2)),m=e.styleConfig?.desktop||"",g=e.styleConfig?.mobile?` class="${e.styleConfig.className}"`:"",h=(e,t="")=>{const{title:i,linkURL:r}=e,s=nt(r,{allowMailtoTel:!1}),{src:c,styleAttr:d}=wt(e,a,o),u=n?d.replace(/display:\s*block/i,"display:inline-block"):d,p=`<img src="${$l(c)}" alt="${$l(i)}" width="${o}" height="${o}" style="${$l(u)}" border="0"${g}/>`,h=at(e)?"X":String(i??""),y=n?`<span style="font-size:${l}px;line-height:1.2;color:#525252;font-family:inherit;white-space:nowrap;display:inline-block;vertical-align:middle;margin-left:6px;">${Il(h)}</span>`:"",b=`text-decoration:none;display:inline-block;vertical-align:middle;line-height:0;${t}${m?`;${m}`:""}`;return s?`<a target="_blank" rel="noopener noreferrer" href="${$l(s)}" style="${b}">${p}${y}</a>`:`<span style="${b}">${p}${y}</span>`},y=`${e.contentStyleConfig?.desktop||""};text-align:${c};`,b=e.contentStyleConfig?.mobile?` class="${e.contentStyleConfig.className}"`:"";let f;if(s&&t.length>1){const e=(100/t.length).toFixed(4);f=`<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%" style="width:100%;border-collapse:collapse;"><tr>${t.map((n,o)=>{const l=0===o?"left":o===t.length-1?"right":"center";return`<td width="${e}%" style="width:${e}%;text-align:${l};vertical-align:middle;line-height:0;font-size:0;padding:0;">${h(n)}</td>`}).join("")}</tr></table>`}else f=t.map(e=>h(e,`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${b} align="${c}" style="${y}">${f}</td></tr></table>`})(e)),"raw_html"===e.key&&(i+=(e=>{const t=function(e){const t=e.match(/<body[^>]*>([\s\S]*?)<\/body>/i);return t?t[1]:/<html[\s>]/i.test(e)||/<!DOCTYPE/i.test(e)?e.replace(/<!DOCTYPE[^>]*>/gi,"").replace(/<html[^>]*>/gi,"").replace(/<\/html>/gi,"").replace(/<head[\s\S]*?<\/head>/gi,"").replace(/<\/?body[^>]*>/gi,"").trim():e}(e.html??""),n=e.contentStyleConfig?.desktop??"",o=e.contentStyleConfig?.mobile?`class="${e.contentStyleConfig.className}"`:"",l=e.contentStyles?.desktop??{},a=l.width,i=l.textAlign??"center";let r="";return null!=a&&"100%"!==String(a)&&"center"===i?r="margin-left:auto;margin-right:auto;":null!=a&&"100%"!==String(a)&&"right"===i?r="margin-left:auto;margin-right:0;":null==a||"100%"===String(a)||"left"!==i&&"justify"!==i||(r="margin-left:0;margin-right:auto;"),`<div ${o} style="${r}max-width:100%;${n}">${t}</div>`})(e)),"table"===e.key&&(i+=(e=>{const t=e.contentStyleConfig?.desktop||"",n=e.contentStyleConfig?.mobile?`class="${e.contentStyleConfig.className}"`:"",o=e.styles?.desktop??{},l="number"==typeof e.rows?e.rows:3,a="number"==typeof e.cols?e.cols:3,i=Boolean(e.headerRow),r=Boolean(e.headerCol),s=Boolean(e.stripedRows),c=o.fontSize??14,d=o.color??"#333333",u=o.borderStyle??"solid",p=o.borderWidth??1,m=o.borderColor??"#e0e0e0",g=o.cellPadding??8,h=o.textAlign??"left",y=o.headerBg??"#f5f5f5",b=o.headerColor??"#333333",f=o.stripedBg??"#fafafa",_="none"!==u?`${p}px ${u} ${m}`:"none",k=Array.from({length:l}).map((t,n)=>{const o=Array.from({length:a}).map((t,o)=>{const l=i&&0===n||r&&0===o,a=l?y:s&&!l&&n%2==0?f:"transparent",u=l?b:d,p=l?"600":"400",m=`${n}-${o}`,k=e.cells?.[m],v=i&&0===n||r&&0===o?"th":"td";let w="—";return"image"===k?.type&&String(k.src??"").trim()?w=`<img src="${$l(k.src)}" alt="${$l(k.alt||"")}" style="max-width:100%;height:auto;display:block;border:0;"/>`:String(k?.text??"").trim()&&(w=Il(String(k.text))),`<${v} style="border:${_};padding:${g}px;font-size:${c}px;color:${u};text-align:${h};background-color:${a};font-weight:${p};vertical-align:top;">${w}</${v}>`}).join("");return`<tr>${o}</tr>`}).join("");return`<div ${n} style="${t}"><table role="presentation" style="${e.styleConfig?.desktop||""};border-collapse:collapse;width:100%;table-layout:auto;"><tbody>${k}</tbody></table></div>`})(e))}),i},Kl={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"}},Vl=e=>Array.isArray(e)?e.filter(e=>!(e&&"object"==typeof e&&!0===e.hidden)).map(e=>e&&"object"==typeof e&&Array.isArray(e.children)?{...e,children:Vl(e.children)}:e):e,Gl=({bodySettings:e,blockList:t,templateData:n})=>{let o="";const l=((e,t)=>{if(!Array.isArray(e))return e;const n=t?.content?.products;if(!Array.isArray(n)||0===n.length)return e;const o=t?.content?.primaryProductId,l=(o?n.find(e=>e?.id===o):n[0])??n[0]??null;if(!l)return e;const a=n.filter(e=>e?.id!==l.id),i=e=>{if(!e||"object"!=typeof e)return e;const t=Array.isArray(e.children)?e.children.map(i):e.children;if("column"!==e.key||"product"!==e.containerType)return{...e,children:t};const n="additional"===e.productRole?"additional":"main",o=Math.max(Array.isArray(t)?t.length:0,Array.isArray(e.columnProducts)?e.columnProducts.length:0,1),r=Array.from({length:o},(e,t)=>"main"===n||0===a.length?l:a[t%a.length]);return{...e,children:t,columnProducts:r}};return e.map(i)})(Vl(t??[]),n),{newBlockList:a,styles:i}=Ul(l);o=Hl(a,e,n);const r=tl(l,e,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 ${e.styles?.headingColor?`color: ${e.styles.headingColor};`:""}\n }\n\n a {\n ${e.styles?.linkColor?`color: ${e.styles.linkColor};`:""}\n }\n\n @media(max-width:620px){\n${!1!==e.stackColumnsOnMobile?" td {\n display:inline-block;\n width:100% !important;\n }\n":""}${!1!==e.scaleFontOnMobile?" body { font-size: 16px !important; }\n":""} }\n ${r}\n ${i}\n</style>\n </head>\n <body>\n <div style="opacity:0;">${e.preHeader}</div>\n <div style="background-color:${e.styles.backgroundColor};color:${e.styles.color}; font-family:${e.styles.fontFamily};"> ${o}</div>\n </body>\n </html>`};function ql(e){let t=e;if("string"==typeof e)try{t=JSON.parse(e)}catch(e){throw new Error("exportNormalizerToHtml: invalid JSON")}if(null==t)throw new Error("exportNormalizerToHtml: input is null or undefined");let n=[],o={...Kl,styles:{...Kl.styles}};Array.isArray(t)?n=t:"object"==typeof t&&(n=Array.isArray(t.blockList)?t.blockList:[],t.bodySettings&&"object"==typeof t.bodySettings&&(o={preHeader:null!=t.bodySettings.preHeader?t.bodySettings.preHeader:Kl.preHeader,contentWidth:Et(t.bodySettings.contentWidth??Kl.contentWidth),contentWidthMode:t.bodySettings.contentWidthMode??Kl.contentWidthMode,stackColumnsOnMobile:!1!==t.bodySettings.stackColumnsOnMobile,scaleFontOnMobile:!1!==t.bodySettings.scaleFontOnMobile,styles:{backgroundColor:t.bodySettings.styles?.backgroundColor??Kl.styles.backgroundColor,contentBg:t.bodySettings.styles?.contentBg??Kl.styles.contentBg,color:t.bodySettings.styles?.color??Kl.styles.color,headingColor:t.bodySettings.styles?.headingColor??Kl.styles.headingColor,linkColor:t.bodySettings.styles?.linkColor??Kl.styles.linkColor,fontFamily:t.bodySettings.styles?.fontFamily??Kl.styles.fontFamily}}));return`<!DOCTYPE html>\n${function(e){return e.replace(/\n/g," ").replace(/[ \t]{2,}/g," ").replace(/> </g,"><").trim()}(Gl({bodySettings:o,blockList:n,templateData:t.templateData}))}`}function Jl(e,t){if("section"===e.layoutRole||"columns"===e.layoutRole)return e.layoutRole;if(!0===e.columnLayoutOnly)return"columns";return t.length>1||e.type&&"full"!==e.type?"columns":"section"}const Yl=["product"];function Xl(e){return Array.isArray(e)?e:e&&"object"==typeof e?Object.values(e):[]}function Zl(e,t={}){if(!e||"object"!=typeof e)return e;if("image"===e.key){const n="string"==typeof e.imageVariable&&/^\{\{\w+\}\}$/.test(e.imageVariable.trim())?e.imageVariable.trim():"",o="string"==typeof e.src&&/^\{\{\w+\}\}$/.test(e.src.trim())?e.src.trim():"",{imageVariable:l,...a}=e,i=o||n||e.src,r=e=>{if(!e||"object"!=typeof e)return e;const{marginLeft:t,marginTop:n,...o}=e;return o},s=e.contentStyles?{desktop:r(e.contentStyles.desktop||{}),mobile:r(e.contentStyles.mobile||{})}:e.contentStyles;return{...a,src:i,...s?{contentStyles:s}:{},textOverlayEnabled:Boolean(e.textOverlayEnabled),overlayText:e.overlayText??"",overlayPosition:e.overlayPosition??"bc",overlayTextColor:e.overlayTextColor??"#ffffff",overlayFontSize:(()=>{const t=Number(e.overlayFontSize);return Number.isFinite(t)&&t>0?t:18})(),overlayBoxBackground:e.overlayBoxBackground??"",overlayPadding:(()=>{const t=Number(e.overlayPadding);return Number.isFinite(t)&&t>=0?t:16})(),scrimEnabled:Boolean(e.scrimEnabled),textShadowEnabled:Boolean(e.textShadowEnabled),children:Xl(e.children).map(e=>Zl(e,t))}}if("video"===e.key){const t=e.videoArea||{},n=t.desktop||{};return{...e,videoUrl:"string"==typeof e.videoUrl?e.videoUrl:"",thumbnailUrl:"string"==typeof e.thumbnailUrl?e.thumbnailUrl:"",videoArea:{desktop:{paddingTop:n.paddingTop??0,paddingBottom:n.paddingBottom??0,paddingLeft:n.paddingLeft??0,paddingRight:n.paddingRight??0,backgroundColor:n.backgroundColor??"transparent",borderWidth:n.borderWidth??0,borderStyle:n.borderStyle??"solid",borderColor:n.borderColor??"#cccccc",borderRadius:n.borderRadius??0},mobile:t.mobile??{}},styles:{desktop:{width:"auto",height:"auto",fillColumn:!1,fillColumnMobile:!1,display:"inline-block",...e.styles?.desktop||{}},mobile:{...e.styles?.mobile||{}}},contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center",backgroundColor:"transparent",...e.contentStyles?.desktop||{}},mobile:{...e.contentStyles?.mobile||{}}}}}if("column"===e.key){const{ctaText:n,container_type:o,...l}=e,a=function(e){if(!e||"object"!=typeof e)return null;const t=null!=e.containerType&&""!==e.containerType?e.containerType:e.container_type;return null==t||""===t?null:"string"!=typeof t?String(t).trim().toLowerCase()||null:t.trim().toLowerCase()}(e),i=a??e.containerType??null;let r=function(e){const t=null==e?null:String(e).trim().toLowerCase();return null==t||""===t||"none"===t?"none":"discount"===t?"discount":"header"===t?"header":"footer"===t?"footer":"product"===t||"hero_product"===t||"additional_product"===t?"product":"none"}(a??e.containerType);if("none"===r){const t=function(e){if(!e||"column"!==e.key)return null;if(!0===e.footerUnifiedLayout)return"footer";if(Array.isArray(e.footerSocialList)&&e.footerSocialList.length>0)return"footer";if(void 0!==e.showFooterBanner)return"footer";let t=!1,n=!1;const o=e=>{e&&"object"==typeof e&&((e.headerLogoSlot||e.headerBannerSlot||e.headerBannerDividerSlot)&&(t=!0),null!=e.footerSlot&&""!==String(e.footerSlot).trim()&&(n=!0),Xl(e.children).forEach(o))};return o(e),n?"footer":void 0!==e.showLogo||void 0!==e.showHeaderBanner||t?"header":null}(e);t&&(r=t)}const s="string"==typeof i?i.trim().toLowerCase():"",c="product"===r?e.productRole??("additional_product"===s?"additional":"main"):void 0,d=Xl(e.children);let u=e.columnProducts;if(Yl.includes(r)){const e=d.length;Array.isArray(u)||(u=[]),u=Array.from({length:e},(e,t)=>u[t]??null)}else u=[];return{...l,containerType:r,productRole:c,columnProducts:u,layoutRole:Jl(e,d),children:(d||[]).map(e=>Zl(e,t))}}if("heading"===e.key){const n=e.id?t?.[e.id]:null,o={...e,key:"text",name:e.name,type:e.type||"h1",contentType:e.contentType??"static",text:e.text,styles:e.styles,contentStyles:e.contentStyles,selectedVariableKey:e.selectedVariableKey,dynamicVariable:n?.variable??e.dynamicVariable,dynamicPrompt:n?.prompt??e.dynamicPrompt,dynamicSelectedContent:n?.selectedContent??e.dynamicSelectedContent,dynamicOptions:Array.isArray(n?.options)?n.options:n?.selectedContent?[n.selectedContent]:e.dynamicOptions};return"dynamic"===o.contentType&&(o.dynamicVariable=o.dynamicVariable??"",o.dynamicPrompt=o.dynamicPrompt??"",o.dynamicSelectedContent=o.dynamicSelectedContent??"",o.dynamicOptions=Array.isArray(o.dynamicOptions)?o.dynamicOptions:[],o.dynamicAiLanguage="bn-BD"===n?.language||"bn-BD"===o.dynamicAiLanguage?"bn-BD":"en"),{...o,children:Xl(e.children).map(e=>Zl(e,t))}}if("text"===e.key){const n=e.id?t?.[e.id]:null,o=e.contentType??"static",l={...e,type:e.type||"p",contentType:o};return"dynamic"===o&&(l.dynamicVariable=n?.variable??e.dynamicVariable??"",l.dynamicPrompt=n?.prompt??e.dynamicPrompt??"",l.dynamicSelectedContent=n?.selectedContent??e.dynamicSelectedContent??"",l.dynamicOptions=Array.isArray(n?.options)?n.options:n?.selectedContent?[n.selectedContent]:Array.isArray(e.dynamicOptions)?e.dynamicOptions:[],l.dynamicAiLanguage="bn-BD"===n?.language||"bn-BD"===e.dynamicAiLanguage?"bn-BD":"en"),{...l,children:Xl(e.children).map(e=>Zl(e,t))}}return{...e,children:Xl(e.children).map(e=>Zl(e,t))}}const Ql="https://api-alpha.markopolo.ai/v1",ea="https://nbq-ml-api-stg.markopolo.ai/v1",ta="95b48b5b-cf5e-486d-817e-9839d4c4e618";function na(e,t){const n=null!=(o=e)&&"string"==typeof o&&o.trim()?o.replace(/\/$/,""):Ql;var o;const l=function(e){return null!=e&&"string"==typeof e&&e.trim()?e.replace(/\/$/,""):ea}(t);return{imageUploadEndpoint:`${n}/upload-file`,imageUploadQueryParams:{show:!1},imageUploadCompanyField:"comment",productsEndpoint:`${n}/knowledge-base/products`,universalEmailBlocksEndpoint:`${n}/universal-email-blocks`,mlEmailNodesEndpoint:`${l}/ml-service/content/generate-email-nodes`,mlEmailGenerateEndpoint:`${l}/ml-service/content/generate-email`}}function oa(e={}){const t=e&&"object"==typeof e?e:{},{apiBaseUrlV1:n,apiBaseV1:o,mlGenerationApiBaseUrlV1:l,mlApiBaseUrlV1:a,headers:i,mlEmailGenerateBnEndpoint:r,...s}=t,c=n||o||Ql,d="undefined"!=typeof process&&process.env?.REACT_APP_ML_API_BASE_V1,u=na(c,l||a||d||ea),p="undefined"!=typeof process?String(process.env?.REACT_APP_EMAIL_TEMPLATE_ID??"").trim():"",m={...u,...s};m.mlEmailGenerateEndpoint&&String(m.mlEmailGenerateEndpoint).trim()||!r||(m.mlEmailGenerateEndpoint=String(r).replace(/\/generate-email\/bn\/?$/i,"/generate-email"));const g=String(m.emailTemplateId??"").trim()||p||ta;return{...m,emailTemplateId:g,headers:{...m.headers||{},...i||{}}}}function la(e,t,n){const o=String(e??"").trim(),l=t&&"object"==typeof t?JSON.parse(JSON.stringify(t)):{name:"Block",key:"column"};l.name||(l.name="column"===l.key?"Container":o||"Block"),l.key||(l.key="column"),"column"===l.key&&Array.isArray(l.children)&&l.children.length>0&&delete l.cells;const a="column"===l.key?String(l.containerType??"none"):"none",i=function(e){if(!e||"object"!=typeof e)return"content";const t=String(e.key??"").toLowerCase();if("column"===t){const t=String(e.containerType??"none").toLowerCase();return"header"===t?"header":"footer"===t?"footer":"none"===t||""===t?"column":"content"}return"image"===t?"image":"menu"===t?"menu":"content"}(l),r="undefined"!=typeof performance&&performance.now?Math.floor(performance.now()):Date.now(),s=String(l.id??r).replace(/-/g,"").slice(0,12),c=`preset_${d=o,String(d??"").toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"").slice(0,48)||"block"}_${s}`;var d;return{companyId:String(n),blockName:o,blockType:i,presetId:c,presetName:o,nameKey:c,containerType:a,block:l}}function aa(e,t){if(!e||"object"!=typeof e)return null!=t?`Request failed (${t})`:"Request failed";const n=e.error;if(n&&"object"==typeof n&&null!=n.message){const e=String(n.message).trim();if(e){const t=null!=n.code?String(n.code).trim():"";return t&&t!==e&&!e.toLowerCase().includes(t.toLowerCase())?`${t}: ${e}`:e}}return"string"==typeof n&&n.trim()?n.trim():"string"==typeof e.message&&e.message.trim()?e.message.trim():null!=t?`Request failed (${t})`:"Request failed"}function ia(e){const t=e?.universalEmailBlocksEndpoint;if(t&&String(t).trim())return String(t).replace(/\/$/,"");const n=String(e?.apiBaseUrlV1||e?.apiBaseV1||"").replace(/\/$/,"");return n?`${n}/universal-email-blocks`:""}function ra(e){return{"Content-Type":"application/json",...e?.headers||{}}}function sa(e){if(!e||"object"!=typeof e)return null;const t=e.resourceId??e.id;if(!t)return null;let n=e.block;if("string"==typeof n)try{n=JSON.parse(n)}catch{n=null}n&&"object"==typeof n||(n={});const o=e.blockMap??e.blocks??e.blockSnapshotMap;if("column"===n.key&&o&&"object"==typeof o){const e=Array.isArray(o)?o.reduce((e,t)=>(t&&"object"==typeof t&&t.id&&(e[t.id]=t),e),{}):{...o};Object.keys(e).length>0&&(n={...n,blockMap:e})}return{id:t,name:e.blockName??e.name??"Saved block",block:n,resourceId:e.resourceId??t,blockType:e.blockType}}const ca={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 da(e){const t=String(e??"").trim();return/^\{\{[A-Za-z_]\w*\}\}$/.test(t)}const ua=/^\s*\{\{[\s\S]*\}\}\s*$/;function pa(e){const t=String(e??"").trim();if(!t)return!1;if("#"===t)return!1;if(t.startsWith("#")&&t.length>1)return!1;if(ua.test(t))return!1;if(da(t))return!1;const n=t.toLowerCase();return!n.startsWith("http://")&&!n.startsWith("https://")&&(!n.startsWith("mailto:")&&!n.startsWith("tel:")&&!n.startsWith("//"))}function ma(e){if(!e||"object"!=typeof e)return"";return`${e.severity??"unknown"}:${e.code??"issue"}:${e.blockId??"global"}:${e.location??""}`}function ga(e){let t=!1;const n=e=>{if(Array.isArray(e))for(const o of e)o&&"object"==typeof o&&("text"===o.key&&"dynamic"===o.contentType&&"bn-BD"===o.dynamicAiLanguage&&(t=!0),Array.isArray(o.children)&&n(o.children))};return n(Array.isArray(e)?e:[]),t?"bn-BD":"en"}function ha(e,t=!1){if(null==e||""===String(e).trim())return t;const n=String(e).trim();try{return/^https?:\/\//i.test(n)?new URL(n):new URL("https://"+n),!0}catch{return!1}}const ya={text:"Text",heading:"Heading",button:"Button",image:"Image",video:"Video",avatar:"Profile image",menu:"Menu",social_link:"Social links",raw_html:"HTML"};const ba={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 fa(e,t,n){const o=e.containerType??"none",l=function(e){const t=e??"none";return ba[t]?ba[t]:String(t).replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}(o);return n<=1?l:"none"===o?`${_a(t+1)} section`:`${_a(t+1)} ${l} block`}function _a(e){const t=e%10,n=e%100;return 1===t&&11!==n?`${e}st`:2===t&&12!==n?`${e}nd`:3===t&&13!==n?`${e}rd`:`${e}th`}function ka(e,t,n){const o=function(e){return ya[e]?ya[e]:String(e||"block").replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}(t),l=[...e],a=l.length>0?l.join(" → "):"Email body";return n?`${o} ("${n}") — ${a}`:`${o} — ${a}`}function va(e,t){const n=function(e){return null==e||"object"!=typeof e?{...ca,styles:{...ca.styles}}:{preHeader:null!=e.preHeader?e.preHeader:ca.preHeader,contentWidth:Et(null!=e.contentWidth?e.contentWidth:ca.contentWidth),stackColumnsOnMobile:!1!==e.stackColumnsOnMobile,scaleFontOnMobile:!1!==e.scaleFontOnMobile,styles:{backgroundColor:null!=e.styles?.backgroundColor?e.styles.backgroundColor:ca.styles.backgroundColor,contentBg:null!=e.styles?.contentBg?e.styles.contentBg:ca.styles.contentBg,color:null!=e.styles?.color?e.styles.color:ca.styles.color,headingColor:null!=e.styles?.headingColor?e.styles.headingColor:ca.styles.headingColor,linkColor:null!=e.styles?.linkColor?e.styles.linkColor:ca.styles.linkColor,fontFamily:null!=e.styles?.fontFamily?e.styles.fontFamily:ca.styles.fontFamily}}}(e);("number"!=typeof n.contentWidth||!Number.isFinite(n.contentWidth)||n.contentWidth<=0)&&t.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()||t.push({severity:"error",code:"body_background_color_missing",message:"Theme background color is missing.",location:"Theme settings"}),null!=o.color&&""!==String(o.color).trim()||t.push({severity:"error",code:"body_text_color_missing",message:"Theme text color is missing.",location:"Theme settings"}),null!=o.fontFamily&&""!==String(o.fontFamily).trim()||t.push({severity:"error",code:"body_font_family_missing",message:"Theme font family is missing.",location:"Theme settings"})}function wa(e,t){e.push(t)}function xa(e){return null==e?"":String(e).replace(/&/gi,"&").replace(/"/gi,'"').replace(/'/g,"'").trim()}function Sa(e){if(null==e||"string"!=typeof e)return[];const t=[],n=/<a\b[^>]*?\bhref\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>"']+))/gi;let o=n.exec(e);for(;o;){const l=o[1]??o[2]??o[3]??"";t.push(xa(l)),o=n.exec(e)}return t}function Ca(e,t=!0){const n=String(e??"").trim();return n?da(n)?null:lt(n,!1,{allowMailtoTel:t}):null}function Na(e,t,n){const o=e.linkURL,l=()=>ka(t,"button",void 0),a=e.id??null;null==o||""===String(o).trim()?wa(n,{severity:"warning",code:"button_empty_link",message:'Button link URL is empty; will be saved as href="https://".',location:l(),blockId:a}):Qe(o)?wa(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:l(),blockId:a}):da(o)||ot(o,!1,{allowMailtoTel:!0})?!da(o)&&pa(o)&&wa(n,{severity:"warning",code:"button_link_missing_protocol",message:"Button link should start with https://, http://, mailto:, or tel: for reliable email clients.",location:l(),blockId:a}):wa(n,{severity:"warning",code:"button_invalid_link",message:"Button link URL format is invalid.",location:l(),blockId:a}),function(e,t,n,o,{invalidCode:l,invalidMessage:a,blockedCode:i,blockedMessage:r,missingProtocolCode:s,missingProtocolMessage:c}){Sa(e??"").forEach((e,d)=>{const u=String(e??"").trim();""!==u&&(Qe(u)?wa(t,{severity:"error",code:i,message:r,location:n(d),blockId:o}):ot(u,!1,{allowMailtoTel:!0})?pa(u)&&wa(t,{severity:"warning",code:s,message:c,location:n(d),blockId:o}):wa(t,{severity:"warning",code:l,message:a,location:n(d),blockId:o}))})}(e.text,n,e=>ka(t,"button",`label link ${e+1}`),a,{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 La=["product"];function Ta(e,t,n,o,l){(function(...e){const t=new Set,n=[];for(const o of e)if(null!=o&&""!==String(o).trim())for(const e of Sa(String(o))){const o=String(e).trim();o&&!t.has(o)&&(t.add(o),n.push(e))}return n})(e.text,e.dynamicSelectedContent).forEach((l,a)=>{const i=String(l??"").trim();""!==i&&(i.startsWith("#")||ua.test(i)||(Qe(i)?wa(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:ka(t,o,`link ${a+1}`),blockId:e.id??null}):ot(i,!1,{allowMailtoTel:!0})?pa(i)&&wa(n,{severity:"warning",code:"text_link_missing_protocol",message:"Text link should start with https://, http://, mailto:, or tel: for reliable email clients.",location:ka(t,o,`link ${a+1}`),blockId:e.id??null}):wa(n,{severity:"warning",code:"text_invalid_link",message:"Text link URL format is invalid.",location:ka(t,o,`link ${a+1}`),blockId:e.id??null})))});if("dynamic"!==(e.contentType??"static"))return;const a=e.dynamicSelectedContent,i=null!=e?.id?l?.[e.id]?.selectedContent:void 0;let r=null!=a&&""!==String(a).trim()?a:i;var s;null!=r&&""!==String(r).trim()||null==e.text||""===(null==(s=e.text)?"":String(s).replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim())||(r=e.text),null!=r&&""!==String(r).trim()||wa(n,{severity:"warning",code:"dynamic_content_empty",message:"Dynamic content not generated; export will use static text if available.",location:ka(t,o,void 0),blockId:e.id??null})}function Ba(e,t,n){const o=e.list||[],l=new Set;o.forEach((o,a)=>{const i=o.title||o.image||`link ${a+1}`,r=e=>ka(t,"social_link",e||i),s=function(e){const t=String(e?.image||"").trim();if(t)return`img:${t}`;const n=String(e?.title||"").trim().toLowerCase();return n?`title:${n}`:null}(o);s&&(l.has(s)?wa(n,{severity:"warning",code:"social_duplicate_platform",message:"Duplicate social platform in this block; only one entry per platform should be kept.",location:r(i),blockId:e.id??null}):l.add(s));const c=o.linkURL;if(null==c||""===String(c).trim()){const t=String(o?.title||"").trim()||`Item ${a+1}`;wa(n,{severity:"warning",code:"social_empty_link",message:`${t} URL is empty — add https URL before sending; the icon still previews without an outbound link.`,location:r(i),blockId:e.id??null})}else Qe(c)?wa(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:r(i),blockId:e.id??null}):ot(c,!1,{allowMailtoTel:!1})||wa(n,{severity:"warning",code:"social_invalid_link",message:"Social link URL format is invalid.",location:r(i),blockId:e.id??null});const d=o.image;null==d||""===String(d).trim()?wa(n,{severity:"warning",code:"social_empty_icon",message:"Social link icon URL is empty; icon will not display.",location:r(i),blockId:e.id??null}):ha(d,!1)||wa(n,{severity:"warning",code:"social_invalid_icon",message:"Social link icon URL format is invalid.",location:r(i),blockId:e.id??null})}),0===o.length&&wa(n,{severity:"info",code:"social_no_links",message:"Social link block has no links.",location:ka(t,"social_link",void 0),blockId:e.id??null})}function Aa(e,t,n,o,l){if(!Array.isArray(e))return;const a=e.length;e.forEach((e,i)=>{if(!e||"object"!=typeof e)return;if(!0===e.hidden)return;const r=e.key;if("column"===r){const r=fa(e,i,a),s=[...t,r];return function(e,t,n){const o=e.containerType??"none";if(!La.includes(o))return;const l=e.children??[],a=e.columnProducts??[];l.forEach((o,i)=>{const r=a[i];if(null==r||"object"==typeof r&&!r.id){const o=l.length>1?`Column ${i+1} of ${l.length}`:"This column",a=[...t,o].join(" → ");wa(n,{severity:"warning",code:"container_product_not_assigned",message:"A product is not assigned to this column; assign a product in Container settings.",location:a,blockId:e.id??null})}})}(e,s,n),void(Array.isArray(e.children)&&Aa(e.children,s,n,o,l))}if("content"===r){const r=a>1?`Column ${i+1} of ${a}`:null,s=r?[...t,r]:t;return void(Array.isArray(e.children)&&Aa(e.children,s,n,o,l))}switch(r){case"image":!function(e,t,n){const o=e.src,l=()=>ka(t,"image",void 0);null!=o&&""!==String(o).trim()?(ha(o,!1)||wa(n,{severity:"warning",code:"image_invalid_src",message:"Image URL format is invalid.",location:l(),blockId:e.id??null}),jo(e)&&Ca(e.linkURL,!0)&&wa(n,{severity:"warning",code:"image_invalid_link",message:"Image link URL format is invalid.",location:l(),blockId:e.id??null}),null!=e.alt&&""!==String(e.alt).trim()||wa(n,{severity:"info",code:"image_empty_alt",message:"Image alt text is empty; consider adding for accessibility.",location:l(),blockId:e.id??null})):wa(n,{severity:"error",code:"image_empty_src",message:"Image URL is empty; the image will not display.",location:l(),blockId:e.id??null})}(e,t,n);break;case"video":!function(e,t,n){const o=()=>ka(t,"video",void 0),l=null!=e.videoUrl?String(e.videoUrl).trim():"";l?ha(l,!1)||wa(n,{severity:"warning",code:"video_invalid_url",message:"Video URL format may be invalid.",location:o(),blockId:e.id??null}):wa(n,{severity:"error",code:"video_empty_url",message:"Video URL is empty; the video will not display.",location:o(),blockId:e.id??null})}(e,t,n);break;case"avatar":!function(e,t,n){const o=e.src,l=()=>ka(t,"avatar",void 0);null==o||""===String(o).trim()?wa(n,{severity:"warning",code:"avatar_empty_src",message:"Avatar image URL is empty; avatar will not display.",location:l(),blockId:e.id??null}):ha(o,!1)||wa(n,{severity:"warning",code:"avatar_invalid_src",message:"Avatar image URL format is invalid.",location:l(),blockId:e.id??null}),Ca(e.linkURL,!0)&&wa(n,{severity:"warning",code:"avatar_invalid_link",message:"Avatar link URL format is invalid.",location:l(),blockId:e.id??null})}(e,t,n);break;case"button":Na(e,t,n);break;case"menu":!function(e,t,n){const o=e.list||[];o.forEach((o,l)=>{const a=String(o.label??"").trim()||`Item ${l+1}`,i=e=>ka(t,"menu",e||`Item ${l+1}`);null!=o.label&&""!==String(o.label).trim()||wa(n,{severity:"info",code:"menu_empty_label",message:'Navigation link label is empty; will display as "Link".',location:i(`item ${l+1}`),blockId:e.id??null});const r=o.url;null==r||""===String(r).trim()?wa(n,{severity:"warning",code:"menu_empty_url",message:`"${a}" link URL is empty; will be saved as href="#". Add a destination URL (e.g. https://example.com) before sending.`,location:i(a),blockId:e.id??null}):Qe(r)?wa(n,{severity:"error",code:"menu_blocked_scheme",message:`"${a}" link uses a blocked URL scheme (javascript:, data:, etc.). Use https://, mailto:, or tel: only.`,location:i(a),blockId:e.id??null}):ot(r,!1,{allowMailtoTel:!0})?!da(r)&&pa(r)&&wa(n,{severity:"warning",code:"menu_item_url_missing_protocol",message:`"${a}" link should start with https://, http://, mailto:, or tel: for reliable email client support.`,location:i(a),blockId:e.id??null}):wa(n,{severity:"warning",code:"menu_invalid_url",message:`"${a}" link URL is not valid. Use a full URL starting with https://example.com.`,location:i(a),blockId:e.id??null})}),0===o.length&&wa(n,{severity:"info",code:"menu_no_items",message:"Menu block has no items.",location:ka(t,"menu",void 0),blockId:e.id??null})}(e,t,n);break;case"social_link":Ba(e,t,n);break;case"raw_html":!function(e,t,n){const o=e.html;null!=o&&""!==String(o).trim()||wa(n,{severity:"info",code:"raw_html_empty",message:"HTML block has no custom markup; export will include an empty wrapper.",location:ka(t,"raw_html",void 0),blockId:e.id??null})}(e,t,n);break;case"text":Ta(e,t,n,"text",l);break;case"heading":Ta(e,t,n,"heading",l)}})}function Ia({blockList:e,bodySettings:t,aiContentRefs:n={}}){const o=[];return va(t,o),Aa(Array.isArray(e)?e:[],[],o,t,n),o}function $a(){const e="undefined"!=typeof window&&null!=window?window:"undefined"!=typeof global&&null!=global?global:void 0;if(!e)return;const t=e.Image;return"function"==typeof t?t:void 0}const Pa=/^\{\{\s*[\w.]+\s*\}\}$/;function Ra(e){if(null==e||""===String(e).trim())return null;const t=String(e).trim();if(function(e){return null!=e&&"string"==typeof e&&Pa.test(e.trim())}(t))return null;if(/^https?:\/\//i.test(t))return ha(t,!1)?t:null;if(t.startsWith("//")){const e=`https:${t}`;return ha(e,!1)?e:null}return null}function Ma(e,t=[],n=e?.length??0){const o=[];return Array.isArray(e)?(e.forEach((e,l)=>{if(!e||"object"!=typeof e)return;if(!0===e.hidden)return;const a=e.key;if("column"===a){const a=fa(e,l,n),i=[...t,a],r=e.children;return void o.push(...Ma(r,i,r?.length??0))}if("content"===a){const a=n>1?`Column ${l+1} of ${n}`:null,i=a?[...t,a]:t,r=e.children;return void o.push(...Ma(r,i,r?.length??0))}if("image"===a){const n=Ra(e.src);n&&o.push({url:n,location:ka(t,"image",void 0),blockId:e.id??null})}}),o):o}function Da(e,t=12e3){const n=$a();if(!n)return Promise.resolve(!1);const o=String(e).trim();return o?new Promise(e=>{const l=new n;let a=!1;const i=t=>{a||(a=!0,clearTimeout(r),l.onload=null,l.onerror=null,e(t))},r=setTimeout(()=>i(!1),t);l.onload=()=>i(!0),l.onerror=()=>i(!1);try{l.src=o}catch{i(!1)}}):Promise.resolve(!1)}async function Ua(e,t={}){const{timeoutMs:n=12e3,concurrent:o=6}=t;if(!$a())return[];const l=Ma(Array.isArray(e)?e:[]);if(0===l.length)return[];const a=new Map;for(const e of l)a.has(e.url)||a.set(e.url,[]),a.get(e.url).push(e.location);const i=[...a.keys()],r=new Map;let s=0;const c=Math.max(1,Math.min(o,i.length));await Promise.all(Array.from({length:c},()=>async function(){for(;s<i.length;){const e=s++,t=i[e],o=await Da(t,n);r.set(t,o)}}()));const d=[];for(const[e,t]of a)if(!0!==r.get(e))for(const n of t)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:l.find(t=>t.url===e&&t.location===n)?.blockId??null});return d}async function Ea(e,t){return[...Ia(e),...await Ua(e?.blockList??[],t)]}const za=(...e)=>e.filter(Boolean).join(" ");function Fa(e,t){const n=e[t];if(!n||"column"!==n.key)return[];const o=[];for(const t of n.cells||[])for(const n of t.childrenIds||[]){o.push(n);const t=e[n];"column"===t?.key&&o.push(...Fa(e,n))}return o}function Oa(e,t,n){const o=e[n];if(!o)return null;const{containerBlock:l}=Gt(e,t,n);if(!l?.id)return null;const a={...e};if("footer"===l.containerType&&!0!==l.footerUnifiedLayout){if(o.footerBannerSlot||o.footerBannerDividerSlot){a[l.id]={...l,showFooterBanner:!1};for(const t of Fa(e,l.id)){const n=e[t];(n?.footerBannerSlot||n?.footerBannerDividerSlot)&&(a[t]={...n,hidden:!0})}return{nextBlockMap:a}}return o.footerSlot?(a[n]={...o,hidden:!0},{nextBlockMap:a}):null}if("header"===l.containerType){if(o.headerLogoSlot)return a[l.id]={...l,showLogo:!1},a[n]={...o,hidden:!0},{nextBlockMap:a};if(o.headerBannerSlot||o.headerBannerDividerSlot){a[l.id]={...l,showHeaderBanner:!1};for(const t of Fa(e,l.id)){const n=e[t];(n?.headerBannerSlot||n?.headerBannerDividerSlot)&&(a[t]={...n,hidden:!0})}return{nextBlockMap:a}}return null}return null}const Wa={drag_block_here:"Drag block here",drop_content_here:"Drop content here",drop_content_hint:"Drag blocks from the left, or click to insert.",drag_section_here:"Drag section here",blocks:"Blocks",photos:"Photos",powered_by_pexels:"Powered by Pexels",loading:"Loading...",content:"Content",typography:"Typography",styles:"Styles",ai_powered:"AI powered",layout:"Layout",components:"Components",presets:"Presets",body_settings:"Theme Settings",global:"Global",text_and_headings:"Text and headings",pre_header:"Pre-header",pre_header_description:"The pre-header is a short summary text that follows the subject line when viewing an email in the inbox.",confirm:"Confirm",cancel:"Cancel",add_blocks:"Add blocks",block_product:"Product",block_product_single:"Single",block_product_multi:"Multi",block_discount:"Discount",product_output_layout:"Output layout",product_main_layout_stacked:"Image on top, Details below",product_main_layout_image_left:"Image left, Details right",discount_variant_simple:"Simple (one line)",discount_variant_card:"Card (title + code)",additional_products_grid_layout:"Additional products",additional_products_per_row:"Products per row",product_row_count_2:"2 columns",product_row_count_3:"3 columns",block_introduction:"Introduction",block_body:"Body",block_header:"Header",block_footer:"Footer",no_product_found:"No product found",no_products_matching_search:"No products match your search. Clear the search to see the full list.",load_more_products:"Load more",add_products:"Add products",add_products_in_store:"Add products in your store.",column:"Column",columns:"Columns",column_settings:"Column Settings",column_cells_section:"Column cells",column_wrapper_style:"Wrapper style",column_styles:"Column Styles",size_px:"Size",column_delete:"Delete Column",column_delete_desc:"Are you sure you want to delete {{count}} extra columns? ",block_palette_section:"Section",block_palette_columns:"Column",settings_title_column_layout:"Column settings",container:"Section",select_parent_section_tooltip:"Parent section settings — layout, spacing, and background",container_settings:"Section settings",layers_panel:"Layers",email_styles_section:"Email styles",document_section:"Document",body_bg_color_short:"Bg color",body_content_bg_short:"Content bg",body_width_label:"Width",body_font_short:"Font",body_text_short:"Text",body_heading_short:"Heading",body_link_short:"Link",type_styles_section:"Type",container_type:"Section type",container_type_help:"Determines which variables and product mappings are available for this section.",container_type_none:"Default",container_type_header:"Header",container_type_discount:"Discount",container_type_introduction:"Introduction",container_type_body:"Body",container_type_product:"Product",container_type_hero_product:"Hero Product",container_type_additional_product:"Additional Product",container_type_footer:"Footer",product_role:"Product Role",product_role_main_hero:"Primary",product_role_additional:"Secondary",product_column_select_label:"Use system variables",product_column_select_placeholder:"Search or select a product",product_column_variables_heading:"Product field tokens",product_column_kb_heading:"Knowledge base product",product_column_kb_tooltip:"Choose a product from your knowledge base catalog here. This controls which product appears in this column in the email.",text:"Text",text_content:"This is a text, click to edit text",text_settings:"Text Settings",text_styles:"Text Styles",text_align:"Text Align",heading:"Heading",heading_content:"This is a heading, click to edit heading",heading_settings:"Heading Settings",heading_type:"Heading Type",button:"Button",button_settings:"Button Settings",button_action:"Button Action",button_styles:"Button Styles",button_padding:"Button Padding",spacer:"Spacer",spacer_block:"SPACER BLOCK",spacer_settings:"Spacer Settings",divider:"Divider",divider_settings:"Divider Settings",divider_type:"Divider Type",divider_styles:"Divider Styles",image:"Image",image_action:"Image Action",image_url:"Image URL",image_alt:"Image Alt",image_alt_placeholder:"Describe for screen readers",image_styles:"Image Styles",image_settings:"Image Settings",image_crop_soon:"Image cropping is not available yet.",crop:"Crop",replace:"Replace",delete:"Delete",image_max_upload_size:"max 10 MB",video:"Video",video_settings:"Video",video_tab_styles:"Styles",video_tab_display:"Display",video_url:"Video URL",video_thumbnail_url:"Custom thumbnail URL",video_thumbnail_url_placeholder:"Leave empty to use YouTube thumbnail",video_export_note:"Email clients typically show a linked thumbnail, not embedded playback.",video_thumbnail_layout:"Thumbnail layout",video_width:"Width (W)",video_height:"Height (H)",video_fill_column:"Fill column",video_fill_column_mobile:"Fill column on mobile",alignment:"Alignment",video_area_section:"Video area",video_block_section:"Block",video_border_none:"None",image_source:"Image source",image_source_url:"Enter URL",image_source_upload:"Upload image",image_upload:"Upload",image_upload_click:"Click to upload",image_upload_not_configured:"Image upload is not configured. Set imageUploadEndpoint in apiConfig or pass null to disable; defaults use the built-in API base.",image_uploaded:"Image uploaded successfully",image_upload_failed:"Failed to upload image",image_upload_error:"Error uploading image",image_upload_file_hint:"PNG, JPEG, GIF, SVG, WebP · max 10 MB",image_upload_invalid_type:"Use PNG, JPEG, GIF, SVG, or WebP.",uploading:"Uploading…",image_source_variable:"Use variable",menu:"Navigation bar",menu_settings:"Navigation bar Settings",menu_layout:"Menu layout",layout_mode:"Layout mode",nav_only:"Navigation only",stacked:"Stacked",logo_left:"Logo left",logo_right:"Logo right",logo_only:"Logo only",mobile_layout:"Mobile layout",stack:"Stack",inline:"Inline",logo_section:"Logo section",show_logo:"Show logo",logo_url:"Logo URL",logo_text:"Logo text",logo_alt:"Logo alt",logo_link:"Logo link",logo_max_width:"Logo max width",border_bottom:"Border bottom",show_border_bottom:"Show border bottom",font_weight:"Font weight",font_weight_light:"Light",font_weight_regular:"Regular",font_weight_semibold:"Semi-bold",font_weight_bold:"Bold",text_transform:"Text transform",menu_items:"Menu Items",menu_item:"Menu Item",menu_styles:"Menu Styles",add_new_item:"Add New Item",label:"Label",page:"Page",url:"URL",target:"Target",same_tab:"Same Tab",new_tab:"New Tab",separator:"Separator",menu_separator_placeholder:'e.g. " | " or " • "',menu_separator_allowed_hint:"Only these symbols: | • — / · You may add spaces.",menu_link_gap:"Link spacing",menu_underline_links:"Underline links",logo_text_placeholder:"Brand",letter_spacing:"Letter Spacing",link_color:"Link Color",avatar:"Avatar",avatar_settings:"Avatar Settings",avatar_image:"Avatar image",avatar_border_radius:"Border radius",social_link:"Social Link",social_link_settings:"Social Link Settings",add_social_link:"Add Social Link",social_link_size:"Social Link Size",icon_styles:"Icon styles",icon_size:"Icon size",icon_size_small:"Small",icon_size_medium:"Medium",icon_size_large:"Large",icon_color:"Icon color",icon_color_default:"Default",icon_color_white:"White",icon_color_black:"Black",icon_color_gray:"Gray",social_icon_spacing:"Icon spacing",social_links:"Social Links",social_platform_x:"X",social_platform_formerly_twitter:"Formerly Twitter",social_platform_x_alt:"X, formerly Twitter",social_link_placeholder_facebook:"https://www.facebook.com/yourpage",social_link_placeholder_linkedin:"https://www.linkedin.com/company/yourcompany",social_link_placeholder_instagram:"https://www.instagram.com/yourhandle",social_link_placeholder_tiktok:"https://www.tiktok.com/@yourhandle",social_link_placeholder_x:"https://x.com/yourhandle",social_link_placeholder_youtube:"https://www.youtube.com/yourchannel",social_link_placeholder_pinterest:"https://www.pinterest.com/yourprofile",social_link_placeholder_generic:"https://example.com",social_settings_icons:"Icons",social_settings_style:"Style",social_platform_field:"Platform",social_icon_label_field:"Label",social_custom_icon:"Custom icon",social_add_icon:"Add platform",social_platform_custom:"Custom",social_icon_size_px:"Size",collapse:"Collapse",expand:"Expand",raw_html:"HTML",raw_html_block:"Email-safe HTML",raw_html_block_description:"Prefer table-based layouts and inline CSS for client compatibility.",raw_html_settings:"HTML Settings",raw_html_code_label:"Code",raw_html_code_hint:"Inserted as-is in the exported email. Test in major clients before you send.",raw_html_default_content:'<p style="text-align:center;color:#A3A3A3;font-size:12px">Add custom HTML here</p>',raw_html_appearance:"Layout",raw_html_clear_background:"Clear",raw_html_email_client_warning:"Custom HTML may render inconsistently across email clients. Test thoroughly.",raw_html_info_tooltip_aria:"More about email-safe HTML",content_background_color:"Content Background Color",container_background_image_title:"Section background image",container_background_image_section_title:"Section background image",container_background_image_section_toggle:"Show section background image",container_background_image_layout_group:"Image layout",container_background_image_row_label:"Background image",container_background_image_intro:"Blocks you add to this section (text, buttons, images, etc.) appear on top of the image. Drag components from the palette into the section on the canvas.",container_background_image_tooltip_p1:"Uses a background image on the section table (email-client friendly — not CSS position:absolute).",container_background_image_tooltip_p2:"Use “Content background color” for a tint behind blocks, or set it transparent so only the photo shows through.",container_background_image_enable:"Enable background image",container_background_image_url:"Image URL",container_background_image_upload:"Upload image",container_background_image_upload_click:"Drag and drop or select image",container_background_image_file_hint:"Accepts .png, .jpg, .jpeg, .gif, and .webp. Maximum file size 10 MB.",container_background_image_select_button:"Select image",container_background_image_clear:"Remove background image",container_background_image_size:"Image fit",container_background_image_position:"Focal point",container_bg_size_cover:"Cover",container_bg_size_contain:"Contain",container_bg_size_fill:"Fill",image_file_too_large:"Image must be 10 MB or smaller.",container_bg_image_url_error_blocked_scheme:"This URL uses a blocked protocol. Use only http:// or https:// for images.",container_bg_image_url_error_duplicate_protocol:"The URL repeats the protocol. Use a single https:// prefix.",container_bg_image_url_error_hostname:"Use a full URL with a valid hostname (e.g. https://cdn.example.com/photo.jpg).",container_bg_image_url_error_invalid_protocol:"Unsupported protocol. Use http:// or https:// for image URLs.",container_bg_image_url_error_generic:"Invalid image URL format.",container_bg_image_preview_failed:"Could not load a preview for this URL. It may not be an image, or the host blocked the request.",image_text_overlay:"Text overlay",overlay_multi_item:"Multi-item stack",add_overlay_item:"Add overlay item",drag_to_move:"Drag to move",overlay_max_width:"Overlay max width",item_gap:"Item gap",scrim:"Scrim",text_shadow:"Text shadow",fill_column:"Fill column",image_text_overlay_tip:"Optional caption drawn on top of the image in the editor. For full layouts over a photo, use a section background image instead.",image_text_overlay_container_tip:"Select the section → Styles → Section background image, then drag text and buttons into that section.",image_text_overlay_enable:"Enable text overlay",image_overlay_caption:"Caption",image_overlay_caption_placeholder:"Short line of text…",image_overlay_position:"Caption position",image_overlay_pos_tl:"Top left",image_overlay_pos_tc:"Top center",image_overlay_pos_tr:"Top right",image_overlay_pos_ml:"Middle left",image_overlay_pos_mc:"Middle center",image_overlay_pos_mr:"Middle right",image_overlay_pos_bl:"Bottom left",image_overlay_pos_bc:"Bottom center",image_overlay_pos_br:"Bottom right",image_overlay_box_bg:"Caption box background (CSS)",image_overlay_padding:"Caption padding",background_color:"Background Color",text_color:"Text Color",email_theme_background_color:"Email Theme Background Color",font_color:"Font Color",button_color:"Button Color",divider_color:"Divider Color",action_type:"Action Type",content_background:"Content background",heading_color:"Heading color",top:"Top",right:"Right",left:"Left",bottom:"Bottom",line_height:"Line Height",link:"Link",link_url:"Link URL",link_url_placeholder:"example.com",padding_settings:"Padding Settings",width:"Width",height:"Height",width_auto:"Width Auto",auto_width:"Auto Width",font_size:"Font Size",font_family:"Font Family",solid:"Solid",dotted:"Dotted",dashed:"Dashed",align:"Align",spacing:"Spacing",border_radius:"Border radius",link_all_sides:"Link all sides",padding_link_sides_label:"Same padding on all sides",padding_link_sides_tooltip:"When on, one value updates top, right, bottom, and left together. Turn off to set each side separately.",email_width_mode:"Width",email_width_default:"Email-width (default)",custom_px:"Custom px",custom_width_px:"Custom width",full_bleed:"Full bleed",full_bleed_tooltip:"Extends edge-to-edge in clients that support it; clipped to email-width otherwise.",export_html:"Export HTML",export_json:"Export JSON",export_checking_images:"Checking images…",export_validation_title:"Export validation",export_validation_issues_found:"Issues found before export",export_validation_errors:"Errors",export_validation_warnings:"Warnings",export_validation_info:"Info",export_anyway:"Export anyway",ignore:"Ignore",validation_body_content_width_invalid:"Body content width must be between 280 and 1200 px.",validation_body_background_color_missing:"Theme background color is missing.",validation_body_text_color_missing:"Theme text color is missing.",validation_body_font_family_missing:"Theme font family is missing.",validation_image_empty_src:"Image URL is empty; the image will not display.",validation_image_invalid_src:"Image URL format is invalid.",validation_image_invalid_link:"Image link URL format is invalid.",validation_image_url_not_loadable:"Image URL could not be loaded or previewed; the link may be broken, expired, or blocked.",validation_image_empty_alt:"Image alt text is empty; consider adding for accessibility.",validation_avatar_empty_src:"Avatar image URL is empty; avatar will not display.",validation_avatar_invalid_src:"Avatar image URL format is invalid.",validation_avatar_invalid_link:"Avatar link URL format is invalid.",validation_button_empty_link:'Button link URL is empty; will be saved as href="https://".',validation_button_invalid_link:"Button link URL format is invalid.",validation_button_blocked_scheme:"Button link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s), mailto:, or tel: only.",validation_button_label_invalid_link:"Button label link URL format is invalid.",validation_button_label_blocked_link_scheme:"Button label link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s), mailto:, or tel: only.",validation_rich_text_link_invalid:"Rich text hyperlink URL format is invalid.",validation_rich_text_link_blocked_scheme:"Rich text link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s), mailto:, or tel: only.",validation_menu_no_items:"Navigation bar has no links.",validation_raw_html_empty:"HTML block has no custom markup; export will include an empty wrapper.",validation_social_empty_link:'Social link URL is empty; will be saved as href="https://".',validation_social_invalid_link:"Social link URL format is invalid.",validation_social_blocked_scheme:"Social link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s) only (e.g. www.example.com or https://…).",validation_social_empty_icon:"Social link icon URL is empty; icon will not display.",validation_social_invalid_icon:"Social link icon URL format is invalid.",validation_social_no_links:"Social link block has no links.",validation_social_duplicate_platform:"Duplicate social platform in this block; only one entry per platform should be kept.",validation_container_product_not_assigned:"A product is not assigned to this column; assign a product in Section settings.",validation_dynamic_content_empty:"Dynamic content not generated; export will use static text if available.",validation_text_invalid_link:"Text link URL format is invalid.",validation_text_blocked_link_scheme:"Text link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s), mailto:, or tel: only.",tooltip_bold:"Bold",tooltip_italic:"Italic",tooltip_underline:"Underline",tooltip_strikethrough:"Strikethrough",tooltip_align_left:"Align left",tooltip_align_center:"Align center",tooltip_align_right:"Align right",tooltip_ordered_list:"Ordered list",tooltip_unordered_list:"Unordered list",tooltip_link:"Link",tooltip_remove_link:"Remove link",add_link_modal_title:"Add link",content_type:"Content type",content_type_static:"Static",content_type_dynamic:"Dynamic",ai_enabled:"Write using AI",text_ai_mode_manual_edit_title:"Can't edit this text here",text_ai_mode_manual_edit_disabled:"AI writing is on for this block, so the text isn't editable on the canvas. In the right panel, turn off “Write using AI” to edit manually.",text_and_content_type:"Content type",heading_or_body:"Heading",body_paragraph:"Body",heading_h1:"H1",heading_h2:"H2",heading_h3:"H3",heading_h4:"H4",variables:"Variables",insert_merge_field:"Select or type variable...",dynamic_prompt_help:"Write your prompt",ai_output_language:"AI output language",ai_output_language_en:"English",ai_output_language_bn:"Bengali",generate:"Generate",ml_generation_failed:"Could not generate AI content",ml_ai_unavailable:"AI generation needs a column layout, company ID, template ID, and ML endpoint. Open this text inside a section column and check apiConfig.",ml_no_variations:"No suggestions were returned. Try another prompt or verify the template exists on the server.",ml_generation_unexpected_error:"Something went wrong while generating content.",sample_ai_content:"Sample AI content",select_content:"Select content",variable_dynamic_placeholder:"None (optional)",variable_display_text:"Display text",variable_introduction:"Introduction",variable_heading:"Heading",variable_subheading:"Subheading",variable_products_description:"Products description",variable_customer_name:"Customer Name",variable_introduction_title:"Introduction Title",variable_introduction_subtitle:"Introduction Subtitle",variable_body_title:"Body Title",variable_body_subtitle:"Body Subtitle",variable_discount_value:"Discount value",variable_discount_code:"Discount code",variable_valid_until:"Valid until",variable_company_name:"Company name",variable_brand_name:"Brand name",variable_address:"Address",variable_website:"Website",variable_logo_url:"Logo URL",variable_tagline:"Tagline",variable_nav_label:"Nav link label",variable_nav_url:"Nav link URL",variable_product_name:"Product name",variable_product_description:"Product description",variable_product_image:"Product image URL",variable_product_link:"Product link",variable_product_price:"Product price",variable_product_currency:"Product currency",variable_product_old_price:"Product old price",variable_product_new_price:"Product new price",variable_product_price_display:"Product price display",variable_image_logo:"Logo",variable_image_hero_banner:"Hero banner",variable_image_footer_banner:"Footer banner",variable_image_product_image:"Product image",variable_cta_label:"CTA label",variable_cta_url:"CTA URL",button_label_variable:"Button label (variable)",button_url_variable:"Use variable",button_text:"Button text",button_label_manual:"Enter label",button_url_manual:"Enter URL",use_company_social_links:"Use company social links",use_navigation_links:"Use navigation links",tooltip_container_type:"Determines which variables and product mappings are available for this section.",tooltip_variables_static:"Insert a merge field into your content. It will be replaced when the email is sent.",tooltip_dynamic_prompt:"Describe the tone or intent; we'll suggest sample content. (Preview mode — connect an AI API for real generation.)",tooltip_write_using_ai:"When on, choose output language and write a prompt to generate variants. Requires ML/API when connected.",tooltip_write_using_ai_unavailable:"AI authoring is disabled for this editor. Enable it from the host app or API options to use Write using AI.",label_align:"Align",label_padding:"Padding",section_background_group:"SECTION BACKGROUND",section_bg_mode:"Type",section_bg_color:"Color",section_bg_image:"Image",section_bg_none:"None",section_content_area_group:"CONTENT AREA",content_area_color:"Content color",content_color_auto:"Auto",content_color_custom:"Custom",shortcuts_modal_title:"Keyboard shortcuts",shortcuts_modal_footnote:"Shortcuts are disabled while typing in text fields inside the settings panel, so you can edit URLs and copy/paste normally.",shortcut_save:"Save (handled by the host page when connected)",shortcut_undo:"Undo",shortcut_redo:"Redo",shortcut_duplicate:"Duplicate selected block",shortcut_copy_block:"Copy selected block",shortcut_paste_block:"Paste block",shortcut_delete_block:"Delete selected block",shortcut_escape:"Deselect block",shortcut_cheat_sheet:"Open this help",shortcut_delete_confirm_title:"Delete this section?",shortcut_delete_confirm_desc:"This section has content blocks inside. Delete it anyway?",section_nest_not_allowed:"Sections cannot be placed inside another section. Drop between sections in the stack.",context_duplicate:"Duplicate",context_copy:"Copy",context_cut:"Cut",context_paste:"Paste",context_delete:"Delete",context_move_up:"Move up",context_move_down:"Move down",context_save_global:"Save as Global Element",context_reset_styles:"Reset styles",topbar_back_to_templates:"Templates",topbar_exit:"Exit",topbar_breadcrumb_email:"Email",topbar_rename_template:"Rename template",topbar_untitled_template:"Untitled template",send_test:"Send test",preview:"Preview",html_email_preview:"HTML preview",html_email_preview_title:"HTML Email Preview",html_email_preview_device_aria:"HTML preview device width",html_email_preview_error:"Could not generate the HTML preview. Check the console for details.",save_template:"Save template",more_actions:"More actions",keyboard_shortcuts:"Keyboard shortcuts",high_contrast_on:"High contrast on",high_contrast_off:"High contrast off",desktop:"Desktop",mobile:"Mobile",undo:"Undo",redo:"Redo",save_state_saved:"Saved",save_state_saving:"Saving…",save_state_unsaved:"Unsaved",save_state_error:"Save failed",export_validation_open_block:"Open block",save:"Save",template_name:"Template name",save_template_title:"Save template",save_template_category:"Category",save_template_category_placeholder:"Select or type a category…",category_promotional:"Promotional",category_transactional:"Transactional",category_newsletter:"Newsletter",category_onboarding:"Onboarding",category_announcement:"Announcement",category_other:"Other",send_test_title:"Send test email",send_test_send:"Send test",send_test_recipients:"Recipients",send_test_recipients_placeholder:"name@example.com, another@example.com",send_test_recipients_hint:"Press Enter or comma to add each address.",send_test_payload:"Payload context",send_test_payload_none:"No payload",send_test_payload_profile:"Profile data",send_test_payload_event:"Event data",send_test_prefix_label:"[TEST] prefix",send_test_prefix_hint:"Prepends [TEST] to the subject line.",universal:"Universal",layers:"Layers",document:"Document",layer_one:"block",layer_many:"blocks",layer_move_up:"Move up",layer_move_down:"Move down",layer_duplicate:"Duplicate",layer_delete:"Delete",universal_saved_blocks:"Saved blocks",universal_empty_state_line_1:"No universal content yet. Click",universal_empty_state_line_2:"on any block to save it for reuse across templates.",universal_used_in_count:"used in {{count}}",compliance:"Compliance",compliance_preflight:"Pre-flight",compliance_all_clear_title:"Ready to send",compliance_all_clear_desc:"All compliance checks pass.",compliance_severity_error:"Error",compliance_severity_warning:"Warning",compliance_severity_info:"Info",compliance_tab_badge_label:"Unresolved issues: {{count}}",compliance_email_size:"Email size (HTML)",compliance_above_clip:"Above Gmail clip threshold",compliance_near_clip:"Approaching clip threshold",compliance_below_clip:"Below Gmail clip threshold",compliance_clip_reason_over:"Gmail will clip this email. Reduce content or remove large blocks.",compliance_clip_reason_near:"Close to Gmail's 102 KB clip limit. Consider trimming content.",compliance_clip_reason_raw_html:"{{n}} raw HTML block(s) — custom HTML is included verbatim and can significantly inflate email size.",right_panel_empty_hint:"Click any block in the canvas to edit its specific settings. Drag blocks from the left rail to add new content.",right_panel_back:"Back",layer_show:"Show",layer_hide:"Hide",save_as_universal:"Save as universal",universal_save_modal_title:"Save as universal block",universal_save_modal_subtitle:"Reusable across templates. Edits won't affect already-sent emails.",universal_save_modal_placeholder:"e.g. Beantown footer",universal_save_modal_confirm:"Save block",universal_save_success:'Saved "{{name}}" as universal block',universal_save_error:"Could not save the universal block. Check your connection and try again.",universal_delete:"Remove",universal_delete_confirm_title:"Remove saved block?",universal_delete_confirm_body:"This removes the block from your saved library. Existing emails are not changed.",universal_delete_confirm_ok:"Remove",configure_columns_title:"Configure columns",configure_columns_subtitle:"Pick a layout. Each column starts empty so you can drag blocks into it.",configure_columns_insert:"Insert section",configure_columns_hint:"click to configure layout",configure_columns_row_count:"Rows to insert:",standard_layout:"Standard",grid_layout:"6/12 Grid",grid_settings:"Grid",grid_rows_locked_hint:"Email layouts use one row of columns.",columns_layout:"Columns layout",column_sizes:"Column widths (%)",show_more:"Show more",show_less:"Show less",col:"Col",gaps:"Gaps",column_gap:"Column gap",button_variant:"Variant",full_width:"Full width",hover_bg_color:"Hover background",hover_text_color:"Hover text",text_decoration:"Decoration",shadow:"Shadow",shadow_preset:"Preset",table:"Table",table_settings:"Table settings",footer_settings:"Footer settings",compliance_approx_kb:"{{n}} KB",cell_content:"Cell content",add_link_url:"URL",add_link_url_placeholder:"https://example.com",add_link_display_text:"Display text",add_link_display_text_placeholder:"Leave blank to keep selected text",add_link_display_text_empty_badge:"No text — link will use selected text",add_link_open_new_tab:"Open in new tab",align_left:"Align left",align_center:"Align center",align_right:"Align right",minimize_toolbar:"Collapse",close_text_editor:"Exit text editing",unlink_universal:"Unlink this copy",unlink_modal_title:"Edit universal block",unlink_modal_keep:"Keep linked",unlink_modal_unlink:"Unlink this copy",unlink_modal_body:"This block is linked to a universal snippet. Editing it here will affect all uses of this block everywhere.",unlink_modal_body2:"Choose “Unlink this copy” to make an independent copy that only affects this template, or “Keep linked” to edit all instances together.",custom:"Custom",custom_color:"Custom color",show_text_label:"Show label",mobile_optimization:"Mobile optimization",stack_columns_on_mobile:"Stack columns on mobile",product_recommendations_section:"Product recommendations",fill_product_slots_label:"Suggest more products",fill_product_slots_on_hint:"We’ll fill empty product areas using cart items, browsing history, and smart recommendations.",fill_product_slots_off_hint:"Only products already in the recipient’s cart will appear. Other product blocks may stay empty.",fill_product_slots_tooltip_title:"Suggest more products",fill_product_slots_tooltip_on_heading:"When this is on",fill_product_slots_tooltip_on_body:"Each product block is filled automatically, in order: items in cart, recently viewed, cross-sell, upsell, deals, then popular picks.",fill_product_slots_tooltip_off_heading:"When this is off",fill_product_slots_tooltip_off_body:"Only cart items count. If there’s nothing in the cart for a slot, that product area is left out of the email.",fill_product_slots_tooltip_watch_heading:"Before you turn this off",fill_product_slots_tooltip_watch_1:"Headlines or intro text can sit above an empty product row.",fill_product_slots_tooltip_watch_2:"Cross-sell and upsell recommendations won’t run.",fill_product_slots_tooltip_watch_3:"Previews and sent emails may show gaps where products were expected.",scale_font_on_mobile:"Scale font on mobile",section_layout:"Section Layout",content_max_width:"Content max-width",content_max_width_option_full:"Full width",min_height:"Min height",border:"Border",border_style:"Border style",border_width:"Border width",border_color:"Border color",visibility:"Visibility",hidden_on_mobile:"Hide on mobile",canvas_hidden_on_mobile:"Hidden on mobile",table_structure:"Table Structure",rows:"Rows",header_row:"Header row",header_column:"Header column",cell_selector:"Cell selector",cell_content_type:"Cell content type",table_style:"Table style",cell_padding:"Cell padding",header_style:"Header style",header_background:"Header background",header_text_color:"Header text color",striped_rows:"Striped rows",stripe_color:"Stripe color",table_structure_mode:"Mode",table_mode_static:"Static",table_mode_dynamic:"Dynamic",table_dynamic_structure_hint:"Export still uses static HTML; data-driven tables may be wired in a future update.",table_add_row:"Add row",table_add_column:"Add column",table_decrease_rows:"Decrease row count",table_increase_rows:"Increase row count",table_decrease_cols:"Decrease column count",table_increase_cols:"Increase column count",table_selected_cell:"Selected: row {{row}}, col {{col}}",table_select_cell_hint:"Select a cell in the grid to edit its content.",table_cell_grid_truncated:"Showing first {{rows}} × {{cols}} cells",table_cell_text_placeholder:"Cell text…",table_align_left:"Left",table_align_center:"Center",table_align_right:"Right",footer_visible_lines:"Visible lines",footer_toggle_brand_name:"Brand name",footer_toggle_tagline:"Tagline",footer_toggle_address:"Address",footer_toggle_unsubscribe:"Unsubscribe",footer_toggle_social_row:"Social row",footer_toggle_secondary_links:"Secondary links",footer_toggle_copyright:"Copyright",footer_native_social_hint:"To edit individual platforms and icons, turn off company links above or select the social row on the canvas.",footer_company_social_managed_note:"Icons and profile URLs come from your company data (same as the live preview). Turn off the switch above to customize platforms for this template only.",footer_company_social_url_empty:"No URL in company data",footer_content_heading:"Content",footer_label_brand:"Brand",footer_unsubscribe_body_text:"Body text",footer_unsubscribe_link_label:"Link text",footer_secondary_links_heading:"Secondary links",footer_secondary_link_text:"Link text",footer_secondary_link_url:"URL",footer_new_link_label:"New link",footer_add_link:"Add link",footer_social_platforms_heading:"Social platforms",footer_platform_label:"Platform",footer_social_profile_url:"Profile URL",footer_upload_icon:"Upload icon",footer_add_platform:"+ Add platform",footer_style_heading:"Style",footer_text_color:"Text",footer_link_color:"Link",footer_background_content:"Background",footer_column_background:"Column background",footer_align:"Align",footer_border_heading:"Border",footer_divider_above:"Divider above",footer_border_top:"Border top",footer_border_top_color:"Border top color",footer_social_instagram:"Instagram",footer_social_facebook:"Facebook",footer_social_twitter:"Twitter",footer_social_linkedin:"LinkedIn",footer_social_youtube:"YouTube",footer_social_tiktok:"TikTok",footer_social_custom_icon:"Custom icon",footer_sections:"Footer sections",footer_brand_name_placeholder:"Your brand",footer_brand_tagline_placeholder:"Your tagline",footer_address_placeholder:"123 Main St, City, Country",footer_unsubscribe_url_placeholder:"{{unsubscribe_url}}",footer_copyright_placeholder:"© {{year}} Your Company",footer_default_unsubscribe_text:"Unsubscribe",show_brand:"Brand",brand_name:"Brand name",brand_tagline:"Tagline",show_address:"Address",address:"Address text",show_unsubscribe:"Unsubscribe link",unsubscribe_text:"Link text",unsubscribe_url:"Unsubscribe URL",show_social:"Social icons",social_icons_hint:"Configure social icons in the block's content settings.",show_secondary_links:"Secondary links",show_copyright:"Copyright",copyright_text:"Copyright text",footer_style:"Footer style",padding_top:"Top padding",padding_bottom:"Bottom padding",show_divider:"Show divider",header_settings:"Header settings",discount_settings:"Discount settings",discount_show_title:"Show title",preset_discount_simple:"Discount (simple line)",style:"Style",navigation:"Navigation",link_style:"Link style",color:"Color",size:"Size",weight:"Weight",transform:"Transform",gap:"Gap",underline:"Underline",title:"Title",add_link:"Add link",font_weight_medium:"Medium",nav_text_transform_sentence:"Sentence case",nav_text_transform_uppercase:"Uppercase",nav_text_transform_capitalize:"Capitalize",placeholder_https:"https://…",brand_name_placeholder:"Brand name",logo_padding:"Logo padding",default_nav_link_label:"Link",navigation_link_placeholder_url:"#",container_variables_none_available:"No variables available for this container type.",header_layout_logo_left_nav_right:"Logo left, Navigation right",header_layout_logo_right_nav_left:"Logo right, Navigation left",header_layout_logo_center_nav_below:"Logo centered, Navigation below",header_layout_logo_only:"Logo only",header_layout_nav_only:"Navigation only",header_banner_section:"Header banner",show_header_banner:"Show header banner",footer_banner_section:"Footer banner",show_footer_banner:"Show footer banner",border_none:"None",discount_code_section:"Promo code",discount_code_background:"Code background",discount_code_corner_radius:"Code corner radius",column_preset_1_col:"1 col",column_preset_equal_2:"Equal 2",column_preset_equal_3:"Equal 3",column_preset_equal_4:"Equal 4",column_preset_1_2:"1 / 2",column_preset_2_1:"2 / 1",column_preset_1_3:"1 / 3",column_preset_3_1:"3 / 1",column_preset_2_3:"2 : 3",column_preset_3_2:"3 : 2",column_preset_1_2_1:"1 / 2 / 1",column_preset_2_1_1:"2 / 1 / 1",column_preset_1_1_2:"1 / 1 / 2",column_preset_2_4_2_4:"2-4 · 2-4",column_preset_4_2_4_2:"4-2 · 4-2"},ja=()=>{const{language:e,languageLibraries:t}=n(Ln);let o={en:Wa};t&&(o={...o,...t,en:{...Wa,...o.en||{}}});return{t:(t,n)=>{let l=(o[e]||{})[t];return n&&n instanceof Object&&Object.keys(n).forEach(e=>{l=l.replace(`{{${e}}}`,n[e])}),l||t}}};function Ha(e){return"string"!=typeof e?e:e.replace(/\u202E/g,"").replace(/\u202D/g,"").replace(/\u202A/g,"").replace(/\u202B/g,"").replace(/\u202C/g,"").replace(/\sdir\s*=\s*["']rtl["']/gi,' dir="ltr"').replace(/\sstyle\s*=\s*["']([^"']*)["']/gi,(e,t)=>{const n=String(t||"").replace(/\s*direction\s*:\s*rtl\s*;?/gi,"").trim();return n?` style="${n}"`:""})}function Ka(e){if("string"!=typeof e||!e)return{masked:e||"",tokens:[]};const t=[];return{masked:e.replace(/\{\{[^{}]+\}\}/g,e=>(t.push(e),`${t.length-1}`)),tokens:t}}function Va(e,t){if("string"!=typeof e||!t.length)return e;let n=e;for(let e=t.length-1;e>=0;e--){const o=`${e}`;n=n.split(o).join(t[e])}return n}let Ga=0;function qa(t){if("function"!=typeof t)return;const n="undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():Date.now();if(n-Ga<2200)return;Ga=n;const o=e.createElement(B,{icon:A,style:{fontSize:24,color:"#93c5fd"},"aria-hidden":!0});m.open({key:"ee-text-ai-readonly-hint",icon:o,message:e.createElement("span",{style:{fontSize:15,fontWeight:700,color:"#fafafa",letterSpacing:"0.01em"}},t("text_ai_mode_manual_edit_title")),description:e.createElement("span",{style:{fontSize:13,lineHeight:1.55,color:"#e5e5e5"}},t("text_ai_mode_manual_edit_disabled")),duration:8,placement:"top",top:72,className:"ee-ai-readonly-notification",style:{width:380,maxWidth:"min(380px, calc(100vw - 32px))"}})}function Ja(e){return e&&"text"===e.key&&"dynamic"===e.contentType}const Ya=/\{\{(\w+)\}\}/g;function Xa(e,t){if(null!=e)if("string"!=typeof e){if(Array.isArray(e))e.forEach(e=>Xa(e,t));else if("object"==typeof e){if(void 0!==e.$$typeof)return;Object.values(e).forEach(e=>Xa(e,t))}}else(function(e){if("string"!=typeof e||0===e.length)return[];const t=[];let n;for(;null!==(n=Ya.exec(e));){const e=n[1];e&&t.push(e)}return Ya.lastIndex=0,t})(e).forEach(e=>t.add(e))}function Za(e,t,n){e&&"object"==typeof e&&(e.id&&n.has(e.id)||(e.id&&n.add(e.id),"column"!==e.key?Xa(e,t):(e.children||[]).forEach(e=>{(e?.children||[]).forEach(e=>Za(e,t,n))})))}function Qa(e,t,n,o){if(!e||o.has(e))return;o.add(e);const l=t[e];l&&"object"==typeof l&&("column"===l.key?(l.cells||[]).forEach(e=>{(e.childrenIds||[]).forEach(e=>Qa(e,t,n,o))}):Xa(l,n))}function ei(e,t){const n=new Set;if(!e||"object"!=typeof e)return n;if(Array.isArray(e.children)){const t=new Set;return Za(e,n,t),n}if(!t||"object"!=typeof t)return n;const o=new Set;return(e.cells||[]).forEach(e=>{(e.childrenIds||[]).forEach(e=>Qa(e,t,n,o))}),n}const ti=()=>{const e=(t,n)=>t?t.classList?.contains("text-content_editable")?null:t&&t.tagName?.toLocaleLowerCase()===n?t:e(t.parentNode,n):null,t=o((e,n)=>e?e.classList?.contains("text-content_editable")?null:e&&e.style?.[n]?e.style[n]:t(e.parentNode,n):null,[]);return{getSelectionNode:e,getSectionStyle:t}},ni=({modifyText:e,setTextContent:t})=>{const{selectionRange:o}=n(Ln),{getSelectionNode:a}=ti(),{t:i}=ja(),r=l(()=>o?a(o.commonAncestorContainer,"b"):null,[o,a]);return qe("button",{className:za("rich-text-tools-button ",r&&"rich-text-tools-button-active"),title:i("tooltip_bold"),onClick:()=>{e("bold",!1,null),t()},children:qe(B,{icon:I,className:"rich-text-tools-button-icon"})})};function oi(e,t){if(!e)return!1;const n=e.commonAncestorContainer;if(!function(e){let t=e;for(t&&3===t.nodeType&&(t=t.parentElement);t;){if(t.classList?.contains("text-content_editable"))return!0;t=t.parentNode}return!1}(n))return!1;try{if(document.queryCommandState("italic"))return!0}catch{}return!("function"!=typeof t||!t(n,"i")&&!t(n,"em"))||function(e){let t=e;for(t&&3===t.nodeType&&(t=t.parentElement);t&&!t.classList?.contains("text-content_editable");){if(1===t.nodeType){const e=t.tagName?.toLowerCase();if("i"===e||"em"===e)return!0;const n=t.style?.fontStyle;if("italic"===n||"oblique"===n)return!0;try{if("undefined"!=typeof window&&window.getComputedStyle){const e=window.getComputedStyle(t).fontStyle;if("italic"===e||"oblique"===e)return!0}}catch{}}t=t.parentNode}return!1}(n)}const li=({modifyText:e,setTextContent:t})=>{const{selectionRange:o}=n(Ln),{getSelectionNode:l}=ti(),{t:a}=ja(),i=oi(o,l);return qe("button",{className:za("rich-text-tools-button ",i&&"rich-text-tools-button-active"),title:a("tooltip_italic"),onClick:()=>{try{document.execCommand("styleWithCSS",!1,!0)}catch{}e("italic",!1,null),t()},children:qe(B,{icon:$,className:"rich-text-tools-button-icon"})})},ai=({modifyText:e,setTextContent:t})=>{const{selectionRange:o}=n(Ln),{getSelectionNode:a}=ti(),{t:i}=ja(),r=l(()=>o?a(o.commonAncestorContainer,"u"):null,[o,a]);return qe("button",{className:za("rich-text-tools-button ",r&&"rich-text-tools-button-active"),title:i("tooltip_underline"),onClick:()=>{e("underline",!1,null),t()},children:qe(B,{icon:P,className:"rich-text-tools-button-icon"})})},ii=({modifyText:e,setTextContent:t})=>{const{selectionRange:o}=n(Ln),{getSelectionNode:a}=ti(),{t:i}=ja(),r=l(()=>o?a(o.commonAncestorContainer,"strike"):null,[o,a]);return qe("button",{className:za("rich-text-tools-button ",r&&"rich-text-tools-button-active"),title:i("tooltip_strikethrough"),onClick:()=>{e("strikethrough",!1,null),t()},children:qe(B,{icon:R,className:"rich-text-tools-button-icon"})})},ri=({modifyText:e,setTextContent:t})=>{const{selectionRange:o}=n(Ln),{getSelectionNode:a}=ti(),{t:i}=ja(),r=l(()=>o?a(o.commonAncestorContainer,"ol"):null,[o,a]);return qe("button",{className:za("rich-text-tools-button ",r&&"rich-text-tools-button-active"),title:i("tooltip_ordered_list"),onClick:()=>{e("insertOrderedList",!1,null),t()},children:qe(B,{icon:M,className:"rich-text-tools-button-icon"})})},si=({modifyText:e,setTextContent:t})=>{const{selectionRange:o}=n(Ln),{getSelectionNode:a}=ti(),{t:i}=ja(),r=l(()=>o?a(o.commonAncestorContainer,"ul"):null,[o,a]);return qe("button",{className:za("rich-text-tools-button ",r&&"rich-text-tools-button-active"),title:i("tooltip_unordered_list"),onClick:()=>{e("insertUnorderedList",!1,null),t()},children:qe(B,{icon:D,className:"rich-text-tools-button-icon"})})},ci=({modifyText:e,setTextContent:t})=>{const{selectionRange:r}=n(Ln),{t:s}=ja(),{getSelectionNode:c}=ti(),[d,u]=a(!1),[p,m]=a({value:"",range:null}),[f,_]=a(""),[k,v]=a(!0),w=i(null),x=l(()=>r?c(r.commonAncestorContainer,"a"):null,[r,c]),S=o(()=>{u(!1),m({value:"",range:null}),_(""),v(!0)},[]),C=o(()=>{const{range:e,value:n,rangeIsLink:o}=p;if(e){if(o){const t=e.commonAncestorContainer,o=1===t.nodeType&&"A"===t.nodeName?t:t.parentNode&&"A"===t.parentNode.nodeName?t.parentNode:null;o&&(o.setAttribute("href",n),o.target=k?"_blank":"_self",f.trim()&&(o.textContent=f.trim()))}else{const t=document.createElement("a");if(t.target=k?"_blank":"_self",t.setAttribute("href",n),f.trim())t.textContent=f.trim(),e.deleteContents(),e.insertNode(t);else try{e.surroundContents(t)}catch{return void S()}}t(),S()}else S()},[p,f,k,t,S]);return Je(Ye,{children:[qe("button",{className:za("rich-text-tools-button ",x&&"rich-text-tools-button-active"),title:s("tooltip_link"),onClick:e=>{let n=window.getSelection(),o=n.getRangeAt(0);const l=o.commonAncestorContainer.parentNode,a="A"===l.nodeName,i={...p,range:o};let r="",s=!0;if(a){i.rangeIsLink=!0;const e=l.getAttribute("href"),t=null!=e?String(e).trim():"";i.value=""!==t?t:String(l.href||"").trim(),r=l.textContent||"",s="_self"!==l.target}else{r=n.toString()}const c=e?.currentTarget?.closest?.(".email-editor");c&&(w.current=c),m(i),_(r),v(s),u(!0),t()},children:qe(B,{icon:U,className:"rich-text-tools-button-icon"})}),qe("button",{className:za("rich-text-tools-button"),title:s("tooltip_remove_link"),onClick:()=>{e("unlink",!1,null),t()},children:qe(B,{icon:E,className:"rich-text-tools-button-icon"})}),qe(g,{title:s("add_link_modal_title"),open:d,zIndex:1100,getContainer:()=>"undefined"==typeof document?null:w.current||document.querySelector(".email-editor")||document.body,onOk:C,onCancel:S,okText:s("confirm"),cancelText:s("cancel"),wrapClassName:"ee-modal-dark",children:Je("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[Je("div",{children:[qe("div",{style:{marginBottom:4,fontSize:12,fontWeight:500},children:s("add_link_url")||"URL"}),qe(h,{value:p.value??"",placeholder:s("add_link_url_placeholder")||s("link_url_placeholder")||"https://example.com",onChange:e=>m({...p,value:e.target.value})})]}),Je("div",{children:[Je("div",{style:{marginBottom:4,display:"flex",alignItems:"center",flexWrap:"wrap",gap:8},children:[qe("span",{style:{fontSize:12,fontWeight:500},children:s("add_link_display_text")||"Display text"}),f.trim()?null:qe(y,{status:"warning",text:s("add_link_display_text_empty_badge"),className:"ee-link-modal-display-text-badge"})]}),qe(h,{value:f,placeholder:s("add_link_display_text_placeholder")||"Leave blank to keep selected text",onChange:e=>_(e.target.value)})]}),Je("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[qe("span",{style:{fontSize:13},children:s("add_link_open_new_tab")||"Open in new tab"}),qe(b,{className:"ee-settings-switch",checked:k,onChange:v})]})]})})]})},di=({id:e,textBlock:t,syncTextFromDom:s})=>{const{blockMap:c,rootOrder:d,templateData:u}=n(Ln),{t:p}=ja(),m=i(null),[g,h]=a(!1),[y,b]=a(!1),_=l(()=>{const t=qt(c,d,e),n=t?.[0]??null;return{containerBlock:n?.containerBlock??null,containerType:n?.containerType??"none",cellIndex:n?.cellIndex??0,lineage:t}},[c,d,e]),k=l(()=>{const e=_?.cellIndex??0,t=_?.containerBlock;return{columnIndex:e,columnProduct:t?.columnProducts?.[e]??null}},[_]),v=l(()=>(_?.lineage??[]).slice(1).filter(e=>e?.containerType&&"none"!==e.containerType).map(e=>{const t=e.cellIndex??0;return{containerType:e.containerType,context:{columnIndex:t,columnProduct:e.containerBlock?.columnProducts?.[t]??null}}}),[_?.lineage]),w=l(()=>zo(0,_?.containerType??"none",u,k,v),[_?.containerType,u,k,v]),x=l(()=>ei(_?.containerBlock,c),[_?.containerBlock,c]),S=l(()=>w.filter(e=>"image"!==e.type&&!x.has(e.variableKey??e.key)),[w,x]),C=o(()=>{if(!m.current)return;const e=m.current.parentNode?.getBoundingClientRect(),t=document.querySelector("#preview");if(!e||!t)return;const n=t.getBoundingClientRect();e.top-190<0?(m.current.style.bottom="auto",m.current.style.top="110%"):(m.current.style.bottom="110%",m.current.style.top="auto"),e.left+420>n.left+n.width?(m.current.style.left="auto",m.current.style.right="0"):(m.current.style.left="0",m.current.style.right="auto")},[]);r(()=>{C()},[C]),r(()=>{const e=()=>{const e="undefined"!=typeof window&&window.getSelection(),n=m.current;if(!e||0===e.rangeCount||!n)return void C();const o=e.getRangeAt(0),l=t?.current;if(!l||!l.contains(o.commonAncestorContainer)||e.isCollapsed)return void C();const a=o.getBoundingClientRect();if(!a||0===a.width&&0===a.height)return void C();const i=n.parentNode;if(!i)return;const r=i.getBoundingClientRect(),s=document.querySelector("#preview"),c=s?s.getBoundingClientRect():null;let d=a.top-r.top-46-8;a.top-60<0&&(d=a.bottom-r.top+8);let u=a.left-r.left+a.width/2-210;if(c){const e=c.left-r.left+8,t=c.right-r.left-8-420;u=Math.max(e,Math.min(u,t))}n.style.top=`${d}px`,n.style.bottom="auto",n.style.left=`${u}px`,n.style.right="auto"};return document.addEventListener("selectionchange",e),()=>document.removeEventListener("selectionchange",e)},[C,t]);const N=(e,t,n)=>{document.execCommand(e,t,n)},L=()=>{"function"!=typeof s?t?.current&&("undefined"!=typeof InputEvent&&InputEvent?t.current.dispatchEvent(new InputEvent("input",{bubbles:!0,cancelable:!0})):t.current.dispatchEvent(new Event("input",{bubbles:!0}))):s()};return qe("div",{className:"rich-text",ref:m,onClick:e=>{e.preventDefault(),e.stopPropagation()},children:qe(Ge.div,{className:"rich-text-tools",initial:{scale:0,x:0},animate:{scale:1,x:0},style:{width:g?"auto":"max-content",maxWidth:"min(100%, 520px)"},children:Je("div",{className:"rich-text-tools-body items-center",children:[!g&&Je(Ye,{children:[qe(ni,{modifyText:N,setTextContent:L}),qe(li,{modifyText:N,setTextContent:L}),qe(ai,{modifyText:N,setTextContent:L}),qe(ii,{modifyText:N,setTextContent:L}),qe(ri,{modifyText:N,setTextContent:L}),qe(si,{modifyText:N,setTextContent:L}),qe(ci,{modifyText:N,setTextContent:L}),qe(f,{zIndex:540,trigger:"click",open:y,onOpenChange:b,overlayClassName:"ee-rich-text-variables-popover",getPopupContainer:()=>document.querySelector("#preview")||document.body,content:Je("div",{className:"ee-rich-text-variables-menu",children:[qe("div",{className:"ee-rich-text-variables-header",children:p("variables")}),S.map(e=>qe("div",{className:"ee-rich-text-variables-item",onMouseDown:n=>{n.preventDefault(),(e=>{if(!t?.current||!e)return;const n=window.getSelection();let o=null;if(n?.rangeCount){const e=n.getRangeAt(0);t.current.contains(e.commonAncestorContainer)&&(o=e)}o||(o=document.createRange(),o.selectNodeContents(t.current),o.collapse(!1)),o.deleteContents();const l=document.createTextNode(e);o.insertNode(l),o.setStartAfter(l),o.collapse(!0),n&&(n.removeAllRanges(),n.addRange(o)),L(),b(!1)})(e.value)},children:e.labelKey?p(e.labelKey):e.label||e.value},`variables-${e.value}`))]}),children:qe("button",{className:"rich-text-tools-button",title:p("insert_merge_field"),onMouseDown:e=>e.preventDefault(),children:qe("span",{className:"rich-text-tools-button-icon",style:{color:"#fff",fontFamily:"monospace",fontWeight:700,fontSize:13,lineHeight:1},children:"{}"})})})]}),qe("button",{className:"rich-text-tools-button",title:p("minimize_toolbar")||"Collapse",onClick:()=>h(!g),children:qe(B,{icon:g?z:F,className:"rich-text-tools-button-icon"})})]})})})},ui=({id:e,blockItem:t,displayContent:a})=>{const{currentItem:s,previewMode:c,blockMap:d,rootOrder:u,setBlocks:p,setCurrentItem:m,isDragStart:g,templateData:h,registerRichTextFlush:y,actionType:b}=n(Ln),{t:f}=ja(),_=i(null),k=i(null),v=i(!1),w=i(!1),x="undo"===b||"redo"===b||"string"==typeof b&&b.startsWith("set_history"),S=s&&s.id===(e??t?.id),C="text"===t?.key&&"dynamic"===t?.contentType,N=S&&!C,L="desktop"===c?t.styles?.desktop??{}:{...t.styles?.desktop??{},...t.styles?.mobile??{}},T=L.linkColor||"#2faade",{linkColor:B,...A}=L,I={...A,direction:"ltr",unicodeBidi:"isolate","--ee-rich-text-link-color":T},$=i(!1),P=null!=a?a:t.text||"",R=l(()=>{const n=qt(d,u,e??t?.id),o=n?.[0]??null;return{containerBlock:o?.containerBlock??null,containerType:o?.containerType??"none",cellIndex:o?.cellIndex??0,lineage:n}},[d,u,e,t?.id]),M=l(()=>{const e=R?.cellIndex??0,t=R?.containerBlock;return{columnIndex:e,columnProduct:t?.columnProducts?.[e]??null}},[R]),D=l(()=>(R?.lineage??[]).slice(1).filter(e=>e?.containerType&&"none"!==e.containerType).map(e=>{const t=e.cellIndex??0;return{containerType:e.containerType,context:{columnIndex:t,columnProduct:e.containerBlock?.columnProducts?.[t]??null}}}),[R?.lineage]),U=l(()=>zo(0,R?.containerType??"none",h,M,D).map(e=>{return t=e.value,n=e.pasteValue,{token:t,pasteValue:String(n||"")};var t,n}).filter(e=>e.token&&e.pasteValue&&""!==e.pasteValue.trim()&&!e.pasteValue.includes("{{")&&e.pasteValue!==e.token).sort((e,t)=>t.pasteValue.length-e.pasteValue.length),[h,M,R?.containerType,D]),E=o(e=>{if(!e||!U.length||"undefined"==typeof document)return e;const t=document.createElement("div");t.innerHTML=e;const n=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);let o=n.nextNode();for(;o;){const e=o.nodeValue||"",{masked:t,tokens:l}=Ka(e);let a=t;U.forEach(({token:e,pasteValue:t})=>{t&&a.includes(t)&&(a=a.split(t).join(e))}),o.nodeValue=Va(a,l),o=n.nextNode()}return t.innerHTML},[U]);r(()=>{v.current=N},[N]);const z=o(()=>{null!=k.current&&(clearTimeout(k.current),k.current=null)},[]);r(()=>()=>z(),[z]),r(()=>{if(N&&_.current){const e=Ha(P);if($.current){const t=_.current,n=Ha(t.innerHTML||"");if("undefined"!=typeof document&&document.activeElement===t&&e!==n&&!x)return void($.current=!0);e!==n&&(t.innerHTML=e)}else _.current.innerHTML=e,_.current.focus();$.current=!0}else $.current=!1},[N,e,P,x]);const F=o(n=>{if(!n)return;const o=e??t?.id,l=d[o]||{},{textToStore:i,unchangedFromResolved:r}=function({rawHtml:e,displayContent:t,blockItemText:n,oldBlockKey:o,blockItemKey:l,restoreVariableTokensInHtml:a}){const i=Ha(e),r=null!=t?Ha(String(t)):null,s=!/<\s*a\b/i.test(i)&&null!=r&&i===r;let c=s?n:i;return"text"===(o??l)&&"function"==typeof a&&(c=a(c)),{textToStore:c,unchangedFromResolved:s}}({rawHtml:n.innerHTML,displayContent:a,blockItemText:t.text,oldBlockKey:l.key,blockItemKey:t.key,restoreVariableTokensInHtml:E}),c=r?l.selectedVariableKey:void 0;if((l.text??"")===(i??"")&&String(l.selectedVariableKey??"")===String(c??""))return;const g={...l,text:i,selectedVariableKey:c},h={...d,[o]:g};p(h,u,`edit_${Date.now()}`),m({...s,data:g})},[e,t?.id,t?.key,t?.text,d,u,p,m,s,a,E]),O=o(()=>{F(_.current)},[F]),W=o(()=>{z(),k.current=setTimeout(()=>{k.current=null,v.current&&_.current&&!w.current&&F(_.current)},380)},[z,F]),j=o(()=>{z(),O()},[z,O]);r(()=>{if(N&&"function"==typeof y)return y(O)},[N,y,O]);const H=o(e=>{if("number"==typeof e.button&&0!==e.button)return;if(!S||!C)return;qa(f);const t=_.current;if(t&&"function"==typeof t.focus)try{t.focus({preventScroll:!0})}catch{t.focus()}},[S,C,f]),K=o(e=>{if(!S||!C)return;if(e.metaKey||e.ctrlKey||e.altKey)return;if("Tab"===e.key||"Escape"===e.key)return;if(e.isComposing)return;const t=e.key;1!==t.length&&"Enter"!==t&&"Backspace"!==t&&"Delete"!==t||(e.preventDefault(),qa(f))},[S,C,f]),V=o(e=>{(e=>{e.preventDefault(),e.stopPropagation()})(e)},[]),G=Ha(P);return Je("div",{className:"relative",dir:"ltr",style:{direction:"ltr",unicodeBidi:"isolate"},children:[N&&t&&!g&&qe(di,{textBlock:_,id:e??t?.id,syncTextFromDom:O}),qe("div",{className:za(N&&"text-block","text-content_editable"),tabIndex:S&&C?0:void 0,onPointerDownCapture:H,onKeyDownCapture:K,onClick:V,onInput:N?()=>{w.current||W()}:void 0,onBlur:j,onCompositionStart:()=>{w.current=!0,z()},onCompositionEnd:()=>{w.current=!1,z(),O()},style:I,dir:"ltr",contentEditable:N,suppressContentEditableWarning:!0,ref:_,dangerouslySetInnerHTML:N?void 0:{__html:G}})]})},pi=t=>{const{id:o,blockItem:a}=t,{currentItem:i,previewMode:r,templateData:s,blockMap:c,rootOrder:d}=n(Ln),u="desktop"===r?a.styles?.desktop??{}:{...a.styles?.desktop??{},...a.styles?.mobile??{}},p=i&&i.id===o,m=l(()=>Jt(c,d,o),[c,d,o]),g=l(()=>Co(a.text,s,m),[a.text,s,m]),h=p?a.text||"":g,y=null!=u.linkColor&&""!==String(u.linkColor).trim()?String(u.linkColor).trim():"#2faade",b=l(()=>Ho(h,y,{useImportant:!1}),[h,y]),f=m?.containerBlock,_="footer"===f?.containerType,k=(g||"").replace(/<[^>]+>/g,"").replace(/\s+/g," ").trim();if(_&&(""===k||"{{Address}}"===k||"{{Tagline}}"===k))return null;const v=a.type&&/^h[1-4]$/.test(a.type)?a.type:"div";return p?qe(ui,{...t,blockItem:a}):e.createElement(v,{style:{...u,direction:"ltr",unicodeBidi:"isolate"},dir:"ltr",dangerouslySetInnerHTML:{__html:b}})};const mi=e=>{const{blockItem:t,id:o}=e,{currentItem:a,previewMode:i,templateData:r,blockMap:s,rootOrder:c}=n(Ln),d=l(()=>Jt(s,c,o),[o,s,c]),u=l(()=>{const e=t.text??"",n=e.match(/\{\{(\w+)\}\}/),o=t.labelVariable?t.labelVariable.replace(/^\{\{|\}\}$/g,"").trim():n?n[1]:void 0;if(!r||!o)return e;const l=$o(r,o,d);return null==l||String(l).startsWith("{{")?e:String(l)},[t.text,t.labelVariable,r,d]),p=a&&a.id===o,m=l(()=>{const e="desktop"===i?t.styles?.desktop??{}:{...t.styles?.desktop??{},...t.styles?.mobile??{}};let n=e.backgroundColor;return!function(e,t,n,o){const l=qt(t,n,o).find(e=>"product"===e?.containerType);if(!l?.containerBlock)return!1;if(!function(e,t){if(!t||"column"!==t.key||"product"!==t.containerType)return!1;if("additional"===t.productRole)return!1;if("image_left"===t.mainProductLayout)return!0;if("image_stacked"===t.mainProductLayout)return!1;const n=t.cells||[],o=n[0]?.childrenIds?.[0],l=e[o];return"column"===l?.key&&"2-3"===l?.type}(t,l.containerBlock))return!1;const a=e.styles?.desktop?.backgroundColor;return null==a||""===String(a).trim()||Ll(a)===Ll(Nl)}(t,s,c,o)?(null==n||""===String(n).trim()||Tl(n))&&(n=Bl(r)):n=Bl(r),{...e,backgroundColor:n}},[t,s,o,i,c,r]),g="desktop"===i?t.contentStyles?.desktop:{...t.contentStyles?.desktop,...t.contentStyles?.mobile},h=l(()=>qe(ui,{...e,blockItem:{...t,styles:{...t.styles,desktop:{...t.styles?.desktop,backgroundColor:m.backgroundColor}}},displayContent:u}),[t,u,m.backgroundColor]);return qe("div",{style:{...g},children:p?h:qe("div",{style:{...m,textAlign:"center"},dangerouslySetInnerHTML:{__html:u}})})},gi=({blockItem:e})=>{const{previewMode:t}=n(Ln),o="desktop"===t?e.styles?.desktop??{}:{...e.styles?.desktop??{},...e.styles?.mobile??{}},l="desktop"===t?e.contentStyles?.desktop:{...e.contentStyles?.desktop,...e.contentStyles?.mobile};return qe("div",{className:"relative",children:qe("div",{style:{...l},children:qe("div",{style:{...o}})})})},hi=({blockItem:e})=>{const{previewMode:t}=n(Ln),o="desktop"===t?e.styles?.desktop??{}:{...e.styles?.desktop??{},...e.styles?.mobile??{}},l="desktop"===t?e.contentStyles?.desktop:{...e.contentStyles?.desktop,...e.contentStyles?.mobile};return qe("div",{className:"relative",style:{...l},children:qe("div",{style:{width:"100%",height:"number"==typeof o.height?`${o.height}px`:o.height||"16px",display:o.display||"block"}})})},yi=({blockItem:e})=>{const{previewMode:t}=n(Ln),{list:o=[],separator:l=" | "}=e,a=o,i=e.mobileLayout??"stack",r="mobile"===t&&"stack"===i,s=st("desktop"===t?e.styles?.desktop??{}:{...e.styles?.desktop??{},...e.styles?.mobile??{}}),c="desktop"===t?e.contentStyles?.desktop:{...e.contentStyles?.desktop,...e.contentStyles?.mobile},d=c&&"object"==typeof c?{...c}:{},u=d.textAlign??"center";delete d.textAlign;const p=e.linkGapPx,m="number"==typeof p&&Number.isFinite(p)&&p>=0?p:0,g=Boolean(e.linkUnderline),h=s.fontWeight,y="normal"===h||"bold"===h?h:null!=h?String(h):"400",b={fontSize:null!=s.fontSize?`${s.fontSize}px`:"14px",fontFamily:s.fontFamily||"sans-serif",color:s.linkColor||s.color||"#2faade",fontWeight:y,letterSpacing:null!=s.letterSpacing?`${s.letterSpacing}px`:"0px",textDecoration:g?"underline":"none",textTransform:s.textTransform??"none",display:"inline-block"},f={fontSize:null!=s.fontSize?`${s.fontSize}px`:"14px",color:s.color||"#333",display:"inline-block",verticalAlign:"middle",whiteSpace:"pre"},_=m>0?{...f,marginLeft:m,marginRight:m}:{...f,paddingLeft:4,paddingRight:4},k="left"===u?"flex-start":"right"===u?"flex-end":"center",v=r?{...d,display:"flex",flexDirection:"column",flexWrap:"nowrap",alignItems:k,...m>0?{gap:m}:{},width:"100%",maxWidth:"100%",minWidth:0,boxSizing:"border-box"}:{...d,display:"block",textAlign:"justify"===u?"justify":u,width:"100%",maxWidth:"100%",minWidth:0,boxSizing:"border-box"},w=(e,t)=>qe("a",{href:e.url?e.url.startsWith("http")?e.url:`https://${e.url}`:"#",target:"_blank"===e.target?"_blank":"_self",rel:"_blank"===e.target?"noopener noreferrer":void 0,style:b,onClick:e=>e.preventDefault(),children:e.label||"Link"},`${t}-link`);return qe("div",{className:"relative ee-menu-block-root",children:qe("div",{className:"ee-menu-block-inner",style:v,children:a.flatMap((e,t)=>{if(r)return[w(e,t)];const n=[];return t>0&&n.push(qe("span",{style:_,children:l},`${t}-sep`)),n.push(w(e,t)),n})})})};function bi(e,t,n){return Math.min(n,Math.max(t,e))}function fi({active:e,hostRef:t,blockId:n,previewMode:l,getEditorSnapshot:a}){const s=i(null),c=i(null),d=i(a);r(()=>{d.current=a},[a]);const u=o(o=>a=>{if(!e||!t.current)return;a.stopPropagation(),a.preventDefault(),c.current=null;const i=t.current,r=i.parentElement;if(!r)return;const u=r.getBoundingClientRect(),p=i.getBoundingClientRect(),m=i.querySelector("img"),g=m?.getBoundingClientRect()??p,h=u.width>0?u.width:600;s.current={edge:o,startX:a.clientX,startY:a.clientY,startW:p.width,startH:g.height,parentW:h};const y=e=>{const o=s.current;if(!o||!t.current)return;const a=d.current(),{blockMap:i,rootOrder:r,setBlocks:u,setCurrentItem:p,currentItem:m}=a,g=c.current||i,h=e.clientX-o.startX,y=e.clientY-o.startY,b=Math.max(24,.05*o.parentW),f=e=>bi(e,b,o.parentW)/o.parentW*100;let _=null;if("e"===o.edge?_={widthPct:f(o.startW+h)}:"w"===o.edge?_={widthPct:f(o.startW-h)}:"s"===o.edge?_={heightPx:bi(o.startH+y,24,2e3)}:"n"===o.edge&&(_={heightPx:bi(o.startH-y,24,2e3)}),!_)return;const k=function({blockMap:e,id:t,previewMode:n,widthPct:o,heightPx:l}){const a=e[t];if(!a||"image"!==a.key)return e;const i=xt(a);if(i.styles||(i.styles={desktop:{},mobile:{}}),i.styles[n]||(i.styles[n]={}),i.contentStyles||(i.contentStyles={desktop:{},mobile:{}}),null!=o){const e=`${bi(Math.round(o),5,100)}%`;i.styles[n].width=e,"desktop"!==n&&(i.styles.desktop||(i.styles.desktop={}),i.styles.desktop.width=e)}if(null!=l){const e=`${Math.round(l)}px`;i.styles[n].height=e,"desktop"!==n&&(i.styles.desktop||(i.styles.desktop={}),i.styles.desktop.height=e)}for(const e of["desktop","mobile"]){const t=i.contentStyles[e];t&&"object"==typeof t&&(delete t.marginLeft,delete t.marginTop)}return{...e,[t]:i}}({blockMap:g,id:n,previewMode:l,widthPct:_.widthPct??null,heightPx:_.heightPx??null});u(k,r,{skipUndo:!0}),m?.id===n&&p({...m,data:k[n]}),c.current=k},b=()=>{s.current=null,document.removeEventListener("pointermove",y),document.removeEventListener("pointerup",b),document.removeEventListener("pointercancel",b);const e=d.current(),{rootOrder:t,setBlocks:n}=e,o=c.current||e.blockMap;c.current=null,n({...o},t,{skipUndo:!1})};document.addEventListener("pointermove",y),document.addEventListener("pointerup",b),document.addEventListener("pointercancel",b)},[e,t,n,l]);if(!e)return null;const p=(e,t,n,o)=>qe("button",{type:"button",className:`ee-image-resize-handle ${t}`,"aria-label":o,tabIndex:-1,style:{cursor:n,touchAction:"none"},onPointerDown:u(e)});return Je(Ye,{children:[p("n","ee-image-resize-handle--n","n-resize","Resize from top edge"),p("s","ee-image-resize-handle--s","s-resize","Resize from bottom edge"),p("e","ee-image-resize-handle--e","e-resize","Resize from right edge"),p("w","ee-image-resize-handle--w","w-resize","Resize from left edge")]})}function _i(e){return null!=e&&"string"==typeof e&&/<[a-zA-Z!/?]/.test(e.trim())}function ki(e){switch(e){case"h1":case"h2":case"h3":return 700;case"subtitle":case"eyebrow":return 600;default:return 400}}const vi=({blockItem:e,id:t})=>{const{previewMode:a,templateData:r,blockMap:s,rootOrder:c,bodySettings:d,currentItem:u,setBlocks:p,setCurrentItem:m}=n(Ln),g=s[t]||e,{src:h,alt:y,linkURL:b}=g,f="desktop"===a?g.styles?.desktop??{}:{...g.styles?.desktop??{},...g.styles?.mobile??{}},_=l(()=>{const e="desktop"===a?g.contentStyles?.desktop??{}:{...g.contentStyles?.desktop,...g.contentStyles?.mobile},{marginLeft:t,marginTop:n,...o}=e;return o},[g.contentStyles,a]),k=i(null),v=o(()=>({blockMap:s,rootOrder:c,setBlocks:p,setCurrentItem:m,currentItem:u,previewMode:a}),[s,c,p,m,u,a]),w=l(()=>{const e="string"==typeof h&&/^\{\{\w+\}\}$/.test(h.trim())?h.trim():"";if(h&&!e)return h;if(!r||!e)return h||"";const n=Jt(s,c,t),o=e.replace(/^\{\{|\}\}$/g,"").trim(),l=$o(r,o,n);return l&&!l.startsWith("{{")?l:h||""},[h,r,s,c,t]),x="string"==typeof h&&/^\{\{\w+\}\}$/.test(h.trim())?h.trim():"",S=!w||w.startsWith("{{"),C=y||"Image",N=f.width,L=N&&"auto"!==N,T=L?{width:N}:void 0,A="string"==typeof b?b.trim():"",I=""===A?"":nt(A,{allowMailtoTel:!0})??"",$=Boolean(g.textOverlayEnabled)&&function(e){const t=Array.isArray(e.overlayItems)?e.overlayItems:[];return t.length>0?t.some(e=>""!==String(e?.text??"").trim()):""!==String(e.overlayText??"").trim()}(g)&&w&&!S,P=()=>{const e=String(g.overlayText??"").replace(/<script\b[\s\S]*?<\/script>/gi,"");return _i(e)?qe("span",{className:"ee-image-overlay-caption-html",dangerouslySetInnerHTML:{__html:e}}):qe("span",{className:"ee-image-overlay-caption-plain",style:{whiteSpace:"pre-wrap"},children:e})},R=()=>{const e=Array.isArray(g.overlayItems)?g.overlayItems:[],t="number"==typeof g.overlayItemGap?g.overlayItemGap:8,n="number"==typeof g.overlayMaxWidth?g.overlayMaxWidth:100,o="number"==typeof g.overlayPadding?g.overlayPadding:16,l=g.textShadowEnabled?"0 1px 3px rgba(0,0,0,0.55)":"none",a=d?.styles?.fontFamily??"sans-serif";return qe("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch",gap:t,width:`${n}%`,maxWidth:"100%",padding:o,boxSizing:"border-box"},children:e.map((e,t)=>{const n=String(e?.text??"").replace(/<script\b[\s\S]*?<\/script>/gi,""),o="number"==typeof e?.fontSize?e.fontSize:16,i=e?.color||"#ffffff",r=null!=e?.fontFamily&&""!==String(e.fontFamily).trim()?String(e.fontFamily).trim():a;return qe("div",{style:{color:i,fontSize:o,fontFamily:r,fontWeight:ki(e?.kind),lineHeight:1.35,textShadow:l,wordBreak:"break-word"},children:_i(n)?qe("span",{className:"ee-image-overlay-caption-html",dangerouslySetInnerHTML:{__html:n}}):qe("span",{style:{whiteSpace:"pre-wrap"},children:n})},t)})})},M=$?(()=>{const e=pl(ul(g.overlayPosition)),t=f.borderRadius,n="number"==typeof g.overlayMaxWidth?g.overlayMaxWidth:100,o="number"==typeof g.overlayPadding?g.overlayPadding:16,l={position:"relative",display:"block",width:"100%",maxWidth:"100%",borderRadius:t,overflow:"hidden",lineHeight:0,verticalAlign:"top"},a=Array.isArray(g.overlayItems)?g.overlayItems:[],i=a.length>0&&a.some(e=>""!==String(e?.text??"").trim()),r={...e,position:"absolute",pointerEvents:"none",zIndex:2,maxWidth:`${n}%`,boxSizing:"border-box",...i?{}:{color:g.overlayTextColor||"#ffffff",fontSize:"number"==typeof g.overlayFontSize?g.overlayFontSize:18,fontWeight:600,lineHeight:1.35,padding:o,textShadow:g.textShadowEnabled?"0 1px 3px rgba(0,0,0,0.55)":void 0,...g.overlayBoxBackground?{backgroundColor:g.overlayBoxBackground,padding:`${Math.max(8,o/2)}px 12px`}:{}}},s=qe("img",{src:w,style:{...f,width:"100%",maxWidth:"100%",display:"block",borderRadius:0,verticalAlign:"top"},alt:C});return Je("div",{className:"ee-image-overlay-host",style:l,children:[g.scrimEnabled?qe("div",{style:{position:"absolute",left:0,right:0,top:0,bottom:0,pointerEvents:"none",zIndex:1,background:"linear-gradient(to top, rgba(0,0,0,0.65), rgba(0,0,0,0.12), transparent 55%)"},"aria-hidden":!0}):null,qe("div",{style:{position:"relative",zIndex:0},children:s}),qe("div",{className:"ee-image-overlay-caption",style:r,children:i?R():P()})]})})():w&&!S?qe("img",{src:w,style:L?{...f,width:"100%",maxWidth:"100%",display:"block"}:f,alt:C,className:"inline-block"}):qe("div",{className:"empty-image",style:{...f,width:L||"auto"===f.width?"100%":f.width},title:S&&x?x:void 0,children:S&&x?qe("span",{className:"empty-image-variable-label",children:x}):qe(B,{icon:O,className:"empty-image-icon"})}),D=jo(g)&&I&&w&&!S?qe("a",{href:I,target:"_blank",rel:"noopener noreferrer",style:L?{textDecoration:"none",display:"block",width:"100%",maxWidth:"100%"}:{textDecoration:"none",display:"inline-block",maxWidth:"100%"},onClick:e=>e.preventDefault(),children:M}):M,U=u?.id===t;return qe("div",{className:"relative",children:qe("div",{style:{..._||{}},children:Je("div",{ref:k,style:T,className:za("ee-image-canvas-host",U&&"ee-image-canvas-host--selected"),children:[D,qe(fi,{active:U,hostRef:k,blockId:t,previewMode:a,getEditorSnapshot:v})]})})})},wi=({blockItem:e})=>{const{src:t,alt:o,linkURL:l}=e,{previewMode:a}=n(Ln),i="desktop"===a?e.styles?.desktop??{}:{...e.styles?.desktop??{},...e.styles?.mobile??{}},r="desktop"===a?e.contentStyles?.desktop:{...e.contentStyles?.desktop,...e.contentStyles?.mobile},s=t?qe("img",{src:t,style:{...i,width:i.width??64,height:i.width??64,objectFit:"cover",borderRadius:i.borderRadius??"50%"},alt:o||"Avatar",className:"inline-block"}):qe("div",{className:"empty-avatar",style:{width:i.width??64,height:i.width??64,borderRadius:i.borderRadius??"50%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--ee-border, #eee)"},children:qe(B,{icon:W,style:{fontSize:"24px",color:"#999"}})}),c={...r,width:"100%"},d=null!=l&&String(l).trim()?nt(l,{allowMailtoTel:!0}):null;return qe("div",{className:"relative",children:qe("div",{style:c,children:d?qe("a",{href:d,target:"_blank",rel:"noopener noreferrer",style:{display:"inline-block"},children:s}):s})})},xi=({blockItem:e})=>{const{previewMode:t}=n(Ln),{t:o}=ja(),{list:l=[]}=e,a=_t(e),i=rt(e?.iconColor),r="desktop"===t?e.styles?.desktop??{}:{...e.styles?.desktop??{},...e.styles?.mobile??{}},s=st(r),c="desktop"===t?e.contentStyles?.desktop:{...e.contentStyles?.desktop,...e.contentStyles?.mobile},d=Boolean(e.showTextLabel),u=r.color||"#525252",p=Math.max(11,Math.round(.58*a)),m=Array.isArray(l)?l.filter(Boolean):[];return 0===m.length?null:qe("div",{className:"relative",children:qe("div",{style:gt(c),children:m.map((e,t)=>{const{image:n,title:l,linkURL:r}=e,c=at(e)?o("social_platform_x_alt"):l,m=at(e)?o("social_platform_x"):l,{src:g,style:h}=vt(e,i,a),y=qe("img",{src:g||n,alt:c,style:h}),b=nt(r,{allowMailtoTel:!1}),f={display:"inline-flex",alignItems:"center",gap:d?8:0,textDecoration:"none",color:u},_=Je(Ye,{children:[y,d?qe("span",{style:{fontSize:p,lineHeight:1.2,color:u,whiteSpace:"nowrap"},children:m}):null]});return qe("div",{style:{...s,display:"inline-flex",alignItems:"center"},children:b?qe("a",{href:b,target:"_blank",rel:"noopener noreferrer",style:f,onClick:e=>e.preventDefault(),children:_}):qe("span",{style:f,children:_})},t)})})})};const Si=({blockItem:e})=>{const{previewMode:t}=n(Ln),l="desktop"===t?{...e.contentStyles?.desktop??{}}:{...e.contentStyles?.desktop??{},...e.contentStyles?.mobile??{}},{outer:a,inner:i}=function(e){if(!e||"object"!=typeof e)return{outer:{width:"100%",textAlign:"center",boxSizing:"border-box"},inner:{width:"100%",maxWidth:"100%",display:"inline-block",verticalAlign:"top",boxSizing:"border-box"}};const{textAlign:t="center",width:n="100%",paddingTop:o,paddingRight:l,paddingBottom:a,paddingLeft:i,backgroundColor:r,...s}=e;return{outer:{width:"100%",textAlign:t,boxSizing:"border-box"},inner:{width:n,maxWidth:"100%",display:"inline-block",verticalAlign:"top",boxSizing:"border-box",paddingTop:o,paddingRight:l,paddingBottom:a,paddingLeft:i,backgroundColor:r,...s}}}(l),r=o(e=>{const t=e.target?.closest?.("a[href]");if(!t)return;e.preventDefault(),e.stopPropagation();const n=(t.getAttribute("href")||"").trim();if(n&&!/^javascript:/i.test(n)&&!/^data:/i.test(n))if(/^https?:\/\//i.test(n)||n.startsWith("//")){const e=n.startsWith("//")?`https:${n}`:n;window.open(e,"_blank","noopener,noreferrer")}else(/^mailto:/i.test(n)||/^tel:/i.test(n))&&window.open(n,"_blank","noopener,noreferrer")},[]);return qe("div",{className:"relative ee-raw-html-block",children:qe("div",{className:"ee-raw-html-outer",style:a,children:qe("div",{className:"ee-raw-html-inner",style:i,children:qe("div",{className:"ee-raw-html-content",role:"region","aria-label":"Custom HTML preview",onClick:r,dangerouslySetInnerHTML:{__html:e.html??""}})})})})},Ci=({blockItem:e})=>{const{previewMode:t}=n(Ln),o="desktop"===t?{...e.styles?.desktop??{}}:{...e.styles?.desktop??{},...e.styles?.mobile??{}},l="number"==typeof e.rows?e.rows:3,a="number"==typeof e.cols?e.cols:3,i=Boolean(e.headerRow),r=Boolean(e.headerCol),s=Boolean(e.stripedRows),c=o.fontSize??14,d=o.color??"#333333",u=o.borderStyle??"solid",p=o.borderWidth??1,m=o.borderColor??"#e0e0e0",g=o.cellPadding??8,h=o.textAlign??"left",y=o.headerBg??"#f5f5f5",b=o.headerColor??"#333333",f=o.stripedBg??"#fafafa",_="none"!==u?`${p}px ${u} ${m}`:"none",k=(e,t)=>{const n=i&&0===e||r&&0===t;return{border:_,padding:g,fontSize:c,color:n?b:d,textAlign:h,backgroundColor:n?y:s&&!n&&e%2==0?f:"transparent",fontWeight:n?600:400,verticalAlign:"top"}},v={...e.contentStyles?.desktop??{},..."desktop"!==t?e.contentStyles?.mobile??{}:{}},w=(t,n)=>{const o=`${t}-${n}`,l=e.cells?.[o];if("image"===l?.type&&String(l.src??"").trim())return qe("img",{src:l.src,alt:l.alt||"",style:{maxWidth:"100%",height:"auto",display:"block"}});const a=l?.text??"";return qe("span",a?{style:{whiteSpace:"pre-wrap"},children:a}:{style:{color:"rgba(0,0,0,0.35)",fontStyle:"italic",fontWeight:400},children:"—"})};return qe("div",{style:{width:"100%",boxSizing:"border-box",paddingTop:v.paddingTop??0,paddingBottom:v.paddingBottom??0,paddingLeft:v.paddingLeft??0,paddingRight:v.paddingRight??0,textAlign:v.textAlign??"left",overflowX:"auto"},children:qe("table",{style:{width:"100%",borderCollapse:"collapse",tableLayout:"auto"},children:qe("tbody",{children:Array.from({length:l}).map((e,t)=>qe("tr",{children:Array.from({length:a}).map((e,n)=>qe(i&&0===t||r&&0===n?"th":"td",{style:k(t,n),children:w(t,n)},`${t}-${n}`))},t))})})})},Ni=({blockItem:e})=>{const{previewMode:t}=n(Ln),o=l(()=>"desktop"===t?e.styles?.desktop??{}:{...e.styles?.desktop??{},...e.styles?.mobile??{}},[e.styles,t]),a=l(()=>"desktop"===t?e.contentStyles?.desktop:{...e.contentStyles?.desktop,...e.contentStyles?.mobile},[e.contentStyles,t]),i=l(()=>"desktop"===t?e.videoArea?.desktop??{}:{...e.videoArea?.desktop??{},...e.videoArea?.mobile??{}},[e.videoArea,t]),r="string"==typeof e.videoUrl?e.videoUrl.trim():"",s=Boolean(o.fillColumn),c=Boolean(o.fillColumnMobile),d="desktop"===t?s:c||s,u=l(()=>ml(r,e.thumbnailUrl),[r,e.thumbnailUrl]),p=l(()=>{let e=o.width,t=o.height;null!=e&&""!==e||(e="auto"),null!=t&&""!==t||(t="auto"),d&&(e="100%");const n=a?.textAlign||"center";let l="0 auto";return"left"===n?l="0":"right"===n&&(l="0 0 0 auto"),{width:"number"==typeof e?`${e}px`:e,height:"number"==typeof t?`${t}px`:t,display:"block",margin:l,maxWidth:"100%"}},[o,d,a?.textAlign]),m=l(()=>{const e=i||{},t=null!=e.borderWidth?Number(e.borderWidth):0;let n="none";return t>0&&e.borderStyle&&"none"!==e.borderStyle&&(n=`${t}px ${e.borderStyle} ${e.borderColor??"#cccccc"}`),{paddingTop:e.paddingTop??0,paddingBottom:e.paddingBottom??0,paddingLeft:e.paddingLeft??0,paddingRight:e.paddingRight??0,backgroundColor:e.backgroundColor||"transparent",border:n,borderRadius:e.borderRadius??0,boxSizing:"border-box"}},[i]),g=l(()=>{let e=o.width;d&&(e="100%"),null!=e&&""!==e||(e="auto");const t="auto"===e?"100%":"number"==typeof e?`${e}px`:e,n=i?.borderRadius;return{width:t,maxWidth:"100%",boxSizing:"border-box",...null!=n&&""!==n?{borderRadius:n}:{}}},[o.width,d,i?.borderRadius]),h=!u,y=r.startsWith("http://")||r.startsWith("https://")||r.startsWith("//")?r.startsWith("//")?`https:${r}`:r:r?`https://${r.replace(/^\/+/,"")}`:"";return qe("div",{className:"relative ee-video-block",children:qe("div",{style:{...a||{}},children:qe("div",h?{className:"empty-image ee-video-inner",style:g,children:qe(B,{icon:j,className:"empty-image-icon"})}:{className:"ee-video-inner",style:m,children:y?qe("a",{href:y,target:"_blank",rel:"noopener noreferrer",style:{display:"block",lineHeight:0,textDecoration:"none"},onClick:e=>e.stopPropagation(),children:qe("img",{src:u,alt:"Video thumbnail",className:"ee-video-thumb",style:p})}):qe("img",{src:u,alt:"Video thumbnail",className:"ee-video-thumb",style:p})})})})},Li=({blockItem:e,id:t})=>{if(!e)return null;const n={blockItem:e,id:t};switch(e.key){case"text":return qe(pi,{...n});case"button":return qe(mi,{...n});case"divider":return qe(gi,{...n});case"spacer":return qe(hi,{...n});case"menu":return qe(yi,{...n});case"image":return qe(vi,{...n});case"video":return qe(Ni,{...n});case"avatar":return qe(wi,{...n});case"social_link":return qe(xi,{...n});case"raw_html":return qe(Si,{...n});case"table":return qe(Ci,{...n});default:return null}},Ti={tree:null};function Bi(e,t,n){if(!n||!e[n])return null;if(t.includes(n))return Kt(n,e);const o=e[n];return"column"===o.key?Kt(n,e):xt(o)}function Ai(e,t,n){const o=Bi(e,t,n);return o?Ii(e,t,o,n):null}function Ii(e,t,n,o){if(!n||!o||!e[o])return null;const l=Bt(n),a=t.indexOf(o);if(-1!==a){const{newBlockMap:n,rootId:o}=nn(e,l);if(!o)return null;const i=[...t];i.splice(a+1,0,o);const r=n[o];return{nextMap:n,nextRootOrder:i,newId:o,selectionData:"column"===r?.key?Kt(o,n):r}}const i=Vt(e,t,o);if(!i)return null;const{newBlockMap:r,rootId:s}=nn(e,l);if(!s)return null;const c=Zt(r,i.containerId,i.cellIndex,i.itemIndex+1,s),d=c[s];return{nextMap:c,nextRootOrder:t,newId:s,selectionData:"column"===d?.key?Kt(s,c):d}}function $i(e,t,n,o){if(!n)return null;if(o&&e[o])return Ii(e,t,n,o);const l=Bt(n),{newBlockMap:a,rootId:i}=nn(e,l);if(!i)return null;const r=a[i],s="column"===r?.key?Kt(i,a):r;return{nextMap:a,nextRootOrder:[...t,i],newId:i,selectionData:s}}function Pi(e,t){const n=e[t];if(!n||"column"!==n.key)return!1;for(const t of n.cells||[])for(const n of t.childrenIds||[]){const t=e[n];if(t&&"empty"!==t.key)return!0}return!1}function Ri(e,t,n,o){if(!n||!e[n])return null;if(-1!==t.indexOf(n)){return{nextMap:en(e,n),nextRootOrder:t.filter(e=>e!==n)}}const l=Vt(e,t,n);if(!l)return null;const a=Oa(e,t,n);if(a?.nextBlockMap)return{nextMap:a.nextBlockMap,nextRootOrder:t};const{blockMap:i,removedId:r}=Xt(e,l.containerId,l.cellIndex,l.itemIndex);let s=i;const c=i[l.containerId];if(c&&0===c.cells[l.cellIndex].childrenIds.length){const e=Wt(o("drag_block_here"));s={...i,[e.id]:e,[l.containerId]:{...c,cells:c.cells.map((t,n)=>n===l.cellIndex?{...t,childrenIds:[e.id]}:t)}}}return r&&(s=en(s,r)),{nextMap:s,nextRootOrder:t}}function Mi(e){return e&&"column"===e.key?"section"===e.layoutRole||"columns"===e.layoutRole?e.layoutRole:!0===e.columnLayoutOnly?"columns":"section":null}const Di="section",Ui="columns";function Ei(e,t){if(!e||"column"!==e.key)return!1;if("none"!==e.containerType)return!1;const n=e.children;if(Array.isArray(n)){if(n.length<2||n.length>3)return!1;for(const e of n){if("content"!==e?.key)return!1;const t=e?.children?.[0];if("column"!==t?.key||"product"!==t?.containerType)return!1}return!0}if(!t||!Array.isArray(e.cells))return!1;const o=e.cells.length;if(o<2||o>3)return!1;for(const n of e.cells){const e=n?.childrenIds?.[0],o=t[e];if(!o||"column"!==o.key||"product"!==o.containerType)return!1}return!0}const zi="ee:open-configure-columns";function Fi(e){"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent(zi,{detail:null!=e&&String(e).length>0?{rootId:e}:{}}))}const Oi=(e,t)=>null==e||""===e?t:"number"==typeof e?e:parseInt(String(e).replace(/px/gi,""),10)||t;function Wi({segment:e,active:t,children:n,onSelect:o}){return n?qe("div",{className:za("ee-footer-canvas-segment",t&&"ee-footer-canvas-segment--selected"),"data-footer-segment":e,role:"button",tabIndex:0,onClick:t=>{t.stopPropagation(),o?.(e,t)},onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),o?.(e,t))},children:n}):null}const ji=({column:e,canvasFooterSegment:t,isFooterColumnSelected:o,onFooterCanvasSegmentSelect:l})=>{const{previewMode:a,templateData:i}=n(Ln),r="desktop"===a?e.styles?.desktop??{}:{...e.styles?.desktop??{},...e.styles?.mobile??{}},s=Boolean(e.showBrand??!0),c=Boolean(e.showTagline??!0),d=Boolean(e.footerShowLogo??!1),u=yl(e.footerLogoSrc??"",i),p=bl(String(e.footerLogoAlt??"Logo").trim()||"Logo",i).trim()||"Logo",m=e.footerLogoLink??"",g="number"==typeof e.footerLogoMaxWidthPercent?e.footerLogoMaxWidthPercent:parseInt(String(e.footerLogoMaxWidthPercent??"30"),10)||30,h="number"==typeof e.footerLogoPaddingPx?e.footerLogoPaddingPx:Oi(e.footerLogoPaddingPx,24),y=Boolean(e.showAddress??!0),b=Boolean(e.showUnsubscribe??!0),f=Boolean(e.showSocial??!1),_=Boolean(e.showSecondaryLinks??!1),k=Boolean(e.showCopyright??!0),v=bl(e.brandName??"",i),w=bl(e.brandTagline??"",i).trim(),x=bl(e.address??"",i),S=bl(e.copyrightText??"",i),C=e.unsubscribeUrl||"{{unsubscribe_url}}",N=null!=e.unsubscribeBodyText&&""!==String(e.unsubscribeBodyText).trim()?String(e.unsubscribeBodyText):kl,{unsubscribeLinkLabel:L}=vl(e),T=bl(L,i),B=bl(N,i),A=xl(e.secondaryLinks),I=wl(e.footerSocialList),$=r.color??"#737373",P=null!=r.linkColor&&""!==String(r.linkColor).trim()?String(r.linkColor).trim():$,R=Oi(r.fontSize,12),M=r.textAlign??"center",D=Oi(r.paddingTop,28),U=Oi(r.paddingRight,24),E=Oi(r.paddingBottom,28),z=Oi(r.paddingLeft,24),F=Boolean(e.showDivider??!1),O=e.dividerColor??"#374151",W=Boolean(e.showBorderTop??!1),j=Oi(e.borderTopWidth,1),H=e.borderTopStyle??"solid",K=e.borderTopColor??"#e5e7eb",V=gl(r.contentBackground),G={margin:0,color:$,fontSize:R,lineHeight:1.5,fontFamily:r.fontFamily??"Arial, sans-serif",textAlign:M},q={color:P,textDecoration:"underline",cursor:"pointer"},J={onClick:e=>{e.preventDefault()}},Y={boxSizing:"border-box",width:"100%",textAlign:M,backgroundColor:V,paddingTop:D,paddingRight:U,paddingBottom:E,paddingLeft:z,borderTop:W&&j>0?`${j}px ${H} ${K}`:void 0},X=(e,t)=>qe("div",{style:{marginTop:0,marginBottom:10},children:e},t),Z=Array.isArray(I)?I.filter(Boolean):[],Q=_t({imageWidth:36}),ee=nt(fl(m,i)),te=qe("img",{src:u,alt:p,draggable:!1,style:{maxWidth:`${Math.min(100,Math.max(10,g))}%`,height:"auto",display:"inline-block",padding:h,verticalAlign:"middle",border:0}}),ne=ee?qe("a",{href:ee,target:"_blank",rel:"noopener noreferrer",style:{textDecoration:"none",lineHeight:0,display:"inline-block"},...J,children:te}):te,oe=e=>Boolean(o&&t===e);return Je("div",{style:Y,children:[F?qe(Wi,{segment:"divider",active:oe("divider"),onSelect:l,children:qe("div",{style:{borderTop:`1px solid ${O}`,marginBottom:15,width:"100%"},"aria-hidden":!0})}):null,d&&u.trim()?X(qe(Wi,{segment:"logo",active:oe("logo"),onSelect:l,children:qe("div",{style:{display:"flex",justifyContent:"left"===M?"flex-start":"right"===M?"flex-end":"center",lineHeight:0},children:ne})}),"logo"):null,s&&v.trim()?X(qe(Wi,{segment:"brand",active:oe("brand"),onSelect:l,children:qe("p",{style:{...G,fontWeight:600},children:v})}),"brand"):null,c&&w.trim()?X(qe(Wi,{segment:"tagline",active:oe("tagline"),onSelect:l,children:qe("p",{style:{...G,opacity:.92},children:w})}),"tagline"):null,y&&x.trim()?X(qe(Wi,{segment:"address",active:oe("address"),onSelect:l,children:qe("p",{style:G,children:x})}),"address"):null,f&&Z.length>0?X(qe(Wi,{segment:"social",active:oe("social"),onSelect:l,children:qe("div",{style:{display:"flex",justifyContent:"left"===M?"flex-start":"right"===M?"flex-end":"center",flexWrap:"wrap",gap:12,alignItems:"center"},children:Z.map((e,t)=>{const n=nt(fl(e.linkURL,i),{allowMailtoTel:!1}),{src:o,style:l}=vt(e,"default",Q),a=qe("img",{src:o||e.image,alt:"",style:l,draggable:!1}),r={style:{display:"inline-flex",alignItems:"center",lineHeight:0}};return n?qe("a",{href:n,target:"_blank",rel:"noopener noreferrer",...r,...J,children:a},`${e.title}-${t}`):qe("span",{...r,children:a},`${e.title}-${t}`)})})}),"social"):null,b?X(qe(Wi,{segment:"unsubscribe",active:oe("unsubscribe"),onSelect:l,children:Je("p",{style:{...G,wordBreak:"break-word"},children:[B?`${B} `:"",qe("a",{href:nt(fl(C,i)),style:q,...J,children:T})]})}),"unsub"):null,_&&A.length>0?X(qe(Wi,{segment:"secondary",active:oe("secondary"),onSelect:l,children:qe("p",{style:{...G,wordBreak:"break-word"},children:A.map((e,t)=>Je("span",{children:[t>0?qe("span",{style:{padding:"0 6px",userSelect:"none"},children:"·"}):null,qe("a",{href:nt(fl(e.url,i)),target:"_blank"===e.target?"_blank":void 0,rel:"_blank"===e.target?"noopener noreferrer":void 0,style:q,...J,children:bl(e.label||"",i)||`#${t+1}`})]},e.id||`${e.label}-${t}`))})}),"secondary"):null,k&&S.trim()?X(qe(Wi,{segment:"copyright",active:oe("copyright"),onSelect:l,children:qe("p",{style:{...G,fontSize:Math.max(10,R-1),opacity:.9},children:S})}),"copy"):null,qe("div",{style:{height:1,marginBottom:-10},"aria-hidden":!0})]})},Hi=["paddingTop","paddingRight","paddingBottom","paddingLeft"],Ki=de;function Vi(e,t){if(!t?.key)return{icon:X,label:""};const{key:n,containerType:o}=t;if("column"===n)return"header"===o?{icon:Z,label:e("block_header")||"Header"}:"footer"===o?{icon:Q,label:e("block_footer")||"Footer"}:"product"===o?{icon:ee,label:e("block_product")}:"discount"===o?{icon:te,label:e("block_discount")}:Mi(t)===Ui?{icon:ne,label:e("block_palette_columns")}:{icon:X,label:e("block_palette_section")};switch(n){case"text":return{icon:ce,label:e("text")};case"button":return{icon:U,label:e("button")};case"image":return{icon:O,label:e("image")};case"video":return{icon:j,label:e("video")};case"divider":return{icon:se,label:e("divider")};case"spacer":return{icon:re,label:e("spacer")};case"menu":return{icon:ie,label:e("menu")};case"avatar":return{icon:W,label:e("avatar")};case"social_link":return{icon:ae,label:e("social_link")};case"raw_html":return{icon:le,label:e("raw_html")};case"table":return{icon:oe,label:e("table")};case"empty":return{icon:X,label:""};default:return{icon:X,label:n||""}}}function Gi(e,t){if("header"!==e?.containerType||!t?.hidden)return!1;const n=String(t.src??""),o=!1===e.showLogo&&"image"===t.key&&!t.headerBannerSlot&&!t.footerBannerSlot&&(!0===t.headerLogoSlot||/\{\{\s*LogoUrl\s*\}\}/.test(n)||n.includes("LogoUrl")),l=!0!==e.showHeaderBanner&&(Boolean(t.headerBannerSlot)||Boolean(t.headerBannerDividerSlot)||"image"===t.key&&n.includes("HeroBanner"));return o||l}function qi(e,t){return"footer"===e?.containerType&&!0!==e?.footerUnifiedLayout&&Boolean(t?.hidden)}const Ji=e=>{const{block:t,blockIndex:o,clearStyles:l}=e,{t:a}=ja(),{previewMode:i,blockMap:r,rootOrder:c,validationMarkers:d,ignoreValidationIssue:u,setBlocks:p,currentItem:m,setCurrentItem:g,setIsDragStart:h,isDragStart:y,bodySettings:b,setActionType:k,onSaveBlockAsGlobal:v}=n(Ln),w="desktop"===i?t.styles?.desktop??{}:{...t.styles?.desktop??{},...t.styles?.mobile??{}},{contentBackground:x,containerBackgroundImage:S,containerBackgroundSize:C,containerBackgroundPosition:N,...L}=w,T="footer"===t.containerType&&t.footerUnifiedLayout?gl(x):x;let A=L,I={};if("discount"===t.containerType){A={...L},I={};for(const e of Hi)Object.prototype.hasOwnProperty.call(A,e)&&(I[e]=A[e],delete A[e])}if("footer"===t.containerType&&t.footerUnifiedLayout){A={...A};for(const e of Hi)delete A[e]}let $=w;if("footer"===t.containerType&&t.footerUnifiedLayout){$={...w};for(const e of Hi)delete $[e]}const P="undefined"!=typeof window?window.__eeDragItemData:null,R=P?.key??(m?.id?r[m.id]?.key:null)??m?.data?.key,M=y&&"column"!==R,D=e=>t=>{t.preventDefault(),t.stopPropagation(),g({id:e.id,data:e,type:"edit"}),k("edit")},U=e=>t=>{t.preventDefault(),t.stopPropagation();const n=r[e];n&&(g({id:n.id,data:n,type:"edit"}),k("edit"))},E=(e,t,n)=>o=>{o.preventDefault(),o.stopPropagation();const l=r[e]?.cells?.[t]?.childrenIds?.[n];if(l){const e=Oa(r,c,l);if(e?.nextBlockMap)return p(e.nextBlockMap,c,"edit"),void g(null)}const{blockMap:i,removedId:s}=Xt(r,e,t,n);let d=i;const u=i[e];if(u&&0===u.cells[t].childrenIds.length){const n=Wt(a("drag_block_here"));d={...i,[n.id]:n,[e]:{...u,cells:u.cells.map((e,o)=>o===t?{...e,childrenIds:[n.id]}:e)}}}s&&(d=en(d,s)),p(d,c,"delete"),g(null)},z=e=>()=>{h(!0),g({id:e.id,data:e,type:"move"}),k("move")},F=e=>{e.preventDefault(),e.stopPropagation(),setTimeout(()=>{e.target.style.border="",e.target.children[0]&&e.target.children[0].classList.remove("sidebar-block-move"),h(!1),l&&l()},50)},O=e=>e.preventDefault(),W=e=>{e.preventDefault(),e.stopPropagation()},j=(e,t)=>n=>{W(n);const o=Qt(r,c,e,t);o&&p(o.nextMap,o.nextRootOrder,"move")},X=e=>t=>{W(t);const n=Ai(r,c,e);n&&(p(n.nextMap,n.nextRootOrder,"add"),g({id:n.newId,data:n.selectionData,type:"edit"}))},Z=e=>"desktop"===i?e.styles?.desktop||{}:{...e.styles?.desktop||{},...e.styles?.mobile||{}},Q=Ft(b),ee=Ot(b),te="mobile"===i||ee?"100%":Q,ne="mobile"===i||ee?"100%":Q,oe=e=>{const t=d?.[e];if(!t)return null;const n="error"===t.severity?`${t.errorCount} error${1===t.errorCount?"":"s"}`:"warning"===t.severity?`${t.warningCount} warning${1===t.warningCount?"":"s"}`:`${t.infoCount??t.totalCount} info`,o=qe("div",{className:"block-validation-popover",children:t.issues.map((e,t)=>{const n=Boolean(e.blockId&&r?.[e.blockId]);return Je("div",{className:"block-validation-popover-item",children:[qe("div",{className:"block-validation-popover-message",children:e.message}),Je("div",{className:"block-validation-popover-actions",children:[n&&qe(_,{size:"small",type:"text",className:"block-validation-popover-open-block",onClick:(o=e.blockId,e=>{e.preventDefault(),e.stopPropagation(),o&&r?.[o]&&(g({id:o,data:r[o],type:"edit"}),k("edit"),"undefined"!=typeof window&&window.requestAnimationFrame(()=>{const e="function"==typeof window.CSS?.escape?window.CSS.escape(String(o)):String(o).replace(/([ #;?%&,.+*~':"!^$[\]()=>|/@])/g,"\\$1"),t=document.querySelector(`[data-block-id="${e}"]`);t&&"function"==typeof t.scrollIntoView&&t.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})}))}),children:a("export_validation_open_block")||"Open block"}),"function"==typeof u&&qe(_,{size:"small",type:"text",className:"block-validation-popover-ignore",onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e)},children:a("ignore")})]})]},`${e.code}-${t}`);var o})});return qe(f,{trigger:["hover","click"],placement:"topRight",overlayClassName:"block-validation-popover-overlay",content:o,getPopupContainer:()=>document.querySelector("#preview")||document.body,children:Je("button",{type:"button",className:za("block-validation-indicator","error"===t.severity?"block-validation-indicator-error":"warning"===t.severity?"block-validation-indicator-warning":"block-validation-indicator-info"),"aria-label":n,onClick:e=>{e.preventDefault(),e.stopPropagation()},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},children:[qe("span",{className:"block-validation-indicator-dot"}),qe("span",{className:"block-validation-indicator-count",children:t.totalCount})]})})},le=(e,t,n,o,l,c,d=1)=>{const u=Z({styles:e.styles}),{contentBackground:p,containerBackgroundImage:g,containerBackgroundSize:h,containerBackgroundPosition:y,...f}=u,_=m?.id===e.id,k=((e=1)=>({"--nested-level":Math.max(1,e),"--nested-width":"100%"}))(d);return Je(Ye,{children:[Je("div",{className:"relative block-content-drag-label-content","data-drop-key":l,children:[qe("div",{className:"absolute block-move-top",children:qe("span",{className:"block-tools-drag_here",children:a("drag_block_here")})}),M&&qe("div",{className:"block-move-content-top","data-name":"dragTools","data-position":"top","data-container-id":t,"data-cell-index":n,"data-item-index":o,"data-drop-key":l,"data-type":"block-item-move"})]}),qe("div",{className:za("block-item block-item-container",_&&"block-item-focus"),style:k,"data-block-id":e.id,onMouseEnter:e=>{e.currentTarget.dataset.hovered="true"},onMouseLeave:e=>{delete e.currentTarget.dataset.hovered},onClick:D(e),children:Je("div",{className:"relative",children:[oe(e.id),qe("div",{className:"block-item-tools",onDragOver:O,children:M&&Je(Ye,{children:[qe("div",{className:"block-move-content-top","data-name":"dragTools","data-position":"top","data-container-id":t,"data-cell-index":n,"data-item-index":o,"data-drop-key":l,"data-type":"block-item-move"}),qe("div",{className:"block-move-content-bottom","data-name":"dragTools","data-position":"bottom","data-container-id":t,"data-cell-index":n,"data-item-index":o+1,"data-drop-key":c,"data-type":"block-item-move"})]})}),(()=>{const l=r[t]?.cells?.[n],i=o>0,s=o<(l?.childrenIds?.length??0)-1,c=Vi(a,e);return Je("div",{className:"block-chrome-overlay",children:[Je("span",{className:"block-chrome-badge",children:[qe(B,{icon:c.icon}),qe("span",{children:c.label})]}),Je("div",{className:"block-chrome-toolbar",children:[qe("span",{className:"block-chrome-action",onMouseDown:W,onClick:U(t),title:a("select_parent_section_tooltip"),children:qe(B,{icon:Ki})}),qe("span",{className:za("block-chrome-action",!i&&"block-chrome-action-disabled"),onMouseDown:W,onClick:j(e.id,-1),title:a("context_move_up"),children:qe(B,{icon:K})}),qe("span",{className:za("block-chrome-action",!s&&"block-chrome-action-disabled"),onMouseDown:W,onClick:j(e.id,1),title:a("context_move_down"),children:qe(B,{icon:V})}),qe("span",{className:"block-chrome-divider","aria-hidden":!0}),qe("span",{className:"block-chrome-action",onMouseDown:W,onClick:X(e.id),title:a("context_duplicate"),children:qe(B,{icon:G})}),qe("span",{className:"block-chrome-divider","aria-hidden":!0}),qe("span",{className:"block-chrome-action block-chrome-action-danger",onMouseDown:W,onClick:E(t,n,o),title:a("layer_delete"),children:qe(B,{icon:J})}),qe("span",{className:"block-chrome-action block-chrome-action-disabled ee-section-nested-no-drag",draggable:!1,onMouseDown:e=>e.stopPropagation(),title:a("section_nest_not_allowed"),style:{cursor:"not-allowed"},children:qe(B,{icon:Y})})]})]})})(),qe("div",{style:{...f,overflow:f.borderRadius?"hidden":void 0},children:qe("div",{className:"block-content block-item-container-body",style:{...sl(u,p),borderRadius:f.borderRadius,overflow:f.borderRadius?"hidden":void 0,...null!=f.minHeight&&""!==f.minHeight&&""!==String(f.minHeight).trim()?{minHeight:f.minHeight}:{}},children:(e.children||[]).map((t,n)=>{const o=Z(t);return qe("div",{style:{...o,width:"mobile"===i&&!1!==b.stackColumnsOnMobile?"100%":t.width},children:(t.children||[]).map((o,l)=>{const i=`${e.id}:${n}:${l}`,r=`${e.id}:${n}:${l+1}`,c=l===t.children.length-1&&"empty"!==o.key&&"column"!==o.key;return Je(s,{children:[ae(o,e.id,n,l,i,r,d),c&&qe("div",{className:"relative block-content-drag-label-content","data-drop-key":r,children:qe("div",{className:"absolute block-move-bottom",children:qe("span",{className:"block-tools-drag_here",children:a("drag_block_here")})})})]},`${e.id}:${n}:${o.id||l}`)})},`${e.id}:${t.id||"cell"}:${n}`)})})})]})}),Je("div",{className:"relative block-content-drag-label-content","data-drop-key":c,children:[qe("div",{className:"absolute block-move-bottom",children:qe("span",{className:"block-tools-drag_here",children:a("drag_block_here")})}),M&&qe("div",{className:"block-move-content-bottom","data-name":"dragTools","data-position":"bottom","data-container-id":t,"data-cell-index":n,"data-item-index":o+1,"data-drop-key":c,"data-type":"block-item-move"})]})]})},ae=(e,n,o,l,i,c,d=0)=>"empty"===e.key?qe("div",{className:"relative width-full",children:qe("div",{className:"block-empty-content ee-empty-drop-slot",onDragOver:M?O:void 0,...M?{"data-container-id":n,"data-cell-index":o,"data-item-index":l,"data-type":"empty-block-item"}:{},"aria-label":e.name||a("drag_block_here"),children:qe("span",{className:"ee-empty-drop-slot__label",children:a("drag_block_here")})})},e.id||l):"column"===e.key?qe(s,{children:le(e,n,o,l,i,c,d+1)},`${n}:${o}:${e.id||l}`):Je(s,{children:[qe("div",{className:"relative block-content-drag-label-content","data-drop-key":i,children:qe("div",{className:"absolute block-move-top",children:qe("span",{className:"block-tools-drag_here",children:a("drag_block_here")})})}),qe("div",{className:za("block-item",m?.id===e.id&&"block-item-focus",e.hidden&&!Gi(t,e)&&!qi(t,e)&&"block-hidden-dim",(Gi(t,e)||qi(t,e))&&"ee-header-banner-off-canvas"),"data-block-id":e.id,onClick:t=>{t.preventDefault(),t.stopPropagation(),Ja(e)&&m?.id===e.id&&qa(a),g({id:e.id,data:e,type:"edit"}),k("edit")},children:Je("div",{className:"relative",children:[oe(e.id),qe("div",{className:za("block-item-tools",Ja(e)&&m?.id===e.id&&"block-item-tools--pointer-through-ai-text"),onDragOver:O,children:M&&Je(Ye,{children:[qe("div",{className:"block-move-content-top","data-name":"dragTools","data-position":"top","data-container-id":n,"data-cell-index":o,"data-item-index":l,"data-drop-key":i,"data-type":"block-item-move"}),qe("div",{className:"block-move-content-bottom","data-name":"dragTools","data-position":"bottom","data-container-id":n,"data-cell-index":o,"data-item-index":l+1,"data-drop-key":c,"data-type":"block-item-move"})]})}),(()=>{const t=r[n]?.cells?.[o],i=l>0,s=l<(t?.childrenIds?.length??0)-1,c=Vi(a,e);return Je("div",{className:"block-chrome-overlay",children:[Je("span",{className:"block-chrome-badge",children:[qe(B,{icon:c.icon}),qe("span",{children:c.label})]}),Je("div",{className:"block-chrome-toolbar",children:[qe("span",{className:"block-chrome-action",onMouseDown:W,onClick:U(n),title:a("select_parent_section_tooltip"),children:qe(B,{icon:Ki})}),qe("span",{className:za("block-chrome-action",!i&&"block-chrome-action-disabled"),onMouseDown:W,onClick:j(e.id,-1),title:a("context_move_up"),children:qe(B,{icon:K})}),qe("span",{className:za("block-chrome-action",!s&&"block-chrome-action-disabled"),onMouseDown:W,onClick:j(e.id,1),title:a("context_move_down"),children:qe(B,{icon:V})}),qe("span",{className:"block-chrome-divider","aria-hidden":!0}),qe("span",{className:"block-chrome-action",onMouseDown:W,onClick:X(e.id),title:a("context_duplicate"),children:qe(B,{icon:G})}),qe("span",{className:"block-chrome-divider","aria-hidden":!0}),qe("span",{className:"block-chrome-action block-chrome-action-danger",onMouseDown:W,onClick:E(n,o,l),title:a("layer_delete"),children:qe(B,{icon:J})}),qe("span",{className:"block-chrome-action block-chrome-drag",draggable:"true",onMouseDown:e=>e.stopPropagation(),onDragEnd:F,onDragStart:z(e),title:a("drag_to_move")||"Drag to move",children:qe(B,{icon:Y})})]})]})})(),qe(Li,{blockItem:e,id:e.id})]})})]},`${n}:${o}:${e.id||l}`),ie=Vi(a,t),re="column"===m?.data?.key&&Mi(m.data)===Ui?a("block_palette_columns"):a("container");return qe(Ye,{children:Je("div",{className:za("relative block-drag-label-content",y&&"column"===R&&"ee-section-drop-preview"),"data-index":o,"data-position":"top",children:[y&&"column"===R?Je("div",{className:"ee-section-drop-slot-outline","aria-hidden":!0,children:[qe("span",{className:"ee-section-drop-badge",children:re}),qe("span",{className:"ee-section-drop-hint",children:a("drag_section_here")})]}):null,qe("div",{className:"absolute block-move-top",children:qe("span",{className:"block-tools-drag_here",children:a("drag_block_here")})}),Je("div",{className:za("relative block",m?.id===t.id&&"block-focus","mobile"===i&&"mobile-block-focus",t.hidden&&"block-hidden-dim","mobile"===i&&t.hiddenOnMobile&&"block-hidden-on-mobile"),"data-block-id":t.id,onClick:D(t),children:["mobile"===i&&t.hiddenOnMobile&&Je("div",{className:"block-hidden-on-mobile-badge","aria-label":a("canvas_hidden_on_mobile")||"Hidden on mobile",children:[qe(B,{icon:H,style:{fontSize:10}}),qe("span",{children:a("canvas_hidden_on_mobile")||"Hidden on mobile"})]}),Je("div",{className:"hover-visible",children:[oe(t.id),Je("div",{className:"block-chrome-overlay",children:[Je("span",{className:"block-chrome-badge",children:[qe(B,{icon:ie.icon}),qe("span",{children:ie.label})]}),Je("div",{className:"block-chrome-toolbar",children:[qe("span",{className:za("block-chrome-action",o<=0&&"block-chrome-action-disabled"),onMouseDown:W,onClick:j(t.id,-1),title:a("context_move_up"),children:qe(B,{icon:K})}),qe("span",{className:za("block-chrome-action",o>=c.length-1&&"block-chrome-action-disabled"),onMouseDown:W,onClick:j(t.id,1),title:a("context_move_down"),children:qe(B,{icon:V})}),qe("span",{className:"block-chrome-divider","aria-hidden":!0}),qe("span",{className:"block-chrome-action",onMouseDown:W,onClick:X(t.id),title:a("context_duplicate"),children:qe(B,{icon:G})}),"function"==typeof v&&qe("span",{className:"block-chrome-action",onMouseDown:W,onClick:(se=t,e=>{W(e),window.dispatchEvent(new CustomEvent("ee:canvas-save-universal",{detail:{block:se}}))}),title:a("save_as_universal"),children:qe(B,{icon:q})}),qe("span",{className:"block-chrome-divider","aria-hidden":!0}),qe("span",{className:"block-chrome-action block-chrome-action-danger",onMouseDown:W,onClick:e=>{e.preventDefault(),e.stopPropagation();const n=en(r,t.id),o=c.filter(e=>e!==t.id);p(n,o,"delete"),g(null)},title:a("layer_delete"),children:qe(B,{icon:J})}),qe("span",{className:"block-chrome-action block-chrome-drag",draggable:"true",onMouseDown:e=>e.stopPropagation(),onDragEnd:F,onDragStart:()=>{h(!0),g({id:t.id,data:t,type:"move"}),k("move")},title:a("drag_to_move")||"Drag to move",children:qe(B,{icon:Y})})]})]})]}),qe("div",{className:"width-full height-full absolute",onDragOver:O,style:{pointerEvents:y&&"column"===R?"auto":"none"},children:y&&"column"===R&&Je(Ye,{children:[qe("div",{className:"block-move-content-top","data-name":"dragTools","data-type":"drag-over-column","data-position":"top","data-index":o}),qe("div",{className:"block-move-content-bottom","data-name":"dragTools","data-type":"drag-over-column","data-position":"bottom","data-index":o+1})]})}),qe("div",{className:"column margin-auto",style:{...A,width:"100%",maxWidth:"100%",overflow:A.borderRadius?"hidden":void 0},children:qe("div",{className:"block-content",style:{...sl($,T),...I,borderRadius:A.borderRadius,overflow:A.borderRadius?"hidden":void 0,width:te,maxWidth:ne,...null!=A.minHeight&&""!==A.minHeight&&""!==String(A.minHeight).trim()?{minHeight:A.minHeight}:{}},"data-index":o,children:t.children.map((e,n)=>{const l="desktop"===i?e.styles?.desktop??{}:{...e.styles?.desktop??{},...e.styles?.mobile??{}};return qe(s,{children:qe("div",{id:`block-content-${o}-${n}`,style:{...l,width:"mobile"===i&&!1!==b.stackColumnsOnMobile?"100%":e.width},children:"footer"===t.containerType&&t.footerUnifiedLayout&&0===n?qe("div",{className:"ee-smart-footer-column-body width-full",children:qe(ji,{column:t,canvasFooterSegment:t.footerSelectedSegment,isFooterColumnSelected:m?.id===t.id,onFooterCanvasSegmentSelect:(e,n)=>{n?.preventDefault?.(),n?.stopPropagation?.();const o=r[t.id];if(!o||"column"!==o.key)return;const l={...o,footerSelectedSegment:e};p({...r,[t.id]:l},c,`edit_${Date.now()}`),g({id:t.id,data:l,type:"edit"}),k("edit")}})},`${t.id}:${n}:footer-unified`):e.children.map((o,l)=>{const i=`${t.id}:${n}:${l}`,r=`${t.id}:${n}:${l+1}`,c=l===e.children.length-1&&"empty"!==o.key&&"column"!==o.key;return Je(s,{children:[ae(o,t.id,n,l,i,r,0),c&&qe("div",{className:"relative block-content-drag-label-content","data-drop-key":r,children:qe("div",{className:"absolute block-move-bottom",children:qe("span",{className:"block-tools-drag_here",children:a("drag_block_here")})})})]},`${t.id}:${n}:${o.id||l}`)})})},`${t.id}:${e.id||"content"}:${n}`)})})})]})]})});var se};function Yi(e){return{id:Nt(),name:e("drag_block_here"),key:"empty",width:"100%",styles:{desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0},mobile:{}}}}function Xi(e,t){return{id:Nt(),name:e("content"),key:"content",width:t,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[Yi(e)]}}function Zi(e,{layoutRole:t,columnLayoutOnly:n,name:o}){const l=n?[Xi(e,"50%"),Xi(e,"50%")]:[Xi(e,"100%")];return{id:Nt(),name:o,key:"column",type:n?"1-1":"full",containerType:"none",layoutRole:t,columnLayoutOnly:n,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},children:l}}const Qi=e=>[Zi(e,{layoutRole:Di,columnLayoutOnly:!1,name:e("block_palette_section")}),Zi(e,{layoutRole:Ui,columnLayoutOnly:!0,name:e("block_palette_columns")}),{id:Nt(),name:e("text"),key:"text",text:e("text_content"),type:"p",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",color:void 0,lineHeight:"20px",paddingTop:16,paddingBottom:16,paddingLeft:16,paddingRight:16,textAlign:"left"},mobile:{}}},{id:Nt(),name:e("button"),key:"button",text:e("button"),type:"link",linkURL:"",contentStyles:{desktop:{textAlign:"center",paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0},mobile:{}},styles:{desktop:{width:"auto",fontSize:12,lineHeight:"140%",borderRadius:4,fontFamily:"sans-serif",paddingTop:10,paddingBottom:10,paddingLeft:20,paddingRight:20,backgroundColor:void 0,color:"#fff",display:"inline-block"},mobile:{}}},{id:Nt(),name:e("spacer"),key:"spacer",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0},mobile:{}},styles:{desktop:{height:16,width:"100%",display:"block"},mobile:{}}},{id:Nt(),name:e("divider"),key:"divider",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"100%",borderTopStyle:"solid",borderTopColor:"#ccc",borderTopWidth:1,display:"inline-block",verticalAlign:"middle"},mobile:{}}},{id:Nt(),name:e("raw_html"),key:"raw_html",html:e("raw_html_default_content"),contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center",width:"100%"},mobile:{}},styles:{desktop:{},mobile:{}}},{id:Nt(),name:e("image"),key:"image",src:"",alt:"Image",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{id:Nt(),name:e("video"),key:"video",videoUrl:"",thumbnailUrl:"",styles:{desktop:{width:"auto",height:"auto",fillColumn:!1,fillColumnMobile:!1,display:"inline-block"},mobile:{}},videoArea:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,backgroundColor:"transparent",borderWidth:0,borderStyle:"solid",borderColor:"#cccccc",borderRadius:0},mobile:{}},contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center",backgroundColor:"transparent"},mobile:{}}},{id:Nt(),name:e("menu"),key:"menu",layoutMode:"nav-only",showLogo:!1,mobileLayout:"stack",linkGapPx:0,linkUnderline:!1,list:[{label:"Page",url:"",target:"_self"},{label:"Page",url:"",target:"_self"}],separator:" | ",contentStyles:{desktop:{paddingTop:16,paddingBottom:16,paddingLeft:16,paddingRight:16,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:14,fontFamily:"sans-serif",color:"#333333",linkColor:"#2faade",letterSpacing:0,fontWeight:"400",textTransform:"none"},mobile:{}}},{id:Nt(),name:e("table")||"Table",key:"table",rows:3,cols:3,structureMode:"static",headerRow:!0,headerCol:!1,stripedRows:!1,cells:{},contentStyles:{desktop:{paddingTop:8,paddingBottom:8,paddingLeft:0,paddingRight:0,textAlign:"left"},mobile:{}},styles:{desktop:{fontSize:14,color:"#333333",borderStyle:"solid",borderWidth:1,borderColor:"#e0e0e0",cellPadding:8,textAlign:"left",headerBg:"#f5f5f5",headerColor:"#333333",stripedRows:!1,stripedBg:"#fafafa"},mobile:{}}},{id:Nt(),name:e("social_link"),key:"social_link",list:[],imageWidth:32,iconSize:"medium",iconColor:"gray",contentStyles:{desktop:{paddingTop:16,paddingBottom:16,paddingLeft:16,paddingRight:16,textAlign:"center"},mobile:{}},styles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0},mobile:{}}}];const er="ee-block-context-menu";function tr(e,t,n){return{label:e,onSelect:t,disabled:n}}const nr=()=>{const{t:e}=ja(),{blockMap:t,rootOrder:l,setBlocks:i,setCurrentItem:s,onSaveBlockAsGlobal:c}=n(Ln),[d,u]=a(null),p=o(()=>u(null),[]);r(()=>{const e=e=>{const n=e.target.closest?.(".email-editor");if(!n)return;const o=e.target.closest?.("[data-block-id]");if(!o||!n.contains(o))return;const l=o.getAttribute("data-block-id");l&&t[l]&&(e.preventDefault(),e.stopPropagation(),u({x:e.clientX,y:e.clientY,blockId:l}))},n=e=>{e.target.closest?.(`.${er}`)||u(null)};return document.addEventListener("contextmenu",e,!0),document.addEventListener("click",n,!0),document.addEventListener("scroll",n,!0),()=>{document.removeEventListener("contextmenu",e,!0),document.removeEventListener("click",n,!0),document.removeEventListener("scroll",n,!0)}},[t]);const m=o((e,n)=>{const o=Qt(t,l,e,n);o&&(i(o.nextMap,o.nextRootOrder,"move"),p())},[t,l,i,p]),h=o(e=>Boolean(Qt(t,l,e,-1)),[t,l]),y=o(e=>Boolean(Qt(t,l,e,1)),[t,l]),b=o(n=>{const o=t[n];if(!o)return[];const a=()=>{const e=Bi(t,l,n);e&&(Ti.tree=e)};return[tr(e("context_duplicate"),()=>{const e=Ai(t,l,n);e&&(i(e.nextMap,e.nextRootOrder,"add"),s({id:e.newId,data:e.selectionData,type:"edit"}),p())},!1),tr(e("context_copy"),()=>{a(),p()},!1),tr(e("context_cut"),()=>{a();const r=()=>{const o=Ri(t,l,n,e);o&&(i(o.nextMap,o.nextRootOrder,"delete"),s(null),p())};if("column"===o.key&&Pi(t,n))return p(),void g.confirm({title:e("shortcut_delete_confirm_title"),content:e("shortcut_delete_confirm_desc"),okText:e("confirm"),cancelText:e("cancel"),wrapClassName:"ee-modal-dark",onOk:r});r()},!1),tr(e("context_paste"),()=>{if(!Ti.tree)return;const e=$i(t,l,Ti.tree,n);e&&(i(e.nextMap,e.nextRootOrder,"add"),s({id:e.newId,data:e.selectionData,type:"edit"}),p())},!Ti.tree),tr(e("context_delete"),()=>{const a=()=>{const o=Ri(t,l,n,e);o&&(i(o.nextMap,o.nextRootOrder,"delete"),s(null),p())};if("column"===o.key&&Pi(t,n))return p(),void g.confirm({title:e("shortcut_delete_confirm_title"),content:e("shortcut_delete_confirm_desc"),okText:e("confirm"),cancelText:e("cancel"),wrapClassName:"ee-modal-dark",onOk:a});a()},!1),tr(e("context_move_up"),()=>m(n,-1),!h(n)),tr(e("context_move_down"),()=>m(n,1),!y(n)),tr(e("context_save_global"),()=>{"function"==typeof c&&c(n),p()},"function"!=typeof c),tr(e("context_reset_styles"),()=>{const o=function(e,t,n){const o=e[t];if(!o||!o.key)return null;const l=Qi(n).find(e=>e.key===o.key);if(!l)return null;const a={...o};return null!=l.styles&&(a.styles=xt(l.styles)),null!=l.contentStyles&&(a.contentStyles=xt(l.contentStyles)),{...e,[t]:a}}(t,n,e);if(!o)return;i(o,l,`edit_${Date.now()}`);const a=o[n];a&&s({id:n,data:"column"===a.key?Kt(n,o):a,type:"edit"}),p()},"empty"===o.key||!Qi(e).some(e=>e.key===o.key))]},[t,l,i,s,e,p,h,y,m,c]);if(!d)return null;const f=b(d.blockId),_="undefined"!=typeof window?window.innerWidth:9999,k="undefined"!=typeof window?window.innerHeight:9999,v=Math.min(d.x,_-220-8),w=Math.min(d.y,k-360-8);return Xe(qe("div",{className:er,style:{position:"fixed",left:v,top:w,zIndex:10050,minWidth:220,background:"#1a1a1a",border:"1px solid rgba(255,255,255,0.12)",borderRadius:8,boxShadow:"0 12px 40px rgba(0,0,0,0.45)",padding:"6px 0"},role:"menu",onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:f.map(e=>qe("button",{type:"button",role:"menuitem",disabled:e.disabled,className:"ee-block-context-menu-item",style:{display:"block",width:"100%",textAlign:"left",padding:"8px 14px",border:"none",background:"transparent",color:e.disabled?"rgba(255,255,255,0.35)":"#f5f5f5",fontSize:13,cursor:e.disabled?"not-allowed":"pointer"},onMouseEnter:t=>{e.disabled||(t.currentTarget.style.background="rgba(255,255,255,0.08)")},onMouseLeave:e=>{e.currentTarget.style.background="transparent"},onClick:()=>{e.disabled||e.onSelect()},children:e.label},e.label))}),document.body)},or=e=>{const{clearStyles:t}=e,{t:o}=ja(),{previewMode:l,bodySettings:a,blockList:c,currentItem:d,blockMap:u,isDragStart:p,setSelectionRange:m}=n(Ln),g=i(null),h="undefined"!=typeof window?window.__eeDragItemData:null,y="undefined"!=typeof window?window.__eeDragSource:null,b=h?.key??(d?.id?u[d.id]?.key:null)??d?.data?.key,f="add"===d?.type||Boolean(h),_=c.length>0&&p&&"product-variables"!==y&&("column"===b||f);r(()=>{const e=St(()=>{try{const n=window.getSelection();if(!n||0===n.rangeCount)return;const o=n.getRangeAt(0),l=document.getElementById("preview");if(!(!!l&&(l.contains(o.commonAncestorContainer)||l===o.commonAncestorContainer)))return;const a=(e=>e?{startContainer:e.startContainer,startOffset:e.startOffset,endContainer:e.endContainer,endOffset:e.endOffset,collapsed:e.collapsed}:null)(o);if(e=g.current,t=a,e&&t&&e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset&&e.collapsed===t.collapsed)return;g.current=a,m(o.cloneRange())}catch(e){console.warn(e)}var e,t},100);return document.addEventListener("selectionchange",e),()=>{document.removeEventListener("selectionchange",e)}},[m]);const k=e=>{e.preventDefault()},v=Ft(a),w=Ot(a),x=a?.styles||{},S=null!=x.color&&""!==String(x.color).trim()?String(x.color).trim():Sn.styles?.color??"#171717",C={width:"desktop"===l?"100%":364,backgroundColor:x.backgroundColor,color:S,fontFamily:x.fontFamily},N={maxWidth:"100%",width:"100%",backgroundColor:"transparent",..."mobile"===l&&!1!==a.scaleFontOnMobile?{fontSize:16}:{}};return Je("div",{className:"preview-main",children:[qe(nr,{}),qe("div",{className:"default-scrollbar",id:"preview",children:qe("div",{className:"preview-content",style:C,children:qe("div",{className:"margin-auto",style:N,children:c.length?Je("div",{className:"preview-column-stack",children:[_&&Je("div",{className:za("block-drag-label-content preview-edge-drop-zone preview-edge-drop-zone-top","column"===b&&"ee-section-drop-preview"),"data-index":0,"data-position":"top",children:["column"===b?Je("div",{className:"ee-section-drop-slot-outline ee-section-drop-slot-outline-edge","aria-hidden":!0,children:[qe("span",{className:"ee-section-drop-badge",children:o("container")}),qe("span",{className:"ee-section-drop-hint",children:o("drag_section_here")})]}):null,qe("div",{className:"absolute block-move-top",children:qe("span",{className:"block-tools-drag_here",children:o("drag_block_here")})}),qe("div",{className:"preview-edge-drop-hit","data-name":"dragTools","data-type":"drag-over-column","data-position":"top","data-index":0,onDragOver:k})]}),c.map((e,n)=>qe(s,{children:qe(Ji,{block:e,blockIndex:n,clearStyles:t})},`${e?.id||"block"}-${n}`)),Je("div",{className:za("relative block-drag-label-content","ee-bottom-stack-drop-slot",p&&!_&&"ee-bottom-stack-drop-slot--active"),"data-index":c.length,"data-position":"bottom",style:{minHeight:p&&!_?52:0},children:[p&&!_?qe("div",{className:"ee-bottom-drop-slot-outline","aria-hidden":!0,children:qe("span",{className:"ee-bottom-drop-slot-label",children:o("drag_block_here")})}):null,qe("div",{className:"absolute block-move-bottom",children:qe("span",{className:"block-tools-drag_here",children:o("drag_block_here")})}),p&&!_&&qe("div",{"data-name":"dragTools","data-type":"drag-over-column","data-position":"bottom","data-index":c.length,onDragOver:k,style:{position:"absolute",inset:0,zIndex:106,pointerEvents:"auto"}})]}),_&&Je("div",{className:za("block-drag-label-content preview-edge-drop-zone preview-edge-drop-zone-bottom","column"===b&&"ee-section-drop-preview"),"data-index":c.length,"data-position":"bottom",children:["column"===b?Je("div",{className:"ee-section-drop-slot-outline ee-section-drop-slot-outline-edge","aria-hidden":!0,children:[qe("span",{className:"ee-section-drop-badge",children:o("container")}),qe("span",{className:"ee-section-drop-hint",children:o("drag_section_here")})]}):null,qe("div",{className:"absolute block-move-bottom",children:qe("span",{className:"block-tools-drag_here",children:o("drag_block_here")})}),qe("div",{className:"preview-edge-drop-hit","data-name":"dragTools","data-type":"drag-over-column","data-position":"bottom","data-index":c.length,onDragOver:k})]})]}):qe("div",{"data-name":"dragEmpty",className:"start-to-add ee-empty-document",style:{width:w?"100%":v,maxWidth:"100%"},"data-type":"empty-block",onDragOver:k,children:Je("div",{className:"ee-empty-document-inner",children:[Je("svg",{className:"ee-empty-document__icon",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,children:[qe("rect",{x:"6",y:"22",width:"14",height:"14",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),qe("rect",{x:"24",y:"22",width:"14",height:"14",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),qe("rect",{x:"6",y:"6",width:"14",height:"14",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),qe("rect",{x:"28",y:"4",width:"14",height:"14",rx:"2",stroke:"currentColor",strokeWidth:"1.5"})]}),qe("p",{className:"ee-empty-document__title",children:o("drop_content_here")}),qe("p",{className:"ee-empty-document__hint",children:o("drop_content_hint")})]})})})})})]})},lr=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i,ar=/^rgba?\(\s*(\d{1,3})\s*[, ]\s*(\d{1,3})\s*[, ]\s*(\d{1,3})(?:\s*[,/]\s*([0-9.]+))?\s*\)$/i,ir=e=>(e=>Math.max(0,Math.min(255,Number.isFinite(e)?Math.round(e):0)))(e).toString(16).padStart(2,"0"),rr=(e,t="#000000")=>{const n=String(e??"").trim();if(!n)return t;if("transparent"===n.toLowerCase())return t;if(/^[0-9a-f]{3}$/i.test(n)){return`#${n.toLowerCase().split("").map(e=>e+e).join("")}`}if(/^[0-9a-f]{6}$/i.test(n))return`#${n.toLowerCase()}`;if(lr.test(n)){if(4===n.length){const[,e,t,o]=n;return`#${e}${e}${t}${t}${o}${o}`.toLowerCase()}return n.toLowerCase()}const o=n.match(ar);if(o){const e=Number(o[1]),t=Number(o[2]),n=Number(o[3]);return`#${ir(e)}${ir(t)}${ir(n)}`.toLowerCase()}const l=(e=>{if("undefined"==typeof document)return null;const t=document.createElement("span");if(t.style.color="",t.style.color=String(e??"").trim(),!t.style.color)return null;const n=t.style.color.match(ar);if(!n)return null;const o=Number(n[1]),l=Number(n[2]),a=Number(n[3]);return`#${ir(o)}${ir(l)}${ir(a)}`.toLowerCase()})(n);return l||t},sr={backgroundImage:"linear-gradient(45deg, #1f1f1f 25%, transparent 25%), linear-gradient(-45deg, #1f1f1f 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #1f1f1f 75%), linear-gradient(-45deg, transparent 75%, #1f1f1f 75%)",backgroundSize:"8px 8px",backgroundPosition:"0 0, 0 4px, 4px -4px, -4px 0px"},cr=({color:e,setColor:t,fallbackColor:n="#ffffff",variant:o="field"})=>{const[l,i]=a(!1),r=rr(e,n),s=r;return qe(f,{zIndex:1070,getPopupContainer:()=>document.querySelector(".right-settings")||document.body,content:qe("div",{className:"select-none ee-color-picker-popover",children:qe(Ze,{disableAlpha:!0,color:r,style:{boxShadow:"none"},onChange:e=>t({hex:rr(e?.hex,n)})})}),trigger:"click",open:l,onOpenChange:i,children:"field"===o?Je("button",{type:"button",className:"ee-color-picker-field-trigger","aria-label":"Open color picker",children:[qe("span",{className:"ee-color-picker-field-swatch",style:{background:"transparent"===s?void 0:s,..."transparent"===s?sr:{}}}),qe("span",{className:"ee-color-picker-field-hex","aria-hidden":!0,children:r.toUpperCase()}),qe("span",{className:"ee-color-picker-field-chevron","aria-hidden":!0})]}):qe("button",{type:"button",className:"color-picker-button","aria-label":"Open color picker",style:{background:s,backgroundImage:"transparent"===s?sr.backgroundImage:void 0,backgroundSize:"transparent"===s?sr.backgroundSize:void 0,backgroundPosition:"transparent"===s?sr.backgroundPosition:void 0}})})},dr=[{key:"paddingTop",suffix:"T"},{key:"paddingRight",suffix:"R"},{key:"paddingBottom",suffix:"B"},{key:"paddingLeft",suffix:"L"}],ur=({padding:e,onChange:t,min:n=0,disabled:o})=>{const{t:l}=ja(),a=n=>o=>{const l="number"==typeof o?o:null==o||""===o?0:Number(o);Number.isNaN(l)||t({...e,[n]:l})};return qe("div",{className:"ee-settings-padding-grid",role:"group","aria-label":l("padding_settings"),children:dr.map(({key:t,suffix:l})=>qe(k,{min:n,step:1,value:e?.[t]??0,onChange:a(t),disabled:o,addonAfter:qe("span",{className:"ee-settings-padding-addon-side","aria-hidden":!0,children:l}),className:"input-width ee-settings-input-affix ee-padding-side-input-num",onFocus:e=>e?.target?.select?.()},t))})},pr=e=>qe(b,{...e,className:`ee-settings-switch ${e.className||""}`.trim()}),mr=({padding:e,setPadding:t,showLinkSides:n=!0})=>{const{t:o}=ja(),[l,i]=a(!1);return n?Je("div",{className:"padding-settings ee-padding-settings-v2",children:[l?qe(k,{min:0,step:1,addonAfter:"px",className:"input-width ee-settings-input-affix ee-padding-linked-input-num",value:e?.paddingTop??0,onChange:n=>{const o="number"==typeof n?n:0;t({...e,paddingTop:o,paddingRight:o,paddingBottom:o,paddingLeft:o})},onFocus:e=>e?.target?.select?.()}):qe(ur,{padding:e,onChange:t,min:0}),Je("div",{className:"ee-settings-row ee-padding-link-sides-row padding-settings-link-row",children:[Je("span",{className:"ee-padding-link-sides-label",children:[o("padding_link_sides_label"),qe(v,{title:o("padding_link_sides_tooltip"),children:qe("span",{className:"ee-help-icon ee-padding-link-sides-help","aria-label":o("padding_link_sides_tooltip"),children:qe(B,{icon:A})})})]}),qe(pr,{checked:l,onChange:i})]})]}):qe("div",{className:"padding-settings ee-padding-settings-v2 ee-padding-settings-plain",children:qe(ur,{padding:e,onChange:t,min:0})})};function gr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var hr,yr={exports:{}};hr=yr,function(){var e={}.hasOwnProperty;function t(){for(var e="",t=0;t<arguments.length;t++){var l=arguments[t];l&&(e=o(e,n(l)))}return e}function n(n){if("string"==typeof n||"number"==typeof n)return n;if("object"!=typeof n)return"";if(Array.isArray(n))return t.apply(null,n);if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]"))return n.toString();var l="";for(var a in n)e.call(n,a)&&n[a]&&(l=o(l,a));return l}function o(e,t){return t?e?e+" "+t:e+t:e}hr.exports?(t.default=t,hr.exports=t):window.classNames=t}();var br=gr(yr.exports);const fr=()=>{const{t:e}=ja(),t=Qi(e),n=(e=>{const t={desktop:{textAlign:"center",paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0},mobile:{}},n={key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},o=o=>({name:e("content"),key:"content",width:o,styles:n,children:[{name:e("drag_block_here"),key:"empty",width:"100%",styles:t}]});return{full:{columns:1,type:"full",children:[{name:e("content"),key:"content",width:"100%",styles:n,children:[{name:e("drag_block_here"),key:"empty",width:"100%",styles:t}]}]},"1-1":{columns:2,type:"1-1",children:Array.from({length:2}).map(()=>({name:e("content"),key:"content",width:"50%",styles:n,children:[{name:e("drag_block_here"),key:"empty",width:"100%",styles:t}]}))},"1-1-1":{columns:3,type:"1-1-1",children:Array.from({length:3}).map(()=>({name:e("content"),key:"content",width:"33.3%",styles:n,children:[{name:e("drag_block_here"),key:"empty",width:"100%",styles:t}]}))},"1-2-1":{columns:3,type:"1-2-1",children:Array.from({length:3}).map((e,t)=>o(1===t?"50%":"25%"))},"2-1-1":{columns:3,type:"2-1-1",children:Array.from({length:3}).map((e,t)=>o(0===t?"50%":"25%"))},"1-1-2":{columns:3,type:"1-1-2",children:Array.from({length:3}).map((e,t)=>o(2===t?"50%":"25%"))},"1-1-1-1":{columns:4,type:"1-1-1-1",children:Array.from({length:4}).map(()=>({name:e("content"),key:"content",width:"25%",styles:n,children:[{name:e("drag_block_here"),key:"empty",width:"100%",styles:t}]}))},"1-2":{columns:2,type:"1-2",children:Array.from({length:2}).map((e,t)=>o(0===t?"33.3%":"66.6%"))},"2-1":{columns:2,type:"2-1",children:Array.from({length:2}).map((e,t)=>o(0===t?"66.6%":"33.3%"))},"1-3":{columns:2,type:"1-3",children:Array.from({length:2}).map((e,t)=>o(0===t?"25%":"75%"))},"3-1":{columns:2,type:"3-1",children:Array.from({length:2}).map((e,t)=>o(0===t?"75%":"25%"))},"2-3":{columns:2,type:"2-3",children:Array.from({length:2}).map((e,t)=>o(0===t?"40%":"60%"))},"3-2":{columns:2,type:"3-2",children:Array.from({length:2}).map((e,t)=>o(0===t?"60%":"40%"))},"2-4-2-4":{columns:4,type:"2-4-2-4",children:Array.from({length:4}).map((o,l)=>({name:e("content"),key:"content",width:l%2==0?"16.6%":"33.3%",styles:n,children:[{name:e("drag_block_here"),key:"empty",width:"100%",styles:t}]}))},"4-2-4-2":{columns:4,type:"4-2-4-2",children:Array.from({length:4}).map((o,l)=>({name:e("content"),key:"content",width:l%2==0?"33.3%":"16.6%",styles:n,children:[{name:e("drag_block_here"),key:"empty",width:"100%",styles:t}]}))}}})(e),o=(e=>t=>{const n={id:Nt(),name:e("drag_block_here"),key:"empty",width:"100%",styles:{desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0},mobile:{}}};return{id:Nt(),name:e("container"),key:"column",type:"full",containerType:"none",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},children:[{id:Nt(),name:e("content"),key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[t||n]}]}})(e);return{blockConfigsList:t,columnsSetting:n,getColumnConfig:o}},_r=({children:e,className:t=""})=>qe("h3",{className:`ee-settings-section-title ${t}`.trim(),children:e}),kr=e=>e?qe("span",{style:{color:"var(--ee-text-tertiary)",fontWeight:400,fontSize:11,marginLeft:6},children:"optional"}):null,vr=({label:e,hint:t,optional:n,children:o,className:l="",layout:a="stack"})=>Je("div",{className:`ee-settings-field ${"toggle"===a?"ee-settings-field--toggle":""} ${l}`.trim(),children:["toggle"===a&&e?Je("div",{className:"ee-settings-row ee-settings-field-toggle-inner",children:[Je("span",{className:"ee-settings-row-label",children:[e,kr(n)]}),o]}):Je(Ye,{children:[e?Je("div",{className:"ee-settings-field-label",children:[e,kr(n)]}):null,o]}),t?qe("div",{style:{fontSize:11,color:"var(--ee-text-tertiary)",lineHeight:1.5},children:t}):null]}),wr=({widths:e})=>{const t=e.reduce((e,t)=>e+parseFloat(t),0)||1;return qe("div",{style:{display:"flex",height:18,gap:2,borderRadius:2,overflow:"hidden",width:36,flexShrink:0},children:e.map((e,n)=>qe("div",{style:{flex:parseFloat(e)/t,background:"rgba(216, 254, 145, 0.5)",borderRadius:1}},n))})},xr=[{key:"full",labelKey:"column_preset_1_col",widths:["100%"]},{key:"1-1",labelKey:"column_preset_equal_2",widths:["50%","50%"]},{key:"1-1-1",labelKey:"column_preset_equal_3",widths:["33.3%","33.3%","33.3%"]},{key:"1-1-1-1",labelKey:"column_preset_equal_4",widths:["25%","25%","25%","25%"]},{key:"1-2",labelKey:"column_preset_1_2",widths:["33.3%","66.6%"]},{key:"2-1",labelKey:"column_preset_2_1",widths:["66.6%","33.3%"]},{key:"1-3",labelKey:"column_preset_1_3",widths:["25%","75%"]},{key:"3-1",labelKey:"column_preset_3_1",widths:["75%","25%"]},{key:"2-3",labelKey:"column_preset_2_3",widths:["40%","60%"]},{key:"3-2",labelKey:"column_preset_3_2",widths:["60%","40%"]},{key:"1-2-1",labelKey:"column_preset_1_2_1",widths:["25%","50%","25%"]},{key:"2-1-1",labelKey:"column_preset_2_1_1",widths:["50%","25%","25%"]},{key:"1-1-2",labelKey:"column_preset_1_1_2",widths:["25%","25%","50%"]},{key:"2-4-2-4",labelKey:"column_preset_2_4_2_4",widths:["16.6%","33.3%","16.6%","33.3%"]},{key:"4-2-4-2",labelKey:"column_preset_4_2_4_2",widths:["33.3%","16.6%","33.3%","16.6%"]}],Sr=()=>{const{blockMap:e,rootOrder:t,setBlocks:o,currentItem:l,setCurrentItem:a,previewMode:i}=n(Ln),{t:r}=ja(),{columnsSetting:s}=fr();if(!l?.data||"column"!==l.data.key)return null;if(Mi(l.data)!==Ui)return null;const c=l.data.children||[],d=c.length,u=n=>{const{blockMap:i}=jt([n]),r={...e,...i};o(r,t,`edit_${Date.now()}`),a({...l,data:n})},p=e=>{const t=s[e.key]||s.full;if(!t)return;const n=l.data.children||[],o=(t.children||[]).map((e,t)=>{const o=n[t];if(o)return{...o,key:e.key,name:e.name,width:e.width,styles:xt(e.styles??o.styles),children:o.children};const l=Nt();return{...e,id:l}}),a=xt(l.data);a.children=o,u(a)},m=(()=>{const e="desktop"===i?l.data.styles?.desktop:{...l.data.styles?.desktop,...l.data.styles?.mobile},t=e?.columnGap??e?.column_gap??0;return"number"==typeof t?t:parseInt(String(t).replace("px",""),10)||0})(),g=c.reduce((e,t)=>e+parseFloat(t.width||"100"),0)||1,h=xr.filter(e=>s[e.key]);return Je(Ye,{children:[qe(_r,{children:r("grid_settings")}),Je("div",{className:"ee-settings-row ee-columns-count-row",children:[qe("span",{className:"ee-padding-link-sides-label",children:r("columns")}),Je("div",{className:"ee-columns-stepper",children:[qe("button",{type:"button",className:"ee-col-stepper-btn",disabled:d<=1,onClick:()=>{const e=Math.max(1,d-1),t=xr.find(t=>t.widths.length===e);t&&p(t)},"aria-label":r("columns"),children:qe(B,{icon:ue,style:{fontSize:10}})}),qe("span",{className:"ee-columns-stepper-value",children:d}),qe("button",{type:"button",className:"ee-col-stepper-btn",disabled:d>=4,onClick:()=>{const e=Math.min(4,d+1),t=xr.find(t=>t.widths.length===e&&t.key.startsWith("1-1"));if(t)p(t);else{const t=xr.find(t=>t.widths.length===e);t&&p(t)}},"aria-label":r("columns"),children:qe(B,{icon:pe,style:{fontSize:10}})})]})]}),qe(_r,{children:r("presets")}),qe("div",{className:"ee-columns-preset-grid",children:h.map(e=>{const t=d===e.widths.length&&c.every((t,n)=>{const o=parseFloat(t.width||"0"),l=parseFloat(e.widths[n]||"0");return Math.abs(o-l)<1});return Je("button",{type:"button",className:br("ee-columns-preset-btn",t&&"ee-columns-preset-btn--active"),onClick:()=>p(e),children:[qe(wr,{widths:e.widths}),qe("span",{children:r(e.labelKey)})]},e.key)})}),d>1&&Je(Ye,{children:[qe(_r,{children:r("column_sizes")}),qe("div",{className:"ee-columns-width-sliders",children:c.map((e,t)=>{const n=(e=>{if("string"!=typeof e)return 1;const t=parseFloat(e.replace("%",""));return isNaN(t)?1:t})(e.width)/g*100;return Je("div",{className:"ee-columns-width-slider-row",children:[Je("span",{className:"ee-columns-width-col-label",children:[r("col")," ",t+1]}),qe("input",{type:"range",min:10,max:90,step:1,value:Math.round(n),onChange:e=>{const n=parseInt(e.target.value,10),o=t===d-1?0:d-1,a=100-n-c.reduce((e,n,l)=>l===t||l===o?e:e+Math.round(parseFloat(n.width||"0")/g*100),0),i=xt(l.data);i.children=i.children.map((e,l)=>l===t?{...e,width:`${n}%`}:l===o?{...e,width:`${Math.max(10,a)}%`}:e),u(i)},className:"ee-columns-width-range"}),Je("span",{className:"ee-columns-width-pct",children:[Math.round(n),"%"]})]},e.id||t)})})]}),qe(_r,{children:r("gaps")}),qe(vr,{label:r("column_gap"),children:qe(k,{min:0,max:60,className:"input-width ee-settings-input-affix",addonAfter:"px",value:m,onChange:e=>(e=>{const t=xt(l.data);t.styles||(t.styles={desktop:{},mobile:{}}),t.styles[i]||(t.styles[i]={}),Object.assign(t.styles[i],e),u(t)})({columnGap:e??0})})})]})},Cr=({items:e,value:t,onChange:n,size:o="md",className:l="","aria-label":a})=>qe("div",{className:`ee-settings-segmented ${"sm"===o?"ee-settings-segmented--sm":""} ${l}`.trim(),role:"group","aria-label":a,children:e.map(e=>{const o="string"==typeof e?e:e.value,l="string"==typeof e?e:e.label,a="object"==typeof e&&e.icon?e.icon:null,i=o===t,r="object"==typeof e&&e.iconOnly;return Je("button",{type:"button",title:"string"==typeof l?l:void 0,className:`ee-settings-segmented-btn${i?" ee-settings-segmented-btn--active":""}${r?" ee-settings-segmented-btn--icon-only":""}`,onClick:()=>n&&n(o),children:[a,l]},String(o))})}),Nr=e=>{if(!e||"string"!=typeof e)return!1;try{const t=new URL(e);return/\/knowledge-base\/products$/i.test(t.pathname.replace(/\/$/,""))}catch{return/knowledge-base\/products\/?$/i.test(String(e).trim().replace(/\/$/,""))}},Lr=e=>{if(!e||"object"!=typeof e)return null;const t=null!=e.id?String(e.id):null!=e.resourceId?String(e.resourceId):"";if(!t)return null;const n=e.price,o="number"==typeof n?n:parseFloat(String(n??"").replace(/,/g,""));return{id:t,name:e.name??"",description:Mn(e.description),image:e.image_url??e.image??"",link:e.url??"",price:Number.isFinite(o)?o:0,currency:e.currency??"USD",old_price:null!=e.old_price?e.old_price:null,new_price:null!=e.new_price?e.new_price:null,resourceId:e.resourceId,source:e.source}},Tr=async(e,t,n={},{page:o=1,limit:l=20,search:a=""}={})=>{if(!e)return null;try{if(Nr(e)){if(!t)return null;const i=e.replace(/\/$/,""),r=new URL(`${i}/${encodeURIComponent(t)}`);r.searchParams.set("page",String(o)),r.searchParams.set("limit",String(l)),r.searchParams.set("search",a??"");const s=await fetch(r.toString(),{method:"GET",headers:{"Content-Type":"application/json",...n}});if(!s.ok)return console.error("[API Service] KB products fetch failed:",s.status,s.statusText),null;const c=await s.json(),d=Array.isArray(c.data)?c.data:[];return{products:d.map(Lr).filter(Boolean),meta:c.meta&&"object"==typeof c.meta?c.meta:{}}}const i=new URL(e);t&&i.searchParams.append("companyId",t);const r=await fetch(i.toString(),{method:"GET",headers:{"Content-Type":"application/json",...n}});if(!r.ok)return console.error("[API Service] Products fetch failed:",r.status,r.statusText),null;const s=await r.json();if(!1===s.success)return console.error("[API Service] Products API returned error:",s.error),null;const c=s.data?.products??[],d=Array.isArray(c)?c.map(e=>e&&"object"==typeof e?{...e,description:Mn(e.description)}:e):[];return Array.isArray(d)&&0!==d.length?{products:d,meta:{hasMore:!1,hasProducts:!0}}:{products:[],meta:{hasMore:!1,hasProducts:!1}}}catch(e){return console.error("[API Service] Error fetching products:",e),null}},Br={};function Ar(){return"undefined"!=typeof document?document.body:null}function Ir(e){if(!e)return"";const t=e.currency??"",n=e.price?.amount??e.price??"";return`${e.name} — ${t} ${n}`.trim()}function $r(e,t){const n=new Map;return[...e,...t].forEach(e=>{e&&e.id&&n.set(e.id,e)}),Array.from(n.values())}function Pr({apiConfig:e,templateData:t,value:n,selectedProduct:r,onChange:s,placeholder:c,staticProductList:d=[],getPopupContainer:u}){const{t:p}=ja(),m=e?.productsEndpoint,g=e?.companyId??t?.companyId,h=l(()=>{const t=e?.headers;return t&&"object"==typeof t?t:Br},[e?.headers]),y=Boolean(m&&g)&&Nr(m),[b,f]=a([]),[_,k]=a({}),[v,S]=a(!1),[C,N]=a(""),[L,T]=a(""),B=i(null),A=i(0),I=i(1),$=i(""),P=i(!1),R=i(""),M=o(async(e,t,n)=>{if(!y)return;const o=(t??"").trim();if(n){const t=`${o}::${e}`;if(P.current&&R.current===t)return;P.current=!0,R.current=t}const l=++A.current;S(!0);try{const a=await Tr(m,g,h,{page:e,limit:20,search:o});if(l!==A.current)return;if(!a)return n||(f([]),T((t??"").trim())),void k({});k(a.meta||{}),f(e=>n?$r(e,a.products):a.products),I.current=e}finally{n&&(P.current=!1,R.current=""),l===A.current&&S(!1)}},[y,m,g,h]),D=o(async e=>{if(!y)return;const t=(e??"").trim();P.current=!1,R.current="";const n=++A.current;S(!0);try{if(""!==t){const e=await Tr(m,g,h,{page:1,limit:20,search:t});if(n!==A.current)return;return e?(k(e.meta||{}),f(e.products),T(t),void(I.current=1)):(f([]),k({}),T(t),void(I.current=1))}let e=1,o=[],l={};for(;o.length<10&&e<=15;){const t=await Tr(m,g,h,{page:e,limit:20,search:""});if(n!==A.current)return;if(!t?.products?.length)break;if(o=$r(o,t.products),l=t.meta||{},I.current=e,!l.hasMore)break;e+=1}k(l),f(o),T("")}finally{n===A.current&&S(!1)}},[y,m,g,h]),U=o(()=>{if(!y||v||!_?.hasMore)return;const e=I.current+1;M(e,$.current,!0)},[y,v,_?.hasMore,M]),E=u??Ar,z=o(e=>Je("div",{children:[e,v&&b.length>0&&Je("div",{className:"ee-kb-product-select-footer",children:[qe(w,{size:"small"})," ",qe("span",{children:p("loading")})]}),!v&&_?.hasMore&&qe("div",{className:"ee-kb-product-select-footer",children:qe("button",{type:"button",className:"ee-kb-product-select-load-more",onClick:U,children:p("load_more_products")})})]}),[v,b.length,_?.hasMore,U,p]),F=l(()=>{const e=y?b:d;return $r(r?.id?[r]:[],e)},[y,b,d,r]),O=l(()=>F.map(e=>({value:e.id,label:Ir(e)})),[F]),W=e=>{if(!e)return s(null),void(y&&(clearTimeout(B.current),N(""),$.current="",I.current=1,T(""),D("")));const t=F.find(t=>t.id===e)||d.find(t=>t.id===e);s(t||null)},j="ee-kb-product-select-dropdown";return qe(x,y?{className:"ee-stack-control ee-kb-product-select",value:n??void 0,placeholder:c,style:{width:"100%"},virtual:!0,dropdownMatchSelectWidth:!0,listHeight:320,listItemHeight:32,dropdownClassName:j,getPopupContainer:E,onChange:W,allowClear:!0,showSearch:!0,filterOption:!1,searchValue:C,onSearch:e=>{if(!y)return;const t=e??"";N(t);const n=t.trim();if(clearTimeout(B.current),""===n)return $.current="",I.current=1,void D("");B.current=setTimeout(()=>{$.current=n,I.current=1,D(n)},400)},onOpenChange:e=>{clearTimeout(B.current),e?(P.current=!1,R.current="",N(""),$.current="",I.current=1,D("")):(P.current=!1,R.current="",N(""),$.current="")},notFoundContent:v?Je("span",{className:"ee-kb-product-select-loading",children:[qe(w,{size:"small"})," ",p("loading")]}):O.length>0?null:qe("span",{className:"ee-kb-product-select-empty",children:""!==L.trim()?p("no_products_matching_search"):p("no_product_found")}),options:O,dropdownRender:z}:{className:"ee-stack-control",value:n??void 0,placeholder:c,style:{width:"100%"},virtual:!0,dropdownMatchSelectWidth:!0,listHeight:320,listItemHeight:32,dropdownClassName:j,getPopupContainer:E,onChange:W,allowClear:!0,showSearch:!0,optionFilterProp:"label",options:d.map(e=>({value:e.id,label:Ir(e)}))})}const Rr=()=>{const{previewMode:e,currentItem:t,blockMap:o,rootOrder:l,setBlocks:a,setCurrentItem:i}=n(Ln),r=e=>{let n;if("column"===e.key){const{blockMap:t}=jt([e]);n={...o,...t}}else n={...o,[t.id]:e};a(n,l,`edit_${(new Date).getTime()}`),i({...t,data:e})};return{findStyleItem:(t,n)=>{if(!t)return;const o=t[e]?.[n];return null!=o&&""!==o?o:t.desktop?.[n]},cardItemElement:(e,t)=>Je("div",{className:"card-item",children:[qe("div",{className:"card-item-title",children:e}),qe("div",{children:t})]}),updateItemStyles:r,colorChange:n=>({hex:o})=>{const l=xt(t.data);l.styles[e][n]=o,r(l)},paddingChange:n=>{const o=xt(t.data);o.styles[e]={...o.styles[e],...n},r(o)},otherStylesChange:(n,o)=>{const l=xt(t.data);l.styles||(l.styles={desktop:{},mobile:{}}),l.styles[e]||(l.styles[e]={}),l.styles[e][n]=o,r(l)},inputChange:n=>o=>{const l=xt(t.data);l.styles||(l.styles={desktop:{},mobile:{}}),l.styles[e]||(l.styles[e]={}),l.styles[e][n]=o,r(l)}}};var Mr={presets:[{id:"preset_header",presetName:"Header",nameKey:"preset_header",containerType:"header",block:{name:"Container",key:"column",type:"full",containerType:"header",headerLayout:"logo_center_nav_below",showHeaderBanner:!1,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",headerLogoSlot:!0,src:"{{LogoUrl}}",alt:"Logo",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:16,paddingBottom:8,paddingLeft:24,paddingRight:24,textAlign:"center"},mobile:{}},styles:{desktop:{width:"30%"},mobile:{}}},{name:"Menu",key:"menu",useNavigationLinks:!0,list:[{label:"Link 1",url:"#",target:"_blank"},{label:"Link 2",url:"#",target:"_blank"},{label:"Link 3",url:"#",target:"_blank"}],separator:" | ",contentStyles:{desktop:{paddingTop:8,paddingBottom:16,paddingLeft:24,paddingRight:24,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:13,fontFamily:"sans-serif",color:"#525252",linkColor:"#525252",letterSpacing:.02,fontWeight:"500",textTransform:"uppercase"},mobile:{}},isPreset:!0},{name:"Image",key:"image",headerBannerSlot:!0,hidden:!0,src:"{{HeroBanner}}",alt:"",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Divider",key:"divider",headerBannerDividerSlot:!0,hidden:!0,contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"100%",borderTopStyle:"solid",borderTopColor:"#ccc",borderTopWidth:1,display:"inline-block",verticalAlign:"middle"},mobile:{}}}]}]}},{id:"preset_header_centered",presetName:"Header (Centered)",nameKey:"preset_header_centered",containerType:"header",block:{name:"Container",key:"column",type:"full",containerType:"header",headerLayout:"logo_center_nav_below",showHeaderBanner:!1,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",headerLogoSlot:!0,src:"{{LogoUrl}}",alt:"Logo",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:16,paddingBottom:8,paddingLeft:24,paddingRight:24,textAlign:"center"},mobile:{}},styles:{desktop:{width:"30%"},mobile:{}}},{name:"Menu",key:"menu",useNavigationLinks:!0,list:[{label:"Link 1",url:"#",target:"_blank"},{label:"Link 2",url:"#",target:"_blank"},{label:"Link 3",url:"#",target:"_blank"}],separator:" | ",contentStyles:{desktop:{paddingTop:8,paddingBottom:16,paddingLeft:24,paddingRight:24,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:13,fontFamily:"sans-serif",color:"#525252",linkColor:"#525252",letterSpacing:.02,fontWeight:"500",textTransform:"uppercase"},mobile:{}},isPreset:!0},{name:"Image",key:"image",headerBannerSlot:!0,hidden:!0,src:"{{HeroBanner}}",alt:"",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Divider",key:"divider",headerBannerDividerSlot:!0,hidden:!0,contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"100%",borderTopStyle:"solid",borderTopColor:"#ccc",borderTopWidth:1,display:"inline-block",verticalAlign:"middle"},mobile:{}}}]}]}},{id:"preset_header_nav_only",presetName:"Nav Bar",nameKey:"preset_header_nav_only",containerType:"header",block:{name:"Container",key:"column",type:"full",containerType:"header",headerLayout:"nav_only",showHeaderBanner:!1,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Menu",key:"menu",useNavigationLinks:!0,list:[{label:"Link 1",url:"#",target:"_blank"},{label:"Link 2",url:"#",target:"_blank"},{label:"Link 3",url:"#",target:"_blank"}],separator:" | ",contentStyles:{desktop:{paddingTop:16,paddingBottom:16,paddingLeft:24,paddingRight:24,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:13,fontFamily:"sans-serif",color:"#525252",linkColor:"#525252",letterSpacing:.02,fontWeight:"500",textTransform:"uppercase"},mobile:{}},isPreset:!0}]}]}},{id:"navigation_bar",presetName:"Navigation Bar",nameKey:"preset_navigation_bar",containerType:"none",block:{name:"Menu",key:"menu",useNavigationLinks:!0,list:[{label:"Link 1",url:"#",target:"_blank"},{label:"Link 2",url:"#",target:"_blank"},{label:"Link 3",url:"#",target:"_blank"}],separator:" | ",contentStyles:{desktop:{paddingTop:25,paddingBottom:15,paddingLeft:5,paddingRight:5,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:14,fontFamily:"Verdana",color:"#333333",linkColor:"#333333",paddingTop:5,paddingBottom:5,paddingLeft:8,paddingRight:8,letterSpacing:0,fontWeight:"normal"},mobile:{}},isPreset:!0}},{id:"product_single",nameKey:"preset_product_single",containerType:"product",presetName:"Product",block:{name:"Container",key:"column",type:"full",containerType:"product",mainProductLayout:"image_stacked",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:null,paddingRight:null,paddingBottom:null,contentBackground:"#fff"},mobile:{}},isPreset:!0,productRole:"main",columnProducts:[{id:"product-1",name:"Abundance Butterfly Diamond Ring",description:"The Maia Diamond Ring features round diamonds set along a delicate gold band, creating a refined and minimalistic look. Its versatile design makes it perfect for everyday wear or for layering with other rings.",image:"https://www.psylish.com/cdn/shop/files/IMG_4632.jpg?v=1773123202&width=1220",link:"https://www.psylish.com",price:2e3,currency:"USD",old_price:null,new_price:null}],children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:null,paddingRight:null,paddingBottom:null,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",src:"{{ProductImage}}",alt:"Image",type:"link",linkURL:"",contentStyles:{desktop:{paddingTop:null,paddingBottom:null,paddingLeft:null,paddingRight:null,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Text",key:"text",text:'<span style="direction: ltr; font-size: 18px; font-family: sans-serif"><p>{{ProductName}}</p></span>',type:"h3",contentType:"static",styles:{desktop:{fontSize:18,fontFamily:"sans-serif",lineHeight:"120%",paddingTop:12,paddingBottom:null,paddingLeft:12,paddingRight:12,textAlign:"left",fontWeight:"bold"},mobile:{}}},{name:"Text",key:"text",text:'<span style="direction: ltr; font-size: 16px; font-family: sans-serif">{{ProductPriceDisplay}}<br></span>',type:"p",contentType:"static",styles:{desktop:{fontSize:16,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:null,paddingBottom:6,paddingLeft:12,paddingRight:12,textAlign:"left"},mobile:{}}},{name:"Text",key:"text",text:"<p>{{ProductDescription}}</p>",type:"p",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"120%",paddingTop:12,paddingBottom:12,paddingLeft:12,paddingRight:12,textAlign:"left"},mobile:{}}},{name:"Button",key:"button",text:"Shop Now",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{textAlign:"center",paddingTop:12,paddingBottom:12,paddingLeft:12,paddingRight:12},mobile:{}},styles:{desktop:{width:"100%",fontSize:16,lineHeight:"140%",borderRadius:4,fontFamily:"sans-serif",paddingTop:10,paddingBottom:10,paddingLeft:null,paddingRight:null,backgroundColor:"#263d2d",color:"#fff",display:"inline-block"},mobile:{}}},{name:"Divider",key:"divider",contentStyles:{desktop:{paddingTop:2,paddingBottom:12,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}},styles:{desktop:{width:"100%",borderTopStyle:"solid",borderTopColor:"#ccc",borderTopWidth:1,display:"inline-block",verticalAlign:"middle"},mobile:{}}}]}]}},{id:"product_image_left",presetName:"Product (Image Left)",nameKey:"preset_product_image_left",containerType:"product",block:{name:"Container",key:"column",type:"full",containerType:"product",productRole:"main",mainProductLayout:"image_left",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:12,paddingLeft:12,paddingRight:12,paddingBottom:12,contentBackground:"#fff"},mobile:{}},isPreset:!0,columnProducts:[{id:"product-1",name:"ADIDAS | KID'S STAN SMITH",description:"Elevate your space with a thoughtfully crafted piece that blends function and style. Whether at home or on the go, it's the kind of essential you'll wonder how you lived without.",image:"https://www.psylish.com/cdn/shop/files/IMG_4632.jpg?v=1773123202&width=1220",link:"https://www.psylish.com",price:90,currency:"USD",old_price:null,new_price:null}],children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Container",key:"column",type:"2-3",containerType:"none",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Content",key:"content",width:"40%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:8,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",src:"{{ProductImage}}",alt:"Product image",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}}]},{name:"Content",key:"content",width:"60%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:12,paddingLeft:8,paddingRight:0,paddingBottom:12,contentBackground:"transparent"},mobile:{}},children:[{name:"Text",key:"text",text:'<p style="font-size:13px;font-family:sans-serif;font-weight:700;letter-spacing:0.05em;text-transform:uppercase;margin:0 0 4px">{{ProductName}}</p>',type:"h2",contentType:"static",styles:{desktop:{fontSize:13,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:0,paddingBottom:4,paddingLeft:0,paddingRight:0,textAlign:"left",fontWeight:"bold"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:14px;font-family:sans-serif;color:#6b7280;margin:0 0 10px">{{ProductPriceDisplay}}</p>',type:"p",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:0,paddingBottom:8,paddingLeft:0,paddingRight:0,textAlign:"left"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:13px;font-family:sans-serif;color:#374151;line-height:1.5">{{ProductDescription}}</p>',type:"p",contentType:"static",styles:{desktop:{fontSize:13,fontFamily:"sans-serif",lineHeight:"150%",paddingTop:0,paddingBottom:14,paddingLeft:0,paddingRight:0,textAlign:"left"},mobile:{}}},{name:"Button",key:"button",text:"Buy Now",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{textAlign:"left",paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0},mobile:{}},styles:{desktop:{width:"auto",fontSize:13,lineHeight:"140%",borderRadius:2,fontFamily:"sans-serif",paddingTop:8,paddingBottom:8,paddingLeft:20,paddingRight:20,color:"#fff",display:"inline-block"},mobile:{}}}]}]}]}]}},{id:"product_two_column",presetName:"Additional Products",nameKey:"preset_product_two_column",containerType:"product",block:{name:"Container",key:"column",type:"1-1",containerType:"none",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,columns:2,columnProducts:[null,null],children:[{name:"Content",key:"content",width:"50%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:0,paddingRight:4,paddingBottom:null,contentBackground:"transparent"},mobile:{}},children:[{name:"Container",key:"column",type:"full",containerType:"product",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:null,paddingRight:null,paddingBottom:null,contentBackground:"#fff"},mobile:{}},isPreset:!0,productRole:"additional",columnProducts:[{id:"product-2",name:"Heartline Diamond Ring",description:"The Sariah Diamond Earrings feature round diamonds in a classic hoop design that curves elegantly around the lobe.",image:"https://www.psylish.com/cdn/shop/files/Psylish3.0_15.png?v=1770880382&width=1220",link:"https://www.psylish.com/",price:1e3,currency:"USD",old_price:1200,new_price:1e3}],children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:null,paddingRight:null,paddingBottom:null,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",src:"{{ProductImage}}",alt:"Image",type:"link",linkURL:"",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Text",key:"text",text:'<span style="direction: ltr; font-size: 18px; font-family: Arial"><p>{{ProductName}}</p></span>',type:"h3",contentType:"static",styles:{desktop:{fontSize:18,fontFamily:"Arial",lineHeight:"140%",paddingTop:12,paddingBottom:0,paddingLeft:8,paddingRight:8,textAlign:"left",fontWeight:"bold"},mobile:{}}},{name:"Text",key:"text",text:'<span style="direction: ltr; font-size: 16px; font-family: Arial">{{ProductPriceDisplay}}<br></span>',type:"p",contentType:"static",styles:{desktop:{fontSize:16,fontFamily:"Arial",lineHeight:"140%",paddingTop:2,paddingBottom:2,paddingLeft:8,paddingRight:8,textAlign:"left"},mobile:{}}},{name:"Text",key:"text",text:"<p>{{ProductDescription}}</p>",type:"p",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:12,paddingBottom:12,paddingLeft:8,paddingRight:8,textAlign:"left"},mobile:{}}},{name:"Button",key:"button",text:"Add to Cart",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{textAlign:"center",paddingTop:12,paddingBottom:12,paddingLeft:8,paddingRight:8},mobile:{}},styles:{desktop:{width:"100%",fontSize:16,lineHeight:"140%",borderRadius:4,fontFamily:"sans-serif",paddingTop:10,paddingBottom:10,paddingLeft:0,paddingRight:0,backgroundColor:"#263d2d",color:"#fff",display:"inline-block"},mobile:{}}}]}]}]},{name:"Content",key:"content",width:"50%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:4,paddingRight:0,paddingBottom:null,contentBackground:"transparent"},mobile:{}},children:[{name:"Container",key:"column",type:"full",containerType:"product",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:null,paddingRight:null,paddingBottom:null,contentBackground:"#fff"},mobile:{}},isPreset:!0,productRole:"additional",columnProducts:[{id:"product-3",name:"Lynx Heart Diamond Ring",description:"The Sariah Diamond Earrings feature round diamonds in a classic hoop design that curves elegantly around the lobe.",image:"https://www.psylish.com/cdn/shop/files/Psylish3.0_48.png?v=1770881768&width=1220",link:"https://www.psylish.com/",price:900,currency:"USD",old_price:1200,new_price:900}],children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:null,paddingRight:null,paddingBottom:null,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",src:"{{ProductImage}}",alt:"Image",type:"link",linkURL:"",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Text",key:"text",text:'<span style="direction: ltr; font-size: 18px; font-family: Arial"><p>{{ProductName}}</p></span>',type:"h3",contentType:"static",styles:{desktop:{fontSize:18,fontFamily:"Arial",lineHeight:"140%",paddingTop:12,paddingBottom:0,paddingLeft:8,paddingRight:8,textAlign:"left",fontWeight:"bold"},mobile:{}}},{name:"Text",key:"text",text:'<span style="direction: ltr; font-size: 16px; font-family: Arial">{{ProductPriceDisplay}}<br></span>',type:"p",contentType:"static",styles:{desktop:{fontSize:16,fontFamily:"Arial",lineHeight:"140%",paddingTop:2,paddingBottom:2,paddingLeft:8,paddingRight:8,textAlign:"left"},mobile:{}}},{name:"Text",key:"text",text:"<p>{{ProductDescription}}</p>",type:"p",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:12,paddingBottom:12,paddingLeft:8,paddingRight:8,textAlign:"left"},mobile:{}}},{name:"Button",key:"button",text:"Add to Cart",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{textAlign:"center",paddingTop:12,paddingBottom:12,paddingLeft:8,paddingRight:8},mobile:{}},styles:{desktop:{width:"100%",fontSize:16,lineHeight:"140%",borderRadius:4,fontFamily:"sans-serif",paddingTop:10,paddingBottom:10,paddingLeft:20,paddingRight:20,backgroundColor:"#263d2d",color:"#fff",display:"inline-block"},mobile:{}}}]}]}]}]}},{id:"product_three_column",presetName:"Products (3 Column)",nameKey:"preset_product_three_column",containerType:"product",block:{name:"Container",key:"column",type:"1-1-1",containerType:"none",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,columns:3,columnProducts:[null,null,null],children:[{name:"Content",key:"content",width:"33.3%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Container",key:"column",type:"full",containerType:"product",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,productRole:"additional",columnProducts:[{id:"product-4",name:"Diamond Ring",description:"Elegant diamond ring for everyday wear.",image:"https://www.psylish.com/cdn/shop/files/IMG_4632.jpg?v=1773123202&width=1220",link:"https://www.psylish.com",price:1500,currency:"USD",old_price:null,new_price:null}],children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",src:"{{ProductImage}}",alt:"Image",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:14px;font-family:sans-serif;font-weight:bold;margin:0">{{ProductName}}</p>',type:"h3",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:8,paddingBottom:2,paddingLeft:8,paddingRight:8,textAlign:"left",fontWeight:"bold"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:13px;font-family:sans-serif;color:#6b7280;margin:0">{{ProductPriceDisplay}}</p>',type:"p",contentType:"static",styles:{desktop:{fontSize:13,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:0,paddingBottom:8,paddingLeft:8,paddingRight:8,textAlign:"left"},mobile:{}}},{name:"Button",key:"button",text:"View",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{textAlign:"center",paddingTop:6,paddingBottom:8,paddingLeft:8,paddingRight:8},mobile:{}},styles:{desktop:{width:"100%",fontSize:13,lineHeight:"140%",borderRadius:3,fontFamily:"sans-serif",paddingTop:8,paddingBottom:8,paddingLeft:0,paddingRight:0,backgroundColor:"#263d2d",color:"#fff",display:"inline-block"},mobile:{}}}]}]}]},{name:"Content",key:"content",width:"33.3%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Container",key:"column",type:"full",containerType:"product",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,productRole:"additional",columnProducts:[{id:"product-5",name:"Sapphire Bracelet",description:"Delicate bracelet with sapphire stones.",image:"https://www.psylish.com/cdn/shop/files/Psylish3.0_15.png?v=1770880382&width=1220",link:"https://www.psylish.com/",price:750,currency:"USD",old_price:900,new_price:750}],children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",src:"{{ProductImage}}",alt:"Image",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:14px;font-family:sans-serif;font-weight:bold;margin:0">{{ProductName}}</p>',type:"h3",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:8,paddingBottom:2,paddingLeft:8,paddingRight:8,textAlign:"left",fontWeight:"bold"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:13px;font-family:sans-serif;color:#6b7280;margin:0">{{ProductPriceDisplay}}</p>',type:"p",contentType:"static",styles:{desktop:{fontSize:13,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:0,paddingBottom:8,paddingLeft:8,paddingRight:8,textAlign:"left"},mobile:{}}},{name:"Button",key:"button",text:"View",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{textAlign:"center",paddingTop:6,paddingBottom:8,paddingLeft:8,paddingRight:8},mobile:{}},styles:{desktop:{width:"100%",fontSize:13,lineHeight:"140%",borderRadius:3,fontFamily:"sans-serif",paddingTop:8,paddingBottom:8,paddingLeft:0,paddingRight:0,backgroundColor:"#263d2d",color:"#fff",display:"inline-block"},mobile:{}}}]}]}]},{name:"Content",key:"content",width:"33.3%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Container",key:"column",type:"full",containerType:"product",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,productRole:"additional",columnProducts:[{id:"product-6",name:"Pearl Necklace",description:"Classic pearl necklace for timeless elegance.",image:"https://www.psylish.com/cdn/shop/files/Psylish3.0_48.png?v=1770881768&width=1220",link:"https://www.psylish.com/",price:600,currency:"USD",old_price:null,new_price:null}],children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",src:"{{ProductImage}}",alt:"Image",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:14px;font-family:sans-serif;font-weight:bold;margin:0">{{ProductName}}</p>',type:"h3",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:8,paddingBottom:2,paddingLeft:8,paddingRight:8,textAlign:"left",fontWeight:"bold"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:13px;font-family:sans-serif;color:#6b7280;margin:0">{{ProductPriceDisplay}}</p>',type:"p",contentType:"static",styles:{desktop:{fontSize:13,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:0,paddingBottom:8,paddingLeft:8,paddingRight:8,textAlign:"left"},mobile:{}}},{name:"Button",key:"button",text:"View",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{textAlign:"center",paddingTop:6,paddingBottom:8,paddingLeft:8,paddingRight:8},mobile:{}},styles:{desktop:{width:"100%",fontSize:13,lineHeight:"140%",borderRadius:3,fontFamily:"sans-serif",paddingTop:8,paddingBottom:8,paddingLeft:0,paddingRight:0,backgroundColor:"#263d2d",color:"#fff",display:"inline-block"},mobile:{}}}]}]}]}]}},{id:"preset_discount",presetName:"Discount",nameKey:"preset_discount",containerType:"discount",block:{name:"Container",key:"column",type:"full",containerType:"discount",discountVariant:"card",showTitle:!0,discountTitle:"{{DiscountValue}} off your first order",discountCode:"{{DiscountCode}}",titleSize:22,titleWeight:"600",codeSize:16,codeSpacing:.08,codeBorder:"dashed",codeBorderWidth:1.5,codeBg:"none",codeRadius:4,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:28,paddingLeft:24,paddingRight:24,paddingBottom:28,contentBackground:"#D8FE91"},mobile:{}},isPreset:!0,children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Text",key:"text",text:'<p style="text-align:center;margin:0 0 0px"><span style="font-family:Arial;font-size:22px;font-weight:600;color:#171717">{{DiscountValue}} off your first order</span></p>',type:"h2",contentType:"static",styles:{desktop:{fontSize:22,fontFamily:"Arial",lineHeight:"130%",paddingTop:0,paddingBottom:14,paddingLeft:0,paddingRight:0,textAlign:"center",fontWeight:"600"},mobile:{}}},{name:"Text",key:"text",text:'<p style="text-align:center;margin:0"><span style="font-family:Arial;font-size:16px;letter-spacing:0.08em;color:#171717">{{DiscountCode}}</span></p>',type:"p",contentType:"static",styles:{desktop:{fontSize:16,fontFamily:"Arial",lineHeight:"130%",paddingTop:10,paddingBottom:10,paddingLeft:28,paddingRight:28,textAlign:"center",borderTopStyle:"dashed",borderBottomStyle:"dashed",borderLeftStyle:"dashed",borderRightStyle:"dashed",borderTopColor:"#171717",borderBottomColor:"#171717",borderLeftColor:"#171717",borderRightColor:"#171717",borderTopWidth:"1.5px",borderBottomWidth:"1.5px",borderLeftWidth:"1.5px",borderRightWidth:"1.5px",borderRadius:"4px",display:"block",width:"fit-content",maxWidth:"100%",marginLeft:"auto",marginRight:"auto"},mobile:{}}}]}],discountAlign:"center",discountGap:14}},{id:"preset_discount_simple",presetName:"Discount (simple line)",nameKey:"preset_discount_simple",containerType:"discount",block:{name:"Container",key:"column",type:"full",containerType:"discount",discountVariant:"simple",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#ffa7aa"},mobile:{}},isPreset:!0,children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Text",key:"text",text:'<div style="text-align: center;"><font face="Arial">Use <b>{{DiscountCode}}</b> for <b>{{DiscountValue}}</b> OFF. Expires on {{ValidUntil}}</font></div>',type:"p",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"120%",paddingTop:12,paddingBottom:12,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}}}]}]}},{id:"preset_footer",presetName:"Footer",nameKey:"preset_footer",containerType:"footer",block:{name:"Container",key:"column",type:"full",containerType:"footer",footerUnifiedLayout:!1,showFooterBanner:!1,isPreset:!0,styles:{key:"column",desktop:{backgroundColor:"#f4f4f5",paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0,contentBackground:"#ffffff",color:"#737373",linkColor:"",fontSize:12,textAlign:"center"},mobile:{}},children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",footerBannerSlot:!0,hidden:!0,src:"{{FooterBanner}}",alt:"",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:8,paddingBottom:8,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Divider",key:"divider",footerBannerDividerSlot:!0,hidden:!0,contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"100%",borderTopStyle:"solid",borderTopColor:"#ccc",borderTopWidth:1,display:"inline-block",verticalAlign:"middle"},mobile:{}}},{name:"Image",key:"image",footerSlot:"logo",src:"{{LogoUrl}}",alt:"Logo",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:8,paddingBottom:4,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"30%"},mobile:{}}},{name:"Text",key:"text",footerSlot:"brand",hidden:!0,text:'<div style="text-align:center"><b>{{BrandName}}</b></div>',type:"p",contentType:"static",styles:{desktop:{fontSize:12,fontFamily:"Arial, sans-serif",color:"#737373",lineHeight:"150%",paddingTop:8,paddingBottom:4,paddingLeft:12,paddingRight:12,textAlign:"center",fontWeight:"600"},mobile:{}}},{name:"Text",key:"text",footerSlot:"tagline",text:'<div style="text-align:center">{{Tagline}}</div>',type:"p",contentType:"static",styles:{desktop:{fontSize:12,fontFamily:"Arial, sans-serif",color:"#737373",lineHeight:"150%",paddingTop:2,paddingBottom:2,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}}},{name:"Text",key:"text",footerSlot:"address",hidden:!0,text:'<div style="text-align:center">{{Address}}</div>',type:"p",contentType:"static",styles:{desktop:{fontSize:12,fontFamily:"Arial, sans-serif",color:"#737373",lineHeight:"150%",paddingTop:4,paddingBottom:4,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}}},{name:"Social link",key:"social_link",footerSlot:"social",list:[],imageWidth:36,iconSize:"medium",iconColor:"gray",contentStyles:{desktop:{paddingTop:12,paddingBottom:8,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}},styles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0},mobile:{}}},{name:"Menu",key:"menu",footerSlot:"secondary",hidden:!0,useNavigationLinks:!1,layoutMode:"nav-only",showLogo:!1,mobileLayout:"stack",linkGapPx:0,linkUnderline:!1,list:[{label:"Privacy",url:"#",target:"_self"},{label:"Terms",url:"#",target:"_self"}],separator:" · ",contentStyles:{desktop:{paddingTop:2,paddingBottom:2,paddingLeft:4,paddingRight:4,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:12,fontFamily:"Arial, sans-serif",color:"#737373",linkColor:"#737373",letterSpacing:0,fontWeight:"400",textTransform:"none"},mobile:{}},isPreset:!0},{name:"Text",key:"text",footerSlot:"unsubscribe",hidden:!0,text:'<div style="text-align:center">You are receiving this email because you subscribed. <a href="{{unsubscribe_url}}">Unsubscribe</a></div>',unsubscribeBodyText:"You are receiving this email because you subscribed.",unsubscribeLinkLabel:"Unsubscribe",unsubscribeUrl:"{{unsubscribe_url}}",contentStyles:{desktop:{paddingTop:2,paddingBottom:2,paddingLeft:4,paddingRight:4,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:12,fontFamily:"Arial, sans-serif",color:"#737373",paddingTop:4,paddingBottom:4,paddingLeft:12,paddingRight:12,lineHeight:"150%"},mobile:{}},isPreset:!0},{name:"Text",key:"text",footerSlot:"copyright",text:'<div style="text-align:center;font-size:11px;opacity:0.9">© 2026 {{BrandName}}</div>',type:"p",contentType:"static",styles:{desktop:{fontSize:11,fontFamily:"Arial, sans-serif",color:"#737373",lineHeight:"150%",paddingTop:8,paddingBottom:4,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}}}]}]}}]};const Dr=new Set(["navigation_bar","preset_header_centered","preset_header_nav_only","product_image_left","product_three_column","preset_discount_simple"]);function Ur(e){if(!e||"object"!=typeof e)return e;const t={...e,id:Nt()};return Array.isArray(t.children)&&(t.children=t.children.map(Ur)),Array.isArray(t.columnProducts)&&(t.columnProducts=t.columnProducts.map(e=>e&&"object"==typeof e?{...e}:e)),t}function Er(e){const t=Mr.presets.find(t=>t.id===e);return t?Ur(JSON.parse(JSON.stringify(t.block))):null}const zr=[{id:"dolor-sit-amet",name:"Dolor Sit Amet",description:"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",image:"https://plus.unsplash.com/premium_photo-1681711647066-ef84575c0d95?fm=jpg&q=30&w=300&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MXx8cHJvZHVjdCUyMHBob3RvZ3JhcGh5fGVufDB8fDB8fHww",link:"https://loremipsum.com/checkout/cart/12345",price:2e3,currency:"USD",old_price:2500,new_price:2e3},{id:"sample-2",name:"Sample Pearl Necklace",description:"Classic strand of lustrous freshwater pearls with a sterling silver clasp. Timeless elegance for any outfit.",image:"https://picsum.photos/seed/necklace2/200/200",link:"https://www.example.com/products/sample-2",price:750,currency:"USD",old_price:null,new_price:null},{id:"sample-3",name:"Sample Gold Bracelet",description:"Handcrafted 14K yellow gold link bracelet. Lightweight and comfortable for everyday wear.",image:"https://picsum.photos/seed/bracelet3/200/200",link:"https://www.example.com/products/sample-3",price:450,currency:"USD",old_price:500,new_price:450},{id:"sample-4",name:"Sample Silver Earrings",description:"Delicate sterling silver drop earrings with subtle sparkle. A versatile addition to your jewelry collection.",image:"https://picsum.photos/seed/earrings4/200/200",link:"https://www.example.com/products/sample-4",price:199,currency:"USD",old_price:null,new_price:null},{id:"sample-5",name:"Sample Gemstone Pendant",description:"Stunning pendant with a natural gemstone centerpiece on a fine silver chain. Makes a memorable gift.",image:"https://picsum.photos/seed/pendant5/200/200",link:"https://www.example.com/products/sample-5",price:320,currency:"USD",old_price:400,new_price:320}],Fr=new Set(["image/png","image/jpeg","image/jpg","image/gif","image/svg+xml","image/webp"]),Or={png:"image/png",jpeg:"image/jpeg",jpg:"image/jpeg",gif:"image/gif",svg:"image/svg+xml",webp:"image/webp"},Wr=Array.from(Fr).join(",");function jr(e){return e?function(e){if(!e)return!1;const t=String(e.type||"").toLowerCase().trim();if(t)return Fr.has(t);const n=String(e.name||"").toLowerCase(),o=n.lastIndexOf(".");if(-1===o)return!1;const l=n.slice(o+1);return Object.prototype.hasOwnProperty.call(Or,l)}(e)?e.size>10485760?"size":null:"type":null}const Hr=({imageUploadEndpoint:e,headers:t={},companyId:n,imageUploadQueryParams:l,imageUploadCompanyField:a="companyId"}={})=>{const i=!!e;return{uploadImageFile:o(async o=>{if(!i)return console.error("[useImageUpload] No image upload endpoint configured"),null;if(!o)return console.error("[useImageUpload] No file provided"),null;const r=jr(o);if("type"===r)return console.error("[useImageUpload] File type not allowed:",o.type),null;if("size"===r)return console.error("[useImageUpload] File too large:",o.size,"bytes"),null;const s=await(async(e,t,n,o={},l={})=>{if(!e)return console.error("[API Service] No image upload endpoint configured"),null;if(!t)return console.error("[API Service] No file provided for upload"),null;const{queryParams:a={},companyField:i="companyId"}=l;try{const l=new FormData;l.append("file",t),n&&("comment"===i?l.append("comment",n):l.append("companyId",n));let r=e;if(a&&Object.keys(a).length>0){const t="undefined"!=typeof window&&window.location?.origin?window.location.origin:"http://localhost",n=new URL(e,t);Object.entries(a).forEach(([e,t])=>{null!=t&&n.searchParams.set(e,String(t))}),r=n.toString()}const s={...o};Object.keys(s).forEach(e=>{"content-type"===e.toLowerCase()&&delete s[e]});const c=await fetch(r,{method:"POST",headers:{...s},body:l}),d=await c.text();let u={};try{u=d?JSON.parse(d):{}}catch{u=d?{message:d.slice(0,500)}:{}}if(!c.ok){const e=aa(u,c.status);throw console.error("[API Service] Image upload failed:",c.status,e),new Error(e)}if(u&&!1===u.success){const e=aa(u,c.status);throw console.error("[API Service] Upload API returned error:",e),new Error(e)}if(u&&"string"==typeof u.url&&u.url.trim())return u.url.trim();const p=u?.data?.url;if(p&&"string"==typeof p)return p.trim();throw new Error("Upload succeeded but no image URL was returned.")}catch(e){if(console.error("[API Service] Error uploading image:",e),e instanceof Error&&e.message)throw e;throw new Error(e&&"object"==typeof e&&"message"in e?String(e.message):"Unable to upload image. Check your network and try again.")}})(e,o,n,t,{queryParams:l,companyField:a});return s},[i,e,t,n,l,a]),isConfigured:i}};function Kr(e){if(null==e)return!0;const t=String(e).trim().toLowerCase();return""===t||"transparent"===t}const Vr=({t:e,findStyleItem:t,colorChange:n,inputChange:o,paddingChange:i,patchContainerBackground:s,commitColumnUpdate:c,currentItem:d,children:u})=>{const p=t(d.data.styles,"backgroundColor"),m=t(d.data.styles,"contentBackground"),g=t(d.data.styles,"containerBackgroundImage")??"",h=""!==String(g).trim(),y=l(()=>function(e,t){return e?"image":Kr(t)?"none":"color"}(h,p),[h,p]),[b,f]=a(null),_=b??y;r(()=>{f(null)},[d?.data?.id]),r(()=>{h&&f(null)},[h]);const v=t(d.data.styles,"contentMaxWidth")??"100%",w=l(()=>[{value:"100%",label:e("content_max_width_option_full")},{value:"720px",label:"720"},{value:"600px",label:"600"},{value:"540px",label:"540"}],[e]),x=l(()=>[{value:"none",label:e("border_none")},{value:"solid",label:e("solid")},{value:"dashed",label:e("dashed")},{value:"dotted",label:e("dotted")}],[e]),S=w.some(e=>e.value===v)?v:"100%",C=t(d.data.styles,"minHeight")??"",N="string"==typeof C?parseInt(C.replace("px",""),10)||"":C||"",L=t(d.data.styles,"borderStyle")??"none",T=t(d.data.styles,"borderWidth")??1,B="string"==typeof T?parseInt(T.replace("px",""),10)||1:T||1,A=t(d.data.styles,"borderColor")??"#e0e0e0",I=t(d.data.styles,"borderRadius")??0,$="string"==typeof I?parseInt(String(I).replace("px",""),10)||0:I||0,P="none"!==L,R=Boolean(d.data.hiddenOnMobile),M=Kr(m)?"auto":"custom";return Je(Ye,{children:[qe(_r,{children:e("section_background_group")}),qe(vr,{label:e("section_bg_mode"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:_,onChange:e=>(e=>{if("image"===e)return f("image"),void s({containerBackgroundEnabled:!0});if(f(null),"color"===e){s({containerBackgroundImage:"",containerBackgroundEnabled:!1});const e=Kr(p)?"#ffffff":p;return void n("backgroundColor")({hex:e})}"none"===e&&(s({containerBackgroundImage:"",containerBackgroundEnabled:!1}),n("backgroundColor")({hex:"transparent"}))})(e),"aria-label":e("section_bg_mode"),items:[{value:"color",label:e("section_bg_color")},{value:"image",label:e("section_bg_image")},{value:"none",label:e("section_bg_none")}]})}),("color"===_||"image"===_)&&qe(vr,{label:e("background_color"),children:qe(cr,{color:Kr(p)?"#ffffff":p,setColor:({hex:e})=>n("backgroundColor")({hex:e})})}),"image"===_?u:null,qe(_r,{children:e("section_content_area_group")}),qe(vr,{label:e("content_area_color"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:M,onChange:e=>{"auto"!==e?o("contentBackground")("#ffffff"):o("contentBackground")("transparent")},"aria-label":e("content_area_color"),items:[{value:"auto",label:e("content_color_auto")},{value:"custom",label:e("content_color_custom")}]})}),"custom"===M?qe(vr,{label:e("content_background_color"),children:qe(cr,{color:Kr(m)?"#ffffff":m,setColor:({hex:e})=>n("contentBackground")({hex:e})})}):null,qe(vr,{label:e("content_max_width"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:S,onChange:e=>o("contentMaxWidth")(e),"aria-label":e("content_max_width"),items:w})}),qe(vr,{label:e("min_height"),children:qe(k,{min:0,max:2e3,className:"input-width ee-settings-input-affix",addonAfter:"px",value:N,onFocus:e=>e?.target?.select?.(),onChange:e=>o("minHeight")(e?`${e}px`:"")})}),qe(_r,{children:e("border")}),qe(vr,{label:e("border_style"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:L,onChange:e=>o("borderStyle")(e),"aria-label":e("border_style"),items:x})}),P?Je(Ye,{children:[qe(vr,{label:e("border_width"),children:qe(k,{min:0,max:20,className:"input-width ee-settings-input-affix",addonAfter:"px",value:B,onFocus:e=>e?.target?.select?.(),onChange:e=>o("borderWidth")(e??1)})}),qe(vr,{label:e("border_color"),children:qe(cr,{color:A,setColor:({hex:e})=>n("borderColor")({hex:e})})})]}):null,qe(vr,{label:e("border_radius"),children:qe(k,{min:0,max:64,className:"input-width ee-settings-input-affix",addonAfter:"px",value:$,onFocus:e=>e?.target?.select?.(),onChange:e=>o("borderRadius")(e??0)})}),qe(_r,{children:e("spacing")}),qe(vr,{label:e("label_padding"),children:qe(mr,{padding:{paddingTop:t(d.data.styles,"paddingTop"),paddingRight:t(d.data.styles,"paddingRight"),paddingLeft:t(d.data.styles,"paddingLeft"),paddingBottom:t(d.data.styles,"paddingBottom")},setPadding:i})}),qe(_r,{children:e("visibility")}),Je("div",{className:"ee-settings-row ee-padding-link-sides-row ee-visibility-hide-mobile-row",children:[qe("span",{className:"ee-padding-link-sides-label",children:e("hidden_on_mobile")}),qe(pr,{checked:R,onChange:e=>{const t=xt(d.data);t.hiddenOnMobile=e,c(t)}})]})]})},Gr=["product"],qr=e=>"additional"===e?"additional":"main";function Jr(e,t,n){if(!e||"product"!==e.containerType)return null;const o=qt(t,n,e.id);for(let e=0;e<o.length;e++){const n=o[e]?.containerBlock;if(n&&Ei(n,t))return"additional"}return"main"}function Yr(e){const t=String(e??"").trim();return t?/^\{\{\w+\}\}$/.test(t)?null:lt(t,!1,{allowMailtoTel:!1})||null:null}const Xr=()=>{const{blockMap:e,rootOrder:t,setBlocks:o,currentItem:s,setCurrentItem:c,previewMode:d,templateData:u,setIsDragStart:p,setActionType:m,apiConfig:g}=n(Ln),{t:y}=ja(),[b,f]=a(!1),_=i(null),[C,N]=a(!1),[L,T]=a(""),[I,$]=a(""),{uploadImageFile:P,isConfigured:R}=Hr({imageUploadEndpoint:g?.imageUploadEndpoint,headers:g?.headers||{},companyId:g?.companyId,imageUploadQueryParams:g?.imageUploadQueryParams,imageUploadCompanyField:g?.imageUploadCompanyField}),{findStyleItem:M,colorChange:D,inputChange:U,paddingChange:E}=Rr(),{blockConfigsList:z}=fr(),F=Mi(s?.data),O=s?.data?.children??[],[W,j]=a(0);r(()=>{j(0)},[s?.data?.id]),r(()=>{const e=O.length;0!==e&&j(t=>t>=e?Math.max(0,e-1):t)},[O.length]);const[H,K]=a(!1);r(()=>{K(!1)},[s?.data?.id]);const V="discount"===(G=s.data.containerType??"none")||"none"===G||"header"===G||"footer"===G?G:"product";var G;const q="product"===s.data.containerType?Jr(s.data,e,t):null,Y=qr(q??s.data.productRole??"main"),X=s.data.columnProducts,Z=l(()=>Array.isArray(X)?X:[],[X]),Q=l(()=>{const e=s.data;return"image_left"===e.mainProductLayout||"image_stacked"===e.mainProductLayout?e.mainProductLayout:function(e){const t=e?.children?.[0]?.children?.[0];return"column"===t?.key&&"2-3"===t?.type}(e)?"image_left":"image_stacked"},[s.data]),ee=l(()=>{const e=s.data;if(!Ei(e))return null;const t=e.children?.length??0;return 2!==t&&3!==t?null:{columnCount:t}},[s.data]),te=l(()=>({columnIndex:0,columnProduct:Z[0]??null}),[Z]),ne=M(s.data.styles,"containerBackgroundImage")??"";r(()=>{$("")},[ne]);const oe=u?.content?.products?.length>0?u.content.products:u?.catalogProducts?.length>0?u.catalogProducts:zr,le=n=>{const{blockMap:l}=jt([n]);let a={...e,...l};const i=qr(n.productRole);"product"===n.containerType&&"main"===i&&Object.keys(a).forEach(e=>{if(e===n.id)return;const t=a[e];if(!t||"column"!==t.key)return;if("product"!==t.containerType)return;"main"===qr(t.productRole)&&(a[e]={...t,productRole:"additional"})}),o(a,t,`edit_${(new Date).getTime()}`),c({...s,data:n})};r(()=>{if("product"!==s?.data?.containerType)return;const n=Jr(s.data,e,t);if(!n)return;if(qr(s.data.productRole)===n)return;const o=xt(s.data);o.productRole=n,le(o)},[s?.data?.id,s?.data?.containerType,s?.data?.productRole,e,t]);const ae=e=>{const t=xt(s.data);t.styles||(t.styles={desktop:{},mobile:{}}),t.styles[d]||(t.styles[d]={}),Object.assign(t.styles[d],e),le(t)},ie=async e=>{if(!e)return;const t=jr(e);if("type"!==t)if("size"!==t)if(R){N(!0);try{const t=await P(e);t?(ae({containerBackgroundImage:ol(t),containerBackgroundEnabled:!0}),T(""),$(""),S.success(y("image_uploaded"))):S.error(y("image_upload_failed"))}catch(t){console.error(t);const e="string"==typeof t?.message&&t.message.trim()?t.message.trim():null;S.error(e||y("image_upload_error"))}finally{N(!1)}}else S.error(y("image_upload_not_configured"));else S.error(y("image_file_too_large"));else S.error(y("image_upload_invalid_type"))},re=e=>{const t=Yr(e);var n;T(t?y("blocked_scheme"===(n=t)?"container_bg_image_url_error_blocked_scheme":"duplicate_protocol"===n?"container_bg_image_url_error_duplicate_protocol":"missing_hostname_dot"===n?"container_bg_image_url_error_hostname":"invalid_protocol"===n?"container_bg_image_url_error_invalid_protocol":"container_bg_image_url_error_generic"):""),$("")},se=Gr.includes(V),ce=e=>{if(!se||"main"!==qr(Y))return;if(e===Q)return;const t=Er("image_left"===e?"product_image_left":"product_single");if(!t)return;const n=xt(s.data);n.mainProductLayout=e,n.children=xt(t.children),n.columnProducts=xt(Z),le(n)},de=l(()=>ei(s.data,e),[s.data,e]),ue=l(()=>qt(e,t,s.data?.id),[e,t,s.data?.id]),pe=l(()=>(ue||[]).filter(e=>e?.containerBlock&&e.containerBlock.id!==s.data?.id&&"none"!==e.containerType).map(e=>{const t=e.cellIndex??0;return{containerType:e.containerType,context:{columnIndex:t,columnProduct:e.containerBlock?.columnProducts?.[t]??null}}}),[ue,s.data?.id]),he=zo(0,V,u,{},pe).filter(({variableKey:e,key:t})=>!("product"===V)||(e??t)!==ao).filter(({variableKey:e,key:t})=>!de.has(e??t)),ye=l(()=>{const e={columnIndex:0,columnProduct:Z[0]??null};return Wo(V,u,e).filter(e=>e.variableKey&&!de.has(e.variableKey))},[V,u,Z,de]),be=l(()=>{const e=new Set(he.map(e=>e.variableKey??e.key)),t=ye.filter(t=>{const n=t.variableKey;return!(!n||e.has(n))&&(e.add(n),!0)});return[...he,...t]},[he,ye]),fe=e=>t=>{const n=(e=>{const{value:t,type:n}=e;if("image"===n){const e=xt(z.find(e=>"image"===e.key));return e?(e.src=t,e):{name:y("image"),key:"image",src:t,alt:"Image",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}}}const o=xt(z.find(e=>"text"===e.key));return o?(o.text=`<p>${t}</p>`,o.type="p",o.contentType="static",o):{name:y("text"),key:"text",text:`<p>${t}</p>`,type:"p",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"20px",paddingTop:16,paddingBottom:16,paddingLeft:16,paddingRight:16,textAlign:"left"},mobile:{}}}})(e);"undefined"!=typeof window&&(window.__eeDragItemData=n,window.__eeDragSource="product-variables"),p(!0),m("add"),t.target.classList.add("ee-product-variable-item-dragging"),t.dataTransfer&&(t.dataTransfer.effectAllowed="copy")},_e=e=>{e.target.classList.remove("ee-product-variable-item-dragging"),"undefined"!=typeof window&&(window.__eeDragItemData=null,window.__eeDragSource=null),setTimeout(()=>{p(!1)},50)},ke=e=>t=>{const n=xt(s.data);n.children[e].styles[d]={...n.children[e].styles[d],...t},le(n)},ve=(e=!1)=>{const t=M(s.data.styles,"containerBackgroundImage")??"",n=function(e,t,n){const o=String(e??"").trim();if(!o)return"";if(Yr(o))return"";if(/^\{\{\w+\}\}$/.test(o)){const e=o.replace(/\{\{|\}\}/g,"").trim(),l=t&&e?$o(t,e,n):null;return null==l||String(l).startsWith("{{")?"":nt(String(l).trim(),{allowMailtoTel:!1})||""}return nt(o,{allowMailtoTel:!1})||""}(t,u,te),o=Je("span",{className:"ee-container-bg-heading-inline",children:[y("container_background_image_section_title"),qe(v,{title:Je("div",{className:"ee-container-bg-tooltip",children:[qe("p",{className:"ee-container-bg-tooltip-p",children:y("container_background_image_tooltip_p1")}),qe("p",{className:"ee-container-bg-tooltip-p",children:y("container_background_image_tooltip_p2")}),qe("p",{className:"ee-container-bg-tooltip-p",children:y("container_background_image_intro")})]}),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:qe("span",{className:"ee-container-bg-section-help",tabIndex:0,"aria-label":y("container_background_image_title"),onClick:e=>e.stopPropagation(),children:qe(B,{icon:A})})})]}),l=!e||H;return Je("div",{className:za("ee-container-bg-section",e&&"ee-container-bg-section--disclosure"),children:[e?Je("div",{className:"ee-settings-row ee-padding-link-sides-row ee-container-bg-disclosure-switch-row",children:[qe("div",{className:"ee-container-bg-disclosure-heading-left",children:qe("span",{className:"ee-settings-section-title ee-container-bg-section-heading",children:o})}),qe(pr,{checked:H,onChange:K,"aria-label":y("container_background_image_section_toggle")})]}):qe(_r,{className:"ee-container-bg-section-heading",children:o}),l?Je("div",{className:"ee-container-bg-section-body",children:[qe("input",{ref:_,type:"file",accept:Wr,className:"ee-image-upload-input-hidden",onChange:async e=>{const t=e.target.files?.[0];await ie(t),e.target.value=""},disabled:C}),Je(vr,{label:y("container_background_image_upload"),children:[qe(w,{spinning:C,children:Je("div",{role:"button",tabIndex:0,className:"ee-image-upload-trigger",onClick:()=>!C&&_.current?.click(),onDrop:async e=>{e.preventDefault(),e.stopPropagation();const t=e.dataTransfer?.files?.[0];await ie(t)},onDragOver:e=>{e.preventDefault(),e.stopPropagation()},style:{opacity:C?.6:1,cursor:C?"not-allowed":"pointer"},children:[qe(B,{icon:me,className:"ee-image-upload-icon"}),qe("span",{children:y(C?"uploading":"image_upload_click")})]})}),Je("div",{className:"ee-image-toolbar",children:[Je("button",{type:"button",className:"ee-image-toolbar-btn",onClick:()=>_.current?.click(),disabled:C,children:[qe(B,{icon:ge}),qe("span",{children:y("replace")||"Replace"})]}),Je("button",{type:"button",className:"ee-image-toolbar-btn ee-image-toolbar-btn--danger",onClick:()=>{T(""),$(""),ae({containerBackgroundImage:"",containerBackgroundEnabled:!1})},disabled:C||!String(t).trim(),children:[qe(B,{icon:J}),qe("span",{children:y("delete")||"Delete"})]})]}),qe("div",{className:"ee-image-upload-hint",children:y("image_upload_file_hint")||"PNG, JPEG, GIF, SVG, WebP · max 10 MB"})]}),Je("div",{className:"ee-container-bg-url-block",children:[qe("div",{className:"ee-stack-label ee-container-bg-url-label",children:y("container_background_image_url")}),qe(h,{className:"width-full",value:t,onChange:e=>{const t=e.target.value,n=""!==String(t).trim();$(""),L&&re(t),ae({containerBackgroundImage:t,containerBackgroundEnabled:n})},onBlur:e=>re(e.target.value),status:L||I?"error":"",placeholder:"https://"}),L?qe("div",{className:"ee-field-error",role:"alert",children:L}):null,I&&!L?qe("div",{className:"ee-field-error",role:"alert",children:I}):null,n&&!L?qe("div",{className:"ee-container-bg-url-preview",children:qe("img",{src:n,alt:"",className:"ee-container-bg-url-preview-img",onLoad:()=>$(""),onError:()=>$(y("container_bg_image_preview_failed"))})}):null]}),Je("div",{className:"ee-container-bg-format-bar",children:[qe("div",{className:"ee-container-bg-format-bar-caption",children:y("container_background_image_layout_group")}),Je("div",{className:"ee-container-bg-format-bar-inner",children:[Je("div",{className:"ee-container-bg-format-bar-field ee-container-bg-format-bar-field-size",children:[qe("div",{className:"ee-container-bg-format-bar-label",children:y("container_background_image_size")}),qe(x,{className:"ee-container-bg-size-select ee-container-bg-size-select-half",value:M(s.data.styles,"containerBackgroundSize")||"cover",onChange:e=>ae({containerBackgroundSize:e}),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:al.map(e=>qe(x.Option,{value:e.value,children:y(e.labelKey)},e.value))})]}),Je("div",{className:"ee-container-bg-format-bar-field ee-container-bg-format-bar-field-grid",children:[qe("div",{className:"ee-container-bg-format-bar-label",children:y("container_background_image_position")}),qe("div",{className:"ee-container-bg-position-grid",role:"group","aria-label":y("container_background_image_position"),children:il.map(e=>{const t=M(s.data.styles,"containerBackgroundPosition")||"center center";return qe("button",{type:"button",className:za("ee-container-bg-position-cell",t===e&&"ee-container-bg-position-cell-active"),title:e,"aria-pressed":t===e,onClick:()=>ae({containerBackgroundPosition:e}),children:qe("span",{className:"ee-container-bg-dot","aria-hidden":!0})},e)})})]})]})]})]}):null]})};return qe(Ye,{children:Je("div",{className:"margin-y-30 ee-settings-block-form",children:[Je(Ye,{children:[se||ee?null:qe(_r,{className:"ee-settings-section-title--flush",children:y("container_settings")}),Je("div",{className:"ee-right-panel-stack",children:[ee?Je(Ye,{children:[qe(_r,{className:"margin-top-12",children:y("additional_products_grid_layout")}),qe(vr,{label:y("additional_products_per_row"),children:qe(x,{className:"ee-stack-control",value:String(ee.columnCount),style:{width:"100%"},getPopupContainer:()=>document.querySelector(".right-settings")||document.body,onChange:e=>(e=>{if(!ee||e===ee.columnCount)return;const t=Er(3===e?"product_three_column":"product_two_column");if(!t)return;const n=s.data.id,o=xt(s.data.styles),l=[...s.data.columnProducts??[]],a=xt(t);a.id=n,a.styles=xt(o),a.styles.desktop||(a.styles.desktop={}),Object.assign(a.styles.desktop,{paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0}),a.columnProducts=Array.from({length:e},(e,t)=>l[t]??null),le(a)})(Number(e)),options:[{value:"2",label:y("product_row_count_2")},{value:"3",label:y("product_row_count_3")}]})})]}):null,se&&"main"===qr(Y)?Je(Ye,{children:[qe(_r,{className:"margin-top-12",children:y("product_output_layout")}),qe(vr,{label:y("style"),children:qe(x,{className:"ee-stack-control",value:Q,style:{width:"100%"},getPopupContainer:()=>document.querySelector(".right-settings")||document.body,onChange:ce,options:[{value:"image_stacked",label:y("product_main_layout_stacked")},{value:"image_left",label:y("product_main_layout_image_left")}]})})]}):null,se&&Je(Ye,{children:[qe(_r,{className:"margin-top-12 ee-product-kb-heading-with-tooltip",children:Je("span",{className:"ee-product-kb-heading-inner",children:[qe("span",{children:y("product_column_kb_heading")}),qe(v,{title:y("product_column_kb_tooltip"),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:qe("span",{className:"ee-container-bg-section-help",tabIndex:0,"aria-label":y("product_column_kb_tooltip"),onClick:e=>e.stopPropagation(),children:qe(B,{icon:A})})})]})}),Je("div",{className:"ee-product-assign-section ee-product-assign-after-kb-heading",children:[qe("span",{className:"ee-stack-label",children:y("product_column_select_label")}),qe(Pr,{apiConfig:g,templateData:u,value:Z[0]?.id??void 0,selectedProduct:Z[0],onChange:e=>((e,t)=>{const n=xt(s.data),o=[...n.columnProducts??[]];o[e]=t,n.columnProducts=o,le(n)})(0,e),placeholder:y("product_column_select_placeholder"),staticProductList:oe})]})]}),Je("div",{className:"ee-product-variables-section margin-top-12",children:[qe("span",{className:"ee-stack-label",children:y("product_column_variables_heading")}),Je("button",{type:"button",className:"ee-product-variables-toggle",onClick:()=>f(e=>!e),children:[qe("span",{children:y("variables")}),qe("span",{className:"ee-product-variables-toggle-icon",children:b?"▴":"▾"})]}),b&&qe("div",{className:"ee-product-variables-dropdown",children:be.length>0?be.map(e=>Je("div",{className:"ee-product-variable-item",draggable:!0,onDragStart:fe(e),onDragEnd:_e,title:e.value,children:[qe("span",{className:"ee-product-variable-item-label",children:e.labelKey?y(e.labelKey):e.label}),qe("span",{className:"ee-product-variable-item-token",children:e.value})]},e.value)):qe("div",{className:"ee-stack-help",children:y("container_variables_none_available")})})]})]})]}),F===Ui&&qe(Sr,{}),F!==Di&&(()=>{const e=s.data.children||[],t=Math.min(Math.max(0,W),Math.max(0,e.length-1)),n=e[t],o=n?M(n.styles,"backgroundColor"):void 0,l=y(F===Ui?"column_cells_section":"column_settings");return Je(Ye,{children:[qe(_r,{children:l}),e.length>1?qe(vr,{label:y("column"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:String(t),"aria-label":y("column_settings"),onChange:e=>j(Number(e)),items:e.map((e,t)=>({value:String(t),label:`${y("column")} ${t+1}`}))})}):null,n?Je(Ye,{children:[qe(vr,{label:y("content_background_color"),children:qe(cr,{color:o,setColor:({hex:e})=>((e,t)=>n=>{const o=xt(s.data);o.children[t].styles[d][e]=n,le(o)})("backgroundColor",t)(e)})}),qe(vr,{label:y("label_padding"),children:qe(mr,{padding:{paddingTop:M(n.styles,"paddingTop"),paddingRight:M(n.styles,"paddingRight"),paddingLeft:M(n.styles,"paddingLeft"),paddingBottom:M(n.styles,"paddingBottom")},setPadding:ke(t)})})]}):null]})})(),(()=>{if(F===Di)return qe(Vr,{t:y,findStyleItem:M,colorChange:D,inputChange:U,paddingChange:E,patchContainerBackground:ae,commitColumnUpdate:le,currentItem:s,children:ve()});const e=M(s.data.styles,"backgroundColor"),t=M(s.data.styles,"contentBackground"),n=M(s.data.styles,"borderRadius"),o="number"==typeof n?n:parseInt(String(n||"").replace("px",""),10)||0,l=Boolean(s.data.hiddenOnMobile);return Je(Ye,{children:[qe(_r,{children:y(F===Ui?"column_wrapper_style":"column_styles")}),qe(vr,{label:y("background_color"),children:qe(cr,{color:e,setColor:D("backgroundColor")})}),qe(vr,{label:y("content_background_color"),children:qe(cr,{color:t,setColor:D("contentBackground")})}),qe(vr,{label:y("border_radius"),children:qe(k,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",value:o,onFocus:e=>e?.target?.select?.(),onChange:e=>U("borderRadius")(Number(e)||0)})}),qe(vr,{label:y("label_padding"),children:qe(mr,{padding:{paddingTop:M(s.data.styles,"paddingTop"),paddingRight:M(s.data.styles,"paddingRight"),paddingLeft:M(s.data.styles,"paddingLeft"),paddingBottom:M(s.data.styles,"paddingBottom")},setPadding:E})}),ve(F===Ui),F===Ui?Je(Ye,{children:[qe(_r,{children:y("visibility")}),Je("div",{className:"ee-settings-row ee-padding-link-sides-row ee-visibility-hide-mobile-row",children:[qe("span",{className:"ee-padding-link-sides-label",children:y("hidden_on_mobile")}),qe(pr,{checked:l,onChange:e=>{const t=xt(s.data);t.hiddenOnMobile=e,le(t)}})]})]}):null]})})()]})})},Zr=({mlEmailNodesEndpoint:e,mlGenerationEndpoint:t,headers:n={},templateData:l,blockId:a,containerType:i,containerId:r,productId:s,blockName:c="Text",blockElementType:d="p",emailTemplateId:u,companyId:p,aiContentLanguage:m="en"}={})=>{const g=!!(e&&String(u??"").trim()&&String(p??"").trim()&&a&&r),h=!!t,y=g||h;return{generateOptions:o(async(o,y,b={})=>{const{previousPrompt:f="",previousSelectedAiContent:_=""}=b,k=function(e,t={}){const{containerType:n}=t,o=String(e??"").trim();let l;return l=Fo[o]?Fo[o]:o?o.split(/[-_]/).map(e=>e.length?e[0].toUpperCase()+e.slice(1).toLowerCase():"").join(""):"DisplayText",l||(l="DisplayText"),"product"===n&&"DisplayText"===l?"ProductDescription":l}(o,{containerType:i});if(g){const t={containerType:i||"none",id:r};if("product"===(i||"")&&null!=s){const e=String(s).trim();e&&(t.productId=e)}const o=e,l={blockContext:{blockId:a,name:c,type:d||"p"},companyId:p,containerContext:t,emailTemplateId:u,language:"bn-BD"===m?"bn-BD":"en",promptContext:{newPrompt:y||"",previousPrompt:f||"",previousSelectedAiContent:_||""},type:k},g=await(async(e,t,n={})=>{if(!e)return console.error("[API Service] generate-email-nodes: no endpoint"),{success:!1,error:"ML endpoint is not configured."};try{const o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...n},body:JSON.stringify(t)});let l={};try{l=await o.json()}catch{l={}}if(!o.ok||!1===l.success){let e="";const t=l.error;if(t&&"object"==typeof t){const n=null!=t.code?String(t.code):"",o=null!=t.message?String(t.message):"";e=[n,o].filter(Boolean).join(" — ")||o||n}return e||(e=null!=l.message?String(l.message):`${o.status} ${o.statusText}`),console.error("[API Service] generate-email-nodes failed:",e),{success:!1,error:String(e),errorCode:t&&"object"==typeof t&&null!=t.code?String(t.code):void 0}}const a=Array.isArray(l.variations)?l.variations:[],i=a.map(e=>e&&"string"==typeof e.value?e.value.trim():"").filter(Boolean);return 0===i.length?(console.error("[API Service] generate-email-nodes: empty variations"),{success:!1,error:"No variations were returned for this request."}):{success:!0,options:i,variations:a,emailJson:"string"==typeof l.emailJson?l.emailJson:void 0,blockId:l.blockId,emailTemplateId:l.emailTemplateId}}catch(e){return console.error("[API Service] Error calling generate-email-nodes:",e),{success:!1,error:e&&"object"==typeof e&&"message"in e?String(e.message):"Unable to reach the ML service. Check your network and try again."}}})(o,l,n);if(g&&g.success&&g.options?.length)return g.options;return{error:g&&"object"==typeof g&&g.error?String(g.error):"No response from the ML service."}}if(h){const e={variable:k,prompt:y,context:{templateData:l,blockId:a,containerType:i}},o=await(async(e,t,n={})=>{if(!e)return console.error("[API Service] ML endpoint not configured"),null;try{const o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...n},body:JSON.stringify(t)});if(!o.ok)return console.error("[API Service] ML endpoint failed:",o.status,o.statusText),null;const l=await o.json();if(!l.success)return console.error("[API Service] ML API returned error:",l.error),null;const a=l.data?.options??[];return Array.isArray(a)&&0!==a.length?a:(console.error("[API Service] ML API returned empty options"),null)}catch(e){return console.error("[API Service] Error calling ML endpoint:",e),null}})(t,e,n);return o&&o.length?o:{error:"The legacy ML endpoint did not return any options. Check the API response."}}return{i18nKey:"ml_ai_unavailable"}},[g,h,e,t,n,l,a,i,r,s,c,d,u,p,m]),isConfigured:y}};function Qr(){const{blockMap:e,rootOrder:t,currentItem:o}=n(Ln);return l(()=>{if(!e||!o?.id)return{containerBlock:null,containerType:"none",columnIndex:0,cellIndex:0,contentIndex:0,effectiveContainerBlock:null,effectiveContainerType:"none",effectiveCellIndex:0,effectiveColumnProduct:null};const{containerBlock:n,containerType:l,cellIndex:a,isRoot:i,rootIndex:r}=Gt(e,t,o.id);let s=0;if(i)s=r??0;else if(n){const e=t.indexOf(n.id);s=e>=0?e:0}const c=a??0,d=Jt(e,t,o.id);return{containerBlock:n??null,containerType:l??"none",columnIndex:s,cellIndex:c,contentIndex:c,effectiveContainerBlock:d.containerBlock??n??null,effectiveContainerType:d.containerType??l??"none",effectiveCellIndex:d.columnIndex??c,effectiveColumnProduct:d.columnProduct??null}},[e,t,o?.id])}const{TextArea:es}=h,ts=[8,9,10,11,12,14,16,18,20,24,28,32,36,48,64],ns="staticTextBeforeAi";function os(e,t,n,o){const l=Number.parseInt(String(e??""),10);return Number.isNaN(l)?o:Math.min(n,Math.max(t,l))}function ls(e){return null==e||"string"!=typeof e?"":e.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim()}const as=({embedded:e=!1})=>{const{currentItem:t,previewMode:o,templateData:l,apiConfig:i,bodySettings:s,aiEnabled:c=!0}=n(Ln),{t:d}=ja(),{findStyleItem:u,paddingChange:p,inputChange:m,updateItemStyles:g}=Rr(),{containerBlock:y,containerType:b,cellIndex:f,effectiveContainerBlock:w,effectiveContainerType:S,effectiveCellIndex:N,effectiveColumnProduct:L}=Qr(),T="product"===S?w:y,I="none"!==S?S:b,$=T?.id,P="product"===S?L?.id??w?.columnProducts?.[N??0]?.id:"product"===b?y?.columnProducts?.[f??0]?.id:void 0,R="bn-BD"===t?.data?.dynamicAiLanguage?"bn-BD":"en",{generateOptions:M}=Zr({mlEmailNodesEndpoint:i?.mlEmailNodesEndpoint,mlGenerationEndpoint:i?.mlGenerationEndpoint,headers:i?.headers||{},templateData:l,blockId:t?.id,containerType:I,containerId:$,productId:P,blockName:t?.data?.name||"Text",blockElementType:t?.data?.type||"p",emailTemplateId:i?.emailTemplateId,companyId:i?.companyId??l?.companyId,aiContentLanguage:R}),[D,U]=a(""),E=u(t.data.styles,"fontSize"),z=null!=E&&""!==E?Number(E):14,[F,O]=a(String(z)),[W,j]=a(""),H=(e,n)=>{const l=xt(t.data);l.styles||(l.styles={desktop:{},mobile:{}}),l.styles.desktop||(l.styles.desktop={}),l.styles.mobile||(l.styles.mobile={}),l.styles[o][e]=n,l.text=Ct(l.text,l.styles.desktop),g(l)},K=e=>{const t=os(e,1,999,14);O(String(t)),H("fontSize",t)},V=()=>{const e=String(W??"").trim();if(""===e){const e=xt(t.data);return e.styles||(e.styles={desktop:{},mobile:{}}),e.styles.desktop||(e.styles.desktop={}),e.styles.mobile||(e.styles.mobile={}),delete e.styles.desktop.lineHeight,delete e.styles.mobile.lineHeight,void g(e)}const n=os(e,1,999,24);j(String(n)),m("lineHeight")(`${n}px`)};r(()=>{O(String(z))},[t?.id,z]);const G=u(t.data.styles,"lineHeight");r(()=>{j(null==G||""===G?"":String(function(e,t=14){if(null==e||""===e)return Math.max(1,Math.round(1.4*Number(t)));const n=String(e).trim(),o=n.match(/^(-?\d*\.?\d+)\s*%$/);if(o){const e=Number(o[1]);if(!Number.isNaN(e))return Math.max(1,Math.round(t*e/100))}const l=n.match(/^(-?\d*\.?\d+)\s*px$/i);if(l){const e=Number(l[1]);if(!Number.isNaN(e))return Math.max(1,Math.round(e))}const a=Number(n);return Number.isNaN(a)?24:a>0&&a<=10?Math.max(1,Math.round(t*a)):Math.max(1,Math.round(a))}(G,z)))},[t?.id,G,z]);const[q,J]=a([]),[Y,X]=a(!1),[Z,Q]=a(""),ee=t.data.contentType??"static",te=t.data.type??"p",ne=String(te).toLowerCase(),oe="p"===ne||""===te?"p":/^h[1-6]$/.test(ne)?ne:"p",le=e=>{if(!c)return;const n=e?"dynamic":"static",o=xt(t.data),l=o.styles?.desktop??{};if(o.contentType=n,"dynamic"===n){if("static"===(t.data.contentType??"static")){const e=t.data.text??"",n=Ct(d("text_content"),l),a=Ct(d("ai_enabled"),l);ls(e).length>0&&e!==n&&e!==a?o[ns]=e:delete o[ns]}o.selectedVariableKey=void 0,o.dynamicVariable=o.dynamicVariable??"",o.dynamicPrompt=o.dynamicPrompt??"",o.dynamicSelectedContent=o.dynamicSelectedContent??"",o.dynamicOptions=Array.isArray(o.dynamicOptions)?o.dynamicOptions:[],o.dynamicAiLanguage="bn-BD"===o.dynamicAiLanguage?"bn-BD":"en";const e=o.dynamicSelectedContent??"",n="string"==typeof e?ls(e):"",a=Ct(d("ai_enabled"),l);o.text=n.length>0?Ct(e,l):a}else{const e=o[ns];"string"==typeof e&&ls(e).length>0?o.text=Ct(e,l):o.text=Ct(d("text_content"),l),delete o[ns]}g(o)},ae=async()=>{const e=t.data.dynamicVariable??"",n=t.data.dynamicPrompt??D??"";X(!0),Q("");try{const o=await M(e,n,{previousPrompt:t.data.dynamicPreviousPrompt??"",previousSelectedAiContent:ls(t.data.dynamicSelectedContent||t.data.text)});if(o&&"object"==typeof o&&!Array.isArray(o))return o.i18nKey?Q(d(o.i18nKey)):o.error?Q(String(o.error)):Q(d("ml_no_variations")),void J([]);if(Array.isArray(o)&&o.length>0){Q(""),J(o);const e=xt(t.data);e.dynamicOptions=o,e.dynamicPrompt=n,e.dynamicPreviousPrompt=n,g(e)}else Q(d("ml_no_variations")),J([])}catch(e){console.error("[TextStyleSettings] Error during content generation:",e),Q(e&&"object"==typeof e&&"message"in e?String(e.message):d("ml_generation_unexpected_error")),J([])}finally{X(!1)}},ie=e=>{const n=e.target.value;U(n),Q("");const o=xt(t.data);o.dynamicPrompt=n,g(o)},re=e=>{const n=xt(t.data);n.dynamicAiLanguage="bn-BD"===e?"bn-BD":"en",g(n)};return Je("div",{className:e?"ee-settings-block-form ee-discount-simple-text-settings":"margin-y-30 ee-settings-block-form",children:[(()=>{const e=Je("div",{className:za("ee-text-ai-usp-row","ee-settings-row","ee-text-ai-toggle-row",!c&&"ee-text-ai-usp-row--disabled"),children:[Je("span",{className:"ee-text-ai-label-with-help",children:[d("ai_enabled"),qe(v,{title:d("tooltip_write_using_ai"),children:qe("span",{className:"ee-help-icon ee-text-ai-help-trigger","aria-label":d("tooltip_write_using_ai"),onClick:e=>e.stopPropagation(),children:qe(B,{icon:A})})})]}),qe(pr,{checked:"dynamic"===ee,onChange:le,disabled:!c})]});return qe(Ye,{children:Je("div",{className:"ee-text-settings-content-wrap",children:[qe(_r,{children:d("content")}),Je("div",{className:"ee-text-settings-content-gap",children:[qe(vr,{label:d("heading_type"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:oe,onChange:e=>{return(n=e,()=>{const e=String(n??"p").toLowerCase(),o=t.data.styles?.desktop??{},l="p"!==e&&/^h[1-6]$/.test(e)?e:"p";let a,i,r;if("p"===l)a=14,i=20,r="400";else{switch(a=o.fontSize,l){case"h1":a=22;break;case"h2":a=20;break;case"h3":a=18;break;case"h4":a=16;break;case"h5":a=15;break;case"h6":a=14;break;default:a=null!=a&&""!==a&&Number(a)||14}i=Math.max(1,Math.round(1.4*Number(a))),r="bold"}const s=xt(t.data);s.type=l;const c="p"===l?{textTransform:"none",letterSpacing:"0em"}:{},d={...o,...c,fontSize:a,lineHeight:`${i}px`,fontWeight:r},u={...t.data.styles?.mobile??{},...c,fontSize:a,lineHeight:`${i}px`,fontWeight:r};s.styles={...s.styles??{},desktop:d,mobile:u},s.text=Ct(s.text,d),g(s)})();var n},items:[{value:"p",label:d("body_paragraph")},{value:"h1",label:"H1"},{value:"h2",label:"H2"},{value:"h3",label:"H3"},{value:"h4",label:"H4"}],"aria-label":d("heading_type")})}),qe("div",{className:"ee-text-ai-slot",children:c?e:qe(v,{title:d("tooltip_write_using_ai_unavailable"),children:e})}),c&&"dynamic"===ee?Je(Ye,{children:[Je("div",{className:"ee-dynamic-prompt-block ee-dynamic-prompt-block--with-heading",children:[Je("div",{className:"ee-dynamic-language-row",children:[qe("span",{className:"ee-prompt-label",children:d("ai_output_language")}),Je(x,{className:"input-width ee-dynamic-language-select",value:R,onChange:re,getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:[qe(x.Option,{value:"en",children:d("ai_output_language_en")}),qe(x.Option,{value:"bn-BD",children:d("ai_output_language_bn")})]})]}),Je("span",{className:"ee-prompt-label",children:[d("dynamic_prompt_help"),qe(v,{title:d("tooltip_dynamic_prompt"),children:qe("span",{className:"ee-help-icon","aria-label":"Help",children:qe(B,{icon:A})})})]}),qe(es,{rows:3,value:t.data.dynamicPrompt??D,onChange:ie,placeholder:d("dynamic_prompt_help")}),qe(_,{type:"primary",size:"small",block:!0,loading:Y,disabled:!(t.data.dynamicPrompt??D??"").trim(),onClick:ae,children:d("generate")}),Z?qe("div",{className:"ee-ml-generation-error",role:"alert",children:Z}):null]}),(t.data.dynamicOptions?.length>0||q.length>0)&&Je("div",{className:"ee-sample-content-block",children:[qe("div",{className:"card-item-title",children:d("select_content")}),(t.data.dynamicOptions||q).map((e,n)=>{const o="string"==typeof e?e:String(e),l=t.data.dynamicSelectedContent??"",a=(("string"==typeof l?ls(l):"").length>0?l:t.data.text??"").replace(/<[^>]+>/g,"").replace(/\s+/g," ").trim(),i=o.replace(/\s+/g," ").trim(),r=a.length>0&&a===i;return qe("div",{className:za("ee-sample-content-item",r&&"ee-sample-content-item-selected"),onClick:()=>(e=>{const n=xt(t.data);n.dynamicSelectedContent=e,n.text=e,g(n),Array.isArray(n.dynamicOptions)&&n.dynamicOptions.length&&J([...n.dynamicOptions]),Q("")})(e),children:e},n)})]})]}):null]})]})})})(),(()=>{const e=u(t.data.styles,"color"),n=null!=e&&""!==String(e).trim()?e:s?.styles?.color??"#171717",a=u(t.data.styles,"linkColor"),i=u(t.data.styles,"textAlign"),r=u(t.data.styles,"fontFamily"),c=function(e){if(null==e||""===e)return"400";const t=String(e).trim().toLowerCase();if("bold"===t||"bolder"===t)return"700";if("normal"===t||"lighter"===t)return"400";const n=Number(t);return Number.isNaN(n)||n<=450?"400":n<=550?"500":n<=650?"600":"700"}(u(t.data.styles,"fontWeight")),p=u(t.data.styles,"textTransform"),y=null!=p&&""!==String(p).trim()?String(p):"none",b=function(e,t){if(null==e||""===e)return t;const n=String(e).trim().replace(/[a-z%]+$/i,""),o=Number(n);return Number.isNaN(o)?t:o}(u(t.data.styles,"letterSpacing"),0),f=Yo(l),_=Zo(r,l);return Je(Ye,{children:[qe(_r,{children:d("typography")}),qe(vr,{label:d("font_color"),children:qe(cr,{color:n,fallbackColor:s?.styles?.color??"#171717",setColor:({hex:e})=>H("color",e)})}),qe(vr,{label:d("link_color"),children:qe(cr,{color:null!=a&&""!==String(a).trim()?a:"#2faade",setColor:({hex:e})=>((e,n)=>{const l=xt(t.data);l.styles||(l.styles={desktop:{},mobile:{}}),l.styles.desktop||(l.styles.desktop={}),l.styles.mobile||(l.styles.mobile={}),l.styles[o][e]=n,g(l)})("linkColor",e)})}),qe(vr,{label:d("label_align"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:i||"left",onChange:e=>(e=>{const n=xt(t.data);n.styles||(n.styles={desktop:{},mobile:{}}),n.styles.desktop||(n.styles.desktop={}),n.styles.mobile||(n.styles.mobile={}),n.styles[o].textAlign=e,"string"==typeof n.text&&(n.text=n.text.replace(/(\s+style\s*=\s*)(["'])([^"']*)\2/gi,(e,t,n,o)=>{const l=o.replace(/\s*text-align\s*:[^;]+;?/gi,"").replace(/;+\s*$/,"").trim();return l?`${t}${n}${l}${n}`:""})),g(n)})(e),"aria-label":d("text_align"),items:[{value:"left",label:qe(B,{icon:he,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:qe(B,{icon:ye,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:qe(B,{icon:be,className:"tag-style-size"}),iconOnly:!0},{value:"justify",label:qe(B,{icon:fe,className:"tag-style-size"}),iconOnly:!0}]})}),qe(vr,{label:d("font_weight"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:c,onChange:e=>H("fontWeight",e),"aria-label":d("font_weight"),items:[{value:"400",label:"Reg"},{value:"500",label:"Med"},{value:"600",label:"SBd"},{value:"700",label:"Bd"}]})}),qe(vr,{label:d("text_transform"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:y,onChange:e=>H("textTransform",e),"aria-label":d("text_transform"),items:[{value:"none",label:"Aa"},{value:"uppercase",label:"AA"},{value:"capitalize",label:"Cp"}]})}),qe(vr,{label:d("font_family"),children:qe(x,{className:"input-width ee-font-family-select",value:_,showSearch:!0,optionFilterProp:"label",labelRender:({value:e})=>qe("span",{children:Qo(e,l)}),onChange:e=>H("fontFamily",Zo(e,l)),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,options:f})}),qe(vr,{label:d("font_size"),children:qe(C,{className:"input-width ee-settings-input-affix",value:F,options:ts.map(e=>({value:String(e),label:`${e}px`})),onChange:e=>O(String(e??"")),onSelect:e=>K(e),filterOption:!1,getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:qe(h,{addonAfter:"px",onFocus:e=>e?.target?.select?.(),onBlur:()=>K(F),onPressEnter:e=>{K(F),e.currentTarget.blur()},onKeyDown:e=>{if("ArrowUp"!==e.key&&"ArrowDown"!==e.key)return;e.preventDefault();const t="ArrowUp"===e.key?1:-1,n=os(F,1,999,14)+t;K(n)}})})}),qe(vr,{label:d("line_height"),children:qe(h,{className:"input-width ee-settings-input-affix",addonAfter:"px",value:W,onChange:e=>j(e.target.value.replace(/[^\d]/g,"")),onFocus:e=>e?.target?.select?.(),onBlur:V,onPressEnter:e=>{V(),e.currentTarget.blur()}})}),qe(vr,{label:d("letter_spacing"),children:qe(k,{className:"input-width ee-settings-input-affix",addonAfter:"px",min:-20,max:100,step:.1,value:b,onFocus:e=>e?.target?.select?.(),onChange:e=>{const t=null==e||Number.isNaN(Number(e))?0:Number(e);m("letterSpacing")(`${t}px`)}})})]})})(),Je(Ye,{children:[qe(_r,{children:d("spacing")||"Spacing"}),qe(vr,{label:d("label_padding"),children:qe(mr,{padding:{paddingTop:u(t.data.styles,"paddingTop"),paddingRight:u(t.data.styles,"paddingRight"),paddingLeft:u(t.data.styles,"paddingLeft"),paddingBottom:u(t.data.styles,"paddingBottom")},setPadding:p})})]})]})};function is(e){if(null==e)return!0;const t=String(e).trim().toLowerCase();return""===t||"transparent"===t||"rgba(0, 0, 0, 0)"===t}function rs(e,t){const n=Bl(t);if(!e||"object"!=typeof e)return n;for(const t of["desktop","mobile"]){const o=e[t]?.backgroundColor;if(!is(o))return Tl(o)?n:o}for(const t of["desktop","mobile"]){const n=e[t]?.borderColor;if(!is(n))return n}return n}function ss(e,t,n){"solid"===t?(e.borderWidth=0,e.borderStyle="solid",e.borderColor=n,e.backgroundColor=n,e.color=function(e){const t=String(e??"").trim().replace(/^#/,"");if(3!==t.length&&6!==t.length)return"#ffffff";const n=(e=>3===e.length?e.split("").map(e=>e+e).join(""):e)(t),o=parseInt(n.slice(0,2),16),l=parseInt(n.slice(2,4),16),a=parseInt(n.slice(4,6),16);return[o,l,a].every(e=>Number.isFinite(e))&&(.299*o+.587*l+.114*a)/255>.62?"#171717":"#ffffff"}(n),e.textDecoration="none"):"outline"===t?(e.borderWidth=2,e.borderStyle="solid",e.borderColor=n,e.backgroundColor="transparent",e.color=n,e.textDecoration="none"):"ghost"===t?(e.borderWidth=0,e.borderStyle="none",e.borderColor="transparent",e.backgroundColor="transparent",e.color=n,e.textDecoration="none"):"underline"===t&&(e.borderWidth=0,e.borderStyle="none",e.borderColor="transparent",e.backgroundColor="transparent",e.color=n,e.textDecoration="underline")}const cs=()=>{const{currentItem:e,previewMode:t,templateData:o}=n(Ln),[i,r]=a(""),{t:s}=ja(),{containerBlock:c,containerType:d,contentIndex:u,effectiveContainerBlock:p,effectiveContainerType:m,effectiveCellIndex:g,effectiveColumnProduct:y}=Qr(),b="none"!==m?m:d,f=y??p?.columnProducts?.[g]??c?.columnProducts?.[u]??null,_=l(()=>({columnIndex:"product"===m?g:u,columnProduct:f}),[m,g,u,f]),v=l(()=>Yo(o),[o]),w=["header","footer","discount","product"].includes(b),{findStyleItem:S,colorChange:C,paddingChange:L,inputChange:T,updateItemStyles:A}=Rr(),{urlOptions:I}=l(()=>function(e,t,n={}){const o="product"===e?Uo:Do;return{labelOptions:Mo.map(({variableKey:e,labelKey:o})=>({value:co(e),labelKey:o,pasteValue:$o(t,e,n)})),urlOptions:o.map(({variableKey:e,labelKey:o})=>({value:co(e),labelKey:o,pasteValue:$o(t,e,n)}))}}(b,o,_),[b,o,_]);return Je("div",{className:"margin-y-30 ee-settings-block-form",children:[(()=>{const{linkURL:t,text:n,labelVariable:l,urlVariable:a}=e.data,c=n?.replace(/<[^>]+>/g,"").trim()??"",d=l||c&&/\{\{\w+\}\}/.test(c),u=l?l.replace(/^\{\{|\}\}$/g,"").trim():c.match(/\{\{(\w+)\}\}/)?.[1]||"CTALabel",p=o&&d?$o(o,u,_):null,m=null==p||String(p).startsWith("{{")?c:p,g=a?a.replace(/^\{\{|\}\}$/g,"").trim():"",y=null!=t?String(t).trim():"",b=y.match(/^\{\{(\w+)\}\}$/),f=a||(!a&&b?y:null)||void 0,k=b&&o?$o(o,b[1],_):null,v=null==k||"string"!=typeof k||String(k).startsWith("{{")?"":String(k).trim(),S=!y&&g&&o?$o(o,g,_):null,C=null==S||"string"!=typeof S||S.startsWith("{{")?"":String(S).trim(),N=v||C||y||"",L=e=>{r((e=>{const t=String(e??"").trim(),n=lt(t,!1,{allowMailtoTel:!0});return n?"empty"===n?"Button -> Link URL is empty. Add a destination like 'https://example.com' or 'mailto:support@example.com'.":"blocked_scheme"===n?`Button -> Link URL ('${t}') uses a blocked protocol. Use https://, http://, mailto:, or tel:.`:"duplicate_protocol"===n?`Button -> Link URL ('${t}') repeats the protocol. Keep only one, e.g. 'https://example.com'.`:"missing_hostname_dot"===n?`Button -> Link URL ('${t}') is missing a valid hostname. Use a full domain like 'https://example.com'.`:"invalid_protocol"===n?`Button -> Link URL ('${t}') has an unsupported protocol. Use https://, http://, mailto:, or tel:.`:`Button -> Link URL ('${t}') is invalid. Fix the URL format, for example 'https://example.com'.`:""})(e))};return Je(Ye,{children:[qe(_r,{children:s("button_action")}),qe(vr,{label:s("button_text"),children:qe(h,{className:"width-full",value:m,onChange:t=>{const n=t.target.value,o=xt(e.data);o.text=n,n&&n.startsWith("{{")||(o.labelVariable=""),A(o)},placeholder:s("button_label_manual")})}),w&&I.length>0?qe(vr,{label:s("button_url_variable"),children:qe(x,{className:"ee-variable-select width-full",placeholder:s("button_url_manual"),allowClear:!0,value:f,onChange:t=>{const n=xt(e.data);if(!t){n.urlVariable="";const e=String(n.linkURL??"").trim();return/^\{\{\w+\}\}$/.test(e)?n.linkURL="":n.linkURL=n.linkURL||"",void A(n)}const o=I.find(e=>e.value===t);n.urlVariable=t;const l=o?o.pasteValue:t;n.linkURL="string"==typeof l?l.replace(/^https?:\/\//,""):"",A(n)},getPopupContainer:()=>document.querySelector(".right-settings")||document.body,options:[{value:"",label:s("button_url_manual")},...I.map(e=>({value:e.value,label:s(e.labelKey)}))]})}):null,qe(vr,{label:s("link_url"),children:Je(Ye,{children:[qe(h,{className:"width-full",value:N,onChange:t=>{const n=t.target.value,o=xt(e.data);o.linkURL=n,n&&n.startsWith("{{")||(o.urlVariable=""),A(o),i&&L(n)},onBlur:e=>L(e.target.value),status:i?"error":"",placeholder:s("link_url_placeholder")}),i?qe("div",{className:"ee-field-error",role:"alert",children:i}):null]})})]})})(),(()=>{const n=S(e.data.styles,"width"),l=S(e.data.styles,"borderRadius"),a="number"==typeof l?l:parseInt(String(l||"").replace("px",""),10)||0,i=e.data.contentStyles?.[t]?.textAlign??"center",r="left"===i||"center"===i||"right"===i?i:"center",c=S(e.data.styles,"color"),d=S(e.data.styles,"fontFamily"),u=S(e.data.styles,"fontSize"),p=S(e.data.styles,"lineHeight"),m=function(e,t){const n=e?.buttonAccentColor;return null==n||is(n)?rs(e?.styles,t):n}(e.data,o),g=e.data.buttonVariant??"solid",h=e.data.hoverBg??"",y=e.data.hoverColor??"",b=S(e.data.styles,"letterSpacing")??"0em",f=S(e.data.styles,"textTransform")??"none",_=S(e.data.styles,"textDecoration")??"none",w=S(e.data.styles,"borderWidth"),I=S(e.data.styles,"borderStyle")??"solid",$=S(e.data.styles,"borderColor")??"#000000",P=e.data.shadowPreset??"none",R=t=>n=>{const o=xt(e.data);o[t]=n,A(o)},M={none:"",sm:"0 1px 2px rgba(0,0,0,0.12)",md:"0 4px 6px rgba(0,0,0,0.18)",lg:"0 10px 20px rgba(0,0,0,0.22)"},D=()=>document.querySelector(".right-settings")||document.body;return Je(Ye,{children:[qe(_r,{children:s("button_styles")}),qe(vr,{label:s("button_variant")||"Variant",children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:g,onChange:t=>(t=>{const n=xt(e.data);n.buttonVariant=t,n.styles=n.styles??{desktop:{},mobile:{}},n.styles.desktop={...n.styles.desktop??{}},n.styles.mobile={...n.styles.mobile??{}};const l=null==n.buttonAccentColor||is(n.buttonAccentColor)?rs(n.styles,o):n.buttonAccentColor;n.buttonAccentColor=l,ss(n.styles.desktop,t,l),ss(n.styles.mobile,t,l),A(n)})(t),"aria-label":s("button_variant")||"Variant",items:[{value:"solid",label:"Solid"},{value:"outline",label:"Outline"},{value:"ghost",label:"Ghost"},{value:"underline",label:"Underline"}]})}),qe(vr,{layout:"toggle",label:s("full_width")||"Full width",children:qe(pr,{checked:"auto"!==n,onChange:()=>{const e="auto"===n?"100%":"auto";T("width")(e)}})}),"auto"!==n?qe(vr,{label:s("width"),children:qe(N,{value:Number(String(n).replace("%","")),onChange:e=>T("width")(e+"%")})}):null,"auto"!==n?qe(vr,{label:s("align"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:r,onChange:n=>(n=>{const o=xt(e.data);o.contentStyles||(o.contentStyles={desktop:{},mobile:{}}),o.contentStyles[t]={...o.contentStyles[t]||{},textAlign:n},A(o)})(n),"aria-label":s("align"),items:[{value:"left",label:qe(B,{icon:he,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:qe(B,{icon:ye,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:qe(B,{icon:be,className:"tag-style-size"}),iconOnly:!0}]})}):null,qe(vr,{label:s("font_color"),children:qe(cr,{color:c,setColor:C("color")})}),qe(vr,{label:s("button_color"),children:qe(cr,{color:m,setColor:({hex:t})=>{const n=xt(e.data);n.styles=n.styles??{desktop:{},mobile:{}},n.styles.desktop={...n.styles.desktop??{}},n.styles.mobile={...n.styles.mobile??{}},n.buttonAccentColor=t;const o=n.buttonVariant??"solid";ss(n.styles.desktop,o,t),ss(n.styles.mobile,o,t),A(n)}})}),qe(vr,{label:s("hover_bg_color")||"Hover bg",children:qe(cr,{color:h||m,setColor:e=>R("hoverBg")(e.hex)})}),qe(vr,{label:s("hover_text_color")||"Hover text",children:qe(cr,{color:y||c,setColor:e=>R("hoverColor")(e.hex)})}),qe(vr,{label:s("font_family"),children:qe(x,{className:"width-full",showSearch:!0,optionFilterProp:"label",value:Zo(d??"sans-serif",o),onChange:e=>T("fontFamily")(Zo(e,o)),labelRender:({value:e})=>qe("span",{children:Qo(e,o)}),getPopupContainer:D,options:v})}),qe(vr,{label:s("font_size"),children:qe(k,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",value:u,onFocus:e=>e?.target?.select?.(),onChange:T("fontSize")})}),qe(vr,{label:s("line_height"),children:qe(k,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"%",value:Number(String(p||"100").replace("%","")),onFocus:e=>e?.target?.select?.(),onChange:e=>T("lineHeight")(`${e??0}%`)})}),qe(vr,{label:s("letter_spacing")||"Letter spacing",children:qe(k,{className:"input-width ee-settings-input-affix",addonAfter:"em",step:.01,value:parseFloat(String(b).replace("em",""))||0,onFocus:e=>e?.target?.select?.(),onChange:e=>T("letterSpacing")(`${e??0}em`)})}),qe(vr,{label:s("text_transform")||"Transform",children:qe(x,{className:"width-full",value:f,onChange:T("textTransform"),getPopupContainer:D,options:[{value:"none",label:"None"},{value:"uppercase",label:"UPPERCASE"},{value:"lowercase",label:"lowercase"},{value:"capitalize",label:"Capitalize"}]})}),qe(vr,{label:s("text_decoration")||"Decoration",children:qe(x,{className:"width-full",value:_,onChange:T("textDecoration"),getPopupContainer:D,options:[{value:"none",label:"None"},{value:"underline",label:"Underline"},{value:"line-through",label:"Strikethrough"}]})}),qe(_r,{children:s("border")||"Border"}),qe(vr,{label:s("border_width")||"Width",children:qe(k,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",value:"number"==typeof w?w:parseInt(String(w||"0"),10)||0,onFocus:e=>e?.target?.select?.(),onChange:e=>T("borderWidth")(Number(e)||0)})}),qe(vr,{label:s("border_style")||"Style",children:qe(x,{className:"width-full",value:I,onChange:T("borderStyle"),getPopupContainer:D,options:[{value:"solid",label:s("solid")},{value:"dashed",label:s("dashed")},{value:"dotted",label:s("dotted")},{value:"none",label:s("video_border_none")}]})}),qe(vr,{label:s("border_color"),children:qe(cr,{color:$,setColor:e=>T("borderColor")(e.hex)})}),qe(vr,{label:s("border_radius"),children:qe(k,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",value:a,onFocus:e=>e?.target?.select?.(),onChange:e=>T("borderRadius")(Number(e)||0)})}),qe(_r,{children:s("shadow")||"Shadow"}),qe(vr,{label:s("shadow_preset")||"Preset",children:qe(x,{className:"width-full",value:P,onChange:n=>{const o=xt(e.data);o.shadowPreset=n,o.styles=o.styles??{},o.styles[t]=o.styles[t]??{},o.styles[t].boxShadow=M[n]??"",A(o)},getPopupContainer:D,options:[{value:"none",label:"None"},{value:"sm",label:"Small"},{value:"md",label:"Medium"},{value:"lg",label:"Large"}]})}),qe(_r,{children:s("button_padding")}),qe(vr,{label:s("label_padding"),children:qe(mr,{padding:{paddingTop:S(e.data.styles,"paddingTop"),paddingRight:S(e.data.styles,"paddingRight"),paddingLeft:S(e.data.styles,"paddingLeft"),paddingBottom:S(e.data.styles,"paddingBottom")},setPadding:L})})]})})(),Je(Ye,{children:[qe(_r,{children:s("spacing")}),qe(vr,{label:s("label_padding"),children:qe(mr,{padding:{paddingTop:S(e.data.contentStyles,"paddingTop"),paddingRight:S(e.data.contentStyles,"paddingRight"),paddingLeft:S(e.data.contentStyles,"paddingLeft"),paddingBottom:S(e.data.contentStyles,"paddingBottom")},setPadding:n=>{const o=xt(e.data);o.contentStyles[t]={...o.contentStyles[t],...n},A(o)}})})]})]})},ds=()=>{const{currentItem:e,previewMode:t}=n(Ln),{t:o}=ja(),{findStyleItem:l,colorChange:a,updateItemStyles:i,inputChange:r}=Rr(),s=n=>{const o=xt(e.data);o.contentStyles[t]={...o.contentStyles[t],...n},i(o)};return qe("div",{className:"margin-y-30 ee-settings-block-form",children:(()=>{const n=l(e.data.contentStyles,"textAlign"),c=["left","center","right","justify"].includes(n)?n:"center",d=(e=>{if(null==e)return 100;if("number"==typeof e&&Number.isFinite(e))return Math.min(100,Math.max(0,e));const t=String(e).trim();if(/%$/.test(t)){const e=Number(t.replace(/%/,""));return Number.isFinite(e)?Math.min(100,Math.max(0,e)):100}const n=Number.parseFloat(t);return Number.isFinite(n)?Math.min(100,Math.max(0,n)):100})(l(e.data.styles,"width")),u=l(e.data.styles,"borderTopColor"),p=l(e.data.styles,"borderTopWidth"),m=l(e.data.styles,"borderTopStyle"),g=[{label:o("solid"),value:"solid"},{label:o("dotted"),value:"dotted"},{label:o("dashed"),value:"dashed"}];return Je(Ye,{children:[qe(_r,{children:o("divider")}),qe(vr,{label:o("divider_type"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:m||"solid",onChange:e=>r("borderTopStyle")(e),"aria-label":o("divider_type"),items:g.map(e=>({value:e.value,label:e.label}))})}),qe(vr,{label:o("height"),children:qe(k,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",value:"number"==typeof p?p:0,onFocus:e=>e?.target?.select?.(),onChange:e=>r("borderTopWidth")("number"==typeof e?e:0)})}),qe(vr,{label:o("divider_color"),children:qe(cr,{color:u,setColor:a("borderTopColor")})}),qe(vr,{label:o("width"),children:qe(N,{min:0,max:100,value:d,tooltip:{formatter:e=>`${e}%`},onChange:e=>r("width")(`${e}%`)})}),qe(vr,{label:o("align"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:c,onChange:n=>(n=>{const o=xt(e.data);o.contentStyles[t]={...o.contentStyles[t],textAlign:n},i(o)})(n),"aria-label":o("align"),items:[{value:"left",label:qe(B,{icon:he,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:qe(B,{icon:ye,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:qe(B,{icon:be,className:"tag-style-size"}),iconOnly:!0},{value:"justify",label:qe(B,{icon:fe,className:"tag-style-size"}),iconOnly:!0}]})}),qe(_r,{children:o("spacing")}),qe(vr,{label:o("label_padding"),children:qe(mr,{padding:{paddingTop:l(e.data.contentStyles,"paddingTop"),paddingRight:l(e.data.contentStyles,"paddingRight"),paddingLeft:l(e.data.contentStyles,"paddingLeft"),paddingBottom:l(e.data.contentStyles,"paddingBottom")},setPadding:s})})]})})()})};function us(e,t,n,o){const l=Number.parseInt(String(e??""),10);return Number.isNaN(l)?o:Math.min(n,Math.max(t,l))}const ps=()=>{const{currentItem:e}=n(Ln),{t:t}=ja(),{findStyleItem:o,inputChange:l}=Rr(),a=o(e.data.styles,"height"),i="number"==typeof a?a:parseInt(a,10)||16;return Je("div",{className:"margin-y-30 ee-settings-block-form",children:[qe(_r,{children:t("spacer")}),qe(vr,{label:Je("span",{className:"flex items-center gap-2",children:[qe(B,{icon:re,className:"tag-style-size"}),t("height")]}),children:qe(k,{min:0,max:200,step:1,className:"input-width ee-settings-input-affix",addonAfter:"px",value:i,onFocus:e=>e?.target?.select?.(),onChange:e=>l("height")(us(e,0,200,0)),onBlur:e=>l("height")(us(e?.target?.value,0,200,0)),onKeyDown:e=>{if("ArrowUp"!==e.key&&"ArrowDown"!==e.key)return;e.preventDefault();const t="ArrowUp"===e.key?1:-1;l("height")(us(i+t,0,200,0))}})})]})};function ms(e){if(null==e||""===e)return"400";const t=String(e).trim().toLowerCase();if("normal"===t||"regular"===t)return"400";if("bold"===t)return"700";if("bolder"===t)return"700";if("lighter"===t)return"300";if("light"===t)return"300";const n=Number(t);return Number.isNaN(n)?"400":n<=350?"300":n<=500?"400":n<=650?"600":"700"}const gs=new Set(["|","•","—","/","·"," "]);function hs(e){return[...String(e??"")].filter(e=>gs.has(e)).join("")}const ys=()=>{const{currentItem:e,previewMode:t,templateData:l}=n(Ln),{t:r}=ja(),{findStyleItem:s,updateItemStyles:d,colorChange:u,inputChange:p}=Rr(),{list:m=[],separator:g=" | "}=e.data;c(()=>{const t=e?.data?.separator,n=hs(String(t??""));if(String(t??"")!==n){const t=xt(e.data);t.separator=n,d(t)}},[e?.id,e?.data,d]);const[y,b]=a(!1),[f,_]=a(null),[v,w]=a({}),S=i(null),C=()=>document.querySelector(".right-settings")||document.body,N=(t,n)=>{const o=xt(e.data);o[t]=n,"list"===t&&(o.useNavigationLinks=!1),d(o)},L=(e,t,n)=>{const o=((e,t,n)=>{const o=String(e??"").trim(),l=`Menu item ${t+1}${n?` (${n})`:""} -> URL`,a=lt(o,!1,{allowMailtoTel:!0});return a?"empty"===a?`${l} is empty. Add a destination like 'https://example.com'.`:"blocked_scheme"===a?`${l} ('${o}') uses a blocked protocol. Use https://, http://, mailto:, or tel:.`:"duplicate_protocol"===a?`${l} ('${o}') repeats the protocol. Keep one protocol, e.g. 'https://example.com'.`:"missing_hostname_dot"===a?`${l} ('${o}') is missing a valid hostname. Use a full domain like 'https://example.com'.`:"invalid_protocol"===a?`${l} ('${o}') has an unsupported protocol. Use https://, http://, mailto:, or tel:.`:`${l} ('${o}') is invalid. Fix it to a valid URL like 'https://example.com'.`:""})(e,t,n);w(e=>{if(!o&&!e[t])return e;const n={...e};return o?n[t]=o:delete n[t],n})},T=o(St(e=>{e.preventDefault();const t=S.current,n=e.target?.closest?.(".social-link-item[data-index]");if(!n||!t?.contains(n))return;const o=Array.from(t.querySelectorAll(".social-link-item[data-index]")).indexOf(n);if(-1===o)return;const l=f,a=xt(m);null==l||l===o||a.length<2||([a[o],a[l]]=[a[l],a[o]],_(o),N("list",a))},50),[f]),A=Yo(l),I=Zo(s(e.data.styles,"fontFamily"),l),$=[{label:r("same_tab"),value:"_self"},{label:r("new_tab"),value:"_blank"}],P=e.data.layoutMode??"nav-only",R=Boolean(e.data.showLogo),M=Boolean(e.data.borderBottom),D=e.data.borderBottomColor??"#e5e7eb",U=e.data.borderBottomWidth??1,E=e.data.mobileLayout??"stack",z=e.data.linkGapPx,F="number"==typeof z&&Number.isFinite(z)?z:0,O=Boolean(e.data.linkUnderline),W=s(e.data.contentStyles,"textAlign"),j=["left","center","right"].includes(W)?W:"center";return Je("div",{className:"margin-y-30 ee-settings-block-form",children:[qe(_r,{children:r("menu_layout")||"Menu layout"}),qe(vr,{label:r("mobile_layout")||"Mobile layout",children:qe(x,{className:"width-full",value:E,onChange:e=>N("mobileLayout",e),getPopupContainer:C,options:[{value:"stack",label:r("stack")||"Stack"},{value:"inline",label:r("inline")||"Inline"}]})}),["logo-left","logo-right","stacked","logo-only"].includes(P)&&Je(Ye,{children:[qe(_r,{children:r("logo_section")}),qe(vr,{layout:"toggle",label:r("show_logo"),children:qe(pr,{checked:R,onChange:e=>N("showLogo",e)})}),R?Je(Ye,{children:[qe(vr,{label:r("logo_url")||"Logo URL",children:qe(h,{className:"width-full",placeholder:"https://...",value:e.data.logoSrc??"",onChange:e=>N("logoSrc",e.target.value)})}),qe(vr,{label:r("logo_text")||"Logo text",children:qe(h,{className:"width-full",placeholder:r("logo_text_placeholder")||"Brand",value:e.data.logoText??"",onChange:e=>N("logoText",e.target.value)})}),qe(vr,{label:r("logo_alt")||"Alt text",children:qe(h,{className:"width-full",placeholder:"Logo",value:e.data.logoAlt??"",onChange:e=>N("logoAlt",e.target.value)})}),qe(vr,{label:r("logo_link")||"Logo link",children:qe(h,{className:"width-full",value:e.data.logoHref??"",onChange:e=>N("logoHref",e.target.value),placeholder:r("link_url_placeholder")||"example.com"})}),qe(vr,{label:r("logo_max_width"),children:qe(k,{min:20,max:400,className:"input-width ee-settings-input-affix",addonAfter:"px",value:e.data.logoMaxWidth??120,onFocus:e=>e?.target?.select?.(),onChange:e=>N("logoMaxWidth",e??120)})})]}):null]}),qe(_r,{children:r("menu_items")}),qe("div",{ref:S,onDragOver:T,className:"margin-top-12",children:m.map((e,t)=>qe("div",{"data-index":t,draggable:!0,onDragStart:()=>{b(!0),_(t)},onDragEnd:e=>{e.currentTarget?.classList?.remove("social-link-item-current"),b(!1),_(null)},className:za("social-link-item","cursor-grab",y&&"social-link-item-drag_start",f===t?"social-link-item-current":"border-transparent"),children:Je("div",{className:"social-link-item-content ee-menu-item-content",children:[Je("div",{className:"ee-menu-item-header flex items-center justify-between margin-bottom-8",children:[Je("div",{className:"flex items-center ee-menu-item-drag-row",children:[qe("span",{className:"social-link-item-drag-handle ee-menu-item-drag-handle","aria-hidden":!0,children:qe(B,{icon:_e,className:"social-link-item-drag-handle-icon"})}),Je("span",{className:"font-semibold",children:[r("menu_item")," ",t+1]})]}),qe("div",{className:"social-link-item-icon social-link-item-icon-slate ee-menu-item-delete",role:"button",tabIndex:0,onClick:()=>N("list",m.filter((e,n)=>n!==t)),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),N("list",m.filter((e,n)=>n!==t)))},children:qe(B,{icon:J,className:"social-link-item-icon-svg social-link-item-icon-svg-deep"})})]}),Je("div",{className:"ee-menu-item-fields ee-settings-stack-flat",children:[qe(vr,{label:r("label"),children:qe(h,{className:"width-full ee-menu-item-input",value:e.label||"",onChange:e=>N("list",m.map((n,o)=>o===t?{...n,label:e.target.value}:n)),placeholder:r("page")||"Page"})}),Je(vr,{label:r("url"),children:[qe(h,{className:"width-full ee-menu-item-input",value:e.url||"",status:v[t]?"error":"",onChange:n=>{const o=n.target.value;N("list",m.map((e,n)=>n===t?{...e,url:o}:e)),v[t]&&L(o,t,e.label)},onBlur:n=>L(n.target.value,t,e.label),placeholder:r("link_url_placeholder")||"example.com"}),v[t]?qe("div",{className:"ee-field-error",role:"alert",children:v[t]}):null]}),qe(vr,{label:r("target"),children:qe(x,{className:"width-full ee-menu-item-input",value:e.target||"_self",onChange:e=>N("list",m.map((n,o)=>o===t?{...n,target:e}:n)),getPopupContainer:C,children:$.map(e=>qe(x.Option,{value:e.value,children:e.label},e.value))})})]})]})},t))}),Je("button",{type:"button",className:"menu-add-new-item margin-top-12",onClick:()=>N("list",m.concat({label:r("page")||"Page",url:"",target:"_self"})),children:[qe("span",{className:"menu-add-new-item-icon",children:"+"})," ",r("add_new_item")]}),qe(_r,{className:"margin-top-18",children:r("menu_styles")}),qe(vr,{label:r("font_family"),children:qe(x,{className:"width-full ee-font-family-select",value:I,showSearch:!0,optionFilterProp:"label",labelRender:({value:e})=>qe("span",{children:Qo(e,l)}),onChange:e=>p("fontFamily")(Zo(e,l)),getPopupContainer:C,options:A})}),qe(vr,{label:r("font_size"),children:qe(k,{min:8,max:72,className:"input-width ee-settings-input-affix",addonAfter:"px",value:s(e.data.styles,"fontSize"),onFocus:e=>e?.target?.select?.(),onChange:p("fontSize")})}),qe(vr,{label:r("letter_spacing"),children:qe(k,{className:"input-width ee-settings-input-affix",addonAfter:"px",value:s(e.data.styles,"letterSpacing"),onFocus:e=>e?.target?.select?.(),onChange:p("letterSpacing")})}),qe(vr,{label:r("text_color"),children:qe(cr,{color:s(e.data.styles,"color"),setColor:u("color")})}),qe(vr,{label:r("link_color"),children:qe(cr,{color:s(e.data.styles,"linkColor")||s(e.data.styles,"color"),setColor:u("linkColor")})}),qe(vr,{label:r("align"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:j,onChange:n=>(n=>{const o=xt(e.data);o.contentStyles||(o.contentStyles={desktop:{},mobile:{}}),o.contentStyles[t]={...o.contentStyles[t]??{},textAlign:n},d(o)})(n),"aria-label":r("align"),items:[{value:"left",label:qe(B,{icon:he,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:qe(B,{icon:ye,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:qe(B,{icon:be,className:"tag-style-size"}),iconOnly:!0}]})}),qe(vr,{label:r("separator"),hint:r("menu_separator_allowed_hint"),children:qe(h,{className:"width-full ee-menu-separator-input",value:hs(g),onChange:e=>N("separator",hs(e.target.value)),placeholder:r("menu_separator_placeholder")})}),qe(vr,{label:r("menu_link_gap")||"Link spacing",children:qe(k,{min:0,max:96,className:"input-width ee-settings-input-affix",addonAfter:"px",value:F,onFocus:e=>e?.target?.select?.(),onChange:t=>(t=>{const n="number"==typeof t&&Number.isFinite(t)&&t>=0?Math.min(96,t):0,o=xt(e.data);o.linkGapPx=n,d(o)})("number"==typeof t?t:0)})}),qe(vr,{layout:"toggle",label:r("menu_underline_links")||"Underline links",children:qe(pr,{checked:O,onChange:t=>{const n=xt(e.data);n.linkUnderline=!!t,d(n)}})}),qe(vr,{label:r("font_weight")||"Font weight",children:qe(x,{className:"width-full",value:ms(s(e.data.styles,"fontWeight")),onChange:p("fontWeight"),getPopupContainer:C,options:[{value:"300",label:r("font_weight_light")||"Light"},{value:"400",label:r("font_weight_regular")||"Regular"},{value:"600",label:r("font_weight_semibold")||"Semi-bold"},{value:"700",label:r("font_weight_bold")||"Bold"}]})}),qe(vr,{label:r("text_transform")||"Text transform",children:qe(x,{className:"width-full",value:s(e.data.styles,"textTransform")??"none",onChange:p("textTransform"),getPopupContainer:C,options:[{value:"none",label:"None"},{value:"uppercase",label:"UPPERCASE"},{value:"capitalize",label:"Capitalize"}]})}),qe(_r,{children:r("border_bottom")||"Border bottom"}),qe(vr,{layout:"toggle",label:r("show_border_bottom"),children:qe(pr,{checked:M,onChange:e=>N("borderBottom",e)})}),M?Je(Ye,{children:[qe(vr,{label:r("border_color")||"Color",children:qe(cr,{color:D,setColor:({hex:e})=>N("borderBottomColor",e)})}),qe(vr,{label:r("border_width")||"Width",children:qe(k,{min:1,max:8,className:"input-width ee-settings-input-affix",addonAfter:"px",value:U,onFocus:e=>e?.target?.select?.(),onChange:e=>N("borderBottomWidth",e??1)})})]}):null,qe(_r,{className:"ee-menu-settings-padding-heading",children:r("padding_settings")}),qe(vr,{children:qe(mr,{padding:{paddingTop:s(e.data.contentStyles,"paddingTop"),paddingRight:s(e.data.contentStyles,"paddingRight"),paddingLeft:s(e.data.contentStyles,"paddingLeft"),paddingBottom:s(e.data.contentStyles,"paddingBottom")},setPadding:n=>{const o=xt(e.data);o.contentStyles||(o.contentStyles={desktop:{},mobile:{}}),o.contentStyles[t]={...o.contentStyles[t]??{},...n},d(o)}})})]})};function bs(e,t){const n=String(e??""),o=parseFloat(n);if(!Number.isFinite(o))return 100;if(n.includes("px")){const e=Number(t)>0?Number(t):600;return Math.min(100,Math.max(0,Math.round(o/e*100)))}return Math.min(100,Math.max(0,Math.round(o)))}const fs=()=>{const{currentItem:e,previewMode:t,templateData:o,apiConfig:r,bodySettings:s}=n(Ln),{t:c}=ja(),{containerBlock:d,containerType:u,contentIndex:p,effectiveContainerBlock:m,effectiveContainerType:g,effectiveCellIndex:y,effectiveColumnProduct:b}=Qr(),f="none"!==g?g:u,_=b??m?.columnProducts?.[y]??d?.columnProducts?.[p]??null,{findStyleItem:C,inputChange:L,updateItemStyles:T}=Rr(),I=t=>{const n=xt(e.data);Object.assign(n,t),T(n)},$=i(null),[P,R]=a(!1),[M,D]=a(""),[U,E]=a(""),z=l(()=>({columnIndex:"product"===g?y:p,columnProduct:_}),[g,y,p,_]),F=l(()=>Wo(f,o,z),[f,o,z]),{uploadImageFile:O,isConfigured:W}=Hr({imageUploadEndpoint:r?.imageUploadEndpoint,headers:r?.headers||{},companyId:r?.companyId,imageUploadQueryParams:r?.imageUploadQueryParams,imageUploadCompanyField:r?.imageUploadCompanyField}),j=n=>{const o=xt(e.data);o.contentStyles[t]={...o.contentStyles[t],...n},T(o)};return Je("div",{className:"margin-y-30 ee-settings-block-form",children:[(()=>{const{linkURL:t}=e.data,n=jo(e.data),o=e=>{E((e=>{const t=String(e??"").trim(),n=lt(t,!1,{allowMailtoTel:!0});return n?"empty"===n?"Image -> Link URL is empty. Add a destination like 'https://example.com' or disable link action.":"blocked_scheme"===n?`Image -> Link URL ('${t}') uses a blocked protocol. Use https://, http://, mailto:, or tel:.`:"duplicate_protocol"===n?`Image -> Link URL ('${t}') repeats the protocol. Keep only one protocol, e.g. 'https://example.com'.`:"missing_hostname_dot"===n?`Image -> Link URL ('${t}') is missing a valid hostname. Use a full URL like 'https://example.com'.`:"invalid_protocol"===n?`Image -> Link URL ('${t}') has an unsupported protocol. Use https://, http://, mailto:, or tel:.`:`Image -> Link URL ('${t}') is invalid. Fix the URL format, for example 'https://example.com'.`:""})(e))};return Je(Ye,{children:[qe(_r,{children:c("image_action")}),qe(vr,{label:c("action_type"),children:Je("div",{className:"ee-settings-row ee-padding-link-sides-row",children:[qe("span",{className:za("link-tag",!n&&"ee-image-link-tag-inactive"),children:c("link")}),qe(pr,{checked:n,onChange:t=>{const n=xt(e);n.data.linkEnabled=Boolean(t),T(n.data)}})]})}),n?qe(vr,{label:c("link_url"),children:Je(Ye,{children:[qe(h,{value:t??"",onChange:t=>{const n=t.target.value??"",l=xt(e);l.data.linkURL=n,T(l.data),U&&o(n)},onBlur:e=>o(e.target.value),status:U?"error":"",placeholder:c("link_url_placeholder"),className:"width-full"}),U?qe("div",{className:"ee-field-error",role:"alert",children:U}):null]})}):null]})})(),(()=>{const{src:t,alt:n}=e.data,l="string"==typeof t&&/^\{\{\w+\}\}$/.test(t.trim())?String(t).replace(/\{\{|\}\}/g,"").trim():"",a=o&&l?$o(o,l,z):null,i=null==a||String(a).startsWith("{{")?t||"":a,r=e=>{D((e=>{const t=String(e??"").trim();if(/^\{\{\w+\}\}$/.test(t))return"";const n=lt(t,!1,{allowMailtoTel:!1});return n?"empty"===n?"Image -> Image URL is empty. Add an image URL like 'https://example.com/image.jpg' or choose a variable.":"blocked_scheme"===n?`Image -> Image URL ('${t}') uses a blocked protocol. Use only http:// or https:// image URLs.`:"duplicate_protocol"===n?`Image -> Image URL ('${t}') repeats the protocol. Keep only one protocol, e.g. 'https://example.com/image.jpg'.`:"missing_hostname_dot"===n?`Image -> Image URL ('${t}') is missing a valid hostname. Use a full URL like 'https://example.com/image.jpg'.`:"invalid_protocol"===n?`Image -> Image URL ('${t}') has an unsupported protocol. Use only http:// or https:// image URLs.`:`Image -> Image URL ('${t}') is invalid. Fix the URL format, for example 'https://example.com/image.jpg'.`:""})(e))},s=t=>n=>{const o=xt(e),l=n.target.value;o.data[t]=l,T(o.data),"src"===t&&M&&r(l)},d=t=>{const n=xt(e);n.data.src=t,T(n.data)},u=()=>{$.current?.click()};return Je(Ye,{children:[qe(_r,{children:c("image")}),qe(vr,{label:c("image_upload"),children:Je(Ye,{children:[qe("input",{ref:$,type:"file",accept:Wr,className:"ee-image-upload-input-hidden",onChange:async e=>{const t=e.target.files?.[0];if(!t)return;const n=jr(t);if("type"===n)return S.error(c("image_upload_invalid_type")||"Use PNG, JPEG, GIF, SVG, or WebP."),void(e.target.value="");if("size"===n)return S.error(c("image_file_too_large")),void(e.target.value="");if(!W)return S.error(c("image_upload_not_configured")||"Image upload not configured"),console.warn("[ImageStyleSettings] Image upload endpoint not configured"),void(e.target.value="");R(!0);try{const e=await O(t);e?(d(ol(e)),S.success(c("image_uploaded")||"Image uploaded successfully")):S.error(c("image_upload_failed")||"Failed to upload image")}catch(e){console.error("[ImageStyleSettings] Upload error:",e);const t="string"==typeof e?.message&&e.message.trim()?e.message.trim():null;S.error(t||c("image_upload_error")||"Error uploading image")}finally{R(!1),e.target.value=""}},disabled:P}),qe(w,{spinning:P,children:Je("div",{role:"button",tabIndex:0,className:"ee-image-upload-trigger",onClick:u,onDrop:async e=>{e.preventDefault(),e.stopPropagation();const t=e.dataTransfer?.files?.[0];if(!t)return;const n=jr(t);if("type"!==n)if("size"!==n){if(!W)return S.error(c("image_upload_not_configured")||"Image upload not configured"),void console.warn("[ImageStyleSettings] Image upload endpoint not configured");R(!0);try{const e=await O(t);e?(d(ol(e)),S.success(c("image_uploaded")||"Image uploaded successfully")):S.error(c("image_upload_failed")||"Failed to upload image")}catch(e){console.error("[ImageStyleSettings] Upload error:",e);const t="string"==typeof e?.message&&e.message.trim()?e.message.trim():null;S.error(t||c("image_upload_error")||"Error uploading image")}finally{R(!1),$.current.value=""}}else S.error(c("image_file_too_large"));else S.error(c("image_upload_invalid_type")||"Use PNG, JPEG, GIF, SVG, or WebP.")},onDragOver:e=>{e.preventDefault(),e.stopPropagation()},style:{opacity:P?.6:1,cursor:P?"not-allowed":"pointer"},children:[qe(B,{icon:me,className:"ee-image-upload-icon"}),qe("span",{children:P?c("uploading")||"Uploading...":c("image_upload_click")})]})}),Je("div",{className:"ee-image-toolbar",children:[Je("button",{type:"button",className:"ee-image-toolbar-btn",onClick:u,disabled:P,children:[qe(B,{icon:ge}),qe("span",{children:c("replace")||"Replace"})]}),Je("button",{type:"button",className:"ee-image-toolbar-btn ee-image-toolbar-btn--danger",onClick:()=>I({src:""}),children:[qe(B,{icon:J}),qe("span",{children:c("delete")||"Delete"})]})]}),qe("div",{className:"ee-image-upload-hint",children:c("image_upload_file_hint")||"PNG, JPEG, GIF, SVG, WebP · max 10 MB"})]})}),F.length>0?qe(vr,{label:c("image_source_variable"),children:qe(x,{className:"ee-variable-select width-full",placeholder:c("image_source_variable"),allowClear:!0,value:"string"==typeof t&&/^\{\{\w+\}\}$/.test(String(t).trim())?String(t).trim():void 0,onChange:e=>d(e??""),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,options:F.map(e=>({value:e.value,label:c(e.labelKey)}))})}):null,qe(vr,{label:c("image_url"),children:Je(Ye,{children:[qe(h,{className:"width-full",value:i,onChange:s("src"),onBlur:e=>r(e.target.value),status:M?"error":"",placeholder:"https://..."}),M?qe("div",{className:"ee-field-error",role:"alert",children:M}):null]})}),qe(vr,{label:c("image_alt"),children:qe(h,{className:"width-full",value:n||"",onChange:s("alt"),placeholder:c("image_alt_placeholder")})})]})})(),(()=>{const t=e.data,n=s?.styles?.fontFamily??"sans-serif",l=Boolean(t.textOverlayEnabled),a=t.overlayPosition??"bc",i=Boolean(t.scrimEnabled),r=Boolean(t.textShadowEnabled),d=t.overlayMaxWidth??100,u=t.overlayItemGap??8,p=Array.isArray(t.overlayItems)?t.overlayItems:[],m=[{value:"eyebrow",label:"Eyebrow",defaultSize:11},{value:"h1",label:"H1",defaultSize:32},{value:"h2",label:"H2",defaultSize:24},{value:"h3",label:"H3",defaultSize:18},{value:"subtitle",label:"Subtitle",defaultSize:16},{value:"body",label:"Body",defaultSize:14}],g=(e,t)=>{const n=[...p];n[e]={...n[e],...t},I({overlayItems:n})},y=(e,t)=>{const n=[...p],o="up"===t?e-1:e+1;o<0||o>=n.length||([n[e],n[o]]=[n[o],n[e]],I({overlayItems:n}))},b=(e,t,n,o)=>qe("button",{type:"button",disabled:t,onClick:e,style:{width:22,height:22,display:"inline-flex",alignItems:"center",justifyContent:"center",background:"transparent",border:"1px solid rgba(255,255,255,0.12)",borderRadius:3,cursor:t?"not-allowed":"pointer",color:o?"#f87070":"var(--ee-muted-foreground)",opacity:t?.35:1,padding:0,flexShrink:0},children:qe(B,{icon:n,style:{fontSize:9}})});return Je(Ye,{children:[qe(_r,{children:Je("span",{className:"ee-container-bg-heading-inline",children:[c("image_text_overlay"),qe(v,{title:Je("div",{children:[qe("p",{style:{marginBottom:8},children:c("image_text_overlay_tip")}),qe("p",{style:{margin:0,opacity:.85},children:c("image_text_overlay_container_tip")})]}),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:qe("span",{className:"ee-help-icon ee-container-bg-section-help",tabIndex:0,"aria-label":c("image_text_overlay"),children:qe(B,{icon:A})})})]})}),qe(vr,{layout:"toggle",label:c("image_text_overlay_enable"),children:qe(pr,{checked:l,onChange:e=>{if(e&&!t.textOverlayEnabled){const e=p.length>0?p:[{kind:"eyebrow",text:"EYEBROW TEXT",color:"#d8fe91",fontSize:11,fontFamily:n},{kind:"h1",text:"Heading Text",color:"#ffffff",fontSize:32,fontFamily:n},{kind:"body",text:"Body copy goes here.",color:"#ffffff",fontSize:14,fontFamily:n}];I({textOverlayEnabled:!0,overlayItems:e})}else I({textOverlayEnabled:e})}})}),l?Je(Ye,{children:[qe(vr,{label:c("add_overlay_item")||"Add element",children:qe("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:m.map(e=>Je("button",{type:"button",onClick:()=>(e=>{const t=m.find(t=>t.value===e)||m[5],o=[...p,{kind:e,text:"",color:"#ffffff",fontSize:t.defaultSize,fontFamily:n}];I({overlayItems:o})})(e.value),style:{padding:"4px 10px",background:"rgba(255,255,255,0.05)",border:"1px solid rgba(255,255,255,0.12)",borderRadius:4,color:"var(--ee-foreground)",cursor:"pointer",fontSize:11,fontFamily:"inherit"},children:["+ ",e.label]},e.value))})}),p.length>0&&qe("div",{style:{display:"flex",flexDirection:"column",gap:8,marginBottom:12},children:p.map((e,t)=>Je("div",{style:{background:"rgba(255,255,255,0.04)",border:"1px solid var(--ee-border)",borderRadius:6,padding:"10px 12px"},children:[Je("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:8},children:[b(()=>y(t,"up"),0===t,K,!1),b(()=>y(t,"down"),t===p.length-1,V,!1),qe(x,{size:"small",style:{flex:1},value:e.kind||"body",onChange:e=>g(t,{kind:e}),options:m.map(e=>({value:e.value,label:e.label})),getPopupContainer:()=>document.querySelector(".right-settings")||document.body}),b(()=>(e=>{I({overlayItems:p.filter((t,n)=>n!==e)})})(t),!1,J,!0)]}),qe(h,{size:"small",value:e.text||"",placeholder:"Text content...",onChange:e=>g(t,{text:e.target.value}),style:{marginBottom:8}}),Je("div",{style:{marginBottom:8},children:[qe("div",{style:{fontSize:11,color:"var(--ee-muted-foreground)",marginBottom:4},children:c("font_family")}),qe(x,{size:"small",className:"width-full ee-font-family-select",showSearch:!0,optionFilterProp:"label",value:Zo(null!=e.fontFamily&&""!==String(e.fontFamily).trim()?e.fontFamily:n,o),onChange:e=>g(t,{fontFamily:Zo(e,o)}),labelRender:({value:e})=>qe("span",{children:Qo(e,o)}),options:Yo(o),getPopupContainer:()=>document.querySelector(".right-settings")||document.body})]}),Je("div",{style:{display:"flex",alignItems:"center",gap:8},children:[qe(cr,{color:e.color||"#ffffff",setColor:({hex:e})=>g(t,{color:e}),fallbackColor:"#ffffff"}),qe(k,{size:"small",min:8,max:96,addonAfter:"px",value:e.fontSize||16,style:{flex:1},onChange:e=>g(t,{fontSize:"number"==typeof e?e:16})})]})]},t))}),qe(vr,{label:c("item_gap")||"Item gap",children:qe(k,{min:0,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:u,onChange:e=>I({overlayItemGap:"number"==typeof e?e:8})})}),qe(vr,{label:c("image_overlay_position"),children:qe("div",{className:"ee-image-overlay-position-grid",role:"group","aria-label":c("image_overlay_position"),children:cl.map(e=>qe("button",{type:"button",className:za("ee-image-overlay-position-cell",a===e&&"ee-image-overlay-position-cell-active"),title:c(`image_overlay_pos_${e}`),"aria-pressed":a===e,onClick:()=>I({overlayPosition:e}),children:qe("span",{className:"ee-image-overlay-dot","aria-hidden":!0})},e))})}),qe(vr,{label:c("overlay_max_width")||"Max width",children:qe(k,{min:20,max:100,className:"input-width ee-settings-input-affix",addonAfter:"%",value:d,onChange:e=>I({overlayMaxWidth:"number"==typeof e?e:100})})}),qe(vr,{label:c("image_overlay_box_bg"),children:qe(h,{className:"width-full",placeholder:"rgba(0,0,0,0.35)",value:t.overlayBoxBackground??"",onChange:e=>I({overlayBoxBackground:e.target.value})})}),qe(vr,{label:c("image_overlay_padding"),children:qe(k,{min:0,max:120,className:"input-width ee-settings-input-affix",addonAfter:"px",value:"number"==typeof t.overlayPadding?t.overlayPadding:16,onChange:e=>I({overlayPadding:"number"==typeof e?e:16})})}),qe(vr,{layout:"toggle",label:c("scrim")||"Scrim",children:qe(pr,{checked:i,onChange:e=>I({scrimEnabled:e})})}),qe(vr,{layout:"toggle",label:c("text_shadow")||"Text shadow",children:qe(pr,{checked:r,onChange:e=>I({textShadowEnabled:e})})})]}):null]})})(),(()=>{const n=C(e.data.styles,"width"),o=C(e.data.styles,"height"),l=C(e.data.styles,"borderRadius"),a="number"==typeof l?l:parseInt(String(l||"").replace("px",""),10)||0,i=C(e.data.contentStyles,"textAlign"),r=Boolean(e.data.fillColumn);return Je(Ye,{children:[qe(_r,{children:c("layout")}),qe(vr,{layout:"toggle",label:c("fill_column")||"Fill column",children:qe(pr,{checked:r,onChange:e=>I({fillColumn:e})})}),qe(vr,{layout:"toggle",label:c("auto_width"),children:qe(pr,{checked:"auto"===n,onChange:()=>{const e="auto"===n?"100%":"auto";L("width")(e)}})}),"auto"!==n?qe(vr,{label:c("width"),children:qe(N,{value:bs(n,s?.contentWidth),onChange:e=>L("width")(e+"%")})}):null,qe(vr,{label:c("height")||"Height",children:qe(k,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",placeholder:"auto",value:o&&parseInt(String(o).replace("px",""),10)||void 0,onChange:e=>L("height")(e?`${e}px`:"auto")})}),qe(vr,{label:c("border_radius"),children:qe(k,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",value:a,onFocus:e=>e?.target?.select?.(),onChange:e=>L("borderRadius")(Number(e)||0)})}),qe(vr,{label:c("align"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:i||"center",onChange:n=>(n=>{const o=xt(e.data);o.contentStyles||(o.contentStyles={desktop:{},mobile:{}}),o.contentStyles[t]||(o.contentStyles[t]={}),o.contentStyles[t]={...o.contentStyles[t],textAlign:n},T(o)})(n),"aria-label":c("align"),items:[{value:"left",label:qe(B,{icon:he,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:qe(B,{icon:ye,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:qe(B,{icon:be,className:"tag-style-size"}),iconOnly:!0},{value:"justify",label:qe(B,{icon:fe,className:"tag-style-size"}),iconOnly:!0}]})}),qe(_r,{children:c("spacing")}),qe(vr,{label:c("label_padding"),children:qe(mr,{padding:{paddingTop:C(e.data.contentStyles,"paddingTop"),paddingRight:C(e.data.contentStyles,"paddingRight"),paddingLeft:C(e.data.contentStyles,"paddingLeft"),paddingBottom:C(e.data.contentStyles,"paddingBottom")},setPadding:j})})]})})()]})},_s=()=>{const{currentItem:e,previewMode:t}=n(Ln),{t:o}=ja(),{findStyleItem:l,updateItemStyles:a}=Rr(),i=t=>{const n=xt(e.data);t(n),a(n)},r=n=>{const o=e.data.videoArea||{},l="desktop"===t?{}:o.desktop||{};return o[t]?.[n]??l[n]},s=e=>i(n=>{n.videoArea||(n.videoArea={desktop:{},mobile:{}}),n.videoArea[t]={...n.videoArea[t]||{},...e}}),c=l(e.data.contentStyles,"textAlign"),d=["left","center","right"].includes(c)?c:"center",u=Je("span",{className:"ee-container-bg-heading-inline",children:[o("video_url"),qe(v,{title:o("video_export_note"),children:qe("span",{className:"ee-help-icon ee-container-bg-section-help",tabIndex:0,"aria-label":o("video_export_note"),children:qe(B,{icon:A})})})]});return Je("div",{className:"margin-y-30 ee-settings-block-form",children:[qe(_r,{children:o("video_tab_display")}),qe(vr,{label:u,children:qe(h,{className:"width-full",value:e.data.videoUrl??"",onChange:e=>i(t=>{t.videoUrl=e.target.value}),placeholder:"https://www.youtube.com/watch?v=..."})}),qe(vr,{label:o("video_thumbnail_url"),children:qe(h,{className:"width-full",value:e.data.thumbnailUrl??"",onChange:e=>i(t=>{t.thumbnailUrl=e.target.value}),placeholder:o("video_thumbnail_url_placeholder")})}),qe(_r,{children:o("video_thumbnail_layout")}),qe(vr,{label:o("video_width"),children:qe(k,{min:0,className:"input-width ee-settings-input-affix ee-video-dim-field width-full",placeholder:"auto",addonAfter:"px",value:"number"==typeof l(e.data.styles,"width")?l(e.data.styles,"width"):void 0,onChange:e=>i(n=>{n.styles=n.styles||{desktop:{},mobile:{}},n.styles[t]={...n.styles[t]||{},width:null==e||""===e?"auto":e}})})}),qe(vr,{label:o("video_height"),children:qe(k,{min:0,className:"input-width ee-settings-input-affix ee-video-dim-field width-full",placeholder:"auto",addonAfter:"px",value:"number"==typeof l(e.data.styles,"height")?l(e.data.styles,"height"):void 0,onChange:e=>i(n=>{n.styles=n.styles||{desktop:{},mobile:{}},n.styles[t]={...n.styles[t]||{},height:null==e||""===e?"auto":e}})})}),qe(vr,{label:o("alignment"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:d,onChange:e=>i(n=>{n.contentStyles||(n.contentStyles={desktop:{},mobile:{}}),n.contentStyles[t]={...n.contentStyles[t]||{},textAlign:e}}),"aria-label":o("alignment"),items:[{value:"left",label:qe(B,{icon:he,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:qe(B,{icon:ye,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:qe(B,{icon:be,className:"tag-style-size"}),iconOnly:!0}]})}),qe(vr,{layout:"toggle",label:o("video_fill_column"),children:qe(pr,{checked:Boolean(l(e.data.styles,"fillColumn")),onChange:e=>i(n=>{n.styles=n.styles||{desktop:{},mobile:{}},n.styles[t]={...n.styles[t]||{},fillColumn:e}})})}),qe(vr,{layout:"toggle",label:o("video_fill_column_mobile"),children:qe(pr,{checked:Boolean(l(e.data.styles,"fillColumnMobile")),onChange:e=>i(n=>{n.styles=n.styles||{desktop:{},mobile:{}},n.styles[t]={...n.styles[t]||{},fillColumnMobile:e}})})}),qe(_r,{children:o("video_area_section")}),qe(vr,{label:o("label_padding"),children:qe(mr,{setPadding:e=>i(n=>{n.videoArea||(n.videoArea={desktop:{},mobile:{}}),n.videoArea[t]={...n.videoArea[t]||{},...e}}),padding:{paddingTop:r("paddingTop")??0,paddingBottom:r("paddingBottom")??0,paddingLeft:r("paddingLeft")??0,paddingRight:r("paddingRight")??0}})}),qe(vr,{label:o("background_color"),children:qe(cr,{color:"string"==typeof r("backgroundColor")&&r("backgroundColor").replace(/^#/,"")||"transparent",setColor:({hex:e})=>s({backgroundColor:e})})}),qe(vr,{label:o("divider_type"),children:Je(x,{className:"width-full",value:r("borderStyle")||"solid",onChange:e=>s({borderStyle:e}),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:[qe(x.Option,{value:"none",children:o("video_border_none")}),qe(x.Option,{value:"solid",children:o("solid")}),qe(x.Option,{value:"dashed",children:o("dashed")})]})}),qe(vr,{label:o("border_width"),children:qe(k,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",value:r("borderWidth")??0,onFocus:e=>e?.target?.select?.(),onChange:e=>s({borderWidth:null==e?0:e})})}),qe(vr,{label:o("border_color"),children:qe(cr,{color:(r("borderColor")||"#cccccc").replace(/^#/,""),setColor:({hex:e})=>s({borderColor:e})})}),qe(_r,{children:o("video_block_section")}),qe(vr,{label:o("label_padding"),children:qe(mr,{padding:{paddingTop:l(e.data.contentStyles,"paddingTop")??0,paddingBottom:l(e.data.contentStyles,"paddingBottom")??0,paddingLeft:l(e.data.contentStyles,"paddingLeft")??0,paddingRight:l(e.data.contentStyles,"paddingRight")??0},setPadding:e=>i(n=>{n.contentStyles||(n.contentStyles={desktop:{},mobile:{}}),n.contentStyles[t]={...n.contentStyles[t]||{},...e}})})}),qe(vr,{label:o("background_color"),children:qe(cr,{color:(l(e.data.contentStyles,"backgroundColor")||"").replace(/^#/,"")||"transparent",setColor:({hex:e})=>i(n=>{n.contentStyles||(n.contentStyles={desktop:{},mobile:{}}),n.contentStyles[t]={...n.contentStyles[t]||{},backgroundColor:e}})})})]})},ks=()=>{const{currentItem:e,previewMode:t}=n(Ln),{t:o}=ja(),{findStyleItem:l,cardItemElement:a,updateItemStyles:i}=Rr(),{src:r,alt:s,linkURL:c}=e.data,d=l(e.data.styles,"width")??64,u=l(e.data.styles,"borderRadius"),p="50%"===u?50:parseInt(String(u).replace("px",""),10)||0;return Je("div",{className:"margin-y-30 ee-settings-block-form",children:[qe("div",{className:"right-setting-block-item-title",children:o("avatar_image")}),a(o("image_url"),qe(h,{value:r,onChange:t=>{const n=xt(e.data);n.src=t.target.value??"",i(n)}})),a(o("image_alt"),qe(h,{value:s,onChange:t=>{const n=xt(e.data);n.alt=t.target.value??"",i(n)},placeholder:"Avatar"})),a(o("link_url"),qe(h,{value:c,onChange:t=>{const n=xt(e.data);n.linkURL=t.target.value??"",i(n)},placeholder:o("link_url_placeholder")})),qe("div",{className:"right-setting-block-item-title margin-top-18",children:o("image_styles")}),a(o("width"),qe(k,{min:16,max:256,value:"number"==typeof d?d:64,onChange:t=>{const n=xt(e.data);n.styles.desktop||(n.styles.desktop={}),n.styles.desktop.width=t,i(n)},addonAfter:"px"})),a(o("avatar_border_radius"),qe(k,{min:0,max:50,value:p,onChange:t=>{const n=xt(e.data);n.styles.desktop||(n.styles.desktop={}),n.styles.desktop.borderRadius=50===t?"50%":`${t}px`,i(n)},addonAfter:50===p?"%":"px"})),qe("div",{className:"right-setting-block-item-title margin-top-18",children:o("padding_settings")}),qe(mr,{padding:{paddingTop:l(e.data.contentStyles,"paddingTop"),paddingRight:l(e.data.contentStyles,"paddingRight"),paddingLeft:l(e.data.contentStyles,"paddingLeft"),paddingBottom:l(e.data.contentStyles,"paddingBottom")},setPadding:n=>{const o=xt(e.data);o.contentStyles||(o.contentStyles={desktop:{},mobile:{}}),o.contentStyles[t]||(o.contentStyles[t]={}),o.contentStyles[t]={...o.contentStyles[t],...n},i(o)}})]})},vs="__ee_social_custom__";function ws({preset:e,settingsPanelIconColor:t,t:n}){const{src:o,style:l}=vt(e,t,22);return Je("span",{className:"ee-social-add-menu-item",children:[o?qe("img",{src:o,alt:"",className:"ee-social-add-menu-icon",style:l,draggable:!1}):null,qe("span",{children:at(e)?n("social_platform_x"):e.title})]})}function xs(e,t){const n=String(e?.image||"").trim(),o=String(t?.image||"").trim();if(n&&o&&n===o)return!0;const l=String(e?.title||"").trim().toLowerCase(),a=String(t?.title||"").trim().toLowerCase();return Boolean(l&&a&&l===a)}const Ss={facebook:"social_link_placeholder_facebook",linkedin:"social_link_placeholder_linkedin",instagram:"social_link_placeholder_instagram",tiktok:"social_link_placeholder_tiktok",youtube:"social_link_placeholder_youtube",pinterest:"social_link_placeholder_pinterest"};function Cs(e,t){if(at(e))return t("social_link_placeholder_x");const n=String(e?.title||"").trim().toLowerCase(),o=Ss[n];return t(o||"social_link_placeholder_generic")}function Ns({blockNode:e,onUpdateBlock:t,previewMode:n,findStyleItem:s,apiConfig:c,templateData:d,embedded:u=!1}){const{t:p}=ja(),m=l(()=>Array.isArray(e.list)?e.list:[],[e.list]),[g,y]=a(!1),[b,f]=a(null),[_,v]=a({}),[w,C]=a(null),N=i(null),T=i(null),[A,I]=a(null),[$,P]=a(null),{uploadImageFile:R,isConfigured:M}=Hr({imageUploadEndpoint:c?.imageUploadEndpoint,headers:c?.headers||{},companyId:c?.companyId,imageUploadQueryParams:c?.imageUploadQueryParams,imageUploadCompanyField:c?.imageUploadCompanyField}),D=[{image:pt("facebook"),title:"Facebook",linkURL:""},{image:pt("linkedin"),title:"LinkedIn",linkURL:""},{image:pt("instagram"),title:"Instagram",linkURL:""},{image:pt("tiktok"),title:"TikTok",linkURL:""},{image:pt("x"),title:"X",linkURL:""},{image:pt("youtube"),title:"YouTube",linkURL:""},{image:pt("pinterest"),title:"Pinterest",linkURL:""}];r(()=>{null!=w&&w>=m.length&&C(m.length?m.length-1:null)},[w,m.length]);const U=(n,o)=>{const l=xt(e),a=function(e){if(!Array.isArray(e))return e;const t=[];for(const n of e)t.some(e=>xs(e,n))||t.push(n);return t}(o);l[n]=a,l.useCompanySocialLinks=!1,t(l)},E=(e,t)=>{U("list",m.map((n,o)=>o===e?{...n,...t}:n))},z=(e,t,n)=>{const o=((e,t,n)=>{const o=String(e??"").trim(),l=`Social links -> ${n||`Item ${t+1}`} URL`,a=lt(o,!1,{allowMailtoTel:!1});return a?"empty"===a?`${l} is empty. Add a profile URL like 'https://example.com'.`:"blocked_scheme"===a?`${l} ('${o}') uses a blocked protocol. Use only http:// or https:// URLs.`:"duplicate_protocol"===a?`${l} ('${o}') repeats the protocol. Keep one protocol, e.g. 'https://example.com'.`:"missing_hostname_dot"===a?`${l} ('${o}') is missing a valid hostname. Use a full domain like 'https://example.com'.`:"invalid_protocol"===a?`${l} ('${o}') has an unsupported protocol. Use only http:// or https:// URLs.`:`${l} ('${o}') is invalid. Fix it to a valid URL like 'https://example.com'.`:""})(e,t,n);v(e=>{if(!o&&!e[t])return e;const n={...e};return o?n[t]=o:delete n[t],n})},F=o(St(e=>{e.preventDefault();const t=N.current,n=e.target?.closest?.(".social-link-item[data-index]");if(!n||!t?.contains(n))return;const o=Array.from(t.querySelectorAll(".social-link-item[data-index]")).indexOf(n);if(-1===o)return;const l=b,a=xt(m);l!==o&&([a[o],a[l]]=[a[l],a[o]],f(o),U("list",a),C(e=>e===l?o:e===o?l:e))},50),[b,m,u]),O=()=>document.querySelector(".right-settings")||document.body,W=s(e.contentStyles,"textAlign"),j=["left","center","right","justify"].includes(W)?W:"center",H=s(e.contentStyles,"columnGapPx"),G="number"==typeof H&&Number.isFinite(H)&&H>=0?H:8,q=function(e){if(e?.iconSize&&null!=ct[e.iconSize])return e.iconSize;const t=Number(e?.imageWidth);if(!Number.isFinite(t)||t<=0)return"medium";let n="medium",o=1/0;for(const[e,l]of Object.entries(ct)){const a=Math.abs(t-l);a<o&&(o=a,n=e)}return n}(e),Y=rt(e.iconColor),X="default"===Y?"default":"white",Z=Boolean(e.showTextLabel),Q=l(()=>[{value:"small",label:p("icon_size_small")},{value:"medium",label:p("icon_size_medium")},{value:"large",label:p("icon_size_large")}],[p]),ee=D.filter(e=>!m.some(t=>xs(t,e))),te=[...D.map(e=>({value:e.title,label:at(e)?p("social_platform_x"):e.title})),{value:vs,label:p("social_platform_custom")}],ne=[{value:"default",label:p("icon_color_default")},{value:"white",label:p("icon_color_white")},{value:"black",label:p("icon_color_black")},{value:"gray",label:p("icon_color_gray")}],oe=[...ee.map(e=>({key:e.title+e.image,label:qe(ws,{preset:e,settingsPanelIconColor:X,t:p}),onClick:()=>{U("list",m.concat({...e,id:Nt()})),C(m.length)}})),{key:"__add_custom_social_row__",label:Je("span",{className:"ee-social-add-menu-item ee-social-add-menu-item--custom",children:[qe("span",{className:"menu-add-new-item-icon",children:"+"}),qe("span",{children:p("social_platform_custom")})]}),onClick:()=>{U("list",m.concat({id:Nt(),image:"",title:"",linkURL:""})),C(m.length)}}];return Je("div",{className:za("ee-settings-block-form ee-social-link-settings",!u&&"margin-y-30"),children:[u?null:qe(_r,{className:"ee-social-link-settings-section",children:p("social_settings_icons")}),Je("div",{ref:N,onDragOver:F,className:"ee-social-link-icons-list",children:[qe("input",{ref:T,type:"file",accept:Wr,className:"ee-image-upload-input-hidden",onChange:async e=>{const t=e.target.files?.[0];e.target.value="";const n=A;if(I(null),null==t||null==n)return;const o=jr(t);if("type"!==o)if("size"!==o){P(n);try{const e=await R(t);e?(E(n,{image:ol(e)}),S.success(p("image_uploaded"))):S.error(p("image_upload_failed"))}catch(e){S.error(p("image_upload_error"))}finally{P(null)}}else S.error(p("image_file_too_large"));else S.error(p("image_upload_invalid_type"))}}),m.map((e,t)=>{const{title:n,linkURL:o}=e,l=at(e),a=function(e,t){const n=String(e?.image||"").trim(),o=t.find(e=>e.image===n);if(o)return o;if(at(e))return t.find(e=>at(e))??null;const l=String(e?.title||"").trim();return l?t.find(e=>e.title===l)??null:null}(e,D),i=!a,r=i&&!String(n||"").trim()?p("social_platform_custom"):l?p("social_platform_x"):n,s=i&&!String(n||"").trim()?p("social_platform_custom"):l?p("social_platform_x_alt"):n,c=vt(e,X,22),d=vt(e,X,28),u=a?a.title:vs,k=w===t;return qe("div",{"data-index":t,draggable:!0,onDragStart:()=>{y(!0),f(t)},onDragEnd:e=>{e.currentTarget?.classList?.remove("social-link-item-current"),y(!1),f(null)},className:za("social-link-item","cursor-grab",g&&"social-link-item-drag_start",b===t?"social-link-item-current":"border-transparent"),children:Je("div",{className:za("social-link-item-content","ee-menu-item-content","ee-social-link-row-shell"),children:[Je("div",{className:"ee-social-link-row-header",children:[qe("span",{className:"social-link-item-drag-handle","aria-hidden":!0,children:qe(B,{icon:_e,className:"social-link-item-drag-handle-icon"})}),c.src?qe("img",{src:c.src,alt:s,className:"social-link-item-img",style:c.style,draggable:!1}):qe("div",{className:"social-link-item-img ee-social-row-icon-placeholder","aria-hidden":!0}),qe("div",{className:"ee-social-link-row-header-main",children:Je("div",{className:"social-link-platform-title-wrap ee-social-link-row-title-wrap",children:[qe("div",{className:"font-semibold ee-social-link-row-primary-title",children:r}),l?qe("div",{className:"social-link-platform-former-name",children:p("social_platform_formerly_twitter")}):null]})}),Je("div",{className:"ee-social-link-row-tools",children:[qe("button",{type:"button",className:"ee-social-link-row-icon-btn","aria-expanded":k,"aria-label":p(k?"collapse":"expand"),onClick:e=>{e.stopPropagation(),(e=>{C(t=>t===e?null:e)})(t)},children:qe(B,{icon:k?K:V})}),qe("button",{type:"button",className:"ee-social-link-row-icon-btn ee-social-link-row-icon-btn-danger","aria-label":p("delete"),onClick:e=>{e.stopPropagation(),U("list",m.filter((e,n)=>n!==t)),C(e=>e===t?null:null!=e&&e>t?e-1:e)},children:qe(B,{icon:J,className:"social-link-item-icon-svg"})})]})]}),k?Je("div",{className:"ee-social-link-row-detail",children:[qe(vr,{label:p("social_platform_field"),children:qe(x,{className:"width-full ee-stack-control",value:u,options:te,getPopupContainer:O,onChange:e=>{if(e===vs)return void E(t,{title:"",image:""});const n=D.find(t=>t.title===e);n&&E(t,{image:n.image,title:n.title})}})}),qe(vr,{label:p("social_icon_label_field"),children:qe(h,{className:"width-full",value:n||"",placeholder:r,onChange:e=>E(t,{title:e.target.value})})}),Je(vr,{label:p("url"),children:[qe(h,{className:"width-full",placeholder:Cs(e,p),value:o||"",status:_[t]?"error":"",onChange:e=>{const n=e.target.value;U("list",m.map((e,o)=>o===t?{...e,linkURL:n}:e)),_[t]&&z(n,t,r)},onBlur:e=>z(e.target.value,t,r)}),_[t]?qe("div",{className:"ee-field-error",role:"alert",children:_[t]}):null]}),qe(vr,{label:p("social_custom_icon"),children:Je("div",{className:"ee-social-custom-icon-row",children:[qe("div",{className:"ee-social-custom-icon-preview",children:d.src?qe("img",{src:d.src,alt:"",style:d.style,draggable:!1}):qe("span",{className:"ee-social-custom-icon-preview-empty","aria-hidden":!0})}),qe("button",{type:"button",className:"menu-add-new-item ee-social-custom-upload-btn",disabled:!M||$===t,onClick:()=>(e=>{M?(I(e),requestAnimationFrame(()=>T.current?.click?.())):S.error(p("image_upload_not_configured"))})(t),children:p($===t?"uploading":"image_upload")})]})})]}):null]})},e.id??`${e.image??""}-${t}`)})]}),u?null:qe(L,{overlayClassName:"ee-social-add-platform-dropdown",menu:{items:oe},trigger:["click"],getPopupContainer:O,children:Je("button",{type:"button",className:"menu-add-new-item margin-top-12",children:[qe("span",{className:"menu-add-new-item-icon",children:"+"})," ",p("social_add_icon")]})}),qe(_r,{className:"ee-social-link-settings-section ee-social-link-settings-style-heading",children:p("social_settings_style")}),qe(_r,{className:"ee-social-link-settings-subsection",children:p("icon_styles")}),qe(vr,{label:p("icon_size"),children:qe(x,{className:"width-full ee-stack-control",value:q,onChange:n=>{const o=xt(e);o.iconSize=n,o.imageWidth=ct[n]??32,o.iconSizePx=null,t(o)},getPopupContainer:O,options:Q})}),qe(vr,{label:p("icon_color"),children:qe(x,{className:"width-full ee-stack-control",value:Y,onChange:n=>{const o=rt(n),l=xt(e);l.iconColor=o,l.iconColorHex=null,t(l)},getPopupContainer:O,options:ne})}),qe(vr,{layout:"toggle",label:p("show_text_label"),children:qe(pr,{checked:Z,onChange:n=>{const o=xt(e);o.showTextLabel=n,t(o)}})}),qe(vr,{label:p("social_icon_spacing"),children:qe(k,{min:0,max:96,className:"input-width ee-settings-input-affix",addonAfter:"px",value:G,onFocus:e=>e?.target?.select?.(),onChange:o=>(o=>{const l="number"==typeof o&&Number.isFinite(o)&&o>=0?Math.min(96,o):8,a=xt(e);a.contentStyles||(a.contentStyles={desktop:{},mobile:{}}),a.contentStyles[n]={...a.contentStyles[n]||{},columnGapPx:l},t(a)})(o)})}),qe(vr,{label:p("align"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:j,onChange:o=>(o=>{const l=xt(e);l.contentStyles[n]={...l.contentStyles[n],textAlign:o},t(l)})(o),"aria-label":p("align"),items:[{value:"left",label:qe(B,{icon:he,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:qe(B,{icon:ye,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:qe(B,{icon:be,className:"tag-style-size"}),iconOnly:!0},{value:"justify",label:qe(B,{icon:fe,className:"tag-style-size"}),iconOnly:!0}]})}),u?null:Je(Ye,{children:[qe(_r,{className:"ee-social-settings-padding-heading ee-social-link-settings-subsection",children:p("padding_settings")}),qe(vr,{children:qe(mr,{padding:{paddingTop:s(e.contentStyles,"paddingTop"),paddingRight:s(e.contentStyles,"paddingRight"),paddingLeft:s(e.contentStyles,"paddingLeft"),paddingBottom:s(e.contentStyles,"paddingBottom")},setPadding:o=>{const l=xt(e);l.contentStyles||(l.contentStyles={desktop:{},mobile:{}}),l.contentStyles[n]||(l.contentStyles[n]={}),l.contentStyles[n]={...l.contentStyles[n],...o},t(l)}})})]})]})}const Ls=()=>{const{currentItem:e,previewMode:t,apiConfig:l,templateData:a}=n(Ln),{findStyleItem:i,updateItemStyles:r}=Rr(),s=o(e=>{r(e)},[r]);return qe(Ns,{blockNode:e.data,onUpdateBlock:s,previewMode:t,findStyleItem:i,apiConfig:l,templateData:a,embedded:!1})},{TextArea:Ts}=h;const Bs=()=>{const{currentItem:e,previewMode:t}=n(Ln),{t:o}=ja(),{findStyleItem:l,updateItemStyles:a}=Rr(),i=n=>{const o=xt(e.data);o.contentStyles||(o.contentStyles={desktop:{},mobile:{}}),o.contentStyles[t]={...o.contentStyles[t]??{},...n},a(o)},r=l(e.data.contentStyles,"textAlign"),s=["left","center","right","justify"].includes(r)?r:"center",c=function(e){if(null==e||""===e)return 100;if("number"==typeof e)return Math.min(100,Math.max(10,Math.round(e)));const t=String(e).trim().match(/^(\d+(?:\.\d+)?)%$/);return t?Math.min(100,Math.max(10,Math.round(Number(t[1])))):100}(l(e.data.contentStyles,"width")),d=l(e.data.contentStyles,"backgroundColor"),u=function(e){if(null==e)return 0;if("number"==typeof e&&Number.isFinite(e))return Math.min(48,Math.max(0,Math.round(e)));const t=String(e).trim().replace(/px$/i,""),n=Number.parseFloat(t);return Number.isFinite(n)?Math.min(48,Math.max(0,Math.round(n))):0}(l(e.data.contentStyles,"borderRadius"));return Je("div",{className:"margin-y-30 ee-settings-block-form ee-raw-html-settings",children:[qe(_r,{className:"ee-raw-html-heading-row",children:Je("span",{className:"ee-raw-html-title-left",children:[qe(B,{icon:le,className:"ee-raw-html-title-icon","aria-hidden":!0}),qe("span",{className:"ee-raw-html-block-heading-text",children:o("raw_html_block")}),qe(v,{title:o("raw_html_code_hint"),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:qe("span",{className:"ee-help-icon ee-raw-html-title-help",tabIndex:0,"aria-label":o("raw_html_info_tooltip_aria"),children:qe(B,{icon:A})})})]})}),qe("p",{className:"ee-raw-html-block-description",children:o("raw_html_block_description")}),qe(vr,{label:o("raw_html_code_label"),children:qe(Ts,{className:"ee-raw-html-code-textarea",value:e.data.html??"",onChange:t=>(t=>{const n=xt(e.data);n.html=t,a(n)})(t.target.value),autoSize:{minRows:10,maxRows:28},spellCheck:!1})}),qe(_r,{children:o("raw_html_appearance")}),qe(vr,{label:o("width"),children:qe(N,{min:10,max:100,value:c,tooltip:{formatter:e=>`${e}%`},onChange:e=>{i({width:`${e}%`})}})}),qe(vr,{label:o("align"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:s,onChange:e=>(e=>{i({textAlign:e})})(e),"aria-label":o("align"),items:[{value:"left",label:qe(B,{icon:he,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:qe(B,{icon:ye,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:qe(B,{icon:be,className:"tag-style-size"}),iconOnly:!0},{value:"justify",label:qe(B,{icon:fe,className:"tag-style-size"}),iconOnly:!0}]})}),qe(vr,{label:o("border_radius"),children:qe(k,{min:0,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:u,onFocus:e=>e?.target?.select?.(),onChange:n=>(n=>{const o="number"==typeof n&&Number.isFinite(n)?Math.min(48,Math.max(0,Math.round(n))):0;if(0===o){const n=xt(e.data);n.contentStyles||(n.contentStyles={desktop:{},mobile:{}});const o={...n.contentStyles[t]??{}};return delete o.borderRadius,n.contentStyles[t]=o,void a(n)}i({borderRadius:o})})("number"==typeof n?n:0)})}),qe(vr,{label:o("background_color"),children:Je("div",{className:"ee-raw-html-bg-row",children:[qe(cr,{color:d,setColor:({hex:e})=>{i({backgroundColor:e})},fallbackColor:"#ffffff"}),null!=d&&""!==String(d).trim()&&"transparent"!==String(d).toLowerCase()?qe(_,{type:"link",size:"small",onClick:()=>{const n=xt(e.data),o=n.contentStyles[t]||{},{backgroundColor:l,...i}=o;n.contentStyles[t]=i,a(n)},children:o("raw_html_clear_background")}):null]})}),qe(_r,{className:"ee-raw-html-settings-padding-heading",children:o("padding_settings")}),qe(vr,{children:qe(mr,{padding:{paddingTop:l(e.data.contentStyles,"paddingTop"),paddingRight:l(e.data.contentStyles,"paddingRight"),paddingLeft:l(e.data.contentStyles,"paddingLeft"),paddingBottom:l(e.data.contentStyles,"paddingBottom")},setPadding:e=>{i(e)}})}),Je("div",{className:"ee-raw-html-email-warning",role:"note",children:[qe(B,{icon:ke,className:"ee-raw-html-email-warning-icon","aria-hidden":!0}),qe("span",{children:o("raw_html_email_client_warning")})]})]})},As=[{value:"none",label:"None"},{value:"solid",label:"Solid"},{value:"dashed",label:"Dashed"},{value:"dotted",label:"Dotted"}],Is=()=>{const{currentItem:e,previewMode:t}=n(Ln),{t:o}=ja(),{findStyleItem:a,updateItemStyles:i}=Rr(),r=()=>document.querySelector(".right-settings")||document.body,s=t=>{const n=xt(e.data);Object.assign(n,t),i(n)},c=n=>{const o=xt(e.data);o.styles||(o.styles={desktop:{},mobile:{}}),o.styles[t]||(o.styles[t]={}),Object.assign(o.styles[t],n),i(o)},d=e.data.rows??3,u=e.data.cols??3,p=Boolean(e.data.headerRow),m=Boolean(e.data.headerCol),g=e.data.selectedCell??null,y=e.data.structureMode??"static",b=a(e.data.styles,"fontSize")??14,f=a(e.data.styles,"color")??"#333333",_=a(e.data.styles,"borderColor")??"#e0e0e0",v=a(e.data.styles,"borderStyle")??"solid",w=a(e.data.styles,"borderWidth")??1,S=a(e.data.styles,"cellPadding")??8,C=a(e.data.styles,"textAlign")??"left",N=a(e.data.styles,"headerBg")??"#f5f5f5",L=a(e.data.styles,"headerColor")??"#333333",T=Boolean(e.data.stripedRows),A=a(e.data.styles,"stripedBg")??"#fafafa",I="number"==typeof u?u:3,$="number"==typeof d?d:3,P=l(()=>g&&e.data.cells?e.data.cells[g]??null:null,[g,e.data.cells]),R="image"===P?.type?"image":"text",M=t=>{if(!g)return;const n={...e.data.cells||{}};n[g]={...n[g]||{},...t},s({cells:n})},D=Math.min($,8),U=Math.min(I,8),E=l(()=>{if("string"!=typeof g)return null;const e=g.match(/^(\d+)-(\d+)$/);return e?{row:Number(e[1])+1,col:Number(e[2])+1}:null},[g]),z=l(()=>[{value:"left",label:o("table_align_left")},{value:"center",label:o("table_align_center")},{value:"right",label:o("table_align_right")}],[o]);return Je("div",{className:"margin-y-30 ee-settings-block-form ee-table-settings",children:[qe(_r,{children:o("table_structure")}),qe(vr,{label:o("table_structure_mode"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:y,onChange:e=>s({structureMode:e}),"aria-label":o("table_structure_mode"),items:[{value:"static",label:o("table_mode_static")},{value:"dynamic",label:o("table_mode_dynamic")}]})}),"dynamic"===y?qe("div",{className:"ee-table-dynamic-hint",role:"note",children:o("table_dynamic_structure_hint")}):null,qe(vr,{label:o("rows"),children:qe(k,{min:1,max:20,className:"width-full ee-settings-input-affix ee-table-dimension-input",value:$,onFocus:e=>e?.target?.select?.(),onChange:e=>{const t="number"==typeof e&&Number.isFinite(e)?Math.round(e):null;null!=t&&s({rows:Math.min(20,Math.max(1,t))})}})}),qe(vr,{label:o("columns"),children:qe(k,{min:1,max:12,className:"width-full ee-settings-input-affix ee-table-dimension-input",value:I,onFocus:e=>e?.target?.select?.(),onChange:e=>{const t="number"==typeof e&&Number.isFinite(e)?Math.round(e):null;null!=t&&s({cols:Math.min(12,Math.max(1,t))})}})}),Je("div",{className:"ee-table-add-actions",children:[Je("button",{type:"button",className:"ee-table-add-btn menu-add-new-item",onClick:()=>s({rows:Math.min(20,$+1)}),disabled:$>=20,children:[qe("span",{className:"menu-add-new-item-icon",children:"+"})," ",o("table_add_row")]}),Je("button",{type:"button",className:"ee-table-add-btn menu-add-new-item",onClick:()=>s({cols:Math.min(12,I+1)}),disabled:I>=12,children:[qe("span",{className:"menu-add-new-item-icon",children:"+"})," ",o("table_add_column")]})]}),qe(vr,{layout:"toggle",label:o("header_row"),children:qe(pr,{checked:p,onChange:e=>s({headerRow:e})})}),qe(vr,{layout:"toggle",label:o("header_column"),children:qe(pr,{checked:m,onChange:e=>s({headerCol:e})})}),qe(_r,{className:"margin-top-12",children:o("cell_selector")}),Je("div",{className:"ee-table-cell-picker-wrap",children:[qe("div",{className:"ee-table-cell-picker-grid",style:{gridTemplateColumns:`repeat(${U}, minmax(0, 1fr))`},children:Array.from({length:D*U}).map((t,n)=>{const o=Math.floor(n/U),l=n%U,a=`${o}-${l}`,i=g===a;return Je("button",{type:"button",className:`ee-table-cell-picker-btn${i?" ee-table-cell-picker-btn--selected":""}${p&&0===o||m&&0===l?" ee-table-cell-picker-btn--header":""}`,onClick:()=>{if(i)return void s({selectedCell:null});const t={...e.data.cells||{}};t[a]||(t[a]={type:"text",text:""}),s({selectedCell:a,cells:t})},children:[o+1,",",l+1]},a)})}),$>D||I>U?qe("div",{className:"ee-table-cell-picker-caption",children:o("table_cell_grid_truncated",{rows:D,cols:U})}):null,qe("div",g&&E?{className:"ee-table-selected-label",children:o("table_selected_cell",{row:E.row,col:E.col})}:{className:"ee-table-selected-label ee-table-selected-label--muted",children:o("table_select_cell_hint")})]}),g?Je(Ye,{children:[qe(_r,{className:"margin-top-12",children:o("cell_content")}),qe(vr,{label:o("cell_content_type"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:R,onChange:e=>{M("image"===e?{type:"image",src:"",alt:""}:{type:"text",text:P?.text??""})},"aria-label":o("cell_content_type"),items:[{value:"text",icon:qe(B,{icon:ce,className:"tag-style-size"}),label:o("text")},{value:"image",icon:qe(B,{icon:O,className:"tag-style-size"}),label:o("image")}]})}),qe(vr,"text"===R?{label:o("content"),children:qe(h.TextArea,{className:"ee-table-cell-textarea",rows:4,value:P?.text??"",placeholder:o("table_cell_text_placeholder"),onChange:e=>M({text:e.target.value})})}:{label:o("image"),children:qe(h,{className:"width-full",value:P?.src??"",placeholder:"https://...",onChange:e=>M({src:e.target.value})})})]}):null,qe(_r,{className:"margin-top-12",children:o("table_style")}),qe(vr,{label:o("font_size"),children:qe(k,{min:8,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:"number"==typeof b?b:parseInt(String(b||"14"),10),onFocus:e=>e?.target?.select?.(),onChange:e=>c({fontSize:e??14})})}),qe(vr,{label:o("text_color"),children:qe(cr,{color:f,setColor:({hex:e})=>c({color:e})})}),qe(vr,{label:o("text_align"),children:qe(x,{className:"width-full",value:C,onChange:e=>c({textAlign:e}),getPopupContainer:r,options:z})}),qe(vr,{label:o("cell_padding"),children:qe(k,{min:0,max:40,className:"input-width ee-settings-input-affix",addonAfter:"px",value:"number"==typeof S?S:parseInt(String(S||"8"),10),onFocus:e=>e?.target?.select?.(),onChange:e=>c({cellPadding:e??8})})}),qe(_r,{className:"margin-top-12",children:o("border")}),qe(vr,{label:o("border_style"),children:qe(x,{className:"width-full",value:v,onChange:e=>c({borderStyle:e}),getPopupContainer:r,options:As})}),"none"!==v?Je(Ye,{children:[qe(vr,{label:o("border_width"),children:qe(k,{min:0,max:10,className:"input-width ee-settings-input-affix",addonAfter:"px",value:"number"==typeof w?w:parseInt(String(w||"1"),10),onFocus:e=>e?.target?.select?.(),onChange:e=>c({borderWidth:e??1})})}),qe(vr,{label:o("border_color"),children:qe(cr,{color:_,setColor:({hex:e})=>c({borderColor:e})})})]}):null,qe(_r,{className:"margin-top-12",children:o("header_style")}),qe(vr,{label:o("header_background"),children:qe(cr,{color:N,setColor:({hex:e})=>c({headerBg:e})})}),qe(vr,{label:o("header_text_color"),children:qe(cr,{color:L,setColor:({hex:e})=>c({headerColor:e})})}),qe(vr,{layout:"toggle",label:o("striped_rows"),children:qe(pr,{checked:T,onChange:e=>s({stripedRows:e})})}),T?qe(vr,{label:o("stripe_color"),children:qe(cr,{color:A,setColor:({hex:e})=>c({stripedBg:e})})}):null,qe(_r,{className:"ee-table-settings-padding-heading",children:o("padding_settings")}),qe(vr,{children:qe(mr,{padding:{paddingTop:a(e.data.contentStyles,"paddingTop"),paddingRight:a(e.data.contentStyles,"paddingRight"),paddingLeft:a(e.data.contentStyles,"paddingLeft"),paddingBottom:a(e.data.contentStyles,"paddingBottom")},setPadding:n=>(n=>{const o=xt(e.data);o.contentStyles||(o.contentStyles={desktop:{},mobile:{}}),o.contentStyles[t]={...o.contentStyles[t]??{},...n},i(o)})(n)})})]})},$s={logo:"logo",brand:"brand",tagline:"tagline",address:"address",unsubscribe:"unsubscribe",social:"social",secondary:"secondary",copyright:"copyright"};function Ps(e,t,n){return e?e.id===t?n(e):Array.isArray(e.children)?{...e,children:e.children.map(e=>Ps(e,t,n))}:e:e}function Rs(e,t,n=new Set){if(!e||n.has(e.id))return null;if(n.add(e.id),e.footerSlot===t)return e;if(Array.isArray(e.children))for(const o of e.children){const e=Rs(o,t,n);if(e)return e}return null}function Ms(e,t=new Set){if(!e||t.has(e.id))return null;if(t.add(e.id),"image"===e.key&&e.footerBannerSlot)return e;if("image"===e.key&&String(e.src||"").includes("FooterBanner"))return e;if(Array.isArray(e.children))for(const n of e.children){const e=Ms(n,t);if(e)return e}return null}function Ds(e,t=new Set){if(!e||t.has(e.id))return null;if(t.add(e.id),"divider"===e.key&&e.footerBannerDividerSlot)return e;if(Array.isArray(e.children))for(const n of e.children){const e=Ds(n,t);if(e)return e}return null}function Us(e){return String(e??"").replace(/<[^>]+>/g,"").trim()}function Es(e){const t=/<div[^>]*>([\s\S]*?)<\/div>/i.exec(e||"");return t?t[1].trim():Us(e)}function zs(e){return`<div style="text-align:center">${e}</div>`}function Fs(e,t,n){const o=n||"{{unsubscribe_url}}",l=t||"Unsubscribe";return`<div style="text-align:center">${null!=e&&""!==String(e).trim()?String(e).trim():kl} ${`<a href="${o}">${l}</a>`}</div>`}function Os(e){const t={bodyText:kl,unsubLabel:"Unsubscribe",unsubUrl:"{{unsubscribe_url}}"};if(!e)return t;if("text"===e.key)return{bodyText:e.unsubscribeBodyText??t.bodyText,unsubLabel:e.unsubscribeLinkLabel??t.unsubLabel,unsubUrl:e.unsubscribeUrl??t.unsubUrl};if("menu"===e.key&&Array.isArray(e.list)){const n=e.list[0]||{};return{bodyText:t.bodyText,unsubLabel:String(n.label??t.unsubLabel),unsubUrl:String(n.url??t.unsubUrl)}}return t}function Ws(e,t){return{id:e.id,name:e.name,key:"text",footerSlot:"unsubscribe",hidden:e.hidden,text:Fs(t.bodyText,t.unsubLabel,t.unsubUrl),unsubscribeBodyText:t.bodyText??kl,unsubscribeLinkLabel:t.unsubLabel||"Unsubscribe",unsubscribeUrl:t.unsubUrl||"{{unsubscribe_url}}",contentStyles:e.contentStyles||{desktop:{paddingTop:2,paddingBottom:2,paddingLeft:4,paddingRight:4,textAlign:"center"},mobile:{}},styles:e.styles?.desktop||e.styles?.mobile?e.styles:{desktop:{fontSize:12,fontFamily:"Arial, sans-serif",color:"#737373"},mobile:{}},isPreset:e.isPreset}}const js=[10,11,12,13,14,16];function Hs(){const{currentItem:e,templateData:t,previewMode:o,apiConfig:i}=n(Ln),{t:s}=ja(),{findStyleItem:c,updateItemStyles:d}=Rr(),[u,p]=a(null);r(()=>{p(null)},[e?.id]);const m=e.data,g=e=>u===e,y=(e,n)=>g(e)?n:bl(n??"",t),b=(e,n)=>g(e)?n:fl(n??"",t),f=l(()=>{const e={};for(const t of Object.values($s))e[t]=Rs(m,t);return e},[m.id,JSON.stringify(m.children)]),_=e=>{d(e)},v=(e,t)=>{const n=f[e];n?.id&&_(Ps(xt(m),n.id,t))},w=(e,t)=>{v(e,e=>({...e,hidden:!t}))},S=e=>{const t=f[e];return!!t&&!0!==t.hidden},C=f[$s.logo],N=f[$s.brand],L=f[$s.tagline],T=f[$s.address],A=f[$s.unsubscribe],I=f[$s.social],$=f[$s.secondary],P=f[$s.copyright];r(()=>{if(!A||"menu"!==A.key)return;const e=Os(A);v($s.unsubscribe,t=>"menu"===t.key?Ws(t,e):t)},[A?.key]);const R=S($s.logo),M=S($s.brand),D=S($s.tagline),U=S($s.address),E=S($s.unsubscribe),z=S($s.social),F=S($s.secondary),O=S($s.copyright),W=C?.src??"{{LogoUrl}}",j=l(()=>{const e="string"==typeof W?W.trim():String(W??""),n=e&&/^\{\{\w+\}\}$/.test(e)?e.replace(/\{\{|\}\}/g,"").trim():"",o=t&&n?$o(t,n,{}):null;return null==o||String(o).startsWith("{{")?yl(W,t)||W||"":String(o)},[W,t]),H=C?.alt??"Logo",K=C?.linkURL??"",V=String(C?.styles?.desktop?.width??"30%"),G=parseInt(V.replace("%",""),10)||30,q=C?.contentStyles?.desktop?.paddingTop??C?.contentStyles?.desktop?.paddingLeft??12,J=l(()=>Ms(m),[m.id,JSON.stringify(m.children)]),Y=!0===m.showFooterBanner,X=J?.src??"{{FooterBanner}}",Z=l(()=>{const e="string"==typeof X?X.trim():String(X??""),n=e&&/^\{\{\w+\}\}$/.test(e)?e.replace(/\{\{|\}\}/g,"").trim():"",o=t&&n?$o(t,n,{}):null;return null==o||String(o).startsWith("{{")?X||"":String(o)},[X,t]),Q=J?.alt??"",ee=J?.linkURL??"",te=function(e){const t=/<b>([\s\S]*?)<\/b>/i.exec(e||"");return t?t[1].trim():Us(e)}(N?.text??""),ne=Es(L?.text??""),oe=Es(T?.text??""),le=Es(P?.text??"");const ae=Os(A),ie=$?.list??[],re=c(m.styles,"color")??"#737373",se=c(m.styles,"linkColor"),ce=null!=se&&""!==String(se).trim()?String(se).trim():"",de=c(m.styles,"backgroundColor")??"transparent",ue=c(m.styles,"contentBackground")??"#ffffff",pe=c(m.styles,"fontSize")??12,me=c(m.styles,"textAlign")??"center",ge=c(m.styles,"paddingTop")??28,fe=c(m.styles,"paddingBottom")??28,_e=c(m.styles,"paddingLeft")??24,ke=c(m.styles,"paddingRight")??24,ve=l(()=>js.map(e=>({value:e,label:`${e}px`})),[]),we=e=>{const t=xt(m);t.styles||(t.styles={desktop:{},mobile:{}}),t.styles.desktop||(t.styles.desktop={}),Object.assign(t.styles.desktop,e),_(t)},xe=e=>{J?.id&&_(Ps(xt(m),J.id,e))},Se=e=>{v($s.secondary,t=>({...t,list:e,useNavigationLinks:!1}))},Ce=e=>{v($s.unsubscribe,t=>{const n={...Os(t),...e},o=Fs(n.bodyText,n.unsubLabel,n.unsubUrl);return"text"===t.key?{...t,text:o,unsubscribeBodyText:n.bodyText,unsubscribeLinkLabel:n.unsubLabel,unsubscribeUrl:n.unsubUrl}:Ws(t,n)})},Ne=(new Date).getFullYear();return Je("div",{className:"margin-y-30 ee-settings-block-form ee-footer-native-shell-settings",children:[qe(_r,{children:s("footer_visible_lines")}),qe(vr,{layout:"toggle",label:s("show_logo"),children:qe(pr,{checked:R,onChange:e=>w($s.logo,e)})}),qe(vr,{layout:"toggle",label:s("show_footer_banner"),children:qe(pr,{checked:Y,onChange:e=>{let t=xt(m);t.showFooterBanner=e,e&&!Ms(t)&&(t=function(e,t){const n=xt(e),o=function(e){const t=e.children?.find(e=>"content"===e.key);return t||e.children?.[0]}(n);if(!o?.children)return n;const l=!0===e.showFooterBanner,a={id:Nt(),name:t("image"),key:"image",footerBannerSlot:!0,src:"{{FooterBanner}}",alt:"",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:8,paddingBottom:8,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}},hidden:!l},i={id:Nt(),name:t("divider"),key:"divider",footerBannerDividerSlot:!0,hidden:!l,contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"100%",borderTopStyle:"solid",borderTopColor:"#ccc",borderTopWidth:1,display:"inline-block",verticalAlign:"middle"},mobile:{}}},r=[...o.children];return r.splice(0,0,a,i),{...n,children:(n.children||[]).map(e=>e.id===o.id?{...e,children:r}:e)}}(t,s));const n=Ms(t);n?.id&&(t=Ps(t,n.id,t=>({...t,hidden:!e})));const o=Ds(t);o?.id&&(t=Ps(t,o.id,t=>({...t,hidden:!e}))),_(t)}})}),qe(vr,{layout:"toggle",label:s("footer_toggle_brand_name"),children:qe(pr,{checked:M,onChange:e=>w($s.brand,e)})}),qe(vr,{layout:"toggle",label:s("footer_toggle_tagline"),children:qe(pr,{checked:D,onChange:e=>w($s.tagline,e)})}),qe(vr,{layout:"toggle",label:s("footer_toggle_address"),children:qe(pr,{checked:U,onChange:e=>w($s.address,e)})}),qe(vr,{layout:"toggle",label:s("footer_toggle_social_row"),children:qe(pr,{checked:z,onChange:e=>w($s.social,e)})}),qe(vr,{layout:"toggle",label:s("footer_toggle_secondary_links"),children:qe(pr,{checked:F,onChange:e=>w($s.secondary,e)})}),qe(vr,{layout:"toggle",label:s("footer_toggle_unsubscribe"),children:qe(pr,{checked:E,onChange:e=>w($s.unsubscribe,e)})}),qe(vr,{layout:"toggle",label:s("footer_toggle_copyright"),children:qe(pr,{checked:O,onChange:e=>w($s.copyright,e)})}),R&&C?Je(Ye,{children:[qe(_r,{className:"margin-top-12",children:s("logo_section")}),qe(vr,{label:s("image_url"),children:qe(h,{className:"width-full",value:g("logoSrc")?W:j,placeholder:s("placeholder_https"),onFocus:()=>p("logoSrc"),onBlur:()=>p(e=>"logoSrc"===e?null:e),onChange:e=>v($s.logo,t=>({...t,src:e.target.value}))})}),qe(vr,{label:s("logo_alt"),children:qe(h,{className:"width-full",value:y("logoAlt",H),placeholder:"Logo",onFocus:()=>p("logoAlt"),onBlur:()=>p(e=>"logoAlt"===e?null:e),onChange:e=>v($s.logo,t=>({...t,alt:e.target.value}))})}),qe(vr,{label:s("logo_link"),children:qe(h,{className:"width-full",value:b("logoLink",K),placeholder:s("link_url_placeholder"),onFocus:()=>p("logoLink"),onBlur:()=>p(e=>"logoLink"===e?null:e),onChange:e=>v($s.logo,t=>({...t,linkURL:e.target.value,linkEnabled:Boolean(e.target.value)}))})}),qe(vr,{label:s("logo_max_width"),children:qe(k,{min:10,max:100,className:"input-width ee-settings-input-affix",addonAfter:"%",value:G,onFocus:e=>e?.target?.select?.(),onChange:e=>v($s.logo,t=>({...t,styles:{...t.styles,desktop:{...t.styles?.desktop,width:`${e||30}%`}}}))})}),qe(vr,{label:s("logo_padding"),children:qe(k,{min:0,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:"number"==typeof q?q:12,onFocus:e=>e?.target?.select?.(),onChange:e=>v($s.logo,t=>({...t,contentStyles:{...t.contentStyles,desktop:{...t.contentStyles?.desktop,paddingTop:e??12,paddingBottom:e??12,paddingLeft:e??12,paddingRight:e??12}}}))})})]}):null,Y&&J?Je(Ye,{children:[qe(_r,{className:"margin-top-12",children:s("footer_banner_section")}),qe(vr,{label:s("image_url"),children:qe(h,{className:"width-full",value:g("footerBannerSrc")?X:Z,placeholder:s("placeholder_https"),onFocus:()=>p("footerBannerSrc"),onBlur:()=>p(e=>"footerBannerSrc"===e?null:e),onChange:e=>xe(t=>({...t,src:e.target.value}))})}),qe(vr,{label:s("image_alt"),children:qe(h,{className:"width-full",value:y("footerBannerAlt",Q),placeholder:s("image_alt_placeholder"),onFocus:()=>p("footerBannerAlt"),onBlur:()=>p(e=>"footerBannerAlt"===e?null:e),onChange:e=>xe(t=>({...t,alt:e.target.value}))})}),qe(vr,{label:s("link_url"),children:qe(h,{className:"width-full",value:b("footerBannerLink",ee),placeholder:s("link_url_placeholder"),onFocus:()=>p("footerBannerLink"),onBlur:()=>p(e=>"footerBannerLink"===e?null:e),onChange:e=>xe(t=>({...t,linkURL:e.target.value,linkEnabled:Boolean(e.target.value)}))})})]}):null,qe(_r,{className:"margin-top-12",children:s("footer_content_heading")}),M&&N?qe(vr,{label:s("footer_label_brand"),children:qe(h,{className:"width-full",value:y("brandName",te),placeholder:s("footer_brand_name_placeholder"),onFocus:()=>p("brandName"),onBlur:()=>p(e=>"brandName"===e?null:e),onChange:e=>v($s.brand,t=>{return{...t,text:(n=e.target.value,`<div style="text-align:center"><b>${n}</b></div>`)};var n})})}):null,D&&L?qe(vr,{label:s("brand_tagline"),children:qe(h,{className:"width-full",value:y("tagline",ne),placeholder:s("footer_brand_tagline_placeholder"),onFocus:()=>p("tagline"),onBlur:()=>p(e=>"tagline"===e?null:e),onChange:e=>v($s.tagline,t=>({...t,text:zs(e.target.value)}))})}):null,U&&T?qe(vr,{label:s("address"),children:qe(h.TextArea,{className:"width-full",value:y("address",oe),rows:2,placeholder:s("footer_address_placeholder"),onFocus:()=>p("address"),onBlur:()=>p(e=>"address"===e?null:e),onChange:e=>v($s.address,t=>({...t,text:zs(e.target.value)}))})}):null,z&&I?Je(Ye,{children:[qe(_r,{className:"margin-top-12",children:s("footer_social_platforms_heading")}),qe(Ns,{blockNode:I,onUpdateBlock:e=>v($s.social,()=>e),previewMode:o,findStyleItem:c,apiConfig:i,templateData:t,embedded:!0},I.id)]}):null,F&&$?Je(Ye,{children:[qe(_r,{className:"margin-top-12",children:s("footer_secondary_links_heading")}),Je("div",{className:"margin-top-12 ee-settings-stack-flat",children:[ie.map((e,t)=>Je("div",{className:"margin-bottom-12",children:[qe(vr,{label:`${s("footer_secondary_link_text")} ${t+1}`,children:qe(h,{className:"width-full",value:e.label||"",onChange:e=>{const n=[...ie];n[t]={...n[t],label:e.target.value},Se(n)}})}),qe(vr,{label:s("footer_secondary_link_url"),children:qe(h,{className:"width-full",value:e.url||"",onChange:e=>{const n=[...ie];n[t]={...n[t],url:e.target.value},Se(n)}})})]},`${e.label}-${t}`)),Je("button",{type:"button",className:"menu-add-new-item",onClick:()=>Se([...ie,{label:s("footer_new_link_label"),url:"#",target:"_self"}]),children:[qe("span",{className:"menu-add-new-item-icon",children:"+"})," ",s("footer_add_link")]})]})]}):null,E&&A?Je(Ye,{children:[qe(_r,{className:"margin-top-12",children:s("footer_toggle_unsubscribe")}),qe(vr,{label:s("footer_unsubscribe_body_text"),children:qe(h,{className:"width-full",value:y("bodyText",ae.bodyText),placeholder:kl,onFocus:()=>p("bodyText"),onBlur:()=>p(e=>"bodyText"===e?null:e),onChange:e=>Ce({bodyText:e.target.value})})}),qe(vr,{label:s("footer_unsubscribe_link_label"),children:qe(h,{className:"width-full",value:y("unsubLabel",ae.unsubLabel),onFocus:()=>p("unsubLabel"),onBlur:()=>p(e=>"unsubLabel"===e?null:e),onChange:e=>Ce({unsubLabel:e.target.value})})}),qe(vr,{label:s("unsubscribe_url"),children:qe(h,{className:"width-full",value:b("unsubUrl",ae.unsubUrl),placeholder:s("footer_unsubscribe_url_placeholder"),onFocus:()=>p("unsubUrl"),onBlur:()=>p(e=>"unsubUrl"===e?null:e),onChange:e=>Ce({unsubUrl:e.target.value})})})]}):null,O&&P?qe(vr,{label:s("copyright_text"),children:qe(h,{className:"width-full",value:y("copyright",le),placeholder:s("footer_copyright_placeholder",{year:Ne}),onFocus:()=>p("copyright"),onBlur:()=>p(e=>"copyright"===e?null:e),onChange:e=>v($s.copyright,t=>{return{...t,text:(n=e.target.value,`<div style="text-align:center;font-size:11px;opacity:0.9">${n}</div>`)};var n})})}):null,qe(_r,{className:"margin-top-12",children:s("footer_style_heading")}),qe(vr,{label:s("footer_text_color"),children:qe(cr,{color:re,setColor:({hex:e})=>we({color:e})})}),qe(vr,{label:s("footer_link_color"),children:qe(cr,{color:ce||re,setColor:({hex:e})=>we({linkColor:e})})}),qe(vr,{label:s("footer_background_content"),children:qe(cr,{color:ue,setColor:({hex:e})=>we({contentBackground:e||"#ffffff"})})}),qe(vr,{label:s("footer_column_background"),children:qe(cr,{color:de,setColor:({hex:e})=>we({backgroundColor:e||"transparent"})})}),qe(vr,{label:s("font_size"),children:qe(x,{className:"width-full ee-stack-control",value:"number"==typeof pe?pe:parseInt(String(pe||"12"),10),onChange:e=>we({fontSize:e}),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,options:ve})}),qe(vr,{label:s("footer_align"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:me,onChange:e=>we({textAlign:e}),"aria-label":s("footer_align"),items:[{value:"left",label:qe(B,{icon:he})},{value:"center",label:qe(B,{icon:ye})},{value:"right",label:qe(B,{icon:be})}]})}),qe(vr,{label:s("label_padding"),children:qe(mr,{padding:{paddingTop:ge,paddingBottom:fe,paddingLeft:_e,paddingRight:ke},setPadding:we})})]})}const Ks=[10,11,12,13,14,16],Vs="__ee_footer_social_custom__",Gs=[{value:"instagram",image:pt("instagram"),labelKey:"footer_social_instagram",title:"Instagram"},{value:"facebook",image:pt("facebook"),labelKey:"footer_social_facebook",title:"Facebook"},{value:"twitter",image:pt("x"),labelKey:"footer_social_twitter",title:"Twitter"},{value:"linkedin",image:pt("linkedin"),labelKey:"footer_social_linkedin",title:"LinkedIn"},{value:"youtube",image:pt("youtube"),labelKey:"footer_social_youtube",title:"YouTube"},{value:"tiktok",image:pt("tiktok"),labelKey:"footer_social_tiktok",title:"TikTok"}];function qs(e){const t=String(e?.image||"").toLowerCase(),n=Gs.find(e=>String(e.image).toLowerCase()===t);return n?n.value:t.includes("brand-instagram")||t.includes("tc-instagram")?"instagram":t.includes("brand-facebook")||t.includes("tc-facebook")?"facebook":t.includes("brand-x")||t.includes("tc-x")?"twitter":t.includes("brand-linkedin")||t.includes("tc-linkedin")?"linkedin":t.includes("brand-youtube")||t.includes("tc-youtube")?"youtube":t.includes("brand-tiktok")||t.includes("tc-tiktok")?"tiktok":"custom"}const Js={facebook:"social_link_placeholder_facebook",linkedin:"social_link_placeholder_linkedin",instagram:"social_link_placeholder_instagram",tiktok:"social_link_placeholder_tiktok",youtube:"social_link_placeholder_youtube"};function Ys(e,t){if(at(e))return t("social_link_placeholder_x");const n=String(e?.title||"").trim().toLowerCase(),o=Js[n];return t(o||"social_link_placeholder_generic")}function Xs({preset:e,t:t}){const n={image:e.image,title:e.title},{src:o,style:l}=vt(n,"default",22);return Je("span",{className:"ee-social-add-menu-item",children:[o?qe("img",{src:o,alt:"",className:"ee-social-add-menu-icon",style:l,draggable:!1}):null,qe("span",{children:t(e.labelKey)})]})}const Zs=()=>{const{currentItem:e,apiConfig:t,templateData:s}=n(Ln),{t:c}=ja(),{findStyleItem:d,updateItemStyles:u}=Rr(),p=i(null),m=i(null),g=i(null),[y,b]=a(null),[f,_]=a(!1),[v,w]=a(null),[C,N]=a(!1),[T,A]=a(null),[I,$]=a(!1),[P,R]=a(null),[M,D]=a({}),[U,E]=a(null);r(()=>{E(null)},[e?.id]);const{uploadImageFile:z,isConfigured:F}=Hr({imageUploadEndpoint:t?.imageUploadEndpoint,headers:t?.headers||{},companyId:t?.companyId,imageUploadQueryParams:t?.imageUploadQueryParams,imageUploadCompanyField:t?.imageUploadCompanyField}),O=()=>document.querySelector(".right-settings")||document.body,W=l(()=>Ks.map(e=>({value:e,label:`${e}px`})),[]),j=t=>{const n=xt(e.data);Object.assign(n,t),"footer"===n.containerType&&Object.prototype.hasOwnProperty.call(t,"footerSocialList")&&(n.footerUseCompanySocial=!1),u(n)},H=t=>{const n=xt(e.data);n.styles||(n.styles={desktop:{},mobile:{}}),n.styles.desktop||(n.styles.desktop={}),Object.assign(n.styles.desktop,t),u(n)};r(()=>{const t=e?.data;if(!t||"footer"!==t.containerType||!t.footerUnifiedLayout)return;if(!s)return;const n=function(e,t){if(!t||!e)return{};const n={},o=t.companyContext||{},l=t.brandContext||{};if(hl(e.brandName)&&null!=o.name&&""!==String(o.name).trim()&&(n.brandName=String(o.name).trim()),hl(e.address)&&null!=o.address&&""!==String(o.address).trim()&&(n.address=String(o.address).trim()),hl(e.brandTagline)&&null!=l.tagline&&""!==String(l.tagline).trim()&&(n.brandTagline=String(l.tagline).trim()),hl(e.footerLogoSrc)&&null!=l.logo_url&&""!==String(l.logo_url).trim()&&(n.footerLogoSrc=String(l.logo_url).trim()),hl(e.footerLogoLink)&&null!=o.website&&""!==String(o.website).trim()&&(n.footerLogoLink=String(o.website).trim()),hl(e.footerLogoAlt)&&null!=o.name&&""!==String(o.name).trim()&&(n.footerLogoAlt=String(o.name).trim()),hl(e.copyrightText)&&null!=o.name&&""!==String(o.name).trim()){const e=(new Date).getFullYear();n.copyrightText=`© ${e} ${String(o.name).trim()}`}return n}(t,s);if(0===Object.keys(n).length)return;const o=xt(t);Object.assign(o,n),o.footerUnifiedLayout=!0,u(o)},[e?.data,s,u]);const G=Boolean(e.data.showBrand??!0),q=Boolean(e.data.showTagline??!0),Y=Boolean(e.data.footerShowLogo??!1),X=e.data.footerLogoSrc??"",Z=e.data.footerLogoAlt??"Logo",Q=e.data.footerLogoLink??"",ee="number"==typeof e.data.footerLogoMaxWidthPercent?e.data.footerLogoMaxWidthPercent:parseInt(String(e.data.footerLogoMaxWidthPercent??"30"),10)||30,te="number"==typeof e.data.footerLogoPaddingPx?e.data.footerLogoPaddingPx:parseInt(String(e.data.footerLogoPaddingPx??"24"),10)||24,ne=l(()=>yl(X,s),[X,s]),oe=e=>U===e,le=(e,t)=>oe(e)?t:bl(t??"",s),ae=Boolean(e.data.showAddress??!0),ie=Boolean(e.data.showUnsubscribe??!0),re=Boolean(e.data.showSocial??!1),se=Boolean(e.data.showSecondaryLinks??!1),ce=Boolean(e.data.showCopyright??!0),de=e.data.footerSelectedSegment??null,ue=e.data.brandName??"",pe=e.data.brandTagline??"",me=e.data.address??"",ge=vl(e.data),fe=null!=e.data.unsubscribeLinkLabel?String(e.data.unsubscribeLinkLabel):ge.unsubscribeLinkLabel,ke=e.data.unsubscribeBodyText??"",ve=e.data.unsubscribeUrl??"",we=e.data.copyrightText??"",xe=xl(e.data.secondaryLinks),Se=wl(e.data.footerSocialList);r(()=>{null!=v&&v>=Se.length&&w(Se.length?Se.length-1:null)},[v,Se.length]),r(()=>{de&&requestAnimationFrame(()=>{document.getElementById(`ee-footer-settings-segment-${de}`)?.scrollIntoView?.({block:"nearest",behavior:"smooth"})})},[de,e?.id]);const Ce=e.data.styles?.desktop??{},Ne=d(e.data.styles,"color")??"#737373",Le=d(e.data.styles,"linkColor"),Te=null!=Le&&""!==String(Le).trim()?String(Le).trim():"",Be=d(e.data.styles,"backgroundColor")??"transparent",Ae=gl(d(e.data.styles,"contentBackground")??""),Ie=d(e.data.styles,"fontSize")??12,$e=d(e.data.styles,"textAlign")??"center",Pe=d(e.data.styles,"paddingTop")??28,Re=d(e.data.styles,"paddingBottom")??28,Me=d(e.data.styles,"paddingLeft")??24,De=d(e.data.styles,"paddingRight")??24,Ue=Boolean(e.data.showDivider??!1),Ee=e.data.dividerColor??"#374151",ze=Boolean(e.data.showBorderTop??!1),Fe=e.data.borderTopColor??Ce.borderTopColor??"#e5e7eb",Oe="number"==typeof e.data.borderTopWidth?e.data.borderTopWidth:parseInt(String(e.data.borderTopWidth??"1"),10)||1,We=(new Date).getFullYear(),je=l(()=>Gs.map(e=>({value:e.value,label:c(e.labelKey)})),[c]),He=l(()=>[...je,{value:Vs,label:c("footer_social_custom_icon")}],[je,c]),Ke=l(()=>[{label:c("same_tab"),value:"_self"},{label:c("new_tab"),value:"_blank"}],[c]),Ve=e=>{const t=e.map(e=>({...e,id:e.id||Nt()}));j({secondaryLinks:xl(t)})},Ge=e=>{const t=e.map(e=>({...e,id:e.id||Nt()}));j({footerSocialList:wl(t)})},Xe=(e,t)=>{Ge(Se.map((n,o)=>o===e?{...n,...t,id:n.id||Nt()}:n))},Ze=(e,t,n)=>{const o=((e,t,n)=>{const o=String(e??"").trim(),l=`Footer link ${t+1}${n?` (${n})`:""} -> URL`,a=lt(o,!1,{allowMailtoTel:!0});return a?"empty"===a?`${l} is empty. Add a destination like 'https://example.com'.`:"blocked_scheme"===a?`${l} ('${o}') uses a blocked protocol. Use https://, http://, mailto:, or tel:.`:"duplicate_protocol"===a?`${l} ('${o}') repeats the protocol. Keep one protocol, e.g. 'https://example.com'.`:"missing_hostname_dot"===a?`${l} ('${o}') is missing a valid hostname. Use a full domain like 'https://example.com'.`:"invalid_protocol"===a?`${l} ('${o}') has an unsupported protocol. Use https://, http://, mailto:, or tel:.`:`${l} ('${o}') is invalid. Fix it to a valid URL like 'https://example.com'.`:""})(e,t,n);D(e=>{if(!o&&!e[t])return e;const n={...e};return o?n[t]=o:delete n[t],n})},Qe=o(St(e=>{e.preventDefault();const t=m.current,n=e.target?.closest?.(".social-link-item[data-index]");if(!n||!t?.contains(n))return;const o=Array.from(t.querySelectorAll(".social-link-item[data-index]")).indexOf(n);if(-1===o)return;const l=T,a=xt(Se);null==l||l===o||a.length<2||([a[o],a[l]]=[a[l],a[o]],A(o),Ge(a),w(e=>e===l?o:e===o?l:e))},50),[T,Se]),et=o(St(e=>{e.preventDefault();const t=g.current,n=e.target?.closest?.(".social-link-item[data-index]");if(!n||!t?.contains(n))return;const o=Array.from(t.querySelectorAll(".social-link-item[data-index]")).indexOf(n);if(-1===o)return;const l=P,a=xt(xe);null==l||l===o||a.length<2||([a[o],a[l]]=[a[l],a[o]],R(o),Ve(a))},50),[P,xe]),tt=new Set(Se.map(e=>qs(e)).filter(e=>"custom"!==e)),nt=[...Gs.filter(e=>!tt.has(e.value)).map(e=>({key:`footer-add-${e.value}`,label:qe(Xs,{preset:e,t:c}),onClick:()=>{const t=Se.length;Ge([...Se,{id:Nt(),image:e.image,title:e.title,linkURL:"",socialPlatformKey:e.value}]),w(t)}})),{key:"__footer_add_custom__",label:Je("span",{className:"ee-social-add-menu-item ee-social-add-menu-item--custom",children:[qe("span",{className:"menu-add-new-item-icon",children:"+"}),qe("span",{children:c("footer_social_custom_icon")})]}),onClick:()=>{const e=Se.length;Ge([...Se,{id:Nt(),image:"",title:"",linkURL:""}]),w(e)}}],ot=e=>za("ee-footer-settings-segment",de===e&&"ee-footer-settings-segment--focused");return e?.data?.footerUnifiedLayout?Je("div",{className:"margin-y-30 ee-settings-block-form",children:[qe(_r,{children:c("footer_visible_lines")}),qe(vr,{layout:"toggle",label:c("show_logo"),children:qe(pr,{checked:Y,onChange:e=>j({footerShowLogo:e})})}),qe(vr,{layout:"toggle",label:c("footer_toggle_brand_name"),children:qe(pr,{checked:G,onChange:e=>j({showBrand:e})})}),qe(vr,{layout:"toggle",label:c("footer_toggle_tagline"),children:qe(pr,{checked:q,onChange:e=>j({showTagline:e})})}),qe(vr,{layout:"toggle",label:c("footer_toggle_address"),children:qe(pr,{checked:ae,onChange:e=>j({showAddress:e})})}),qe(vr,{layout:"toggle",label:c("footer_toggle_unsubscribe"),children:qe(pr,{checked:ie,onChange:e=>j({showUnsubscribe:e})})}),qe(vr,{layout:"toggle",label:c("footer_toggle_social_row"),children:qe(pr,{checked:re,onChange:e=>j({showSocial:e})})}),qe(vr,{layout:"toggle",label:c("footer_toggle_secondary_links"),children:qe(pr,{checked:se,onChange:e=>j({showSecondaryLinks:e})})}),qe(vr,{layout:"toggle",label:c("footer_toggle_copyright"),children:qe(pr,{checked:ce,onChange:e=>j({showCopyright:e})})}),qe("div",{id:"ee-footer-settings-segment-logo",className:ot("logo"),children:Y?Je(Ye,{children:[qe(_r,{className:"margin-top-12",children:c("logo_section")}),qe(vr,{label:c("image_url"),children:qe(h,{className:"width-full",value:oe("logoSrc")?X:ne,placeholder:c("placeholder_https"),onFocus:()=>E("logoSrc"),onBlur:()=>E(e=>"logoSrc"===e?null:e),onChange:e=>j({footerLogoSrc:e.target.value})})}),qe(vr,{label:c("logo_alt"),children:qe(h,{className:"width-full",value:le("logoAlt",Z),placeholder:"Logo",onFocus:()=>E("logoAlt"),onBlur:()=>E(e=>"logoAlt"===e?null:e),onChange:e=>j({footerLogoAlt:e.target.value})})}),qe(vr,{label:c("logo_link"),children:qe(h,{className:"width-full",value:(it="logoLink",rt=Q,oe(it)?rt:fl(rt??"",s)),placeholder:c("link_url_placeholder"),onFocus:()=>E("logoLink"),onBlur:()=>E(e=>"logoLink"===e?null:e),onChange:e=>j({footerLogoLink:e.target.value})})}),qe(vr,{label:c("logo_max_width"),children:qe(k,{min:10,max:100,className:"input-width ee-settings-input-affix",addonAfter:"%",value:ee,onFocus:e=>e?.target?.select?.(),onChange:e=>j({footerLogoMaxWidthPercent:e??30})})}),qe(vr,{label:c("logo_padding"),children:qe(k,{min:0,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:te,onFocus:e=>e?.target?.select?.(),onChange:e=>j({footerLogoPaddingPx:e??24})})})]}):null}),qe(_r,{className:"margin-top-12",children:c("footer_content_heading")}),G?qe("div",{id:"ee-footer-settings-segment-brand",className:ot("brand"),children:qe(vr,{label:c("footer_label_brand"),children:qe(h,{className:"width-full",value:le("brandName",ue),placeholder:c("footer_brand_name_placeholder"),onFocus:()=>E("brandName"),onBlur:()=>E(e=>"brandName"===e?null:e),onChange:e=>j({brandName:e.target.value})})})}):null,q?qe("div",{id:"ee-footer-settings-segment-tagline",className:ot("tagline"),children:qe(vr,{label:c("brand_tagline"),children:qe(h,{className:"width-full",value:le("tagline",pe),placeholder:c("footer_brand_tagline_placeholder"),onFocus:()=>E("tagline"),onBlur:()=>E(e=>"tagline"===e?null:e),onChange:e=>j({brandTagline:e.target.value})})})}):null,ae?qe("div",{id:"ee-footer-settings-segment-address",className:ot("address"),children:qe(vr,{label:c("address"),children:qe(h.TextArea,{className:"width-full",value:le("address",me),rows:2,placeholder:c("footer_address_placeholder"),onFocus:()=>E("address"),onBlur:()=>E(e=>"address"===e?null:e),onChange:e=>j({address:e.target.value})})})}):null,ie?Je("div",{id:"ee-footer-settings-segment-unsubscribe",className:ot("unsubscribe"),children:[qe(vr,{label:c("footer_unsubscribe_body_text"),children:qe(h,{className:"width-full",value:ke,placeholder:kl,onChange:e=>j({unsubscribeBodyText:e.target.value})})}),qe(vr,{label:c("footer_unsubscribe_link_label"),children:qe(h,{className:"width-full",value:fe,placeholder:c("footer_default_unsubscribe_text"),onChange:e=>j({unsubscribeLinkLabel:e.target.value})})}),qe(vr,{label:c("unsubscribe_url"),children:qe(h,{className:"width-full",value:ve,placeholder:c("footer_unsubscribe_url_placeholder"),onChange:e=>j({unsubscribeUrl:e.target.value})})})]}):null,ce?qe("div",{id:"ee-footer-settings-segment-copyright",className:ot("copyright"),children:qe(vr,{label:c("copyright_text"),children:qe(h,{className:"width-full",value:le("copyright",we),placeholder:c("footer_copyright_placeholder",{year:We}),onFocus:()=>E("copyright"),onBlur:()=>E(e=>"copyright"===e?null:e),onChange:e=>j({copyrightText:e.target.value})})})}):null,se?Je("div",{id:"ee-footer-settings-segment-secondary",className:ot("secondary"),children:[qe(_r,{className:"margin-top-12",children:c("footer_secondary_links_heading")}),qe("div",{ref:g,onDragOver:et,className:"margin-top-12",children:xe.map((e,t)=>qe("div",{"data-index":t,draggable:!0,onDragStart:()=>{$(!0),R(t)},onDragEnd:e=>{e.currentTarget?.classList?.remove("social-link-item-current"),$(!1),R(null)},className:za("social-link-item","cursor-grab",I&&"social-link-item-drag_start",P===t?"social-link-item-current":"border-transparent"),children:Je("div",{className:"social-link-item-content ee-menu-item-content",children:[Je("div",{className:"ee-menu-item-header flex items-center justify-between margin-bottom-8",children:[Je("div",{className:"flex items-center ee-menu-item-drag-row",children:[qe("span",{className:"social-link-item-drag-handle ee-menu-item-drag-handle","aria-hidden":!0,children:qe(B,{icon:_e,className:"social-link-item-drag-handle-icon"})}),Je("span",{className:"font-semibold",children:[c("footer_secondary_link_text")," ",t+1]})]}),qe("div",{className:"social-link-item-icon social-link-item-icon-slate ee-menu-item-delete",role:"button",tabIndex:0,onClick:()=>{const e=xe.filter((e,n)=>n!==t);Ve(e.length?e:_l()),D(e=>{const n={...e};return delete n[t],n})},onKeyDown:e=>{if("Enter"===e.key||" "===e.key){e.preventDefault();const n=xe.filter((e,n)=>n!==t);Ve(n.length?n:_l())}},children:qe(B,{icon:J,className:"social-link-item-icon-svg social-link-item-icon-svg-deep"})})]}),Je("div",{className:"ee-menu-item-fields ee-settings-stack-flat",children:[qe(vr,{label:c("footer_secondary_link_text"),children:qe(h,{className:"width-full ee-menu-item-input",value:e.label||"",onChange:e=>Ve(xe.map((n,o)=>o===t?{...n,label:e.target.value}:n)),placeholder:c("footer_secondary_link_text")})}),Je(vr,{label:c("footer_secondary_link_url"),children:[qe(h,{className:"width-full ee-menu-item-input",value:e.url||"",status:M[t]?"error":"",onChange:n=>{const o=n.target.value;Ve(xe.map((e,n)=>n===t?{...e,url:o}:e)),M[t]&&Ze(o,t,e.label)},onBlur:n=>Ze(n.target.value,t,e.label),placeholder:c("link_url_placeholder")}),M[t]?qe("div",{className:"ee-field-error",role:"alert",children:M[t]}):null]}),qe(vr,{label:c("target"),children:qe(x,{className:"width-full ee-menu-item-input",value:e.target||"_self",onChange:e=>Ve(xe.map((n,o)=>o===t?{...n,target:e}:n)),getPopupContainer:O,options:Ke})})]})]})},e.id??`sec-${t}`))}),Je("button",{type:"button",className:"menu-add-new-item margin-top-12",onClick:()=>Ve([...xe,{id:Nt(),label:c("footer_new_link_label"),url:"#",target:"_self"}]),children:[qe("span",{className:"menu-add-new-item-icon",children:"+"})," ",c("footer_add_link")]})]}):null,re?Je("div",{id:"ee-footer-settings-segment-social",className:ot("social"),children:[qe(_r,{className:"margin-top-12",children:c("footer_social_platforms_heading")}),qe("input",{ref:p,type:"file",accept:Wr,className:"ee-image-upload-input-hidden",onChange:async e=>{const t=e.target.files?.[0];if(e.target.value="",null==t||null==y)return;const n=jr(t);if("type"!==n)if("size"!==n){if(!F)return S.error(c("image_upload_not_configured")),void b(null);_(!0);try{const e=await z(t);if(e){const t=[...Se],n=t[y];n&&(t[y]={...n,id:n.id||Nt(),image:ol(e)},Ge(t),S.success(c("image_uploaded")))}else S.error(c("image_upload_failed"))}catch(e){S.error(c("image_upload_error"))}finally{_(!1),b(null)}}else S.error(c("image_file_too_large"));else S.error(c("image_upload_invalid_type"))}}),qe("div",{ref:m,onDragOver:Qe,className:"ee-social-link-icons-list margin-top-12",children:Se.map((e,t)=>{const n=function(e){const t=String(e?.image||"").trim(),n=Gs.find(e=>String(e.image).trim()===t);if(n)return n;const o=qs(e);return o&&"custom"!==o?Gs.find(e=>e.value===o)??null:null}(e),o=at(e),l=!n,a=l&&!String(e.title||"").trim()?c("footer_social_custom_icon"):o?c("social_platform_x"):String(e.title||"").trim()?String(e.title||"").trim():c(n?n.labelKey:"footer_social_custom_icon"),i=l&&!String(e.title||"").trim()?c("footer_social_custom_icon"):o?c("social_platform_x_alt"):String(e.title||"").trim()||c(n?n.labelKey:"footer_social_custom_icon"),r=vt(e,"default",22),s=vt(e,"default",28),d=n?n.value:Vs,u=v===t;return qe("div",{"data-index":t,draggable:!0,onDragStart:()=>{N(!0),A(t)},onDragEnd:e=>{e.currentTarget?.classList?.remove("social-link-item-current"),N(!1),A(null)},className:za("social-link-item","cursor-grab",C&&"social-link-item-drag_start",T===t?"social-link-item-current":"border-transparent"),children:Je("div",{className:za("social-link-item-content","ee-menu-item-content","ee-social-link-row-shell"),children:[Je("div",{className:"ee-social-link-row-header",children:[qe("span",{className:"social-link-item-drag-handle","aria-hidden":!0,children:qe(B,{icon:_e,className:"social-link-item-drag-handle-icon"})}),r.src?qe("img",{src:r.src,alt:i,className:"social-link-item-img",style:r.style,draggable:!1}):qe("div",{className:"social-link-item-img ee-social-row-icon-placeholder","aria-hidden":!0}),qe("div",{className:"ee-social-link-row-header-main",children:Je("div",{className:"social-link-platform-title-wrap ee-social-link-row-title-wrap",children:[qe("div",{className:"font-semibold ee-social-link-row-primary-title",children:a}),o?qe("div",{className:"social-link-platform-former-name",children:c("social_platform_formerly_twitter")}):null]})}),Je("div",{className:"ee-social-link-row-tools",children:[qe("button",{type:"button",className:"ee-social-link-row-icon-btn","aria-expanded":u,"aria-label":c(u?"collapse":"expand"),onClick:e=>{e.stopPropagation(),(e=>{w(t=>t===e?null:e)})(t)},children:qe(B,{icon:u?K:V})}),qe("button",{type:"button",className:"ee-social-link-row-icon-btn ee-social-link-row-icon-btn-danger","aria-label":c("delete"),onClick:e=>{e.stopPropagation();const n=Se.filter((e,n)=>n!==t);Ge(n.length?n:$t([],{})),w(e=>e===t?null:null!=e&&e>t?e-1:e)},children:qe(B,{icon:J,className:"social-link-item-icon-svg"})})]})]}),u?Je("div",{className:"ee-social-link-row-detail",children:[qe(vr,{label:c("footer_platform_label"),children:qe(x,{className:"width-full ee-stack-control",value:d,options:He,getPopupContainer:O,onChange:e=>{e!==Vs?((e,t)=>{const n=Gs.find(e=>e.value===t),o=Se[e];if(!o)return;const l=[...Se];n&&(l[e]={...o,id:o.id||Nt(),image:n.image,title:n.title,socialPlatformKey:n.value}),Ge(l)})(t,e):Xe(t,{title:"",image:"",socialPlatformKey:void 0})}})}),qe(vr,{label:c("social_icon_label_field"),children:qe(h,{className:"width-full",value:e.title||"",placeholder:a,onChange:e=>Xe(t,{title:e.target.value})})}),qe(vr,{label:c("footer_social_profile_url"),children:qe(h,{className:"width-full",placeholder:Ys(e,c),value:e.linkURL||"",onChange:e=>Xe(t,{linkURL:e.target.value})})}),qe(vr,{label:c("social_custom_icon"),children:Je("div",{className:"ee-social-custom-icon-row",children:[qe("div",{className:"ee-social-custom-icon-preview",children:s.src?qe("img",{src:s.src,alt:"",style:s.style,draggable:!1}):qe("span",{className:"ee-social-custom-icon-preview-empty","aria-hidden":!0})}),qe("button",{type:"button",className:"menu-add-new-item ee-social-custom-upload-btn ee-footer-social-upload-btn",disabled:!F||f&&y===t,onClick:()=>{b(t),p.current?.click()},children:c(f&&y===t?"uploading":"footer_upload_icon")})]})})]}):null]})},e.id??`soc-${t}`)})}),qe(L,{overlayClassName:"ee-social-add-platform-dropdown",menu:{items:nt},trigger:["click"],getPopupContainer:O,children:Je("button",{type:"button",className:"menu-add-new-item margin-top-12",children:[qe("span",{className:"menu-add-new-item-icon",children:"+"})," ",c("footer_add_platform")]})})]}):null,qe(_r,{className:"margin-top-12",children:c("footer_style_heading")}),qe(vr,{label:c("footer_text_color"),children:qe(cr,{color:Ne,setColor:({hex:e})=>H({color:e})})}),qe(vr,{label:c("footer_link_color"),children:qe(cr,{color:Te||Ne,setColor:({hex:e})=>H({linkColor:e})})}),qe(vr,{label:c("footer_background_content"),children:qe(cr,{color:Ae,setColor:({hex:e})=>H({contentBackground:e||"#ffffff"})})}),qe(vr,{label:c("footer_column_background"),children:qe(cr,{color:Be,setColor:({hex:e})=>H({backgroundColor:e||"transparent"})})}),qe(vr,{label:c("font_size"),children:qe(x,{className:"width-full ee-stack-control",value:"number"==typeof Ie?Ie:parseInt(String(Ie||"12"),10),style:{width:"100%"},onChange:e=>H({fontSize:e}),getPopupContainer:O,options:W})}),qe(vr,{label:c("footer_align"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:$e,onChange:e=>H({textAlign:e}),"aria-label":c("footer_align"),items:[{value:"left",label:qe(B,{icon:he})},{value:"center",label:qe(B,{icon:ye})},{value:"right",label:qe(B,{icon:be})}]})}),qe(_r,{className:"margin-top-12",children:c("footer_border_heading")}),Je("div",{id:"ee-footer-settings-segment-divider",className:ot("divider"),children:[qe(vr,{layout:"toggle",label:c("footer_divider_above"),children:qe(pr,{checked:Ue,onChange:e=>j({showDivider:e})})}),Ue?qe(vr,{label:c("divider_color"),children:qe(cr,{color:Ee,setColor:({hex:e})=>j({dividerColor:e})})}):null]}),qe(vr,{layout:"toggle",label:c("footer_border_top"),children:qe(pr,{checked:ze,onChange:e=>j({showBorderTop:e})})}),ze?Je(Ye,{children:[qe(vr,{label:c("footer_border_top_color"),children:qe(cr,{color:Fe,setColor:({hex:e})=>j({borderTopColor:e})})}),qe(vr,{label:c("border_width"),children:qe(k,{min:1,max:8,className:"input-width ee-settings-input-affix",addonAfter:"px",value:Oe,onFocus:e=>e?.target?.select?.(),onChange:e=>j({borderTopWidth:e??1})})})]}):null,qe(vr,{label:c("label_padding"),children:qe(mr,{padding:{paddingTop:Pe,paddingBottom:Re,paddingLeft:Me,paddingRight:De},setPadding:e=>H({...e})})})]}):qe(Hs,{});var it,rt};function Qs(e,t,n=new Set){if(!e||n.has(e.id))return null;if(n.add(e.id),e.key===t)return e;if(Array.isArray(e.children))for(const o of e.children){const e=Qs(o,t,n);if(e)return e}return null}function ec(e,t,n=new Set){if(!e||n.has(e.id))return null;if(n.add(e.id),"image"===e.key&&String(e.src||"").includes(t))return e;if(Array.isArray(e.children))for(const o of e.children){const e=ec(o,t,n);if(e)return e}return null}function tc(e,t=new Set){if(!e||t.has(e.id))return null;if(t.add(e.id),"image"===e.key&&e.headerBannerSlot)return e;if("image"===e.key&&String(e.src||"").includes("HeroBanner"))return e;if(Array.isArray(e.children))for(const n of e.children){const e=tc(n,t);if(e)return e}return null}function nc(e,t=new Set){if(!e||t.has(e.id))return null;if(t.add(e.id),"divider"===e.key&&e.headerBannerDividerSlot)return e;if(Array.isArray(e.children))for(const n of e.children){const e=nc(n,t);if(e)return e}return null}function oc(e){const t=ec(e,"LogoUrl");if(t)return t;let n=null;return function e(t){if(t&&!n)if("image"!==t.key){if(Array.isArray(t.children))for(const n of t.children)e(n)}else n=t}(e),n}function lc(e,t,n){return e?e.id===t?n(e):Array.isArray(e.children)?{...e,children:e.children.map(e=>lc(e,t,n))}:e:e}function ac(e,t,n,o){const l=t?xt(t):{id:Nt(),name:"Image",key:"image",src:"{{LogoUrl}}",alt:"Logo",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:12,paddingBottom:12,paddingLeft:12,paddingRight:12,textAlign:"left"},mobile:{}},styles:{desktop:{width:"50%"},mobile:{}}},a=n?xt(n):{id:Nt(),name:"Menu",key:"menu",useNavigationLinks:!0,list:Pt.map(e=>({...e})),separator:" | ",contentStyles:{desktop:{paddingTop:16,paddingBottom:16,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:13,fontFamily:"sans-serif",color:"#525252",linkColor:"#525252",letterSpacing:.02,fontWeight:"500",textTransform:"uppercase"},mobile:{}},isPreset:!0},i={paddingTop:20,paddingBottom:16},r=(e,t,n,o)=>({id:Nt(),name:"Content",key:"content",width:t||"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:e.map(e=>"image"===e.key?{...e,id:Nt(),contentStyles:{...e.contentStyles,desktop:{...e.contentStyles?.desktop,textAlign:n||"left",...o||{}}}}:"menu"===e.key?{...e,id:Nt(),contentStyles:{...e.contentStyles,desktop:{...e.contentStyles?.desktop,textAlign:n||"center",...o||{}}}}:{...e,id:Nt()})});let s;switch(e){case"logo_left_nav_right":default:s=[r([l],"50%","left"),r([a],"50%","right",i)];break;case"logo_right_nav_left":s=[r([a],"50%","left",i),r([l],"50%","right")];break;case"logo_center_nav_below":s=[r([l,a],"100%","center")];break;case"logo_only":s=[r([l],"100%","center")];break;case"nav_only":s=[r([a],"100%","center")]}return(e=>{if(!o||!o.banner&&!o.divider)return e;const t=[o.banner,o.divider].filter(Boolean).map(e=>xt(e));return[...e,r(t,"100%","center")]})(s)}const ic=()=>{const{blockMap:e,rootOrder:t,setBlocks:o,currentItem:a,setCurrentItem:i,templateData:r}=n(Ln),{t:s}=ja(),{findStyleItem:c}=Rr(),d=a.data,u=n=>{const{blockMap:l}=jt([n]),r={...e,...l};o(r,t,`edit_${Date.now()}`),i({...a,data:n})},p=l(()=>oc(d),[d.id,JSON.stringify(d.children)]),m=l(()=>Qs(d,"menu"),[d.id,JSON.stringify(d.children)]),g=l(()=>tc(d),[d.id,JSON.stringify(d.children)]),y=l(()=>[{value:"logo_left_nav_right",label:s("header_layout_logo_left_nav_right")},{value:"logo_right_nav_left",label:s("header_layout_logo_right_nav_left")},{value:"logo_center_nav_below",label:s("header_layout_logo_center_nav_below")},{value:"logo_only",label:s("header_layout_logo_only")},{value:"nav_only",label:s("header_layout_nav_only")}],[s]),b=l(()=>[{value:"400",label:s("font_weight_regular")},{value:"500",label:s("font_weight_medium")},{value:"600",label:s("font_weight_semibold")},{value:"700",label:s("font_weight_bold")}],[s]),f=l(()=>[{value:"none",label:s("nav_text_transform_sentence")},{value:"uppercase",label:s("nav_text_transform_uppercase")},{value:"capitalize",label:s("nav_text_transform_capitalize")}],[s]),_=l(()=>[{value:"stack",label:s("stack")},{value:"inline",label:s("inline")}],[s]),v=d.headerLayout||"logo_center_nav_below",w=!1!==d.showLogo,S=!0===d.showHeaderBanner,C=p?.src??"{{LogoUrl}}",N=l(()=>{const e="string"==typeof C?C.trim():String(C??""),t=e&&/^\{\{\w+\}\}$/.test(e)?e.replace(/\{\{|\}\}/g,"").trim():"",n=r&&t?$o(r,t,{}):null;return null==n||String(n).startsWith("{{")?C||"":String(n)},[C,r]),L=g?.src??"{{HeroBanner}}",T=l(()=>{const e="string"==typeof L?L.trim():String(L??""),t=e&&/^\{\{\w+\}\}$/.test(e)?e.replace(/\{\{|\}\}/g,"").trim():"",n=r&&t?$o(r,t,{}):null;return null==n||String(n).startsWith("{{")?L||"":String(n)},[L,r]),B=p?.alt??"Logo",A=p?.linkURL??"",I=String(p?.styles?.desktop?.width??"50%"),$=parseInt(I.replace("%",""),10)||50,P=p?.contentStyles?.desktop?.paddingLeft??12,R=g?.alt??"",M=g?.linkURL??"",D=m?.list??[],U=m?.styles?.desktop?.linkColor??"#525252",E=m?.styles?.desktop?.fontSize??13,z=String(m?.styles?.desktop?.fontWeight??"500"),F=m?.styles?.desktop?.textTransform??"uppercase",O=m?.styles?.desktop?.letterSpacing??.02,W=m?.styles?.desktop?.paddingLeft??8,j=m?.linkUnderline??!1,H=c(d.styles,"contentBackground")??"#ffffff",K=d.showBorderBottom??!1,V=d.mobileLayout??"stack",G=c(d.styles,"paddingTop")??0,q=c(d.styles,"paddingRight")??0,J=c(d.styles,"paddingBottom")??0,Y=c(d.styles,"paddingLeft")??0,X=e=>{p&&u(lc(xt(d),p.id,e))},Z=e=>{g&&u(lc(xt(d),g.id,e))},Q=e=>{m&&u(lc(xt(d),m.id,t=>({...e(t),useNavigationLinks:!1})))},ee=e=>{Q(t=>({...t,styles:{...t.styles,desktop:{...t.styles?.desktop,...e}}}))},te=e=>{u({...xt(d),...e})},ne=e=>{const t=xt(d);t.styles||(t.styles={desktop:{},mobile:{}}),t.styles.desktop||(t.styles.desktop={}),Object.assign(t.styles.desktop,e),u(t)},oe=(e,t,n)=>{Q(o=>{const l=[...o.list||[]];return l[e]={...l[e],[t]:n},{...o,list:l}})},le=["logo_left_nav_right","logo_right_nav_left","logo_center_nav_below","logo_only"].includes(v),ae=["logo_left_nav_right","logo_right_nav_left","logo_center_nav_below","nav_only"].includes(v),ie=()=>document.querySelector(".right-settings")||document.body;return Je("div",{className:"margin-y-30 ee-settings-block-form",children:[qe(_r,{children:s("layout")}),qe(vr,{label:s("style"),children:qe(x,{className:"width-full ee-stack-control",value:v,onChange:e=>{const t=xt(d),n=oc(t),o=Qs(t,"menu"),l=function(e){const t=tc(e),n=nc(e);return t||n?{banner:t,divider:n}:null}(t);t.headerLayout=e,t.children=ac(e,n,o,l);const a=!1!==t.showLogo,i=oc(t);let r=t;i?.id&&(r=lc(r,i.id,e=>({...e,hidden:!a})));const s=!0===r.showHeaderBanner,c=tc(r);c?.id&&(r=lc(r,c.id,e=>({...e,hidden:!s})));const p=nc(r);p?.id&&(r=lc(r,p.id,e=>({...e,hidden:!s}))),u(r)},options:y,getPopupContainer:ie})}),le&&Je(Ye,{children:[qe(_r,{children:s("logo_section")}),qe(vr,{layout:"toggle",label:s("show_logo"),children:qe(pr,{checked:w,onChange:e=>{let t=xt(d);t.showLogo=e;const n=p?.id;n&&(t=lc(t,n,t=>({...t,hidden:!e}))),u(t)}})}),w&&Je(Ye,{children:[qe(vr,{label:s("image_url"),children:qe(h,{className:"width-full",value:N,placeholder:s("placeholder_https"),onChange:e=>X(t=>({...t,src:e.target.value}))})}),qe(vr,{label:s("logo_text"),children:qe(h,{className:"width-full",value:d.logoText??"",placeholder:s("brand_name_placeholder"),onChange:e=>te({logoText:e.target.value})})}),qe(vr,{label:s("logo_alt"),children:qe(h,{className:"width-full",value:B,onChange:e=>X(t=>({...t,alt:e.target.value}))})}),qe(vr,{label:s("logo_link"),children:qe(h,{className:"width-full",value:A,placeholder:s("link_url_placeholder"),onChange:e=>X(t=>({...t,linkURL:e.target.value,linkEnabled:Boolean(e.target.value)}))})}),qe(vr,{label:s("logo_max_width"),children:qe(k,{min:10,max:100,className:"input-width ee-settings-input-affix",addonAfter:"%",value:$,onFocus:e=>e?.target?.select?.(),onChange:e=>X(t=>({...t,styles:{...t.styles,desktop:{...t.styles?.desktop,width:`${e||50}%`}}}))})}),qe(vr,{label:s("logo_padding"),children:qe(k,{min:0,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:P,onFocus:e=>e?.target?.select?.(),onChange:e=>X(t=>({...t,contentStyles:{...t.contentStyles,desktop:{...t.contentStyles?.desktop,paddingTop:e??12,paddingBottom:e??12,paddingLeft:e??12,paddingRight:e??12}}}))})})]})]}),qe(_r,{className:"margin-top-12",children:s("header_banner_section")}),qe(vr,{layout:"toggle",label:s("show_header_banner"),children:qe(pr,{checked:S,onChange:e=>{let t=xt(d);t.showHeaderBanner=e,e&&!tc(t)&&(t=function(e,t){const n=xt(e),o={id:Nt(),name:t("image"),key:"image",headerBannerSlot:!0,src:"{{HeroBanner}}",alt:"",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:8,paddingBottom:8,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},l={id:Nt(),name:t("divider"),key:"divider",headerBannerDividerSlot:!0,contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"100%",borderTopStyle:"solid",borderTopColor:"#ccc",borderTopWidth:1,display:"inline-block",verticalAlign:"middle"},mobile:{}}},a=!0===e.showHeaderBanner;o.hidden=!a,l.hidden=!a;const i={id:Nt(),name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[o,l]};return n.children=[...n.children||[],i],n}(t,s));const n=tc(t);n?.id&&(t=lc(t,n.id,t=>({...t,hidden:!e})));const o=nc(t);o?.id&&(t=lc(t,o.id,t=>({...t,hidden:!e}))),u(t)}})}),S&&g?Je(Ye,{children:[qe(vr,{label:s("image_url"),children:qe(h,{className:"width-full",value:T,placeholder:s("placeholder_https"),onChange:e=>Z(t=>({...t,src:e.target.value}))})}),qe(vr,{label:s("image_alt"),children:qe(h,{className:"width-full",value:R,placeholder:s("image_alt_placeholder"),onChange:e=>Z(t=>({...t,alt:e.target.value}))})}),qe(vr,{label:s("link_url"),children:qe(h,{className:"width-full",value:M,placeholder:s("link_url_placeholder"),onChange:e=>Z(t=>({...t,linkURL:e.target.value,linkEnabled:Boolean(e.target.value)}))})})]}):null,ae&&Je(Ye,{children:[qe(_r,{children:s("navigation")}),qe("div",{className:"margin-top-12",children:D.map((e,t)=>Je("div",{className:"ee-header-nav-link-row",children:[qe(h,{className:"ee-header-nav-link-input",value:e.label,placeholder:s("page"),onChange:e=>oe(t,"label",e.target.value)}),qe(h,{className:"ee-header-nav-link-input",value:e.url,placeholder:s("link_url_placeholder"),onChange:e=>oe(t,"url",e.target.value)}),qe("button",{type:"button",className:"ee-header-nav-remove-btn",onClick:()=>(e=>{Q(t=>({...t,list:(t.list||[]).filter((t,n)=>n!==e)}))})(t),"aria-label":s("tooltip_remove_link"),children:"×"})]},`header-nav-${t}-${e.label??""}`))}),Je("button",{type:"button",className:"ee-header-add-nav-link-btn",onClick:()=>{Q(e=>({...e,list:[...e.list||[],{label:s("default_nav_link_label"),url:"#",target:"_blank"}]}))},children:[qe("span",{className:"ee-header-add-nav-link-btn-icon",children:"+"}),s("add_link")]}),qe(_r,{className:"margin-top-18",children:s("link_style")}),qe(vr,{label:s("color"),children:qe(cr,{color:U,setColor:({hex:e})=>ee({linkColor:e,color:e})})}),qe(vr,{label:s("size"),children:qe(k,{min:10,max:24,className:"input-width ee-settings-input-affix",addonAfter:"px",value:E,onFocus:e=>e?.target?.select?.(),onChange:e=>ee({fontSize:e??13})})}),qe(vr,{label:s("weight"),children:qe(x,{className:"width-full ee-stack-control",value:z,onChange:e=>ee({fontWeight:e}),options:b,getPopupContainer:ie})}),qe(vr,{label:s("transform"),children:qe(x,{className:"width-full ee-stack-control",value:F,onChange:e=>ee({textTransform:e}),options:f,getPopupContainer:ie})}),qe(vr,{label:s("spacing"),children:qe(k,{min:0,max:1,step:.01,className:"input-width ee-settings-input-affix",addonAfter:"em",value:O,onFocus:e=>e?.target?.select?.(),onChange:e=>ee({letterSpacing:e??0})})}),qe(vr,{label:s("gap"),children:qe(k,{min:0,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:W,onFocus:e=>e?.target?.select?.(),onChange:e=>ee({paddingLeft:e??8,paddingRight:e??8})})}),qe(vr,{layout:"toggle",label:s("underline"),children:qe(pr,{checked:j,onChange:e=>Q(t=>({...t,linkUnderline:e}))})})]}),qe(_r,{children:s("container_settings")}),qe(vr,{label:s("background_color"),children:qe(cr,{color:H,setColor:({hex:e})=>ne({contentBackground:e})})}),qe(vr,{layout:"toggle",label:s("border_bottom"),children:qe(pr,{checked:K,onChange:e=>te({showBorderBottom:e})})}),qe(vr,{label:s("mobile_layout"),children:qe(x,{className:"width-full ee-stack-control",value:V,onChange:e=>te({mobileLayout:e}),options:_,getPopupContainer:ie})}),qe(vr,{label:s("label_padding"),children:qe(mr,{padding:{paddingTop:G,paddingRight:q,paddingBottom:J,paddingLeft:Y},setPadding:ne})})]})};function rc(e,t,n){return e?e.id===t?n(e):Array.isArray(e.children)?{...e,children:e.children.map(e=>rc(e,t,n))}:e:e}function sc({columnCurrentItem:e,textBlockId:t}){const o=n(Ln),a=e?.id,i=o.blockMap?.[t],r=l(()=>{if(!a||!t||!i||"text"!==i.key)return null;const n={id:i.id,data:i,type:"edit"};return{...o,currentItem:n,setCurrentItem:n=>{if(n?.id===t&&null!=n?.data){const l=rc(xt(e.data),t,()=>n.data),{blockMap:i}=jt([l]),r={...o.blockMap,...i};return o.setBlocks(r,o.rootOrder,`edit_${Date.now()}`),void o.setCurrentItem({...e,id:a,data:l})}o.setCurrentItem(n)}}},[o,e,a,i,t]);return r?qe(Ln.Provider,{value:r,children:qe(as,{embedded:!0})}):null}function cc(e,t=[]){if(!e)return t;if("text"===e.key&&t.push(e),Array.isArray(e.children))for(const n of e.children)cc(n,t);return t}function dc(e,t,n){return e?e.id===t?n(e):Array.isArray(e.children)?{...e,children:e.children.map(e=>dc(e,t,n))}:e:e}const uc=()=>{const{blockMap:e,rootOrder:t,setBlocks:o,currentItem:a,setCurrentItem:i}=n(Ln),{t:r}=ja(),{findStyleItem:s}=Rr(),c=l(()=>[{value:"400",label:r("font_weight_regular")},{value:"500",label:r("font_weight_medium")},{value:"600",label:r("font_weight_semibold")},{value:"700",label:r("font_weight_bold")}],[r]),d=l(()=>[{value:"dashed",label:r("dashed")},{value:"solid",label:r("solid")},{value:"dotted",label:r("dotted")},{value:"none",label:r("border_none")}],[r]),u=l(()=>[{value:"left",label:r("table_align_left")},{value:"center",label:r("table_align_center")},{value:"right",label:r("table_align_right")}],[r]),p=a.data,m=p.discountVariant??"card",g="card"===m,y=n=>{const{blockMap:l}=jt([n]),r={...e,...l};o(r,t,`edit_${Date.now()}`),i({...a,data:n})},b=e=>{y({...xt(p),...e})},f=e=>{const t=xt(p);t.styles||(t.styles={desktop:{},mobile:{}}),t.styles.desktop||(t.styles.desktop={}),Object.assign(t.styles.desktop,e),y(t)},_=(e,t)=>{y(dc(xt(p),e,t))},v=cc(p),w=g?v[0]??null:null,S=g?v[1]??null:null,C=g?null:v[0]?.id,N=p.showTitle??!0,L=p.discountTitle??"{{DiscountValue}} off your first order",T=p.titleSize??22,B=String(p.titleWeight??"600"),A=p.discountCode??"{{DiscountCode}}",I=p.codeSize??16,$=p.codeSpacing??.08,P=p.codeBorder??"dashed",R=p.codeBorderWidth??1.5,M=p.codeBg??"none",D=p.codeRadius??4,U=s(p.styles,"contentBackground")??(g?"#D8FE91":"#ffa7aa"),E=s(p.styles,"color")??"#171717",z=p.discountAlign??"center",F=p.discountGap??14,O=s(p.styles,"paddingTop")??28,W=s(p.styles,"paddingRight")??24,j=s(p.styles,"paddingBottom")??28,H=s(p.styles,"paddingLeft")??24,K=()=>document.querySelector(".right-settings")||document.body,V=(e,t,n,o={})=>{if(!w)return;const l=void 0!==o.textColor?o.textColor:E,a=void 0!==o.discountAlign?o.discountAlign:z,i=void 0!==o.discountGap?o.discountGap:F;_(w.id,o=>({...o,text:`<p style="text-align:center;margin:0 0 0px"><span style="font-family:Arial;font-size:${t}px;font-weight:${n};color:${l}">${e}</span></p>`,styles:{...o.styles,desktop:{...o.styles?.desktop,fontSize:t,fontWeight:n,textAlign:a,paddingBottom:i}}}))},G=(e,t,n,o,l,a,i={})=>{if(!S)return;const r=void 0!==i.textColor?i.textColor:E,s=void 0!==i.codeBg?i.codeBg:M,c="none"!==s&&""!==s&&s?s:"transparent",d=void 0!==i.discountAlign?i.discountAlign:z,u="none"===o?"none":o,p="none"!==o?r:"transparent";_(S.id,i=>({...i,text:`<p style="text-align:center;margin:0"><span style="font-family:Arial;font-size:${t}px;letter-spacing:${n}em;color:${r}">${e}</span></p>`,styles:{...i.styles,desktop:{...i.styles?.desktop,fontSize:t,letterSpacing:n,textAlign:d,borderTopStyle:u,borderBottomStyle:u,borderLeftStyle:u,borderRightStyle:u,borderTopColor:p,borderBottomColor:p,borderLeftColor:p,borderRightColor:p,borderTopWidth:"none"!==o?`${l}px`:"0px",borderBottomWidth:"none"!==o?`${l}px`:"0px",borderLeftWidth:"none"!==o?`${l}px`:"0px",borderRightWidth:"none"!==o?`${l}px`:"0px",borderRadius:`${a}px`,display:"block",width:"fit-content",maxWidth:"100%",marginLeft:"auto",marginRight:"auto",backgroundColor:c}}}))};return Je("div",{className:"margin-y-30 ee-settings-block-form",children:[qe(_r,{children:r("layout")}),qe(vr,{label:r("style"),children:qe(x,{className:"width-full ee-stack-control",value:m,onChange:e=>{const t="card"===e?"card":"simple";if(t===(p.discountVariant??"card"))return;const n=Er("card"===t?"preset_discount":"preset_discount_simple");if(!n)return;const o=xt(n);o.id=p.id,y(o)},options:[{value:"card",label:r("discount_variant_card")},{value:"simple",label:r("discount_variant_simple")}],getPopupContainer:K})}),!g&&C&&qe(sc,{columnCurrentItem:a,textBlockId:C}),g&&Je(Ye,{children:[qe(_r,{children:r("title")}),qe(vr,{layout:"toggle",label:r("discount_show_title"),children:qe(pr,{checked:N,onChange:e=>{b({showTitle:e}),w&&_(w.id,t=>({...t,hidden:!e}))}})}),N&&Je(Ye,{children:[qe(vr,{label:r("text"),children:qe(h,{className:"width-full",value:L,onChange:e=>{const t=e.target.value;b({discountTitle:t}),V(t,T,B)}})}),qe(vr,{label:r("size"),children:qe(k,{min:12,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:T,onFocus:e=>e?.target?.select?.(),onChange:e=>{b({titleSize:e??22}),V(L,e??22,B)}})}),qe(vr,{label:r("weight"),children:qe(x,{className:"width-full ee-stack-control",value:B,onChange:e=>{b({titleWeight:e}),V(L,T,e)},options:c,getPopupContainer:K})})]}),qe(_r,{children:r("discount_code_section")}),qe(vr,{label:r("text"),children:qe(h,{className:"width-full",value:A,onChange:e=>{const t=e.target.value;b({discountCode:t}),G(t,I,$,P,R,D)}})}),qe(vr,{label:r("size"),children:qe(k,{min:10,max:32,className:"input-width ee-settings-input-affix",addonAfter:"px",value:I,onFocus:e=>e?.target?.select?.(),onChange:e=>{b({codeSize:e??16}),G(A,e??16,$,P,R,D)}})}),qe(vr,{label:r("spacing"),children:qe(k,{min:0,max:1,step:.01,className:"input-width ee-settings-input-affix",addonAfter:"em",value:$,onFocus:e=>e?.target?.select?.(),onChange:e=>{b({codeSpacing:e??0}),G(A,I,e??0,P,R,D)}})}),qe(vr,{label:r("border_style"),children:qe(x,{className:"width-full ee-stack-control",value:P,onChange:e=>{b({codeBorder:e}),G(A,I,$,e,R,D)},options:d,getPopupContainer:K})}),"none"!==P&&qe(vr,{label:r("border_width"),children:qe(k,{min:.5,max:6,step:.5,className:"input-width ee-settings-input-affix",addonAfter:"px",value:R,onFocus:e=>e?.target?.select?.(),onChange:e=>{b({codeBorderWidth:e??1.5}),G(A,I,$,P,e??1.5,D)}})}),qe(vr,{label:r("discount_code_background"),children:qe(cr,{color:"none"===M?"":M,setColor:({hex:e})=>{const t=e||"none";b({codeBg:t}),G(A,I,$,P,R,D,{codeBg:t})}})}),qe(vr,{label:r("discount_code_corner_radius"),children:qe(k,{min:0,max:32,className:"input-width ee-settings-input-affix",addonAfter:"px",value:D,onFocus:e=>e?.target?.select?.(),onChange:e=>{b({codeRadius:e??4}),G(A,I,$,P,R,e??4)}})})]}),qe(_r,{children:r("container_settings")}),qe(vr,{label:r("background_color"),children:qe(cr,{color:U,setColor:({hex:e})=>f({contentBackground:e})})}),g&&Je(Ye,{children:[qe(vr,{label:r("text_color"),children:qe(cr,{color:E,setColor:({hex:e})=>{f({color:e}),(e=>{g&&(V(L,T,B,{textColor:e}),G(A,I,$,P,R,D,{textColor:e}))})(e)}})}),qe(vr,{label:r("text_align"),children:qe(x,{className:"width-full ee-stack-control",value:z,onChange:e=>{b({discountAlign:e}),V(L,T,B,{discountAlign:e}),G(A,I,$,P,R,D,{discountAlign:e})},options:u,getPopupContainer:K})}),qe(vr,{label:r("gap"),children:qe(k,{min:0,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:F,onFocus:e=>e?.target?.select?.(),onChange:e=>{const t=e??14;b({discountGap:t}),V(L,T,B,{discountGap:t})}})})]}),qe(vr,{label:r("label_padding"),children:qe(mr,{padding:{paddingTop:O,paddingRight:W,paddingBottom:j,paddingLeft:H},setPadding:f})})]})},pc=new Set(["header","discount"]),mc=()=>{const{currentItem:e}=n(Ln),t=e?.data?.key,o=e?.data?.containerType,l="column"===t,a=l&&"footer"===o,i=l&&!pc.has(o)&&"footer"!==o;return Je(Ye,{children:[l&&"header"===o&&qe(ic,{}),l&&"discount"===o&&qe(uc,{}),a?qe(Zs,{}):null,i?qe(Xr,{}):null,"text"===t&&qe(as,{}),"button"===t&&qe(cs,{}),"divider"===t&&qe(ds,{}),"spacer"===t&&qe(ps,{}),"menu"===t&&qe(ys,{}),"image"===t&&qe(fs,{}),"video"===t&&qe(_s,{}),"avatar"===t&&qe(ks,{}),"social_link"===t&&qe(Ls,{}),"raw_html"===t&&qe(Bs,{}),"table"===t&&qe(Is,{})]})},gc={error:{icon:we,color:"#F87171",bg:"rgba(127, 29, 29, 0.35)",border:"rgba(248, 113, 113, 0.45)"},warning:{icon:ke,color:"#fbbf24",bg:"rgba(251, 191, 36, 0.08)",border:"rgba(251, 191, 36, 0.25)"},info:{icon:A,color:"#60a5fa",bg:"rgba(96, 165, 250, 0.08)",border:"rgba(96, 165, 250, 0.25)"}},hc=e=>{const t={},n=e=>{Array.isArray(e)&&e.forEach(e=>{e&&"object"==typeof e&&("text"===e.key&&"dynamic"===e.contentType&&(e.dynamicPrompt||e.dynamicSelectedContent)&&(t[e.id]={blockId:e.id,key:e.key,type:e.type||"p",prompt:e.dynamicPrompt??"",selectedContent:e.dynamicSelectedContent??"",options:e.dynamicOptions??[],variable:e.dynamicVariable??"",language:"bn-BD"===e.dynamicAiLanguage?"bn-BD":"en"}),Array.isArray(e.children)&&n(e.children))})};return n(e),t},yc=()=>{const{blockList:e,bodySettings:t,blockMap:o,setCurrentItem:a,setActionType:i,validationMarkers:r,ignoreValidationIssue:s,filterIgnoredValidationIssues:c}=n(Ln),{t:d}=ja(),u=l(()=>{const n=Ia({blockList:e??[],bodySettings:t??null,aiContentRefs:hc(e??[])});return"function"==typeof c?c(n):n},[e,t,c]),p=u.filter(e=>"error"===e.severity),m=u.filter(e=>"warning"===e.severity),g=u.filter(e=>"info"===e.severity),h=(e,t)=>{const n=gc[e.severity]||gc.info,l=`validation_${e.code}`,r=d(l),c=r&&r!==l?r:e.message,u=Boolean(e.blockId&&o?.[e.blockId]);return Je("div",{style:{padding:10,background:n.bg,border:`1px solid ${n.border}`,borderRadius:4,display:"flex",gap:10,marginBottom:8},children:[qe(B,{icon:n.icon,style:{width:14,height:14,color:n.color,flexShrink:0,marginTop:2}}),Je("div",{style:{flex:1,minWidth:0},children:[qe("div",{style:{fontSize:12,fontWeight:700,color:n.color,textTransform:"none"},children:e.location||e.code||d(`compliance_severity_${e.severity}`)||e.severity}),qe("div",{style:{fontSize:11,color:"var(--ee-foreground)",marginTop:2,lineHeight:1.5},children:c}),(u||"function"==typeof s)&&Je("div",{style:{marginTop:6,display:"flex",gap:8},children:[u&&qe("button",{type:"button",onClick:()=>{var t;(t=e.blockId)&&o?.[t]&&(a({id:t,data:o[t],type:"edit"}),i("edit"),"undefined"!=typeof window&&window.requestAnimationFrame(()=>{const e="function"==typeof window.CSS?.escape?window.CSS.escape(String(t)):String(t).replace(/([ #;?%&,.+*~':"!^$[\]()=>|/@])/g,"\\$1"),n=document.querySelector(`[data-block-id="${e}"]`);n&&"function"==typeof n.scrollIntoView&&n.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})}))},style:{background:"transparent",border:"1px solid rgba(255,255,255,0.18)",color:"var(--ee-foreground)",padding:"3px 8px",borderRadius:999,fontSize:11,cursor:"pointer",fontFamily:"inherit"},children:d("export_validation_open_block")||"Open block"}),"function"==typeof s&&qe("button",{type:"button",onClick:()=>s(e),style:{background:"transparent",border:"1px solid rgba(255,255,255,0.12)",color:"var(--ee-muted-foreground)",padding:"3px 8px",borderRadius:999,fontSize:11,cursor:"pointer",fontFamily:"inherit"},title:ma(e),children:d("ignore")})]})]})]},t)},y=0===u.length,b=l(()=>{try{const n=ql({blockList:e??[],bodySettings:t??{}}),o="undefined"!=typeof Blob?new Blob([n]).size:n.length;return Math.max(1,Math.round(o/1024))}catch{return 0}},[e,t]),f=l(()=>{const t=e=>Array.isArray(e)?e.reduce((e,n)=>{if(!n||"object"!=typeof n)return e;return e+("raw_html"===n.key?1:0)+t(n.children)},0):0;return t(e??[])},[e]),_=Math.min(100,b/200*100),k=b>=102,v=!k&&b>=80,w=k?"#f87070":v?"#fbbf24":"var(--ee-primary)",x=k?"#f87070":v?"#fbbf24":"#C6F065",S=k?d("compliance_above_clip")||"Above clip threshold":v?d("compliance_near_clip")||"Approaching clip threshold":d("compliance_below_clip")||"Below clip threshold",C=Je(Ye,{children:[qe(_r,{children:d("compliance_email_size")||"Email size"}),Je("div",{style:{padding:"10px 12px",background:"rgba(255,255,255,0.03)",border:"1px solid rgba(255,255,255,0.08)",borderRadius:6},children:[Je("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[qe("span",{style:{fontSize:12,color:"#A3A3A3",fontVariantNumeric:"tabular-nums"},children:d("compliance_approx_kb",{n:String(b)})}),qe("span",{style:{fontSize:11,fontWeight:600,color:x,fontVariantNumeric:"tabular-nums"},children:S})]}),Je("div",{style:{position:"relative",height:6,background:"rgba(255,255,255,0.08)",borderRadius:99},children:[qe("div",{style:{position:"absolute",left:0,top:0,height:"100%",width:`${_}%`,background:w,borderRadius:99,transition:"width 0.3s ease"}}),qe("div",{style:{position:"absolute",left:"51%",top:-3,bottom:-3,width:1.5,background:"rgba(251,191,36,0.7)",borderRadius:1}})]}),qe("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:6},children:Je("span",{style:{fontSize:10,color:"rgba(251,191,36,0.85)"},children:[102," KB clip"]})}),(k||v||f>0)&&Je("div",{style:{marginTop:8,padding:"6px 8px",background:k?"rgba(248,112,112,0.08)":"rgba(251,191,36,0.08)",border:"1px solid "+(k?"rgba(248,112,112,0.25)":"rgba(251,191,36,0.25)"),borderRadius:4,fontSize:11,color:k?"#f87070":"#fbbf24",lineHeight:1.5},children:[k&&qe("div",{children:d("compliance_clip_reason_over")||"Gmail will clip this email. Reduce content or remove large blocks."}),v&&!k&&qe("div",{children:d("compliance_clip_reason_near")||"Close to Gmail’s clip limit. Consider trimming content."}),f>0&&qe("div",{style:{marginTop:k||v?4:0},children:d("compliance_clip_reason_raw_html",{n:String(f)})||`${f} raw HTML block${f>1?"s":""} — custom HTML is included verbatim and can significantly inflate email size.`})]})]})]});return Je("div",{style:{padding:"14px 14px 18px 14px"},children:[qe(_r,{className:"ee-settings-section-title--flush",children:d("compliance_preflight")||"Pre-flight"}),y?Je("div",{style:{display:"flex",alignItems:"center",gap:10,padding:12,background:"rgba(216, 254, 145, 0.08)",border:"1px solid rgba(216, 254, 145, 0.25)",borderRadius:4},children:[qe(B,{icon:ve,style:{width:16,height:16,color:"var(--ee-primary)"}}),Je("div",{children:[qe("div",{style:{fontSize:13,fontWeight:500},children:d("compliance_all_clear_title")}),qe("div",{style:{fontSize:11,color:"var(--ee-muted-foreground)",marginTop:2},children:d("compliance_all_clear_desc")})]})]}):Je(Ye,{children:[p.length>0&&Je("div",{style:{marginBottom:12},children:[Je("div",{className:"export-validation-errors-heading",style:{fontWeight:600,marginBottom:6,fontSize:12},children:[d("export_validation_errors")," (",p.length,")"]}),p.map((e,t)=>h(e,`e-${t}`))]}),m.length>0&&Je("div",{style:{marginBottom:12},children:[Je("div",{className:"export-validation-warnings-heading",style:{fontWeight:600,marginBottom:6,fontSize:12},children:[d("export_validation_warnings")," (",m.length,")"]}),m.map((e,t)=>h(e,`w-${t}`))]}),g.length>0&&Je("div",{children:[Je("div",{className:"export-validation-info-heading",style:{fontWeight:600,marginBottom:6,fontSize:12},children:[d("export_validation_info")," (",g.length,")"]}),g.map((e,t)=>h(e,`i-${t}`))]})]}),C]})},bc=({open:e,onUnlinkInstance:t,onKeepLinked:n,onClose:o})=>{const{t:l}=ja(),a=()=>{n?.(),o?.()};return Je(g,{className:"ee-modal-dark",title:l("unlink_modal_title")||"Edit universal block",open:e,onCancel:a,footer:[qe(_,{onClick:a,children:l("unlink_modal_keep")||"Keep linked"},"keep"),qe(_,{type:"primary",danger:!0,onClick:()=>{t?.(),o?.()},children:l("unlink_modal_unlink")||"Unlink this copy"},"unlink")],width:440,destroyOnClose:!0,children:[qe("p",{style:{color:"var(--ee-muted-foreground)",marginBottom:8},children:l("unlink_modal_body")||"This block is linked to a universal snippet. Editing it here will affect all uses of this block everywhere."}),qe("p",{style:{color:"var(--ee-muted-foreground)"},children:l("unlink_modal_body2")||"Choose “Unlink this copy” to make an independent copy that only affects this template, or “Keep linked” to edit all instances together."})]})},fc=({onSaveAsUniversal:e})=>{const{blockMap:t,rootOrder:o,setBlocks:l,currentItem:s,setCurrentItem:c,onSaveBlockAsGlobal:d}=n(Ln),{t:u}=ja(),[p,m]=a(!1),[h,y]=a(!1),b=i(null);r(()=>{if(!p)return;const e=e=>{b.current&&!b.current.contains(e.target)&&m(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[p]);const f=s?.id,_=f?t[f]:null;if(!f||!_)return null;const k=()=>m(!1),v="function"==typeof e||"function"==typeof d,w=Boolean(_?.universalBlockId);return Je(Ye,{children:[Je("div",{ref:b,className:"ee-block-actions-menu-wrap",onClick:e=>e.stopPropagation(),children:[qe("button",{type:"button",className:"ee-block-actions-trigger",onClick:()=>m(e=>!e),"aria-haspopup":"true","aria-expanded":p,"aria-label":u("more_actions"),title:u("more_actions"),children:qe(B,{icon:xe})}),p&&Je("div",{className:"ee-block-actions-menu",role:"menu",children:[Je("button",{type:"button",role:"menuitem",className:"ee-block-actions-item",onClick:()=>{k();const e=Ai(t,o,f);e&&(l(e.nextMap,e.nextRootOrder,"add"),c({id:e.newId,data:e.selectionData,type:"edit"}))},children:[qe(B,{icon:G}),qe("span",{children:u("layer_duplicate")})]}),v&&Je("button",{type:"button",role:"menuitem",className:"ee-block-actions-item",onClick:()=>{k(),"function"==typeof e&&e(_)},children:[qe(B,{icon:q}),qe("span",{children:u("save_as_universal")})]}),w&&Je("button",{type:"button",role:"menuitem",className:"ee-block-actions-item",onClick:()=>{k(),y(!0)},children:[qe(B,{icon:E}),qe("span",{children:u("unlink_universal")||"Unlink this copy"})]}),Je("button",{type:"button",role:"menuitem",className:"ee-block-actions-item",onClick:()=>{k();const e={..._,hidden:!_.hidden};l({...t,[f]:e},o,"edit")},children:[qe(B,{icon:_.hidden?Se:H}),qe("span",{children:_.hidden?u("layer_show"):u("layer_hide")})]}),qe("div",{className:"ee-block-actions-divider","aria-hidden":!0}),Je("button",{type:"button",role:"menuitem",className:"ee-block-actions-item ee-block-actions-item-danger",onClick:()=>{k();const e=()=>{const e=Ri(t,o,f,u);e&&(l(e.nextMap,e.nextRootOrder,"delete"),c(null))};"column"===_.key&&Pi(t,f)?g.confirm({title:u("shortcut_delete_confirm_title"),content:u("shortcut_delete_confirm_desc"),okText:u("confirm"),cancelText:u("cancel"),wrapClassName:"ee-modal-dark",onOk:e}):e()},children:[qe(B,{icon:J}),qe("span",{children:u("layer_delete")})]})]})]}),qe(bc,{open:h,onUnlinkInstance:()=>{const e={..._};delete e.universalBlockId,l({...t,[f]:e},o,`edit_${Date.now()}`),c({...s,data:e})},onKeepLinked:()=>{},onClose:()=>y(!1)})]})},_c=({open:e,block:t,onCreate:n,onClose:o})=>{const{t:l}=ja(),[i,s]=a("");r(()=>{e&&s("")},[e]);const c=()=>{i.trim()&&t&&n({name:i.trim(),block:t})};return Je(g,{className:"ee-modal-dark",title:l("universal_save_modal_title"),open:e,onCancel:o,footer:[qe(_,{onClick:o,children:l("cancel")},"cancel"),qe(_,{type:"primary",onClick:c,disabled:!i.trim(),children:l("universal_save_modal_confirm")},"save")],width:420,destroyOnClose:!0,children:[qe("p",{style:{color:"var(--ee-muted-foreground)",marginBottom:12},children:l("universal_save_modal_subtitle")}),qe(h,{autoFocus:!0,value:i,placeholder:l("universal_save_modal_placeholder"),onChange:e=>s(e.target.value),onPressEnter:c})]})},kc="content",vc="styles",wc="compliance";function xc({t:e}){return Je("div",{className:"ee-fill-product-slots-tooltip",children:[qe("p",{className:"ee-fill-product-slots-tooltip-title",children:e("fill_product_slots_tooltip_title")}),Je("div",{className:"ee-fill-product-slots-tooltip-block",children:[qe("p",{className:"ee-fill-product-slots-tooltip-heading",children:e("fill_product_slots_tooltip_on_heading")}),qe("p",{className:"ee-fill-product-slots-tooltip-body",children:e("fill_product_slots_tooltip_on_body")})]}),Je("div",{className:"ee-fill-product-slots-tooltip-block",children:[qe("p",{className:"ee-fill-product-slots-tooltip-heading",children:e("fill_product_slots_tooltip_off_heading")}),qe("p",{className:"ee-fill-product-slots-tooltip-body",children:e("fill_product_slots_tooltip_off_body")})]}),Je("div",{className:"ee-fill-product-slots-tooltip-block ee-fill-product-slots-tooltip-block--watch",children:[qe("p",{className:"ee-fill-product-slots-tooltip-heading",children:e("fill_product_slots_tooltip_watch_heading")}),Je("ul",{className:"ee-fill-product-slots-tooltip-list",children:[qe("li",{children:e("fill_product_slots_tooltip_watch_1")}),qe("li",{children:e("fill_product_slots_tooltip_watch_2")}),qe("li",{children:e("fill_product_slots_tooltip_watch_3")})]})]})]})}const Sc=()=>{const{currentItem:e,isDragStart:t,bodySettings:s,setBodySettings:d,fillProductSlots:u,setFillProductSlots:p,setCurrentItem:m,setActionType:g,blockMap:y,rootOrder:b,validationMarkers:f,onSaveBlockAsGlobal:_,templateData:w}=n(Ln),[C,N]=a(null),{t:L}=ja(),T=o(e=>e&&"object"==typeof e&&"column"===e.key&&e.id&&y[e.id]?Kt(e.id,y)??e:e,[y]),I=o(e=>{N(T(e))},[T]),$=o(async({name:e,block:t})=>{try{"function"==typeof _&&await Promise.resolve(_({name:e,block:t})),S.success(String(L("universal_save_success")||"").replace("{{name}}",e)||`Saved "${e}" as universal`),N(null)}catch(e){console.error("[EmailEditor] onSaveBlockAsGlobal:",e);const t=L("universal_save_error")||"Could not save universal block",n="string"==typeof e?.message&&e.message.trim()?e.message.trim():"string"==typeof e?e:t;S.error(n||t)}},[_,L]);r(()=>{const e=e=>{e.detail&&e.detail.block&&N(T(e.detail.block))};return window.addEventListener("ee:canvas-save-universal",e),()=>window.removeEventListener("ee:canvas-save-universal",e)},[T]);const P=l(()=>Yo(w),[w]),[R,M]=a(kc),D=i(null),E=f?Object.values(f).reduce((e,t)=>e+(t?.totalCount||0),0):0,z=e=>{if(!e)return X;switch(e.key){case"column":{const t=e.containerType;return"product"===t?ee:"discount"===t?te:Mi(e)===Di?X:ne}case"text":{const t=(e.type||"p").toLowerCase();return/^h[1-6]$/.test(t)?Te:ce}case"button":return U;case"image":return O;case"video":return j;case"divider":return se;case"spacer":return re;case"menu":return ie;case"avatar":return W;case"social_link":return ae;case"raw_html":return le;case"table":return oe;case"footer":return Le;default:return X}},F=()=>{if(!e?.id||!y[e.id])return[];const t=[e.id],n=new Set(t);let o=e.id;for(;;){const e=Vt(y,b,o);if(!e||n.has(e.containerId))break;t.unshift(e.containerId),n.add(e.containerId),o=e.containerId}return t.map(e=>({id:e,data:y[e]})).filter(e=>Boolean(e.data))},H=()=>{let t="Block";const n=e?.data.key;switch(n){case"text":{const n=(e?.data?.type||"p").toLowerCase();t=/^h[1-6]$/.test(n)?L("heading_settings"):L("text_settings");break}case"column":{const n=e?.data?.containerType;if("product"===n){t=L("block_product");break}if("header"===n){t=L("header_settings");break}if("discount"===n){t=L("discount_settings");break}if("footer"===n){t=L("footer_settings");break}if(Ei(e?.data)){t=L("additional_products_grid_layout");break}t=Mi(e?.data)===Ui?L("settings_title_column_layout"):L("container_settings");break}case"button":t=L("button_settings");break;case"divider":t=L("divider_settings");break;case"spacer":t=L("spacer_settings");break;case"menu":t=L("menu_settings");break;case"image":t=L("image_settings");break;case"video":t=L("video_settings");break;case"avatar":t=L("avatar_settings");break;case"social_link":t=L("social_link_settings");break;case"raw_html":t=L("raw_html_settings");break;case"table":t=L("table_settings");break;case"footer":t=L("footer_settings")}return t},K=e=>t=>{d({...s,styles:{...s.styles,[e]:t.hex}},"set_body_settings")},V=(e,t,n,o)=>qe(vr,{label:e,children:qe(cr,{color:t,setColor:n,fallbackColor:o})}),G=()=>Je("section",{className:"right-panel-styles-section",children:[qe("h3",{className:"right-panel-styles-section-title",children:L("product_recommendations_section")}),Je("div",{className:"right-panel-styles-section-body ee-settings-stack-flat",children:[qe(vr,{layout:"toggle",label:Je("span",{children:[L("fill_product_slots_label"),qe(v,{overlayClassName:"ee-fill-product-slots-tooltip-overlay",title:qe(xc,{t:L}),children:qe("span",{className:"ee-help-icon","aria-label":L("fill_product_slots_label"),children:qe(B,{icon:A})})})]}),children:qe(pr,{checked:!1!==u,onChange:e=>p(e,"set_fill_product_slots")})}),qe("p",{className:"ee-fill-product-slots-hint"+(!1===u?" ee-fill-product-slots-hint--off":""),children:L(!1!==u?"fill_product_slots_on_hint":"fill_product_slots_off_hint")})]})]}),q=()=>{const e=s.styles||{},t=e.headingColor||e.color||"#171717";return Je("section",{className:"right-panel-styles-section",children:[qe("h3",{className:"right-panel-styles-section-title",children:L("type_styles_section")}),Je("div",{className:"right-panel-styles-section-body ee-settings-stack-flat",children:[qe(vr,{label:L("body_font_short"),children:qe(x,{className:"input-width",showSearch:!0,optionFilterProp:"label",value:Zo(e.fontFamily,w),onChange:e=>{return t=Zo(e,w),void d({...s,styles:{...s.styles,fontFamily:t}},"set_body_settings");var t},labelRender:({value:e})=>qe("span",{children:Qo(e,w)}),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,options:P.map(e=>({label:e.label,value:e.value}))})}),V(L("body_text_short"),e.color,K("color"),"#171717"),V(L("body_heading_short"),t,K("headingColor"),"#171717"),V(L("body_link_short"),e.linkColor||"#338AF3",K("linkColor"),"#338AF3")]})]})},J=()=>{const e=s.styles||{},t=Ft(s);return Je("section",{className:"right-panel-styles-section",children:[qe("h3",{className:"right-panel-styles-section-title",children:L("document_section")}),Je("div",{className:"right-panel-styles-section-body ee-settings-stack-flat",children:[V(L("body_bg_color_short"),e.backgroundColor,K("backgroundColor"),"#F5F5F5"),qe(vr,{label:L("body_width_label"),children:qe(k,{className:"input-width ee-settings-input-affix ee-body-width-number",addonAfter:"px",min:Mt,max:Dt,value:t,onChange:e=>d({...s,contentWidth:e,contentWidthMode:Ut.CUSTOM_PX},"set_body_settings")})})]})]})},Y=()=>{const e=zt(s),t=Ft(s),n=s.styles||{};return Je(Ye,{children:[Je("section",{className:"right-panel-styles-section",children:[qe("h3",{className:"right-panel-styles-section-title",children:L("email_styles_section")}),Je("div",{className:"right-panel-styles-section-body ee-settings-stack-flat",children:[V(L("body_bg_color_short"),n.backgroundColor,K("backgroundColor"),"#F5F5F5"),qe(vr,{label:Je("span",{children:[L("email_width_mode"),qe(v,{title:L("full_bleed_tooltip"),children:qe("span",{className:"ee-help-icon","aria-label":"Help",children:qe(B,{icon:A})})})]}),children:qe(x,{className:"input-width ee-width-mode-select",value:e,onChange:e=>d({...s,contentWidthMode:e},"set_body_settings"),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,options:[{value:Ut.EMAIL_WIDTH,label:L("email_width_default")},{value:Ut.CUSTOM_PX,label:L("custom_px")},{value:Ut.FULL_BLEED,label:L("full_bleed")}]})}),qe(vr,{label:L("custom_width_px"),children:qe(k,{className:"input-width ee-settings-input-affix ee-body-width-number",addonAfter:"px",min:Mt,max:Dt,value:t,disabled:e===Ut.FULL_BLEED,onChange:e=>d({...s,contentWidth:e,contentWidthMode:Ut.CUSTOM_PX},"set_body_settings")})})]})]}),q(),G(),Je("section",{className:"right-panel-styles-section",children:[qe("h3",{className:"right-panel-styles-section-title",children:L("text_and_headings")}),qe("div",{className:"right-panel-styles-section-body",children:qe(vr,{label:L("pre_header"),hint:L("pre_header_description"),children:qe(h,{value:s.preHeader,onChange:e=>d({...s,preHeader:e.target.value},"set_body_settings")})})})]}),Je("section",{className:"right-panel-styles-section",children:[qe("h3",{className:"right-panel-styles-section-title",children:L("mobile_optimization")||"Mobile optimization"}),Je("div",{className:"right-panel-styles-section-body ee-settings-stack-flat",children:[Je("div",{className:"ee-settings-row",children:[qe("span",{className:"ee-settings-row-label",children:L("stack_columns_on_mobile")||"Stack columns on mobile"}),qe(pr,{checked:!1!==s.stackColumnsOnMobile,onChange:e=>d({...s,stackColumnsOnMobile:e},"set_body_settings")})]}),Je("div",{className:"ee-settings-row",children:[qe("span",{className:"ee-settings-row-label",children:L("scale_font_on_mobile")||"Scale font on mobile"}),qe(pr,{checked:!1!==s.scaleFontOnMobile,onChange:e=>d({...s,scaleFontOnMobile:e},"set_body_settings")})]})]})]})]})},Z="undefined"!=typeof window&&"product-variables"===window.__eeDragSource,Q=e&&"edit"===e.type&&(!t||Z);c(()=>{if(!Q)return;M(kc);const e=D.current;e&&(e.scrollTop=0)},[Q,e?.id]);const de=()=>Je(Ye,{children:[Je("div",{className:"right-panel-block-settings-header",children:[qe("button",{type:"button",className:"right-panel-back-btn",onClick:()=>m(null),"aria-label":L("right_panel_back"),children:qe(B,{icon:Ce})}),qe("span",{className:"ee-block-settings-header-icon","aria-hidden":!0,children:qe(B,{icon:z(e?.data)})}),qe("h2",{className:"right-setting-block-title right-panel-block-title-inline",children:H()}),qe(fc,{onSaveAsUniversal:I})]}),Je("div",{className:"right-panel-layers-bar",children:[qe("div",{className:"right-panel-layers-header",children:L("layers_panel")}),qe("nav",{className:"right-panel-breadcrumbs-shell","aria-label":L("layers_panel"),children:qe("ol",{className:"right-panel-breadcrumbs-trail",children:F().map((e,t,n)=>{const o=t===n.length-1,l=(e=>{if(!e)return"";switch(e.key){case"column":{const t=e.containerType;if("product"===t)return L("block_product");if("discount"===t)return L("block_discount");if("header"===t)return L("block_header");if("footer"===t)return L("block_footer");const n=Mi(e);return L(n===Di?"block_palette_section":n===Ui?"block_palette_columns":"container")}case"text":{const t=(e.type||"p").toLowerCase();return/^h[1-6]$/.test(t)?L("heading"):L("text")}case"button":return L("button");case"image":return L("image");case"video":return L("video");case"divider":return L("divider");case"spacer":return L("spacer");case"menu":return L("menu");case"avatar":return L("avatar");case"social_link":return L("social_link");case"raw_html":return L("raw_html");case"table":return L("table");case"footer":return L("block_footer");case"empty":return L("drag_block_here");default:return e.name||"Block"}})(e.data),a=z(e.data);return Je("li",{className:"right-panel-breadcrumb-item right-panel-breadcrumb-crumb-slot",children:[t>0?qe("span",{className:"right-panel-breadcrumb-sep","aria-hidden":!0,children:qe(B,{icon:Ne})}):null,o?Je("span",{className:"right-panel-breadcrumb-segment right-panel-breadcrumb-current","aria-current":"page",children:[qe("span",{className:"right-panel-breadcrumb-ancestor-icon right-panel-breadcrumb-current-icon",children:qe(B,{icon:a})}),qe("span",{className:"right-panel-breadcrumb-label",children:l})]}):Je("button",{type:"button",className:"right-panel-breadcrumb-segment right-panel-breadcrumb-ancestor",onClick:(i=e.id,e=>{e.preventDefault(),e.stopPropagation();const t=y[i];t&&(m({id:i,data:t,type:"edit"}),g("edit"))}),children:[qe("span",{className:"right-panel-breadcrumb-ancestor-icon",children:qe(B,{icon:a})}),qe("span",{className:"right-panel-breadcrumb-label",children:l})]})]},`${e.id||"layer"}-${t}`);var i})})})]}),qe("div",{className:"right-panel-block-settings-form",children:qe(mc,{})})]});return Je(Ye,{children:[qe("div",{className:"right-settings",onClick:e=>{e.stopPropagation()},children:Je(Ye,{children:[Je("div",{className:"right-panel-tabs",children:[qe("button",{type:"button",className:"right-panel-tab "+(R===kc?"right-panel-tab-active":""),onClick:()=>M(kc),children:L("content")}),qe("button",{type:"button",className:"right-panel-tab "+(R===vc?"right-panel-tab-active":""),onClick:()=>M(vc),children:L("styles")}),Je("button",{type:"button",className:"right-panel-tab "+(R===wc?"right-panel-tab-active":""),onClick:()=>M(wc),children:[L("compliance"),E>0&&qe("span",{className:"right-panel-tab-badge","aria-label":L("compliance_tab_badge_label",{count:E>99?"99+":String(E)}),children:E>99?"99+":E})]})]}),Je("div",{ref:D,className:"right-panel-tab-content default-scrollbar"+(R===kc&&Q?" right-panel-tab-content--block-settings":""),children:[R===kc&&(Q?de():Je(Ye,{children:[J(),q(),G(),qe("div",{className:"ee-content-empty-hint",children:L("right_panel_empty_hint")})]})),R===vc&&Y(),R===wc&&qe(yc,{})]})]})}),qe(_c,{open:Boolean(C),block:C,onCreate:$,onClose:()=>N(null)})]})},Cc={column:ne,text:ce,button:Ae,divider:se,spacer:re,menu:ie,image:O,social_link:Be,raw_html:le,table:oe,video:j,product:ee,header:Z,footer:Q,discount:te},Nc={header:"header",footer:"footer",discount:"discount",product:"product",none:"product"};function Lc(e,t){const n=Nc[t];return n&&Cc[n]?Cc[n]:Cc.product}const Tc=["text","image","button","divider","spacer","social_link","menu","table","video","raw_html"],Bc={[Di]:X,[Ui]:ne};const Ac=({clearStyles:e,openConfigureColumnsModal:t})=>{const{setCurrentItem:o,setIsDragStart:l,setActionType:a,templateData:i,aiEnabled:r=!0}=n(Ln),{blockConfigsList:s}=fr(),{t:c}=ja(),{blockItems:d,layoutItems:u}=function(e,t){const n=[];Tc.forEach(o=>{const l=e.find(e=>e.key===o);l&&("text"===o&&t?n.push({...l,ai:!0,contentType:"static",dynamicPrompt:"",dynamicSelectedContent:"",dynamicOptions:[],dynamicVariable:"",isPreset:!1}):n.push({...l,isPreset:!1}))});const o=[],l=e.find(e=>"column"===e.key&&e.layoutRole===Di),a=e.find(e=>"column"===e.key&&e.layoutRole===Ui);return l&&o.push({...l,isPreset:!1,paletteIcon:Bc[Di],opensConfigureModal:!1}),a&&o.push({...a,isPreset:!1,paletteIcon:Bc[Ui],opensConfigureModal:!0}),{blockItems:n,layoutItems:o}}(s,r),p=Mr.presets.filter(e=>!Dr.has(e.id)).map(e=>({key:e.id,name:e.presetName,icon:Lc(e.presetName,e.containerType),isPreset:!0,getColumn:()=>Er(e.id)})),m=t=>{t.target.style.outline="",setTimeout(()=>{l(!1),e&&e()},50)},g=e=>t=>{const n=e.isPreset?xt(e.getColumn(c,i)):xt(e);o({id:null,data:n,type:"add"}),l(!0),t.target.style.outline="1px dashed var(--ee-primary)",a("add")},h=e=>{const n="boolean"==typeof e.opensConfigureModal?e.opensConfigureModal:Mi(e)===Ui;return Je("div",{className:"ee-blocks-palette-card",draggable:!0,onDragStart:g(e),onDragEnd:m,onClick:()=>{n&&t()},title:n?`${e.name} — ${c("configure_columns_hint")}`:e.name,children:[qe(B,{icon:e.paletteIcon||e.icon||Cc[e.key]||ce,className:"ee-blocks-palette-card-icon"}),qe("span",{className:"ee-blocks-palette-card-label",children:e.name}),e.ai&&Je("span",{className:"ee-blocks-palette-card-ai",children:[qe(B,{icon:q,className:"ee-blocks-palette-card-ai-icon","aria-hidden":!0}),"AI"]})]},`palette-card-${e.key}-${e.layoutRole??"base"}`)};return Je("div",{className:"ee-blocks-palette",children:[qe("div",{className:"ee-left-rail-section-title",children:c("blocks")}),qe("div",{className:"ee-blocks-palette-grid",children:d.map(h)}),u.length>0&&Je(Ye,{children:[qe("div",{className:"ee-left-rail-section-title",style:{paddingTop:16},children:c("layout")}),qe("div",{className:"ee-blocks-palette-grid",children:u.map(h)})]}),p.length>0&&Je(Ye,{children:[qe("div",{className:"ee-left-rail-section-title",style:{paddingTop:16},children:c("presets")}),qe("div",{className:"ee-blocks-palette-rows",children:p.map(e=>Je("div",{className:"ee-blocks-palette-row",draggable:!0,onDragStart:g(e),onDragEnd:m,title:e.name,children:[qe(B,{icon:_e,className:"ee-blocks-palette-row-grip"}),qe(B,{icon:e.icon,className:"ee-blocks-palette-row-icon"}),qe("span",{className:"ee-blocks-palette-row-label",children:e.name})]},e.key))})]})]})},Ic=({clearStyles:e})=>{const{universals:t=[],universalsLoading:o,setCurrentItem:l,setIsDragStart:a,setActionType:i,deleteUniversalEmailBlock:r}=n(Ln),{t:s}=ja(),c=e=>t=>{const n=JSON.parse(JSON.stringify(e.block||{}));n&&"object"==typeof n&&(l({id:null,data:n,type:"add"}),a(!0),t.currentTarget.style.outline="1px dashed var(--ee-primary)",i("add"))},d=t=>{t.currentTarget.style.outline="",setTimeout(()=>{a(!1),e&&e()},50)};return Je("div",{className:"ee-universal-panel",children:[Je("div",{className:"ee-left-rail-section-title",children:[s("universal_saved_blocks"),o?qe("span",{className:"ee-universal-loading",children:" · …"}):null]}),0===t.length?Je("div",{className:"ee-universal-empty",children:[s("universal_empty_state_line_1")," ",qe(B,{icon:q,style:{width:10,height:10,color:"var(--ee-primary)",verticalAlign:"middle"}})," ",s("universal_empty_state_line_2")]}):qe("div",{className:"ee-universal-list",children:t.map(e=>{const t=String(e?.block?.containerType||e?.block?.key||"block").replace(/[-_]/g," "),n="none"===t.trim().toLowerCase()?s("block_palette_section"):t;return Je("div",{className:"ee-universal-item",draggable:!0,onDragStart:c(e),onDragEnd:d,title:e.name,children:[qe(B,{icon:_e,className:"ee-blocks-palette-row-grip"}),qe(B,{icon:q,className:"ee-universal-item-icon"}),Je("div",{className:"ee-universal-item-body",children:[qe("div",{className:"ee-universal-item-name",children:e.name}),Je("div",{className:"ee-universal-item-meta",children:[n,null!=e.usedIn?` · ${s("universal_used_in_count").replace("{{count}}",String(e.usedIn))}`:""]})]}),"function"==typeof r?qe("button",{type:"button",className:"ee-universal-item-delete","aria-label":s("universal_delete"),title:s("universal_delete"),onMouseDown:e=>e.stopPropagation(),onClick:t=>{t.preventDefault(),t.stopPropagation(),g.confirm({title:s("universal_delete_confirm_title"),content:s("universal_delete_confirm_body"),okButtonProps:{danger:!0},okText:s("universal_delete_confirm_ok"),cancelText:s("cancel"),wrapClassName:"ee-modal-dark",onOk:async()=>{try{await r(e.resourceId??e.id)}catch(e){throw S.error(e?.message||s("universal_save_error")||"Could not delete"),e}}})},children:qe(B,{icon:J,className:"ee-universal-item-delete-icon"})}):null]},e.id)})})]})},$c={column:ne,text:ce,button:Ae,divider:se,spacer:re,menu:ie,image:O,video:j,social_link:Be,raw_html:le,table:oe,avatar:W,empty:X};function Pc(e){return e?"column"===e.key?"product"===e.containerType?ee:"discount"===e.containerType?te:Mi(e)===Di?X:ne:$c[e.key]||X:X}function Rc(e,t=28){const n=String(e??"").replace(/<[^>]+>/g,"").trim();return n?n.length>t?`${n.slice(0,t)}…`:n:null}function Mc(e,t){if("column"!==e?.key||"footer"!==e.containerType||!e.footerUnifiedLayout)return[];const n=[],o=(e,t,o,l)=>{n.push({segment:e,label:t,subtitle:Rc(o),icon:l})};if(e.showDivider&&o("divider",t("footer_divider_above"),null,se),e.footerShowLogo&&o("logo",`${t("image")} · ${t("logo_section")}`,e.footerLogoAlt||"",O),e.showBrand&&o("brand",`${t("text")} · ${t("footer_label_brand")}`,e.brandName||"",ce),e.showTagline&&o("tagline",`${t("text")} · ${t("brand_tagline")}`,e.brandTagline||"",ce),e.showAddress&&o("address",`${t("text")} · ${t("address")}`,e.address||"",ce),e.showSocial){const n=wl(e.footerSocialList).map(e=>String(e.title||"").trim()).filter(Boolean);o("social",t("footer_social_platforms_heading"),n.length?n.slice(0,4).join(", "):null,Be)}if(e.showUnsubscribe){const n=String(e.unsubscribeLinkLabel??"").trim()||"Unsubscribe";o("unsubscribe",`${t("menu")} · ${t("footer_toggle_unsubscribe")}`,n,ie)}if(e.showSecondaryLinks){const n=xl(e.secondaryLinks).map(e=>String(e.label||"").trim()).filter(Boolean);o("secondary",t("footer_secondary_links_heading"),n.length?n.slice(0,5).join(" · "):null,ie)}return e.showCopyright&&o("copyright",`${t("text")} · ${t("copyright_text")}`,e.copyrightText||"",ce),n}const Dc=()=>{const{blockMap:e,rootOrder:t,setBlocks:o,setCurrentItem:l,setActionType:i,currentItem:r,onSaveBlockAsGlobal:s}=n(Ln),{t:c}=ja(),[d,u]=a(null),[p,m]=a(null),h=r?.id||null,y=n=>{if(!n||!e[n])return;let a=e[n];if("column"===a.key&&"footer"===a.containerType&&a.footerUnifiedLayout&&null!=a.footerSelectedSegment&&""!==a.footerSelectedSegment){const l={...a};delete l.footerSelectedSegment,o({...e,[n]:l},t,`edit_${Date.now()}`),a=l}l({id:n,data:a,type:"edit"}),i("edit"),"undefined"!=typeof window&&window.requestAnimationFrame(()=>{const e="function"==typeof window.CSS?.escape?window.CSS.escape(String(n)):String(n).replace(/([ #;?%&,.+*~':"!^$[\]()=>|/@])/g,"\\$1"),t=document.querySelector(`[data-block-id="${e}"]`);t&&"function"==typeof t.scrollIntoView&&t.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})})},b=(n,a)=>{const r=e[n];if(!r)return;const s={...r,footerSelectedSegment:a};o({...e,[n]:s},t,`edit_${Date.now()}`),l({id:n,data:s,type:"edit"}),i("edit"),"undefined"!=typeof window&&window.requestAnimationFrame(()=>{const e="function"==typeof window.CSS?.escape?window.CSS.escape(String(n)):String(n).replace(/([ #;?%&,.+*~':"!^$[\]()=>|/@])/g,"\\$1"),t=document.querySelector(`[data-block-id="${e}"]`);t&&"function"==typeof t.scrollIntoView&&t.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})})},f=(n,l)=>{const a=t.indexOf(n);if(-1===a)return;const i=[...t],r="up"===l?a-1:a+1;r<0||r>=i.length||([i[a],i[r]]=[i[r],i[a]],o(e,i,"move"))},_=(n,l)=>{const a=t.indexOf(n);if(-1===a)return;const i=[...t];i.splice(a,1);const r=l>a?l-1:l;i.splice(Math.max(0,Math.min(r,i.length)),0,n),o(e,i,"move")},k=(n,a,i,r,v)=>{if(!n)return null;const w=h===n.id,x=function(e){if(!e)return null;const t=e.text||e.title||e.list&&e.list[0]?.label||e.alt||e.html||"",n=String(t).replace(/<[^>]+>/g,"").trim();return n?n.length>24?`${n.slice(0,24)}…`:n:null}(n),S=function(e,t){if(!e)return"";switch(e.key){case"column":{const n=e.containerType;if("product"===n)return t("block_product");if("discount"===n)return t("block_discount");if("header"===n)return t("block_header");if("footer"===n)return t("block_footer");if("introduction"===n)return t("block_introduction");if("body"===n)return t("block_body");const o=Mi(e);return t(o===Di?"block_palette_section":o===Ui?"block_palette_columns":"container")}case"text":return t("text");case"button":return t("button");case"image":return t("image");case"video":return t("video");case"divider":return t("divider");case"spacer":return t("spacer");case"menu":return t("menu");case"avatar":return t("avatar");case"social_link":return t("social_link");case"raw_html":return t("raw_html");case"table":return t("table")||"Table";case"empty":return t("drag_block_here");default:return e.name||"Block"}}(n,c),C=!!n.hidden,N=i&&d&&d!==n.id&&p===r;return Je("div",{children:[N&&qe("div",{className:"ee-layer-drop-indicator","aria-hidden":!0}),Je("div",{className:za("ee-layer-row",w&&"ee-layer-row-selected",C&&"ee-layer-row-hidden"),style:{paddingLeft:6+14*a},onClick:e=>{e.stopPropagation(),y(n.id)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),y(n.id))},role:"button",tabIndex:0,draggable:i,onDragStart:e=>{if(i){e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",n.id)}catch{}u(n.id)}},onDragOver:e=>{if(!i||!d||d===n.id)return;e.preventDefault();const t=e.currentTarget.getBoundingClientRect(),o=e.clientY-t.top<t.height/2;m(o?r:r+1)},onDrop:e=>{if(!i||!d)return;e.preventDefault();_(d,p??r),u(null),m(null)},onDragEnd:()=>{u(null),m(null)},children:[qe(B,{icon:Pc(n),className:"ee-layer-row-icon"}),Je("span",{className:"ee-layer-row-label",children:[S,x&&Je("span",{className:"ee-layer-row-sub",children:["· ",x]})]}),Je("div",{className:"ee-layer-row-actions",onClick:e=>e.stopPropagation(),children:[i&&Je(Ye,{children:[qe("button",{type:"button",className:"ee-layer-mini-btn",title:c("layer_move_up"),disabled:0===r,onClick:()=>f(n.id,"up"),children:qe(B,{icon:K})}),qe("button",{type:"button",className:"ee-layer-mini-btn",title:c("layer_move_down"),disabled:r===v-1,onClick:()=>f(n.id,"down"),children:qe(B,{icon:V})})]}),qe("button",{type:"button",className:"ee-layer-mini-btn",title:c("layer_duplicate"),onClick:()=>(n=>{const a=Ai(e,t,n);a&&(o(a.nextMap,a.nextRootOrder,"add"),l({id:a.newId,data:a.selectionData,type:"edit"}))})(n.id),children:qe(B,{icon:G})}),i&&"column"===n.key&&"function"==typeof s?qe("button",{type:"button",className:"ee-layer-mini-btn ee-layer-save-universal",title:c("save_as_universal"),"aria-label":c("save_as_universal"),onClick:e=>{e.stopPropagation(),window.dispatchEvent(new CustomEvent("ee:canvas-save-universal",{detail:{block:n}}))},children:qe(B,{icon:q})}):null,qe("button",{type:"button",className:"ee-layer-mini-btn ee-layer-mini-btn-danger",title:c("layer_delete"),onClick:()=>(n=>{const a=e[n];if(!a)return;const i=()=>{const a=Ri(e,t,n,c);a&&(o(a.nextMap,a.nextRootOrder,"delete"),l(null))};"column"===a.key&&Pi(e,n)?g.confirm({title:c("shortcut_delete_confirm_title"),content:c("shortcut_delete_confirm_desc"),okText:c("confirm"),cancelText:c("cancel"),wrapClassName:"ee-modal-dark",onOk:i}):i()})(n.id),children:qe(B,{icon:J})})]}),qe("button",{type:"button",className:"ee-layer-mini-btn ee-layer-row-vis",title:c(C?"layer_show":"layer_hide"),onClick:l=>{l.stopPropagation(),(n=>{const l=e[n];if(!l)return;const a={...e,[n]:{...l,hidden:!l.hidden}};o(a,t,"edit")})(n.id)},children:qe(B,{icon:C?H:Se})})]}),"column"===n.key&&Array.isArray(n.cells)&&n.cells.map((t,o)=>{const l=t.childrenIds||[],i=n.cells.length>1;return Je("div",{children:[i&&qe("div",{className:"ee-layer-cell-label",style:{paddingLeft:12+14*(a+1)},children:`${c("column")} ${o+1}`}),l.map(t=>{const n=e[t];return n&&"empty"!==n.key?k(n,a+2,!1,0,0):null})]},t.id||o)}),"column"===n.key&&"footer"===n.containerType&&n.footerUnifiedLayout&&Mc(n,c).map(({segment:t,label:o,subtitle:l,icon:i})=>{const r=e[n.id]||n,s=h===n.id&&r.footerSelectedSegment===t,c=a+2;return Je("div",{className:za("ee-layer-row","ee-layer-row--footer-segment",s&&"ee-layer-row-selected"),style:{paddingLeft:6+14*c},role:"button",tabIndex:0,onClick:e=>{e.stopPropagation(),b(n.id,t)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),b(n.id,t))},children:[qe(B,{icon:i,className:"ee-layer-row-icon"}),Je("span",{className:"ee-layer-row-label",children:[o,l?Je("span",{className:"ee-layer-row-sub",children:["· ",l]}):null]})]},`${n.id}:footer-seg:${t}`)})]},n.id)};return Je("div",{className:"ee-layers-panel",onDragOver:e=>{d&&e.preventDefault()},onDrop:e=>{if(!d)return;e.preventDefault();const n=p??t.length;_(d,n),u(null),m(null)},children:[Je("div",{className:"ee-layers-header",children:[qe("span",{children:c("layers")}),Je("span",{className:"ee-layers-header-count",children:[t.length," ",1===t.length?c("layer_one"):c("layer_many")]})]}),Je("button",{type:"button",className:za("ee-layers-document",!h&&"ee-layers-document-active"),onClick:()=>l(null),children:[qe(B,{icon:Ie}),qe("span",{children:c("document")})]}),t.map((n,o)=>{const l=e[n];return k(l,1,!0,o,t.length)}),d&&p===t.length&&qe("div",{className:"ee-layer-drop-indicator","aria-hidden":!0})]})},Uc=[{key:"full",label:"1 column",desc:"Full-width section"},{key:"1-1",label:"2 columns",desc:"Equal halves"},{key:"1-1-1",label:"3 columns",desc:"Equal thirds"},{key:"1-1-1-1",label:"4 columns",desc:"Equal quarters"},{key:"1-2",label:"1 : 2",desc:"Narrow + wide"},{key:"2-1",label:"2 : 1",desc:"Wide + narrow"},{key:"1-3",label:"1 : 3",desc:"Sidebar + body"},{key:"3-1",label:"3 : 1",desc:"Body + sidebar"},{key:"2-3",label:"2 : 3",desc:"Off-center"},{key:"3-2",label:"3 : 2",desc:"Off-center"},{key:"1-2-1",label:"1 : 2 : 1",desc:"Hero + edges"},{key:"2-1-1",label:"2 : 1 : 1",desc:"Lead + two"},{key:"1-1-2",label:"1 : 1 : 2",desc:"Two + lead"}],Ec=[{key:"6-col-equal",label:"6 cols equal",cols:6,parts:[1,1,1,1,1,1]},{key:"12-col-equal",label:"12 cols equal",cols:12,parts:[1,1,1,1,1,1,1,1,1,1,1,1]}],zc=["A","B","C","D"],Fc=["A","B","C","D","E","F","G","H","I","J","K","L"],Oc=({parts:e,rowCount:t})=>{const n=e.slice(0,Math.min(e.length,12)),o=Math.min(t,4);return Je("div",{className:"ee-grid-preview-wrap",children:[qe("div",{className:"ee-grid-preview-heading",children:"Live preview"}),Array.from({length:o}).map((e,t)=>Je("div",{className:"ee-grid-preview-row",children:[qe("div",{className:"ee-grid-preview-row-label",children:zc[t]}),n.map((e,n)=>Je("div",{className:"ee-grid-preview-cell",style:{flex:e},children:[Fc[n],zc[t]]},n))]},t))]})},Wc=e=>{const t="full"===e?[1]:e.split("-").map(e=>parseInt(e,10)),n=t.reduce((e,t)=>e+t,0);return qe("div",{className:"ee-layout-preview",children:t.map((e,t)=>qe("span",{className:"ee-layout-preview-cell",style:{flex:e/n}},t))})};function jc(e,t,n){const o=e[t]||e.full,l=e=>e&&"object"==typeof e?{...e,id:Nt(),...Array.isArray(e.children)?{children:e.children.map(l)}:{}}:e;return{id:Nt(),name:n("block_palette_columns"),key:"column",type:o.type,containerType:"none",layoutRole:Ui,columnLayoutOnly:!0,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},children:(o.children||[]).map(l)}}const Hc=({open:e,onClose:t,columnRootId:o})=>{const{t:l}=ja(),{columnsSetting:i}=fr(),{blockMap:s,rootOrder:c,setBlocks:d,setCurrentItem:u}=n(Ln),[p,m]=a("1-1"),[h,y]=a(1),[b,f]=a(!1),[k,v]=a("6-col-equal");r(()=>{e&&(m("1-1"),y(1),f(!1))},[e]);const w=(()=>{if(b){const e=Ec.find(e=>e.key===k);return e?e.parts:[1]}return"full"===p?[1]:p.split("-").map(e=>parseInt(e,10))})();return Je(g,{className:"ee-modal-dark ee-configure-columns-modal",title:l("configure_columns_title"),open:e,onCancel:t,footer:[qe(_,{onClick:t,children:l("cancel")},"cancel"),qe(_,{type:"primary",onClick:()=>{const e=b?"full":p;let n=s,a=[...c];const r=o&&"column"===n[o]?.key?o:null;let m=null;for(let t=0;t<h;t++){const o=jc(i,e,l);if(b){const e=Ec.find(e=>e.key===k);if(e){o.type=e.key;const t=e.cols,n=`${(100/t).toFixed(4)}%`;o.children=Array.from({length:t},(e,t)=>({id:Nt(),name:l("content"),key:"content",width:n,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{id:Nt(),name:l("drag_block_here"),key:"empty",width:"100%",styles:{desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0},mobile:{}}}]}))}}if(r&&0===t&&"column"===n[r]?.key){o.id=r,n=en(n,r);const{blockMap:e}=jt([o]);n={...n,...e},m=r;continue}const{newBlockMap:s,rootId:c}=nn(n,o);c&&(n=s,a=[...a,c],m=c)}d(n,a,"add"),null!=m&&n[m]&&u({id:m,data:n[m],type:"edit"}),t()},children:l("configure_columns_insert")},"insert")],width:660,destroyOnClose:!0,children:[qe("p",{style:{color:"var(--ee-muted-foreground)",marginBottom:14},children:l("configure_columns_subtitle")}),Je("div",{className:"ee-layout-tab-group",role:"tablist","aria-label":"Layout type",children:[qe("button",{type:"button",role:"tab","aria-selected":!b,className:za("ee-layout-tab",!b&&"ee-layout-tab-active"),onClick:()=>f(!1),children:l("standard_layout")||"Standard"}),qe("button",{type:"button",role:"tab","aria-selected":b,className:za("ee-layout-tab",b&&"ee-layout-tab-active"),onClick:()=>f(!0),children:l("grid_layout")||"6/12 Grid"})]}),qe("div",b?{style:{display:"flex",gap:8},children:Ec.map(e=>Je("button",{type:"button",className:za("ee-layout-card",k===e.key&&"ee-layout-card-active"),onClick:()=>v(e.key),style:{flex:1},children:[qe("div",{className:"ee-layout-grid-mini-bar",children:e.parts.slice(0,6).map((e,t)=>qe("span",{className:"ee-layout-grid-mini-cell"},t))}),qe("div",{className:"ee-layout-card-label",children:e.label})]},e.key))}:{className:"ee-layout-grid",children:Uc.filter(e=>i[e.key]).map(e=>Je("button",{type:"button",className:za("ee-layout-card",p===e.key&&"ee-layout-card-active"),onClick:()=>m(e.key),children:[Wc(e.key),qe("div",{className:"ee-layout-card-label",children:e.label}),qe("div",{className:"ee-layout-card-desc",children:e.desc})]},e.key))}),qe(Oc,{parts:w,rowCount:h}),Je("div",{className:"ee-row-count-row",children:[qe("span",{children:l("configure_columns_row_count")||"Rows to insert:"}),qe(_,{className:"ee-configure-stepper-btn",type:"default",size:"small",icon:qe(B,{icon:ue}),onClick:()=>y(e=>Math.max(1,e-1)),disabled:h<=1}),qe("span",{className:"ee-row-count-value",children:h}),qe(_,{className:"ee-configure-stepper-btn",type:"default",size:"small",icon:qe(B,{icon:pe}),onClick:()=>y(e=>Math.min(4,e+1)),disabled:h>=4})]})]})},Kc="blocks",Vc="universal",Gc="layers",qc=({clearStyles:e})=>{const{t:t}=ja(),[n,o]=a(Kc),[l,i]=a(!1),[s,c]=a(null);r(()=>{const e=e=>{c(e?.detail?.rootId??null),i(!0)};return window.addEventListener(zi,e),()=>window.removeEventListener(zi,e)},[]);const d=[{id:Kc,label:t("blocks"),icon:$e},{id:Vc,label:t("universal"),icon:q},{id:Gc,label:t("layers"),icon:Pe}];return Je("aside",{className:"ee-left-rail","aria-label":"Editor sidebar",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:[qe("div",{className:"ee-left-rail-tabs",role:"tablist",children:d.map(e=>Je("button",{type:"button",role:"tab","aria-selected":n===e.id,className:za("ee-left-rail-tab",n===e.id&&"ee-left-rail-tab-active"),onClick:()=>o(e.id),children:[qe(B,{icon:e.icon}),qe("span",{children:e.label})]},e.id))}),Je("div",{className:"ee-left-rail-body",children:[n===Kc&&qe(Ac,{clearStyles:e,openConfigureColumnsModal:()=>{c(null),i(!0)}}),n===Vc&&qe(Ic,{clearStyles:e}),n===Gc&&qe(Dc,{})]}),qe(Hc,{open:l,columnRootId:s,onClose:()=>{i(!1),c(null)}})]})},Jc=({open:e,issues:t,onClose:o,onExportAnyway:l})=>{const{setCurrentItem:a,setActionType:i,blockMap:r}=n(Ln),{t:s}=ja(),c=e=>{var t;e?.blockId&&((t=e.blockId)&&r?.[t]&&(a({id:t,data:r[t],type:"edit"}),i("edit"),"undefined"!=typeof window&&window.requestAnimationFrame(()=>{const e="function"==typeof window.CSS?.escape?window.CSS.escape(String(t)):String(t).replace(/([ #;?%&,.+*~':"!^$[\]()=>|/@])/g,"\\$1"),n=document.querySelector(`[data-block-id="${e}"]`);n&&"function"==typeof n.scrollIntoView&&n.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})}),1)&&o())},d=(e,t)=>{const n=Boolean(e?.blockId),o=`validation_${e.code}`,l=s(o),a=l&&l!==o?l:e.message;return qe("li",{className:"export-validation-issue-item",children:Je("button",{type:"button",className:"export-validation-issue-btn "+(n?"is-clickable":""),onClick:()=>c(e),disabled:!n,children:[qe("span",{className:"export-validation-issue-copy",children:a}),n&&qe("span",{className:"export-validation-issue-action",children:s("export_validation_open_block")||"Open block"})]})},t)},u=(t||[]).filter(e=>"error"===e.severity),p=(t||[]).filter(e=>"warning"===e.severity),m=(t||[]).filter(e=>"info"===e.severity);return Je(g,{className:"ee-modal-dark",title:s("export_validation_title"),open:e,onCancel:o,footer:[qe(_,{onClick:o,children:s("cancel")},"cancel"),qe(_,{type:"primary",onClick:l,children:s("export_anyway")},"export")],width:520,destroyOnClose:!0,children:[qe("p",{style:{marginBottom:12},children:s("export_validation_issues_found")}),Je("div",{style:{maxHeight:360,overflowY:"auto"},children:[u.length>0&&Je("div",{style:{marginBottom:12},children:[Je("div",{className:"export-validation-errors-heading",style:{fontWeight:600,marginBottom:6},children:[s("export_validation_errors")," (",u.length,")"]}),qe("ul",{className:"export-validation-issue-list",children:u.map((e,t)=>d(e,`e-${t}`))})]}),p.length>0&&Je("div",{style:{marginBottom:12},children:[Je("div",{className:"export-validation-warnings-heading",style:{fontWeight:600,marginBottom:6},children:[s("export_validation_warnings")," (",p.length,")"]}),qe("ul",{className:"export-validation-issue-list",children:p.map((e,t)=>d(e,`w-${t}`))})]}),m.length>0&&Je("div",{children:[Je("div",{className:"export-validation-info-heading",style:{fontWeight:600,marginBottom:6},children:[s("export_validation_info")," (",m.length,")"]}),qe("ul",{className:"export-validation-issue-list",children:m.map((e,t)=>d(e,`i-${t}`))})]})]})]})},{Option:Yc}=x,Xc=[{value:"none",label:"No payload"},{value:"profile",label:"Profile data"},{value:"event",label:"Event data"}],Zc=({open:e,onClose:t,onSend:n,templateName:o})=>{const{t:l}=ja(),[i,r]=a([]),[s,c]=a(""),[d,u]=a("none"),[p,m]=a(!0),[y,f]=a(!1),k=e=>{const t=String(e||"").trim();if(!t)return;const n=t.split(/[\s,;]+/).filter(Boolean);r(e=>{const t=new Set(e);return n.forEach(e=>t.add(e)),Array.from(t)}),c("")},v=e=>{r(t=>t.filter(t=>t!==e))},w=()=>{r([]),c(""),u("none"),m(!0),f(!1),t?.()};return qe(g,{className:"ee-modal-dark",title:l("send_test_title")||"Send test email",open:e,onCancel:w,footer:[qe(_,{onClick:w,disabled:y,children:l("cancel")},"cancel"),qe(_,{type:"primary",onClick:async()=>{if(0!==i.length){f(!0);try{await Promise.resolve(n?.({recipients:i,payloadType:d,testPrefix:p,subjectPrefix:p?"[TEST] ":"",name:o||"Untitled template"})),w()}finally{f(!1)}}},loading:y,disabled:0===i.length,children:l("send_test_send")||"Send test"},"send")],width:480,destroyOnClose:!0,children:Je("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[Je("div",{children:[qe("div",{style:{marginBottom:6,fontSize:13,fontWeight:500},children:l("send_test_recipients")||"Recipients"}),Je("div",{style:{display:"flex",flexWrap:"wrap",gap:4,minHeight:36,padding:"4px 8px",border:"1px solid var(--ee-border, #374151)",borderRadius:6,backgroundColor:"var(--ee-surface, #1a1a1a)",cursor:"text"},onClick:()=>document.getElementById("ee-send-test-input")?.focus(),children:[i.map(e=>qe(T,{closable:!0,onClose:()=>v(e),style:{margin:2},children:e},e)),qe(h,{id:"ee-send-test-input",bordered:!1,value:s,style:{flex:1,minWidth:160,padding:0},placeholder:0===i.length?l("send_test_recipients_placeholder")||"name@example.com, another@example.com":"",onChange:e=>c(e.target.value),onKeyDown:e=>{"Enter"!==e.key&&","!==e.key&&" "!==e.key&&"Tab"!==e.key||(e.preventDefault(),k(s)),"Backspace"===e.key&&!s&&i.length>0&&v(i[i.length-1])},onBlur:()=>{s.trim()&&k(s)}})]}),qe("div",{style:{fontSize:11,color:"var(--ee-muted-foreground)",marginTop:4},children:l("send_test_recipients_hint")||"Press Enter or comma to add each address."})]}),Je("div",{children:[qe("div",{style:{marginBottom:6,fontSize:13,fontWeight:500},children:l("send_test_payload")||"Payload context"}),qe(x,{style:{width:"100%"},value:d,onChange:u,getPopupContainer:()=>document.querySelector(".email-editor")||document.body,children:Xc.map(e=>qe(Yc,{value:e.value,children:l(`send_test_payload_${e.value}`)||e.label},e.value))})]}),Je("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 12px",borderRadius:6,backgroundColor:"var(--ee-surface, #1a1a1a)",border:"1px solid var(--ee-border, #374151)"},children:[Je("div",{children:[qe("div",{style:{fontSize:13,fontWeight:500},children:l("send_test_prefix_label")||"[TEST] prefix"}),qe("div",{style:{fontSize:12,color:"var(--ee-muted-foreground)"},children:l("send_test_prefix_hint")||"Prepends [TEST] to the subject line."})]}),qe(b,{checked:p,onChange:m})]})]})})},Qc=({templateName:e,onTemplateNameChange:t,onBack:s,onPreview:c,onSendTest:d,onSaveTemplate:u,onShowShortcuts:p,onSendTestIntent:m,onSaveTemplateIntent:y,saveStatusDetail:b,onExit:f,hideOverflowExportActions:_=!1})=>{const{previewMode:k,setPreviewMode:v,canUndo:w,canRedo:S,undo:C,redo:N,blockList:L,bodySettings:T,fillProductSlots:A,templateData:I,saveState:$,highContrastEditor:P,setHighContrastEditor:R,filterIgnoredValidationIssues:M}=n(Ln),{t:D}=ja(),[U,E]=a(!1),[z,F]=a(e||""),[O,W]=a(!1),[j,H]=a(!1),[K,V]=a([]),[G,q]=a(null),[J,Y]=a(!1),[X,Z]=a(!1),[Q,ee]=a(!1),[te,ne]=a(""),[oe,le]=a(!1),[ae,ie]=a("desktop"),re=i(null);r(()=>{oe&&ie("desktop")},[oe]);const se=l(()=>{if(!oe)return{html:"",error:null};try{return{html:Gl({bodySettings:T,blockList:L,templateData:I??void 0})??"",error:null}}catch(e){return console.error("[EmailEditor] HTML preview generation failed:",e),{html:"",error:D("html_email_preview_error")}}},[oe,T,L,I,D]);r(()=>{F(e||"")},[e]),r(()=>{if(!O)return;const e=e=>{re.current&&!re.current.contains(e.target)&&W(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[O]);const ce=()=>{E(!1),"function"==typeof t&&z!==e&&t(z)},de=o(e=>{const t={},n=(e,o=[])=>{Array.isArray(e)&&e.forEach(e=>{if(!e||"object"!=typeof e)return;const l={blockId:e.id??null,key:e.key??null,containerType:"column"===e.key?e.containerType??"none":null},a=[...o,l];if("text"===e.key&&"dynamic"===e.contentType){const n="string"==typeof e.dynamicPrompt?e.dynamicPrompt.trim():"",o="string"==typeof e.dynamicSelectedContent?e.dynamicSelectedContent.trim():"";if(!n&&!o)return;t[e.id]={blockId:e.id,path:a,key:e.key,type:e.type||"p",selectedContent:o,options:Array.isArray(e.dynamicOptions)?e.dynamicOptions:[],prompt:n,variable:e.dynamicVariable??"",language:"bn-BD"===e.dynamicAiLanguage?"bn-BD":"en"}}Array.isArray(e.children)&&n(e.children,a)})};return n(e,[]),t},[]),ue=o(e=>Array.isArray(e)?e.map(e=>{if(!e||"object"!=typeof e)return e;const{dynamicPrompt:t,dynamicOptions:n,dynamicSelectedContent:o,dynamicVariable:l,dynamicAiLanguage:a,staticTextBeforeAi:i,children:r,...s}=e;return{...s,children:ue(r)}}):e,[]),pe=o(()=>({blockList:ue(L??[]),bodySettings:T??null,aiContentRefs:de(L??[]),language:ga(L??[]),fillProductSlots:!1!==A}),[L,T,A,de,ue]),me=()=>{const t=pe(),n=JSON.stringify(t,null,2),o=new Blob([n],{type:"application/json"}),l=document.createElement("a");l.download=`${e||"email-template"}.json`,l.href=URL.createObjectURL(o),l.click()},ge=()=>{const t=Gl({bodySettings:T,blockList:L,templateData:I});if(null==t)return;const n=new Blob([t],{type:"text/html"}),o=document.createElement("a");o.download=`${e||"email-template"}.html`,o.href=URL.createObjectURL(n),o.click()},he=async e=>{Y(!0);try{const t=pe();let n=Ia({blockList:t.blockList??[],bodySettings:t.bodySettings??null,aiContentRefs:t.aiContentRefs??{}});const o=await Ua(t.blockList??[]);if(n=[...n,...o],"function"==typeof M&&(n=M(n)),0===n.length)return void("html"===e?ge():me());V(n),q(e),H(!0)}finally{Y(!1)}},ye=()=>{H(!1),V([]),q(null)},be="function"==typeof m||"function"==typeof d,fe="function"==typeof y||"function"==typeof u,_e="function"==typeof m,ke="function"==typeof y;return Je("header",{className:"ee-topbar",children:["function"==typeof s&&"function"!=typeof f&&Je(Ye,{children:[Je("button",{type:"button",className:"ee-topbar-back",onClick:s,"aria-label":D("topbar_back_to_templates"),children:[qe(B,{icon:Ce}),qe("span",{children:D("topbar_back_to_templates")})]}),qe("div",{className:"ee-topbar-divider","aria-hidden":!0})]}),Je("div",{className:"ee-topbar-breadcrumb",children:[qe(B,{icon:Re}),qe("span",{children:D("topbar_breadcrumb_email")}),qe(B,{icon:Ne,className:"ee-topbar-breadcrumb-sep"}),U?qe("input",{autoFocus:!0,className:"ee-topbar-name-input",value:z,onChange:e=>F(e.target.value),onBlur:ce,onKeyDown:t=>{"Enter"===t.key?ce():"Escape"===t.key&&(F(e||""),E(!1))},"aria-label":D("topbar_rename_template")}):qe("button",{type:"button",className:"ee-topbar-name-btn",onClick:()=>{"function"==typeof t&&E(!0)},title:"function"==typeof t?D("topbar_rename_template"):void 0,children:e||D("topbar_untitled_template")})]}),Je("div",{className:"ee-topbar-spacer",children:[(b||$)&&Je(Ye,{children:[Je("div",{className:"ee-topbar-status-cluster ee-topbar-status-cluster--lead",children:[qe("span",{className:za("header-save-state","saved"===$&&"header-save-state_saved","saving"===$&&"header-save-state_saving","unsaved"===$&&"header-save-state_unsaved","error"===$&&"header-save-state_error"),"aria-label":`save-state-${$}`,children:b||$&&(D(`save_state_${$}`)||$)}),"saved"===$&&qe(B,{icon:ve,className:"ee-topbar-saved-check","aria-hidden":!0}),"saving"===$&&qe(B,{icon:Me,spin:!0,className:"ee-topbar-saving-spinner","aria-hidden":!0})]}),qe("div",{className:"ee-topbar-divider","aria-hidden":!0})]}),qe("button",{type:"button",className:"ee-topbar-icon-btn",onClick:C,disabled:!w,title:D("undo"),"aria-label":D("undo"),children:qe(B,{icon:De})}),qe("button",{type:"button",className:"ee-topbar-icon-btn",onClick:N,disabled:!S,title:D("redo"),"aria-label":D("redo"),children:qe(B,{icon:Ue})}),qe("div",{className:"ee-topbar-divider","aria-hidden":!0}),Je("div",{className:"ee-topbar-segment",role:"tablist","aria-label":"Device preview",children:[qe("button",{type:"button",role:"tab","aria-selected":"desktop"===k,className:za("ee-topbar-segment-btn","desktop"===k&&"ee-topbar-segment-btn-active"),onClick:()=>v("desktop"),title:D("desktop"),children:qe(B,{icon:Ee})}),qe("button",{type:"button",role:"tab","aria-selected":"mobile"===k,className:za("ee-topbar-segment-btn","mobile"===k&&"ee-topbar-segment-btn-active"),onClick:()=>v("mobile"),title:D("mobile"),children:qe(B,{icon:ze})})]}),qe("button",{type:"button",className:"ee-topbar-icon-btn",onClick:()=>le(!0),title:D("html_email_preview"),"aria-label":D("html_email_preview"),children:qe(B,{icon:Se})}),qe("div",{className:"ee-topbar-divider","aria-hidden":!0}),be&&Je("button",{type:"button",className:"ee-topbar-btn ee-topbar-btn-ghost ee-topbar-btn-send-test",onClick:()=>{"function"!=typeof m?"function"==typeof d&&Z(!0):m()},title:D("send_test"),children:[qe(B,{icon:Fe}),qe("span",{className:"ee-topbar-btn-label",children:D("send_test")})]}),"function"==typeof c&&Je("button",{type:"button",className:"ee-topbar-btn ee-topbar-btn-outline",onClick:()=>{"function"==typeof c&&c()},title:D("preview"),children:[qe(B,{icon:Oe}),qe("span",{className:"ee-topbar-btn-label",children:D("preview")})]}),fe&&Je("button",{type:"button",className:"ee-topbar-btn ee-topbar-btn-primary",onClick:()=>{"function"!=typeof y?"function"==typeof u&&ee(!0):y()},title:D("save_template"),children:[qe(B,{icon:We}),qe("span",{className:"ee-topbar-btn-label",children:D("save_template")})]}),Je("div",{className:"ee-topbar-overflow-wrap",ref:re,children:[qe("button",{type:"button",className:"ee-topbar-icon-btn",onClick:()=>W(e=>!e),"aria-haspopup":"true","aria-expanded":O,"aria-label":D("more_actions"),title:D("more_actions"),children:qe(B,{icon:xe})}),O&&Je("div",{className:"ee-topbar-overflow-menu",role:"menu",children:[!_&&Je(Ye,{children:[Je("button",{type:"button",role:"menuitem",className:"ee-topbar-overflow-item",disabled:J,onClick:()=>{W(!1),he("json")},children:[qe(B,{icon:je}),qe("span",{children:D("export_json")})]}),Je("button",{type:"button",role:"menuitem",className:"ee-topbar-overflow-item",disabled:J,onClick:()=>{W(!1),he("html")},children:[qe(B,{icon:He}),qe("span",{children:D("export_html")})]})]}),"function"==typeof p&&Je(Ye,{children:[!_&&qe("div",{className:"ee-topbar-overflow-divider","aria-hidden":!0}),Je("button",{type:"button",role:"menuitem",className:"ee-topbar-overflow-item",onClick:()=>{W(!1),p()},children:[qe(B,{icon:Ke}),qe("span",{children:D("keyboard_shortcuts")})]})]}),"function"==typeof R&&Je("button",{type:"button",role:"menuitem",className:"ee-topbar-overflow-item",onClick:()=>{R(e=>!e),W(!1)},children:[qe(B,{icon:Ve}),qe("span",{children:D(P?"high_contrast_off":"high_contrast_on")})]})]})]}),"function"==typeof f&&Je(Ye,{children:[qe("div",{className:"ee-topbar-divider ee-topbar-divider-exit","aria-hidden":!0}),qe("button",{type:"button",className:"ee-topbar-exit-btn",onClick:f,children:D("topbar_exit")||"Exit"})]})]}),qe(g,{className:"ee-modal-dark ee-html-preview-modal",title:Je("div",{className:"ee-html-preview-modal-header-inner",children:[qe("span",{className:"ee-html-preview-modal-title-text",children:D("html_email_preview_title")}),Je("div",{className:"ee-topbar-segment ee-html-preview-modal-segment",role:"tablist","aria-label":D("html_email_preview_device_aria"),onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),children:[qe("button",{type:"button",role:"tab","aria-selected":"desktop"===ae,className:za("ee-topbar-segment-btn","desktop"===ae&&"ee-topbar-segment-btn-active"),onClick:()=>ie("desktop"),title:D("desktop"),children:qe(B,{icon:Ee})}),qe("button",{type:"button",role:"tab","aria-selected":"mobile"===ae,className:za("ee-topbar-segment-btn","mobile"===ae&&"ee-topbar-segment-btn-active"),onClick:()=>ie("mobile"),title:D("mobile"),children:qe(B,{icon:ze})})]})]}),open:oe,onCancel:()=>le(!1),footer:null,width:"min(960px, 96vw)",centered:!0,destroyOnClose:!0,children:se.error?qe("p",{className:"ee-html-preview-error",children:se.error}):qe("div",{className:za("ee-html-preview-viewport","mobile"===ae&&"ee-html-preview-viewport--mobile"),children:qe("iframe",{title:D("html_email_preview_title"),className:"ee-html-preview-iframe",sandbox:"allow-same-origin allow-popups allow-popups-to-escape-sandbox",srcDoc:se.html})})}),qe(Jc,{open:j,issues:K,onClose:ye,onExportAnyway:()=>{"html"===G?ge():"json"===G&&me(),ye()}}),!_e&&"function"==typeof d&&qe(Zc,{open:X,templateName:e,onClose:()=>Z(!1),onSend:t=>{if("function"!=typeof d)return;const n=pe();d({...n,name:e||"Untitled template",recipients:t.recipients,payloadType:t.payloadType,subjectPrefix:t.subjectPrefix})}}),!ke&&"function"==typeof u&&qe(g,{className:"ee-modal-dark",title:D("save_template_title")||"Save template",open:Q,onCancel:()=>{ee(!1),ne("")},onOk:()=>{if("function"!=typeof u)return;const t=pe();u({...t,name:e||"Untitled template",category:te}),ee(!1),ne("")},okText:D("save")||"Save",cancelText:D("cancel"),width:420,destroyOnClose:!0,children:Je("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[Je("div",{children:[qe("div",{style:{marginBottom:6,fontSize:13,fontWeight:500},children:D("template_name")||"Template name"}),qe(h,{value:e||D("topbar_untitled_template"),readOnly:!0})]}),Je("div",{children:[qe("div",{style:{marginBottom:6,fontSize:13,fontWeight:500},children:D("save_template_category")||"Category"}),qe(x,{style:{width:"100%"},value:te||void 0,placeholder:D("save_template_category_placeholder")||"Select or type a category…",allowClear:!0,showSearch:!0,onChange:e=>ne(e||""),getPopupContainer:()=>document.querySelector(".email-editor")||document.body,options:[{value:"promotional",label:D("category_promotional")||"Promotional"},{value:"transactional",label:D("category_transactional")||"Transactional"},{value:"newsletter",label:D("category_newsletter")||"Newsletter"},{value:"onboarding",label:D("category_onboarding")||"Onboarding"},{value:"announcement",label:D("category_announcement")||"Announcement"},{value:"other",label:D("category_other")||"Other"}]})]})]})})]})},ed=({keys:e,desc:t})=>Je("div",{className:"ee-shortcuts-row",children:[qe("span",{className:"ee-shortcuts-row-desc",children:t}),qe("kbd",{className:"ee-shortcuts-kbd",children:e})]}),td=({open:e,onClose:t})=>{const{t:n}=ja(),o=/Mac|iPhone|iPod|iPad/i.test("undefined"!=typeof navigator&&navigator.platform||"")?"⌘":"Ctrl";return Je(g,{wrapClassName:"ee-modal-dark ee-shortcuts-modal",title:n("shortcuts_modal_title"),open:e,onCancel:t,footer:null,width:520,destroyOnClose:!0,children:[qe(ed,{keys:`${o} + S`,desc:n("shortcut_save")}),qe(ed,{keys:`${o} + Z`,desc:n("shortcut_undo")}),qe(ed,{keys:`${o} + Shift + Z / ${o} + Y`,desc:n("shortcut_redo")}),qe(ed,{keys:`${o} + D`,desc:n("shortcut_duplicate")}),qe(ed,{keys:`${o} + C`,desc:n("shortcut_copy_block")}),qe(ed,{keys:`${o} + V`,desc:n("shortcut_paste_block")}),qe(ed,{keys:"Delete / Backspace",desc:n("shortcut_delete_block")}),qe(ed,{keys:"Esc",desc:n("shortcut_escape")}),qe(ed,{keys:"?",desc:n("shortcut_cheat_sheet")}),qe("p",{className:"ee-shortcuts-footnote",children:n("shortcuts_modal_footnote")})]})};function nd(e){return e&&"function"==typeof e.closest&&(e.closest('[data-type="empty-block-item"]')||e.closest('[data-type="empty-block"]')||e.closest('[data-type="drag-over-column"]')||e.closest('[data-type="block-item-move"]'))||e}const od=({language:e})=>{const{blockMap:t,rootOrder:l,setBlocks:i,currentItem:s,setCurrentItem:c,setIsDragStart:d,setLanguage:u,templateData:p,highContrastEditor:m,canUndo:h,canRedo:y,undo:b,redo:f,flushPendingRichText:_,onShortcutSave:k,templateName:v,onTemplateNameChange:w,onBack:x,onSaveTemplate:C,onSaveTemplateIntent:N,onSendTest:L,onSendTestIntent:T,saveStatusDetail:B,onExit:A,onPreview:I,hideOverflowExportActions:$}=n(Ln),{t:P}=ja(),{getColumnConfig:R}=fr(),[M,D]=a(!1),U=e=>{if(!e||"object"!=typeof e)return e;const t=p?.content?.products,n=p?.catalogProducts,o=p?.content?.primaryProductId,l=Array.isArray(t)&&t.length>0?t:Array.isArray(n)&&n.length>0?n:zr,a=o?l.find(e=>e.id===o):l[0],i=a?l.filter(e=>e?.id!==a.id):l,r=e=>{if(!e||"object"!=typeof e)return e;const t=Array.isArray(e.children)?e.children.map(r):e.children;if("column"!==e.key||"product"!==e.containerType||!a)return{...e,children:t};const n=Math.max(Array.isArray(t)?t.length:0,Array.isArray(e.columnProducts)?e.columnProducts.length:0,1),o="additional"===e.productRole?"additional":"main",l=Array.from({length:n},(e,t)=>"main"===o||0===i.length?a:i[t%i.length]);return{...e,children:t,columnProducts:l}};return r(e)};r(()=>{u(e)},[e,u]),r(()=>{const e=e=>{const t=e.target;if(n=t,Boolean(n&&n.closest&&n.closest(".email-editor")))return!0;var n;const o=t===document.body||t===document.documentElement||"string"==typeof t?.id&&"root"===t.id;return Boolean(o&&document.querySelector(".email-editor"))},n=e=>"Backspace"===e.key||"Delete"===e.key||"Backspace"===e.code||"Delete"===e.code,o=o=>{if(!e(o))return;const a=o.metaKey||o.ctrlKey,r=o.key,d=(u=o.target,Boolean(u?.closest?.(".text-content_editable[contenteditable='true']")));var u;const p=(e=>{if(!e)return!1;const t=e.tagName;return"INPUT"===t||"TEXTAREA"===t||"SELECT"===t||Boolean(e.closest?.(".ant-input, .ant-input-number, textarea.ant-input, .ant-select-selection-search-input"))})(o.target),m=()=>{if(!s?.id||"add"===s.type)return!1;const e=s.id,n=t[e];if(!n)return!1;const a=()=>{const n=Ri(t,l,e,P);n&&(i(n.nextMap,n.nextRootOrder,"delete"),c(null))};return"column"===n.key&&Pi(t,e)?(o.preventDefault(),o.stopPropagation(),g.confirm({title:P("shortcut_delete_confirm_title"),content:P("shortcut_delete_confirm_desc"),okText:P("confirm"),cancelText:P("cancel"),wrapClassName:"ee-modal-dark",onOk:a}),!0):(o.preventDefault(),o.stopPropagation(),a(),!0)};if(a&&"s"===String(r).toLowerCase())"function"==typeof k&&(o.preventDefault(),o.stopPropagation(),k());else if(d){if("Escape"===r)return o.preventDefault(),o.stopPropagation(),_(),D(!1),"function"==typeof document.activeElement?.blur&&document.activeElement.blur(),void c(null);if(!a&&n(o)&&(e=>"function"==typeof e?.closest&&e.closest("[data-block-id]")?.getAttribute?.("data-block-id")||null)(o.target)===s?.id&&(()=>{const e=window.getSelection();if(!e?.rangeCount)return!1;const t=e.anchorNode;if(!t)return!1;const n=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement,o="function"==typeof n?.closest?n.closest(".text-content_editable[contenteditable='true']"):null;return!!o&&0===String(o.innerText||"").replace(/[\u200b\uFEFF]/g,"").replace(/\u00a0/g," ").replace(/[\t\n\r\f]/g,"").trim().length})())return _(),void m();if(a&&"z"===String(r).toLowerCase()&&!o.shiftKey){if(!h)return;return o.preventDefault(),o.stopPropagation(),_(),void b()}if(a&&("z"===String(r).toLowerCase()&&o.shiftKey||"y"===String(r).toLowerCase())){if(!y)return;return o.preventDefault(),o.stopPropagation(),_(),void f()}}else if(!p){if(a&&"z"===String(r).toLowerCase()&&!o.shiftKey){if(!h)return;return o.preventDefault(),_(),void b()}if(a&&("z"===String(r).toLowerCase()&&o.shiftKey||"y"===String(r).toLowerCase())){if(!y)return;return o.preventDefault(),_(),void f()}if(a&&"d"===String(r).toLowerCase()){if(!s?.id||"add"===s.type)return;o.preventDefault();const e=Ai(t,l,s.id);if(!e)return;return i(e.nextMap,e.nextRootOrder,"add"),void c({id:e.newId,data:e.selectionData,type:"edit"})}if(a&&"c"===String(r).toLowerCase()){if(!s?.id||"add"===s.type)return;o.preventDefault();const e=Bi(t,l,s.id);return void(e&&(Ti.tree=e))}if(a&&"v"===String(r).toLowerCase()){if(!Ti.tree)return;o.preventDefault();const e=s?.id&&t[s.id]?s.id:null,n=$i(t,l,Ti.tree,e);if(!n)return;return i(n.nextMap,n.nextRootOrder,"add"),void c({id:n.newId,data:n.selectionData,type:"edit"})}return"Escape"===r?(o.preventDefault(),D(!1),void c(null)):"?"===r||o.shiftKey&&"Slash"===o.code?(o.preventDefault(),void D(!0)):void(n(o)&&m())}};return document.addEventListener("keydown",o,!0),()=>document.removeEventListener("keydown",o,!0)},[t,l,s,i,c,h,y,b,f,_,k,P]);const E=()=>{const e=document.getElementsByClassName("block-drag-label-content");Array.from(e).forEach(e=>{e.children[0]&&(e.children[0].style.visibility="hidden")})},z=()=>{const e=document.getElementsByClassName("block-content-drag-label-content");Array.from(e).forEach(e=>{e.children[0]&&(e.children[0].style.visibility="hidden")})},F=()=>{document.querySelectorAll(".block-empty-content").forEach(e=>{e.style.border=""})},O=()=>{document.querySelectorAll('[data-type="empty-block"]').forEach(e=>{e.style.border=""})},W=()=>{document.querySelectorAll('[data-drag-hovered="true"]').forEach(e=>{delete e.dataset.dragHovered})},j=e=>{const t=e?.closest?.(".block-item[data-block-id], .block[data-block-id]")||null;document.querySelectorAll('[data-drag-hovered="true"]').forEach(e=>{e!==t&&delete e.dataset.dragHovered}),t&&(t.dataset.dragHovered="true")},H=()=>{E(),z(),F(),O(),W()},K=o(e=>{e.preventDefault(),e.stopPropagation();const t=nd(e.target),{type:n}=t.dataset||{};switch(n){case"empty-block":E(),z(),W(),t.style.border="2px dashed var(--ee-drop-target-outline)";break;case"drag-over-column":{z(),j(t);const e=t.dataset.index,n=document.getElementsByClassName("block-drag-label-content");Array.from(n).forEach(t=>{const n=Number(t.dataset.index)===Number(e),o=t.querySelector(".block-move-top"),l=t.querySelector(".block-move-bottom");o&&(o.style.visibility=n?"visible":"hidden"),l&&(l.style.visibility=n?"visible":"hidden")});break}case"block-item-move":{E(),j(t);const e=t.dataset.dropKey,n=document.getElementsByClassName("block-content-drag-label-content");Array.from(n).forEach(t=>{t.dataset.dropKey===e?t.children[0].style.visibility="visible":t.children[0].style.visibility="hidden"});break}case"empty-block-item":E(),z(),j(t),t.classList?.contains("block-empty-content")&&(t.style.border="2px dashed var(--ee-drop-target-outline)");break;default:E(),z(),W()}},[]),V=(e,t)=>{const{blockMap:n,removedId:o}=Xt(e,t.containerId,t.cellIndex,t.itemIndex);return{result:n,removedId:o}},G=(e,t,n,o)=>{const l=e[t];if(!l||l.cells[n].childrenIds.length>0)return e;const a=Wt(o("drag_block_here"));return{...e,[a.id]:a,[t]:{...l,cells:l.cells.map((e,t)=>t===n?{...e,childrenIds:[a.id]}:e)}}},q=(e,t,n)=>{if(!t||!n)return!1;if(t===n)return!0;const o=t=>{const l=e[t];if(!l||"column"!==l.key)return!1;for(const e of l.cells||[])for(const t of e.childrenIds||[]){if(t===n)return!0;if(o(t))return!0}return!1};return o(t)};return Je(Ye,{children:[qe(td,{open:M,onClose:()=>D(!1)}),Je("div",{className:"email-editor"+(m?" ee-high-contrast":""),onDragOver:K,onDrop:e=>{e.preventDefault(),e.stopPropagation();const n=nd(e.target),{type:o}=n.dataset||{};W(),F(),O(),d(!1);const a="undefined"!=typeof window?window.__eeDragItemData:null,r=()=>{"undefined"!=typeof window&&(window.__eeDragItemData=null,window.__eeDragSource=null)},u="add"===s?.type&&null!=s?.data,p=u||a?"add":s?.type,m=u?function(e){if(!e||"object"!=typeof e)return e;const t="column"===e.key&&Array.isArray(e.children)&&e.children.length>0;if("column"===e.key&&Array.isArray(e.cells)&&e.cells.length>0&&!t){const t=tn(e,e.blockMap||e.blockSnapshotMap||{});if(t?.blockMap&&t.rootId){const e=Ht(t.blockMap,[t.rootId])[0];if(e)return Bt(e)}}return Bt(e)}(s.data):a?Bt(a):s?.data??null;if(m){switch(o){case"empty-block":{const e="column"===m.key?m:R(m),n=U(e),{newBlockMap:o,rootId:l}=nn(t,n);if(!l)return void r();i(o,[l],"add"),c({id:l,data:o[l],type:"edit"}),"add"===p&&"column"===o[l]?.key&&Mi(o[l])===Ui&&Fi(l);break}case"empty-block-item":{F();const e=n.dataset.containerId,o=Number(n.dataset.cellIndex),a=Number(n.dataset.itemIndex);if(!e)return void r();if("column"===m.key||"add"!==p&&s?.id&&"column"===t[s.id]?.key)return S.warning(P("section_nest_not_allowed")),r(),void H();let d={...t};if("add"===p){const t=Bt(m),n=U(t),{newBlockMap:s,rootId:u}=nn(d,n);if(!u)return void r();d=Yt(s,e,o,a,u),i(d,l,"add"),c({id:u,data:d[u],type:"edit"})}else{const t=s.id;if(q(d,t,e))return r(),void H();const n=Vt(d,l,t);if(!n)return void r();{const{result:t,removedId:l}=V(d,n);d=t?G(t,n.containerId,n.cellIndex,P):d,l&&(d=Yt(d,e,o,a,l))}i(d,l,"move"),c({...s,data:d[t]??s.data,type:"edit"})}break}case"drag-over-column":{const e=Number(n.dataset.index);let o,a=[...l],d={...t};if("add"===p){const t=Bt(m);if("column"===t.key){const n=U(t),{newBlockMap:l,rootId:i}=nn(d,n);if(!i)return void r();d=l,a.splice(e,0,i),o={id:i,data:d[i],type:"edit"}}else{const n=e>=a.length?a[a.length-1]:a[e],l=d[n];if(!l||"column"!==l.key)return void r();const{newBlockMap:i,rootId:s}=nn(d,t);if(!s)return void r();d=i;const c=0,u=d[n]?.cells?.[c],p=u?.childrenIds?.[0],m=p?d[p]:null;if("empty"===m?.key)d=Yt(d,n,c,0,s);else{d=Zt(d,n,c,u?.childrenIds?.length??0,s)}o={id:s,data:d[s],type:"edit"}}}else{const t=s.id,n=l.indexOf(t);if(-1===n)return void r();a.splice(n,1),a.splice(e>n?e-1:e,0,t),o={...s,type:"edit"}}i(d,a,"move"),c(o),"add"===p&&"column"===o?.data?.key&&Mi(o.data)===Ui&&Fi(o.id),setTimeout(()=>{const e=document.getElementsByClassName("block-drag-label-content");Array.from(e).forEach(e=>{const t=e.querySelector(".block-move-top");t&&(t.style.visibility="hidden")})},30);break}case"block-item-move":{const e=n.dataset.dropKey;if(!e)return void r();const[o,a,d]=e.split(":"),u=Number(a),g=Number(d);let h,y={...t};if("add"===p){if("column"===m.key)return S.warning(P("section_nest_not_allowed")),r(),void H();const e=Bt(m),t=U(e),{newBlockMap:n,rootId:l}=nn(y,t);if(!l)return void r();y=Zt(n,o,u,g,l),h={id:l,data:y[l],type:"edit"}}else{const e=s.id;if("column"===y[e]?.key)return S.warning(P("section_nest_not_allowed")),r(),void H();if(q(y,e,o))return r(),void H();const t=Vt(y,l,e);if(!t)return void r();const{blockMap:n,removedId:a}=Xt(y,t.containerId,t.cellIndex,t.itemIndex);y=n;const i=y[t.containerId];if(i&&0===i.cells[t.cellIndex].childrenIds.length){const e=Wt(P("drag_block_here"));y={...y,[e.id]:e,[t.containerId]:{...i,cells:i.cells.map((n,o)=>o===t.cellIndex?{...n,childrenIds:[e.id]}:n)}}}let c=g;t.containerId===o&&t.cellIndex===u&&t.itemIndex<g&&(c=g-1),y=Zt(y,o,u,c,a),h={...s,type:"edit"}}i(y,l,"move"),c(h),setTimeout(()=>{const e=document.getElementsByClassName("block-content-drag-label-content");Array.from(e).forEach(e=>{e.children[0]&&(e.children[0].style.visibility="hidden")})},30);break}}r()}else r()},onDragLeave:e=>{const t=e.currentTarget,n=e.relatedTarget,o=nd(e.target);setTimeout(()=>{if(t&&t.contains(n))switch(o?.dataset?.type){case"empty-block":o.style.border="";break;case"empty-block-item":o?.classList?.contains("block-empty-content")&&(o.style.border="")}else H()},50)},children:[qe(Qc,{templateName:v,onTemplateNameChange:w,onBack:x,onSaveTemplate:C,onSaveTemplateIntent:N,onSendTest:L,onSendTestIntent:T,saveStatusDetail:B,onExit:A,onPreview:I,hideOverflowExportActions:$,onShowShortcuts:()=>D(!0)}),Je("div",{className:"email-editor-main",onClick:e=>{e.preventDefault(),e.stopPropagation(),c(null)},children:[qe(qc,{clearStyles:H}),qe(or,{clearStyles:H}),qe(Sc,{clearStyles:H})]})]})]})},ld="markopolo-email-editor:undo:";const ad=e=>Array.isArray(e)?e.map(e=>e&&"object"==typeof e?{...e,children:ad(e.children)}:e):e&&"object"==typeof e?Object.values(e).map(e=>e&&"object"==typeof e?{...e,children:ad(e.children)}:e):[],id=e=>{const t={},n=(e,o=[])=>{Array.isArray(e)&&e.forEach(e=>{if(!e||"object"!=typeof e)return;const l={blockId:e.id??null,key:e.key??null,containerType:"column"===e.key?e.containerType??"none":null},a=[...o,l];if("text"===e.key&&"dynamic"===e.contentType){const n="string"==typeof e.dynamicPrompt?e.dynamicPrompt.trim():"",o="string"==typeof e.dynamicSelectedContent?e.dynamicSelectedContent.trim():"";if(!n&&!o)return;t[e.id]={blockId:e.id,path:a,key:e.key,type:e.type||"p",selectedContent:o,options:Array.isArray(e.dynamicOptions)?e.dynamicOptions:[],prompt:n,variable:e.dynamicVariable??"",language:"bn-BD"===e.dynamicAiLanguage?"bn-BD":"en"}}Array.isArray(e.children)&&n(e.children,a)})};return n(e,[]),t},rd=e=>Array.isArray(e)?e.map(e=>{if(!e||"object"!=typeof e)return e;const{dynamicPrompt:t,dynamicOptions:n,dynamicSelectedContent:o,dynamicVariable:l,dynamicAiLanguage:a,staticTextBeforeAi:i,children:r,...s}=e;return{...s,children:rd(r)}}):e,sd=d(({defaultBlockList:e,defaultBodySettings:t,fillProductSlots:n,aiContentRefs:s,language:c="en",customLanguageLibraries:d,templateData:m,variableDefinitions:g,apiConfig:h={},aiEnabled:y=!0,saveState:b="saved",onChange:f,undoPersistenceKey:_=null,onShortcutSave:k,onSaveBlockAsGlobal:v,templateName:w="",onTemplateNameChange:x,onBack:S,onSaveTemplate:C,onSaveTemplateIntent:N,onSendTest:L,onSendTestIntent:T,saveStatusDetail:B,onExit:A,onPreview:I,hideOverflowExportActions:$=!1,universals:P=[]},R)=>{const[M,D]=a(()=>{if("undefined"==typeof window)return!1;try{return"1"===window.localStorage.getItem("ee_high_contrast_editor")}catch{return!1}});r(()=>{if("undefined"!=typeof window)try{window.localStorage.setItem("ee_high_contrast_editor",M?"1":"0")}catch{}},[M]),r(()=>{var e;po=(e=g)&&"object"==typeof e?e:uo,vo()},[g]);const U=l(()=>oa(h),[h]),[E,z]=a([]),[F,O]=a(!1),W=o(async()=>{if(U?.companyId){O(!0);try{const e=await async function(e,t={}){const n=ia(e),o=e?.companyId;if(!n||!o)return[];const l=new URLSearchParams({companyId:String(o),page:String(t.page??1),limit:String(t.limit??100)});null!=t.blockType&&String(t.blockType).trim()&&l.set("blockType",String(t.blockType)),"boolean"==typeof t.isActive&&l.set("isActive",String(t.isActive));const a=await fetch(`${n}?${l.toString()}`,{method:"GET",headers:{...e?.headers||{}}}),i=await a.text();let r;try{r=i?JSON.parse(i):{}}catch{return[]}if(!a.ok)return console.warn("[universal-email-blocks]",a.status,r),[];const s=r?.data;return Array.isArray(s)?s.map(sa).filter(Boolean):[]}(U,{limit:100});z(Array.isArray(e)?e:[])}catch(e){console.warn("[EmailEditor] universal email blocks fetch",e)}finally{O(!1)}}else z([])},[U]);r(()=>{W()},[W]);const j=l(()=>{const e=E??[],t=P??[];if(!U?.companyId)return t;const n=new Set;return e.filter(e=>{const t=String(e?.resourceId??e?.id??"");return!(!t||n.has(t))&&(n.add(t),!0)})},[U?.companyId,E,P]),H=o(async e=>{U?.companyId&&(await async function(e,{name:t,block:n}){const o=ia(e),l=e?.companyId;if(!o||!l)throw new Error("Universal blocks API: missing endpoint or companyId");const a=la(t,n,l),i=await fetch(o,{method:"POST",headers:ra(e),body:JSON.stringify(a)}),r=await i.text();let s;try{s=r?JSON.parse(r):{}}catch{s={message:r}}if(!i.ok)throw new Error(aa(s,i.status));return s?.data??s}(U,e),await W()),"function"==typeof v&&await Promise.resolve(v(e))},[U,v,W]),K=o(async e=>{U?.companyId&&(await async function(e,t){const n=ia(e),o=e?.companyId;if(!n||!o||!t)throw new Error("Universal blocks API: missing endpoint, companyId, or id");const l=new URLSearchParams({companyId:String(o)}),a=`${n}/${encodeURIComponent(String(t))}?${l}`,i=await fetch(a,{method:"DELETE",headers:{...e?.headers||{}}});if(204===i.status)return!0;if(!i.ok){const e=await i.text();let t;try{t=e?JSON.parse(e):{}}catch{t={message:e}}throw new Error(aa(t,i.status))}return!0}(U,e),await W())},[U,W]),V=e&&!Array.isArray(e)&&"object"==typeof e?e:null,G=V?V.blocks??V.blockList??[]:e,q=(J=G,Array.isArray(J)?J.map(e=>e&&"object"==typeof e?{...e,children:ad(e.children)}:e):J&&"object"==typeof J?Object.values(J).map(e=>e&&"object"==typeof e?{...e,children:ad(e.children)}:e):[]);var J;const Y=s??V?.aiContentRefs??{},X=t??V?.bodySettings??Nn.bodySettings,Z=void 0!==n?!1!==n:void 0!==V?.fillProductSlots?!1!==V.fillProductSlots:Cn,Q=m??Nn.templateData,ee=((e,t)=>{if(!Array.isArray(e))return e;const n=t?.content?.products;if(!Array.isArray(n)||0===n.length)return e;const o=t?.content?.primaryProductId,l=(o?n.find(e=>e?.id===o):n[0])??n[0]??zr[0]??null;if(!l)return e;const a=n.filter(e=>e?.id!==l.id),i=e=>{if(!e||"object"!=typeof e)return e;const t=Array.isArray(e.children)?e.children.map(i):e.children;if("column"!==e.key||"product"!==e.containerType)return{...e,children:t};const n="additional"===e.productRole?"additional":"main",o=Math.max(Array.isArray(t)?t.length:0,Array.isArray(e.columnProducts)?e.columnProducts.length:0,1),r=Array.from({length:o},(e,t)=>"main"===n||0===a.length?l:a[t%a.length]);return{...e,children:t,columnProducts:r}};return e.map(i)})(q,Q),te=function(e,t={}){const n=Array.isArray(e)?e:e&&"object"==typeof e?Object.values(e):null;if(!Array.isArray(n))return e;const o=n.map(e=>Zl(e,t));return o.forEach(Lt),o}(ee,Y),{blockMap:ne,rootOrder:oe}=jt(te),le=Rt(ne,Q),ae=l(()=>function(e){if("undefined"==typeof sessionStorage||!e)return null;try{const t=sessionStorage.getItem(ld+e);if(!t)return null;const n=JSON.parse(t);return n&&"object"==typeof n?{undoStack:Array.isArray(n.undoStack)?n.undoStack:[],redoStack:Array.isArray(n.redoStack)?n.redoStack:[]}:null}catch{return null}}(_),[_]),[ie,re]=u(Rn,{...Nn,blockMap:le,rootOrder:oe,blockList:te,bodySettings:{...X,contentWidth:Et(X?.contentWidth)},fillProductSlots:Z,languageLibraries:d,templateData:Q,undoStack:ae?.undoStack??[],redoStack:ae?.redoStack??[]}),se=i(null);r(()=>{_&&function(e,t,n){if("undefined"!=typeof sessionStorage&&e)try{sessionStorage.setItem(ld+e,JSON.stringify({undoStack:t,redoStack:n}))}catch{}}(_,ie.undoStack,ie.redoStack)},[_,ie.undoStack,ie.redoStack]),r(()=>{re(vn(m??null,{skipUndo:!0}))},[m]);const[ce,de]=a([]);r(()=>{if("undefined"==typeof document)return;const e=ie.blockList??[],t="ee-font-runtime-imports",n=document.getElementById(t)||Object.assign(document.createElement("style"),{id:t}),o=tl(e,ie.bodySettings,ie.templateData);n.textContent=o||"",n.parentNode||document.head.appendChild(n)},[ie.blockList,ie.bodySettings,ie.templateData]);const ue=l(()=>new Set(ce),[ce]),pe=o(e=>(Array.isArray(e)?e:[]).filter(e=>!ue.has(ma(e))),[ue]),me=o(e=>{const t=ma(e);t&&de(e=>e.includes(t)?e:[...e,t])},[]),ge=o(()=>{const e=ie.blockList??[];return{blockList:rd(e),bodySettings:ie.bodySettings??null,aiContentRefs:id(e),language:ga(e),fillProductSlots:!1!==ie.fillProductSlots}},[ie.blockList,ie.bodySettings,ie.fillProductSlots]),he=l(()=>pe(Ia({blockList:ie.blockList??[],bodySettings:ie.bodySettings??null,aiContentRefs:id(ie.blockList??[])})).filter(e=>e?.blockId&&("warning"===e.severity||"error"===e.severity||"info"===e.severity)).reduce((e,t)=>{const n=t.blockId,o=e[n]??{severity:t.severity,warningCount:0,errorCount:0,infoCount:0,totalCount:0,messages:[],issues:[]};return"error"===t.severity&&(o.errorCount+=1),"warning"===t.severity&&(o.warningCount+=1),"info"===t.severity&&(o.infoCount+=1),o.totalCount+=1,o.severity=o.errorCount>0?"error":o.warningCount>0?"warning":"info",o.messages.push(t.message),o.issues.push(t),e[n]=o,e},{}),[ie.blockList,ie.bodySettings,pe]);p(R,()=>({blockList:rd(ie.blockList??[]),bodySettings:ie.bodySettings,fillProductSlots:!1!==ie.fillProductSlots,aiContentRefs:id(ie.blockList??[]),actionType:ie.actionType,exportJson:ge,filterIgnoredValidationIssues:pe,ignoreValidationIssue:me,focusBlock:e=>{if(!e||!ie.blockMap?.[e])return!1;const t=ie.blockMap[e],n="column"===t?.key?Kt(e,ie.blockMap)??t:t;return re(kn({id:e,data:n,type:"edit"})),re(_n("edit")),"undefined"!=typeof window&&window.requestAnimationFrame(()=>{const t="function"==typeof window.CSS?.escape?window.CSS.escape(String(e)):String(e).replace(/([ #;?%&,.+*~':\x22!^$\x5b\x5d()=>|/@])/g,"\\$1"),n=document.querySelector(`[data-block-id="${t}"]`);n&&"function"==typeof n.scrollIntoView&&n.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})}),!0},exportHtml:()=>Gl({bodySettings:ie.bodySettings,blockList:ie.blockList,templateData:ie.templateData})}),[ie.blockList,ie.blockMap,ie.bodySettings,ie.fillProductSlots,ie.actionType,ie.templateData,ge,pe,me]),r(()=>{"function"==typeof f&&"firstRender"!==ie.actionType&&f({blockList:rd(ie.blockList??[]),bodySettings:ie.bodySettings??null,aiContentRefs:id(ie.blockList??[]),fillProductSlots:!1!==ie.fillProductSlots,actionType:ie.actionType})},[ie.blockList,ie.bodySettings,ie.fillProductSlots,ie.actionType,f]);const ye=o(e=>{re((e=>({type:an,isDragStart:e}))(e))},[]),be=o((e,t,n)=>{t&&re(_n(t)),re(((e,t={})=>({type:dn,bodySettings:e,skipUndo:Boolean(t.skipUndo)}))(e,n||{}))},[]),fe=o((e,t,n)=>{t&&re(_n(t)),re(((e,t={})=>({type:un,fillProductSlots:!1!==e,skipUndo:Boolean(t.skipUndo)}))(e,n||{}))},[]),_e=o((e,t,n,o)=>{n&&re(_n(n)),re(((e,t,n={})=>({type:ln,blockMap:e,rootOrder:t,skipUndo:Boolean(n.skipUndo)}))(e,t,o||{}))},[]),ke=o((e,t,n)=>{t&&re(_n(t)),re(((e,t={})=>({type:on,blockList:e,skipUndo:Boolean(t.skipUndo)}))(e,n||{}))},[]),ve=o(e=>{re((e=>({type:sn,previewMode:e}))(e))},[]),we=o(e=>{re(kn(e))},[]),xe=o(e=>{re((e=>({type:pn,selectionRange:e}))(e))},[]),Se=o(e=>{re((e=>({type:mn,textRange:e}))(e))},[]),Ce=o(e=>{re(_n(e))},[]),Ne=o(e=>{re((e=>({type:gn,language:e}))(e))},[]),Le=o(e=>{re((e=>({type:hn,languageLibraries:e}))(e))},[]),Te=o((e,t)=>{re(vn(e,t||{}))},[]),Be=o(()=>{try{se.current?.()}catch{}},[]),Ae=o(e=>(se.current=e,()=>{se.current===e&&(se.current=null)}),[]),Ie=o(()=>{Be(),re({type:bn})},[Be]),$e=o(()=>{Be(),re({type:fn})},[Be]),Pe=l(()=>({blockMap:ie.blockMap,rootOrder:ie.rootOrder,blockList:ie.blockList,actionType:ie.actionType,previewMode:ie.previewMode,currentItem:ie.currentItem,bodySettings:ie.bodySettings,fillProductSlots:!1!==ie.fillProductSlots,isDragStart:ie.isDragStart,selectionRange:ie.selectionRange,textRange:ie.textRange,language:ie.language,languageLibraries:ie.languageLibraries,templateData:ie.templateData,apiConfig:U,validationMarkers:he,ignoreValidationIssue:me,aiEnabled:y,saveState:b,highContrastEditor:M,canUndo:ie.undoStack.length>0,canRedo:ie.redoStack.length>0,undo:Ie,redo:$e,flushPendingRichText:Be,registerRichTextFlush:Ae,onShortcutSave:k,onSaveBlockAsGlobal:H,templateName:w,onTemplateNameChange:x,onBack:S,onSaveTemplate:C,onSaveTemplateIntent:N,onSendTest:L,onSendTestIntent:T,saveStatusDetail:B,onExit:A,onPreview:I,hideOverflowExportActions:$,universals:j,universalsLoading:F,deleteUniversalEmailBlock:U?.companyId?K:void 0,setIsDragStart:ye,setBodySettings:be,setFillProductSlots:fe,setBlocks:_e,setBlockList:ke,setPreviewMode:ve,setCurrentItem:we,setSelectionRange:xe,setTextRange:Se,setActionType:Ce,setLanguage:Ne,setLanguageLibraries:Le,setTemplateData:Te,setHighContrastEditor:D}),[ie.blockMap,ie.rootOrder,ie.blockList,ie.actionType,ie.previewMode,ie.currentItem,ie.bodySettings,ie.fillProductSlots,ie.isDragStart,ie.selectionRange,ie.textRange,ie.language,ie.languageLibraries,ie.templateData,ie.undoStack.length,ie.redoStack.length,U,he,me,y,b,M,Ie,$e,Be,Ae,k,H,w,x,S,C,N,L,T,B,A,I,$,j,F,K,ye,be,fe,_e,ke,ve,we,xe,Se,Ce,Ne,Le,Te,D]);return qe(Ln.Provider,{value:Pe,children:qe(od,{language:c})})});const cd=["Product","Discount"],dd=["text","image","button"];function ud(e,t,n,o,l,a,i){if("column"===e.key&&e.containerType){const t=function(e){const t=e.toLowerCase();return"product"===t?"Product":"discount"===t?"Discount":"None"}(e.containerType),n=e.id??null;let r=o;"Product"===t&&(i.productIndex++,r=i.productIndex);for(const o of e.children??[])ud(o,t,n,r,l,a,i);return}if("content"===e.key){for(const r of e.children??[])ud(r,t,n,o,l,a,i);return}const r="dynamic"===e.contentType,s=cd.includes(t)&&dd.includes(e.key);if((r||s)&&n){let i=l.find(e=>e.containerId===n);i||(i={containerId:n,containerType:t,blocks:[]},l.push(i));const c=e.id?a[e.id]:void 0,d=function(e){return"image"===e.key?e.src??"":"button"===e.key?e.linkURL??"":e.text??""}(e);let u="";"Product"===t?u=function(e,t){const n=`product ${t}`;return e.includes("{{ProductImage}}")?`This block is meant for displaying the ${n} image`:e.includes("{{ProductName}}")?`This block is meant for displaying the ${n} name`:e.includes("{{ProductOldPrice}}")||e.includes("{{ProductNewPrice}}")?`This block is meant for displaying the ${n} original and discounted price`:e.includes("{{ProductPrice}}")||e.includes("{{ProductCurrency}}")?`This block is meant for displaying the ${n} price and currency`:e.includes("{{ProductDescription}}")?`This block is meant for displaying the ${n} description`:e.includes("{{ProductLink}}")?`This block is meant for displaying the ${n} link`:`This block is meant for displaying ${n} content`}(d,o):"Discount"===t&&(u=function(e){const t=[];return e.includes("{{DiscountValue}}")&&t.push("the discount value (e.g. 20% or $10)"),e.includes("{{DiscountCode}}")&&t.push("the discount/promo code"),e.includes("{{ValidUntil}}")&&t.push("the discount expiry date"),0===t.length?"This block is meant for displaying discount/offer information":`This block is meant for displaying ${t.join(", ")}`}(d));const p=c?.prompt||u,m=s&&!r;i.blocks.push({id:e.id??"",contentType:m||"dynamic"===e.contentType?"dynamic":"static",value:m?"":d,ai:{prompt:p,selectedSampleAiContent:m?"":c?.selectedContent??d}})}if(e.children)for(const r of e.children)ud(r,t,n,o,l,a,i)}const pd={text:"text",image:"src",button:"linkURL"};function md(e,t){if(0===t.size)return!0;if(e.id&&t.has(e.id)){const n=t.get(e.id),o=pd[e.key];o&&(e[o]=n,t.delete(e.id))}if(e.children)for(const n of e.children)if(md(n,t))return!0;return 0===t.size}var gd=Object.freeze({__proto__:null,jsonToHtml:function(e){return ql(e)},normalizeJson:function(e){const t="string"==typeof e?JSON.parse(e):e,n=[],o=t.aiContentRefs||{},l={productIndex:0},a=t.blockList||[];for(const e of a)ud(e,"None",null,0,n,o,l);return{groups:n}},updateJsonWithMlContent:function(e,t){const n="string"==typeof e?JSON.parse(e):e,o=structuredClone(n),l=new Map;for(const e of t)e.variations.length>0&&l.set(e.nodeId,e.variations[0].value);const a=o.blockList||[];for(const e of a)if(md(e,l))break;return o}});function hd(e,t={}){const{validate:n=!0}=t,o=e?.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 l=o.exportJson();if(!l||"object"!=typeof l)throw new Error("exportTemplateJson: exportJson() returned an invalid payload.");return{payload:l,issues:n?Ia({blockList:l.blockList,bodySettings:l.bodySettings,aiContentRefs:l.aiContentRefs}):[]}}async function yd(e,t={}){const{validate:n=!0,checkImages:o=!0,imageProbe:l}=t,a=e?.current;if(!a||"function"!=typeof a.exportJson)throw new Error("exportTemplateJsonAsync: ref must be attached to EmailEditor (expected ref.current.exportJson to be a function).");const i=a.exportJson();if(!i||"object"!=typeof i)throw new Error("exportTemplateJsonAsync: exportJson() returned an invalid payload.");if(!n)return{payload:i,issues:[]};return{payload:i,issues:o?await Ea({blockList:i.blockList,bodySettings:i.bodySettings,aiContentRefs:i.aiContentRefs},l):Ia({blockList:i.blockList,bodySettings:i.bodySettings,aiContentRefs:i.aiContentRefs})}}const bd=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."});function fd(e={}){const t={name:"",website:"",navigation_links:[],social_links:{}},n={brand_color:"#111111",logo_url:"",tagline:"",heroBanner:"",footerBanner:""},o=null;return{content:{...{products:[],primaryProductId:null},...e.content&&"object"==typeof e.content?e.content:{}},companyContext:{...t,...e.companyContext&&"object"==typeof e.companyContext?e.companyContext:{}},brandContext:{...n,..."string"==typeof e.brandColor&&e.brandColor.trim()?{brand_color:e.brandColor.trim()}:{},...e.brandContext&&"object"==typeof e.brandContext?e.brandContext:{}},companyId:null!=e.companyId?e.companyId:o}}function _d(e){const t=[];if(null==e||"object"!=typeof e)return{ok:!1,warnings:["templateData must be a non-null object"]};const n=e;if(null!=n.content&&"object"!=typeof n.content)t.push("templateData.content should be an object when provided");else if(n.content&&"object"==typeof n.content){const e=n.content;null==e.products||Array.isArray(e.products)||t.push("templateData.content.products should be an array when provided")}if(null==n.catalogProducts||Array.isArray(n.catalogProducts)||t.push("templateData.catalogProducts should be an array when provided"),null!=n.companyContext&&"object"!=typeof n.companyContext&&t.push("templateData.companyContext should be an object when provided"),null!=n.brandContext&&"object"!=typeof n.brandContext&&t.push("templateData.brandContext should be an object when provided"),n.brandContext&&"object"==typeof n.brandContext){const e=n.brandContext;null!=e.brand_color&&"string"!=typeof e.brand_color&&t.push("templateData.brandContext.brand_color should be a string when provided")}return{ok:0===t.length,warnings:t}}export{ta as DEFAULT_EMAIL_TEMPLATE_ID,Ql as DEFAULT_MARKOPOLO_API_BASE_V1,ea as DEFAULT_ML_GENERATION_API_BASE_V1,sd as EmailEditor,bd as TEMPLATE_DATA_SCHEMA,fd as createDefaultTemplateData,sd as default,ql as exportNormalizerToHtml,hd as exportTemplateJson,yd as exportTemplateJsonAsync,oa as mergeMarkopoloApiConfig,gd as utils,Ia as validateExportPayload,Ea as validateExportPayloadComplete,Ua as validateImageUrlsReachable,_d as validateTemplateDataShape};
|
|
1
|
+
import e,{createContext as t,useContext as n,useCallback as o,useMemo as l,useState as a,useRef as i,useEffect as r,Fragment as s,useLayoutEffect as c,forwardRef as d,useReducer as u,useImperativeHandle as p}from"react";import{notification as m,Modal as g,Input as h,Badge as y,Switch as b,Popover as f,Button as _,InputNumber as k,Tooltip as v,Spin as w,Select as x,message as S,AutoComplete as C,Slider as N,Dropdown as L,Tag as T}from"antd";import{FontAwesomeIcon as B}from"@fortawesome/react-fontawesome";import{faInfoCircle as A,faBold as I,faItalic as $,faUnderline as P,faStrikethrough as R,faListOl as M,faListUl as D,faLink as U,faUnlink as E,faExpandAlt as z,faCompressAlt as F,faImage as O,faUser as W,faVideo as j,faEyeSlash as H,faChevronUp as K,faChevronDown as V,faCopy as G,faStar as q,faTrash as J,faArrowsAlt as Y,faSquare as X,faWindowMaximize as Z,faWindowMinimize as Q,faCube as ee,faTag as te,faColumns as ne,faTable as oe,faCode as le,faShareAlt as ae,faBars as ie,faArrowsAltV as re,faGripLines as se,faFont as ce,faCog as de,faMinus as ue,faPlus as pe,faCloudUploadAlt as me,faSyncAlt as ge,faAlignLeft as he,faAlignCenter as ye,faAlignRight as be,faAlignJustify as fe,faGripVertical as _e,faExclamationTriangle as ke,faCheckCircle as ve,faExclamationCircle as we,faEllipsisV as xe,faEye as Se,faChevronLeft as Ce,faChevronRight as Ne,faEnvelopeOpenText as Le,faHeading as Te,faShareAltSquare as Be,faMinusSquare as Ae,faFile as Ie,faTh as $e,faLayerGroup as Pe,faEnvelope as Re,faSpinner as Me,faUndo as De,faRedo as Ue,faDesktop as Ee,faMobileAlt as ze,faPaperPlane as Fe,faExternalLinkAlt as Oe,faSave as We,faFileExport as je,faFileCode as He,faKeyboard as Ke,faAdjust as Ve}from"@fortawesome/free-solid-svg-icons";import{motion as Ge}from"framer-motion";import{jsx as qe,jsxs as Je,Fragment as Ye}from"react/jsx-runtime";import{createPortal as Xe}from"react-dom";import{ChromePicker as Ze}from"react-color";function Qe(e){const t=String(e??"").trim();return/^(?:javascript|vbscript)\s*:/i.test(t)||/^data\s*:/i.test(t)}function et(e){let t=String(e??"").trim();if(!t)return"";if(Qe(t))return"";for(let e=0;e<t.length;e++){const n=t.charCodeAt(e),o=t[e];if(n<32||"<"===o||">"===o||'"'===o)return""}return t}function tt(e){const t=String(e??"").trim().match(/^https?:\/\/(.+)/is);return!!t&&/^https?:\/\//i.test(t[1])}function nt(e,t={}){const{allowMailtoTel:n=!0}=t,o=String(e??"").trim();if(!o)return null;if(Qe(o))return null;if(tt(o))return null;if(n&&(/^mailto:/i.test(o)||/^tel:/i.test(o)))return o;const l=/^https?:\/\//i.test(o)?o:`https://${o.replace(/^\/+/,"")}`;return ot(l,!1,t)?l:null}function ot(e,t=!1,n={}){return null==lt(e,t,n)}function lt(e,t=!1,n={}){const{allowMailtoTel:o=!0}=n;if(null==e||""===String(e).trim())return t?null:"empty";const l=String(e).trim();if(Qe(l))return"blocked_scheme";if(tt(l))return"duplicate_protocol";let a;if(/^https?:\/\//i.test(l)){const e=l.replace(/^https?:\/\//i,"");if(/^https?:\/\//i.test(e))return"duplicate_protocol";a=l}else a=o&&/^mailto:/i.test(l)||o&&/^tel:/i.test(l)?l:`https://${l}`;try{const e=new URL(a);return"http:"===e.protocol||"https:"===e.protocol?function(e){const t=String(e??"").trim().toLowerCase();return""!==t&&"http"!==t&&"https"!==t&&("localhost"===t||!!t.includes(":")||!!/^(?:\d{1,3}\.){3}\d{1,3}$/.test(t)||t.includes("."))}(e.hostname)?null:"missing_hostname_dot":o&&"mailto:"===e.protocol||o&&"tel:"===e.protocol?null:"invalid_protocol"}catch{return"invalid_url"}}function at(e){const t=String(e?.image||"").toLowerCase(),n=String(e?.title||"").toLowerCase().trim();return t.includes("/tc-x.svg")||t.includes("/brand-x.svg")||t.includes("/icons/x.svg")||t.includes("simple-icons")&&t.includes("/x.svg")||"x"===n||"twitter"===n}const it=["default","white","black","gray"];function rt(e){const t="string"==typeof e?e:"gray";return it.includes(t)?t:"default"}function st(e){if(!e||"object"!=typeof e)return{};const{padding:t,paddingTop:n,paddingRight:o,paddingBottom:l,paddingLeft:a,...i}=e;return i}const ct={small:21,medium:24,large:32},dt="https://unpkg.com/@tabler/icons@3.24.0/icons/outline",ut={facebook:"brand-facebook",x:"brand-x",instagram:"brand-instagram",linkedin:"brand-linkedin",tiktok:"brand-tiktok",youtube:"brand-youtube",pinterest:"brand-pinterest"};function pt(e){if(!e)return null;const t=ut[e];return t?`${dt}/${t}.svg`:null}const mt={left:"flex-start",center:"center",right:"flex-end",justify:"space-between"};function gt(e){const t=e&&"object"==typeof e?{...e}:{},n=t.columnGapPx,o="number"==typeof n&&Number.isFinite(n)&&n>=0?n:8;delete t.columnGapPx;const l=t.textAlign||"center";delete t.textAlign;const a=mt[l]||mt.left;return{...t,display:"flex",width:"100%",maxWidth:"100%",boxSizing:"border-box",flexDirection:"row",flexWrap:"wrap",alignItems:"center",justifyContent:a,columnGap:o,rowGap:0}}function ht(e){if(!e)return null;if(at(e))return"x";const t=String(e.image||"").toLowerCase(),n=String(e.title||"").toLowerCase();return t.includes("facebook")||n.includes("facebook")?"facebook":t.includes("instagram")||n.includes("instagram")?"instagram":t.includes("linkedin")||n.includes("linkedin")?"linkedin":t.includes("tiktok")||n.includes("tiktok")?"tiktok":t.includes("youtube")||n.includes("youtube")?"youtube":t.includes("pinterest")||n.includes("pinterest")?"pinterest":null}const yt="https://s.magecdn.com/social";const bt={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 ft(e){const t=String(e||"").toLowerCase();return pt("twitter"===t?"x":t)}function _t(e){const t=e?.iconSize;if(t&&null!=ct[t])return ct[t];const n=Number(e?.imageWidth);return Number.isFinite(n)&&n>0?Math.round(n):ct.medium}function kt(e){const t=function(e){switch(e){case"white":return"brightness(0) invert(1)";case"black":return"brightness(0)";case"gray":return"brightness(0) opacity(0.55)";default:return""}}(e);return t?{filter:t}:{}}function vt(e,t,n){const o=Number(n)||ct.medium,l={width:o,height:o,objectFit:"contain",display:"block",verticalAlign:"middle",flexShrink:0},a=t&&"default"!==t?t:"default",i=String(e?.image||"").trim(),r=function(e){return pt(ht(e))}(e),s=function(e){const t=ht(e);if(!t)return null;const n=bt[t];return n?`${yt}/${n}`:null}(e);if(i&&!function(e){const t=String(e||"").trim().toLowerCase();return!(!t||!t.startsWith(String(yt).toLowerCase())&&!t.startsWith(String(dt).toLowerCase())&&!t.includes("unpkg.com/@tabler/icons"))}(i))return{src:i,style:l};if("default"===a)return s?{src:s,style:l}:{src:i,style:l};if(r){if("white"===a)return{src:r,style:{...l,filter:"brightness(0) invert(1)"}};if("gray"===a)return{src:r,style:{...l,filter:"brightness(0) opacity(0.55)"}};if("black"===a)return{src:r,style:l}}return i?{src:i,style:{...l,...kt(a)}}:{src:"",style:l}}function wt(e,t,n){const{src:o,style:l}=vt(e,t,n),a=Number(n)||ct.medium,i=[`width:${a}px`,`height:${a}px`,"object-fit:contain","display:block","vertical-align:middle"];return"brightness(0) opacity(0.55)"===l.filter?i.push("opacity:0.55"):l.filter&&i.push(`filter:${l.filter}`),null!=l.opacity&&i.push(`opacity:${l.opacity}`),{src:o,styleAttr:i.join(";")}}const xt=e=>{const t=e.constructor===Array?[]:{};for(let n in e)e.hasOwnProperty(n)&&(e[n]&&"object"==typeof e[n]?(t[n]=e[n].constructor===Array?[]:{},t[n]=xt(e[n])):t[n]=e[n]);return t},St=(e,t)=>{let n=null;return function(){n||(n=setTimeout(()=>{e.apply(this,arguments),n=null},t))}};function Ct(e,t={}){if(null==e||"string"!=typeof e)return e;const n=null!=t.fontSize?Number(t.fontSize):14,o=null!=t.fontFamily?String(t.fontFamily):"sans-serif",l=null!=t.color?String(t.color):"",a=["direction: ltr",`font-size: ${n}px`,`font-family: ${o}`];l&&a.push(`color: ${l}`);const i=t.fontWeight;null!=i&&""!==String(i).trim()&&a.push(`font-weight: ${i}`);const r=t.fontStretch;null!=r&&""!==String(r).trim()&&"normal"!==String(r).toLowerCase()&&a.push(`font-stretch: ${r}`);const s=t.textTransform;null!=s&&""!==String(s).trim()&&"none"!==String(s).toLowerCase()&&a.push(`text-transform: ${s}`);const c=a.join("; ");let d=function(e){if(null==e||"string"!=typeof e)return e;let t=e.replace(/\sstyle\s*=\s*["']([^"']*)["']/gi,(e,t)=>{const n=t.replace(/\s*font-size\s*:[^;]+;?/gi,"").replace(/\s*font-family\s*:[^;]+;?/gi,"").replace(/\s*color\s*:[^;]+;?/gi,"").replace(/^;\s*|;\s*$/g,"").trim();return n?` style="${n}"`:""}),n="";for(let e=0;e<20&&n!==t;e++)n=t,t=t.replace(/<font(\s[^>]*)?>([\s\S]*?)<\/font>/gi,"$2");return t}(e.trim());const u=/^<span(?:\s[^>]*)?>([\s\S]*)<\/span>$/i.exec(d.trim()),p=/^<div(?:\s[^>]*)?>([\s\S]*)<\/div>$/i.exec(d.trim());return u?d=u[1]:p&&(d=p[1]),`<span style="${c}">${d}</span>`}function Nt(){return"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function Lt(e){if(!e||"object"!=typeof e)return;e.id||(e.id=Nt());const t=e.children;Array.isArray(t)&&t.forEach(Lt)}function Tt(e){if(!e||"object"!=typeof e)return;e.id=Nt();const t=e.children;Array.isArray(t)&&t.forEach(Tt)}function Bt(e){if(!e||"object"!=typeof e)return e;const t=xt(e);return Tt(t),t}const At=[{key:"facebook",image:ft("facebook"),title:"Facebook"},{key:"twitter",image:ft("twitter"),title:"X"},{key:"instagram",image:ft("instagram"),title:"Instagram"},{key:"linkedin",image:ft("linkedin"),title:"LinkedIn"},{key:"tiktok",image:ft("tiktok"),title:"TikTok"},{key:"youtube",image:ft("youtube"),title:"YouTube"}];function It(e){const t=e?.socialPlatformKey;if(t&&"string"==typeof t&&At.some(e=>e.key===t))return t;if(at(e))return"twitter";const n=String(e?.title??"").trim().toLowerCase(),o=String(e?.image??"").trim();for(const e of At){if(n&&n===e.title.toLowerCase())return e.key;if("twitter"===e.key&&n&&("twitter"===n||"tweet"===n||"tw"===n))return"twitter";if(o&&o===e.image)return e.key}return null}function $t(e,t){const n=t&&"object"==typeof t&&!Array.isArray(t)?t:{},o=Array.isArray(e)?e:[],l=new Map,a=[];for(const e of o){const t=It(e);t?l.set(t,e):a.push(e)}return[...At.map(e=>{const t=l.get(e.key),o=null!=n[e.key]?et(String(n[e.key]).trim()):"",a=null!=t?.linkURL?String(t.linkURL).trim():"",i=a?et(a):"",r=o||i||"";return{id:t?.id??Nt(),image:t?.image||e.image,title:t?.title||e.title,linkURL:r,socialPlatformKey:e.key}}),...a]}const Pt=[{label:"Link 1",url:"#",target:"_blank"},{label:"Link 2",url:"#",target:"_blank"},{label:"Link 3",url:"#",target:"_blank"}];function Rt(e,t){if(!e)return e;const n=t&&"object"==typeof t?t:{},o=n?.companyContext?.navigation_links,l=Array.isArray(o)&&o.length>0,a=n?.companyContext?.social_links,i=Object.values(e).some(e=>e&&"menu"===e.key&&!1!==e.useNavigationLinks),r=Object.values(e).some(e=>e&&"social_link"===e.key),s=Object.values(e).some(e=>e&&"column"===e.key&&"footer"===e.containerType&&e.footerUnifiedLayout&&!1!==e.footerUseCompanySocial);if(!i&&!r&&!s)return e;const c={...e};let d=!1;return Object.keys(e).forEach(t=>{const n=e[t];if(n){if("menu"===n.key&&!1!==n.useNavigationLinks){const e=l?o.map(e=>function(e){if(!e||"object"!=typeof e)return{label:"Link",url:"#",target:"_self"};const t=e.label??e.name??e.title??"Link",n="string"==typeof t?t:null!=t?String(t):"Link",o=e.url??e.href??e.link??e.uri??"";return{label:n||"Link",url:("string"==typeof o?o.trim():null!=o?String(o).trim():"")||"#",target:"_blank"===e.target||"_self"===e.target?e.target:"_self"}}(e)):Pt;c[t]={...n,list:e},d=!0}if("social_link"===n.key&&!1!==n.useCompanySocialLinks){const e=$t(n.list??[],a??{}),o={...n,list:e};JSON.stringify({...n,list:n.list??[]})!==JSON.stringify(o)&&(c[t]=o,d=!0)}if("column"===n.key&&"footer"===n.containerType&&n.footerUnifiedLayout&&!1!==n.footerUseCompanySocial){const e=function(e,t){return $t(e,t)}(n.footerSocialList??[],a??{});JSON.stringify(n.footerSocialList??[])!==JSON.stringify(e)&&(c[t]={...n,footerSocialList:e},d=!0)}}}),d?c:e}const Mt=280,Dt=1200,Ut={EMAIL_WIDTH:"email_width",CUSTOM_PX:"custom_px",FULL_BLEED:"full_bleed"};function Et(e){const t=Math.round(Number(e));return!Number.isFinite(t)||t<=0?600:Math.min(Dt,Math.max(Mt,t))}function zt(e){const t=e?.contentWidthMode;return Object.values(Ut).includes(t)?t:Ut.EMAIL_WIDTH}function Ft(e){return Et(e?.contentWidth)}function Ot(e){return zt(e)===Ut.FULL_BLEED}function Wt(e="Drag block here",t){return{id:t||Nt(),name:e,key:"empty",width:"100%",styles:{desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0},mobile:{}}}}function jt(e){const t={},n=[];function o(e){if(e&&"object"==typeof e)if(e.id||(e.id=Nt()),"column"===e.key){const n=(e.children||[]).map(e=>{e.id||(e.id=Nt());const t=[];return(e.children||[]).forEach(e=>{e.id||(e.id=Nt()),o(e),t.push(e.id)}),{id:e.id,width:e.width,styles:e.styles,childrenIds:t}}),{children:l,...a}=e;t[e.id]={...a,cells:n}}else t[e.id]=e}return(e||[]).forEach(e=>{e.id||(e.id=Nt()),o(e),n.push(e.id)}),{blockMap:t,rootOrder:n}}function Ht(e,t){function n(t){const o=e[t];if(!o)return null;if("column"===o.key){const e=(o.cells||[]).map(e=>({id:e.id,name:"Content",key:"content",width:e.width,styles:e.styles,children:(e.childrenIds||[]).map(e=>n(e)).filter(Boolean)})),{cells:t,...l}=o;return{...l,children:e}}return{...o}}return(t||[]).map(e=>n(e)).filter(Boolean)}function Kt(e,t){const n=t[e];if(!n)return null;if("column"!==n.key)return n;const o=(n.cells||[]).map(e=>({id:e.id,name:"Content",key:"content",width:e.width,styles:e.styles,children:(e.childrenIds||[]).map(e=>{const n=t[e];return n?"column"===n.key?Kt(e,t):n:null}).filter(Boolean)})),{cells:l,...a}=n;return{...a,children:o}}function Vt(e,t,n){function o(t){const l=e[t];if(!l||"column"!==l.key)return null;for(let a=0;a<(l.cells||[]).length;a++){const i=l.cells[a];for(let l=0;l<(i.childrenIds||[]).length;l++){if(i.childrenIds[l]===n)return{containerId:t,cellIndex:a,itemIndex:l};const r=e[i.childrenIds[l]];if(r&&"column"===r.key){const e=o(i.childrenIds[l]);if(e)return e}}}return null}for(const e of t||[]){const t=o(e);if(t)return t}return null}function Gt(e,t,n){const o=(t||[]).indexOf(n);if(-1!==o){const t=e[n];return{containerBlock:t??null,containerType:t?.containerType??"none",cellIndex:0,isRoot:!0,rootIndex:o}}const l=Vt(e,t,n);if(!l)return{containerBlock:null,containerType:"none",cellIndex:0,isRoot:!1};const a=e[l.containerId];return{containerBlock:a??null,containerType:a?.containerType??"none",cellIndex:l.cellIndex,isRoot:!1}}function qt(e,t,n){const o=(t||[]).indexOf(n);if(-1!==o){const t=e[n];return[{containerBlock:t??null,containerType:t?.containerType??"none",cellIndex:0,isRoot:!0,rootIndex:o}]}function l(t,o=[]){const a=e[t];if(!a||"column"!==a.key)return null;for(let t=0;t<(a.cells||[]).length;t++){const i=a.cells[t];for(let r=0;r<(i.childrenIds||[]).length;r++){const s=i.childrenIds[r];if(s===n)return[{containerBlock:a,containerType:a?.containerType??"none",cellIndex:t,isRoot:!1},...o];const c=e[s];if(c&&"column"===c.key){const e=l(s,[{containerBlock:a,containerType:a?.containerType??"none",cellIndex:t,isRoot:!1},...o]);if(e)return e}}}return null}for(const e of t||[]){const t=l(e,[]);if(t)return t}return[]}function Jt(e,t,n){const o=qt(e,t,n),l=o.find(e=>e?.containerType&&"none"!==e.containerType)||o[0]||null,a=l?.cellIndex??0,i=l?.containerBlock??null,r=i?.columnProducts?.[a]??null,s=Array.isArray(i?.columnProducts)?i.columnProducts.find(e=>null!=e)??null:null;return{containerType:l?.containerType??"none",columnIndex:a,columnProduct:r??s,containerBlock:i,lineage:o}}function Yt(e,t,n,o,l){const a=e[t];if(!a)return e;const i=a.cells.map((e,t)=>{if(t!==n)return e;const a=[...e.childrenIds];return a[o]=l,{...e,childrenIds:a}});return{...e,[t]:{...a,cells:i}}}function Xt(e,t,n,o){const l=e[t];if(!l)return{blockMap:e,removedId:null};const a=l.cells[n];if(!a)return{blockMap:e,removedId:null};const i=a.childrenIds[o],r=[...a.childrenIds];r.splice(o,1);const s=l.cells.map((e,t)=>t===n?{...e,childrenIds:r}:e);return{blockMap:{...e,[t]:{...l,cells:s}},removedId:i}}function Zt(e,t,n,o,l){const a=e[t];if(!a)return e;const i=a.cells[n];if(!i)return e;const r=[...i.childrenIds];r.splice(o,0,l);const s=a.cells.map((e,t)=>t===n?{...e,childrenIds:r}:e);return{...e,[t]:{...a,cells:s}}}function Qt(e,t,n,o){if(!n||!e[n]||0===o)return null;const l=t.indexOf(n);if(-1!==l){const n=l+o;if(n<0||n>=t.length)return null;const a=[...t],[i]=a.splice(l,1);return a.splice(n,0,i),{nextMap:e,nextRootOrder:a}}const a=Vt(e,t,n);if(!a)return null;const{containerId:i,cellIndex:r,itemIndex:s}=a,c=e[i],d=[...c.cells[r].childrenIds],u=s+o;if(u<0||u>=d.length)return null;const[p]=d.splice(s,1);d.splice(u,0,p);const m=c.cells.map((e,t)=>t===r?{...e,childrenIds:d}:e);return{nextMap:{...e,[i]:{...c,cells:m}},nextRootOrder:t}}function en(e,t){const n={...e};return function e(t){const o=n[t];o&&("column"===o.key&&(o.cells||[]).forEach(t=>(t.childrenIds||[]).forEach(t=>e(t))),delete n[t])}(t),n}function tn(e,t={}){if(!e||"column"!==e.key||!Array.isArray(e.cells))return null;const n=(o=t)&&"object"==typeof o?Array.isArray(o)?o.reduce((e,t)=>(t&&"object"==typeof t&&t.id&&(e[t.id]=t),e),{}):{...o}:{};var o;const l=xt(e);delete l.children,delete l.blockMap,delete l.blockSnapshotMap;const a={...n,[l.id]:l};function i(e){e&&!a[e]&&(a[e]=Wt("…",e))}return function e(t){if(t&&"column"===t.key&&Array.isArray(t.cells))for(const n of t.cells)for(const t of n.childrenIds||[]){i(t);const n=a[t];n&&"column"===n.key&&e(n)}}(l),{blockMap:a,rootId:l.id}}function nn(e,t){if(!t)return{newBlockMap:e,rootId:null};if("column"===t.key){const n=Array.isArray(t.children)&&t.children.length>0;if(Array.isArray(t.cells)&&t.cells.length>0&&!n){const n=tn(t,t.blockMap||t.blockSnapshotMap||{});if(n?.blockMap&&n.rootId){const t=Ht(n.blockMap,[n.rootId])[0];if(t){const{blockMap:n,rootOrder:o}=jt([t]);return{newBlockMap:{...e,...n},rootId:o[0]??null}}}}const{blockMap:o,rootOrder:l}=jt([t]);return{newBlockMap:{...e,...o},rootId:l[0]??null}}return{newBlockMap:{...e,[t.id]:t},rootId:t.id}}const on="SET_BLOCK_LIST",ln="SET_BLOCKS",an="SET_IS_DRAG_START",rn="SET_ACTION_TYPE",sn="SET_PREVIEW_MODE",cn="SET_CURRENT_ITEM",dn="SET_BODY_SETTINGS",un="SET_FILL_PRODUCT_SLOTS",pn="SET_SELECTION_RANGE",mn="SET_TEXT_RANGE",gn="SET_LANGUAGE",hn="SET_LANGUAGE_LIBRARIES",yn="SET_TEMPLATE_VARIABLES",bn="UNDO",fn="REDO",_n=e=>({type:rn,actionType:e}),kn=e=>({type:cn,currentItem:e}),vn=(e,t={})=>({type:yn,templateData:e,skipUndo:Boolean(t.skipUndo)}),wn={},xn=[],Sn={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"}},Cn=!0,Nn={blockMap:wn,rootOrder:xn,blockList:[],isDragStart:!1,actionType:"firstRender",previewMode:"desktop",currentItem:null,bodySettings:Sn,fillProductSlots:Cn,selectionRange:null,textRange:null,language:"en",languageLibraries:{},templateData:null,undoStack:[],redoStack:[]},Ln=t();function Tn(e,t,n){const o=Rt(t,e.templateData),l=Ht(o,n);let{currentItem:a}=e;if(a?.id&&o[a.id]){const e=Kt(a.id,o);e&&e!==a.data&&(a={...a,data:e})}return{...e,blockMap:o,rootOrder:n,blockList:l,currentItem:a}}function Bn(e){return e?{...e,data:e.data&&"object"==typeof e.data?xt(e.data):e.data}:null}function An(e){return{blockMap:xt(e.blockMap||wn),rootOrder:[...e.rootOrder||xn],bodySettings:xt(e.bodySettings||Sn),fillProductSlots:void 0!==e.fillProductSlots?!1!==e.fillProductSlots:Cn,currentItem:Bn(e.currentItem),templateData:null==e.templateData?null:xt(e.templateData)}}function In(e){return JSON.stringify(e,(e,t)=>t&&"object"==typeof t&&!Array.isArray(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function $n(e,t){if(t)return e;const n=An(e),o=e.undoStack[e.undoStack.length-1];return o&&function(e,t){if(!e||!t)return!1;try{return In(e)===In(t)}catch{return!1}}(n,o)?e:{...e,undoStack:[...e.undoStack,n].slice(-50),redoStack:[]}}function Pn(e,t){const n=t.templateData,o=Rt(xt(t.blockMap||wn),n),l=[...t.rootOrder||xn],a=Ht(o,l);let i=Bn(t.currentItem);if(i?.id&&o[i.id]){const e=Kt(i.id,o);e&&(i={...i,data:e})}const r=xt(t.bodySettings||Sn);return{...e,blockMap:o,rootOrder:l,blockList:a,bodySettings:{...r,contentWidth:Et(r.contentWidth)},fillProductSlots:void 0!==t.fillProductSlots?!1!==t.fillProductSlots:Cn,currentItem:i,templateData:n}}function Rn(e,t){switch(t.type){case ln:return Tn($n(e,t.skipUndo),t.blockMap,t.rootOrder);case on:{const n=$n(e,t.skipUndo),{blockMap:o,rootOrder:l}=jt(t.blockList);return Tn(n,o,l)}case an:return{...e,isDragStart:t.isDragStart};case rn:return{...e,actionType:t.actionType};case sn:return{...e,previewMode:t.previewMode};case cn:{let n=t.currentItem;if(n?.id&&e.blockMap[n.id]){const t=Kt(n.id,e.blockMap);t&&(n={...n,data:t})}return{...e,currentItem:n}}case dn:{const n=$n(e,t.skipUndo),o={...n.bodySettings,...t.bodySettings};return{...n,bodySettings:{...o,contentWidth:Et(o.contentWidth)}}}case un:return{...$n(e,t.skipUndo),fillProductSlots:!1!==t.fillProductSlots};case pn:return{...e,selectionRange:t.selectionRange};case mn:return{...e,textRange:t.textRange};case gn:return{...e,language:t.language};case hn:return{...e,languageLibraries:t.languageLibraries};case yn:{const n=$n(e,t.skipUndo),o=t.templateData,l=Rt(n.blockMap,o),a=Ht(l,n.rootOrder);let{currentItem:i}=n;if(i?.id&&l[i.id]){const e=Kt(i.id,l);e&&(i={...i,data:e})}return{...n,templateData:o,blockMap:l,blockList:a,currentItem:i}}case bn:{if(!e.undoStack.length)return e;const t=e.undoStack[e.undoStack.length-1],n=e.undoStack.slice(0,-1),o=An(e),l=[...e.redoStack,o].slice(-50);return{...Pn(e,t),undoStack:n,redoStack:l,actionType:"undo"}}case fn:{if(!e.redoStack.length)return e;const t=e.redoStack[e.redoStack.length-1],n=e.redoStack.slice(0,-1),o=An(e),l=[...e.undoStack,o].slice(-50);return{...Pn(e,t),undoStack:l,redoStack:n,actionType:"redo"}}default:return e}}function Mn(e){if(null==e)return"";const t=String(e).trim();if(!t)return"";const n=t.toLowerCase();return"none"===n||"null"===n||"undefined"===n?"":t}var Dn={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 Un="CustomerName",En="DiscountValue",zn="DiscountCode",Fn="ValidUntil",On="CompanyName",Wn="Address",jn="Website",Hn="BrandName",Kn="LogoUrl",Vn="Tagline",Gn="HeroBanner",qn="FooterBanner",Jn="NavLabel",Yn="NavUrl",Xn="ProductName",Zn="ProductDescription",Qn="ProductImage",eo="ProductLink",to="ProductPrice",no="ProductCurrency",oo="ProductOldPrice",lo="ProductNewPrice",ao="ProductPriceDisplay",io="CTALabel",ro="CTAUrl",so=new Set([oo,lo]);function co(e){return`{{${e}}}`}const uo=Dn;let po=uo;function mo(e,t=po){return t&&Array.isArray(t[e])?t[e].map(e=>({...e,token:e.token||co(e.key)})):[]}let go=[],ho=[],yo=[],bo={},fo=[],_o=[],ko=[];function vo(){go=mo("global",po),ho=mo("product",po),yo=mo("discount",po),bo=[...go,...ho,...yo].reduce((e,t)=>(e[t.key]=t,e),{}),fo=yo.map(e=>({variableKey:e.key,labelKey:e.labelKey}));const e=ho.filter(e=>!so.has(e.key));_o=e.map(e=>({variableKey:e.key,labelKey:e.labelKey})),ko=go.map(e=>({value:e.token,label:e.label,key:e.key,labelKey:e.labelKey,source:e.source,type:e.type})),yo.map(e=>({value:e.token,label:e.label,key:e.key,labelKey:e.labelKey,source:e.source,type:e.type})),e.map(e=>({value:e.token,label:e.label,key:e.key,labelKey:e.labelKey,source:e.source,type:e.type}))}vo();const wo={[Un]:"User",[En]:"20%",[zn]:"SAVE20",[Fn]:"12-31-2025",[On]:"Company Name",[Hn]:"Company Name",[Wn]:"",[jn]:"www.example.com",[Kn]:"https://via.placeholder.com/150x50/ffffff/333333?text=Logo",[Vn]:"Your tagline here",[Gn]:"https://via.placeholder.com/600x200/eeeeee/666666?text=Hero",[qn]:"https://via.placeholder.com/600x100/eeeeee/666666?text=Footer",[Jn]:"Link",[Yn]:"https://www.example.com",[Xn]:"Product Name",[Zn]:"Product description goes here.",[Qn]:"https://via.placeholder.com/300x300/eeeeee/666666?text=Product",[eo]:"https://www.example.com",[to]:"0",[no]:"USD",[oo]:"0",[lo]:"0",[ao]:"$0.00 USD",[io]:"Shop Now",[ro]:"www.example.com"};function xo(e){return null==e||"string"!=typeof e?"":e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}const So=new Set([ao]);function Co(e,t,n={}){if(null==e||"string"!=typeof e)return"";const o=e.replace(/\{\{(\w+)\}\}/g,(e,o)=>{const l=$o(t,o,n);return So.has(o)?l:xo(l)});return null==(l=o)||"string"!=typeof l?l:l.replace(/^(<p[^>]*>\s*(?:<br\s*\/?>| )?\s*<\/p>\s*)+/i,"");var l}function No(e){return wo[e]??"—"}const Lo=/^\{\{\s*[\w.]+\s*\}\}$/;function To(e,t,{allowEmpty:n=!1}={}){if(null==e)return n?"":No(t);const o=String(e).trim();return""===o?n?"":No(t):function(e){return"string"==typeof e&&Lo.test(e.trim())}(o)?No(t):o}const Bo={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 Ao(e){return function(e){return"string"==typeof e&&/^[A-Za-z]{3}$/.test(e.trim())}(e)?String(e).trim().toUpperCase():"USD"}function Io(e,t){const n=function(e){if(null==e)return null;const t=String(e).replace(/,/g,"").trim();if(""===t)return null;const n=Number(t);return Number.isFinite(n)?n:null}(e);if(null==n)return null;const o=Ao(t),l=function(e){return Bo[e]??null}(o);if(!l)return null;const a=function(e){if(null==e)return 0;const t=String(e).trim().replace(/,/g,"");if(!t.includes("."))return 0;const[,n=""]=t.split(".");return Math.max(0,n.length)}(e);try{return`${new Intl.NumberFormat(l,{style:"currency",currency:o,minimumFractionDigits:a,maximumFractionDigits:a}).format(n)} ${o}`}catch{return null}}function $o(e,t,n={}){if(!e)return No(t);const{columnIndex:o,columnProduct:l}=n;let a=l;switch(!a&&e.content?.products&&"number"==typeof o&&(a=e.content.products[o]||null),t){case Un:return No(Un);case En:return To(e.content?.discount?.value,En);case zn:return To(e.content?.discount?.code,zn);case Fn:return To(e.content?.discount?.valid_until,Fn);case On:case Hn:return To(e.companyContext?.name,t);case Wn:return To(e.companyContext?.address,Wn,{allowEmpty:!0});case jn:return To(e.companyContext?.website,jn);case Kn:return To(e.brandContext?.logo_url,Kn);case Vn:return To(e.brandContext?.tagline,Vn);case Gn:return To(e.brandContext?.heroBanner,Gn);case qn:return To(e.brandContext?.footerBanner,qn);case Jn:case Yn:return No(t);case Xn:return To(a?.name,Xn);case Zn:{const e=Mn(a?.description);return e?To(e,Zn,{allowEmpty:!0}):""}case Qn:return To(a?.image,Qn);case eo:return To(a?.link,eo);case to:return null!=a?.price&&"number"==typeof a.price||null!=a?.price&&"string"==typeof a.price?String(a.price):null!=a?.new_price?String(a.new_price):No(to);case no:return To(a?.currency,no);case oo:return To(a?.old_price,oo);case lo:return null!=a?.new_price?To(a.new_price,lo):null!=a?.price?To(a.price,lo):No(lo);case ao:{const e=Ao(a?.currency),t=null!=a?.price?a.price:a?.new_price,n=null!=a?.old_price||null!=a?.new_price,o=null!=a?.old_price?a.old_price:null,l=null!=a?.new_price?a.new_price:null!=a?.price?a.price:null;if(n&&(null!=o||null!=l)){const t=Io(o,e),n=Io(l,e),a=null!=(null!=t?t:null!=o?String(o):null)?xo(null!=t?t:null!=o?String(o):""):"";return[""!==a?`<span style="text-decoration: line-through;">${a}</span>`:"",null!=(null!=n?n:null!=l?String(l):null)?xo(null!=n?n:null!=l?String(l):""):""].filter(Boolean).join(" ")||No(ao)}const i=Io(t,e);return null!=i?xo(i):null!=t?xo(String(t)):No(ao)}case io:{const t=e.content?.cta?.text;return To(t,io)}case ro:{const t=e.content?.cta?.url;return To(null!=t?t:e.companyContext?.website,ro)}default:return No(t)}}const Po=[{variableKey:Kn,labelKey:"variable_image_logo"},{variableKey:Gn,labelKey:"variable_image_hero_banner"},{variableKey:qn,labelKey:"variable_image_footer_banner"}],Ro=[{variableKey:Qn,labelKey:"variable_image_product_image"}],Mo=[{variableKey:io,labelKey:"variable_cta_label"}],Do=[{variableKey:ro,labelKey:"variable_cta_url"}],Uo=[{variableKey:eo,labelKey:"variable_product_link"},{variableKey:jn,labelKey:"variable_website"}];function Eo(e,t,n,o={}){let l=[];return"discount"===t?l=[...fo]:"product"===t&&(l=[..._o]),l.map(({variableKey:e,labelKey:t})=>({...bo[e]||{},variableKey:e,labelKey:t,value:co(e),pasteValue:$o(n,e,o)}))}function zo(e,t,n,o={},l=[]){const a="none"===t?ko.map(e=>({...e,pasteValue:$o(n,e.key,o)})):Eo(0,t,n,o),i=(l||[]).filter(e=>e&&e.containerType&&"none"!==e.containerType).flatMap(e=>Eo(0,e.containerType,n,e.context||{})),r=new Set,s=[];return[...a,...i].forEach(e=>{const t=e.variableKey||e.key||e.value;t&&!r.has(t)&&(r.add(t),s.push(e))}),s}const Fo={display_text:"DisplayText",introduction:"Introduction",heading:"Heading",subheading:"Subheading",products_description:"ProductDescription"};function Oo(e,t,n,o){return{value:co(e),labelKey:t,variableKey:e,key:e,type:"image",pasteValue:$o(n,e,o)}}function Wo(e,t,n={}){const o=Po.map(({variableKey:e,labelKey:o})=>Oo(e,o,t,n));if("product"===e){const e=Ro.map(({variableKey:e,labelKey:o})=>Oo(e,o,t,n));return[...o,...e]}return o}function jo(e){return!1!==e?.linkEnabled}function Ho(e,t,n={}){if(!e||!t)return e;const{useImportant:o=!1}=n,l=String(t).trim();if(!l)return e;const a=o?`color: ${l} !important`:`color: ${l}`;return String(e).replace(/<a\b([^>]*)>/gi,(e,t)=>{const n=t.match(/\sstyle\s*=\s*"([^"]*)"/i);if(n){const e=(n[1]||"").replace(/\s*color\s*:\s*[^;]+(!important)?\s*;?/gi,"").replace(/;\s*;/g,";").replace(/^\s*;|;\s*$/g,"").trim(),o=`${e?`${e}; `:""}${a};`;return`<a${t.replace(n[0],` style="${o}"`)}>`}const o=t.match(/\sstyle\s*=\s*'([^']*)'/i);if(o){const e=(o[1]||"").replace(/\s*color\s*:\s*[^;]+(!important)?\s*;?/gi,"").replace(/;\s*;/g,";").replace(/^\s*;|;\s*$/g,"").trim(),n=`${e?`${e}; `:""}${a};`;return`<a${t.replace(o[0],` style='${n}'`)}>`}return`<a${t} style="${a};">`})}const Ko=[{name:"Sans Serif (Generic)",stack:"sans-serif"},{name:"Overused Grotesk",stack:"'Overused Grotesk', ui-sans-serif, system-ui, sans-serif"},{name:"Arial",stack:"Arial, Helvetica, sans-serif"},{name:"Helvetica",stack:"Helvetica, Arial, sans-serif"},{name:"Georgia",stack:"Georgia, Times New Roman, serif"},{name:"Times New Roman",stack:"'Times New Roman', Times, serif"},{name:"Verdana",stack:"Verdana, Geneva, sans-serif"},{name:"Tahoma",stack:"Tahoma, Geneva, sans-serif"},{name:"Trebuchet MS",stack:"'Trebuchet MS', Helvetica, Arial, sans-serif"},{name:"Courier New",stack:"'Courier New', Courier, monospace"},{name:"Palatino",stack:"'Palatino Linotype', Palatino, serif"},{name:"Garamond",stack:"Garamond, 'Times New Roman', serif"},{name:"Lucida",stack:"'Lucida Sans Unicode', 'Lucida Grande', sans-serif"}],Vo=[{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"}],Go=e=>/\s/.test(String(e||""))?`'${String(e).replace(/'/g,"\\'")}'`:String(e);function qo(e){return`https://fonts.googleapis.com/css2?family=${(e=>String(e).trim().replace(/\s+/g,"+"))(e)}:wght@400;700&display=swap`}function Jo(e){const t=e?.brandContext?.customFonts;return Array.isArray(t)?t.filter(e=>e&&"object"==typeof e&&e.name&&e.url).map(e=>({label:`${e.name} (Brand Kit)`,value:`${Go(e.name)}, Arial, sans-serif`,primaryName:String(e.name),source:"custom",url:String(e.url),format:e.format?String(e.format):void 0,weight:null!=e.weight?String(e.weight):void 0,style:e.style?String(e.style):void 0})):[]}function Yo(e){return[...Ko.map(e=>({label:e.name,value:e.stack,primaryName:e.name,source:"system"})),...Vo.map(e=>({label:`${e.name} (Google)`,value:`${Go(e.name)}, ${e.fallback}`,primaryName:e.name,source:"google"})),...Jo(e)]}function Xo(e){if(!e)return"";const t=String(e).split(",")[0];return String(t??"").trim().replace(/^['"]|['"]$/g,"")}function Zo(e,t){const n=Yo(t),o=Xo(e).toLowerCase(),l=n.find(e=>e.primaryName.toLowerCase()===o);return l?l.value:e}function Qo(e,t){const n=Yo(t),o=Zo(e,t),l=Xo(o).toLowerCase(),a=n.find(e=>e.primaryName.toLowerCase()===l||e.value===o);return a?a.label:"sans-serif"===l?"Sans Serif (Generic)":o}function el(e){const t=String(e.name||"").trim(),n=String(e.url||"").trim();if(!t||!n)return"";const o=e.format?` format('${e.format}')`:"",l=e.weight?`font-weight:${e.weight};`:"",a=e.style?`font-style:${e.style};`:"";return`@font-face{font-family:${Go(t)};src:url('${n}')${o};${l}${a}}`}function tl(e,t,n){const o=function(e,t){const n=new Set,o=e=>{null!=e&&""!==String(e).trim()&&n.add(String(e).trim())};o(t?.styles?.fontFamily);const l=e=>{Array.isArray(e)&&e.forEach(e=>{e&&"object"==typeof e&&(o(e?.styles?.desktop?.fontFamily),o(e?.styles?.mobile?.fontFamily),"image"===e.key&&Array.isArray(e.overlayItems)&&e.overlayItems.forEach(e=>{e&&"object"==typeof e&&o(e.fontFamily)}),Array.isArray(e.children)&&l(e.children))})};return l(e),[...n]}(e,t),l=new Set;o.forEach(e=>{const t=function(e){const t=Xo(e),n=Vo.find(e=>e.name.toLowerCase()===t.toLowerCase());return n?qo(n.name):null}(e);t&&l.add(t)});const a=(Array.isArray(n?.brandContext?.customFonts)?n.brandContext.customFonts:[]).map(el).filter(Boolean);return[...[...l].map(e=>`@import url('${e}');`),...a].join("\n")}const nl="ee_cb";function ol(e){const t=String(e??"").trim();if(!t)return t;if(/^\{\{/u.test(t)||/^data:/iu.test(t))return t;try{const e="undefined"!=typeof window&&window.location?.origin?window.location.origin:"http://localhost",n=new URL(t,e);return n.searchParams.set(nl,String(Date.now())),n.toString()}catch{const e=t.includes("?")?"&":"?";return`${t}${e}${nl}=${Date.now()}`}}function ll(e){const t=String(e??"").trim();if(!t)return t;try{const e="undefined"!=typeof window&&window.location?.origin?window.location.origin:"http://localhost",n=new URL(t,e);n.searchParams.delete(nl);let o=n.toString();return o.endsWith("?")&&(o=o.slice(0,-1)),o}catch{return t.replace(new RegExp(`[?&]${nl}=\\d+`,"g"),"").replace(/\?&/g,"?").replace(/&&+/g,"&").replace(/[?&]$/,"")}}const al=[{value:"cover",labelKey:"container_bg_size_cover"},{value:"contain",labelKey:"container_bg_size_contain"},{value:"fill",labelKey:"container_bg_size_fill"}],il=["left top","center top","right top","left center","center center","right center","left bottom","center bottom","right bottom"];function rl(e){return String(e??"").trim().replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"").replace(/\r/g,"")}function sl(e,t){const n=e?.containerBackgroundEnabled,o=e?.containerBackgroundImage,l=o&&String(o).trim();if(!1===n||!l)return{background:t};const a={cover:"cover",contain:"contain",fill:"100% 100%"}[e?.containerBackgroundSize||"cover"]||"cover",i=e?.containerBackgroundPosition||"center center";return{backgroundColor:t,backgroundImage:`url("${rl(l)}")`,backgroundSize:a,backgroundPosition:i,backgroundRepeat:"no-repeat"}}const cl=["tl","tc","tr","ml","mc","mr","bl","bc","br"],dl={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 ul(e){const t=String(e??"bc").toLowerCase();return cl.includes(t)?t:"bc"}function pl(e){const t=ul(e);return dl[t]}function ml(e,t){const n="string"==typeof t?t.trim():"";if(n)return n;const o=function(e){if(!e||"string"!=typeof e)return null;const t=e.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 e of n){const n=t.match(e);if(n?.[1])return n[1]}return null}(e||"");return o?`https://img.youtube.com/vi/${o}/hqdefault.jpg`:""}function gl(e){const t=null!=e?String(e).trim():"";return t&&"transparent"!==t.toLowerCase()?t:"#ffffff"}const hl=e=>null==e||""===String(e).trim();function yl(e,t){const n="string"==typeof e?e.trim():String(e??"").trim();if(!n)return"";const o=/^\{\{(\w+)\}\}$/.exec(n);if(o&&t){const e=$o(t,o[1],{});if(null!=e&&""!==String(e).trim()&&!String(e).startsWith("{{"))return String(e).trim()}return n}function bl(e,t){if(null==e||""===e)return"";const n=String(e);return t?n.replace(/\{\{(\w+)\}\}/g,(e,n)=>{const o=$o(t,n,{});if(null==o)return`{{${n}}}`;const l=String(o);return l.startsWith("{{")?`{{${n}}}`:l}):n}function fl(e,t){if(null==e||""===e)return"";const n=String(e);return t?n.replace(/\{\{(\w+)\}\}/g,(e,n)=>{const o=$o(t,n,{}),l=null!=o?String(o).trim():"";return!l||"—"===l||l.startsWith("{{")?e:l}):n}const _l=()=>[{id:Nt(),label:"Privacy",url:"#",target:"_self"},{id:Nt(),label:"Terms",url:"#",target:"_self"}],kl="You are receiving this email because you subscribed.";function vl(e){let t=null!=e?.unsubscribeLinkLabel&&""!==String(e.unsubscribeLinkLabel).trim()?String(e.unsubscribeLinkLabel).trim():"";const n=String(e?.unsubscribeText??"").trim();if(!t&&n){const e=n.split(/\s*[·•]\s*/);t=e[0]?.trim()||""}return{unsubscribeLinkLabel:t||"Unsubscribe"}}function wl(e){return(Array.isArray(e)&&0!==e.length?e:$t([],{})).map(e=>({id:e?.id,image:e?.image??"",title:e?.title??"",linkURL:e?.linkURL??"",socialPlatformKey:e?.socialPlatformKey}))}function xl(e){return Array.isArray(e)&&0!==e.length?e.map(e=>({id:e?.id,label:e?.label??"",url:e?.url??"",target:"_blank"===e?.target?"_blank":"_self"})):_l()}const Sl=e=>String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),Cl=(e,t)=>{if(null==e||""===e)return t;if("number"==typeof e)return e;const n=parseInt(String(e).replace(/px/gi,""),10);return Number.isFinite(n)?n:t};const Nl="#111827";function Ll(e){if(null==e)return"";const t=String(e).trim().toLowerCase();return/^#[0-9a-f]{3}$/.test(t)?`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`:t}function Tl(e){return Ll(e)===Ll("#263d2d")}function Bl(e){if(null==e||"object"!=typeof e)return"#111111";const t=e.brandContext,n=t&&"object"==typeof t?t.brand_color??t.brandColor??null:null,o=e.brandColor,l=("string"==typeof n&&""!==n.trim()?n:"string"==typeof o&&""!==o.trim()?o:null)??"#111111",a=String(l).trim();return""!==a?a:"#111111"}const Al=new Set(["fontWeight","opacity","zIndex"]),Il=e=>String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),$l=e=>Il(e).replace(/"/g,""").replace(/'/g,"'"),Pl=(e,t="#")=>{if(null==e)return t;const n=String(e).trim();if(!n)return t;const o=n.toLowerCase();return/^\s*(?:javascript|vbscript):/i.test(o)||/^\s*data:/i.test(o)?t:/^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(/^\/+/,"")}`},Rl=(e,t)=>{const n=new RegExp(/[A-Z]/g),o=e=>e.replace(n,e=>`-${e.toLowerCase()}`),l={desktop:t?.desktop??{},mobile:t?.mobile??{}};let a={className:e,desktop:"",mobile:""};for(let e of Object.entries(l.desktop))if(e[1]&&"contentBackground"!==e[0]&&"horizontalAlign"!==e[0]&&"containerBackgroundImage"!==e[0]&&"containerBackgroundSize"!==e[0]&&"containerBackgroundPosition"!==e[0]){const t="number"!=typeof e[1]||Al.has(e[0])?e[1]:e[1]+"px";a.desktop+=`${o(e[0])}:${t};`}if(Object.keys(l.mobile).length){let t="";for(let e of Object.entries(l.mobile))if(e[1]&&"contentBackground"!==e[0]&&"horizontalAlign"!==e[0]&&"containerBackgroundImage"!==e[0]&&"containerBackgroundSize"!==e[0]&&"containerBackgroundPosition"!==e[0]){const n="number"!=typeof e[1]||Al.has(e[0])?e[1]:e[1]+"px";t+=`${o(e[0])}:${n} !important;`}a.mobile+=`@media(max-width:620px){\n .${e} {\n ${t}\n }\n }`}return a};function Ml(e){if(!e||"object"!=typeof e)return{};const{marginLeft:t,marginTop:n,...o}=e;return o}function Dl(e){const t=st(e||{}),{linkColor:n,color:o,...l}=t,a=null!=n&&""!==String(n).trim()?String(n).trim():null,i=null!=o&&""!==String(o).trim()?String(o).trim():null,r=a??i;return null==r?l:{...l,color:r}}const Ul=(e,t="",n=null)=>{const o=e.map((e,o)=>{let l={...e};const a=null!==n?`${n}-${o}`:`${o}`,i=e=>`e${a}-${e}`,r={desktop:e?.styles?.desktop??{},mobile:e?.styles?.mobile??{}},s="menu"===e.key?{desktop:Dl(r.desktop),mobile:Dl(r.mobile)}:"social_link"===e.key?{desktop:st(r.desktop),mobile:st(r.mobile)}:r;if(l.styleConfig=Rl(i(e.key),s),l.contentStyles){const n={desktop:l.contentStyles?.desktop??{},mobile:l.contentStyles?.mobile??{}};let o=n;if(l.imageHostMarginStyleConfig=null,"image"===l.key){o={desktop:Ml(n.desktop),mobile:Ml(n.mobile)};const a={desktop:(n.desktop,{}),mobile:(n.mobile,{})};if(Object.keys(a.desktop).length||Object.keys(a.mobile).length){const n=Rl(i(`${e.key}-hm`),a);l.imageHostMarginStyleConfig=n,n.mobile&&(t+=n.mobile)}}l.contentStyleConfig=Rl(i(`${e.key}-c`),o),l.contentStyleConfig.mobile&&(t+=l.contentStyleConfig.mobile)}if("video"===l.key&&l.videoArea){const n={desktop:l.videoArea?.desktop??{},mobile:l.videoArea?.mobile??{}};l.videoAreaStyleConfig=Rl(i(`${e.key}-va`),n),l.videoAreaStyleConfig.mobile&&(t+=l.videoAreaStyleConfig.mobile)}if(l.styleConfig.mobile&&(t+=l.styleConfig.mobile),e.hiddenOnMobile){const e=`@media(max-width:620px){.${l.styleConfig.className}{display:none !important;}}`;t+=e,l.styleConfig={...l.styleConfig,mobile:(l.styleConfig.mobile||"")+e}}if(s.desktop.contentBackground&&(l.contentStyleConfig||(l.contentStyleConfig={className:i(`${e.key}-c`),desktop:"",mobile:""}),l.contentStyleConfig.desktop+=`background-color:${s.desktop.contentBackground};`),s.mobile.contentBackground){l.contentStyleConfig||(l.contentStyleConfig={className:i(`${e.key}-c`),desktop:"",mobile:""});const n=`@media(max-width:620px){.${l.contentStyleConfig.className}{background-color:${s.mobile.contentBackground};}}`;l.contentStyleConfig.mobile=(l.contentStyleConfig.mobile||"")+n,t+=n}if("menu"===l.key){if("stack"===(e.mobileLayout??"inline")){const n=l.contentStyleConfig?.className??i(`${e.key}-c`);l.contentStyleConfig||(l.contentStyleConfig={className:n,desktop:"",mobile:""});const o=l.contentStyles?.desktop?.textAlign??l.contentStyles?.mobile?.textAlign??"center",a=String(o).toLowerCase(),r="left"===a?"flex-start":"right"===a?"flex-end":"center",s=["left","right","center","justify"].includes(a)?a:"center",c=e.linkGapPx,d=`@media(max-width:620px){\n.${n}{display:flex !important;flex-direction:column !important;align-items:${r} !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}`;l.contentStyleConfig.mobile=(l.contentStyleConfig.mobile||"")+d,t+=d}}if(e.children?.length){const{newBlockList:n,styles:o}=Ul(e.children,"",a);t+=o,l.children=n}return{...l}});return{newBlockList:o,styles:t}};function El(e){const t=e.contentStyleConfig?.desktop??"",n=function(e){const t=e.contentStyles?.desktop??{},n=e.contentStyles?.mobile??{},o=null!=t.textAlign&&""!==String(t.textAlign).trim()?t.textAlign:n.textAlign,l=null!=o&&""!==String(o).trim()?String(o).trim():"center";return"start"===l?"left":"end"===l?"right":l}(e);return/\btext-align\s*:/i.test(t)?t:`${t}text-align:${n};`}const zl="#2faade";function Fl(e){const t=String(e??"");return null!=(n=t)&&"string"==typeof n&&/<[a-zA-Z!/?]/.test(n.trim())?function(e){if(!e||!/<a\b/i.test(e))return e;const t=(e,t,n)=>{const o=(t[1]||"").replace(/\s*text-decoration(-line)?\s*:[^;]+;?/gi,"").replace(/^\s*;|;\s*$/g,"").trim(),l=(o?`${o}; `:"")+"text-decoration: none;",a='"'===n?` style="${l}"`:` style='${l}'`;return`<a${e.replace(t[0],a)}>`};return String(e).replace(/<a\b([^>]*)>/gi,(e,n)=>{const o=n.match(/\sstyle\s*=\s*"([^"]*)"/i);if(o)return t(n,o,'"');const l=n.match(/\sstyle\s*=\s*'([^']*)'/i);return l?t(n,l,"'"):`<a${n} style="text-decoration: none;">`})}(t):Il(t);var n}function Ol(e){const t=e?.dynamicSelectedContent,n=e?.text??"";if(null==t)return String(n);const o=String(t);return""===o.trim()?String(n):o}const Wl=(e,t,n={})=>{let o=Ol(e);t&&o&&(o=Co(o,t,n));const l=e?.styles?.desktop??{},a=null!=l.linkColor&&""!==String(l.linkColor).trim();return o=Ho(o,a?String(l.linkColor).trim():zl,{useImportant:a}),`<${e.type} ${e.styleConfig?.mobile?`class="${e.styleConfig.className}"`:""} \n style="${e.styleConfig?.desktop||""}">\n ${o}\n </${e.type}>`};const jl=(e,t,n={},o=null)=>{let l=e.text||"",a=e.linkURL||"";if(t){const o=l.match(/\{\{(\w+)\}\}/),i=e.labelVariable?e.labelVariable.replace(/^\{\{|\}\}$/g,"").trim():o?o[1]:void 0;if(i){const e=$o(t,i,n);null==e||String(e).startsWith("{{")||(l=String(e))}if(e.urlVariable){const o=$o(t,e.urlVariable.replace(/^\{\{|\}\}$/g,""),n);o&&!o.startsWith("{{")&&(a=String(o))}else{const e=String(a||"").trim().match(/^\{\{(\w+)\}\}$/);if(e){const o=$o(t,e[1],n);o&&!String(o).startsWith("{{")&&(a=String(o))}}}const i=Fl(l),r=$l(Pl(a)),s=Bl(t);let c=e.styleConfig.desktop||"";!function(e,t){if(!function(e){return!(!e||"column"!==e.key||"product"!==e.containerType)&&"additional"!==e.productRole&&("image_left"===e.mainProductLayout||"image_stacked"!==e.mainProductLayout&&function(e){const t=e?.children?.[0]?.children?.[0];return"column"===t?.key&&"2-3"===t?.type}(e))}(t))return!1;const n=e.styles?.desktop?.backgroundColor;return null==n||""===String(n).trim()||Ll(n)===Ll(Nl)}(e,o)?Tl(e.styles?.desktop?.backgroundColor)&&(c=c.replace(/background-color:\s*[^;]+;?/gi,"")):c=c.replace(/background-color:\s*[^;]+;?/gi,"");const d=c.includes("background-color:")?"":`background-color:${s};`,u=c.includes("box-sizing")?"":"box-sizing:border-box;";return`<div ${e.contentStyleConfig.mobile?`class="${e.contentStyleConfig.className}"`:""}\n style="${e.contentStyleConfig.desktop}">\n <a ${e.styleConfig.mobile?`class="${e.styleConfig.className}"`:""}\n style="${c}${d}${u}text-align:center;text-decoration:none;" target="_blank" rel="noopener noreferrer" href="${r}">${i}</a>\n </div>`};const Hl=(e,t,n,o,l,a)=>{let i="";const r={columnIndex:l??0,columnProduct:o?.columnProducts?.[a??0]??null};return e.forEach((e,s)=>{if("column"===e.key){const r=function(e){const t={...e?.desktop??{}},n=e?.mobile??{},o=String(t.containerBackgroundImage??"").trim(),l=String(n.containerBackgroundImage??"").trim();!o&&l&&(t.containerBackgroundImage=n.containerBackgroundImage,null!=n.containerBackgroundSize&&(t.containerBackgroundSize=n.containerBackgroundSize),null!=n.containerBackgroundPosition&&(t.containerBackgroundPosition=n.containerBackgroundPosition),void 0!==n.containerBackgroundEnabled&&(t.containerBackgroundEnabled=n.containerBackgroundEnabled));const a=t.minHeight,i=n.minHeight;return null!=a&&""!==String(a).trim()||null==i||""===String(i).trim()||(t.minHeight=i),t}(e.styles),c=e.styles?.desktop?.borderRadius,d=c?`border-radius:${"number"==typeof c?c+"px":c};`:"",u=d?"overflow:hidden;":"",p=function(e){const t=e??{};if(!1===t.containerBackgroundEnabled)return"";const n=ll(t.containerBackgroundImage);return n&&String(n).trim()?`background-image:url("${rl(n)}");background-size:${{cover:"cover",contain:"contain",fill:"100% 100%"}[t.containerBackgroundSize||"cover"]||"cover"};background-position:${t.containerBackgroundPosition||"center center"};background-repeat:no-repeat;`:""}(r),m=function(e){if(null==e)return"";if("number"==typeof e&&Number.isFinite(e))return`min-height:${e}px;`;const t=String(e).trim();return t?/^\d+$/.test(t)?`min-height:${t}px;`:`min-height:${t};`:""}(r.minHeight),g=String(r.contentBackground??"").trim(),h=g&&"transparent"!==g.toLowerCase()?`background-color:${g};`:"",y=void 0!==a,b=Ot(t)||y?"100%":`${Ft(t)}px`,f=e.containerType&&"none"!==e.containerType?e:o,_=e.containerType&&"none"!==e.containerType?s:l,k=e.containerType&&"none"!==e.containerType?0:a,v="footer"===e.containerType&&e.footerUnifiedLayout?function(e,t,n){const o=e,l=o.styles?.desktop??{},a=Boolean(o.showBrand??!0),i=Boolean(o.showTagline??!0),r=Boolean(o.footerShowLogo??!1),s=yl(o.footerLogoSrc??"",n),c=bl(String(o.footerLogoAlt??"Logo").trim()||"Logo",n).trim()||"Logo",d=o.footerLogoLink??"",u=Cl(o.footerLogoMaxWidthPercent,30),p=Cl(o.footerLogoPaddingPx,24),m=Boolean(o.showAddress??!0),g=Boolean(o.showUnsubscribe??!0),h=Boolean(o.showSocial??!1),y=Boolean(o.showSecondaryLinks??!1),b=Boolean(o.showCopyright??!0),f=bl(o.brandName??"",n),_=bl(o.brandTagline??"",n).trim(),k=bl(o.address??"",n),v=bl(o.copyrightText??"",n),w=o.unsubscribeUrl||"{{unsubscribe_url}}",x=null!=o.unsubscribeBodyText&&""!==String(o.unsubscribeBodyText).trim()?String(o.unsubscribeBodyText):kl,{unsubscribeLinkLabel:S}=vl(o),C=xl(o.secondaryLinks),N=wl(o.footerSocialList),L=l.color??"#737373",T=null!=l.linkColor&&""!==String(l.linkColor).trim()?String(l.linkColor).trim():L,B=Cl(l.fontSize,12),A=l.textAlign??"center",I=Cl(l.paddingTop,28),$=Cl(l.paddingRight,24),P=Cl(l.paddingBottom,28),R=Cl(l.paddingLeft,24),M=gl(l.contentBackground),D=Boolean(o.showDivider??!1),U=Sl(o.dividerColor??"#374151"),E=Boolean(o.showBorderTop??!1),z=Cl(o.borderTopWidth,1),F=o.borderTopStyle??"solid",O=Sl(o.borderTopColor??"#e5e7eb"),W=E&&z>0?`${z}px ${F} ${O}`:"",j=t?.width??"100%",H=t?.styleConfig?.mobile?` class="${t.styleConfig.className}"`:"",K=t?.styleConfig?.desktop??"",V=`margin:0;color:${Sl(L)};font-size:${B}px;line-height:1.5;font-family:Arial,sans-serif;text-align:${Sl(A)};`,G=`color:${Sl(T)};text-decoration:underline;`,q=[];let J="";if(D&&(J+=`<div style="border-top:1px solid ${U};margin-bottom:14px;width:100%;font-size:0;line-height:0;"> </div>`),r&&s.trim()){const e="left"===A?"left":"right"===A?"right":"center",t=`<img src="${Sl(s)}" alt="${Sl(c)}" width="570" style="max-width:${u}%;height:auto;display:inline-block;padding:${p}px;vertical-align:middle;border:0;outline:none;text-decoration:none;"/>`,o=nt(fl(d,n)),l=o?`<a href="${Sl(o)}" target="_blank" rel="noopener noreferrer" style="text-decoration:none;line-height:0;display:inline-block;">${t}</a>`:t;J+=`<div style="text-align:${Sl(e)};margin-bottom:10px;line-height:0;">${l}</div>`}if(a&&f.trim()&&(J+=`<p style="${V}font-weight:600;margin:0 0 10px 0;">${Sl(f)}</p>`),i&&_&&(J+=`<p style="${V}margin:0 0 10px 0;opacity:0.92;">${Sl(_)}</p>`),m&&k.trim()&&(J+=`<p style="${V}margin:0 0 10px 0;">${Sl(k)}</p>`),h){const e=Array.isArray(N)?N.filter(Boolean):[];if(e.length>0){const t=ct.medium,o=e.map(e=>{const o=nt(fl(e.linkURL,n),{allowMailtoTel:!1}),{src:l,styleAttr:a}=wt(e,"default",t),i=`<img src="${Sl(l)}" alt="" width="${t}" height="${t}" style="${a}" border="0"/>`,r="text-decoration:none;display:inline-block;vertical-align:middle;line-height:0;margin:0 6px;";return o?`<a href="${Sl(o)}" target="_blank" rel="noopener noreferrer" style="${r}">${i}</a>`:`<span style="${r}">${i}</span>`}).join(""),l="left"===A?"left":"right"===A?"right":"center";J+=`<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%" style="width:100%;border-collapse:collapse;margin-bottom:10px;"><tr><td align="${l}" style="text-align:${l};font-size:0;line-height:0;">${o}</td></tr></table>`}}if(g){const e=Sl(bl(x,n)),t=Sl(bl(S,n));let o=`<p style="${V}margin:0 0 10px 0;word-break:break-word;">`;e&&(o+=`${e} `),o+=`<a href="${Sl(nt(fl(w,n)))}" style="${G}">${t}</a>`,o+="</p>",J+=o}if(y&&C.length>0){let e=`<p style="${V}margin:0 0 10px 0;word-break:break-word;">`;C.forEach((t,o)=>{o>0&&(e+='<span style="padding:0 6px;">·</span>');const l=Sl(bl(t.label,n)),a=Sl(nt(fl(t.url,n))),i="_blank"===t.target?' target="_blank" rel="noopener noreferrer"':"";e+=`<a href="${a}" style="${G}"${i}>${l||`#${o+1}`}</a>`}),e+="</p>",J+=e}if(b&&v.trim()){J+=`<p style="${V}font-size:${Math.max(10,B-1)}px;margin:0;opacity:0.9;">${Sl(v)}</p>`}var Y;return q.push(`<td${H} style="width:${j};${K}">${Y=J,`<table role="presentation" cellpadding="0" cellspacing="0" border="0" width="100%" style="width:100%;"><tr><td align="${Sl(A)}" style="${V}text-align:${Sl(A)};background-color:${Sl(M)};padding:${I}px ${$}px ${P}px ${R}px;${W?`border-top:${W};`:""}">${Y}</td></tr></table>`}</td>`),q.join("")}(e,e.children?.find(e=>"content"===e.key)??e.children?.[0]??null,n):Hl(e.children,t,n,f,_,k);if("discount"===e.containerType){const t=e.styles?.desktop??{},n=e=>"number"==typeof e?`${e}px`:String(e??""),o=[t.paddingTop?`padding-top:${n(t.paddingTop)};`:"",t.paddingRight?`padding-right:${n(t.paddingRight)};`:"",t.paddingBottom?`padding-bottom:${n(t.paddingBottom)};`:"",t.paddingLeft?`padding-left:${n(t.paddingLeft)};`:""].join(""),l=e.styleConfig.desktop.replace(/padding(?:-(?:top|right|bottom|left))?:[^;]+;?\s*/gi,""),a=o?`<tr><td style="${o}"><table role="presentation" cellpadding="0" cellspacing="0" border="0" style="width:100%;border-collapse:collapse;"><tbody><tr>${v}</tr></tbody></table></td></tr>`:`<tr>${v}</tr>`;i+=`<div ${e.styleConfig.mobile?`class="${e.styleConfig.className}"`:""}\n style="${l}width:100%;display:block;${u}">\n <table ${e.contentStyleConfig.mobile?`class="${e.contentStyleConfig.className}"`:""}\n style="width:100%;max-width:${b};margin:0 auto;${d}${e.contentStyleConfig?.desktop??""}${h}${p}${m}">\n <tbody>${a}</tbody>\n </table></div>`}else i+=`<div ${e.styleConfig.mobile?`class="${e.styleConfig.className}"`:""}\n style="${e.styleConfig.desktop}width:100%;display:block;${u}">\n <table ${e.contentStyleConfig.mobile?`class="${e.contentStyleConfig.className}"`:""}\n style="width:100%;max-width:${b};margin:0 auto;${d}${e.contentStyleConfig?.desktop??""}${h}${p}${m}">\n <tbody><tr>${v}</tr></tbody>\n </table></div>`}if("content"===e.key&&(i+=`<td ${e.styleConfig.mobile?`class="${e.styleConfig.className}"`:""} \n style="width:${e.width}; ${e.styleConfig.desktop}">${Hl(e.children,t,n,o,l,s)}</td>`),"text"===e.key){const t=null!=o?{columnIndex:l??0,columnProduct:o?.columnProducts?.[a??0]??null}:r;e.type&&/^h[1-4]$/.test(e.type)?i+=Wl(e,n,t):i+=((e,t,n={},o=null)=>{let l=Ol(e);t&&l&&(l=Co(l,t,n));const a=e?.styles?.desktop??{},i=null!=a.linkColor&&""!==String(a.linkColor).trim();l=Ho(l,i?String(a.linkColor).trim():zl,{useImportant:i});const r="footer"===o?.containerType,s=null==(c=l)||"string"!=typeof c?"":c.replace(/<[^>]+>/g,"").replace(/\s+/g," ").trim();var c;return!r||""!==s&&"{{Address}}"!==s&&"{{Tagline}}"!==s?`<div ${e.styleConfig?.mobile?`class="${e.styleConfig.className}"`:""} \n style="${e.styleConfig?.desktop||""}">${l}</div>`:""})(e,n,t,o)}if("heading"===e.key&&(i+=Wl(e,n,r)),"image"===e.key){i+=((e,t,n={},o=null)=>{let l=e.src||"";const a="string"==typeof e.src&&/^\{\{\s*[\w.]+\s*\}\}$/.test(e.src.trim())?e.src.trim():"";if(t&&a){const e=$o(t,a.replace(/^\{\{\s*|\s*\}\}$/g,""),n);e&&!/^\{\{\s*[\w.]+\s*\}\}$/.test(String(e).trim())&&(l=e)}l=ll(l);const i=$l(l),r=$l(e.alt||"Image"),s=null!=e.linkURL?String(e.linkURL).trim():"",c=Array.isArray(e.overlayItems)?e.overlayItems:[],d=c.some(e=>""!==String(e?.text??"").trim()),u=String(e.overlayText??"").trim(),p=Boolean(e.textOverlayEnabled)&&(d||""!==u)&&l,m=`${e.styleConfig?.desktop||""};max-width:100%;display:inline-block;vertical-align:top;`;let g=`<img src="${i}" alt="${r}" style="${m}" ${e.styleConfig?.mobile?`class="${e.styleConfig.className}"`:""}/>`;if(p){const t=pl(ul(e.overlayPosition)),n=Object.entries({position:"absolute",...t,"z-index":"2","max-width":`${"number"==typeof e.overlayMaxWidth?e.overlayMaxWidth:100}%`,"box-sizing":"border-box","pointer-events":"none"}).map(([e,t])=>`${e}:${t};`).join(""),l="number"==typeof e.overlayPadding?e.overlayPadding:16,a=e.textShadowEnabled?"text-shadow:0 1px 3px rgba(0,0,0,0.55);":"";let s="";if(d){const t="number"==typeof e.overlayItemGap?e.overlayItemGap:8,n=c.filter(e=>String(e?.text??"").trim()).map(e=>{const t="number"==typeof e.fontSize?e.fontSize:16,n=$l(e.color||"#ffffff"),l=(e=>{switch(e){case"h1":case"h2":case"h3":return"700";case"subtitle":case"eyebrow":return"600";default:return"400"}})(e.kind),i=null!=e.fontFamily&&""!==String(e.fontFamily).trim()?String(e.fontFamily).trim():String(o?.styles?.fontFamily||"sans-serif").trim()||"sans-serif",r=$l(i),s=Il(String(e.text??""));return`<div style="color:${n};font-size:${t}px;font-weight:${l};line-height:1.35;font-family:${r};${a}">${s}</div>`});s=`<div style="display:flex;flex-direction:column;gap:${t}px;width:100%;padding:${l}px;">${n.join("")}</div>`}else s=`<div style="color:${$l(e.overlayTextColor||"#ffffff")};font-size:${"number"==typeof e.overlayFontSize?e.overlayFontSize:18}px;font-weight:600;line-height:1.35;${e.overlayBoxBackground?`background-color:${$l(e.overlayBoxBackground)};padding:8px 12px;`:`padding:${l}px;`}${a}">${Il(u)}</div>`;g=`<div style="position:relative;display:inline-block;vertical-align:top;max-width:100%;overflow:hidden;line-height:0;">\n ${e.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="${i}" alt="${r}" style="${m}position:relative;z-index:0;border-radius:0;" ${e.styleConfig?.mobile?`class="${e.styleConfig.className}"`:""}/>\n <div style="${n}">\n ${s}\n </div>\n </div>`}const h=jo(e)&&""!==s?`<a href="${$l(Pl(s))}" target="_blank" rel="noopener noreferrer" style="text-decoration:none;display:inline-block;max-width:100%;">${g}</a>`:g,y=e.imageHostMarginStyleConfig,b=y&&(y.desktop||y.mobile)?`<div ${y.mobile?`class="${y.className}"`:""} style="display:inline-block;vertical-align:top;max-width:100%;${y.desktop||""}">${h}</div>`:h;return`<div ${e.contentStyleConfig.mobile?`class="${e.contentStyleConfig.className}"`:""} \n style="${El(e)}">\n ${b}\n </div>`})(e,n,null!=o?{columnIndex:l??0,columnProduct:o?.columnProducts?.[a??0]??null}:r,t)}if("video"===e.key&&(i+=(e=>{const t=null!=e.videoUrl?String(e.videoUrl).trim():"",n=ml(t,null!=e.thumbnailUrl?String(e.thumbnailUrl).trim():""),o=t?Pl(t):"#",l=`${e.styleConfig?.desktop||""};max-width:100%;height:auto;display:block;border:0;`,a=e.contentStyleConfig?.desktop||"",i=e.videoAreaStyleConfig?.desktop||"";return`<div ${e.contentStyleConfig?.mobile?`class="${e.contentStyleConfig.className}"`:""} style="${a}">\n <div ${e.videoAreaStyleConfig?.mobile?`class="${e.videoAreaStyleConfig.className}"`:""} style="${i}">\n ${n?`<a href="${$l(o)}" target="_blank" rel="noopener noreferrer" style="text-decoration:none;display:inline-block;max-width:100%;line-height:0;"><img src="${$l(n)}" alt="${$l("Video")}" style="${l}"/></a>`:`<a href="${$l(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>`})(e)),"button"===e.key){i+=jl(e,n,null!=o?{columnIndex:l??0,columnProduct:o?.columnProducts?.[a??0]??null}:r,o)}var c,d;"divider"===e.key&&(i+=`<div ${(c=e).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"===e.key&&(i+=(d=e,`<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"===e.key&&(i+=(e=>{const t=e.list||[],n=null!=e.separator?String(e.separator):" | ",o=e.styleConfig?.desktop||"",l=e.contentStyleConfig?.desktop||"",a=e.linkGapPx,i="number"==typeof a&&Number.isFinite(a)&&a>=0?a:0,r=Boolean(e.linkUnderline),s=e.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 t.forEach((e,t)=>{t>0&&(u+=`<span style="${i>0?`display:inline-block;margin-left:${i}px;margin-right:${i}px;font-size:${c};color:${d};`:`display:inline-block;padding-left:4px;padding-right:4px;font-size:${c};color:${d};`}">${Il(n)}</span>`);const l=Pl(e.url,"#"),a="_blank"===e.target?"_blank":"_self",s=Il(e.label||"Link"),p=r?"underline":"none";u+=`<a target="${a}" href="${$l(l)}" style="${o};text-decoration:${p};display:inline-block;">${s}</a>`}),`<div ${e.contentStyleConfig?.mobile?`class="${e.contentStyleConfig.className}"`:""} style="${l}">${u}</div>`})(e)),"avatar"===e.key&&(i+=(e=>{const t=e.src||"",n=e.alt||"Avatar",o=e.linkURL,l=e.styleConfig?.desktop||"",a=e.styles?.desktop?.width??64,i=`max-width:100%;width:${"number"==typeof a?a+"px":a};height:${"number"==typeof a?a+"px":a};object-fit:cover;border-radius:${e.styles?.desktop?.borderRadius??"50%"};${l}`,r=$l(t),s=$l(n),c=t?`<img src="${r}" alt="${s}" style="${i}" />`:`<div style="${i};background:#eee;display:flex;align-items:center;justify-content:center;"></div>`,d=e.contentStyleConfig?.desktop||"",u=o?`<a href="${$l(Pl(o))}" target="_blank" rel="noopener noreferrer">${c}</a>`:c;return`<div ${e.contentStyleConfig?.mobile?`class="${e.contentStyleConfig.className}"`:""} style="${d}">${u}</div>`})(e)),"social_link"===e.key&&(i+=(e=>{const t=Array.isArray(e.list)?e.list.filter(Boolean):[];if(0===t.length)return"";const n=Boolean(e.showTextLabel),o=_t(e),l=Math.max(11,Math.round(.58*o)),a=rt(e.iconColor),i=e?.contentStyles?.desktop??{},r=i.textAlign||"center",s="justify"===r,c="right"===r?"right":"left"===r?"left":"center",d=i.columnGapPx,u="number"==typeof d&&Number.isFinite(d)&&d>=0?d:8,p=Math.max(0,Math.round(u/2)),m=e.styleConfig?.desktop||"",g=e.styleConfig?.mobile?` class="${e.styleConfig.className}"`:"",h=(e,t="")=>{const{title:i,linkURL:r}=e,s=nt(r,{allowMailtoTel:!1}),{src:c,styleAttr:d}=wt(e,a,o),u=n?d.replace(/display:\s*block/i,"display:inline-block"):d,p=`<img src="${$l(c)}" alt="${$l(i)}" width="${o}" height="${o}" style="${$l(u)}" border="0"${g}/>`,h=at(e)?"X":String(i??""),y=n?`<span style="font-size:${l}px;line-height:1.2;color:#525252;font-family:inherit;white-space:nowrap;display:inline-block;vertical-align:middle;margin-left:6px;">${Il(h)}</span>`:"",b=`text-decoration:none;display:inline-block;vertical-align:middle;line-height:0;${t}${m?`;${m}`:""}`;return s?`<a target="_blank" rel="noopener noreferrer" href="${$l(s)}" style="${b}">${p}${y}</a>`:`<span style="${b}">${p}${y}</span>`},y=`${e.contentStyleConfig?.desktop||""};text-align:${c};`,b=e.contentStyleConfig?.mobile?` class="${e.contentStyleConfig.className}"`:"";let f;if(s&&t.length>1){const e=(100/t.length).toFixed(4);f=`<table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%" style="width:100%;border-collapse:collapse;"><tr>${t.map((n,o)=>{const l=0===o?"left":o===t.length-1?"right":"center";return`<td width="${e}%" style="width:${e}%;text-align:${l};vertical-align:middle;line-height:0;font-size:0;padding:0;">${h(n)}</td>`}).join("")}</tr></table>`}else f=t.map(e=>h(e,`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${b} align="${c}" style="${y}">${f}</td></tr></table>`})(e)),"raw_html"===e.key&&(i+=(e=>{const t=function(e){const t=e.match(/<body[^>]*>([\s\S]*?)<\/body>/i);return t?t[1]:/<html[\s>]/i.test(e)||/<!DOCTYPE/i.test(e)?e.replace(/<!DOCTYPE[^>]*>/gi,"").replace(/<html[^>]*>/gi,"").replace(/<\/html>/gi,"").replace(/<head[\s\S]*?<\/head>/gi,"").replace(/<\/?body[^>]*>/gi,"").trim():e}(e.html??""),n=e.contentStyleConfig?.desktop??"",o=e.contentStyleConfig?.mobile?`class="${e.contentStyleConfig.className}"`:"",l=e.contentStyles?.desktop??{},a=l.width,i=l.textAlign??"center";let r="";return null!=a&&"100%"!==String(a)&&"center"===i?r="margin-left:auto;margin-right:auto;":null!=a&&"100%"!==String(a)&&"right"===i?r="margin-left:auto;margin-right:0;":null==a||"100%"===String(a)||"left"!==i&&"justify"!==i||(r="margin-left:0;margin-right:auto;"),`<div ${o} style="${r}max-width:100%;${n}">${t}</div>`})(e)),"table"===e.key&&(i+=(e=>{const t=e.contentStyleConfig?.desktop||"",n=e.contentStyleConfig?.mobile?`class="${e.contentStyleConfig.className}"`:"",o=e.styles?.desktop??{},l="number"==typeof e.rows?e.rows:3,a="number"==typeof e.cols?e.cols:3,i=Boolean(e.headerRow),r=Boolean(e.headerCol),s=Boolean(e.stripedRows),c=o.fontSize??14,d=o.color??"#333333",u=o.borderStyle??"solid",p=o.borderWidth??1,m=o.borderColor??"#e0e0e0",g=o.cellPadding??8,h=o.textAlign??"left",y=o.headerBg??"#f5f5f5",b=o.headerColor??"#333333",f=o.stripedBg??"#fafafa",_="none"!==u?`${p}px ${u} ${m}`:"none",k=Array.from({length:l}).map((t,n)=>{const o=Array.from({length:a}).map((t,o)=>{const l=i&&0===n||r&&0===o,a=l?y:s&&!l&&n%2==0?f:"transparent",u=l?b:d,p=l?"600":"400",m=`${n}-${o}`,k=e.cells?.[m],v=i&&0===n||r&&0===o?"th":"td";let w="—";return"image"===k?.type&&String(k.src??"").trim()?w=`<img src="${$l(k.src)}" alt="${$l(k.alt||"")}" style="max-width:100%;height:auto;display:block;border:0;"/>`:String(k?.text??"").trim()&&(w=Il(String(k.text))),`<${v} style="border:${_};padding:${g}px;font-size:${c}px;color:${u};text-align:${h};background-color:${a};font-weight:${p};vertical-align:top;">${w}</${v}>`}).join("");return`<tr>${o}</tr>`}).join("");return`<div ${n} style="${t}"><table role="presentation" style="${e.styleConfig?.desktop||""};border-collapse:collapse;width:100%;table-layout:auto;"><tbody>${k}</tbody></table></div>`})(e))}),i},Kl={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"}},Vl=e=>Array.isArray(e)?e.filter(e=>!(e&&"object"==typeof e&&!0===e.hidden)).map(e=>e&&"object"==typeof e&&Array.isArray(e.children)?{...e,children:Vl(e.children)}:e):e,Gl=({bodySettings:e,blockList:t,templateData:n})=>{let o="";const l=((e,t)=>{if(!Array.isArray(e))return e;const n=t?.content?.products;if(!Array.isArray(n)||0===n.length)return e;const o=t?.content?.primaryProductId,l=(o?n.find(e=>e?.id===o):n[0])??n[0]??null;if(!l)return e;const a=n.filter(e=>e?.id!==l.id),i=e=>{if(!e||"object"!=typeof e)return e;const t=Array.isArray(e.children)?e.children.map(i):e.children;if("column"!==e.key||"product"!==e.containerType)return{...e,children:t};const n="additional"===e.productRole?"additional":"main",o=Math.max(Array.isArray(t)?t.length:0,Array.isArray(e.columnProducts)?e.columnProducts.length:0,1),r=Array.from({length:o},(e,t)=>"main"===n||0===a.length?l:a[t%a.length]);return{...e,children:t,columnProducts:r}};return e.map(i)})(Vl(t??[]),n),{newBlockList:a,styles:i}=Ul(l);o=Hl(a,e,n);const r=tl(l,e,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 ${e.styles?.headingColor?`color: ${e.styles.headingColor};`:""}\n }\n\n a {\n ${e.styles?.linkColor?`color: ${e.styles.linkColor};`:""}\n }\n\n @media(max-width:620px){\n${!1!==e.stackColumnsOnMobile?" td {\n display:inline-block;\n width:100% !important;\n }\n":""}${!1!==e.scaleFontOnMobile?" body { font-size: 16px !important; }\n":""} }\n ${r}\n ${i}\n</style>\n </head>\n <body>\n <div style="opacity:0;">${e.preHeader}</div>\n <div style="background-color:${e.styles.backgroundColor};color:${e.styles.color}; font-family:${e.styles.fontFamily};"> ${o}</div>\n </body>\n </html>`};function ql(e){let t=e;if("string"==typeof e)try{t=JSON.parse(e)}catch(e){throw new Error("exportNormalizerToHtml: invalid JSON")}if(null==t)throw new Error("exportNormalizerToHtml: input is null or undefined");let n=[],o={...Kl,styles:{...Kl.styles}};Array.isArray(t)?n=t:"object"==typeof t&&(n=Array.isArray(t.blockList)?t.blockList:[],t.bodySettings&&"object"==typeof t.bodySettings&&(o={preHeader:null!=t.bodySettings.preHeader?t.bodySettings.preHeader:Kl.preHeader,contentWidth:Et(t.bodySettings.contentWidth??Kl.contentWidth),contentWidthMode:t.bodySettings.contentWidthMode??Kl.contentWidthMode,stackColumnsOnMobile:!1!==t.bodySettings.stackColumnsOnMobile,scaleFontOnMobile:!1!==t.bodySettings.scaleFontOnMobile,styles:{backgroundColor:t.bodySettings.styles?.backgroundColor??Kl.styles.backgroundColor,contentBg:t.bodySettings.styles?.contentBg??Kl.styles.contentBg,color:t.bodySettings.styles?.color??Kl.styles.color,headingColor:t.bodySettings.styles?.headingColor??Kl.styles.headingColor,linkColor:t.bodySettings.styles?.linkColor??Kl.styles.linkColor,fontFamily:t.bodySettings.styles?.fontFamily??Kl.styles.fontFamily}}));return`<!DOCTYPE html>\n${function(e){return e.replace(/\n/g," ").replace(/[ \t]{2,}/g," ").replace(/> </g,"><").trim()}(Gl({bodySettings:o,blockList:n,templateData:t.templateData}))}`}function Jl(e,t){if("section"===e.layoutRole||"columns"===e.layoutRole)return e.layoutRole;if(!0===e.columnLayoutOnly)return"columns";return t.length>1||e.type&&"full"!==e.type?"columns":"section"}const Yl=["product"];function Xl(e){return Array.isArray(e)?e:e&&"object"==typeof e?Object.values(e):[]}function Zl(e,t={}){if(!e||"object"!=typeof e)return e;if("image"===e.key){const n="string"==typeof e.imageVariable&&/^\{\{\w+\}\}$/.test(e.imageVariable.trim())?e.imageVariable.trim():"",o="string"==typeof e.src&&/^\{\{\w+\}\}$/.test(e.src.trim())?e.src.trim():"",{imageVariable:l,...a}=e,i=o||n||e.src,r=e=>{if(!e||"object"!=typeof e)return e;const{marginLeft:t,marginTop:n,...o}=e;return o},s=e.contentStyles?{desktop:r(e.contentStyles.desktop||{}),mobile:r(e.contentStyles.mobile||{})}:e.contentStyles;return{...a,src:i,...s?{contentStyles:s}:{},textOverlayEnabled:Boolean(e.textOverlayEnabled),overlayText:e.overlayText??"",overlayPosition:e.overlayPosition??"bc",overlayTextColor:e.overlayTextColor??"#ffffff",overlayFontSize:(()=>{const t=Number(e.overlayFontSize);return Number.isFinite(t)&&t>0?t:18})(),overlayBoxBackground:e.overlayBoxBackground??"",overlayPadding:(()=>{const t=Number(e.overlayPadding);return Number.isFinite(t)&&t>=0?t:16})(),scrimEnabled:Boolean(e.scrimEnabled),textShadowEnabled:Boolean(e.textShadowEnabled),children:Xl(e.children).map(e=>Zl(e,t))}}if("video"===e.key){const t=e.videoArea||{},n=t.desktop||{};return{...e,videoUrl:"string"==typeof e.videoUrl?e.videoUrl:"",thumbnailUrl:"string"==typeof e.thumbnailUrl?e.thumbnailUrl:"",videoArea:{desktop:{paddingTop:n.paddingTop??0,paddingBottom:n.paddingBottom??0,paddingLeft:n.paddingLeft??0,paddingRight:n.paddingRight??0,backgroundColor:n.backgroundColor??"transparent",borderWidth:n.borderWidth??0,borderStyle:n.borderStyle??"solid",borderColor:n.borderColor??"#cccccc",borderRadius:n.borderRadius??0},mobile:t.mobile??{}},styles:{desktop:{width:"auto",height:"auto",fillColumn:!1,fillColumnMobile:!1,display:"inline-block",...e.styles?.desktop||{}},mobile:{...e.styles?.mobile||{}}},contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center",backgroundColor:"transparent",...e.contentStyles?.desktop||{}},mobile:{...e.contentStyles?.mobile||{}}}}}if("column"===e.key){const{ctaText:n,container_type:o,...l}=e,a=function(e){if(!e||"object"!=typeof e)return null;const t=null!=e.containerType&&""!==e.containerType?e.containerType:e.container_type;return null==t||""===t?null:"string"!=typeof t?String(t).trim().toLowerCase()||null:t.trim().toLowerCase()}(e),i=a??e.containerType??null;let r=function(e){const t=null==e?null:String(e).trim().toLowerCase();return null==t||""===t||"none"===t?"none":"discount"===t?"discount":"header"===t?"header":"footer"===t?"footer":"product"===t||"hero_product"===t||"additional_product"===t?"product":"none"}(a??e.containerType);if("none"===r){const t=function(e){if(!e||"column"!==e.key)return null;if(!0===e.footerUnifiedLayout)return"footer";if(Array.isArray(e.footerSocialList)&&e.footerSocialList.length>0)return"footer";if(void 0!==e.showFooterBanner)return"footer";let t=!1,n=!1;const o=e=>{e&&"object"==typeof e&&((e.headerLogoSlot||e.headerBannerSlot||e.headerBannerDividerSlot)&&(t=!0),null!=e.footerSlot&&""!==String(e.footerSlot).trim()&&(n=!0),Xl(e.children).forEach(o))};return o(e),n?"footer":void 0!==e.showLogo||void 0!==e.showHeaderBanner||t?"header":null}(e);t&&(r=t)}const s="string"==typeof i?i.trim().toLowerCase():"",c="product"===r?e.productRole??("additional_product"===s?"additional":"main"):void 0,d=Xl(e.children);let u=e.columnProducts;if(Yl.includes(r)){const e=d.length;Array.isArray(u)||(u=[]),u=Array.from({length:e},(e,t)=>u[t]??null)}else u=[];return{...l,containerType:r,productRole:c,columnProducts:u,layoutRole:Jl(e,d),children:(d||[]).map(e=>Zl(e,t))}}if("heading"===e.key){const n=e.id?t?.[e.id]:null,o={...e,key:"text",name:e.name,type:e.type||"h1",contentType:e.contentType??"static",text:e.text,styles:e.styles,contentStyles:e.contentStyles,selectedVariableKey:e.selectedVariableKey,dynamicVariable:n?.variable??e.dynamicVariable,dynamicPrompt:n?.prompt??e.dynamicPrompt,dynamicSelectedContent:n?.selectedContent??e.dynamicSelectedContent,dynamicOptions:Array.isArray(n?.options)?n.options:n?.selectedContent?[n.selectedContent]:e.dynamicOptions};return"dynamic"===o.contentType&&(o.dynamicVariable=o.dynamicVariable??"",o.dynamicPrompt=o.dynamicPrompt??"",o.dynamicSelectedContent=o.dynamicSelectedContent??"",o.dynamicOptions=Array.isArray(o.dynamicOptions)?o.dynamicOptions:[],o.dynamicAiLanguage="bn-BD"===n?.language||"bn-BD"===o.dynamicAiLanguage?"bn-BD":"en"),{...o,children:Xl(e.children).map(e=>Zl(e,t))}}if("text"===e.key){const n=e.id?t?.[e.id]:null,o=e.contentType??"static",l={...e,type:e.type||"p",contentType:o};return"dynamic"===o&&(l.dynamicVariable=n?.variable??e.dynamicVariable??"",l.dynamicPrompt=n?.prompt??e.dynamicPrompt??"",l.dynamicSelectedContent=n?.selectedContent??e.dynamicSelectedContent??"",l.dynamicOptions=Array.isArray(n?.options)?n.options:n?.selectedContent?[n.selectedContent]:Array.isArray(e.dynamicOptions)?e.dynamicOptions:[],l.dynamicAiLanguage="bn-BD"===n?.language||"bn-BD"===e.dynamicAiLanguage?"bn-BD":"en"),{...l,children:Xl(e.children).map(e=>Zl(e,t))}}return{...e,children:Xl(e.children).map(e=>Zl(e,t))}}const Ql="https://api-alpha.markopolo.ai/v1",ea="https://nbq-ml-api-stg.markopolo.ai/v1",ta="95b48b5b-cf5e-486d-817e-9839d4c4e618";function na(e,t){const n=null!=(o=e)&&"string"==typeof o&&o.trim()?o.replace(/\/$/,""):Ql;var o;const l=function(e){return null!=e&&"string"==typeof e&&e.trim()?e.replace(/\/$/,""):ea}(t);return{imageUploadEndpoint:`${n}/upload-file`,imageUploadQueryParams:{show:!1},imageUploadCompanyField:"comment",productsEndpoint:`${n}/knowledge-base/products`,universalEmailBlocksEndpoint:`${n}/universal-email-blocks`,mlEmailNodesEndpoint:`${l}/ml-service/content/generate-email-nodes`,mlEmailGenerateEndpoint:`${l}/ml-service/content/generate-email`}}function oa(e={}){const t=e&&"object"==typeof e?e:{},{apiBaseUrlV1:n,apiBaseV1:o,mlGenerationApiBaseUrlV1:l,mlApiBaseUrlV1:a,headers:i,mlEmailGenerateBnEndpoint:r,...s}=t,c=n||o||Ql,d="undefined"!=typeof process&&process.env?.REACT_APP_ML_API_BASE_V1,u=na(c,l||a||d||ea),p="undefined"!=typeof process?String(process.env?.REACT_APP_EMAIL_TEMPLATE_ID??"").trim():"",m={...u,...s};m.mlEmailGenerateEndpoint&&String(m.mlEmailGenerateEndpoint).trim()||!r||(m.mlEmailGenerateEndpoint=String(r).replace(/\/generate-email\/bn\/?$/i,"/generate-email"));const g=String(m.emailTemplateId??"").trim()||p||ta;return{...m,emailTemplateId:g,headers:{...m.headers||{},...i||{}}}}function la(e,t,n){const o=String(e??"").trim(),l=t&&"object"==typeof t?JSON.parse(JSON.stringify(t)):{name:"Block",key:"column"};l.name||(l.name="column"===l.key?"Container":o||"Block"),l.key||(l.key="column"),"column"===l.key&&Array.isArray(l.children)&&l.children.length>0&&delete l.cells;const a="column"===l.key?String(l.containerType??"none"):"none",i=function(e){if(!e||"object"!=typeof e)return"content";const t=String(e.key??"").toLowerCase();if("column"===t){const t=String(e.containerType??"none").toLowerCase();return"header"===t?"header":"footer"===t?"footer":"none"===t||""===t?"column":"content"}return"image"===t?"image":"menu"===t?"menu":"content"}(l),r="undefined"!=typeof performance&&performance.now?Math.floor(performance.now()):Date.now(),s=String(l.id??r).replace(/-/g,"").slice(0,12),c=`preset_${d=o,String(d??"").toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"").slice(0,48)||"block"}_${s}`;var d;return{companyId:String(n),blockName:o,blockType:i,presetId:c,presetName:o,nameKey:c,containerType:a,block:l}}function aa(e,t){if(!e||"object"!=typeof e)return null!=t?`Request failed (${t})`:"Request failed";const n=e.error;if(n&&"object"==typeof n&&null!=n.message){const e=String(n.message).trim();if(e){const t=null!=n.code?String(n.code).trim():"";return t&&t!==e&&!e.toLowerCase().includes(t.toLowerCase())?`${t}: ${e}`:e}}return"string"==typeof n&&n.trim()?n.trim():"string"==typeof e.message&&e.message.trim()?e.message.trim():null!=t?`Request failed (${t})`:"Request failed"}function ia(e){const t=e?.universalEmailBlocksEndpoint;if(t&&String(t).trim())return String(t).replace(/\/$/,"");const n=String(e?.apiBaseUrlV1||e?.apiBaseV1||"").replace(/\/$/,"");return n?`${n}/universal-email-blocks`:""}function ra(e){return{"Content-Type":"application/json",...e?.headers||{}}}function sa(e){if(!e||"object"!=typeof e)return null;const t=e.resourceId??e.id;if(!t)return null;let n=e.block;if("string"==typeof n)try{n=JSON.parse(n)}catch{n=null}n&&"object"==typeof n||(n={});const o=e.blockMap??e.blocks??e.blockSnapshotMap;if("column"===n.key&&o&&"object"==typeof o){const e=Array.isArray(o)?o.reduce((e,t)=>(t&&"object"==typeof t&&t.id&&(e[t.id]=t),e),{}):{...o};Object.keys(e).length>0&&(n={...n,blockMap:e})}return{id:t,name:e.blockName??e.name??"Saved block",block:n,resourceId:e.resourceId??t,blockType:e.blockType}}const ca={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 da(e){const t=String(e??"").trim();return/^\{\{[A-Za-z_]\w*\}\}$/.test(t)}const ua=/^\s*\{\{[\s\S]*\}\}\s*$/;function pa(e){const t=String(e??"").trim();if(!t)return!1;if("#"===t)return!1;if(t.startsWith("#")&&t.length>1)return!1;if(ua.test(t))return!1;if(da(t))return!1;const n=t.toLowerCase();return!n.startsWith("http://")&&!n.startsWith("https://")&&(!n.startsWith("mailto:")&&!n.startsWith("tel:")&&!n.startsWith("//"))}function ma(e){if(!e||"object"!=typeof e)return"";return`${e.severity??"unknown"}:${e.code??"issue"}:${e.blockId??"global"}:${e.location??""}`}function ga(e){let t=!1;const n=e=>{if(Array.isArray(e))for(const o of e)o&&"object"==typeof o&&("text"===o.key&&"dynamic"===o.contentType&&"bn-BD"===o.dynamicAiLanguage&&(t=!0),Array.isArray(o.children)&&n(o.children))};return n(Array.isArray(e)?e:[]),t?"bn-BD":"en"}function ha(e,t=!1){if(null==e||""===String(e).trim())return t;const n=String(e).trim();try{return/^https?:\/\//i.test(n)?new URL(n):new URL("https://"+n),!0}catch{return!1}}const ya={text:"Text",heading:"Heading",button:"Button",image:"Image",video:"Video",avatar:"Profile image",menu:"Menu",social_link:"Social links",raw_html:"HTML"};const ba={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 fa(e,t,n){const o=e.containerType??"none",l=function(e){const t=e??"none";return ba[t]?ba[t]:String(t).replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}(o);return n<=1?l:"none"===o?`${_a(t+1)} section`:`${_a(t+1)} ${l} block`}function _a(e){const t=e%10,n=e%100;return 1===t&&11!==n?`${e}st`:2===t&&12!==n?`${e}nd`:3===t&&13!==n?`${e}rd`:`${e}th`}function ka(e,t,n){const o=function(e){return ya[e]?ya[e]:String(e||"block").replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}(t),l=[...e],a=l.length>0?l.join(" → "):"Email body";return n?`${o} ("${n}") — ${a}`:`${o} — ${a}`}function va(e,t){const n=function(e){return null==e||"object"!=typeof e?{...ca,styles:{...ca.styles}}:{preHeader:null!=e.preHeader?e.preHeader:ca.preHeader,contentWidth:Et(null!=e.contentWidth?e.contentWidth:ca.contentWidth),stackColumnsOnMobile:!1!==e.stackColumnsOnMobile,scaleFontOnMobile:!1!==e.scaleFontOnMobile,styles:{backgroundColor:null!=e.styles?.backgroundColor?e.styles.backgroundColor:ca.styles.backgroundColor,contentBg:null!=e.styles?.contentBg?e.styles.contentBg:ca.styles.contentBg,color:null!=e.styles?.color?e.styles.color:ca.styles.color,headingColor:null!=e.styles?.headingColor?e.styles.headingColor:ca.styles.headingColor,linkColor:null!=e.styles?.linkColor?e.styles.linkColor:ca.styles.linkColor,fontFamily:null!=e.styles?.fontFamily?e.styles.fontFamily:ca.styles.fontFamily}}}(e);("number"!=typeof n.contentWidth||!Number.isFinite(n.contentWidth)||n.contentWidth<=0)&&t.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()||t.push({severity:"error",code:"body_background_color_missing",message:"Theme background color is missing.",location:"Theme settings"}),null!=o.color&&""!==String(o.color).trim()||t.push({severity:"error",code:"body_text_color_missing",message:"Theme text color is missing.",location:"Theme settings"}),null!=o.fontFamily&&""!==String(o.fontFamily).trim()||t.push({severity:"error",code:"body_font_family_missing",message:"Theme font family is missing.",location:"Theme settings"})}function wa(e,t){e.push(t)}function xa(e){return null==e?"":String(e).replace(/&/gi,"&").replace(/"/gi,'"').replace(/'/g,"'").trim()}function Sa(e){if(null==e||"string"!=typeof e)return[];const t=[],n=/<a\b[^>]*?\bhref\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>"']+))/gi;let o=n.exec(e);for(;o;){const l=o[1]??o[2]??o[3]??"";t.push(xa(l)),o=n.exec(e)}return t}function Ca(e,t=!0){const n=String(e??"").trim();return n?da(n)?null:lt(n,!1,{allowMailtoTel:t}):null}function Na(e,t,n){const o=e.linkURL,l=()=>ka(t,"button",void 0),a=e.id??null;null==o||""===String(o).trim()?wa(n,{severity:"warning",code:"button_empty_link",message:'Button link URL is empty; will be saved as href="https://".',location:l(),blockId:a}):Qe(o)?wa(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:l(),blockId:a}):da(o)||ot(o,!1,{allowMailtoTel:!0})?!da(o)&&pa(o)&&wa(n,{severity:"warning",code:"button_link_missing_protocol",message:"Button link should start with https://, http://, mailto:, or tel: for reliable email clients.",location:l(),blockId:a}):wa(n,{severity:"warning",code:"button_invalid_link",message:"Button link URL format is invalid.",location:l(),blockId:a}),function(e,t,n,o,{invalidCode:l,invalidMessage:a,blockedCode:i,blockedMessage:r,missingProtocolCode:s,missingProtocolMessage:c}){Sa(e??"").forEach((e,d)=>{const u=String(e??"").trim();""!==u&&(Qe(u)?wa(t,{severity:"error",code:i,message:r,location:n(d),blockId:o}):ot(u,!1,{allowMailtoTel:!0})?pa(u)&&wa(t,{severity:"warning",code:s,message:c,location:n(d),blockId:o}):wa(t,{severity:"warning",code:l,message:a,location:n(d),blockId:o}))})}(e.text,n,e=>ka(t,"button",`label link ${e+1}`),a,{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 La=["product"];function Ta(e,t,n,o,l){(function(...e){const t=new Set,n=[];for(const o of e)if(null!=o&&""!==String(o).trim())for(const e of Sa(String(o))){const o=String(e).trim();o&&!t.has(o)&&(t.add(o),n.push(e))}return n})(e.text,e.dynamicSelectedContent).forEach((l,a)=>{const i=String(l??"").trim();""!==i&&(i.startsWith("#")||ua.test(i)||(Qe(i)?wa(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:ka(t,o,`link ${a+1}`),blockId:e.id??null}):ot(i,!1,{allowMailtoTel:!0})?pa(i)&&wa(n,{severity:"warning",code:"text_link_missing_protocol",message:"Text link should start with https://, http://, mailto:, or tel: for reliable email clients.",location:ka(t,o,`link ${a+1}`),blockId:e.id??null}):wa(n,{severity:"warning",code:"text_invalid_link",message:"Text link URL format is invalid.",location:ka(t,o,`link ${a+1}`),blockId:e.id??null})))});if("dynamic"!==(e.contentType??"static"))return;const a=e.dynamicSelectedContent,i=null!=e?.id?l?.[e.id]?.selectedContent:void 0;let r=null!=a&&""!==String(a).trim()?a:i;var s;null!=r&&""!==String(r).trim()||null==e.text||""===(null==(s=e.text)?"":String(s).replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim())||(r=e.text),null!=r&&""!==String(r).trim()||wa(n,{severity:"warning",code:"dynamic_content_empty",message:"Dynamic content not generated; export will use static text if available.",location:ka(t,o,void 0),blockId:e.id??null})}function Ba(e,t,n){const o=e.list||[],l=new Set;o.forEach((o,a)=>{const i=o.title||o.image||`link ${a+1}`,r=e=>ka(t,"social_link",e||i),s=function(e){const t=String(e?.image||"").trim();if(t)return`img:${t}`;const n=String(e?.title||"").trim().toLowerCase();return n?`title:${n}`:null}(o);s&&(l.has(s)?wa(n,{severity:"warning",code:"social_duplicate_platform",message:"Duplicate social platform in this block; only one entry per platform should be kept.",location:r(i),blockId:e.id??null}):l.add(s));const c=o.linkURL;if(null==c||""===String(c).trim()){const t=String(o?.title||"").trim()||`Item ${a+1}`;wa(n,{severity:"warning",code:"social_empty_link",message:`${t} URL is empty — add https URL before sending; the icon still previews without an outbound link.`,location:r(i),blockId:e.id??null})}else Qe(c)?wa(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:r(i),blockId:e.id??null}):ot(c,!1,{allowMailtoTel:!1})||wa(n,{severity:"warning",code:"social_invalid_link",message:"Social link URL format is invalid.",location:r(i),blockId:e.id??null});const d=o.image;null==d||""===String(d).trim()?wa(n,{severity:"warning",code:"social_empty_icon",message:"Social link icon URL is empty; icon will not display.",location:r(i),blockId:e.id??null}):ha(d,!1)||wa(n,{severity:"warning",code:"social_invalid_icon",message:"Social link icon URL format is invalid.",location:r(i),blockId:e.id??null})}),0===o.length&&wa(n,{severity:"info",code:"social_no_links",message:"Social link block has no links.",location:ka(t,"social_link",void 0),blockId:e.id??null})}function Aa(e,t,n,o,l){if(!Array.isArray(e))return;const a=e.length;e.forEach((e,i)=>{if(!e||"object"!=typeof e)return;if(!0===e.hidden)return;const r=e.key;if("column"===r){const r=fa(e,i,a),s=[...t,r];return function(e,t,n){const o=e.containerType??"none";if(!La.includes(o))return;const l=e.children??[],a=e.columnProducts??[];l.forEach((o,i)=>{const r=a[i];if(null==r||"object"==typeof r&&!r.id){const o=l.length>1?`Column ${i+1} of ${l.length}`:"This column",a=[...t,o].join(" → ");wa(n,{severity:"warning",code:"container_product_not_assigned",message:"A product is not assigned to this column; assign a product in Container settings.",location:a,blockId:e.id??null})}})}(e,s,n),void(Array.isArray(e.children)&&Aa(e.children,s,n,o,l))}if("content"===r){const r=a>1?`Column ${i+1} of ${a}`:null,s=r?[...t,r]:t;return void(Array.isArray(e.children)&&Aa(e.children,s,n,o,l))}switch(r){case"image":!function(e,t,n){const o=e.src,l=()=>ka(t,"image",void 0);null!=o&&""!==String(o).trim()?(ha(o,!1)||wa(n,{severity:"warning",code:"image_invalid_src",message:"Image URL format is invalid.",location:l(),blockId:e.id??null}),jo(e)&&Ca(e.linkURL,!0)&&wa(n,{severity:"warning",code:"image_invalid_link",message:"Image link URL format is invalid.",location:l(),blockId:e.id??null}),null!=e.alt&&""!==String(e.alt).trim()||wa(n,{severity:"info",code:"image_empty_alt",message:"Image alt text is empty; consider adding for accessibility.",location:l(),blockId:e.id??null})):wa(n,{severity:"error",code:"image_empty_src",message:"Image URL is empty; the image will not display.",location:l(),blockId:e.id??null})}(e,t,n);break;case"video":!function(e,t,n){const o=()=>ka(t,"video",void 0),l=null!=e.videoUrl?String(e.videoUrl).trim():"";l?ha(l,!1)||wa(n,{severity:"warning",code:"video_invalid_url",message:"Video URL format may be invalid.",location:o(),blockId:e.id??null}):wa(n,{severity:"error",code:"video_empty_url",message:"Video URL is empty; the video will not display.",location:o(),blockId:e.id??null})}(e,t,n);break;case"avatar":!function(e,t,n){const o=e.src,l=()=>ka(t,"avatar",void 0);null==o||""===String(o).trim()?wa(n,{severity:"warning",code:"avatar_empty_src",message:"Avatar image URL is empty; avatar will not display.",location:l(),blockId:e.id??null}):ha(o,!1)||wa(n,{severity:"warning",code:"avatar_invalid_src",message:"Avatar image URL format is invalid.",location:l(),blockId:e.id??null}),Ca(e.linkURL,!0)&&wa(n,{severity:"warning",code:"avatar_invalid_link",message:"Avatar link URL format is invalid.",location:l(),blockId:e.id??null})}(e,t,n);break;case"button":Na(e,t,n);break;case"menu":!function(e,t,n){const o=e.list||[];o.forEach((o,l)=>{const a=String(o.label??"").trim()||`Item ${l+1}`,i=e=>ka(t,"menu",e||`Item ${l+1}`);null!=o.label&&""!==String(o.label).trim()||wa(n,{severity:"info",code:"menu_empty_label",message:'Navigation link label is empty; will display as "Link".',location:i(`item ${l+1}`),blockId:e.id??null});const r=o.url;null==r||""===String(r).trim()?wa(n,{severity:"warning",code:"menu_empty_url",message:`"${a}" link URL is empty; will be saved as href="#". Add a destination URL (e.g. https://example.com) before sending.`,location:i(a),blockId:e.id??null}):Qe(r)?wa(n,{severity:"error",code:"menu_blocked_scheme",message:`"${a}" link uses a blocked URL scheme (javascript:, data:, etc.). Use https://, mailto:, or tel: only.`,location:i(a),blockId:e.id??null}):ot(r,!1,{allowMailtoTel:!0})?!da(r)&&pa(r)&&wa(n,{severity:"warning",code:"menu_item_url_missing_protocol",message:`"${a}" link should start with https://, http://, mailto:, or tel: for reliable email client support.`,location:i(a),blockId:e.id??null}):wa(n,{severity:"warning",code:"menu_invalid_url",message:`"${a}" link URL is not valid. Use a full URL starting with https://example.com.`,location:i(a),blockId:e.id??null})}),0===o.length&&wa(n,{severity:"info",code:"menu_no_items",message:"Menu block has no items.",location:ka(t,"menu",void 0),blockId:e.id??null})}(e,t,n);break;case"social_link":Ba(e,t,n);break;case"raw_html":!function(e,t,n){const o=e.html;null!=o&&""!==String(o).trim()||wa(n,{severity:"info",code:"raw_html_empty",message:"HTML block has no custom markup; export will include an empty wrapper.",location:ka(t,"raw_html",void 0),blockId:e.id??null})}(e,t,n);break;case"text":Ta(e,t,n,"text",l);break;case"heading":Ta(e,t,n,"heading",l)}})}function Ia({blockList:e,bodySettings:t,aiContentRefs:n={}}){const o=[];return va(t,o),Aa(Array.isArray(e)?e:[],[],o,t,n),o}function $a(){const e="undefined"!=typeof window&&null!=window?window:"undefined"!=typeof global&&null!=global?global:void 0;if(!e)return;const t=e.Image;return"function"==typeof t?t:void 0}const Pa=/^\{\{\s*[\w.]+\s*\}\}$/;function Ra(e){if(null==e||""===String(e).trim())return null;const t=String(e).trim();if(function(e){return null!=e&&"string"==typeof e&&Pa.test(e.trim())}(t))return null;if(/^https?:\/\//i.test(t))return ha(t,!1)?t:null;if(t.startsWith("//")){const e=`https:${t}`;return ha(e,!1)?e:null}return null}function Ma(e,t=[],n=e?.length??0){const o=[];return Array.isArray(e)?(e.forEach((e,l)=>{if(!e||"object"!=typeof e)return;if(!0===e.hidden)return;const a=e.key;if("column"===a){const a=fa(e,l,n),i=[...t,a],r=e.children;return void o.push(...Ma(r,i,r?.length??0))}if("content"===a){const a=n>1?`Column ${l+1} of ${n}`:null,i=a?[...t,a]:t,r=e.children;return void o.push(...Ma(r,i,r?.length??0))}if("image"===a){const n=Ra(e.src);n&&o.push({url:n,location:ka(t,"image",void 0),blockId:e.id??null})}}),o):o}function Da(e,t=12e3){const n=$a();if(!n)return Promise.resolve(!1);const o=String(e).trim();return o?new Promise(e=>{const l=new n;let a=!1;const i=t=>{a||(a=!0,clearTimeout(r),l.onload=null,l.onerror=null,e(t))},r=setTimeout(()=>i(!1),t);l.onload=()=>i(!0),l.onerror=()=>i(!1);try{l.src=o}catch{i(!1)}}):Promise.resolve(!1)}async function Ua(e,t={}){const{timeoutMs:n=12e3,concurrent:o=6}=t;if(!$a())return[];const l=Ma(Array.isArray(e)?e:[]);if(0===l.length)return[];const a=new Map;for(const e of l)a.has(e.url)||a.set(e.url,[]),a.get(e.url).push(e.location);const i=[...a.keys()],r=new Map;let s=0;const c=Math.max(1,Math.min(o,i.length));await Promise.all(Array.from({length:c},()=>async function(){for(;s<i.length;){const e=s++,t=i[e],o=await Da(t,n);r.set(t,o)}}()));const d=[];for(const[e,t]of a)if(!0!==r.get(e))for(const n of t)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:l.find(t=>t.url===e&&t.location===n)?.blockId??null});return d}async function Ea(e,t){return[...Ia(e),...await Ua(e?.blockList??[],t)]}const za=(...e)=>e.filter(Boolean).join(" ");function Fa(e,t){const n=e[t];if(!n||"column"!==n.key)return[];const o=[];for(const t of n.cells||[])for(const n of t.childrenIds||[]){o.push(n);const t=e[n];"column"===t?.key&&o.push(...Fa(e,n))}return o}function Oa(e,t,n){const o=e[n];if(!o)return null;const{containerBlock:l}=Gt(e,t,n);if(!l?.id)return null;const a={...e};if("footer"===l.containerType&&!0!==l.footerUnifiedLayout){if(o.footerBannerSlot||o.footerBannerDividerSlot){a[l.id]={...l,showFooterBanner:!1};for(const t of Fa(e,l.id)){const n=e[t];(n?.footerBannerSlot||n?.footerBannerDividerSlot)&&(a[t]={...n,hidden:!0})}return{nextBlockMap:a}}return o.footerSlot?(a[n]={...o,hidden:!0},{nextBlockMap:a}):null}if("header"===l.containerType){if(o.headerLogoSlot)return a[l.id]={...l,showLogo:!1},a[n]={...o,hidden:!0},{nextBlockMap:a};if(o.headerBannerSlot||o.headerBannerDividerSlot){a[l.id]={...l,showHeaderBanner:!1};for(const t of Fa(e,l.id)){const n=e[t];(n?.headerBannerSlot||n?.headerBannerDividerSlot)&&(a[t]={...n,hidden:!0})}return{nextBlockMap:a}}return null}return null}const Wa={drag_block_here:"Drag block here",drop_content_here:"Drop content here",drop_content_hint:"Drag blocks from the left, or click to insert.",drag_section_here:"Drag section here",blocks:"Blocks",photos:"Photos",powered_by_pexels:"Powered by Pexels",loading:"Loading...",content:"Content",typography:"Typography",styles:"Styles",ai_powered:"AI powered",layout:"Layout",components:"Components",presets:"Presets",body_settings:"Theme Settings",global:"Global",text_and_headings:"Text and headings",pre_header:"Pre-header",pre_header_description:"The pre-header is a short summary text that follows the subject line when viewing an email in the inbox.",confirm:"Confirm",cancel:"Cancel",add_blocks:"Add blocks",block_product:"Product",block_product_single:"Single",block_product_multi:"Multi",block_discount:"Discount",product_output_layout:"Output layout",product_main_layout_stacked:"Image on top, Details below",product_main_layout_image_left:"Image left, Details right",discount_variant_simple:"Simple (one line)",discount_variant_card:"Card (title + code)",additional_products_grid_layout:"Additional products",additional_products_per_row:"Products per row",product_row_count_2:"2 columns",product_row_count_3:"3 columns",block_introduction:"Introduction",block_body:"Body",block_header:"Header",block_footer:"Footer",no_product_found:"No product found",no_products_matching_search:"No products match your search. Clear the search to see the full list.",load_more_products:"Load more",add_products:"Add products",add_products_in_store:"Add products in your store.",column:"Column",columns:"Columns",column_settings:"Column Settings",column_cells_section:"Column cells",column_wrapper_style:"Wrapper style",column_styles:"Column Styles",size_px:"Size",column_delete:"Delete Column",column_delete_desc:"Are you sure you want to delete {{count}} extra columns? ",block_palette_section:"Section",block_palette_columns:"Column",settings_title_column_layout:"Column settings",container:"Section",select_parent_section_tooltip:"Parent section settings — layout, spacing, and background",container_settings:"Section settings",layers_panel:"Layers",email_styles_section:"Email styles",document_section:"Document",body_bg_color_short:"Bg color",body_content_bg_short:"Content bg",body_width_label:"Width",body_font_short:"Font",body_text_short:"Text",body_heading_short:"Heading",body_link_short:"Link",type_styles_section:"Type",container_type:"Section type",container_type_help:"Determines which variables and product mappings are available for this section.",container_type_none:"Default",container_type_header:"Header",container_type_discount:"Discount",container_type_introduction:"Introduction",container_type_body:"Body",container_type_product:"Product",container_type_hero_product:"Hero Product",container_type_additional_product:"Additional Product",container_type_footer:"Footer",product_role:"Product Role",product_role_main_hero:"Primary",product_role_additional:"Secondary",product_column_select_label:"Use system variables",product_column_select_placeholder:"Search or select a product",product_column_variables_heading:"Product field tokens",product_column_kb_heading:"Knowledge base product",product_column_kb_tooltip:"Choose a product from your knowledge base catalog here. This controls which product appears in this column in the email.",text:"Text",text_content:"This is a text, click to edit text",text_settings:"Text Settings",text_styles:"Text Styles",text_align:"Text Align",heading:"Heading",heading_content:"This is a heading, click to edit heading",heading_settings:"Heading Settings",heading_type:"Heading Type",button:"Button",button_settings:"Button Settings",button_action:"Button Action",button_styles:"Button Styles",button_padding:"Button Padding",spacer:"Spacer",spacer_block:"SPACER BLOCK",spacer_settings:"Spacer Settings",divider:"Divider",divider_settings:"Divider Settings",divider_type:"Divider Type",divider_styles:"Divider Styles",image:"Image",image_action:"Image Action",image_url:"Image URL",image_alt:"Image Alt",image_alt_placeholder:"Describe for screen readers",image_styles:"Image Styles",image_settings:"Image Settings",image_crop_soon:"Image cropping is not available yet.",crop:"Crop",replace:"Replace",delete:"Delete",image_max_upload_size:"max 10 MB",video:"Video",video_settings:"Video",video_tab_styles:"Styles",video_tab_display:"Display",video_url:"Video URL",video_thumbnail_url:"Custom thumbnail URL",video_thumbnail_url_placeholder:"Leave empty to use YouTube thumbnail",video_export_note:"Email clients typically show a linked thumbnail, not embedded playback.",video_thumbnail_layout:"Thumbnail layout",video_width:"Width (W)",video_height:"Height (H)",video_fill_column:"Fill column",video_fill_column_mobile:"Fill column on mobile",alignment:"Alignment",video_area_section:"Video area",video_block_section:"Block",video_border_none:"None",image_source:"Image source",image_source_url:"Enter URL",image_source_upload:"Upload image",image_upload:"Upload",image_upload_click:"Click to upload",image_upload_not_configured:"Image upload is not configured. Set imageUploadEndpoint in apiConfig or pass null to disable; defaults use the built-in API base.",image_uploaded:"Image uploaded successfully",image_upload_failed:"Failed to upload image",image_upload_error:"Error uploading image",image_upload_file_hint:"PNG, JPEG, GIF, SVG, WebP · max 10 MB",image_upload_invalid_type:"Use PNG, JPEG, GIF, SVG, or WebP.",uploading:"Uploading…",image_source_variable:"Use variable",menu:"Navigation bar",menu_settings:"Navigation bar Settings",menu_layout:"Menu layout",layout_mode:"Layout mode",nav_only:"Navigation only",stacked:"Stacked",logo_left:"Logo left",logo_right:"Logo right",logo_only:"Logo only",mobile_layout:"Mobile layout",stack:"Stack",inline:"Inline",logo_section:"Logo section",show_logo:"Show logo",logo_url:"Logo URL",logo_text:"Logo text",logo_alt:"Logo alt",logo_link:"Logo link",logo_max_width:"Logo max width",border_bottom:"Border bottom",show_border_bottom:"Show border bottom",font_weight:"Font weight",font_weight_light:"Light",font_weight_regular:"Regular",font_weight_semibold:"Semi-bold",font_weight_bold:"Bold",text_transform:"Text transform",menu_items:"Menu Items",menu_item:"Menu Item",menu_styles:"Menu Styles",add_new_item:"Add New Item",label:"Label",page:"Page",url:"URL",target:"Target",same_tab:"Same Tab",new_tab:"New Tab",separator:"Separator",menu_separator_placeholder:'e.g. " | " or " • "',menu_separator_allowed_hint:"Only these symbols: | • — / · You may add spaces.",menu_link_gap:"Link spacing",menu_underline_links:"Underline links",logo_text_placeholder:"Brand",letter_spacing:"Letter Spacing",link_color:"Link Color",avatar:"Avatar",avatar_settings:"Avatar Settings",avatar_image:"Avatar image",avatar_border_radius:"Border radius",social_link:"Social Link",social_link_settings:"Social Link Settings",add_social_link:"Add Social Link",social_link_size:"Social Link Size",icon_styles:"Icon styles",icon_size:"Icon size",icon_size_small:"Small",icon_size_medium:"Medium",icon_size_large:"Large",icon_color:"Icon color",icon_color_default:"Default",icon_color_white:"White",icon_color_black:"Black",icon_color_gray:"Gray",social_icon_spacing:"Icon spacing",social_links:"Social Links",social_platform_x:"X",social_platform_formerly_twitter:"Formerly Twitter",social_platform_x_alt:"X, formerly Twitter",social_link_placeholder_facebook:"https://www.facebook.com/yourpage",social_link_placeholder_linkedin:"https://www.linkedin.com/company/yourcompany",social_link_placeholder_instagram:"https://www.instagram.com/yourhandle",social_link_placeholder_tiktok:"https://www.tiktok.com/@yourhandle",social_link_placeholder_x:"https://x.com/yourhandle",social_link_placeholder_youtube:"https://www.youtube.com/yourchannel",social_link_placeholder_pinterest:"https://www.pinterest.com/yourprofile",social_link_placeholder_generic:"https://example.com",social_settings_icons:"Icons",social_settings_style:"Style",social_platform_field:"Platform",social_icon_label_field:"Label",social_custom_icon:"Custom icon",social_add_icon:"Add platform",social_platform_custom:"Custom",social_icon_size_px:"Size",collapse:"Collapse",expand:"Expand",raw_html:"HTML",raw_html_block:"Email-safe HTML",raw_html_block_description:"Prefer table-based layouts and inline CSS for client compatibility.",raw_html_settings:"HTML Settings",raw_html_code_label:"Code",raw_html_code_hint:"Inserted as-is in the exported email. Test in major clients before you send.",raw_html_default_content:'<p style="text-align:center;color:#A3A3A3;font-size:12px">Add custom HTML here</p>',raw_html_appearance:"Layout",raw_html_clear_background:"Clear",raw_html_email_client_warning:"Custom HTML may render inconsistently across email clients. Test thoroughly.",raw_html_info_tooltip_aria:"More about email-safe HTML",content_background_color:"Content Background Color",container_background_image_title:"Section background image",container_background_image_section_title:"Section background image",container_background_image_section_toggle:"Show section background image",container_background_image_layout_group:"Image layout",container_background_image_row_label:"Background image",container_background_image_intro:"Blocks you add to this section (text, buttons, images, etc.) appear on top of the image. Drag components from the palette into the section on the canvas.",container_background_image_tooltip_p1:"Uses a background image on the section table (email-client friendly — not CSS position:absolute).",container_background_image_tooltip_p2:"Use “Content background color” for a tint behind blocks, or set it transparent so only the photo shows through.",container_background_image_enable:"Enable background image",container_background_image_url:"Image URL",container_background_image_upload:"Upload image",container_background_image_upload_click:"Drag and drop or select image",container_background_image_file_hint:"Accepts .png, .jpg, .jpeg, .gif, and .webp. Maximum file size 10 MB.",container_background_image_select_button:"Select image",container_background_image_clear:"Remove background image",container_background_image_size:"Image fit",container_background_image_position:"Focal point",container_bg_size_cover:"Cover",container_bg_size_contain:"Contain",container_bg_size_fill:"Fill",image_file_too_large:"Image must be 10 MB or smaller.",container_bg_image_url_error_blocked_scheme:"This URL uses a blocked protocol. Use only http:// or https:// for images.",container_bg_image_url_error_duplicate_protocol:"The URL repeats the protocol. Use a single https:// prefix.",container_bg_image_url_error_hostname:"Use a full URL with a valid hostname (e.g. https://cdn.example.com/photo.jpg).",container_bg_image_url_error_invalid_protocol:"Unsupported protocol. Use http:// or https:// for image URLs.",container_bg_image_url_error_generic:"Invalid image URL format.",container_bg_image_preview_failed:"Could not load a preview for this URL. It may not be an image, or the host blocked the request.",image_text_overlay:"Text overlay",overlay_multi_item:"Multi-item stack",add_overlay_item:"Add overlay item",drag_to_move:"Drag to move",overlay_max_width:"Overlay max width",item_gap:"Item gap",scrim:"Scrim",text_shadow:"Text shadow",fill_column:"Fill column",image_text_overlay_tip:"Optional caption drawn on top of the image in the editor. For full layouts over a photo, use a section background image instead.",image_text_overlay_container_tip:"Select the section → Styles → Section background image, then drag text and buttons into that section.",image_text_overlay_enable:"Enable text overlay",image_overlay_caption:"Caption",image_overlay_caption_placeholder:"Short line of text…",image_overlay_position:"Caption position",image_overlay_pos_tl:"Top left",image_overlay_pos_tc:"Top center",image_overlay_pos_tr:"Top right",image_overlay_pos_ml:"Middle left",image_overlay_pos_mc:"Middle center",image_overlay_pos_mr:"Middle right",image_overlay_pos_bl:"Bottom left",image_overlay_pos_bc:"Bottom center",image_overlay_pos_br:"Bottom right",image_overlay_box_bg:"Caption box background (CSS)",image_overlay_padding:"Caption padding",background_color:"Background Color",text_color:"Text Color",email_theme_background_color:"Email Theme Background Color",font_color:"Font Color",button_color:"Button Color",divider_color:"Divider Color",action_type:"Action Type",content_background:"Content background",heading_color:"Heading color",top:"Top",right:"Right",left:"Left",bottom:"Bottom",line_height:"Line Height",link:"Link",link_url:"Link URL",link_url_placeholder:"example.com",padding_settings:"Padding Settings",width:"Width",height:"Height",width_auto:"Width Auto",auto_width:"Auto Width",font_size:"Font Size",font_family:"Font Family",solid:"Solid",dotted:"Dotted",dashed:"Dashed",align:"Align",spacing:"Spacing",border_radius:"Border radius",link_all_sides:"Link all sides",padding_link_sides_label:"Same padding on all sides",padding_link_sides_tooltip:"When on, one value updates top, right, bottom, and left together. Turn off to set each side separately.",email_width_mode:"Width",email_width_default:"Email-width (default)",custom_px:"Custom px",custom_width_px:"Custom width",full_bleed:"Full bleed",full_bleed_tooltip:"Extends edge-to-edge in clients that support it; clipped to email-width otherwise.",export_html:"Export HTML",export_json:"Export JSON",export_checking_images:"Checking images…",export_validation_title:"Export validation",export_validation_issues_found:"Issues found before export",export_validation_errors:"Errors",export_validation_warnings:"Warnings",export_validation_info:"Info",export_anyway:"Export anyway",ignore:"Ignore",validation_body_content_width_invalid:"Body content width must be between 280 and 1200 px.",validation_body_background_color_missing:"Theme background color is missing.",validation_body_text_color_missing:"Theme text color is missing.",validation_body_font_family_missing:"Theme font family is missing.",validation_image_empty_src:"Image URL is empty; the image will not display.",validation_image_invalid_src:"Image URL format is invalid.",validation_image_invalid_link:"Image link URL format is invalid.",validation_image_url_not_loadable:"Image URL could not be loaded or previewed; the link may be broken, expired, or blocked.",validation_image_empty_alt:"Image alt text is empty; consider adding for accessibility.",validation_avatar_empty_src:"Avatar image URL is empty; avatar will not display.",validation_avatar_invalid_src:"Avatar image URL format is invalid.",validation_avatar_invalid_link:"Avatar link URL format is invalid.",validation_button_empty_link:'Button link URL is empty; will be saved as href="https://".',validation_button_invalid_link:"Button link URL format is invalid.",validation_button_blocked_scheme:"Button link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s), mailto:, or tel: only.",validation_button_label_invalid_link:"Button label link URL format is invalid.",validation_button_label_blocked_link_scheme:"Button label link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s), mailto:, or tel: only.",validation_rich_text_link_invalid:"Rich text hyperlink URL format is invalid.",validation_rich_text_link_blocked_scheme:"Rich text link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s), mailto:, or tel: only.",validation_menu_no_items:"Navigation bar has no links.",validation_raw_html_empty:"HTML block has no custom markup; export will include an empty wrapper.",validation_social_empty_link:'Social link URL is empty; will be saved as href="https://".',validation_social_invalid_link:"Social link URL format is invalid.",validation_social_blocked_scheme:"Social link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s) only (e.g. www.example.com or https://…).",validation_social_empty_icon:"Social link icon URL is empty; icon will not display.",validation_social_invalid_icon:"Social link icon URL format is invalid.",validation_social_no_links:"Social link block has no links.",validation_social_duplicate_platform:"Duplicate social platform in this block; only one entry per platform should be kept.",validation_container_product_not_assigned:"A product is not assigned to this column; assign a product in Section settings.",validation_dynamic_content_empty:"Dynamic content not generated; export will use static text if available.",validation_text_invalid_link:"Text link URL format is invalid.",validation_text_blocked_link_scheme:"Text link uses a blocked URL scheme (javascript:, data:, etc.). Use http(s), mailto:, or tel: only.",tooltip_bold:"Bold",tooltip_italic:"Italic",tooltip_underline:"Underline",tooltip_strikethrough:"Strikethrough",tooltip_align_left:"Align left",tooltip_align_center:"Align center",tooltip_align_right:"Align right",tooltip_ordered_list:"Ordered list",tooltip_unordered_list:"Unordered list",tooltip_link:"Link",tooltip_remove_link:"Remove link",add_link_modal_title:"Add link",content_type:"Content type",content_type_static:"Static",content_type_dynamic:"Dynamic",ai_enabled:"Write using AI",text_ai_mode_manual_edit_title:"Can't edit this text here",text_ai_mode_manual_edit_disabled:"AI writing is on for this block, so the text isn't editable on the canvas. In the right panel, turn off “Write using AI” to edit manually.",text_and_content_type:"Content type",heading_or_body:"Heading",body_paragraph:"Body",heading_h1:"H1",heading_h2:"H2",heading_h3:"H3",heading_h4:"H4",variables:"Variables",insert_merge_field:"Select or type variable...",dynamic_prompt_help:"Write your prompt",ai_output_language:"AI output language",ai_output_language_en:"English",ai_output_language_bn:"Bengali",generate:"Generate",ml_generation_failed:"Could not generate AI content",ml_ai_unavailable:"AI generation needs a column layout, company ID, template ID, and ML endpoint. Open this text inside a section column and check apiConfig.",ml_no_variations:"No suggestions were returned. Try another prompt or verify the template exists on the server.",ml_generation_unexpected_error:"Something went wrong while generating content.",sample_ai_content:"Sample AI content",select_content:"Select content",variable_dynamic_placeholder:"None (optional)",variable_display_text:"Display text",variable_introduction:"Introduction",variable_heading:"Heading",variable_subheading:"Subheading",variable_products_description:"Products description",variable_customer_name:"Customer Name",variable_introduction_title:"Introduction Title",variable_introduction_subtitle:"Introduction Subtitle",variable_body_title:"Body Title",variable_body_subtitle:"Body Subtitle",variable_discount_value:"Discount value",variable_discount_code:"Discount code",variable_valid_until:"Valid until",variable_company_name:"Company name",variable_brand_name:"Brand name",variable_address:"Address",variable_website:"Website",variable_logo_url:"Logo URL",variable_tagline:"Tagline",variable_nav_label:"Nav link label",variable_nav_url:"Nav link URL",variable_product_name:"Product name",variable_product_description:"Product description",variable_product_image:"Product image URL",variable_product_link:"Product link",variable_product_price:"Product price",variable_product_currency:"Product currency",variable_product_old_price:"Product old price",variable_product_new_price:"Product new price",variable_product_price_display:"Product price display",variable_image_logo:"Logo",variable_image_hero_banner:"Hero banner",variable_image_footer_banner:"Footer banner",variable_image_product_image:"Product image",variable_cta_label:"CTA label",variable_cta_url:"CTA URL",button_label_variable:"Button label (variable)",button_url_variable:"Use variable",button_text:"Button text",button_label_manual:"Enter label",button_url_manual:"Enter URL",use_company_social_links:"Use company social links",use_navigation_links:"Use navigation links",tooltip_container_type:"Determines which variables and product mappings are available for this section.",tooltip_variables_static:"Insert a merge field into your content. It will be replaced when the email is sent.",tooltip_dynamic_prompt:"Describe the tone or intent; we'll suggest sample content. (Preview mode — connect an AI API for real generation.)",tooltip_write_using_ai:"When on, choose output language and write a prompt to generate variants. Requires ML/API when connected.",tooltip_write_using_ai_unavailable:"AI authoring is disabled for this editor. Enable it from the host app or API options to use Write using AI.",label_align:"Align",label_padding:"Padding",section_background_group:"SECTION BACKGROUND",section_bg_mode:"Type",section_bg_color:"Color",section_bg_image:"Image",section_bg_none:"None",section_content_area_group:"CONTENT AREA",content_area_color:"Content color",content_color_auto:"Auto",content_color_custom:"Custom",shortcuts_modal_title:"Keyboard shortcuts",shortcuts_modal_footnote:"Shortcuts are disabled while typing in text fields inside the settings panel, so you can edit URLs and copy/paste normally.",shortcut_save:"Save (handled by the host page when connected)",shortcut_undo:"Undo",shortcut_redo:"Redo",shortcut_duplicate:"Duplicate selected block",shortcut_copy_block:"Copy selected block",shortcut_paste_block:"Paste block",shortcut_delete_block:"Delete selected block",shortcut_escape:"Deselect block",shortcut_cheat_sheet:"Open this help",shortcut_delete_confirm_title:"Delete this section?",shortcut_delete_confirm_desc:"This section has content blocks inside. Delete it anyway?",section_nest_not_allowed:"Sections cannot be placed inside another section. Drop between sections in the stack.",context_duplicate:"Duplicate",context_copy:"Copy",context_cut:"Cut",context_paste:"Paste",context_delete:"Delete",context_move_up:"Move up",context_move_down:"Move down",context_save_global:"Save as Global Element",context_reset_styles:"Reset styles",topbar_back_to_templates:"Templates",topbar_exit:"Exit",topbar_breadcrumb_email:"Email",topbar_rename_template:"Rename template",topbar_untitled_template:"Untitled template",send_test:"Send test",preview:"Preview",html_email_preview:"HTML preview",html_email_preview_title:"HTML Email Preview",html_email_preview_device_aria:"HTML preview device width",html_email_preview_error:"Could not generate the HTML preview. Check the console for details.",save_template:"Save template",more_actions:"More actions",keyboard_shortcuts:"Keyboard shortcuts",high_contrast_on:"High contrast on",high_contrast_off:"High contrast off",desktop:"Desktop",mobile:"Mobile",undo:"Undo",redo:"Redo",save_state_saved:"Saved",save_state_saving:"Saving…",save_state_unsaved:"Unsaved",save_state_error:"Save failed",export_validation_open_block:"Open block",save:"Save",template_name:"Template name",save_template_title:"Save template",save_template_category:"Category",save_template_category_placeholder:"Select or type a category…",category_promotional:"Promotional",category_transactional:"Transactional",category_newsletter:"Newsletter",category_onboarding:"Onboarding",category_announcement:"Announcement",category_other:"Other",send_test_title:"Send test email",send_test_send:"Send test",send_test_recipients:"Recipients",send_test_recipients_placeholder:"name@example.com, another@example.com",send_test_recipients_hint:"Press Enter or comma to add each address.",send_test_payload:"Payload context",send_test_payload_none:"No payload",send_test_payload_profile:"Profile data",send_test_payload_event:"Event data",send_test_prefix_label:"[TEST] prefix",send_test_prefix_hint:"Prepends [TEST] to the subject line.",universal:"Universal",layers:"Layers",document:"Document",layer_one:"block",layer_many:"blocks",layer_move_up:"Move up",layer_move_down:"Move down",layer_duplicate:"Duplicate",layer_delete:"Delete",universal_saved_blocks:"Saved blocks",universal_empty_state_line_1:"No universal content yet. Click",universal_empty_state_line_2:"on any block to save it for reuse across templates.",universal_used_in_count:"used in {{count}}",compliance:"Compliance",compliance_preflight:"Pre-flight",compliance_all_clear_title:"Ready to send",compliance_all_clear_desc:"All compliance checks pass.",compliance_severity_error:"Error",compliance_severity_warning:"Warning",compliance_severity_info:"Info",compliance_tab_badge_label:"Unresolved issues: {{count}}",compliance_email_size:"Email size (HTML)",compliance_above_clip:"Above Gmail clip threshold",compliance_near_clip:"Approaching clip threshold",compliance_below_clip:"Below Gmail clip threshold",compliance_clip_reason_over:"Gmail will clip this email. Reduce content or remove large blocks.",compliance_clip_reason_near:"Close to Gmail's 102 KB clip limit. Consider trimming content.",compliance_clip_reason_raw_html:"{{n}} raw HTML block(s) — custom HTML is included verbatim and can significantly inflate email size.",right_panel_empty_hint:"Click any block in the canvas to edit its specific settings. Drag blocks from the left rail to add new content.",right_panel_back:"Back",layer_show:"Show",layer_hide:"Hide",save_as_universal:"Save as universal",universal_save_modal_title:"Save as universal block",universal_save_modal_subtitle:"Reusable across templates. Edits won't affect already-sent emails.",universal_save_modal_placeholder:"e.g. Beantown footer",universal_save_modal_confirm:"Save block",universal_save_success:'Saved "{{name}}" as universal block',universal_save_error:"Could not save the universal block. Check your connection and try again.",universal_delete:"Remove",universal_delete_confirm_title:"Remove saved block?",universal_delete_confirm_body:"This removes the block from your saved library. Existing emails are not changed.",universal_delete_confirm_ok:"Remove",configure_columns_title:"Configure columns",configure_columns_subtitle:"Pick a layout. Each column starts empty so you can drag blocks into it.",configure_columns_insert:"Insert section",configure_columns_hint:"click to configure layout",configure_columns_row_count:"Rows to insert:",standard_layout:"Standard",grid_layout:"6/12 Grid",grid_settings:"Grid",grid_rows_locked_hint:"Email layouts use one row of columns.",columns_layout:"Columns layout",column_sizes:"Column widths (%)",show_more:"Show more",show_less:"Show less",col:"Col",gaps:"Gaps",column_gap:"Column gap",button_variant:"Variant",full_width:"Full width",hover_bg_color:"Hover background",hover_text_color:"Hover text",text_decoration:"Decoration",shadow:"Shadow",shadow_preset:"Preset",table:"Table",table_settings:"Table settings",footer_settings:"Footer settings",compliance_approx_kb:"{{n}} KB",cell_content:"Cell content",add_link_url:"URL",add_link_url_placeholder:"https://example.com",add_link_display_text:"Display text",add_link_display_text_placeholder:"Leave blank to keep selected text",add_link_display_text_empty_badge:"No text — link will use selected text",add_link_open_new_tab:"Open in new tab",align_left:"Align left",align_center:"Align center",align_right:"Align right",minimize_toolbar:"Collapse",close_text_editor:"Exit text editing",unlink_universal:"Unlink this copy",unlink_modal_title:"Edit universal block",unlink_modal_keep:"Keep linked",unlink_modal_unlink:"Unlink this copy",unlink_modal_body:"This block is linked to a universal snippet. Editing it here will affect all uses of this block everywhere.",unlink_modal_body2:"Choose “Unlink this copy” to make an independent copy that only affects this template, or “Keep linked” to edit all instances together.",custom:"Custom",custom_color:"Custom color",show_text_label:"Show label",mobile_optimization:"Mobile optimization",stack_columns_on_mobile:"Stack columns on mobile",product_recommendations_section:"Product recommendations",fill_product_slots_label:"Suggest more products",fill_product_slots_on_hint:"We’ll fill empty product areas using cart items, browsing history, and smart recommendations.",fill_product_slots_off_hint:"Only products already in the recipient’s cart will appear. Other product blocks may stay empty.",fill_product_slots_tooltip_title:"Suggest more products",fill_product_slots_tooltip_on_heading:"When this is on",fill_product_slots_tooltip_on_body:"Each product block is filled automatically, in order: items in cart, recently viewed, cross-sell, upsell, deals, then popular picks.",fill_product_slots_tooltip_off_heading:"When this is off",fill_product_slots_tooltip_off_body:"Only cart items count. If there’s nothing in the cart for a slot, that product area is left out of the email.",fill_product_slots_tooltip_watch_heading:"Before you turn this off",fill_product_slots_tooltip_watch_1:"Headlines or intro text can sit above an empty product row.",fill_product_slots_tooltip_watch_2:"Cross-sell and upsell recommendations won’t run.",fill_product_slots_tooltip_watch_3:"Previews and sent emails may show gaps where products were expected.",scale_font_on_mobile:"Scale font on mobile",section_layout:"Section Layout",content_max_width:"Content max-width",content_max_width_option_full:"Full width",min_height:"Min height",border:"Border",border_style:"Border style",border_width:"Border width",border_color:"Border color",visibility:"Visibility",hidden_on_mobile:"Hide on mobile",canvas_hidden_on_mobile:"Hidden on mobile",table_structure:"Table Structure",rows:"Rows",header_row:"Header row",header_column:"Header column",cell_selector:"Cell selector",cell_content_type:"Cell content type",table_style:"Table style",cell_padding:"Cell padding",header_style:"Header style",header_background:"Header background",header_text_color:"Header text color",striped_rows:"Striped rows",stripe_color:"Stripe color",table_structure_mode:"Mode",table_mode_static:"Static",table_mode_dynamic:"Dynamic",table_dynamic_structure_hint:"Export still uses static HTML; data-driven tables may be wired in a future update.",table_add_row:"Add row",table_add_column:"Add column",table_decrease_rows:"Decrease row count",table_increase_rows:"Increase row count",table_decrease_cols:"Decrease column count",table_increase_cols:"Increase column count",table_selected_cell:"Selected: row {{row}}, col {{col}}",table_select_cell_hint:"Select a cell in the grid to edit its content.",table_cell_grid_truncated:"Showing first {{rows}} × {{cols}} cells",table_cell_text_placeholder:"Cell text…",table_align_left:"Left",table_align_center:"Center",table_align_right:"Right",footer_visible_lines:"Visible lines",footer_toggle_brand_name:"Brand name",footer_toggle_tagline:"Tagline",footer_toggle_address:"Address",footer_toggle_unsubscribe:"Unsubscribe",footer_toggle_social_row:"Social row",footer_toggle_secondary_links:"Secondary links",footer_toggle_copyright:"Copyright",footer_native_social_hint:"To edit individual platforms and icons, turn off company links above or select the social row on the canvas.",footer_company_social_managed_note:"Icons and profile URLs come from your company data (same as the live preview). Turn off the switch above to customize platforms for this template only.",footer_company_social_url_empty:"No URL in company data",footer_content_heading:"Content",footer_label_brand:"Brand",footer_unsubscribe_body_text:"Body text",footer_unsubscribe_link_label:"Link text",footer_secondary_links_heading:"Secondary links",footer_secondary_link_text:"Link text",footer_secondary_link_url:"URL",footer_new_link_label:"New link",footer_add_link:"Add link",footer_social_platforms_heading:"Social platforms",footer_platform_label:"Platform",footer_social_profile_url:"Profile URL",footer_upload_icon:"Upload icon",footer_add_platform:"+ Add platform",footer_style_heading:"Style",footer_text_color:"Text",footer_link_color:"Link",footer_background_content:"Background",footer_column_background:"Column background",footer_align:"Align",footer_border_heading:"Border",footer_divider_above:"Divider above",footer_border_top:"Border top",footer_border_top_color:"Border top color",footer_social_instagram:"Instagram",footer_social_facebook:"Facebook",footer_social_twitter:"Twitter",footer_social_linkedin:"LinkedIn",footer_social_youtube:"YouTube",footer_social_tiktok:"TikTok",footer_social_custom_icon:"Custom icon",footer_sections:"Footer sections",footer_brand_name_placeholder:"Your brand",footer_brand_tagline_placeholder:"Your tagline",footer_address_placeholder:"123 Main St, City, Country",footer_unsubscribe_url_placeholder:"{{unsubscribe_url}}",footer_copyright_placeholder:"© {{year}} Your Company",footer_default_unsubscribe_text:"Unsubscribe",show_brand:"Brand",brand_name:"Brand name",brand_tagline:"Tagline",show_address:"Address",address:"Address text",show_unsubscribe:"Unsubscribe link",unsubscribe_text:"Link text",unsubscribe_url:"Unsubscribe URL",show_social:"Social icons",social_icons_hint:"Configure social icons in the block's content settings.",show_secondary_links:"Secondary links",show_copyright:"Copyright",copyright_text:"Copyright text",footer_style:"Footer style",padding_top:"Top padding",padding_bottom:"Bottom padding",show_divider:"Show divider",header_settings:"Header settings",discount_settings:"Discount settings",discount_show_title:"Show title",preset_discount_simple:"Discount (simple line)",style:"Style",navigation:"Navigation",link_style:"Link style",color:"Color",size:"Size",weight:"Weight",transform:"Transform",gap:"Gap",underline:"Underline",title:"Title",add_link:"Add link",font_weight_medium:"Medium",nav_text_transform_sentence:"Sentence case",nav_text_transform_uppercase:"Uppercase",nav_text_transform_capitalize:"Capitalize",placeholder_https:"https://…",brand_name_placeholder:"Brand name",logo_padding:"Logo padding",default_nav_link_label:"Link",navigation_link_placeholder_url:"#",container_variables_none_available:"No variables available for this container type.",header_layout_logo_left_nav_right:"Logo left, Navigation right",header_layout_logo_right_nav_left:"Logo right, Navigation left",header_layout_logo_center_nav_below:"Logo centered, Navigation below",header_layout_logo_only:"Logo only",header_layout_nav_only:"Navigation only",header_banner_section:"Header banner",show_header_banner:"Show header banner",footer_banner_section:"Footer banner",show_footer_banner:"Show footer banner",border_none:"None",discount_code_section:"Promo code",discount_code_background:"Code background",discount_code_corner_radius:"Code corner radius",column_preset_1_col:"1 col",column_preset_equal_2:"Equal 2",column_preset_equal_3:"Equal 3",column_preset_equal_4:"Equal 4",column_preset_1_2:"1 / 2",column_preset_2_1:"2 / 1",column_preset_1_3:"1 / 3",column_preset_3_1:"3 / 1",column_preset_2_3:"2 : 3",column_preset_3_2:"3 : 2",column_preset_1_2_1:"1 / 2 / 1",column_preset_2_1_1:"2 / 1 / 1",column_preset_1_1_2:"1 / 1 / 2",column_preset_2_4_2_4:"2-4 · 2-4",column_preset_4_2_4_2:"4-2 · 4-2"},ja=()=>{const{language:e,languageLibraries:t}=n(Ln);let o={en:Wa};t&&(o={...o,...t,en:{...Wa,...o.en||{}}});return{t:(t,n)=>{let l=(o[e]||{})[t];return n&&n instanceof Object&&Object.keys(n).forEach(e=>{l=l.replace(`{{${e}}}`,n[e])}),l||t}}};function Ha(e){return"string"!=typeof e?e:e.replace(/\u202E/g,"").replace(/\u202D/g,"").replace(/\u202A/g,"").replace(/\u202B/g,"").replace(/\u202C/g,"").replace(/\sdir\s*=\s*["']rtl["']/gi,' dir="ltr"').replace(/\sstyle\s*=\s*["']([^"']*)["']/gi,(e,t)=>{const n=String(t||"").replace(/\s*direction\s*:\s*rtl\s*;?/gi,"").trim();return n?` style="${n}"`:""})}function Ka(e){if("string"!=typeof e||!e)return{masked:e||"",tokens:[]};const t=[];return{masked:e.replace(/\{\{[^{}]+\}\}/g,e=>(t.push(e),`${t.length-1}`)),tokens:t}}function Va(e,t){if("string"!=typeof e||!t.length)return e;let n=e;for(let e=t.length-1;e>=0;e--){const o=`${e}`;n=n.split(o).join(t[e])}return n}let Ga=0;function qa(t){if("function"!=typeof t)return;const n="undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():Date.now();if(n-Ga<2200)return;Ga=n;const o=e.createElement(B,{icon:A,style:{fontSize:24,color:"#93c5fd"},"aria-hidden":!0});m.open({key:"ee-text-ai-readonly-hint",icon:o,message:e.createElement("span",{style:{fontSize:15,fontWeight:700,color:"#fafafa",letterSpacing:"0.01em"}},t("text_ai_mode_manual_edit_title")),description:e.createElement("span",{style:{fontSize:13,lineHeight:1.55,color:"#e5e5e5"}},t("text_ai_mode_manual_edit_disabled")),duration:8,placement:"top",top:72,className:"ee-ai-readonly-notification",style:{width:380,maxWidth:"min(380px, calc(100vw - 32px))"}})}function Ja(e){return e&&"text"===e.key&&"dynamic"===e.contentType}const Ya=/\{\{(\w+)\}\}/g;function Xa(e,t){if(null!=e)if("string"!=typeof e){if(Array.isArray(e))e.forEach(e=>Xa(e,t));else if("object"==typeof e){if(void 0!==e.$$typeof)return;Object.values(e).forEach(e=>Xa(e,t))}}else(function(e){if("string"!=typeof e||0===e.length)return[];const t=[];let n;for(;null!==(n=Ya.exec(e));){const e=n[1];e&&t.push(e)}return Ya.lastIndex=0,t})(e).forEach(e=>t.add(e))}function Za(e,t,n){e&&"object"==typeof e&&(e.id&&n.has(e.id)||(e.id&&n.add(e.id),"column"!==e.key?Xa(e,t):(e.children||[]).forEach(e=>{(e?.children||[]).forEach(e=>Za(e,t,n))})))}function Qa(e,t,n,o){if(!e||o.has(e))return;o.add(e);const l=t[e];l&&"object"==typeof l&&("column"===l.key?(l.cells||[]).forEach(e=>{(e.childrenIds||[]).forEach(e=>Qa(e,t,n,o))}):Xa(l,n))}function ei(e,t){const n=new Set;if(!e||"object"!=typeof e)return n;if(Array.isArray(e.children)){const t=new Set;return Za(e,n,t),n}if(!t||"object"!=typeof t)return n;const o=new Set;return(e.cells||[]).forEach(e=>{(e.childrenIds||[]).forEach(e=>Qa(e,t,n,o))}),n}const ti=()=>{const e=(t,n)=>t?t.classList?.contains("text-content_editable")?null:t&&t.tagName?.toLocaleLowerCase()===n?t:e(t.parentNode,n):null,t=o((e,n)=>e?e.classList?.contains("text-content_editable")?null:e&&e.style?.[n]?e.style[n]:t(e.parentNode,n):null,[]);return{getSelectionNode:e,getSectionStyle:t}},ni=({modifyText:e,setTextContent:t})=>{const{selectionRange:o}=n(Ln),{getSelectionNode:a}=ti(),{t:i}=ja(),r=l(()=>o?a(o.commonAncestorContainer,"b"):null,[o,a]);return qe("button",{className:za("rich-text-tools-button ",r&&"rich-text-tools-button-active"),title:i("tooltip_bold"),onClick:()=>{e("bold",!1,null),t()},children:qe(B,{icon:I,className:"rich-text-tools-button-icon"})})};function oi(e,t){if(!e)return!1;const n=e.commonAncestorContainer;if(!function(e){let t=e;for(t&&3===t.nodeType&&(t=t.parentElement);t;){if(t.classList?.contains("text-content_editable"))return!0;t=t.parentNode}return!1}(n))return!1;try{if(document.queryCommandState("italic"))return!0}catch{}return!("function"!=typeof t||!t(n,"i")&&!t(n,"em"))||function(e){let t=e;for(t&&3===t.nodeType&&(t=t.parentElement);t&&!t.classList?.contains("text-content_editable");){if(1===t.nodeType){const e=t.tagName?.toLowerCase();if("i"===e||"em"===e)return!0;const n=t.style?.fontStyle;if("italic"===n||"oblique"===n)return!0;try{if("undefined"!=typeof window&&window.getComputedStyle){const e=window.getComputedStyle(t).fontStyle;if("italic"===e||"oblique"===e)return!0}}catch{}}t=t.parentNode}return!1}(n)}const li=({modifyText:e,setTextContent:t})=>{const{selectionRange:o}=n(Ln),{getSelectionNode:l}=ti(),{t:a}=ja(),i=oi(o,l);return qe("button",{className:za("rich-text-tools-button ",i&&"rich-text-tools-button-active"),title:a("tooltip_italic"),onClick:()=>{try{document.execCommand("styleWithCSS",!1,!0)}catch{}e("italic",!1,null),t()},children:qe(B,{icon:$,className:"rich-text-tools-button-icon"})})},ai=({modifyText:e,setTextContent:t})=>{const{selectionRange:o}=n(Ln),{getSelectionNode:a}=ti(),{t:i}=ja(),r=l(()=>o?a(o.commonAncestorContainer,"u"):null,[o,a]);return qe("button",{className:za("rich-text-tools-button ",r&&"rich-text-tools-button-active"),title:i("tooltip_underline"),onClick:()=>{e("underline",!1,null),t()},children:qe(B,{icon:P,className:"rich-text-tools-button-icon"})})},ii=({modifyText:e,setTextContent:t})=>{const{selectionRange:o}=n(Ln),{getSelectionNode:a}=ti(),{t:i}=ja(),r=l(()=>o?a(o.commonAncestorContainer,"strike"):null,[o,a]);return qe("button",{className:za("rich-text-tools-button ",r&&"rich-text-tools-button-active"),title:i("tooltip_strikethrough"),onClick:()=>{e("strikethrough",!1,null),t()},children:qe(B,{icon:R,className:"rich-text-tools-button-icon"})})},ri=({modifyText:e,setTextContent:t})=>{const{selectionRange:o}=n(Ln),{getSelectionNode:a}=ti(),{t:i}=ja(),r=l(()=>o?a(o.commonAncestorContainer,"ol"):null,[o,a]);return qe("button",{className:za("rich-text-tools-button ",r&&"rich-text-tools-button-active"),title:i("tooltip_ordered_list"),onClick:()=>{e("insertOrderedList",!1,null),t()},children:qe(B,{icon:M,className:"rich-text-tools-button-icon"})})},si=({modifyText:e,setTextContent:t})=>{const{selectionRange:o}=n(Ln),{getSelectionNode:a}=ti(),{t:i}=ja(),r=l(()=>o?a(o.commonAncestorContainer,"ul"):null,[o,a]);return qe("button",{className:za("rich-text-tools-button ",r&&"rich-text-tools-button-active"),title:i("tooltip_unordered_list"),onClick:()=>{e("insertUnorderedList",!1,null),t()},children:qe(B,{icon:D,className:"rich-text-tools-button-icon"})})},ci=({modifyText:e,setTextContent:t})=>{const{selectionRange:r}=n(Ln),{t:s}=ja(),{getSelectionNode:c}=ti(),[d,u]=a(!1),[p,m]=a({value:"",range:null}),[f,_]=a(""),[k,v]=a(!0),w=i(null),x=l(()=>r?c(r.commonAncestorContainer,"a"):null,[r,c]),S=o(()=>{u(!1),m({value:"",range:null}),_(""),v(!0)},[]),C=o(()=>{const{range:e,value:n,rangeIsLink:o}=p;if(e){if(o){const t=e.commonAncestorContainer,o=1===t.nodeType&&"A"===t.nodeName?t:t.parentNode&&"A"===t.parentNode.nodeName?t.parentNode:null;o&&(o.setAttribute("href",n),o.target=k?"_blank":"_self",f.trim()&&(o.textContent=f.trim()))}else{const t=document.createElement("a");if(t.target=k?"_blank":"_self",t.setAttribute("href",n),f.trim())t.textContent=f.trim(),e.deleteContents(),e.insertNode(t);else try{e.surroundContents(t)}catch{return void S()}}t(),S()}else S()},[p,f,k,t,S]);return Je(Ye,{children:[qe("button",{className:za("rich-text-tools-button ",x&&"rich-text-tools-button-active"),title:s("tooltip_link"),onClick:e=>{let n=window.getSelection(),o=n.getRangeAt(0);const l=o.commonAncestorContainer.parentNode,a="A"===l.nodeName,i={...p,range:o};let r="",s=!0;if(a){i.rangeIsLink=!0;const e=l.getAttribute("href"),t=null!=e?String(e).trim():"";i.value=""!==t?t:String(l.href||"").trim(),r=l.textContent||"",s="_self"!==l.target}else{r=n.toString()}const c=e?.currentTarget?.closest?.(".email-editor");c&&(w.current=c),m(i),_(r),v(s),u(!0),t()},children:qe(B,{icon:U,className:"rich-text-tools-button-icon"})}),qe("button",{className:za("rich-text-tools-button"),title:s("tooltip_remove_link"),onClick:()=>{e("unlink",!1,null),t()},children:qe(B,{icon:E,className:"rich-text-tools-button-icon"})}),qe(g,{title:s("add_link_modal_title"),open:d,zIndex:1100,getContainer:()=>"undefined"==typeof document?null:w.current||document.querySelector(".email-editor")||document.body,onOk:C,onCancel:S,okText:s("confirm"),cancelText:s("cancel"),wrapClassName:"ee-modal-dark",children:Je("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[Je("div",{children:[qe("div",{style:{marginBottom:4,fontSize:12,fontWeight:500},children:s("add_link_url")||"URL"}),qe(h,{value:p.value??"",placeholder:s("add_link_url_placeholder")||s("link_url_placeholder")||"https://example.com",onChange:e=>m({...p,value:e.target.value})})]}),Je("div",{children:[Je("div",{style:{marginBottom:4,display:"flex",alignItems:"center",flexWrap:"wrap",gap:8},children:[qe("span",{style:{fontSize:12,fontWeight:500},children:s("add_link_display_text")||"Display text"}),f.trim()?null:qe(y,{status:"warning",text:s("add_link_display_text_empty_badge"),className:"ee-link-modal-display-text-badge"})]}),qe(h,{value:f,placeholder:s("add_link_display_text_placeholder")||"Leave blank to keep selected text",onChange:e=>_(e.target.value)})]}),Je("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[qe("span",{style:{fontSize:13},children:s("add_link_open_new_tab")||"Open in new tab"}),qe(b,{className:"ee-settings-switch",checked:k,onChange:v})]})]})})]})},di=({id:e,textBlock:t,syncTextFromDom:s})=>{const{blockMap:c,rootOrder:d,templateData:u}=n(Ln),{t:p}=ja(),m=i(null),[g,h]=a(!1),[y,b]=a(!1),_=l(()=>{const t=qt(c,d,e),n=t?.[0]??null;return{containerBlock:n?.containerBlock??null,containerType:n?.containerType??"none",cellIndex:n?.cellIndex??0,lineage:t}},[c,d,e]),k=l(()=>{const e=_?.cellIndex??0,t=_?.containerBlock;return{columnIndex:e,columnProduct:t?.columnProducts?.[e]??null}},[_]),v=l(()=>(_?.lineage??[]).slice(1).filter(e=>e?.containerType&&"none"!==e.containerType).map(e=>{const t=e.cellIndex??0;return{containerType:e.containerType,context:{columnIndex:t,columnProduct:e.containerBlock?.columnProducts?.[t]??null}}}),[_?.lineage]),w=l(()=>zo(0,_?.containerType??"none",u,k,v),[_?.containerType,u,k,v]),x=l(()=>ei(_?.containerBlock,c),[_?.containerBlock,c]),S=l(()=>w.filter(e=>"image"!==e.type&&!x.has(e.variableKey??e.key)),[w,x]),C=o(()=>{if(!m.current)return;const e=m.current.parentNode?.getBoundingClientRect(),t=document.querySelector("#preview");if(!e||!t)return;const n=t.getBoundingClientRect();e.top-190<0?(m.current.style.bottom="auto",m.current.style.top="110%"):(m.current.style.bottom="110%",m.current.style.top="auto"),e.left+420>n.left+n.width?(m.current.style.left="auto",m.current.style.right="0"):(m.current.style.left="0",m.current.style.right="auto")},[]);r(()=>{C()},[C]),r(()=>{const e=()=>{const e="undefined"!=typeof window&&window.getSelection(),n=m.current;if(!e||0===e.rangeCount||!n)return void C();const o=e.getRangeAt(0),l=t?.current;if(!l||!l.contains(o.commonAncestorContainer)||e.isCollapsed)return void C();const a=o.getBoundingClientRect();if(!a||0===a.width&&0===a.height)return void C();const i=n.parentNode;if(!i)return;const r=i.getBoundingClientRect(),s=document.querySelector("#preview"),c=s?s.getBoundingClientRect():null;let d=a.top-r.top-46-8;a.top-60<0&&(d=a.bottom-r.top+8);let u=a.left-r.left+a.width/2-210;if(c){const e=c.left-r.left+8,t=c.right-r.left-8-420;u=Math.max(e,Math.min(u,t))}n.style.top=`${d}px`,n.style.bottom="auto",n.style.left=`${u}px`,n.style.right="auto"};return document.addEventListener("selectionchange",e),()=>document.removeEventListener("selectionchange",e)},[C,t]);const N=(e,t,n)=>{document.execCommand(e,t,n)},L=()=>{"function"!=typeof s?t?.current&&("undefined"!=typeof InputEvent&&InputEvent?t.current.dispatchEvent(new InputEvent("input",{bubbles:!0,cancelable:!0})):t.current.dispatchEvent(new Event("input",{bubbles:!0}))):s()};return qe("div",{className:"rich-text",ref:m,onClick:e=>{e.preventDefault(),e.stopPropagation()},children:qe(Ge.div,{className:"rich-text-tools",initial:{scale:0,x:0},animate:{scale:1,x:0},style:{width:g?"auto":"max-content",maxWidth:"min(100%, 520px)"},children:Je("div",{className:"rich-text-tools-body items-center",children:[!g&&Je(Ye,{children:[qe(ni,{modifyText:N,setTextContent:L}),qe(li,{modifyText:N,setTextContent:L}),qe(ai,{modifyText:N,setTextContent:L}),qe(ii,{modifyText:N,setTextContent:L}),qe(ri,{modifyText:N,setTextContent:L}),qe(si,{modifyText:N,setTextContent:L}),qe(ci,{modifyText:N,setTextContent:L}),qe(f,{zIndex:540,trigger:"click",open:y,onOpenChange:b,overlayClassName:"ee-rich-text-variables-popover",getPopupContainer:()=>document.querySelector("#preview")||document.body,content:Je("div",{className:"ee-rich-text-variables-menu",children:[qe("div",{className:"ee-rich-text-variables-header",children:p("variables")}),S.map(e=>qe("div",{className:"ee-rich-text-variables-item",onMouseDown:n=>{n.preventDefault(),(e=>{if(!t?.current||!e)return;const n=window.getSelection();let o=null;if(n?.rangeCount){const e=n.getRangeAt(0);t.current.contains(e.commonAncestorContainer)&&(o=e)}o||(o=document.createRange(),o.selectNodeContents(t.current),o.collapse(!1)),o.deleteContents();const l=document.createTextNode(e);o.insertNode(l),o.setStartAfter(l),o.collapse(!0),n&&(n.removeAllRanges(),n.addRange(o)),L(),b(!1)})(e.value)},children:e.labelKey?p(e.labelKey):e.label||e.value},`variables-${e.value}`))]}),children:qe("button",{className:"rich-text-tools-button",title:p("insert_merge_field"),onMouseDown:e=>e.preventDefault(),children:qe("span",{className:"rich-text-tools-button-icon",style:{color:"#fff",fontFamily:"monospace",fontWeight:700,fontSize:13,lineHeight:1},children:"{}"})})})]}),qe("button",{className:"rich-text-tools-button",title:p("minimize_toolbar")||"Collapse",onClick:()=>h(!g),children:qe(B,{icon:g?z:F,className:"rich-text-tools-button-icon"})})]})})})},ui=({id:e,blockItem:t,displayContent:a})=>{const{currentItem:s,previewMode:c,blockMap:d,rootOrder:u,setBlocks:p,setCurrentItem:m,isDragStart:g,templateData:h,registerRichTextFlush:y,actionType:b}=n(Ln),{t:f}=ja(),_=i(null),k=i(null),v=i(!1),w=i(!1),x="undo"===b||"redo"===b||"string"==typeof b&&b.startsWith("set_history"),S=s&&s.id===(e??t?.id),C="text"===t?.key&&"dynamic"===t?.contentType,N=S&&!C,L="desktop"===c?t.styles?.desktop??{}:{...t.styles?.desktop??{},...t.styles?.mobile??{}},T=L.linkColor||"#2faade",{linkColor:B,...A}=L,I={...A,direction:"ltr",unicodeBidi:"isolate","--ee-rich-text-link-color":T},$=i(!1),P=null!=a?a:t.text||"",R=l(()=>{const n=qt(d,u,e??t?.id),o=n?.[0]??null;return{containerBlock:o?.containerBlock??null,containerType:o?.containerType??"none",cellIndex:o?.cellIndex??0,lineage:n}},[d,u,e,t?.id]),M=l(()=>{const e=R?.cellIndex??0,t=R?.containerBlock;return{columnIndex:e,columnProduct:t?.columnProducts?.[e]??null}},[R]),D=l(()=>(R?.lineage??[]).slice(1).filter(e=>e?.containerType&&"none"!==e.containerType).map(e=>{const t=e.cellIndex??0;return{containerType:e.containerType,context:{columnIndex:t,columnProduct:e.containerBlock?.columnProducts?.[t]??null}}}),[R?.lineage]),U=l(()=>zo(0,R?.containerType??"none",h,M,D).map(e=>{return t=e.value,n=e.pasteValue,{token:t,pasteValue:String(n||"")};var t,n}).filter(e=>e.token&&e.pasteValue&&""!==e.pasteValue.trim()&&!e.pasteValue.includes("{{")&&e.pasteValue!==e.token).sort((e,t)=>t.pasteValue.length-e.pasteValue.length),[h,M,R?.containerType,D]),E=o(e=>{if(!e||!U.length||"undefined"==typeof document)return e;const t=document.createElement("div");t.innerHTML=e;const n=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);let o=n.nextNode();for(;o;){const e=o.nodeValue||"",{masked:t,tokens:l}=Ka(e);let a=t;U.forEach(({token:e,pasteValue:t})=>{t&&a.includes(t)&&(a=a.split(t).join(e))}),o.nodeValue=Va(a,l),o=n.nextNode()}return t.innerHTML},[U]);r(()=>{v.current=N},[N]);const z=o(()=>{null!=k.current&&(clearTimeout(k.current),k.current=null)},[]);r(()=>()=>z(),[z]),r(()=>{if(N&&_.current){const e=Ha(P);if($.current){const t=_.current,n=Ha(t.innerHTML||"");if("undefined"!=typeof document&&document.activeElement===t&&e!==n&&!x)return void($.current=!0);e!==n&&(t.innerHTML=e)}else _.current.innerHTML=e,_.current.focus();$.current=!0}else $.current=!1},[N,e,P,x]);const F=o(n=>{if(!n)return;const o=e??t?.id,l=d[o]||{},{textToStore:i,unchangedFromResolved:r}=function({rawHtml:e,displayContent:t,blockItemText:n,oldBlockKey:o,blockItemKey:l,restoreVariableTokensInHtml:a}){const i=Ha(e),r=null!=t?Ha(String(t)):null,s=!/<\s*a\b/i.test(i)&&null!=r&&i===r;let c=s?n:i;return"text"===(o??l)&&"function"==typeof a&&(c=a(c)),{textToStore:c,unchangedFromResolved:s}}({rawHtml:n.innerHTML,displayContent:a,blockItemText:t.text,oldBlockKey:l.key,blockItemKey:t.key,restoreVariableTokensInHtml:E}),c=r?l.selectedVariableKey:void 0;if((l.text??"")===(i??"")&&String(l.selectedVariableKey??"")===String(c??""))return;const g={...l,text:i,selectedVariableKey:c},h={...d,[o]:g};p(h,u,`edit_${Date.now()}`),m({...s,data:g})},[e,t?.id,t?.key,t?.text,d,u,p,m,s,a,E]),O=o(()=>{F(_.current)},[F]),W=o(()=>{z(),k.current=setTimeout(()=>{k.current=null,v.current&&_.current&&!w.current&&F(_.current)},380)},[z,F]),j=o(()=>{z(),O()},[z,O]);r(()=>{if(N&&"function"==typeof y)return y(O)},[N,y,O]);const H=o(e=>{if("number"==typeof e.button&&0!==e.button)return;if(!S||!C)return;qa(f);const t=_.current;if(t&&"function"==typeof t.focus)try{t.focus({preventScroll:!0})}catch{t.focus()}},[S,C,f]),K=o(e=>{if(!S||!C)return;if(e.metaKey||e.ctrlKey||e.altKey)return;if("Tab"===e.key||"Escape"===e.key)return;if(e.isComposing)return;const t=e.key;1!==t.length&&"Enter"!==t&&"Backspace"!==t&&"Delete"!==t||(e.preventDefault(),qa(f))},[S,C,f]),V=o(e=>{(e=>{e.preventDefault(),e.stopPropagation()})(e)},[]),G=Ha(P);return Je("div",{className:"relative",dir:"ltr",style:{direction:"ltr",unicodeBidi:"isolate"},children:[N&&t&&!g&&qe(di,{textBlock:_,id:e??t?.id,syncTextFromDom:O}),qe("div",{className:za(N&&"text-block","text-content_editable"),tabIndex:S&&C?0:void 0,onPointerDownCapture:H,onKeyDownCapture:K,onClick:V,onInput:N?()=>{w.current||W()}:void 0,onBlur:j,onCompositionStart:()=>{w.current=!0,z()},onCompositionEnd:()=>{w.current=!1,z(),O()},style:I,dir:"ltr",contentEditable:N,suppressContentEditableWarning:!0,ref:_,dangerouslySetInnerHTML:N?void 0:{__html:G}})]})},pi=t=>{const{id:o,blockItem:a}=t,{currentItem:i,previewMode:r,templateData:s,blockMap:c,rootOrder:d}=n(Ln),u="desktop"===r?a.styles?.desktop??{}:{...a.styles?.desktop??{},...a.styles?.mobile??{}},p=i&&i.id===o,m=l(()=>Jt(c,d,o),[c,d,o]),g=l(()=>Co(a.text,s,m),[a.text,s,m]),h=p?a.text||"":g,y=null!=u.linkColor&&""!==String(u.linkColor).trim()?String(u.linkColor).trim():"#2faade",b=l(()=>Ho(h,y,{useImportant:!1}),[h,y]),f=m?.containerBlock,_="footer"===f?.containerType,k=(g||"").replace(/<[^>]+>/g,"").replace(/\s+/g," ").trim();if(_&&(""===k||"{{Address}}"===k||"{{Tagline}}"===k))return null;const v=a.type&&/^h[1-4]$/.test(a.type)?a.type:"div";return p?qe(ui,{...t,blockItem:a}):e.createElement(v,{style:{...u,direction:"ltr",unicodeBidi:"isolate"},dir:"ltr",dangerouslySetInnerHTML:{__html:b}})};const mi=e=>{const{blockItem:t,id:o}=e,{currentItem:a,previewMode:i,templateData:r,blockMap:s,rootOrder:c}=n(Ln),d=l(()=>Jt(s,c,o),[o,s,c]),u=l(()=>{const e=t.text??"",n=e.match(/\{\{(\w+)\}\}/),o=t.labelVariable?t.labelVariable.replace(/^\{\{|\}\}$/g,"").trim():n?n[1]:void 0;if(!r||!o)return e;const l=$o(r,o,d);return null==l||String(l).startsWith("{{")?e:String(l)},[t.text,t.labelVariable,r,d]),p=a&&a.id===o,m=l(()=>{const e="desktop"===i?t.styles?.desktop??{}:{...t.styles?.desktop??{},...t.styles?.mobile??{}};let n=e.backgroundColor;return!function(e,t,n,o){const l=qt(t,n,o).find(e=>"product"===e?.containerType);if(!l?.containerBlock)return!1;if(!function(e,t){if(!t||"column"!==t.key||"product"!==t.containerType)return!1;if("additional"===t.productRole)return!1;if("image_left"===t.mainProductLayout)return!0;if("image_stacked"===t.mainProductLayout)return!1;const n=t.cells||[],o=n[0]?.childrenIds?.[0],l=e[o];return"column"===l?.key&&"2-3"===l?.type}(t,l.containerBlock))return!1;const a=e.styles?.desktop?.backgroundColor;return null==a||""===String(a).trim()||Ll(a)===Ll(Nl)}(t,s,c,o)?(null==n||""===String(n).trim()||Tl(n))&&(n=Bl(r)):n=Bl(r),{...e,backgroundColor:n}},[t,s,o,i,c,r]),g="desktop"===i?t.contentStyles?.desktop:{...t.contentStyles?.desktop,...t.contentStyles?.mobile},h=l(()=>qe(ui,{...e,blockItem:{...t,styles:{...t.styles,desktop:{...t.styles?.desktop,backgroundColor:m.backgroundColor}}},displayContent:u}),[t,u,m.backgroundColor]);return qe("div",{style:{...g},children:p?h:qe("div",{style:{...m,textAlign:"center"},dangerouslySetInnerHTML:{__html:u}})})},gi=({blockItem:e})=>{const{previewMode:t}=n(Ln),o="desktop"===t?e.styles?.desktop??{}:{...e.styles?.desktop??{},...e.styles?.mobile??{}},l="desktop"===t?e.contentStyles?.desktop:{...e.contentStyles?.desktop,...e.contentStyles?.mobile};return qe("div",{className:"relative",children:qe("div",{style:{...l},children:qe("div",{style:{...o}})})})},hi=({blockItem:e})=>{const{previewMode:t}=n(Ln),o="desktop"===t?e.styles?.desktop??{}:{...e.styles?.desktop??{},...e.styles?.mobile??{}},l="desktop"===t?e.contentStyles?.desktop:{...e.contentStyles?.desktop,...e.contentStyles?.mobile};return qe("div",{className:"relative",style:{...l},children:qe("div",{style:{width:"100%",height:"number"==typeof o.height?`${o.height}px`:o.height||"16px",display:o.display||"block"}})})},yi=({blockItem:e})=>{const{previewMode:t}=n(Ln),{list:o=[],separator:l=" | "}=e,a=o,i=e.mobileLayout??"inline",r="mobile"===t&&"stack"===i,s=st("desktop"===t?e.styles?.desktop??{}:{...e.styles?.desktop??{},...e.styles?.mobile??{}}),c="desktop"===t?e.contentStyles?.desktop:{...e.contentStyles?.desktop,...e.contentStyles?.mobile},d=c&&"object"==typeof c?{...c}:{},u=d.textAlign??"center";delete d.textAlign;const p=e.linkGapPx,m="number"==typeof p&&Number.isFinite(p)&&p>=0?p:0,g=Boolean(e.linkUnderline),h=s.fontWeight,y="normal"===h||"bold"===h?h:null!=h?String(h):"400",b={fontSize:null!=s.fontSize?`${s.fontSize}px`:"14px",fontFamily:s.fontFamily||"sans-serif",color:s.linkColor||s.color||"#2faade",fontWeight:y,letterSpacing:null!=s.letterSpacing?`${s.letterSpacing}px`:"0px",textDecoration:g?"underline":"none",textTransform:s.textTransform??"none",display:"inline-block"},f={fontSize:null!=s.fontSize?`${s.fontSize}px`:"14px",color:s.color||"#333",display:"inline-block",verticalAlign:"middle",whiteSpace:"pre"},_=m>0?{...f,marginLeft:m,marginRight:m}:{...f,paddingLeft:4,paddingRight:4},k="left"===u?"flex-start":"right"===u?"flex-end":"center",v=r?{...d,display:"flex",flexDirection:"column",flexWrap:"nowrap",alignItems:k,...m>0?{gap:m}:{},width:"100%",maxWidth:"100%",minWidth:0,boxSizing:"border-box"}:{...d,display:"block",textAlign:"justify"===u?"justify":u,width:"100%",maxWidth:"100%",minWidth:0,boxSizing:"border-box"},w=(e,t)=>qe("a",{href:e.url?e.url.startsWith("http")?e.url:`https://${e.url}`:"#",target:"_blank"===e.target?"_blank":"_self",rel:"_blank"===e.target?"noopener noreferrer":void 0,style:b,onClick:e=>e.preventDefault(),children:e.label||"Link"},`${t}-link`);return qe("div",{className:"relative ee-menu-block-root",children:qe("div",{className:"ee-menu-block-inner",style:v,children:a.flatMap((e,t)=>{if(r)return[w(e,t)];const n=[];return t>0&&n.push(qe("span",{style:_,children:l},`${t}-sep`)),n.push(w(e,t)),n})})})};function bi(e,t,n){return Math.min(n,Math.max(t,e))}function fi({active:e,hostRef:t,blockId:n,previewMode:l,getEditorSnapshot:a}){const s=i(null),c=i(null),d=i(a);r(()=>{d.current=a},[a]);const u=o(o=>a=>{if(!e||!t.current)return;a.stopPropagation(),a.preventDefault(),c.current=null;const i=t.current,r=i.parentElement;if(!r)return;const u=r.getBoundingClientRect(),p=i.getBoundingClientRect(),m=i.querySelector("img"),g=m?.getBoundingClientRect()??p,h=u.width>0?u.width:600;s.current={edge:o,startX:a.clientX,startY:a.clientY,startW:p.width,startH:g.height,parentW:h};const y=e=>{const o=s.current;if(!o||!t.current)return;const a=d.current(),{blockMap:i,rootOrder:r,setBlocks:u,setCurrentItem:p,currentItem:m}=a,g=c.current||i,h=e.clientX-o.startX,y=e.clientY-o.startY,b=Math.max(24,.05*o.parentW),f=e=>bi(e,b,o.parentW)/o.parentW*100;let _=null;if("e"===o.edge?_={widthPct:f(o.startW+h)}:"w"===o.edge?_={widthPct:f(o.startW-h)}:"s"===o.edge?_={heightPx:bi(o.startH+y,24,2e3)}:"n"===o.edge&&(_={heightPx:bi(o.startH-y,24,2e3)}),!_)return;const k=function({blockMap:e,id:t,previewMode:n,widthPct:o,heightPx:l}){const a=e[t];if(!a||"image"!==a.key)return e;const i=xt(a);if(i.styles||(i.styles={desktop:{},mobile:{}}),i.styles[n]||(i.styles[n]={}),i.contentStyles||(i.contentStyles={desktop:{},mobile:{}}),null!=o){const e=`${bi(Math.round(o),5,100)}%`;i.styles[n].width=e,"desktop"!==n&&(i.styles.desktop||(i.styles.desktop={}),i.styles.desktop.width=e)}if(null!=l){const e=`${Math.round(l)}px`;i.styles[n].height=e,"desktop"!==n&&(i.styles.desktop||(i.styles.desktop={}),i.styles.desktop.height=e)}for(const e of["desktop","mobile"]){const t=i.contentStyles[e];t&&"object"==typeof t&&(delete t.marginLeft,delete t.marginTop)}return{...e,[t]:i}}({blockMap:g,id:n,previewMode:l,widthPct:_.widthPct??null,heightPx:_.heightPx??null});u(k,r,{skipUndo:!0}),m?.id===n&&p({...m,data:k[n]}),c.current=k},b=()=>{s.current=null,document.removeEventListener("pointermove",y),document.removeEventListener("pointerup",b),document.removeEventListener("pointercancel",b);const e=d.current(),{rootOrder:t,setBlocks:n}=e,o=c.current||e.blockMap;c.current=null,n({...o},t,{skipUndo:!1})};document.addEventListener("pointermove",y),document.addEventListener("pointerup",b),document.addEventListener("pointercancel",b)},[e,t,n,l]);if(!e)return null;const p=(e,t,n,o)=>qe("button",{type:"button",className:`ee-image-resize-handle ${t}`,"aria-label":o,tabIndex:-1,style:{cursor:n,touchAction:"none"},onPointerDown:u(e)});return Je(Ye,{children:[p("n","ee-image-resize-handle--n","n-resize","Resize from top edge"),p("s","ee-image-resize-handle--s","s-resize","Resize from bottom edge"),p("e","ee-image-resize-handle--e","e-resize","Resize from right edge"),p("w","ee-image-resize-handle--w","w-resize","Resize from left edge")]})}function _i(e){return null!=e&&"string"==typeof e&&/<[a-zA-Z!/?]/.test(e.trim())}function ki(e){switch(e){case"h1":case"h2":case"h3":return 700;case"subtitle":case"eyebrow":return 600;default:return 400}}const vi=({blockItem:e,id:t})=>{const{previewMode:a,templateData:r,blockMap:s,rootOrder:c,bodySettings:d,currentItem:u,setBlocks:p,setCurrentItem:m}=n(Ln),g=s[t]||e,{src:h,alt:y,linkURL:b}=g,f="desktop"===a?g.styles?.desktop??{}:{...g.styles?.desktop??{},...g.styles?.mobile??{}},_=l(()=>{const e="desktop"===a?g.contentStyles?.desktop??{}:{...g.contentStyles?.desktop,...g.contentStyles?.mobile},{marginLeft:t,marginTop:n,...o}=e;return o},[g.contentStyles,a]),k=i(null),v=o(()=>({blockMap:s,rootOrder:c,setBlocks:p,setCurrentItem:m,currentItem:u,previewMode:a}),[s,c,p,m,u,a]),w=l(()=>{const e="string"==typeof h&&/^\{\{\w+\}\}$/.test(h.trim())?h.trim():"";if(h&&!e)return h;if(!r||!e)return h||"";const n=Jt(s,c,t),o=e.replace(/^\{\{|\}\}$/g,"").trim(),l=$o(r,o,n);return l&&!l.startsWith("{{")?l:h||""},[h,r,s,c,t]),x="string"==typeof h&&/^\{\{\w+\}\}$/.test(h.trim())?h.trim():"",S=!w||w.startsWith("{{"),C=y||"Image",N=f.width,L=N&&"auto"!==N,T=L?{width:N}:void 0,A="string"==typeof b?b.trim():"",I=""===A?"":nt(A,{allowMailtoTel:!0})??"",$=Boolean(g.textOverlayEnabled)&&function(e){const t=Array.isArray(e.overlayItems)?e.overlayItems:[];return t.length>0?t.some(e=>""!==String(e?.text??"").trim()):""!==String(e.overlayText??"").trim()}(g)&&w&&!S,P=()=>{const e=String(g.overlayText??"").replace(/<script\b[\s\S]*?<\/script>/gi,"");return _i(e)?qe("span",{className:"ee-image-overlay-caption-html",dangerouslySetInnerHTML:{__html:e}}):qe("span",{className:"ee-image-overlay-caption-plain",style:{whiteSpace:"pre-wrap"},children:e})},R=()=>{const e=Array.isArray(g.overlayItems)?g.overlayItems:[],t="number"==typeof g.overlayItemGap?g.overlayItemGap:8,n="number"==typeof g.overlayMaxWidth?g.overlayMaxWidth:100,o="number"==typeof g.overlayPadding?g.overlayPadding:16,l=g.textShadowEnabled?"0 1px 3px rgba(0,0,0,0.55)":"none",a=d?.styles?.fontFamily??"sans-serif";return qe("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch",gap:t,width:`${n}%`,maxWidth:"100%",padding:o,boxSizing:"border-box"},children:e.map((e,t)=>{const n=String(e?.text??"").replace(/<script\b[\s\S]*?<\/script>/gi,""),o="number"==typeof e?.fontSize?e.fontSize:16,i=e?.color||"#ffffff",r=null!=e?.fontFamily&&""!==String(e.fontFamily).trim()?String(e.fontFamily).trim():a;return qe("div",{style:{color:i,fontSize:o,fontFamily:r,fontWeight:ki(e?.kind),lineHeight:1.35,textShadow:l,wordBreak:"break-word"},children:_i(n)?qe("span",{className:"ee-image-overlay-caption-html",dangerouslySetInnerHTML:{__html:n}}):qe("span",{style:{whiteSpace:"pre-wrap"},children:n})},t)})})},M=$?(()=>{const e=pl(ul(g.overlayPosition)),t=f.borderRadius,n="number"==typeof g.overlayMaxWidth?g.overlayMaxWidth:100,o="number"==typeof g.overlayPadding?g.overlayPadding:16,l={position:"relative",display:"block",width:"100%",maxWidth:"100%",borderRadius:t,overflow:"hidden",lineHeight:0,verticalAlign:"top"},a=Array.isArray(g.overlayItems)?g.overlayItems:[],i=a.length>0&&a.some(e=>""!==String(e?.text??"").trim()),r={...e,position:"absolute",pointerEvents:"none",zIndex:2,maxWidth:`${n}%`,boxSizing:"border-box",...i?{}:{color:g.overlayTextColor||"#ffffff",fontSize:"number"==typeof g.overlayFontSize?g.overlayFontSize:18,fontWeight:600,lineHeight:1.35,padding:o,textShadow:g.textShadowEnabled?"0 1px 3px rgba(0,0,0,0.55)":void 0,...g.overlayBoxBackground?{backgroundColor:g.overlayBoxBackground,padding:`${Math.max(8,o/2)}px 12px`}:{}}},s=qe("img",{src:w,style:{...f,width:"100%",maxWidth:"100%",display:"block",borderRadius:0,verticalAlign:"top"},alt:C});return Je("div",{className:"ee-image-overlay-host",style:l,children:[g.scrimEnabled?qe("div",{style:{position:"absolute",left:0,right:0,top:0,bottom:0,pointerEvents:"none",zIndex:1,background:"linear-gradient(to top, rgba(0,0,0,0.65), rgba(0,0,0,0.12), transparent 55%)"},"aria-hidden":!0}):null,qe("div",{style:{position:"relative",zIndex:0},children:s}),qe("div",{className:"ee-image-overlay-caption",style:r,children:i?R():P()})]})})():w&&!S?qe("img",{src:w,style:L?{...f,width:"100%",maxWidth:"100%",display:"block"}:f,alt:C,className:"inline-block"}):qe("div",{className:"empty-image",style:{...f,width:L||"auto"===f.width?"100%":f.width},title:S&&x?x:void 0,children:S&&x?qe("span",{className:"empty-image-variable-label",children:x}):qe(B,{icon:O,className:"empty-image-icon"})}),D=jo(g)&&I&&w&&!S?qe("a",{href:I,target:"_blank",rel:"noopener noreferrer",style:L?{textDecoration:"none",display:"block",width:"100%",maxWidth:"100%"}:{textDecoration:"none",display:"inline-block",maxWidth:"100%"},onClick:e=>e.preventDefault(),children:M}):M,U=u?.id===t;return qe("div",{className:"relative",children:qe("div",{style:{..._||{}},children:Je("div",{ref:k,style:T,className:za("ee-image-canvas-host",U&&"ee-image-canvas-host--selected"),children:[D,qe(fi,{active:U,hostRef:k,blockId:t,previewMode:a,getEditorSnapshot:v})]})})})},wi=({blockItem:e})=>{const{src:t,alt:o,linkURL:l}=e,{previewMode:a}=n(Ln),i="desktop"===a?e.styles?.desktop??{}:{...e.styles?.desktop??{},...e.styles?.mobile??{}},r="desktop"===a?e.contentStyles?.desktop:{...e.contentStyles?.desktop,...e.contentStyles?.mobile},s=t?qe("img",{src:t,style:{...i,width:i.width??64,height:i.width??64,objectFit:"cover",borderRadius:i.borderRadius??"50%"},alt:o||"Avatar",className:"inline-block"}):qe("div",{className:"empty-avatar",style:{width:i.width??64,height:i.width??64,borderRadius:i.borderRadius??"50%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--ee-border, #eee)"},children:qe(B,{icon:W,style:{fontSize:"24px",color:"#999"}})}),c={...r,width:"100%"},d=null!=l&&String(l).trim()?nt(l,{allowMailtoTel:!0}):null;return qe("div",{className:"relative",children:qe("div",{style:c,children:d?qe("a",{href:d,target:"_blank",rel:"noopener noreferrer",style:{display:"inline-block"},children:s}):s})})},xi=({blockItem:e})=>{const{previewMode:t}=n(Ln),{t:o}=ja(),{list:l=[]}=e,a=_t(e),i=rt(e?.iconColor),r="desktop"===t?e.styles?.desktop??{}:{...e.styles?.desktop??{},...e.styles?.mobile??{}},s=st(r),c="desktop"===t?e.contentStyles?.desktop:{...e.contentStyles?.desktop,...e.contentStyles?.mobile},d=Boolean(e.showTextLabel),u=r.color||"#525252",p=Math.max(11,Math.round(.58*a)),m=Array.isArray(l)?l.filter(Boolean):[];return 0===m.length?null:qe("div",{className:"relative",children:qe("div",{style:gt(c),children:m.map((e,t)=>{const{image:n,title:l,linkURL:r}=e,c=at(e)?o("social_platform_x_alt"):l,m=at(e)?o("social_platform_x"):l,{src:g,style:h}=vt(e,i,a),y=qe("img",{src:g||n,alt:c,style:h}),b=nt(r,{allowMailtoTel:!1}),f={display:"inline-flex",alignItems:"center",gap:d?8:0,textDecoration:"none",color:u},_=Je(Ye,{children:[y,d?qe("span",{style:{fontSize:p,lineHeight:1.2,color:u,whiteSpace:"nowrap"},children:m}):null]});return qe("div",{style:{...s,display:"inline-flex",alignItems:"center"},children:b?qe("a",{href:b,target:"_blank",rel:"noopener noreferrer",style:f,onClick:e=>e.preventDefault(),children:_}):qe("span",{style:f,children:_})},t)})})})};const Si=({blockItem:e})=>{const{previewMode:t}=n(Ln),l="desktop"===t?{...e.contentStyles?.desktop??{}}:{...e.contentStyles?.desktop??{},...e.contentStyles?.mobile??{}},{outer:a,inner:i}=function(e){if(!e||"object"!=typeof e)return{outer:{width:"100%",textAlign:"center",boxSizing:"border-box"},inner:{width:"100%",maxWidth:"100%",display:"inline-block",verticalAlign:"top",boxSizing:"border-box"}};const{textAlign:t="center",width:n="100%",paddingTop:o,paddingRight:l,paddingBottom:a,paddingLeft:i,backgroundColor:r,...s}=e;return{outer:{width:"100%",textAlign:t,boxSizing:"border-box"},inner:{width:n,maxWidth:"100%",display:"inline-block",verticalAlign:"top",boxSizing:"border-box",paddingTop:o,paddingRight:l,paddingBottom:a,paddingLeft:i,backgroundColor:r,...s}}}(l),r=o(e=>{const t=e.target?.closest?.("a[href]");if(!t)return;e.preventDefault(),e.stopPropagation();const n=(t.getAttribute("href")||"").trim();if(n&&!/^javascript:/i.test(n)&&!/^data:/i.test(n))if(/^https?:\/\//i.test(n)||n.startsWith("//")){const e=n.startsWith("//")?`https:${n}`:n;window.open(e,"_blank","noopener,noreferrer")}else(/^mailto:/i.test(n)||/^tel:/i.test(n))&&window.open(n,"_blank","noopener,noreferrer")},[]);return qe("div",{className:"relative ee-raw-html-block",children:qe("div",{className:"ee-raw-html-outer",style:a,children:qe("div",{className:"ee-raw-html-inner",style:i,children:qe("div",{className:"ee-raw-html-content",role:"region","aria-label":"Custom HTML preview",onClick:r,dangerouslySetInnerHTML:{__html:e.html??""}})})})})},Ci=({blockItem:e})=>{const{previewMode:t}=n(Ln),o="desktop"===t?{...e.styles?.desktop??{}}:{...e.styles?.desktop??{},...e.styles?.mobile??{}},l="number"==typeof e.rows?e.rows:3,a="number"==typeof e.cols?e.cols:3,i=Boolean(e.headerRow),r=Boolean(e.headerCol),s=Boolean(e.stripedRows),c=o.fontSize??14,d=o.color??"#333333",u=o.borderStyle??"solid",p=o.borderWidth??1,m=o.borderColor??"#e0e0e0",g=o.cellPadding??8,h=o.textAlign??"left",y=o.headerBg??"#f5f5f5",b=o.headerColor??"#333333",f=o.stripedBg??"#fafafa",_="none"!==u?`${p}px ${u} ${m}`:"none",k=(e,t)=>{const n=i&&0===e||r&&0===t;return{border:_,padding:g,fontSize:c,color:n?b:d,textAlign:h,backgroundColor:n?y:s&&!n&&e%2==0?f:"transparent",fontWeight:n?600:400,verticalAlign:"top"}},v={...e.contentStyles?.desktop??{},..."desktop"!==t?e.contentStyles?.mobile??{}:{}},w=(t,n)=>{const o=`${t}-${n}`,l=e.cells?.[o];if("image"===l?.type&&String(l.src??"").trim())return qe("img",{src:l.src,alt:l.alt||"",style:{maxWidth:"100%",height:"auto",display:"block"}});const a=l?.text??"";return qe("span",a?{style:{whiteSpace:"pre-wrap"},children:a}:{style:{color:"rgba(0,0,0,0.35)",fontStyle:"italic",fontWeight:400},children:"—"})};return qe("div",{style:{width:"100%",boxSizing:"border-box",paddingTop:v.paddingTop??0,paddingBottom:v.paddingBottom??0,paddingLeft:v.paddingLeft??0,paddingRight:v.paddingRight??0,textAlign:v.textAlign??"left",overflowX:"auto"},children:qe("table",{style:{width:"100%",borderCollapse:"collapse",tableLayout:"auto"},children:qe("tbody",{children:Array.from({length:l}).map((e,t)=>qe("tr",{children:Array.from({length:a}).map((e,n)=>qe(i&&0===t||r&&0===n?"th":"td",{style:k(t,n),children:w(t,n)},`${t}-${n}`))},t))})})})},Ni=({blockItem:e})=>{const{previewMode:t}=n(Ln),o=l(()=>"desktop"===t?e.styles?.desktop??{}:{...e.styles?.desktop??{},...e.styles?.mobile??{}},[e.styles,t]),a=l(()=>"desktop"===t?e.contentStyles?.desktop:{...e.contentStyles?.desktop,...e.contentStyles?.mobile},[e.contentStyles,t]),i=l(()=>"desktop"===t?e.videoArea?.desktop??{}:{...e.videoArea?.desktop??{},...e.videoArea?.mobile??{}},[e.videoArea,t]),r="string"==typeof e.videoUrl?e.videoUrl.trim():"",s=Boolean(o.fillColumn),c=Boolean(o.fillColumnMobile),d="desktop"===t?s:c||s,u=l(()=>ml(r,e.thumbnailUrl),[r,e.thumbnailUrl]),p=l(()=>{let e=o.width,t=o.height;null!=e&&""!==e||(e="auto"),null!=t&&""!==t||(t="auto"),d&&(e="100%");const n=a?.textAlign||"center";let l="0 auto";return"left"===n?l="0":"right"===n&&(l="0 0 0 auto"),{width:"number"==typeof e?`${e}px`:e,height:"number"==typeof t?`${t}px`:t,display:"block",margin:l,maxWidth:"100%"}},[o,d,a?.textAlign]),m=l(()=>{const e=i||{},t=null!=e.borderWidth?Number(e.borderWidth):0;let n="none";return t>0&&e.borderStyle&&"none"!==e.borderStyle&&(n=`${t}px ${e.borderStyle} ${e.borderColor??"#cccccc"}`),{paddingTop:e.paddingTop??0,paddingBottom:e.paddingBottom??0,paddingLeft:e.paddingLeft??0,paddingRight:e.paddingRight??0,backgroundColor:e.backgroundColor||"transparent",border:n,borderRadius:e.borderRadius??0,boxSizing:"border-box"}},[i]),g=l(()=>{let e=o.width;d&&(e="100%"),null!=e&&""!==e||(e="auto");const t="auto"===e?"100%":"number"==typeof e?`${e}px`:e,n=i?.borderRadius;return{width:t,maxWidth:"100%",boxSizing:"border-box",...null!=n&&""!==n?{borderRadius:n}:{}}},[o.width,d,i?.borderRadius]),h=!u,y=r.startsWith("http://")||r.startsWith("https://")||r.startsWith("//")?r.startsWith("//")?`https:${r}`:r:r?`https://${r.replace(/^\/+/,"")}`:"";return qe("div",{className:"relative ee-video-block",children:qe("div",{style:{...a||{}},children:qe("div",h?{className:"empty-image ee-video-inner",style:g,children:qe(B,{icon:j,className:"empty-image-icon"})}:{className:"ee-video-inner",style:m,children:y?qe("a",{href:y,target:"_blank",rel:"noopener noreferrer",style:{display:"block",lineHeight:0,textDecoration:"none"},onClick:e=>e.stopPropagation(),children:qe("img",{src:u,alt:"Video thumbnail",className:"ee-video-thumb",style:p})}):qe("img",{src:u,alt:"Video thumbnail",className:"ee-video-thumb",style:p})})})})},Li=({blockItem:e,id:t})=>{if(!e)return null;const n={blockItem:e,id:t};switch(e.key){case"text":return qe(pi,{...n});case"button":return qe(mi,{...n});case"divider":return qe(gi,{...n});case"spacer":return qe(hi,{...n});case"menu":return qe(yi,{...n});case"image":return qe(vi,{...n});case"video":return qe(Ni,{...n});case"avatar":return qe(wi,{...n});case"social_link":return qe(xi,{...n});case"raw_html":return qe(Si,{...n});case"table":return qe(Ci,{...n});default:return null}},Ti={tree:null};function Bi(e,t,n){if(!n||!e[n])return null;if(t.includes(n))return Kt(n,e);const o=e[n];return"column"===o.key?Kt(n,e):xt(o)}function Ai(e,t,n){const o=Bi(e,t,n);return o?Ii(e,t,o,n):null}function Ii(e,t,n,o){if(!n||!o||!e[o])return null;const l=Bt(n),a=t.indexOf(o);if(-1!==a){const{newBlockMap:n,rootId:o}=nn(e,l);if(!o)return null;const i=[...t];i.splice(a+1,0,o);const r=n[o];return{nextMap:n,nextRootOrder:i,newId:o,selectionData:"column"===r?.key?Kt(o,n):r}}const i=Vt(e,t,o);if(!i)return null;const{newBlockMap:r,rootId:s}=nn(e,l);if(!s)return null;const c=Zt(r,i.containerId,i.cellIndex,i.itemIndex+1,s),d=c[s];return{nextMap:c,nextRootOrder:t,newId:s,selectionData:"column"===d?.key?Kt(s,c):d}}function $i(e,t,n,o){if(!n)return null;if(o&&e[o])return Ii(e,t,n,o);const l=Bt(n),{newBlockMap:a,rootId:i}=nn(e,l);if(!i)return null;const r=a[i],s="column"===r?.key?Kt(i,a):r;return{nextMap:a,nextRootOrder:[...t,i],newId:i,selectionData:s}}function Pi(e,t){const n=e[t];if(!n||"column"!==n.key)return!1;for(const t of n.cells||[])for(const n of t.childrenIds||[]){const t=e[n];if(t&&"empty"!==t.key)return!0}return!1}function Ri(e,t,n,o){if(!n||!e[n])return null;if(-1!==t.indexOf(n)){return{nextMap:en(e,n),nextRootOrder:t.filter(e=>e!==n)}}const l=Vt(e,t,n);if(!l)return null;const a=Oa(e,t,n);if(a?.nextBlockMap)return{nextMap:a.nextBlockMap,nextRootOrder:t};const{blockMap:i,removedId:r}=Xt(e,l.containerId,l.cellIndex,l.itemIndex);let s=i;const c=i[l.containerId];if(c&&0===c.cells[l.cellIndex].childrenIds.length){const e=Wt(o("drag_block_here"));s={...i,[e.id]:e,[l.containerId]:{...c,cells:c.cells.map((t,n)=>n===l.cellIndex?{...t,childrenIds:[e.id]}:t)}}}return r&&(s=en(s,r)),{nextMap:s,nextRootOrder:t}}function Mi(e){return e&&"column"===e.key?"section"===e.layoutRole||"columns"===e.layoutRole?e.layoutRole:!0===e.columnLayoutOnly?"columns":"section":null}const Di="section",Ui="columns";function Ei(e,t){if(!e||"column"!==e.key)return!1;if("none"!==e.containerType)return!1;const n=e.children;if(Array.isArray(n)){if(n.length<2||n.length>3)return!1;for(const e of n){if("content"!==e?.key)return!1;const t=e?.children?.[0];if("column"!==t?.key||"product"!==t?.containerType)return!1}return!0}if(!t||!Array.isArray(e.cells))return!1;const o=e.cells.length;if(o<2||o>3)return!1;for(const n of e.cells){const e=n?.childrenIds?.[0],o=t[e];if(!o||"column"!==o.key||"product"!==o.containerType)return!1}return!0}const zi="ee:open-configure-columns";function Fi(e){"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent(zi,{detail:null!=e&&String(e).length>0?{rootId:e}:{}}))}const Oi=(e,t)=>null==e||""===e?t:"number"==typeof e?e:parseInt(String(e).replace(/px/gi,""),10)||t;function Wi({segment:e,active:t,children:n,onSelect:o}){return n?qe("div",{className:za("ee-footer-canvas-segment",t&&"ee-footer-canvas-segment--selected"),"data-footer-segment":e,role:"button",tabIndex:0,onClick:t=>{t.stopPropagation(),o?.(e,t)},onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),o?.(e,t))},children:n}):null}const ji=({column:e,canvasFooterSegment:t,isFooterColumnSelected:o,onFooterCanvasSegmentSelect:l})=>{const{previewMode:a,templateData:i}=n(Ln),r="desktop"===a?e.styles?.desktop??{}:{...e.styles?.desktop??{},...e.styles?.mobile??{}},s=Boolean(e.showBrand??!0),c=Boolean(e.showTagline??!0),d=Boolean(e.footerShowLogo??!1),u=yl(e.footerLogoSrc??"",i),p=bl(String(e.footerLogoAlt??"Logo").trim()||"Logo",i).trim()||"Logo",m=e.footerLogoLink??"",g="number"==typeof e.footerLogoMaxWidthPercent?e.footerLogoMaxWidthPercent:parseInt(String(e.footerLogoMaxWidthPercent??"30"),10)||30,h="number"==typeof e.footerLogoPaddingPx?e.footerLogoPaddingPx:Oi(e.footerLogoPaddingPx,24),y=Boolean(e.showAddress??!0),b=Boolean(e.showUnsubscribe??!0),f=Boolean(e.showSocial??!1),_=Boolean(e.showSecondaryLinks??!1),k=Boolean(e.showCopyright??!0),v=bl(e.brandName??"",i),w=bl(e.brandTagline??"",i).trim(),x=bl(e.address??"",i),S=bl(e.copyrightText??"",i),C=e.unsubscribeUrl||"{{unsubscribe_url}}",N=null!=e.unsubscribeBodyText&&""!==String(e.unsubscribeBodyText).trim()?String(e.unsubscribeBodyText):kl,{unsubscribeLinkLabel:L}=vl(e),T=bl(L,i),B=bl(N,i),A=xl(e.secondaryLinks),I=wl(e.footerSocialList),$=r.color??"#737373",P=null!=r.linkColor&&""!==String(r.linkColor).trim()?String(r.linkColor).trim():$,R=Oi(r.fontSize,12),M=r.textAlign??"center",D=Oi(r.paddingTop,28),U=Oi(r.paddingRight,24),E=Oi(r.paddingBottom,28),z=Oi(r.paddingLeft,24),F=Boolean(e.showDivider??!1),O=e.dividerColor??"#374151",W=Boolean(e.showBorderTop??!1),j=Oi(e.borderTopWidth,1),H=e.borderTopStyle??"solid",K=e.borderTopColor??"#e5e7eb",V=gl(r.contentBackground),G={margin:0,color:$,fontSize:R,lineHeight:1.5,fontFamily:r.fontFamily??"Arial, sans-serif",textAlign:M},q={color:P,textDecoration:"underline",cursor:"pointer"},J={onClick:e=>{e.preventDefault()}},Y={boxSizing:"border-box",width:"100%",textAlign:M,backgroundColor:V,paddingTop:D,paddingRight:U,paddingBottom:E,paddingLeft:z,borderTop:W&&j>0?`${j}px ${H} ${K}`:void 0},X=(e,t)=>qe("div",{style:{marginTop:0,marginBottom:10},children:e},t),Z=Array.isArray(I)?I.filter(Boolean):[],Q=_t({imageWidth:36}),ee=nt(fl(m,i)),te=qe("img",{src:u,alt:p,draggable:!1,style:{maxWidth:`${Math.min(100,Math.max(10,g))}%`,height:"auto",display:"inline-block",padding:h,verticalAlign:"middle",border:0}}),ne=ee?qe("a",{href:ee,target:"_blank",rel:"noopener noreferrer",style:{textDecoration:"none",lineHeight:0,display:"inline-block"},...J,children:te}):te,oe=e=>Boolean(o&&t===e);return Je("div",{style:Y,children:[F?qe(Wi,{segment:"divider",active:oe("divider"),onSelect:l,children:qe("div",{style:{borderTop:`1px solid ${O}`,marginBottom:15,width:"100%"},"aria-hidden":!0})}):null,d&&u.trim()?X(qe(Wi,{segment:"logo",active:oe("logo"),onSelect:l,children:qe("div",{style:{display:"flex",justifyContent:"left"===M?"flex-start":"right"===M?"flex-end":"center",lineHeight:0},children:ne})}),"logo"):null,s&&v.trim()?X(qe(Wi,{segment:"brand",active:oe("brand"),onSelect:l,children:qe("p",{style:{...G,fontWeight:600},children:v})}),"brand"):null,c&&w.trim()?X(qe(Wi,{segment:"tagline",active:oe("tagline"),onSelect:l,children:qe("p",{style:{...G,opacity:.92},children:w})}),"tagline"):null,y&&x.trim()?X(qe(Wi,{segment:"address",active:oe("address"),onSelect:l,children:qe("p",{style:G,children:x})}),"address"):null,f&&Z.length>0?X(qe(Wi,{segment:"social",active:oe("social"),onSelect:l,children:qe("div",{style:{display:"flex",justifyContent:"left"===M?"flex-start":"right"===M?"flex-end":"center",flexWrap:"wrap",gap:12,alignItems:"center"},children:Z.map((e,t)=>{const n=nt(fl(e.linkURL,i),{allowMailtoTel:!1}),{src:o,style:l}=vt(e,"default",Q),a=qe("img",{src:o||e.image,alt:"",style:l,draggable:!1}),r={style:{display:"inline-flex",alignItems:"center",lineHeight:0}};return n?qe("a",{href:n,target:"_blank",rel:"noopener noreferrer",...r,...J,children:a},`${e.title}-${t}`):qe("span",{...r,children:a},`${e.title}-${t}`)})})}),"social"):null,b?X(qe(Wi,{segment:"unsubscribe",active:oe("unsubscribe"),onSelect:l,children:Je("p",{style:{...G,wordBreak:"break-word"},children:[B?`${B} `:"",qe("a",{href:nt(fl(C,i)),style:q,...J,children:T})]})}),"unsub"):null,_&&A.length>0?X(qe(Wi,{segment:"secondary",active:oe("secondary"),onSelect:l,children:qe("p",{style:{...G,wordBreak:"break-word"},children:A.map((e,t)=>Je("span",{children:[t>0?qe("span",{style:{padding:"0 6px",userSelect:"none"},children:"·"}):null,qe("a",{href:nt(fl(e.url,i)),target:"_blank"===e.target?"_blank":void 0,rel:"_blank"===e.target?"noopener noreferrer":void 0,style:q,...J,children:bl(e.label||"",i)||`#${t+1}`})]},e.id||`${e.label}-${t}`))})}),"secondary"):null,k&&S.trim()?X(qe(Wi,{segment:"copyright",active:oe("copyright"),onSelect:l,children:qe("p",{style:{...G,fontSize:Math.max(10,R-1),opacity:.9},children:S})}),"copy"):null,qe("div",{style:{height:1,marginBottom:-10},"aria-hidden":!0})]})},Hi=["paddingTop","paddingRight","paddingBottom","paddingLeft"],Ki=de;function Vi(e,t){if(!t?.key)return{icon:X,label:""};const{key:n,containerType:o}=t;if("column"===n)return"header"===o?{icon:Z,label:e("block_header")||"Header"}:"footer"===o?{icon:Q,label:e("block_footer")||"Footer"}:"product"===o?{icon:ee,label:e("block_product")}:"discount"===o?{icon:te,label:e("block_discount")}:Mi(t)===Ui?{icon:ne,label:e("block_palette_columns")}:{icon:X,label:e("block_palette_section")};switch(n){case"text":return{icon:ce,label:e("text")};case"button":return{icon:U,label:e("button")};case"image":return{icon:O,label:e("image")};case"video":return{icon:j,label:e("video")};case"divider":return{icon:se,label:e("divider")};case"spacer":return{icon:re,label:e("spacer")};case"menu":return{icon:ie,label:e("menu")};case"avatar":return{icon:W,label:e("avatar")};case"social_link":return{icon:ae,label:e("social_link")};case"raw_html":return{icon:le,label:e("raw_html")};case"table":return{icon:oe,label:e("table")};case"empty":return{icon:X,label:""};default:return{icon:X,label:n||""}}}function Gi(e,t){if("header"!==e?.containerType||!t?.hidden)return!1;const n=String(t.src??""),o=!1===e.showLogo&&"image"===t.key&&!t.headerBannerSlot&&!t.footerBannerSlot&&(!0===t.headerLogoSlot||/\{\{\s*LogoUrl\s*\}\}/.test(n)||n.includes("LogoUrl")),l=!0!==e.showHeaderBanner&&(Boolean(t.headerBannerSlot)||Boolean(t.headerBannerDividerSlot)||"image"===t.key&&n.includes("HeroBanner"));return o||l}function qi(e,t){return"footer"===e?.containerType&&!0!==e?.footerUnifiedLayout&&Boolean(t?.hidden)}const Ji=e=>{const{block:t,blockIndex:o,clearStyles:l}=e,{t:a}=ja(),{previewMode:i,blockMap:r,rootOrder:c,validationMarkers:d,ignoreValidationIssue:u,setBlocks:p,currentItem:m,setCurrentItem:g,setIsDragStart:h,isDragStart:y,bodySettings:b,setActionType:k,onSaveBlockAsGlobal:v}=n(Ln),w="desktop"===i?t.styles?.desktop??{}:{...t.styles?.desktop??{},...t.styles?.mobile??{}},{contentBackground:x,containerBackgroundImage:S,containerBackgroundSize:C,containerBackgroundPosition:N,...L}=w,T="footer"===t.containerType&&t.footerUnifiedLayout?gl(x):x;let A=L,I={};if("discount"===t.containerType){A={...L},I={};for(const e of Hi)Object.prototype.hasOwnProperty.call(A,e)&&(I[e]=A[e],delete A[e])}if("footer"===t.containerType&&t.footerUnifiedLayout){A={...A};for(const e of Hi)delete A[e]}let $=w;if("footer"===t.containerType&&t.footerUnifiedLayout){$={...w};for(const e of Hi)delete $[e]}const P="undefined"!=typeof window?window.__eeDragItemData:null,R=P?.key??(m?.id?r[m.id]?.key:null)??m?.data?.key,M=y&&"column"!==R,D=e=>t=>{t.preventDefault(),t.stopPropagation(),g({id:e.id,data:e,type:"edit"}),k("edit")},U=e=>t=>{t.preventDefault(),t.stopPropagation();const n=r[e];n&&(g({id:n.id,data:n,type:"edit"}),k("edit"))},E=(e,t,n)=>o=>{o.preventDefault(),o.stopPropagation();const l=r[e]?.cells?.[t]?.childrenIds?.[n];if(l){const e=Oa(r,c,l);if(e?.nextBlockMap)return p(e.nextBlockMap,c,"edit"),void g(null)}const{blockMap:i,removedId:s}=Xt(r,e,t,n);let d=i;const u=i[e];if(u&&0===u.cells[t].childrenIds.length){const n=Wt(a("drag_block_here"));d={...i,[n.id]:n,[e]:{...u,cells:u.cells.map((e,o)=>o===t?{...e,childrenIds:[n.id]}:e)}}}s&&(d=en(d,s)),p(d,c,"delete"),g(null)},z=e=>()=>{h(!0),g({id:e.id,data:e,type:"move"}),k("move")},F=e=>{e.preventDefault(),e.stopPropagation(),setTimeout(()=>{e.target.style.border="",e.target.children[0]&&e.target.children[0].classList.remove("sidebar-block-move"),h(!1),l&&l()},50)},O=e=>e.preventDefault(),W=e=>{e.preventDefault(),e.stopPropagation()},j=(e,t)=>n=>{W(n);const o=Qt(r,c,e,t);o&&p(o.nextMap,o.nextRootOrder,"move")},X=e=>t=>{W(t);const n=Ai(r,c,e);n&&(p(n.nextMap,n.nextRootOrder,"add"),g({id:n.newId,data:n.selectionData,type:"edit"}))},Z=e=>"desktop"===i?e.styles?.desktop||{}:{...e.styles?.desktop||{},...e.styles?.mobile||{}},Q=Ft(b),ee=Ot(b),te="mobile"===i||ee?"100%":Q,ne="mobile"===i||ee?"100%":Q,oe=e=>{const t=d?.[e];if(!t)return null;const n="error"===t.severity?`${t.errorCount} error${1===t.errorCount?"":"s"}`:"warning"===t.severity?`${t.warningCount} warning${1===t.warningCount?"":"s"}`:`${t.infoCount??t.totalCount} info`,o=qe("div",{className:"block-validation-popover",children:t.issues.map((e,t)=>{const n=Boolean(e.blockId&&r?.[e.blockId]);return Je("div",{className:"block-validation-popover-item",children:[qe("div",{className:"block-validation-popover-message",children:e.message}),Je("div",{className:"block-validation-popover-actions",children:[n&&qe(_,{size:"small",type:"text",className:"block-validation-popover-open-block",onClick:(o=e.blockId,e=>{e.preventDefault(),e.stopPropagation(),o&&r?.[o]&&(g({id:o,data:r[o],type:"edit"}),k("edit"),"undefined"!=typeof window&&window.requestAnimationFrame(()=>{const e="function"==typeof window.CSS?.escape?window.CSS.escape(String(o)):String(o).replace(/([ #;?%&,.+*~':"!^$[\]()=>|/@])/g,"\\$1"),t=document.querySelector(`[data-block-id="${e}"]`);t&&"function"==typeof t.scrollIntoView&&t.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})}))}),children:a("export_validation_open_block")||"Open block"}),"function"==typeof u&&qe(_,{size:"small",type:"text",className:"block-validation-popover-ignore",onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e)},children:a("ignore")})]})]},`${e.code}-${t}`);var o})});return qe(f,{trigger:["hover","click"],placement:"topRight",overlayClassName:"block-validation-popover-overlay",content:o,getPopupContainer:()=>document.querySelector("#preview")||document.body,children:Je("button",{type:"button",className:za("block-validation-indicator","error"===t.severity?"block-validation-indicator-error":"warning"===t.severity?"block-validation-indicator-warning":"block-validation-indicator-info"),"aria-label":n,onClick:e=>{e.preventDefault(),e.stopPropagation()},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},children:[qe("span",{className:"block-validation-indicator-dot"}),qe("span",{className:"block-validation-indicator-count",children:t.totalCount})]})})},le=(e,t,n,o,l,c,d=1)=>{const u=Z({styles:e.styles}),{contentBackground:p,containerBackgroundImage:g,containerBackgroundSize:h,containerBackgroundPosition:y,...f}=u,_=m?.id===e.id,k=((e=1)=>({"--nested-level":Math.max(1,e),"--nested-width":"100%"}))(d);return Je(Ye,{children:[Je("div",{className:"relative block-content-drag-label-content","data-drop-key":l,children:[qe("div",{className:"absolute block-move-top",children:qe("span",{className:"block-tools-drag_here",children:a("drag_block_here")})}),M&&qe("div",{className:"block-move-content-top","data-name":"dragTools","data-position":"top","data-container-id":t,"data-cell-index":n,"data-item-index":o,"data-drop-key":l,"data-type":"block-item-move"})]}),qe("div",{className:za("block-item block-item-container",_&&"block-item-focus"),style:k,"data-block-id":e.id,onMouseEnter:e=>{e.currentTarget.dataset.hovered="true"},onMouseLeave:e=>{delete e.currentTarget.dataset.hovered},onClick:D(e),children:Je("div",{className:"relative",children:[oe(e.id),qe("div",{className:"block-item-tools",onDragOver:O,children:M&&Je(Ye,{children:[qe("div",{className:"block-move-content-top","data-name":"dragTools","data-position":"top","data-container-id":t,"data-cell-index":n,"data-item-index":o,"data-drop-key":l,"data-type":"block-item-move"}),qe("div",{className:"block-move-content-bottom","data-name":"dragTools","data-position":"bottom","data-container-id":t,"data-cell-index":n,"data-item-index":o+1,"data-drop-key":c,"data-type":"block-item-move"})]})}),(()=>{const l=r[t]?.cells?.[n],i=o>0,s=o<(l?.childrenIds?.length??0)-1,c=Vi(a,e);return Je("div",{className:"block-chrome-overlay",children:[Je("span",{className:"block-chrome-badge",children:[qe(B,{icon:c.icon}),qe("span",{children:c.label})]}),Je("div",{className:"block-chrome-toolbar",children:[qe("span",{className:"block-chrome-action",onMouseDown:W,onClick:U(t),title:a("select_parent_section_tooltip"),children:qe(B,{icon:Ki})}),qe("span",{className:za("block-chrome-action",!i&&"block-chrome-action-disabled"),onMouseDown:W,onClick:j(e.id,-1),title:a("context_move_up"),children:qe(B,{icon:K})}),qe("span",{className:za("block-chrome-action",!s&&"block-chrome-action-disabled"),onMouseDown:W,onClick:j(e.id,1),title:a("context_move_down"),children:qe(B,{icon:V})}),qe("span",{className:"block-chrome-divider","aria-hidden":!0}),qe("span",{className:"block-chrome-action",onMouseDown:W,onClick:X(e.id),title:a("context_duplicate"),children:qe(B,{icon:G})}),qe("span",{className:"block-chrome-divider","aria-hidden":!0}),qe("span",{className:"block-chrome-action block-chrome-action-danger",onMouseDown:W,onClick:E(t,n,o),title:a("layer_delete"),children:qe(B,{icon:J})}),qe("span",{className:"block-chrome-action block-chrome-action-disabled ee-section-nested-no-drag",draggable:!1,onMouseDown:e=>e.stopPropagation(),title:a("section_nest_not_allowed"),style:{cursor:"not-allowed"},children:qe(B,{icon:Y})})]})]})})(),qe("div",{style:{...f,overflow:f.borderRadius?"hidden":void 0},children:qe("div",{className:"block-content block-item-container-body",style:{...sl(u,p),borderRadius:f.borderRadius,overflow:f.borderRadius?"hidden":void 0,...null!=f.minHeight&&""!==f.minHeight&&""!==String(f.minHeight).trim()?{minHeight:f.minHeight}:{}},children:(e.children||[]).map((t,n)=>{const o=Z(t);return qe("div",{style:{...o,width:"mobile"===i&&!1!==b.stackColumnsOnMobile?"100%":t.width},children:(t.children||[]).map((o,l)=>{const i=`${e.id}:${n}:${l}`,r=`${e.id}:${n}:${l+1}`,c=l===t.children.length-1&&"empty"!==o.key&&"column"!==o.key;return Je(s,{children:[ae(o,e.id,n,l,i,r,d),c&&qe("div",{className:"relative block-content-drag-label-content","data-drop-key":r,children:qe("div",{className:"absolute block-move-bottom",children:qe("span",{className:"block-tools-drag_here",children:a("drag_block_here")})})})]},`${e.id}:${n}:${o.id||l}`)})},`${e.id}:${t.id||"cell"}:${n}`)})})})]})}),Je("div",{className:"relative block-content-drag-label-content","data-drop-key":c,children:[qe("div",{className:"absolute block-move-bottom",children:qe("span",{className:"block-tools-drag_here",children:a("drag_block_here")})}),M&&qe("div",{className:"block-move-content-bottom","data-name":"dragTools","data-position":"bottom","data-container-id":t,"data-cell-index":n,"data-item-index":o+1,"data-drop-key":c,"data-type":"block-item-move"})]})]})},ae=(e,n,o,l,i,c,d=0)=>"empty"===e.key?qe("div",{className:"relative width-full",children:qe("div",{className:"block-empty-content ee-empty-drop-slot",onDragOver:M?O:void 0,...M?{"data-container-id":n,"data-cell-index":o,"data-item-index":l,"data-type":"empty-block-item"}:{},"aria-label":e.name||a("drag_block_here"),children:qe("span",{className:"ee-empty-drop-slot__label",children:a("drag_block_here")})})},e.id||l):"column"===e.key?qe(s,{children:le(e,n,o,l,i,c,d+1)},`${n}:${o}:${e.id||l}`):Je(s,{children:[qe("div",{className:"relative block-content-drag-label-content","data-drop-key":i,children:qe("div",{className:"absolute block-move-top",children:qe("span",{className:"block-tools-drag_here",children:a("drag_block_here")})})}),qe("div",{className:za("block-item",m?.id===e.id&&"block-item-focus",e.hidden&&!Gi(t,e)&&!qi(t,e)&&"block-hidden-dim",(Gi(t,e)||qi(t,e))&&"ee-header-banner-off-canvas"),"data-block-id":e.id,onClick:t=>{t.preventDefault(),t.stopPropagation(),Ja(e)&&m?.id===e.id&&qa(a),g({id:e.id,data:e,type:"edit"}),k("edit")},children:Je("div",{className:"relative",children:[oe(e.id),qe("div",{className:za("block-item-tools",Ja(e)&&m?.id===e.id&&"block-item-tools--pointer-through-ai-text"),onDragOver:O,children:M&&Je(Ye,{children:[qe("div",{className:"block-move-content-top","data-name":"dragTools","data-position":"top","data-container-id":n,"data-cell-index":o,"data-item-index":l,"data-drop-key":i,"data-type":"block-item-move"}),qe("div",{className:"block-move-content-bottom","data-name":"dragTools","data-position":"bottom","data-container-id":n,"data-cell-index":o,"data-item-index":l+1,"data-drop-key":c,"data-type":"block-item-move"})]})}),(()=>{const t=r[n]?.cells?.[o],i=l>0,s=l<(t?.childrenIds?.length??0)-1,c=Vi(a,e);return Je("div",{className:"block-chrome-overlay",children:[Je("span",{className:"block-chrome-badge",children:[qe(B,{icon:c.icon}),qe("span",{children:c.label})]}),Je("div",{className:"block-chrome-toolbar",children:[qe("span",{className:"block-chrome-action",onMouseDown:W,onClick:U(n),title:a("select_parent_section_tooltip"),children:qe(B,{icon:Ki})}),qe("span",{className:za("block-chrome-action",!i&&"block-chrome-action-disabled"),onMouseDown:W,onClick:j(e.id,-1),title:a("context_move_up"),children:qe(B,{icon:K})}),qe("span",{className:za("block-chrome-action",!s&&"block-chrome-action-disabled"),onMouseDown:W,onClick:j(e.id,1),title:a("context_move_down"),children:qe(B,{icon:V})}),qe("span",{className:"block-chrome-divider","aria-hidden":!0}),qe("span",{className:"block-chrome-action",onMouseDown:W,onClick:X(e.id),title:a("context_duplicate"),children:qe(B,{icon:G})}),qe("span",{className:"block-chrome-divider","aria-hidden":!0}),qe("span",{className:"block-chrome-action block-chrome-action-danger",onMouseDown:W,onClick:E(n,o,l),title:a("layer_delete"),children:qe(B,{icon:J})}),qe("span",{className:"block-chrome-action block-chrome-drag",draggable:"true",onMouseDown:e=>e.stopPropagation(),onDragEnd:F,onDragStart:z(e),title:a("drag_to_move")||"Drag to move",children:qe(B,{icon:Y})})]})]})})(),qe(Li,{blockItem:e,id:e.id})]})})]},`${n}:${o}:${e.id||l}`),ie=Vi(a,t),re="column"===m?.data?.key&&Mi(m.data)===Ui?a("block_palette_columns"):a("container");return qe(Ye,{children:Je("div",{className:za("relative block-drag-label-content",y&&"column"===R&&"ee-section-drop-preview"),"data-index":o,"data-position":"top",children:[y&&"column"===R?Je("div",{className:"ee-section-drop-slot-outline","aria-hidden":!0,children:[qe("span",{className:"ee-section-drop-badge",children:re}),qe("span",{className:"ee-section-drop-hint",children:a("drag_section_here")})]}):null,qe("div",{className:"absolute block-move-top",children:qe("span",{className:"block-tools-drag_here",children:a("drag_block_here")})}),Je("div",{className:za("relative block",m?.id===t.id&&"block-focus","mobile"===i&&"mobile-block-focus",t.hidden&&"block-hidden-dim","mobile"===i&&t.hiddenOnMobile&&"block-hidden-on-mobile"),"data-block-id":t.id,onClick:D(t),children:["mobile"===i&&t.hiddenOnMobile&&Je("div",{className:"block-hidden-on-mobile-badge","aria-label":a("canvas_hidden_on_mobile")||"Hidden on mobile",children:[qe(B,{icon:H,style:{fontSize:10}}),qe("span",{children:a("canvas_hidden_on_mobile")||"Hidden on mobile"})]}),Je("div",{className:"hover-visible",children:[oe(t.id),Je("div",{className:"block-chrome-overlay",children:[Je("span",{className:"block-chrome-badge",children:[qe(B,{icon:ie.icon}),qe("span",{children:ie.label})]}),Je("div",{className:"block-chrome-toolbar",children:[qe("span",{className:za("block-chrome-action",o<=0&&"block-chrome-action-disabled"),onMouseDown:W,onClick:j(t.id,-1),title:a("context_move_up"),children:qe(B,{icon:K})}),qe("span",{className:za("block-chrome-action",o>=c.length-1&&"block-chrome-action-disabled"),onMouseDown:W,onClick:j(t.id,1),title:a("context_move_down"),children:qe(B,{icon:V})}),qe("span",{className:"block-chrome-divider","aria-hidden":!0}),qe("span",{className:"block-chrome-action",onMouseDown:W,onClick:X(t.id),title:a("context_duplicate"),children:qe(B,{icon:G})}),"function"==typeof v&&qe("span",{className:"block-chrome-action",onMouseDown:W,onClick:(se=t,e=>{W(e),window.dispatchEvent(new CustomEvent("ee:canvas-save-universal",{detail:{block:se}}))}),title:a("save_as_universal"),children:qe(B,{icon:q})}),qe("span",{className:"block-chrome-divider","aria-hidden":!0}),qe("span",{className:"block-chrome-action block-chrome-action-danger",onMouseDown:W,onClick:e=>{e.preventDefault(),e.stopPropagation();const n=en(r,t.id),o=c.filter(e=>e!==t.id);p(n,o,"delete"),g(null)},title:a("layer_delete"),children:qe(B,{icon:J})}),qe("span",{className:"block-chrome-action block-chrome-drag",draggable:"true",onMouseDown:e=>e.stopPropagation(),onDragEnd:F,onDragStart:()=>{h(!0),g({id:t.id,data:t,type:"move"}),k("move")},title:a("drag_to_move")||"Drag to move",children:qe(B,{icon:Y})})]})]})]}),qe("div",{className:"width-full height-full absolute",onDragOver:O,style:{pointerEvents:y&&"column"===R?"auto":"none"},children:y&&"column"===R&&Je(Ye,{children:[qe("div",{className:"block-move-content-top","data-name":"dragTools","data-type":"drag-over-column","data-position":"top","data-index":o}),qe("div",{className:"block-move-content-bottom","data-name":"dragTools","data-type":"drag-over-column","data-position":"bottom","data-index":o+1})]})}),qe("div",{className:"column margin-auto",style:{...A,width:"100%",maxWidth:"100%",overflow:A.borderRadius?"hidden":void 0},children:qe("div",{className:"block-content",style:{...sl($,T),...I,borderRadius:A.borderRadius,overflow:A.borderRadius?"hidden":void 0,width:te,maxWidth:ne,...null!=A.minHeight&&""!==A.minHeight&&""!==String(A.minHeight).trim()?{minHeight:A.minHeight}:{}},"data-index":o,children:t.children.map((e,n)=>{const l="desktop"===i?e.styles?.desktop??{}:{...e.styles?.desktop??{},...e.styles?.mobile??{}};return qe(s,{children:qe("div",{id:`block-content-${o}-${n}`,style:{...l,width:"mobile"===i&&!1!==b.stackColumnsOnMobile?"100%":e.width},children:"footer"===t.containerType&&t.footerUnifiedLayout&&0===n?qe("div",{className:"ee-smart-footer-column-body width-full",children:qe(ji,{column:t,canvasFooterSegment:t.footerSelectedSegment,isFooterColumnSelected:m?.id===t.id,onFooterCanvasSegmentSelect:(e,n)=>{n?.preventDefault?.(),n?.stopPropagation?.();const o=r[t.id];if(!o||"column"!==o.key)return;const l={...o,footerSelectedSegment:e};p({...r,[t.id]:l},c,`edit_${Date.now()}`),g({id:t.id,data:l,type:"edit"}),k("edit")}})},`${t.id}:${n}:footer-unified`):e.children.map((o,l)=>{const i=`${t.id}:${n}:${l}`,r=`${t.id}:${n}:${l+1}`,c=l===e.children.length-1&&"empty"!==o.key&&"column"!==o.key;return Je(s,{children:[ae(o,t.id,n,l,i,r,0),c&&qe("div",{className:"relative block-content-drag-label-content","data-drop-key":r,children:qe("div",{className:"absolute block-move-bottom",children:qe("span",{className:"block-tools-drag_here",children:a("drag_block_here")})})})]},`${t.id}:${n}:${o.id||l}`)})})},`${t.id}:${e.id||"content"}:${n}`)})})})]})]})});var se};function Yi(e){return{id:Nt(),name:e("drag_block_here"),key:"empty",width:"100%",styles:{desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0},mobile:{}}}}function Xi(e,t){return{id:Nt(),name:e("content"),key:"content",width:t,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[Yi(e)]}}function Zi(e,{layoutRole:t,columnLayoutOnly:n,name:o}){const l=n?[Xi(e,"50%"),Xi(e,"50%")]:[Xi(e,"100%")];return{id:Nt(),name:o,key:"column",type:n?"1-1":"full",containerType:"none",layoutRole:t,columnLayoutOnly:n,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},children:l}}const Qi=e=>[Zi(e,{layoutRole:Di,columnLayoutOnly:!1,name:e("block_palette_section")}),Zi(e,{layoutRole:Ui,columnLayoutOnly:!0,name:e("block_palette_columns")}),{id:Nt(),name:e("text"),key:"text",text:e("text_content"),type:"p",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",color:void 0,lineHeight:"20px",paddingTop:16,paddingBottom:16,paddingLeft:16,paddingRight:16,textAlign:"left"},mobile:{}}},{id:Nt(),name:e("button"),key:"button",text:e("button"),type:"link",linkURL:"",contentStyles:{desktop:{textAlign:"center",paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0},mobile:{}},styles:{desktop:{width:"auto",fontSize:12,lineHeight:"140%",borderRadius:4,fontFamily:"sans-serif",paddingTop:10,paddingBottom:10,paddingLeft:20,paddingRight:20,backgroundColor:void 0,color:"#fff",display:"inline-block"},mobile:{}}},{id:Nt(),name:e("spacer"),key:"spacer",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0},mobile:{}},styles:{desktop:{height:16,width:"100%",display:"block"},mobile:{}}},{id:Nt(),name:e("divider"),key:"divider",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"100%",borderTopStyle:"solid",borderTopColor:"#ccc",borderTopWidth:1,display:"inline-block",verticalAlign:"middle"},mobile:{}}},{id:Nt(),name:e("raw_html"),key:"raw_html",html:e("raw_html_default_content"),contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center",width:"100%"},mobile:{}},styles:{desktop:{},mobile:{}}},{id:Nt(),name:e("image"),key:"image",src:"",alt:"Image",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{id:Nt(),name:e("video"),key:"video",videoUrl:"",thumbnailUrl:"",styles:{desktop:{width:"auto",height:"auto",fillColumn:!1,fillColumnMobile:!1,display:"inline-block"},mobile:{}},videoArea:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,backgroundColor:"transparent",borderWidth:0,borderStyle:"solid",borderColor:"#cccccc",borderRadius:0},mobile:{}},contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center",backgroundColor:"transparent"},mobile:{}}},{id:Nt(),name:e("menu"),key:"menu",layoutMode:"nav-only",showLogo:!1,mobileLayout:"inline",linkGapPx:0,linkUnderline:!1,list:[{label:"Page",url:"",target:"_self"},{label:"Page",url:"",target:"_self"}],separator:" | ",contentStyles:{desktop:{paddingTop:16,paddingBottom:16,paddingLeft:16,paddingRight:16,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:14,fontFamily:"sans-serif",color:"#333333",linkColor:"#2faade",letterSpacing:0,fontWeight:"400",textTransform:"none"},mobile:{}}},{id:Nt(),name:e("table")||"Table",key:"table",rows:3,cols:3,structureMode:"static",headerRow:!0,headerCol:!1,stripedRows:!1,cells:{},contentStyles:{desktop:{paddingTop:8,paddingBottom:8,paddingLeft:0,paddingRight:0,textAlign:"left"},mobile:{}},styles:{desktop:{fontSize:14,color:"#333333",borderStyle:"solid",borderWidth:1,borderColor:"#e0e0e0",cellPadding:8,textAlign:"left",headerBg:"#f5f5f5",headerColor:"#333333",stripedRows:!1,stripedBg:"#fafafa"},mobile:{}}},{id:Nt(),name:e("social_link"),key:"social_link",list:[],imageWidth:32,iconSize:"medium",iconColor:"gray",contentStyles:{desktop:{paddingTop:16,paddingBottom:16,paddingLeft:16,paddingRight:16,textAlign:"center"},mobile:{}},styles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0},mobile:{}}}];const er="ee-block-context-menu";function tr(e,t,n){return{label:e,onSelect:t,disabled:n}}const nr=()=>{const{t:e}=ja(),{blockMap:t,rootOrder:l,setBlocks:i,setCurrentItem:s,onSaveBlockAsGlobal:c}=n(Ln),[d,u]=a(null),p=o(()=>u(null),[]);r(()=>{const e=e=>{const n=e.target.closest?.(".email-editor");if(!n)return;const o=e.target.closest?.("[data-block-id]");if(!o||!n.contains(o))return;const l=o.getAttribute("data-block-id");l&&t[l]&&(e.preventDefault(),e.stopPropagation(),u({x:e.clientX,y:e.clientY,blockId:l}))},n=e=>{e.target.closest?.(`.${er}`)||u(null)};return document.addEventListener("contextmenu",e,!0),document.addEventListener("click",n,!0),document.addEventListener("scroll",n,!0),()=>{document.removeEventListener("contextmenu",e,!0),document.removeEventListener("click",n,!0),document.removeEventListener("scroll",n,!0)}},[t]);const m=o((e,n)=>{const o=Qt(t,l,e,n);o&&(i(o.nextMap,o.nextRootOrder,"move"),p())},[t,l,i,p]),h=o(e=>Boolean(Qt(t,l,e,-1)),[t,l]),y=o(e=>Boolean(Qt(t,l,e,1)),[t,l]),b=o(n=>{const o=t[n];if(!o)return[];const a=()=>{const e=Bi(t,l,n);e&&(Ti.tree=e)};return[tr(e("context_duplicate"),()=>{const e=Ai(t,l,n);e&&(i(e.nextMap,e.nextRootOrder,"add"),s({id:e.newId,data:e.selectionData,type:"edit"}),p())},!1),tr(e("context_copy"),()=>{a(),p()},!1),tr(e("context_cut"),()=>{a();const r=()=>{const o=Ri(t,l,n,e);o&&(i(o.nextMap,o.nextRootOrder,"delete"),s(null),p())};if("column"===o.key&&Pi(t,n))return p(),void g.confirm({title:e("shortcut_delete_confirm_title"),content:e("shortcut_delete_confirm_desc"),okText:e("confirm"),cancelText:e("cancel"),wrapClassName:"ee-modal-dark",onOk:r});r()},!1),tr(e("context_paste"),()=>{if(!Ti.tree)return;const e=$i(t,l,Ti.tree,n);e&&(i(e.nextMap,e.nextRootOrder,"add"),s({id:e.newId,data:e.selectionData,type:"edit"}),p())},!Ti.tree),tr(e("context_delete"),()=>{const a=()=>{const o=Ri(t,l,n,e);o&&(i(o.nextMap,o.nextRootOrder,"delete"),s(null),p())};if("column"===o.key&&Pi(t,n))return p(),void g.confirm({title:e("shortcut_delete_confirm_title"),content:e("shortcut_delete_confirm_desc"),okText:e("confirm"),cancelText:e("cancel"),wrapClassName:"ee-modal-dark",onOk:a});a()},!1),tr(e("context_move_up"),()=>m(n,-1),!h(n)),tr(e("context_move_down"),()=>m(n,1),!y(n)),tr(e("context_save_global"),()=>{"function"==typeof c&&c(n),p()},"function"!=typeof c),tr(e("context_reset_styles"),()=>{const o=function(e,t,n){const o=e[t];if(!o||!o.key)return null;const l=Qi(n).find(e=>e.key===o.key);if(!l)return null;const a={...o};return null!=l.styles&&(a.styles=xt(l.styles)),null!=l.contentStyles&&(a.contentStyles=xt(l.contentStyles)),{...e,[t]:a}}(t,n,e);if(!o)return;i(o,l,`edit_${Date.now()}`);const a=o[n];a&&s({id:n,data:"column"===a.key?Kt(n,o):a,type:"edit"}),p()},"empty"===o.key||!Qi(e).some(e=>e.key===o.key))]},[t,l,i,s,e,p,h,y,m,c]);if(!d)return null;const f=b(d.blockId),_="undefined"!=typeof window?window.innerWidth:9999,k="undefined"!=typeof window?window.innerHeight:9999,v=Math.min(d.x,_-220-8),w=Math.min(d.y,k-360-8);return Xe(qe("div",{className:er,style:{position:"fixed",left:v,top:w,zIndex:10050,minWidth:220,background:"#1a1a1a",border:"1px solid rgba(255,255,255,0.12)",borderRadius:8,boxShadow:"0 12px 40px rgba(0,0,0,0.45)",padding:"6px 0"},role:"menu",onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:f.map(e=>qe("button",{type:"button",role:"menuitem",disabled:e.disabled,className:"ee-block-context-menu-item",style:{display:"block",width:"100%",textAlign:"left",padding:"8px 14px",border:"none",background:"transparent",color:e.disabled?"rgba(255,255,255,0.35)":"#f5f5f5",fontSize:13,cursor:e.disabled?"not-allowed":"pointer"},onMouseEnter:t=>{e.disabled||(t.currentTarget.style.background="rgba(255,255,255,0.08)")},onMouseLeave:e=>{e.currentTarget.style.background="transparent"},onClick:()=>{e.disabled||e.onSelect()},children:e.label},e.label))}),document.body)},or=e=>{const{clearStyles:t}=e,{t:o}=ja(),{previewMode:l,bodySettings:a,blockList:c,currentItem:d,blockMap:u,isDragStart:p,setSelectionRange:m}=n(Ln),g=i(null),h="undefined"!=typeof window?window.__eeDragItemData:null,y="undefined"!=typeof window?window.__eeDragSource:null,b=h?.key??(d?.id?u[d.id]?.key:null)??d?.data?.key,f="add"===d?.type||Boolean(h),_=c.length>0&&p&&"product-variables"!==y&&("column"===b||f);r(()=>{const e=St(()=>{try{const n=window.getSelection();if(!n||0===n.rangeCount)return;const o=n.getRangeAt(0),l=document.getElementById("preview");if(!(!!l&&(l.contains(o.commonAncestorContainer)||l===o.commonAncestorContainer)))return;const a=(e=>e?{startContainer:e.startContainer,startOffset:e.startOffset,endContainer:e.endContainer,endOffset:e.endOffset,collapsed:e.collapsed}:null)(o);if(e=g.current,t=a,e&&t&&e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset&&e.collapsed===t.collapsed)return;g.current=a,m(o.cloneRange())}catch(e){console.warn(e)}var e,t},100);return document.addEventListener("selectionchange",e),()=>{document.removeEventListener("selectionchange",e)}},[m]);const k=e=>{e.preventDefault()},v=Ft(a),w=Ot(a),x=a?.styles||{},S=null!=x.color&&""!==String(x.color).trim()?String(x.color).trim():Sn.styles?.color??"#171717",C={width:"desktop"===l?"100%":364,backgroundColor:x.backgroundColor,color:S,fontFamily:x.fontFamily},N={maxWidth:"100%",width:"100%",backgroundColor:"transparent",..."mobile"===l&&!1!==a.scaleFontOnMobile?{fontSize:16}:{}};return Je("div",{className:"preview-main",children:[qe(nr,{}),qe("div",{className:"default-scrollbar",id:"preview",children:qe("div",{className:"preview-content",style:C,children:qe("div",{className:"margin-auto",style:N,children:c.length?Je("div",{className:"preview-column-stack",children:[_&&Je("div",{className:za("block-drag-label-content preview-edge-drop-zone preview-edge-drop-zone-top","column"===b&&"ee-section-drop-preview"),"data-index":0,"data-position":"top",children:["column"===b?Je("div",{className:"ee-section-drop-slot-outline ee-section-drop-slot-outline-edge","aria-hidden":!0,children:[qe("span",{className:"ee-section-drop-badge",children:o("container")}),qe("span",{className:"ee-section-drop-hint",children:o("drag_section_here")})]}):null,qe("div",{className:"absolute block-move-top",children:qe("span",{className:"block-tools-drag_here",children:o("drag_block_here")})}),qe("div",{className:"preview-edge-drop-hit","data-name":"dragTools","data-type":"drag-over-column","data-position":"top","data-index":0,onDragOver:k})]}),c.map((e,n)=>qe(s,{children:qe(Ji,{block:e,blockIndex:n,clearStyles:t})},`${e?.id||"block"}-${n}`)),Je("div",{className:za("relative block-drag-label-content","ee-bottom-stack-drop-slot",p&&!_&&"ee-bottom-stack-drop-slot--active"),"data-index":c.length,"data-position":"bottom",style:{minHeight:p&&!_?52:0},children:[p&&!_?qe("div",{className:"ee-bottom-drop-slot-outline","aria-hidden":!0,children:qe("span",{className:"ee-bottom-drop-slot-label",children:o("drag_block_here")})}):null,qe("div",{className:"absolute block-move-bottom",children:qe("span",{className:"block-tools-drag_here",children:o("drag_block_here")})}),p&&!_&&qe("div",{"data-name":"dragTools","data-type":"drag-over-column","data-position":"bottom","data-index":c.length,onDragOver:k,style:{position:"absolute",inset:0,zIndex:106,pointerEvents:"auto"}})]}),_&&Je("div",{className:za("block-drag-label-content preview-edge-drop-zone preview-edge-drop-zone-bottom","column"===b&&"ee-section-drop-preview"),"data-index":c.length,"data-position":"bottom",children:["column"===b?Je("div",{className:"ee-section-drop-slot-outline ee-section-drop-slot-outline-edge","aria-hidden":!0,children:[qe("span",{className:"ee-section-drop-badge",children:o("container")}),qe("span",{className:"ee-section-drop-hint",children:o("drag_section_here")})]}):null,qe("div",{className:"absolute block-move-bottom",children:qe("span",{className:"block-tools-drag_here",children:o("drag_block_here")})}),qe("div",{className:"preview-edge-drop-hit","data-name":"dragTools","data-type":"drag-over-column","data-position":"bottom","data-index":c.length,onDragOver:k})]})]}):qe("div",{"data-name":"dragEmpty",className:"start-to-add ee-empty-document",style:{width:w?"100%":v,maxWidth:"100%"},"data-type":"empty-block",onDragOver:k,children:Je("div",{className:"ee-empty-document-inner",children:[Je("svg",{className:"ee-empty-document__icon",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,children:[qe("rect",{x:"6",y:"22",width:"14",height:"14",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),qe("rect",{x:"24",y:"22",width:"14",height:"14",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),qe("rect",{x:"6",y:"6",width:"14",height:"14",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),qe("rect",{x:"28",y:"4",width:"14",height:"14",rx:"2",stroke:"currentColor",strokeWidth:"1.5"})]}),qe("p",{className:"ee-empty-document__title",children:o("drop_content_here")}),qe("p",{className:"ee-empty-document__hint",children:o("drop_content_hint")})]})})})})})]})},lr=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i,ar=/^rgba?\(\s*(\d{1,3})\s*[, ]\s*(\d{1,3})\s*[, ]\s*(\d{1,3})(?:\s*[,/]\s*([0-9.]+))?\s*\)$/i,ir=e=>(e=>Math.max(0,Math.min(255,Number.isFinite(e)?Math.round(e):0)))(e).toString(16).padStart(2,"0"),rr=(e,t="#000000")=>{const n=String(e??"").trim();if(!n)return t;if("transparent"===n.toLowerCase())return t;if(/^[0-9a-f]{3}$/i.test(n)){return`#${n.toLowerCase().split("").map(e=>e+e).join("")}`}if(/^[0-9a-f]{6}$/i.test(n))return`#${n.toLowerCase()}`;if(lr.test(n)){if(4===n.length){const[,e,t,o]=n;return`#${e}${e}${t}${t}${o}${o}`.toLowerCase()}return n.toLowerCase()}const o=n.match(ar);if(o){const e=Number(o[1]),t=Number(o[2]),n=Number(o[3]);return`#${ir(e)}${ir(t)}${ir(n)}`.toLowerCase()}const l=(e=>{if("undefined"==typeof document)return null;const t=document.createElement("span");if(t.style.color="",t.style.color=String(e??"").trim(),!t.style.color)return null;const n=t.style.color.match(ar);if(!n)return null;const o=Number(n[1]),l=Number(n[2]),a=Number(n[3]);return`#${ir(o)}${ir(l)}${ir(a)}`.toLowerCase()})(n);return l||t},sr={backgroundImage:"linear-gradient(45deg, #1f1f1f 25%, transparent 25%), linear-gradient(-45deg, #1f1f1f 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #1f1f1f 75%), linear-gradient(-45deg, transparent 75%, #1f1f1f 75%)",backgroundSize:"8px 8px",backgroundPosition:"0 0, 0 4px, 4px -4px, -4px 0px"},cr=({color:e,setColor:t,fallbackColor:n="#ffffff",variant:o="field"})=>{const[l,i]=a(!1),r=rr(e,n),s=r;return qe(f,{zIndex:1070,getPopupContainer:()=>document.querySelector(".right-settings")||document.body,content:qe("div",{className:"select-none ee-color-picker-popover",children:qe(Ze,{disableAlpha:!0,color:r,style:{boxShadow:"none"},onChange:e=>t({hex:rr(e?.hex,n)})})}),trigger:"click",open:l,onOpenChange:i,children:"field"===o?Je("button",{type:"button",className:"ee-color-picker-field-trigger","aria-label":"Open color picker",children:[qe("span",{className:"ee-color-picker-field-swatch",style:{background:"transparent"===s?void 0:s,..."transparent"===s?sr:{}}}),qe("span",{className:"ee-color-picker-field-hex","aria-hidden":!0,children:r.toUpperCase()}),qe("span",{className:"ee-color-picker-field-chevron","aria-hidden":!0})]}):qe("button",{type:"button",className:"color-picker-button","aria-label":"Open color picker",style:{background:s,backgroundImage:"transparent"===s?sr.backgroundImage:void 0,backgroundSize:"transparent"===s?sr.backgroundSize:void 0,backgroundPosition:"transparent"===s?sr.backgroundPosition:void 0}})})},dr=[{key:"paddingTop",suffix:"T"},{key:"paddingRight",suffix:"R"},{key:"paddingBottom",suffix:"B"},{key:"paddingLeft",suffix:"L"}],ur=({padding:e,onChange:t,min:n=0,disabled:o})=>{const{t:l}=ja(),a=n=>o=>{const l="number"==typeof o?o:null==o||""===o?0:Number(o);Number.isNaN(l)||t({...e,[n]:l})};return qe("div",{className:"ee-settings-padding-grid",role:"group","aria-label":l("padding_settings"),children:dr.map(({key:t,suffix:l})=>qe(k,{min:n,step:1,value:e?.[t]??0,onChange:a(t),disabled:o,addonAfter:qe("span",{className:"ee-settings-padding-addon-side","aria-hidden":!0,children:l}),className:"input-width ee-settings-input-affix ee-padding-side-input-num",onFocus:e=>e?.target?.select?.()},t))})},pr=e=>qe(b,{...e,className:`ee-settings-switch ${e.className||""}`.trim()}),mr=({padding:e,setPadding:t,showLinkSides:n=!0})=>{const{t:o}=ja(),[l,i]=a(!1);return n?Je("div",{className:"padding-settings ee-padding-settings-v2",children:[l?qe(k,{min:0,step:1,addonAfter:"px",className:"input-width ee-settings-input-affix ee-padding-linked-input-num",value:e?.paddingTop??0,onChange:n=>{const o="number"==typeof n?n:0;t({...e,paddingTop:o,paddingRight:o,paddingBottom:o,paddingLeft:o})},onFocus:e=>e?.target?.select?.()}):qe(ur,{padding:e,onChange:t,min:0}),Je("div",{className:"ee-settings-row ee-padding-link-sides-row padding-settings-link-row",children:[Je("span",{className:"ee-padding-link-sides-label",children:[o("padding_link_sides_label"),qe(v,{title:o("padding_link_sides_tooltip"),children:qe("span",{className:"ee-help-icon ee-padding-link-sides-help","aria-label":o("padding_link_sides_tooltip"),children:qe(B,{icon:A})})})]}),qe(pr,{checked:l,onChange:i})]})]}):qe("div",{className:"padding-settings ee-padding-settings-v2 ee-padding-settings-plain",children:qe(ur,{padding:e,onChange:t,min:0})})};function gr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var hr,yr={exports:{}};hr=yr,function(){var e={}.hasOwnProperty;function t(){for(var e="",t=0;t<arguments.length;t++){var l=arguments[t];l&&(e=o(e,n(l)))}return e}function n(n){if("string"==typeof n||"number"==typeof n)return n;if("object"!=typeof n)return"";if(Array.isArray(n))return t.apply(null,n);if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]"))return n.toString();var l="";for(var a in n)e.call(n,a)&&n[a]&&(l=o(l,a));return l}function o(e,t){return t?e?e+" "+t:e+t:e}hr.exports?(t.default=t,hr.exports=t):window.classNames=t}();var br=gr(yr.exports);const fr=()=>{const{t:e}=ja(),t=Qi(e),n=(e=>{const t={desktop:{textAlign:"center",paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0},mobile:{}},n={key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},o=o=>({name:e("content"),key:"content",width:o,styles:n,children:[{name:e("drag_block_here"),key:"empty",width:"100%",styles:t}]});return{full:{columns:1,type:"full",children:[{name:e("content"),key:"content",width:"100%",styles:n,children:[{name:e("drag_block_here"),key:"empty",width:"100%",styles:t}]}]},"1-1":{columns:2,type:"1-1",children:Array.from({length:2}).map(()=>({name:e("content"),key:"content",width:"50%",styles:n,children:[{name:e("drag_block_here"),key:"empty",width:"100%",styles:t}]}))},"1-1-1":{columns:3,type:"1-1-1",children:Array.from({length:3}).map(()=>({name:e("content"),key:"content",width:"33.3%",styles:n,children:[{name:e("drag_block_here"),key:"empty",width:"100%",styles:t}]}))},"1-2-1":{columns:3,type:"1-2-1",children:Array.from({length:3}).map((e,t)=>o(1===t?"50%":"25%"))},"2-1-1":{columns:3,type:"2-1-1",children:Array.from({length:3}).map((e,t)=>o(0===t?"50%":"25%"))},"1-1-2":{columns:3,type:"1-1-2",children:Array.from({length:3}).map((e,t)=>o(2===t?"50%":"25%"))},"1-1-1-1":{columns:4,type:"1-1-1-1",children:Array.from({length:4}).map(()=>({name:e("content"),key:"content",width:"25%",styles:n,children:[{name:e("drag_block_here"),key:"empty",width:"100%",styles:t}]}))},"1-2":{columns:2,type:"1-2",children:Array.from({length:2}).map((e,t)=>o(0===t?"33.3%":"66.6%"))},"2-1":{columns:2,type:"2-1",children:Array.from({length:2}).map((e,t)=>o(0===t?"66.6%":"33.3%"))},"1-3":{columns:2,type:"1-3",children:Array.from({length:2}).map((e,t)=>o(0===t?"25%":"75%"))},"3-1":{columns:2,type:"3-1",children:Array.from({length:2}).map((e,t)=>o(0===t?"75%":"25%"))},"2-3":{columns:2,type:"2-3",children:Array.from({length:2}).map((e,t)=>o(0===t?"40%":"60%"))},"3-2":{columns:2,type:"3-2",children:Array.from({length:2}).map((e,t)=>o(0===t?"60%":"40%"))},"2-4-2-4":{columns:4,type:"2-4-2-4",children:Array.from({length:4}).map((o,l)=>({name:e("content"),key:"content",width:l%2==0?"16.6%":"33.3%",styles:n,children:[{name:e("drag_block_here"),key:"empty",width:"100%",styles:t}]}))},"4-2-4-2":{columns:4,type:"4-2-4-2",children:Array.from({length:4}).map((o,l)=>({name:e("content"),key:"content",width:l%2==0?"33.3%":"16.6%",styles:n,children:[{name:e("drag_block_here"),key:"empty",width:"100%",styles:t}]}))}}})(e),o=(e=>t=>{const n={id:Nt(),name:e("drag_block_here"),key:"empty",width:"100%",styles:{desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0},mobile:{}}};return{id:Nt(),name:e("container"),key:"column",type:"full",containerType:"none",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},children:[{id:Nt(),name:e("content"),key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[t||n]}]}})(e);return{blockConfigsList:t,columnsSetting:n,getColumnConfig:o}},_r=({children:e,className:t=""})=>qe("h3",{className:`ee-settings-section-title ${t}`.trim(),children:e}),kr=e=>e?qe("span",{style:{color:"var(--ee-text-tertiary)",fontWeight:400,fontSize:11,marginLeft:6},children:"optional"}):null,vr=({label:e,hint:t,optional:n,children:o,className:l="",layout:a="stack"})=>Je("div",{className:`ee-settings-field ${"toggle"===a?"ee-settings-field--toggle":""} ${l}`.trim(),children:["toggle"===a&&e?Je("div",{className:"ee-settings-row ee-settings-field-toggle-inner",children:[Je("span",{className:"ee-settings-row-label",children:[e,kr(n)]}),o]}):Je(Ye,{children:[e?Je("div",{className:"ee-settings-field-label",children:[e,kr(n)]}):null,o]}),t?qe("div",{style:{fontSize:11,color:"var(--ee-text-tertiary)",lineHeight:1.5},children:t}):null]}),wr=({widths:e})=>{const t=e.reduce((e,t)=>e+parseFloat(t),0)||1;return qe("div",{style:{display:"flex",height:18,gap:2,borderRadius:2,overflow:"hidden",width:36,flexShrink:0},children:e.map((e,n)=>qe("div",{style:{flex:parseFloat(e)/t,background:"rgba(216, 254, 145, 0.5)",borderRadius:1}},n))})},xr=[{key:"full",labelKey:"column_preset_1_col",widths:["100%"]},{key:"1-1",labelKey:"column_preset_equal_2",widths:["50%","50%"]},{key:"1-1-1",labelKey:"column_preset_equal_3",widths:["33.3%","33.3%","33.3%"]},{key:"1-1-1-1",labelKey:"column_preset_equal_4",widths:["25%","25%","25%","25%"]},{key:"1-2",labelKey:"column_preset_1_2",widths:["33.3%","66.6%"]},{key:"2-1",labelKey:"column_preset_2_1",widths:["66.6%","33.3%"]},{key:"1-3",labelKey:"column_preset_1_3",widths:["25%","75%"]},{key:"3-1",labelKey:"column_preset_3_1",widths:["75%","25%"]},{key:"2-3",labelKey:"column_preset_2_3",widths:["40%","60%"]},{key:"3-2",labelKey:"column_preset_3_2",widths:["60%","40%"]},{key:"1-2-1",labelKey:"column_preset_1_2_1",widths:["25%","50%","25%"]},{key:"2-1-1",labelKey:"column_preset_2_1_1",widths:["50%","25%","25%"]},{key:"1-1-2",labelKey:"column_preset_1_1_2",widths:["25%","25%","50%"]},{key:"2-4-2-4",labelKey:"column_preset_2_4_2_4",widths:["16.6%","33.3%","16.6%","33.3%"]},{key:"4-2-4-2",labelKey:"column_preset_4_2_4_2",widths:["33.3%","16.6%","33.3%","16.6%"]}],Sr=()=>{const{blockMap:e,rootOrder:t,setBlocks:o,currentItem:l,setCurrentItem:a,previewMode:i}=n(Ln),{t:r}=ja(),{columnsSetting:s}=fr();if(!l?.data||"column"!==l.data.key)return null;if(Mi(l.data)!==Ui)return null;const c=l.data.children||[],d=c.length,u=n=>{const{blockMap:i}=jt([n]),r={...e,...i};o(r,t,`edit_${Date.now()}`),a({...l,data:n})},p=e=>{const t=s[e.key]||s.full;if(!t)return;const n=l.data.children||[],o=(t.children||[]).map((e,t)=>{const o=n[t];if(o)return{...o,key:e.key,name:e.name,width:e.width,styles:xt(e.styles??o.styles),children:o.children};const l=Nt();return{...e,id:l}}),a=xt(l.data);a.children=o,u(a)},m=(()=>{const e="desktop"===i?l.data.styles?.desktop:{...l.data.styles?.desktop,...l.data.styles?.mobile},t=e?.columnGap??e?.column_gap??0;return"number"==typeof t?t:parseInt(String(t).replace("px",""),10)||0})(),g=c.reduce((e,t)=>e+parseFloat(t.width||"100"),0)||1,h=xr.filter(e=>s[e.key]);return Je(Ye,{children:[qe(_r,{children:r("grid_settings")}),Je("div",{className:"ee-settings-row ee-columns-count-row",children:[qe("span",{className:"ee-padding-link-sides-label",children:r("columns")}),Je("div",{className:"ee-columns-stepper",children:[qe("button",{type:"button",className:"ee-col-stepper-btn",disabled:d<=1,onClick:()=>{const e=Math.max(1,d-1),t=xr.find(t=>t.widths.length===e);t&&p(t)},"aria-label":r("columns"),children:qe(B,{icon:ue,style:{fontSize:10}})}),qe("span",{className:"ee-columns-stepper-value",children:d}),qe("button",{type:"button",className:"ee-col-stepper-btn",disabled:d>=4,onClick:()=>{const e=Math.min(4,d+1),t=xr.find(t=>t.widths.length===e&&t.key.startsWith("1-1"));if(t)p(t);else{const t=xr.find(t=>t.widths.length===e);t&&p(t)}},"aria-label":r("columns"),children:qe(B,{icon:pe,style:{fontSize:10}})})]})]}),qe(_r,{children:r("presets")}),qe("div",{className:"ee-columns-preset-grid",children:h.map(e=>{const t=d===e.widths.length&&c.every((t,n)=>{const o=parseFloat(t.width||"0"),l=parseFloat(e.widths[n]||"0");return Math.abs(o-l)<1});return Je("button",{type:"button",className:br("ee-columns-preset-btn",t&&"ee-columns-preset-btn--active"),onClick:()=>p(e),children:[qe(wr,{widths:e.widths}),qe("span",{children:r(e.labelKey)})]},e.key)})}),d>1&&Je(Ye,{children:[qe(_r,{children:r("column_sizes")}),qe("div",{className:"ee-columns-width-sliders",children:c.map((e,t)=>{const n=(e=>{if("string"!=typeof e)return 1;const t=parseFloat(e.replace("%",""));return isNaN(t)?1:t})(e.width)/g*100;return Je("div",{className:"ee-columns-width-slider-row",children:[Je("span",{className:"ee-columns-width-col-label",children:[r("col")," ",t+1]}),qe("input",{type:"range",min:10,max:90,step:1,value:Math.round(n),onChange:e=>{const n=parseInt(e.target.value,10),o=t===d-1?0:d-1,a=100-n-c.reduce((e,n,l)=>l===t||l===o?e:e+Math.round(parseFloat(n.width||"0")/g*100),0),i=xt(l.data);i.children=i.children.map((e,l)=>l===t?{...e,width:`${n}%`}:l===o?{...e,width:`${Math.max(10,a)}%`}:e),u(i)},className:"ee-columns-width-range"}),Je("span",{className:"ee-columns-width-pct",children:[Math.round(n),"%"]})]},e.id||t)})})]}),qe(_r,{children:r("gaps")}),qe(vr,{label:r("column_gap"),children:qe(k,{min:0,max:60,className:"input-width ee-settings-input-affix",addonAfter:"px",value:m,onChange:e=>(e=>{const t=xt(l.data);t.styles||(t.styles={desktop:{},mobile:{}}),t.styles[i]||(t.styles[i]={}),Object.assign(t.styles[i],e),u(t)})({columnGap:e??0})})})]})},Cr=({items:e,value:t,onChange:n,size:o="md",className:l="","aria-label":a})=>qe("div",{className:`ee-settings-segmented ${"sm"===o?"ee-settings-segmented--sm":""} ${l}`.trim(),role:"group","aria-label":a,children:e.map(e=>{const o="string"==typeof e?e:e.value,l="string"==typeof e?e:e.label,a="object"==typeof e&&e.icon?e.icon:null,i=o===t,r="object"==typeof e&&e.iconOnly;return Je("button",{type:"button",title:"string"==typeof l?l:void 0,className:`ee-settings-segmented-btn${i?" ee-settings-segmented-btn--active":""}${r?" ee-settings-segmented-btn--icon-only":""}`,onClick:()=>n&&n(o),children:[a,l]},String(o))})}),Nr=e=>{if(!e||"string"!=typeof e)return!1;try{const t=new URL(e);return/\/knowledge-base\/products$/i.test(t.pathname.replace(/\/$/,""))}catch{return/knowledge-base\/products\/?$/i.test(String(e).trim().replace(/\/$/,""))}},Lr=e=>{if(!e||"object"!=typeof e)return null;const t=null!=e.id?String(e.id):null!=e.resourceId?String(e.resourceId):"";if(!t)return null;const n=e.price,o="number"==typeof n?n:parseFloat(String(n??"").replace(/,/g,""));return{id:t,name:e.name??"",description:Mn(e.description),image:e.image_url??e.image??"",link:e.url??"",price:Number.isFinite(o)?o:0,currency:e.currency??"USD",old_price:null!=e.old_price?e.old_price:null,new_price:null!=e.new_price?e.new_price:null,resourceId:e.resourceId,source:e.source}},Tr=async(e,t,n={},{page:o=1,limit:l=20,search:a=""}={})=>{if(!e)return null;try{if(Nr(e)){if(!t)return null;const i=e.replace(/\/$/,""),r=new URL(`${i}/${encodeURIComponent(t)}`);r.searchParams.set("page",String(o)),r.searchParams.set("limit",String(l)),r.searchParams.set("search",a??"");const s=await fetch(r.toString(),{method:"GET",headers:{"Content-Type":"application/json",...n}});if(!s.ok)return console.error("[API Service] KB products fetch failed:",s.status,s.statusText),null;const c=await s.json(),d=Array.isArray(c.data)?c.data:[];return{products:d.map(Lr).filter(Boolean),meta:c.meta&&"object"==typeof c.meta?c.meta:{}}}const i=new URL(e);t&&i.searchParams.append("companyId",t);const r=await fetch(i.toString(),{method:"GET",headers:{"Content-Type":"application/json",...n}});if(!r.ok)return console.error("[API Service] Products fetch failed:",r.status,r.statusText),null;const s=await r.json();if(!1===s.success)return console.error("[API Service] Products API returned error:",s.error),null;const c=s.data?.products??[],d=Array.isArray(c)?c.map(e=>e&&"object"==typeof e?{...e,description:Mn(e.description)}:e):[];return Array.isArray(d)&&0!==d.length?{products:d,meta:{hasMore:!1,hasProducts:!0}}:{products:[],meta:{hasMore:!1,hasProducts:!1}}}catch(e){return console.error("[API Service] Error fetching products:",e),null}},Br={};function Ar(){return"undefined"!=typeof document?document.body:null}function Ir(e){if(!e)return"";const t=e.currency??"",n=e.price?.amount??e.price??"";return`${e.name} — ${t} ${n}`.trim()}function $r(e,t){const n=new Map;return[...e,...t].forEach(e=>{e&&e.id&&n.set(e.id,e)}),Array.from(n.values())}function Pr({apiConfig:e,templateData:t,value:n,selectedProduct:r,onChange:s,placeholder:c,staticProductList:d=[],getPopupContainer:u}){const{t:p}=ja(),m=e?.productsEndpoint,g=e?.companyId??t?.companyId,h=l(()=>{const t=e?.headers;return t&&"object"==typeof t?t:Br},[e?.headers]),y=Boolean(m&&g)&&Nr(m),[b,f]=a([]),[_,k]=a({}),[v,S]=a(!1),[C,N]=a(""),[L,T]=a(""),B=i(null),A=i(0),I=i(1),$=i(""),P=i(!1),R=i(""),M=o(async(e,t,n)=>{if(!y)return;const o=(t??"").trim();if(n){const t=`${o}::${e}`;if(P.current&&R.current===t)return;P.current=!0,R.current=t}const l=++A.current;S(!0);try{const a=await Tr(m,g,h,{page:e,limit:20,search:o});if(l!==A.current)return;if(!a)return n||(f([]),T((t??"").trim())),void k({});k(a.meta||{}),f(e=>n?$r(e,a.products):a.products),I.current=e}finally{n&&(P.current=!1,R.current=""),l===A.current&&S(!1)}},[y,m,g,h]),D=o(async e=>{if(!y)return;const t=(e??"").trim();P.current=!1,R.current="";const n=++A.current;S(!0);try{if(""!==t){const e=await Tr(m,g,h,{page:1,limit:20,search:t});if(n!==A.current)return;return e?(k(e.meta||{}),f(e.products),T(t),void(I.current=1)):(f([]),k({}),T(t),void(I.current=1))}let e=1,o=[],l={};for(;o.length<10&&e<=15;){const t=await Tr(m,g,h,{page:e,limit:20,search:""});if(n!==A.current)return;if(!t?.products?.length)break;if(o=$r(o,t.products),l=t.meta||{},I.current=e,!l.hasMore)break;e+=1}k(l),f(o),T("")}finally{n===A.current&&S(!1)}},[y,m,g,h]),U=o(()=>{if(!y||v||!_?.hasMore)return;const e=I.current+1;M(e,$.current,!0)},[y,v,_?.hasMore,M]),E=u??Ar,z=o(e=>Je("div",{children:[e,v&&b.length>0&&Je("div",{className:"ee-kb-product-select-footer",children:[qe(w,{size:"small"})," ",qe("span",{children:p("loading")})]}),!v&&_?.hasMore&&qe("div",{className:"ee-kb-product-select-footer",children:qe("button",{type:"button",className:"ee-kb-product-select-load-more",onClick:U,children:p("load_more_products")})})]}),[v,b.length,_?.hasMore,U,p]),F=l(()=>{const e=y?b:d;return $r(r?.id?[r]:[],e)},[y,b,d,r]),O=l(()=>F.map(e=>({value:e.id,label:Ir(e)})),[F]),W=e=>{if(!e)return s(null),void(y&&(clearTimeout(B.current),N(""),$.current="",I.current=1,T(""),D("")));const t=F.find(t=>t.id===e)||d.find(t=>t.id===e);s(t||null)},j="ee-kb-product-select-dropdown";return qe(x,y?{className:"ee-stack-control ee-kb-product-select",value:n??void 0,placeholder:c,style:{width:"100%"},virtual:!0,dropdownMatchSelectWidth:!0,listHeight:320,listItemHeight:32,dropdownClassName:j,getPopupContainer:E,onChange:W,allowClear:!0,showSearch:!0,filterOption:!1,searchValue:C,onSearch:e=>{if(!y)return;const t=e??"";N(t);const n=t.trim();if(clearTimeout(B.current),""===n)return $.current="",I.current=1,void D("");B.current=setTimeout(()=>{$.current=n,I.current=1,D(n)},400)},onOpenChange:e=>{clearTimeout(B.current),e?(P.current=!1,R.current="",N(""),$.current="",I.current=1,D("")):(P.current=!1,R.current="",N(""),$.current="")},notFoundContent:v?Je("span",{className:"ee-kb-product-select-loading",children:[qe(w,{size:"small"})," ",p("loading")]}):O.length>0?null:qe("span",{className:"ee-kb-product-select-empty",children:""!==L.trim()?p("no_products_matching_search"):p("no_product_found")}),options:O,dropdownRender:z}:{className:"ee-stack-control",value:n??void 0,placeholder:c,style:{width:"100%"},virtual:!0,dropdownMatchSelectWidth:!0,listHeight:320,listItemHeight:32,dropdownClassName:j,getPopupContainer:E,onChange:W,allowClear:!0,showSearch:!0,optionFilterProp:"label",options:d.map(e=>({value:e.id,label:Ir(e)}))})}const Rr=()=>{const{previewMode:e,currentItem:t,blockMap:o,rootOrder:l,setBlocks:a,setCurrentItem:i}=n(Ln),r=e=>{let n;if("column"===e.key){const{blockMap:t}=jt([e]);n={...o,...t}}else n={...o,[t.id]:e};a(n,l,`edit_${(new Date).getTime()}`),i({...t,data:e})};return{findStyleItem:(t,n)=>{if(!t)return;const o=t[e]?.[n];return null!=o&&""!==o?o:t.desktop?.[n]},cardItemElement:(e,t)=>Je("div",{className:"card-item",children:[qe("div",{className:"card-item-title",children:e}),qe("div",{children:t})]}),updateItemStyles:r,colorChange:n=>({hex:o})=>{const l=xt(t.data);l.styles[e][n]=o,r(l)},paddingChange:n=>{const o=xt(t.data);o.styles[e]={...o.styles[e],...n},r(o)},otherStylesChange:(n,o)=>{const l=xt(t.data);l.styles||(l.styles={desktop:{},mobile:{}}),l.styles[e]||(l.styles[e]={}),l.styles[e][n]=o,r(l)},inputChange:n=>o=>{const l=xt(t.data);l.styles||(l.styles={desktop:{},mobile:{}}),l.styles[e]||(l.styles[e]={}),l.styles[e][n]=o,r(l)}}};var Mr={presets:[{id:"preset_header",presetName:"Header",nameKey:"preset_header",containerType:"header",block:{name:"Container",key:"column",type:"full",containerType:"header",headerLayout:"logo_center_nav_below",showHeaderBanner:!1,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",headerLogoSlot:!0,src:"{{LogoUrl}}",alt:"Logo",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:16,paddingBottom:8,paddingLeft:24,paddingRight:24,textAlign:"center"},mobile:{}},styles:{desktop:{width:"30%"},mobile:{}}},{name:"Menu",key:"menu",useNavigationLinks:!0,list:[{label:"Link 1",url:"#",target:"_blank"},{label:"Link 2",url:"#",target:"_blank"},{label:"Link 3",url:"#",target:"_blank"}],separator:" | ",contentStyles:{desktop:{paddingTop:8,paddingBottom:16,paddingLeft:24,paddingRight:24,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:13,fontFamily:"sans-serif",color:"#525252",linkColor:"#525252",letterSpacing:.02,fontWeight:"500",textTransform:"uppercase"},mobile:{}},isPreset:!0},{name:"Image",key:"image",headerBannerSlot:!0,hidden:!0,src:"{{HeroBanner}}",alt:"",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Divider",key:"divider",headerBannerDividerSlot:!0,hidden:!0,contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"100%",borderTopStyle:"solid",borderTopColor:"#ccc",borderTopWidth:1,display:"inline-block",verticalAlign:"middle"},mobile:{}}}]}]}},{id:"preset_header_centered",presetName:"Header (Centered)",nameKey:"preset_header_centered",containerType:"header",block:{name:"Container",key:"column",type:"full",containerType:"header",headerLayout:"logo_center_nav_below",showHeaderBanner:!1,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",headerLogoSlot:!0,src:"{{LogoUrl}}",alt:"Logo",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:16,paddingBottom:8,paddingLeft:24,paddingRight:24,textAlign:"center"},mobile:{}},styles:{desktop:{width:"30%"},mobile:{}}},{name:"Menu",key:"menu",useNavigationLinks:!0,list:[{label:"Link 1",url:"#",target:"_blank"},{label:"Link 2",url:"#",target:"_blank"},{label:"Link 3",url:"#",target:"_blank"}],separator:" | ",contentStyles:{desktop:{paddingTop:8,paddingBottom:16,paddingLeft:24,paddingRight:24,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:13,fontFamily:"sans-serif",color:"#525252",linkColor:"#525252",letterSpacing:.02,fontWeight:"500",textTransform:"uppercase"},mobile:{}},isPreset:!0},{name:"Image",key:"image",headerBannerSlot:!0,hidden:!0,src:"{{HeroBanner}}",alt:"",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Divider",key:"divider",headerBannerDividerSlot:!0,hidden:!0,contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"100%",borderTopStyle:"solid",borderTopColor:"#ccc",borderTopWidth:1,display:"inline-block",verticalAlign:"middle"},mobile:{}}}]}]}},{id:"preset_header_nav_only",presetName:"Nav Bar",nameKey:"preset_header_nav_only",containerType:"header",block:{name:"Container",key:"column",type:"full",containerType:"header",headerLayout:"nav_only",showHeaderBanner:!1,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Menu",key:"menu",useNavigationLinks:!0,list:[{label:"Link 1",url:"#",target:"_blank"},{label:"Link 2",url:"#",target:"_blank"},{label:"Link 3",url:"#",target:"_blank"}],separator:" | ",contentStyles:{desktop:{paddingTop:16,paddingBottom:16,paddingLeft:24,paddingRight:24,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:13,fontFamily:"sans-serif",color:"#525252",linkColor:"#525252",letterSpacing:.02,fontWeight:"500",textTransform:"uppercase"},mobile:{}},isPreset:!0}]}]}},{id:"navigation_bar",presetName:"Navigation Bar",nameKey:"preset_navigation_bar",containerType:"none",block:{name:"Menu",key:"menu",useNavigationLinks:!0,list:[{label:"Link 1",url:"#",target:"_blank"},{label:"Link 2",url:"#",target:"_blank"},{label:"Link 3",url:"#",target:"_blank"}],separator:" | ",contentStyles:{desktop:{paddingTop:25,paddingBottom:15,paddingLeft:5,paddingRight:5,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:14,fontFamily:"Verdana",color:"#333333",linkColor:"#333333",paddingTop:5,paddingBottom:5,paddingLeft:8,paddingRight:8,letterSpacing:0,fontWeight:"normal"},mobile:{}},isPreset:!0}},{id:"product_single",nameKey:"preset_product_single",containerType:"product",presetName:"Product",block:{name:"Container",key:"column",type:"full",containerType:"product",mainProductLayout:"image_stacked",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:null,paddingRight:null,paddingBottom:null,contentBackground:"#fff"},mobile:{}},isPreset:!0,productRole:"main",columnProducts:[{id:"product-1",name:"Abundance Butterfly Diamond Ring",description:"The Maia Diamond Ring features round diamonds set along a delicate gold band, creating a refined and minimalistic look. Its versatile design makes it perfect for everyday wear or for layering with other rings.",image:"https://www.psylish.com/cdn/shop/files/IMG_4632.jpg?v=1773123202&width=1220",link:"https://www.psylish.com",price:2e3,currency:"USD",old_price:null,new_price:null}],children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:null,paddingRight:null,paddingBottom:null,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",src:"{{ProductImage}}",alt:"Image",type:"link",linkURL:"",contentStyles:{desktop:{paddingTop:null,paddingBottom:null,paddingLeft:null,paddingRight:null,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Text",key:"text",text:'<span style="direction: ltr; font-size: 18px; font-family: sans-serif"><p>{{ProductName}}</p></span>',type:"h3",contentType:"static",styles:{desktop:{fontSize:18,fontFamily:"sans-serif",lineHeight:"120%",paddingTop:12,paddingBottom:null,paddingLeft:12,paddingRight:12,textAlign:"left",fontWeight:"bold"},mobile:{}}},{name:"Text",key:"text",text:'<span style="direction: ltr; font-size: 16px; font-family: sans-serif">{{ProductPriceDisplay}}<br></span>',type:"p",contentType:"static",styles:{desktop:{fontSize:16,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:null,paddingBottom:6,paddingLeft:12,paddingRight:12,textAlign:"left"},mobile:{}}},{name:"Text",key:"text",text:"<p>{{ProductDescription}}</p>",type:"p",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"120%",paddingTop:12,paddingBottom:12,paddingLeft:12,paddingRight:12,textAlign:"left"},mobile:{}}},{name:"Button",key:"button",text:"Shop Now",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{textAlign:"center",paddingTop:12,paddingBottom:12,paddingLeft:12,paddingRight:12},mobile:{}},styles:{desktop:{width:"100%",fontSize:16,lineHeight:"140%",borderRadius:4,fontFamily:"sans-serif",paddingTop:10,paddingBottom:10,paddingLeft:null,paddingRight:null,backgroundColor:"#263d2d",color:"#fff",display:"inline-block"},mobile:{}}},{name:"Divider",key:"divider",contentStyles:{desktop:{paddingTop:2,paddingBottom:12,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}},styles:{desktop:{width:"100%",borderTopStyle:"solid",borderTopColor:"#ccc",borderTopWidth:1,display:"inline-block",verticalAlign:"middle"},mobile:{}}}]}]}},{id:"product_image_left",presetName:"Product (Image Left)",nameKey:"preset_product_image_left",containerType:"product",block:{name:"Container",key:"column",type:"full",containerType:"product",productRole:"main",mainProductLayout:"image_left",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:12,paddingLeft:12,paddingRight:12,paddingBottom:12,contentBackground:"#fff"},mobile:{}},isPreset:!0,columnProducts:[{id:"product-1",name:"ADIDAS | KID'S STAN SMITH",description:"Elevate your space with a thoughtfully crafted piece that blends function and style. Whether at home or on the go, it's the kind of essential you'll wonder how you lived without.",image:"https://www.psylish.com/cdn/shop/files/IMG_4632.jpg?v=1773123202&width=1220",link:"https://www.psylish.com",price:90,currency:"USD",old_price:null,new_price:null}],children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Container",key:"column",type:"2-3",containerType:"none",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Content",key:"content",width:"40%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:8,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",src:"{{ProductImage}}",alt:"Product image",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}}]},{name:"Content",key:"content",width:"60%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:12,paddingLeft:8,paddingRight:0,paddingBottom:12,contentBackground:"transparent"},mobile:{}},children:[{name:"Text",key:"text",text:'<p style="font-size:13px;font-family:sans-serif;font-weight:700;letter-spacing:0.05em;text-transform:uppercase;margin:0 0 4px">{{ProductName}}</p>',type:"h2",contentType:"static",styles:{desktop:{fontSize:13,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:0,paddingBottom:4,paddingLeft:0,paddingRight:0,textAlign:"left",fontWeight:"bold"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:14px;font-family:sans-serif;color:#6b7280;margin:0 0 10px">{{ProductPriceDisplay}}</p>',type:"p",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:0,paddingBottom:8,paddingLeft:0,paddingRight:0,textAlign:"left"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:13px;font-family:sans-serif;color:#374151;line-height:1.5">{{ProductDescription}}</p>',type:"p",contentType:"static",styles:{desktop:{fontSize:13,fontFamily:"sans-serif",lineHeight:"150%",paddingTop:0,paddingBottom:14,paddingLeft:0,paddingRight:0,textAlign:"left"},mobile:{}}},{name:"Button",key:"button",text:"Buy Now",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{textAlign:"left",paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0},mobile:{}},styles:{desktop:{width:"auto",fontSize:13,lineHeight:"140%",borderRadius:2,fontFamily:"sans-serif",paddingTop:8,paddingBottom:8,paddingLeft:20,paddingRight:20,color:"#fff",display:"inline-block"},mobile:{}}}]}]}]}]}},{id:"product_two_column",presetName:"Additional Products",nameKey:"preset_product_two_column",containerType:"product",block:{name:"Container",key:"column",type:"1-1",containerType:"none",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,columns:2,columnProducts:[null,null],children:[{name:"Content",key:"content",width:"50%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:0,paddingRight:4,paddingBottom:null,contentBackground:"transparent"},mobile:{}},children:[{name:"Container",key:"column",type:"full",containerType:"product",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:null,paddingRight:null,paddingBottom:null,contentBackground:"#fff"},mobile:{}},isPreset:!0,productRole:"additional",columnProducts:[{id:"product-2",name:"Heartline Diamond Ring",description:"The Sariah Diamond Earrings feature round diamonds in a classic hoop design that curves elegantly around the lobe.",image:"https://www.psylish.com/cdn/shop/files/Psylish3.0_15.png?v=1770880382&width=1220",link:"https://www.psylish.com/",price:1e3,currency:"USD",old_price:1200,new_price:1e3}],children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:null,paddingRight:null,paddingBottom:null,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",src:"{{ProductImage}}",alt:"Image",type:"link",linkURL:"",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Text",key:"text",text:'<span style="direction: ltr; font-size: 18px; font-family: Arial"><p>{{ProductName}}</p></span>',type:"h3",contentType:"static",styles:{desktop:{fontSize:18,fontFamily:"Arial",lineHeight:"140%",paddingTop:12,paddingBottom:0,paddingLeft:8,paddingRight:8,textAlign:"left",fontWeight:"bold"},mobile:{}}},{name:"Text",key:"text",text:'<span style="direction: ltr; font-size: 16px; font-family: Arial">{{ProductPriceDisplay}}<br></span>',type:"p",contentType:"static",styles:{desktop:{fontSize:16,fontFamily:"Arial",lineHeight:"140%",paddingTop:2,paddingBottom:2,paddingLeft:8,paddingRight:8,textAlign:"left"},mobile:{}}},{name:"Text",key:"text",text:"<p>{{ProductDescription}}</p>",type:"p",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:12,paddingBottom:12,paddingLeft:8,paddingRight:8,textAlign:"left"},mobile:{}}},{name:"Button",key:"button",text:"Add to Cart",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{textAlign:"center",paddingTop:12,paddingBottom:12,paddingLeft:8,paddingRight:8},mobile:{}},styles:{desktop:{width:"100%",fontSize:16,lineHeight:"140%",borderRadius:4,fontFamily:"sans-serif",paddingTop:10,paddingBottom:10,paddingLeft:0,paddingRight:0,backgroundColor:"#263d2d",color:"#fff",display:"inline-block"},mobile:{}}}]}]}]},{name:"Content",key:"content",width:"50%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:4,paddingRight:0,paddingBottom:null,contentBackground:"transparent"},mobile:{}},children:[{name:"Container",key:"column",type:"full",containerType:"product",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:null,paddingRight:null,paddingBottom:null,contentBackground:"#fff"},mobile:{}},isPreset:!0,productRole:"additional",columnProducts:[{id:"product-3",name:"Lynx Heart Diamond Ring",description:"The Sariah Diamond Earrings feature round diamonds in a classic hoop design that curves elegantly around the lobe.",image:"https://www.psylish.com/cdn/shop/files/Psylish3.0_48.png?v=1770881768&width=1220",link:"https://www.psylish.com/",price:900,currency:"USD",old_price:1200,new_price:900}],children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:null,paddingLeft:null,paddingRight:null,paddingBottom:null,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",src:"{{ProductImage}}",alt:"Image",type:"link",linkURL:"",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Text",key:"text",text:'<span style="direction: ltr; font-size: 18px; font-family: Arial"><p>{{ProductName}}</p></span>',type:"h3",contentType:"static",styles:{desktop:{fontSize:18,fontFamily:"Arial",lineHeight:"140%",paddingTop:12,paddingBottom:0,paddingLeft:8,paddingRight:8,textAlign:"left",fontWeight:"bold"},mobile:{}}},{name:"Text",key:"text",text:'<span style="direction: ltr; font-size: 16px; font-family: Arial">{{ProductPriceDisplay}}<br></span>',type:"p",contentType:"static",styles:{desktop:{fontSize:16,fontFamily:"Arial",lineHeight:"140%",paddingTop:2,paddingBottom:2,paddingLeft:8,paddingRight:8,textAlign:"left"},mobile:{}}},{name:"Text",key:"text",text:"<p>{{ProductDescription}}</p>",type:"p",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:12,paddingBottom:12,paddingLeft:8,paddingRight:8,textAlign:"left"},mobile:{}}},{name:"Button",key:"button",text:"Add to Cart",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{textAlign:"center",paddingTop:12,paddingBottom:12,paddingLeft:8,paddingRight:8},mobile:{}},styles:{desktop:{width:"100%",fontSize:16,lineHeight:"140%",borderRadius:4,fontFamily:"sans-serif",paddingTop:10,paddingBottom:10,paddingLeft:0,paddingRight:0,backgroundColor:"#263d2d",color:"#fff",display:"inline-block"},mobile:{}}}]}]}]}]}},{id:"product_three_column",presetName:"Products (3 Column)",nameKey:"preset_product_three_column",containerType:"product",block:{name:"Container",key:"column",type:"1-1-1",containerType:"none",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,columns:3,columnProducts:[null,null,null],children:[{name:"Content",key:"content",width:"33.3%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Container",key:"column",type:"full",containerType:"product",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,productRole:"additional",columnProducts:[{id:"product-4",name:"Diamond Ring",description:"Elegant diamond ring for everyday wear.",image:"https://www.psylish.com/cdn/shop/files/IMG_4632.jpg?v=1773123202&width=1220",link:"https://www.psylish.com",price:1500,currency:"USD",old_price:null,new_price:null}],children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",src:"{{ProductImage}}",alt:"Image",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:14px;font-family:sans-serif;font-weight:bold;margin:0">{{ProductName}}</p>',type:"h3",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:8,paddingBottom:2,paddingLeft:8,paddingRight:8,textAlign:"left",fontWeight:"bold"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:13px;font-family:sans-serif;color:#6b7280;margin:0">{{ProductPriceDisplay}}</p>',type:"p",contentType:"static",styles:{desktop:{fontSize:13,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:0,paddingBottom:8,paddingLeft:8,paddingRight:8,textAlign:"left"},mobile:{}}},{name:"Button",key:"button",text:"View",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{textAlign:"center",paddingTop:6,paddingBottom:8,paddingLeft:8,paddingRight:8},mobile:{}},styles:{desktop:{width:"100%",fontSize:13,lineHeight:"140%",borderRadius:3,fontFamily:"sans-serif",paddingTop:8,paddingBottom:8,paddingLeft:0,paddingRight:0,backgroundColor:"#263d2d",color:"#fff",display:"inline-block"},mobile:{}}}]}]}]},{name:"Content",key:"content",width:"33.3%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Container",key:"column",type:"full",containerType:"product",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,productRole:"additional",columnProducts:[{id:"product-5",name:"Sapphire Bracelet",description:"Delicate bracelet with sapphire stones.",image:"https://www.psylish.com/cdn/shop/files/Psylish3.0_15.png?v=1770880382&width=1220",link:"https://www.psylish.com/",price:750,currency:"USD",old_price:900,new_price:750}],children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",src:"{{ProductImage}}",alt:"Image",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:14px;font-family:sans-serif;font-weight:bold;margin:0">{{ProductName}}</p>',type:"h3",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:8,paddingBottom:2,paddingLeft:8,paddingRight:8,textAlign:"left",fontWeight:"bold"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:13px;font-family:sans-serif;color:#6b7280;margin:0">{{ProductPriceDisplay}}</p>',type:"p",contentType:"static",styles:{desktop:{fontSize:13,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:0,paddingBottom:8,paddingLeft:8,paddingRight:8,textAlign:"left"},mobile:{}}},{name:"Button",key:"button",text:"View",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{textAlign:"center",paddingTop:6,paddingBottom:8,paddingLeft:8,paddingRight:8},mobile:{}},styles:{desktop:{width:"100%",fontSize:13,lineHeight:"140%",borderRadius:3,fontFamily:"sans-serif",paddingTop:8,paddingBottom:8,paddingLeft:0,paddingRight:0,backgroundColor:"#263d2d",color:"#fff",display:"inline-block"},mobile:{}}}]}]}]},{name:"Content",key:"content",width:"33.3%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Container",key:"column",type:"full",containerType:"product",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},isPreset:!0,productRole:"additional",columnProducts:[{id:"product-6",name:"Pearl Necklace",description:"Classic pearl necklace for timeless elegance.",image:"https://www.psylish.com/cdn/shop/files/Psylish3.0_48.png?v=1770881768&width=1220",link:"https://www.psylish.com/",price:600,currency:"USD",old_price:null,new_price:null}],children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",src:"{{ProductImage}}",alt:"Image",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:14px;font-family:sans-serif;font-weight:bold;margin:0">{{ProductName}}</p>',type:"h3",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:8,paddingBottom:2,paddingLeft:8,paddingRight:8,textAlign:"left",fontWeight:"bold"},mobile:{}}},{name:"Text",key:"text",text:'<p style="font-size:13px;font-family:sans-serif;color:#6b7280;margin:0">{{ProductPriceDisplay}}</p>',type:"p",contentType:"static",styles:{desktop:{fontSize:13,fontFamily:"sans-serif",lineHeight:"140%",paddingTop:0,paddingBottom:8,paddingLeft:8,paddingRight:8,textAlign:"left"},mobile:{}}},{name:"Button",key:"button",text:"View",type:"link",linkURL:"{{ProductLink}}",contentStyles:{desktop:{textAlign:"center",paddingTop:6,paddingBottom:8,paddingLeft:8,paddingRight:8},mobile:{}},styles:{desktop:{width:"100%",fontSize:13,lineHeight:"140%",borderRadius:3,fontFamily:"sans-serif",paddingTop:8,paddingBottom:8,paddingLeft:0,paddingRight:0,backgroundColor:"#263d2d",color:"#fff",display:"inline-block"},mobile:{}}}]}]}]}]}},{id:"preset_discount",presetName:"Discount",nameKey:"preset_discount",containerType:"discount",block:{name:"Container",key:"column",type:"full",containerType:"discount",discountVariant:"card",showTitle:!0,discountTitle:"{{DiscountValue}} off your first order",discountCode:"{{DiscountCode}}",titleSize:22,titleWeight:"600",codeSize:16,codeSpacing:.08,codeBorder:"dashed",codeBorderWidth:1.5,codeBg:"none",codeRadius:4,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:28,paddingLeft:24,paddingRight:24,paddingBottom:28,contentBackground:"#D8FE91"},mobile:{}},isPreset:!0,children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Text",key:"text",text:'<p style="text-align:center;margin:0 0 0px"><span style="font-family:Arial;font-size:22px;font-weight:600;color:#171717">{{DiscountValue}} off your first order</span></p>',type:"h2",contentType:"static",styles:{desktop:{fontSize:22,fontFamily:"Arial",lineHeight:"130%",paddingTop:0,paddingBottom:14,paddingLeft:0,paddingRight:0,textAlign:"center",fontWeight:"600"},mobile:{}}},{name:"Text",key:"text",text:'<p style="text-align:center;margin:0"><span style="font-family:Arial;font-size:16px;letter-spacing:0.08em;color:#171717">{{DiscountCode}}</span></p>',type:"p",contentType:"static",styles:{desktop:{fontSize:16,fontFamily:"Arial",lineHeight:"130%",paddingTop:10,paddingBottom:10,paddingLeft:28,paddingRight:28,textAlign:"center",borderTopStyle:"dashed",borderBottomStyle:"dashed",borderLeftStyle:"dashed",borderRightStyle:"dashed",borderTopColor:"#171717",borderBottomColor:"#171717",borderLeftColor:"#171717",borderRightColor:"#171717",borderTopWidth:"1.5px",borderBottomWidth:"1.5px",borderLeftWidth:"1.5px",borderRightWidth:"1.5px",borderRadius:"4px",display:"block",width:"fit-content",maxWidth:"100%",marginLeft:"auto",marginRight:"auto"},mobile:{}}}]}],discountAlign:"center",discountGap:14}},{id:"preset_discount_simple",presetName:"Discount (simple line)",nameKey:"preset_discount_simple",containerType:"discount",block:{name:"Container",key:"column",type:"full",containerType:"discount",discountVariant:"simple",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#ffa7aa"},mobile:{}},isPreset:!0,children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Text",key:"text",text:'<div style="text-align: center;"><font face="Arial">Use <b>{{DiscountCode}}</b> for <b>{{DiscountValue}}</b> OFF. Expires on {{ValidUntil}}</font></div>',type:"p",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"120%",paddingTop:12,paddingBottom:12,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}}}]}]}},{id:"preset_footer",presetName:"Footer",nameKey:"preset_footer",containerType:"footer",block:{name:"Container",key:"column",type:"full",containerType:"footer",footerUnifiedLayout:!1,showFooterBanner:!1,isPreset:!0,styles:{key:"column",desktop:{backgroundColor:"#f4f4f5",paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0,contentBackground:"#ffffff",color:"#737373",linkColor:"",fontSize:12,textAlign:"center"},mobile:{}},children:[{name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{name:"Image",key:"image",footerBannerSlot:!0,hidden:!0,src:"{{FooterBanner}}",alt:"",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:8,paddingBottom:8,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},{name:"Divider",key:"divider",footerBannerDividerSlot:!0,hidden:!0,contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"100%",borderTopStyle:"solid",borderTopColor:"#ccc",borderTopWidth:1,display:"inline-block",verticalAlign:"middle"},mobile:{}}},{name:"Image",key:"image",footerSlot:"logo",src:"{{LogoUrl}}",alt:"Logo",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:8,paddingBottom:4,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"30%"},mobile:{}}},{name:"Text",key:"text",footerSlot:"brand",hidden:!0,text:'<div style="text-align:center"><b>{{BrandName}}</b></div>',type:"p",contentType:"static",styles:{desktop:{fontSize:12,fontFamily:"Arial, sans-serif",color:"#737373",lineHeight:"150%",paddingTop:8,paddingBottom:4,paddingLeft:12,paddingRight:12,textAlign:"center",fontWeight:"600"},mobile:{}}},{name:"Text",key:"text",footerSlot:"tagline",text:'<div style="text-align:center">{{Tagline}}</div>',type:"p",contentType:"static",styles:{desktop:{fontSize:12,fontFamily:"Arial, sans-serif",color:"#737373",lineHeight:"150%",paddingTop:2,paddingBottom:2,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}}},{name:"Text",key:"text",footerSlot:"address",hidden:!0,text:'<div style="text-align:center">{{Address}}</div>',type:"p",contentType:"static",styles:{desktop:{fontSize:12,fontFamily:"Arial, sans-serif",color:"#737373",lineHeight:"150%",paddingTop:4,paddingBottom:4,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}}},{name:"Social link",key:"social_link",footerSlot:"social",list:[],imageWidth:36,iconSize:"medium",iconColor:"gray",contentStyles:{desktop:{paddingTop:12,paddingBottom:8,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}},styles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0},mobile:{}}},{name:"Menu",key:"menu",footerSlot:"secondary",hidden:!0,useNavigationLinks:!1,layoutMode:"nav-only",showLogo:!1,mobileLayout:"stack",linkGapPx:0,linkUnderline:!1,list:[{label:"Privacy",url:"#",target:"_self"},{label:"Terms",url:"#",target:"_self"}],separator:" · ",contentStyles:{desktop:{paddingTop:2,paddingBottom:2,paddingLeft:4,paddingRight:4,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:12,fontFamily:"Arial, sans-serif",color:"#737373",linkColor:"#737373",letterSpacing:0,fontWeight:"400",textTransform:"none"},mobile:{}},isPreset:!0},{name:"Text",key:"text",footerSlot:"unsubscribe",hidden:!0,text:'<div style="text-align:center">You are receiving this email because you subscribed. <a href="{{unsubscribe_url}}">Unsubscribe</a></div>',unsubscribeBodyText:"You are receiving this email because you subscribed.",unsubscribeLinkLabel:"Unsubscribe",unsubscribeUrl:"{{unsubscribe_url}}",contentStyles:{desktop:{paddingTop:2,paddingBottom:2,paddingLeft:4,paddingRight:4,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:12,fontFamily:"Arial, sans-serif",color:"#737373",paddingTop:4,paddingBottom:4,paddingLeft:12,paddingRight:12,lineHeight:"150%"},mobile:{}},isPreset:!0},{name:"Text",key:"text",footerSlot:"copyright",text:'<div style="text-align:center;font-size:11px;opacity:0.9">© 2026 {{BrandName}}</div>',type:"p",contentType:"static",styles:{desktop:{fontSize:11,fontFamily:"Arial, sans-serif",color:"#737373",lineHeight:"150%",paddingTop:8,paddingBottom:4,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}}}]}]}}]};const Dr=new Set(["navigation_bar","preset_header_centered","preset_header_nav_only","product_image_left","product_three_column","preset_discount_simple"]);function Ur(e){if(!e||"object"!=typeof e)return e;const t={...e,id:Nt()};return Array.isArray(t.children)&&(t.children=t.children.map(Ur)),Array.isArray(t.columnProducts)&&(t.columnProducts=t.columnProducts.map(e=>e&&"object"==typeof e?{...e}:e)),t}function Er(e){const t=Mr.presets.find(t=>t.id===e);return t?Ur(JSON.parse(JSON.stringify(t.block))):null}const zr=[{id:"dolor-sit-amet",name:"Dolor Sit Amet",description:"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",image:"https://plus.unsplash.com/premium_photo-1681711647066-ef84575c0d95?fm=jpg&q=30&w=300&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MXx8cHJvZHVjdCUyMHBob3RvZ3JhcGh5fGVufDB8fDB8fHww",link:"https://loremipsum.com/checkout/cart/12345",price:2e3,currency:"USD",old_price:2500,new_price:2e3},{id:"sample-2",name:"Sample Pearl Necklace",description:"Classic strand of lustrous freshwater pearls with a sterling silver clasp. Timeless elegance for any outfit.",image:"https://picsum.photos/seed/necklace2/200/200",link:"https://www.example.com/products/sample-2",price:750,currency:"USD",old_price:null,new_price:null},{id:"sample-3",name:"Sample Gold Bracelet",description:"Handcrafted 14K yellow gold link bracelet. Lightweight and comfortable for everyday wear.",image:"https://picsum.photos/seed/bracelet3/200/200",link:"https://www.example.com/products/sample-3",price:450,currency:"USD",old_price:500,new_price:450},{id:"sample-4",name:"Sample Silver Earrings",description:"Delicate sterling silver drop earrings with subtle sparkle. A versatile addition to your jewelry collection.",image:"https://picsum.photos/seed/earrings4/200/200",link:"https://www.example.com/products/sample-4",price:199,currency:"USD",old_price:null,new_price:null},{id:"sample-5",name:"Sample Gemstone Pendant",description:"Stunning pendant with a natural gemstone centerpiece on a fine silver chain. Makes a memorable gift.",image:"https://picsum.photos/seed/pendant5/200/200",link:"https://www.example.com/products/sample-5",price:320,currency:"USD",old_price:400,new_price:320}],Fr=new Set(["image/png","image/jpeg","image/jpg","image/gif","image/svg+xml","image/webp"]),Or={png:"image/png",jpeg:"image/jpeg",jpg:"image/jpeg",gif:"image/gif",svg:"image/svg+xml",webp:"image/webp"},Wr=Array.from(Fr).join(",");function jr(e){return e?function(e){if(!e)return!1;const t=String(e.type||"").toLowerCase().trim();if(t)return Fr.has(t);const n=String(e.name||"").toLowerCase(),o=n.lastIndexOf(".");if(-1===o)return!1;const l=n.slice(o+1);return Object.prototype.hasOwnProperty.call(Or,l)}(e)?e.size>10485760?"size":null:"type":null}const Hr=({imageUploadEndpoint:e,headers:t={},companyId:n,imageUploadQueryParams:l,imageUploadCompanyField:a="companyId"}={})=>{const i=!!e;return{uploadImageFile:o(async o=>{if(!i)return console.error("[useImageUpload] No image upload endpoint configured"),null;if(!o)return console.error("[useImageUpload] No file provided"),null;const r=jr(o);if("type"===r)return console.error("[useImageUpload] File type not allowed:",o.type),null;if("size"===r)return console.error("[useImageUpload] File too large:",o.size,"bytes"),null;const s=await(async(e,t,n,o={},l={})=>{if(!e)return console.error("[API Service] No image upload endpoint configured"),null;if(!t)return console.error("[API Service] No file provided for upload"),null;const{queryParams:a={},companyField:i="companyId"}=l;try{const l=new FormData;l.append("file",t),n&&("comment"===i?l.append("comment",n):l.append("companyId",n));let r=e;if(a&&Object.keys(a).length>0){const t="undefined"!=typeof window&&window.location?.origin?window.location.origin:"http://localhost",n=new URL(e,t);Object.entries(a).forEach(([e,t])=>{null!=t&&n.searchParams.set(e,String(t))}),r=n.toString()}const s={...o};Object.keys(s).forEach(e=>{"content-type"===e.toLowerCase()&&delete s[e]});const c=await fetch(r,{method:"POST",headers:{...s},body:l}),d=await c.text();let u={};try{u=d?JSON.parse(d):{}}catch{u=d?{message:d.slice(0,500)}:{}}if(!c.ok){const e=aa(u,c.status);throw console.error("[API Service] Image upload failed:",c.status,e),new Error(e)}if(u&&!1===u.success){const e=aa(u,c.status);throw console.error("[API Service] Upload API returned error:",e),new Error(e)}if(u&&"string"==typeof u.url&&u.url.trim())return u.url.trim();const p=u?.data?.url;if(p&&"string"==typeof p)return p.trim();throw new Error("Upload succeeded but no image URL was returned.")}catch(e){if(console.error("[API Service] Error uploading image:",e),e instanceof Error&&e.message)throw e;throw new Error(e&&"object"==typeof e&&"message"in e?String(e.message):"Unable to upload image. Check your network and try again.")}})(e,o,n,t,{queryParams:l,companyField:a});return s},[i,e,t,n,l,a]),isConfigured:i}};function Kr(e){if(null==e)return!0;const t=String(e).trim().toLowerCase();return""===t||"transparent"===t}const Vr=({t:e,findStyleItem:t,colorChange:n,inputChange:o,paddingChange:i,patchContainerBackground:s,commitColumnUpdate:c,currentItem:d,children:u})=>{const p=t(d.data.styles,"backgroundColor"),m=t(d.data.styles,"contentBackground"),g=t(d.data.styles,"containerBackgroundImage")??"",h=""!==String(g).trim(),y=l(()=>function(e,t){return e?"image":Kr(t)?"none":"color"}(h,p),[h,p]),[b,f]=a(null),_=b??y;r(()=>{f(null)},[d?.data?.id]),r(()=>{h&&f(null)},[h]);const v=t(d.data.styles,"contentMaxWidth")??"100%",w=l(()=>[{value:"100%",label:e("content_max_width_option_full")},{value:"720px",label:"720"},{value:"600px",label:"600"},{value:"540px",label:"540"}],[e]),x=l(()=>[{value:"none",label:e("border_none")},{value:"solid",label:e("solid")},{value:"dashed",label:e("dashed")},{value:"dotted",label:e("dotted")}],[e]),S=w.some(e=>e.value===v)?v:"100%",C=t(d.data.styles,"minHeight")??"",N="string"==typeof C?parseInt(C.replace("px",""),10)||"":C||"",L=t(d.data.styles,"borderStyle")??"none",T=t(d.data.styles,"borderWidth")??1,B="string"==typeof T?parseInt(T.replace("px",""),10)||1:T||1,A=t(d.data.styles,"borderColor")??"#e0e0e0",I=t(d.data.styles,"borderRadius")??0,$="string"==typeof I?parseInt(String(I).replace("px",""),10)||0:I||0,P="none"!==L,R=Boolean(d.data.hiddenOnMobile),M=Kr(m)?"auto":"custom";return Je(Ye,{children:[qe(_r,{children:e("section_background_group")}),qe(vr,{label:e("section_bg_mode"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:_,onChange:e=>(e=>{if("image"===e)return f("image"),void s({containerBackgroundEnabled:!0});if(f(null),"color"===e){s({containerBackgroundImage:"",containerBackgroundEnabled:!1});const e=Kr(p)?"#ffffff":p;return void n("backgroundColor")({hex:e})}"none"===e&&(s({containerBackgroundImage:"",containerBackgroundEnabled:!1}),n("backgroundColor")({hex:"transparent"}))})(e),"aria-label":e("section_bg_mode"),items:[{value:"color",label:e("section_bg_color")},{value:"image",label:e("section_bg_image")},{value:"none",label:e("section_bg_none")}]})}),("color"===_||"image"===_)&&qe(vr,{label:e("background_color"),children:qe(cr,{color:Kr(p)?"#ffffff":p,setColor:({hex:e})=>n("backgroundColor")({hex:e})})}),"image"===_?u:null,qe(_r,{children:e("section_content_area_group")}),qe(vr,{label:e("content_area_color"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:M,onChange:e=>{"auto"!==e?o("contentBackground")("#ffffff"):o("contentBackground")("transparent")},"aria-label":e("content_area_color"),items:[{value:"auto",label:e("content_color_auto")},{value:"custom",label:e("content_color_custom")}]})}),"custom"===M?qe(vr,{label:e("content_background_color"),children:qe(cr,{color:Kr(m)?"#ffffff":m,setColor:({hex:e})=>n("contentBackground")({hex:e})})}):null,qe(vr,{label:e("content_max_width"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:S,onChange:e=>o("contentMaxWidth")(e),"aria-label":e("content_max_width"),items:w})}),qe(vr,{label:e("min_height"),children:qe(k,{min:0,max:2e3,className:"input-width ee-settings-input-affix",addonAfter:"px",value:N,onFocus:e=>e?.target?.select?.(),onChange:e=>o("minHeight")(e?`${e}px`:"")})}),qe(_r,{children:e("border")}),qe(vr,{label:e("border_style"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:L,onChange:e=>o("borderStyle")(e),"aria-label":e("border_style"),items:x})}),P?Je(Ye,{children:[qe(vr,{label:e("border_width"),children:qe(k,{min:0,max:20,className:"input-width ee-settings-input-affix",addonAfter:"px",value:B,onFocus:e=>e?.target?.select?.(),onChange:e=>o("borderWidth")(e??1)})}),qe(vr,{label:e("border_color"),children:qe(cr,{color:A,setColor:({hex:e})=>n("borderColor")({hex:e})})})]}):null,qe(vr,{label:e("border_radius"),children:qe(k,{min:0,max:64,className:"input-width ee-settings-input-affix",addonAfter:"px",value:$,onFocus:e=>e?.target?.select?.(),onChange:e=>o("borderRadius")(e??0)})}),qe(_r,{children:e("spacing")}),qe(vr,{label:e("label_padding"),children:qe(mr,{padding:{paddingTop:t(d.data.styles,"paddingTop"),paddingRight:t(d.data.styles,"paddingRight"),paddingLeft:t(d.data.styles,"paddingLeft"),paddingBottom:t(d.data.styles,"paddingBottom")},setPadding:i})}),qe(_r,{children:e("visibility")}),Je("div",{className:"ee-settings-row ee-padding-link-sides-row ee-visibility-hide-mobile-row",children:[qe("span",{className:"ee-padding-link-sides-label",children:e("hidden_on_mobile")}),qe(pr,{checked:R,onChange:e=>{const t=xt(d.data);t.hiddenOnMobile=e,c(t)}})]})]})},Gr=["product"],qr=e=>"additional"===e?"additional":"main";function Jr(e,t,n){if(!e||"product"!==e.containerType)return null;const o=qt(t,n,e.id);for(let e=0;e<o.length;e++){const n=o[e]?.containerBlock;if(n&&Ei(n,t))return"additional"}return"main"}function Yr(e){const t=String(e??"").trim();return t?/^\{\{\w+\}\}$/.test(t)?null:lt(t,!1,{allowMailtoTel:!1})||null:null}const Xr=()=>{const{blockMap:e,rootOrder:t,setBlocks:o,currentItem:s,setCurrentItem:c,previewMode:d,templateData:u,setIsDragStart:p,setActionType:m,apiConfig:g}=n(Ln),{t:y}=ja(),[b,f]=a(!1),_=i(null),[C,N]=a(!1),[L,T]=a(""),[I,$]=a(""),{uploadImageFile:P,isConfigured:R}=Hr({imageUploadEndpoint:g?.imageUploadEndpoint,headers:g?.headers||{},companyId:g?.companyId,imageUploadQueryParams:g?.imageUploadQueryParams,imageUploadCompanyField:g?.imageUploadCompanyField}),{findStyleItem:M,colorChange:D,inputChange:U,paddingChange:E}=Rr(),{blockConfigsList:z}=fr(),F=Mi(s?.data),O=s?.data?.children??[],[W,j]=a(0);r(()=>{j(0)},[s?.data?.id]),r(()=>{const e=O.length;0!==e&&j(t=>t>=e?Math.max(0,e-1):t)},[O.length]);const[H,K]=a(!1);r(()=>{K(!1)},[s?.data?.id]);const V="discount"===(G=s.data.containerType??"none")||"none"===G||"header"===G||"footer"===G?G:"product";var G;const q="product"===s.data.containerType?Jr(s.data,e,t):null,Y=qr(q??s.data.productRole??"main"),X=s.data.columnProducts,Z=l(()=>Array.isArray(X)?X:[],[X]),Q=l(()=>{const e=s.data;return"image_left"===e.mainProductLayout||"image_stacked"===e.mainProductLayout?e.mainProductLayout:function(e){const t=e?.children?.[0]?.children?.[0];return"column"===t?.key&&"2-3"===t?.type}(e)?"image_left":"image_stacked"},[s.data]),ee=l(()=>{const e=s.data;if(!Ei(e))return null;const t=e.children?.length??0;return 2!==t&&3!==t?null:{columnCount:t}},[s.data]),te=l(()=>({columnIndex:0,columnProduct:Z[0]??null}),[Z]),ne=M(s.data.styles,"containerBackgroundImage")??"";r(()=>{$("")},[ne]);const oe=u?.content?.products?.length>0?u.content.products:u?.catalogProducts?.length>0?u.catalogProducts:zr,le=n=>{const{blockMap:l}=jt([n]);let a={...e,...l};const i=qr(n.productRole);"product"===n.containerType&&"main"===i&&Object.keys(a).forEach(e=>{if(e===n.id)return;const t=a[e];if(!t||"column"!==t.key)return;if("product"!==t.containerType)return;"main"===qr(t.productRole)&&(a[e]={...t,productRole:"additional"})}),o(a,t,`edit_${(new Date).getTime()}`),c({...s,data:n})};r(()=>{if("product"!==s?.data?.containerType)return;const n=Jr(s.data,e,t);if(!n)return;if(qr(s.data.productRole)===n)return;const o=xt(s.data);o.productRole=n,le(o)},[s?.data?.id,s?.data?.containerType,s?.data?.productRole,e,t]);const ae=e=>{const t=xt(s.data);t.styles||(t.styles={desktop:{},mobile:{}}),t.styles[d]||(t.styles[d]={}),Object.assign(t.styles[d],e),le(t)},ie=async e=>{if(!e)return;const t=jr(e);if("type"!==t)if("size"!==t)if(R){N(!0);try{const t=await P(e);t?(ae({containerBackgroundImage:ol(t),containerBackgroundEnabled:!0}),T(""),$(""),S.success(y("image_uploaded"))):S.error(y("image_upload_failed"))}catch(t){console.error(t);const e="string"==typeof t?.message&&t.message.trim()?t.message.trim():null;S.error(e||y("image_upload_error"))}finally{N(!1)}}else S.error(y("image_upload_not_configured"));else S.error(y("image_file_too_large"));else S.error(y("image_upload_invalid_type"))},re=e=>{const t=Yr(e);var n;T(t?y("blocked_scheme"===(n=t)?"container_bg_image_url_error_blocked_scheme":"duplicate_protocol"===n?"container_bg_image_url_error_duplicate_protocol":"missing_hostname_dot"===n?"container_bg_image_url_error_hostname":"invalid_protocol"===n?"container_bg_image_url_error_invalid_protocol":"container_bg_image_url_error_generic"):""),$("")},se=Gr.includes(V),ce=e=>{if(!se||"main"!==qr(Y))return;if(e===Q)return;const t=Er("image_left"===e?"product_image_left":"product_single");if(!t)return;const n=xt(s.data);n.mainProductLayout=e,n.children=xt(t.children),n.columnProducts=xt(Z),le(n)},de=l(()=>ei(s.data,e),[s.data,e]),ue=l(()=>qt(e,t,s.data?.id),[e,t,s.data?.id]),pe=l(()=>(ue||[]).filter(e=>e?.containerBlock&&e.containerBlock.id!==s.data?.id&&"none"!==e.containerType).map(e=>{const t=e.cellIndex??0;return{containerType:e.containerType,context:{columnIndex:t,columnProduct:e.containerBlock?.columnProducts?.[t]??null}}}),[ue,s.data?.id]),he=zo(0,V,u,{},pe).filter(({variableKey:e,key:t})=>!("product"===V)||(e??t)!==ao).filter(({variableKey:e,key:t})=>!de.has(e??t)),ye=l(()=>{const e={columnIndex:0,columnProduct:Z[0]??null};return Wo(V,u,e).filter(e=>e.variableKey&&!de.has(e.variableKey))},[V,u,Z,de]),be=l(()=>{const e=new Set(he.map(e=>e.variableKey??e.key)),t=ye.filter(t=>{const n=t.variableKey;return!(!n||e.has(n))&&(e.add(n),!0)});return[...he,...t]},[he,ye]),fe=e=>t=>{const n=(e=>{const{value:t,type:n}=e;if("image"===n){const e=xt(z.find(e=>"image"===e.key));return e?(e.src=t,e):{name:y("image"),key:"image",src:t,alt:"Image",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}}}const o=xt(z.find(e=>"text"===e.key));return o?(o.text=`<p>${t}</p>`,o.type="p",o.contentType="static",o):{name:y("text"),key:"text",text:`<p>${t}</p>`,type:"p",contentType:"static",styles:{desktop:{fontSize:14,fontFamily:"sans-serif",lineHeight:"20px",paddingTop:16,paddingBottom:16,paddingLeft:16,paddingRight:16,textAlign:"left"},mobile:{}}}})(e);"undefined"!=typeof window&&(window.__eeDragItemData=n,window.__eeDragSource="product-variables"),p(!0),m("add"),t.target.classList.add("ee-product-variable-item-dragging"),t.dataTransfer&&(t.dataTransfer.effectAllowed="copy")},_e=e=>{e.target.classList.remove("ee-product-variable-item-dragging"),"undefined"!=typeof window&&(window.__eeDragItemData=null,window.__eeDragSource=null),setTimeout(()=>{p(!1)},50)},ke=e=>t=>{const n=xt(s.data);n.children[e].styles[d]={...n.children[e].styles[d],...t},le(n)},ve=(e=!1)=>{const t=M(s.data.styles,"containerBackgroundImage")??"",n=function(e,t,n){const o=String(e??"").trim();if(!o)return"";if(Yr(o))return"";if(/^\{\{\w+\}\}$/.test(o)){const e=o.replace(/\{\{|\}\}/g,"").trim(),l=t&&e?$o(t,e,n):null;return null==l||String(l).startsWith("{{")?"":nt(String(l).trim(),{allowMailtoTel:!1})||""}return nt(o,{allowMailtoTel:!1})||""}(t,u,te),o=Je("span",{className:"ee-container-bg-heading-inline",children:[y("container_background_image_section_title"),qe(v,{title:Je("div",{className:"ee-container-bg-tooltip",children:[qe("p",{className:"ee-container-bg-tooltip-p",children:y("container_background_image_tooltip_p1")}),qe("p",{className:"ee-container-bg-tooltip-p",children:y("container_background_image_tooltip_p2")}),qe("p",{className:"ee-container-bg-tooltip-p",children:y("container_background_image_intro")})]}),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:qe("span",{className:"ee-container-bg-section-help",tabIndex:0,"aria-label":y("container_background_image_title"),onClick:e=>e.stopPropagation(),children:qe(B,{icon:A})})})]}),l=!e||H;return Je("div",{className:za("ee-container-bg-section",e&&"ee-container-bg-section--disclosure"),children:[e?Je("div",{className:"ee-settings-row ee-padding-link-sides-row ee-container-bg-disclosure-switch-row",children:[qe("div",{className:"ee-container-bg-disclosure-heading-left",children:qe("span",{className:"ee-settings-section-title ee-container-bg-section-heading",children:o})}),qe(pr,{checked:H,onChange:K,"aria-label":y("container_background_image_section_toggle")})]}):qe(_r,{className:"ee-container-bg-section-heading",children:o}),l?Je("div",{className:"ee-container-bg-section-body",children:[qe("input",{ref:_,type:"file",accept:Wr,className:"ee-image-upload-input-hidden",onChange:async e=>{const t=e.target.files?.[0];await ie(t),e.target.value=""},disabled:C}),Je(vr,{label:y("container_background_image_upload"),children:[qe(w,{spinning:C,children:Je("div",{role:"button",tabIndex:0,className:"ee-image-upload-trigger",onClick:()=>!C&&_.current?.click(),onDrop:async e=>{e.preventDefault(),e.stopPropagation();const t=e.dataTransfer?.files?.[0];await ie(t)},onDragOver:e=>{e.preventDefault(),e.stopPropagation()},style:{opacity:C?.6:1,cursor:C?"not-allowed":"pointer"},children:[qe(B,{icon:me,className:"ee-image-upload-icon"}),qe("span",{children:y(C?"uploading":"image_upload_click")})]})}),Je("div",{className:"ee-image-toolbar",children:[Je("button",{type:"button",className:"ee-image-toolbar-btn",onClick:()=>_.current?.click(),disabled:C,children:[qe(B,{icon:ge}),qe("span",{children:y("replace")||"Replace"})]}),Je("button",{type:"button",className:"ee-image-toolbar-btn ee-image-toolbar-btn--danger",onClick:()=>{T(""),$(""),ae({containerBackgroundImage:"",containerBackgroundEnabled:!1})},disabled:C||!String(t).trim(),children:[qe(B,{icon:J}),qe("span",{children:y("delete")||"Delete"})]})]}),qe("div",{className:"ee-image-upload-hint",children:y("image_upload_file_hint")||"PNG, JPEG, GIF, SVG, WebP · max 10 MB"})]}),Je("div",{className:"ee-container-bg-url-block",children:[qe("div",{className:"ee-stack-label ee-container-bg-url-label",children:y("container_background_image_url")}),qe(h,{className:"width-full",value:t,onChange:e=>{const t=e.target.value,n=""!==String(t).trim();$(""),L&&re(t),ae({containerBackgroundImage:t,containerBackgroundEnabled:n})},onBlur:e=>re(e.target.value),status:L||I?"error":"",placeholder:"https://"}),L?qe("div",{className:"ee-field-error",role:"alert",children:L}):null,I&&!L?qe("div",{className:"ee-field-error",role:"alert",children:I}):null,n&&!L?qe("div",{className:"ee-container-bg-url-preview",children:qe("img",{src:n,alt:"",className:"ee-container-bg-url-preview-img",onLoad:()=>$(""),onError:()=>$(y("container_bg_image_preview_failed"))})}):null]}),Je("div",{className:"ee-container-bg-format-bar",children:[qe("div",{className:"ee-container-bg-format-bar-caption",children:y("container_background_image_layout_group")}),Je("div",{className:"ee-container-bg-format-bar-inner",children:[Je("div",{className:"ee-container-bg-format-bar-field ee-container-bg-format-bar-field-size",children:[qe("div",{className:"ee-container-bg-format-bar-label",children:y("container_background_image_size")}),qe(x,{className:"ee-container-bg-size-select ee-container-bg-size-select-half",value:M(s.data.styles,"containerBackgroundSize")||"cover",onChange:e=>ae({containerBackgroundSize:e}),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:al.map(e=>qe(x.Option,{value:e.value,children:y(e.labelKey)},e.value))})]}),Je("div",{className:"ee-container-bg-format-bar-field ee-container-bg-format-bar-field-grid",children:[qe("div",{className:"ee-container-bg-format-bar-label",children:y("container_background_image_position")}),qe("div",{className:"ee-container-bg-position-grid",role:"group","aria-label":y("container_background_image_position"),children:il.map(e=>{const t=M(s.data.styles,"containerBackgroundPosition")||"center center";return qe("button",{type:"button",className:za("ee-container-bg-position-cell",t===e&&"ee-container-bg-position-cell-active"),title:e,"aria-pressed":t===e,onClick:()=>ae({containerBackgroundPosition:e}),children:qe("span",{className:"ee-container-bg-dot","aria-hidden":!0})},e)})})]})]})]})]}):null]})};return qe(Ye,{children:Je("div",{className:"margin-y-30 ee-settings-block-form",children:[Je(Ye,{children:[se||ee?null:qe(_r,{className:"ee-settings-section-title--flush",children:y("container_settings")}),Je("div",{className:"ee-right-panel-stack",children:[ee?Je(Ye,{children:[qe(_r,{className:"margin-top-12",children:y("additional_products_grid_layout")}),qe(vr,{label:y("additional_products_per_row"),children:qe(x,{className:"ee-stack-control",value:String(ee.columnCount),style:{width:"100%"},getPopupContainer:()=>document.querySelector(".right-settings")||document.body,onChange:e=>(e=>{if(!ee||e===ee.columnCount)return;const t=Er(3===e?"product_three_column":"product_two_column");if(!t)return;const n=s.data.id,o=xt(s.data.styles),l=[...s.data.columnProducts??[]],a=xt(t);a.id=n,a.styles=xt(o),a.styles.desktop||(a.styles.desktop={}),Object.assign(a.styles.desktop,{paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0}),a.columnProducts=Array.from({length:e},(e,t)=>l[t]??null),le(a)})(Number(e)),options:[{value:"2",label:y("product_row_count_2")},{value:"3",label:y("product_row_count_3")}]})})]}):null,se&&"main"===qr(Y)?Je(Ye,{children:[qe(_r,{className:"margin-top-12",children:y("product_output_layout")}),qe(vr,{label:y("style"),children:qe(x,{className:"ee-stack-control",value:Q,style:{width:"100%"},getPopupContainer:()=>document.querySelector(".right-settings")||document.body,onChange:ce,options:[{value:"image_stacked",label:y("product_main_layout_stacked")},{value:"image_left",label:y("product_main_layout_image_left")}]})})]}):null,se&&Je(Ye,{children:[qe(_r,{className:"margin-top-12 ee-product-kb-heading-with-tooltip",children:Je("span",{className:"ee-product-kb-heading-inner",children:[qe("span",{children:y("product_column_kb_heading")}),qe(v,{title:y("product_column_kb_tooltip"),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:qe("span",{className:"ee-container-bg-section-help",tabIndex:0,"aria-label":y("product_column_kb_tooltip"),onClick:e=>e.stopPropagation(),children:qe(B,{icon:A})})})]})}),Je("div",{className:"ee-product-assign-section ee-product-assign-after-kb-heading",children:[qe("span",{className:"ee-stack-label",children:y("product_column_select_label")}),qe(Pr,{apiConfig:g,templateData:u,value:Z[0]?.id??void 0,selectedProduct:Z[0],onChange:e=>((e,t)=>{const n=xt(s.data),o=[...n.columnProducts??[]];o[e]=t,n.columnProducts=o,le(n)})(0,e),placeholder:y("product_column_select_placeholder"),staticProductList:oe})]})]}),Je("div",{className:"ee-product-variables-section margin-top-12",children:[qe("span",{className:"ee-stack-label",children:y("product_column_variables_heading")}),Je("button",{type:"button",className:"ee-product-variables-toggle",onClick:()=>f(e=>!e),children:[qe("span",{children:y("variables")}),qe("span",{className:"ee-product-variables-toggle-icon",children:b?"▴":"▾"})]}),b&&qe("div",{className:"ee-product-variables-dropdown",children:be.length>0?be.map(e=>Je("div",{className:"ee-product-variable-item",draggable:!0,onDragStart:fe(e),onDragEnd:_e,title:e.value,children:[qe("span",{className:"ee-product-variable-item-label",children:e.labelKey?y(e.labelKey):e.label}),qe("span",{className:"ee-product-variable-item-token",children:e.value})]},e.value)):qe("div",{className:"ee-stack-help",children:y("container_variables_none_available")})})]})]})]}),F===Ui&&qe(Sr,{}),F!==Di&&(()=>{const e=s.data.children||[],t=Math.min(Math.max(0,W),Math.max(0,e.length-1)),n=e[t],o=n?M(n.styles,"backgroundColor"):void 0,l=y(F===Ui?"column_cells_section":"column_settings");return Je(Ye,{children:[qe(_r,{children:l}),e.length>1?qe(vr,{label:y("column"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:String(t),"aria-label":y("column_settings"),onChange:e=>j(Number(e)),items:e.map((e,t)=>({value:String(t),label:`${y("column")} ${t+1}`}))})}):null,n?Je(Ye,{children:[qe(vr,{label:y("content_background_color"),children:qe(cr,{color:o,setColor:({hex:e})=>((e,t)=>n=>{const o=xt(s.data);o.children[t].styles[d][e]=n,le(o)})("backgroundColor",t)(e)})}),qe(vr,{label:y("label_padding"),children:qe(mr,{padding:{paddingTop:M(n.styles,"paddingTop"),paddingRight:M(n.styles,"paddingRight"),paddingLeft:M(n.styles,"paddingLeft"),paddingBottom:M(n.styles,"paddingBottom")},setPadding:ke(t)})})]}):null]})})(),(()=>{if(F===Di)return qe(Vr,{t:y,findStyleItem:M,colorChange:D,inputChange:U,paddingChange:E,patchContainerBackground:ae,commitColumnUpdate:le,currentItem:s,children:ve()});const e=M(s.data.styles,"backgroundColor"),t=M(s.data.styles,"contentBackground"),n=M(s.data.styles,"borderRadius"),o="number"==typeof n?n:parseInt(String(n||"").replace("px",""),10)||0,l=Boolean(s.data.hiddenOnMobile);return Je(Ye,{children:[qe(_r,{children:y(F===Ui?"column_wrapper_style":"column_styles")}),qe(vr,{label:y("background_color"),children:qe(cr,{color:e,setColor:D("backgroundColor")})}),qe(vr,{label:y("content_background_color"),children:qe(cr,{color:t,setColor:D("contentBackground")})}),qe(vr,{label:y("border_radius"),children:qe(k,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",value:o,onFocus:e=>e?.target?.select?.(),onChange:e=>U("borderRadius")(Number(e)||0)})}),qe(vr,{label:y("label_padding"),children:qe(mr,{padding:{paddingTop:M(s.data.styles,"paddingTop"),paddingRight:M(s.data.styles,"paddingRight"),paddingLeft:M(s.data.styles,"paddingLeft"),paddingBottom:M(s.data.styles,"paddingBottom")},setPadding:E})}),ve(F===Ui),F===Ui?Je(Ye,{children:[qe(_r,{children:y("visibility")}),Je("div",{className:"ee-settings-row ee-padding-link-sides-row ee-visibility-hide-mobile-row",children:[qe("span",{className:"ee-padding-link-sides-label",children:y("hidden_on_mobile")}),qe(pr,{checked:l,onChange:e=>{const t=xt(s.data);t.hiddenOnMobile=e,le(t)}})]})]}):null]})})()]})})},Zr=({mlEmailNodesEndpoint:e,mlGenerationEndpoint:t,headers:n={},templateData:l,blockId:a,containerType:i,containerId:r,productId:s,blockName:c="Text",blockElementType:d="p",emailTemplateId:u,companyId:p,aiContentLanguage:m="en"}={})=>{const g=!!(e&&String(u??"").trim()&&String(p??"").trim()&&a&&r),h=!!t,y=g||h;return{generateOptions:o(async(o,y,b={})=>{const{previousPrompt:f="",previousSelectedAiContent:_=""}=b,k=function(e,t={}){const{containerType:n}=t,o=String(e??"").trim();let l;return l=Fo[o]?Fo[o]:o?o.split(/[-_]/).map(e=>e.length?e[0].toUpperCase()+e.slice(1).toLowerCase():"").join(""):"DisplayText",l||(l="DisplayText"),"product"===n&&"DisplayText"===l?"ProductDescription":l}(o,{containerType:i});if(g){const t={containerType:i||"none",id:r};if("product"===(i||"")&&null!=s){const e=String(s).trim();e&&(t.productId=e)}const o=e,l={blockContext:{blockId:a,name:c,type:d||"p"},companyId:p,containerContext:t,emailTemplateId:u,language:"bn-BD"===m?"bn-BD":"en",promptContext:{newPrompt:y||"",previousPrompt:f||"",previousSelectedAiContent:_||""},type:k},g=await(async(e,t,n={})=>{if(!e)return console.error("[API Service] generate-email-nodes: no endpoint"),{success:!1,error:"ML endpoint is not configured."};try{const o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...n},body:JSON.stringify(t)});let l={};try{l=await o.json()}catch{l={}}if(!o.ok||!1===l.success){let e="";const t=l.error;if(t&&"object"==typeof t){const n=null!=t.code?String(t.code):"",o=null!=t.message?String(t.message):"";e=[n,o].filter(Boolean).join(" — ")||o||n}return e||(e=null!=l.message?String(l.message):`${o.status} ${o.statusText}`),console.error("[API Service] generate-email-nodes failed:",e),{success:!1,error:String(e),errorCode:t&&"object"==typeof t&&null!=t.code?String(t.code):void 0}}const a=Array.isArray(l.variations)?l.variations:[],i=a.map(e=>e&&"string"==typeof e.value?e.value.trim():"").filter(Boolean);return 0===i.length?(console.error("[API Service] generate-email-nodes: empty variations"),{success:!1,error:"No variations were returned for this request."}):{success:!0,options:i,variations:a,emailJson:"string"==typeof l.emailJson?l.emailJson:void 0,blockId:l.blockId,emailTemplateId:l.emailTemplateId}}catch(e){return console.error("[API Service] Error calling generate-email-nodes:",e),{success:!1,error:e&&"object"==typeof e&&"message"in e?String(e.message):"Unable to reach the ML service. Check your network and try again."}}})(o,l,n);if(g&&g.success&&g.options?.length)return g.options;return{error:g&&"object"==typeof g&&g.error?String(g.error):"No response from the ML service."}}if(h){const e={variable:k,prompt:y,context:{templateData:l,blockId:a,containerType:i}},o=await(async(e,t,n={})=>{if(!e)return console.error("[API Service] ML endpoint not configured"),null;try{const o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...n},body:JSON.stringify(t)});if(!o.ok)return console.error("[API Service] ML endpoint failed:",o.status,o.statusText),null;const l=await o.json();if(!l.success)return console.error("[API Service] ML API returned error:",l.error),null;const a=l.data?.options??[];return Array.isArray(a)&&0!==a.length?a:(console.error("[API Service] ML API returned empty options"),null)}catch(e){return console.error("[API Service] Error calling ML endpoint:",e),null}})(t,e,n);return o&&o.length?o:{error:"The legacy ML endpoint did not return any options. Check the API response."}}return{i18nKey:"ml_ai_unavailable"}},[g,h,e,t,n,l,a,i,r,s,c,d,u,p,m]),isConfigured:y}};function Qr(){const{blockMap:e,rootOrder:t,currentItem:o}=n(Ln);return l(()=>{if(!e||!o?.id)return{containerBlock:null,containerType:"none",columnIndex:0,cellIndex:0,contentIndex:0,effectiveContainerBlock:null,effectiveContainerType:"none",effectiveCellIndex:0,effectiveColumnProduct:null};const{containerBlock:n,containerType:l,cellIndex:a,isRoot:i,rootIndex:r}=Gt(e,t,o.id);let s=0;if(i)s=r??0;else if(n){const e=t.indexOf(n.id);s=e>=0?e:0}const c=a??0,d=Jt(e,t,o.id);return{containerBlock:n??null,containerType:l??"none",columnIndex:s,cellIndex:c,contentIndex:c,effectiveContainerBlock:d.containerBlock??n??null,effectiveContainerType:d.containerType??l??"none",effectiveCellIndex:d.columnIndex??c,effectiveColumnProduct:d.columnProduct??null}},[e,t,o?.id])}const{TextArea:es}=h,ts=[8,9,10,11,12,14,16,18,20,24,28,32,36,48,64],ns="staticTextBeforeAi";function os(e,t,n,o){const l=Number.parseInt(String(e??""),10);return Number.isNaN(l)?o:Math.min(n,Math.max(t,l))}function ls(e){return null==e||"string"!=typeof e?"":e.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim()}const as=({embedded:e=!1})=>{const{currentItem:t,previewMode:o,templateData:l,apiConfig:i,bodySettings:s,aiEnabled:c=!0}=n(Ln),{t:d}=ja(),{findStyleItem:u,paddingChange:p,inputChange:m,updateItemStyles:g}=Rr(),{containerBlock:y,containerType:b,cellIndex:f,effectiveContainerBlock:w,effectiveContainerType:S,effectiveCellIndex:N,effectiveColumnProduct:L}=Qr(),T="product"===S?w:y,I="none"!==S?S:b,$=T?.id,P="product"===S?L?.id??w?.columnProducts?.[N??0]?.id:"product"===b?y?.columnProducts?.[f??0]?.id:void 0,R="bn-BD"===t?.data?.dynamicAiLanguage?"bn-BD":"en",{generateOptions:M}=Zr({mlEmailNodesEndpoint:i?.mlEmailNodesEndpoint,mlGenerationEndpoint:i?.mlGenerationEndpoint,headers:i?.headers||{},templateData:l,blockId:t?.id,containerType:I,containerId:$,productId:P,blockName:t?.data?.name||"Text",blockElementType:t?.data?.type||"p",emailTemplateId:i?.emailTemplateId,companyId:i?.companyId??l?.companyId,aiContentLanguage:R}),[D,U]=a(""),E=u(t.data.styles,"fontSize"),z=null!=E&&""!==E?Number(E):14,[F,O]=a(String(z)),[W,j]=a(""),H=(e,n)=>{const l=xt(t.data);l.styles||(l.styles={desktop:{},mobile:{}}),l.styles.desktop||(l.styles.desktop={}),l.styles.mobile||(l.styles.mobile={}),l.styles[o][e]=n,l.text=Ct(l.text,l.styles.desktop),g(l)},K=e=>{const t=os(e,1,999,14);O(String(t)),H("fontSize",t)},V=()=>{const e=String(W??"").trim();if(""===e){const e=xt(t.data);return e.styles||(e.styles={desktop:{},mobile:{}}),e.styles.desktop||(e.styles.desktop={}),e.styles.mobile||(e.styles.mobile={}),delete e.styles.desktop.lineHeight,delete e.styles.mobile.lineHeight,void g(e)}const n=os(e,1,999,24);j(String(n)),m("lineHeight")(`${n}px`)};r(()=>{O(String(z))},[t?.id,z]);const G=u(t.data.styles,"lineHeight");r(()=>{j(null==G||""===G?"":String(function(e,t=14){if(null==e||""===e)return Math.max(1,Math.round(1.4*Number(t)));const n=String(e).trim(),o=n.match(/^(-?\d*\.?\d+)\s*%$/);if(o){const e=Number(o[1]);if(!Number.isNaN(e))return Math.max(1,Math.round(t*e/100))}const l=n.match(/^(-?\d*\.?\d+)\s*px$/i);if(l){const e=Number(l[1]);if(!Number.isNaN(e))return Math.max(1,Math.round(e))}const a=Number(n);return Number.isNaN(a)?24:a>0&&a<=10?Math.max(1,Math.round(t*a)):Math.max(1,Math.round(a))}(G,z)))},[t?.id,G,z]);const[q,J]=a([]),[Y,X]=a(!1),[Z,Q]=a(""),ee=t.data.contentType??"static",te=t.data.type??"p",ne=String(te).toLowerCase(),oe="p"===ne||""===te?"p":/^h[1-6]$/.test(ne)?ne:"p",le=e=>{if(!c)return;const n=e?"dynamic":"static",o=xt(t.data),l=o.styles?.desktop??{};if(o.contentType=n,"dynamic"===n){if("static"===(t.data.contentType??"static")){const e=t.data.text??"",n=Ct(d("text_content"),l),a=Ct(d("ai_enabled"),l);ls(e).length>0&&e!==n&&e!==a?o[ns]=e:delete o[ns]}o.selectedVariableKey=void 0,o.dynamicVariable=o.dynamicVariable??"",o.dynamicPrompt=o.dynamicPrompt??"",o.dynamicSelectedContent=o.dynamicSelectedContent??"",o.dynamicOptions=Array.isArray(o.dynamicOptions)?o.dynamicOptions:[],o.dynamicAiLanguage="bn-BD"===o.dynamicAiLanguage?"bn-BD":"en";const e=o.dynamicSelectedContent??"",n="string"==typeof e?ls(e):"",a=Ct(d("ai_enabled"),l);o.text=n.length>0?Ct(e,l):a}else{const e=o[ns];"string"==typeof e&&ls(e).length>0?o.text=Ct(e,l):o.text=Ct(d("text_content"),l),delete o[ns]}g(o)},ae=async()=>{const e=t.data.dynamicVariable??"",n=t.data.dynamicPrompt??D??"";X(!0),Q("");try{const o=await M(e,n,{previousPrompt:t.data.dynamicPreviousPrompt??"",previousSelectedAiContent:ls(t.data.dynamicSelectedContent||t.data.text)});if(o&&"object"==typeof o&&!Array.isArray(o))return o.i18nKey?Q(d(o.i18nKey)):o.error?Q(String(o.error)):Q(d("ml_no_variations")),void J([]);if(Array.isArray(o)&&o.length>0){Q(""),J(o);const e=xt(t.data);e.dynamicOptions=o,e.dynamicPrompt=n,e.dynamicPreviousPrompt=n,g(e)}else Q(d("ml_no_variations")),J([])}catch(e){console.error("[TextStyleSettings] Error during content generation:",e),Q(e&&"object"==typeof e&&"message"in e?String(e.message):d("ml_generation_unexpected_error")),J([])}finally{X(!1)}},ie=e=>{const n=e.target.value;U(n),Q("");const o=xt(t.data);o.dynamicPrompt=n,g(o)},re=e=>{const n=xt(t.data);n.dynamicAiLanguage="bn-BD"===e?"bn-BD":"en",g(n)};return Je("div",{className:e?"ee-settings-block-form ee-discount-simple-text-settings":"margin-y-30 ee-settings-block-form",children:[(()=>{const e=Je("div",{className:za("ee-text-ai-usp-row","ee-settings-row","ee-text-ai-toggle-row",!c&&"ee-text-ai-usp-row--disabled"),children:[Je("span",{className:"ee-text-ai-label-with-help",children:[d("ai_enabled"),qe(v,{title:d("tooltip_write_using_ai"),children:qe("span",{className:"ee-help-icon ee-text-ai-help-trigger","aria-label":d("tooltip_write_using_ai"),onClick:e=>e.stopPropagation(),children:qe(B,{icon:A})})})]}),qe(pr,{checked:"dynamic"===ee,onChange:le,disabled:!c})]});return qe(Ye,{children:Je("div",{className:"ee-text-settings-content-wrap",children:[qe(_r,{children:d("content")}),Je("div",{className:"ee-text-settings-content-gap",children:[qe(vr,{label:d("heading_type"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:oe,onChange:e=>{return(n=e,()=>{const e=String(n??"p").toLowerCase(),o=t.data.styles?.desktop??{},l="p"!==e&&/^h[1-6]$/.test(e)?e:"p";let a,i,r;if("p"===l)a=14,i=20,r="400";else{switch(a=o.fontSize,l){case"h1":a=22;break;case"h2":a=20;break;case"h3":a=18;break;case"h4":a=16;break;case"h5":a=15;break;case"h6":a=14;break;default:a=null!=a&&""!==a&&Number(a)||14}i=Math.max(1,Math.round(1.4*Number(a))),r="bold"}const s=xt(t.data);s.type=l;const c="p"===l?{textTransform:"none",letterSpacing:"0em"}:{},d={...o,...c,fontSize:a,lineHeight:`${i}px`,fontWeight:r},u={...t.data.styles?.mobile??{},...c,fontSize:a,lineHeight:`${i}px`,fontWeight:r};s.styles={...s.styles??{},desktop:d,mobile:u},s.text=Ct(s.text,d),g(s)})();var n},items:[{value:"p",label:d("body_paragraph")},{value:"h1",label:"H1"},{value:"h2",label:"H2"},{value:"h3",label:"H3"},{value:"h4",label:"H4"}],"aria-label":d("heading_type")})}),qe("div",{className:"ee-text-ai-slot",children:c?e:qe(v,{title:d("tooltip_write_using_ai_unavailable"),children:e})}),c&&"dynamic"===ee?Je(Ye,{children:[Je("div",{className:"ee-dynamic-prompt-block ee-dynamic-prompt-block--with-heading",children:[Je("div",{className:"ee-dynamic-language-row",children:[qe("span",{className:"ee-prompt-label",children:d("ai_output_language")}),Je(x,{className:"input-width ee-dynamic-language-select",value:R,onChange:re,getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:[qe(x.Option,{value:"en",children:d("ai_output_language_en")}),qe(x.Option,{value:"bn-BD",children:d("ai_output_language_bn")})]})]}),Je("span",{className:"ee-prompt-label",children:[d("dynamic_prompt_help"),qe(v,{title:d("tooltip_dynamic_prompt"),children:qe("span",{className:"ee-help-icon","aria-label":"Help",children:qe(B,{icon:A})})})]}),qe(es,{rows:3,value:t.data.dynamicPrompt??D,onChange:ie,placeholder:d("dynamic_prompt_help")}),qe(_,{type:"primary",size:"small",block:!0,loading:Y,disabled:!(t.data.dynamicPrompt??D??"").trim(),onClick:ae,children:d("generate")}),Z?qe("div",{className:"ee-ml-generation-error",role:"alert",children:Z}):null]}),(t.data.dynamicOptions?.length>0||q.length>0)&&Je("div",{className:"ee-sample-content-block",children:[qe("div",{className:"card-item-title",children:d("select_content")}),(t.data.dynamicOptions||q).map((e,n)=>{const o="string"==typeof e?e:String(e),l=t.data.dynamicSelectedContent??"",a=(("string"==typeof l?ls(l):"").length>0?l:t.data.text??"").replace(/<[^>]+>/g,"").replace(/\s+/g," ").trim(),i=o.replace(/\s+/g," ").trim(),r=a.length>0&&a===i;return qe("div",{className:za("ee-sample-content-item",r&&"ee-sample-content-item-selected"),onClick:()=>(e=>{const n=xt(t.data);n.dynamicSelectedContent=e,n.text=e,g(n),Array.isArray(n.dynamicOptions)&&n.dynamicOptions.length&&J([...n.dynamicOptions]),Q("")})(e),children:e},n)})]})]}):null]})]})})})(),(()=>{const e=u(t.data.styles,"color"),n=null!=e&&""!==String(e).trim()?e:s?.styles?.color??"#171717",a=u(t.data.styles,"linkColor"),i=u(t.data.styles,"textAlign"),r=u(t.data.styles,"fontFamily"),c=function(e){if(null==e||""===e)return"400";const t=String(e).trim().toLowerCase();if("bold"===t||"bolder"===t)return"700";if("normal"===t||"lighter"===t)return"400";const n=Number(t);return Number.isNaN(n)||n<=450?"400":n<=550?"500":n<=650?"600":"700"}(u(t.data.styles,"fontWeight")),p=u(t.data.styles,"textTransform"),y=null!=p&&""!==String(p).trim()?String(p):"none",b=function(e,t){if(null==e||""===e)return t;const n=String(e).trim().replace(/[a-z%]+$/i,""),o=Number(n);return Number.isNaN(o)?t:o}(u(t.data.styles,"letterSpacing"),0),f=Yo(l),_=Zo(r,l);return Je(Ye,{children:[qe(_r,{children:d("typography")}),qe(vr,{label:d("font_color"),children:qe(cr,{color:n,fallbackColor:s?.styles?.color??"#171717",setColor:({hex:e})=>H("color",e)})}),qe(vr,{label:d("link_color"),children:qe(cr,{color:null!=a&&""!==String(a).trim()?a:"#2faade",setColor:({hex:e})=>((e,n)=>{const l=xt(t.data);l.styles||(l.styles={desktop:{},mobile:{}}),l.styles.desktop||(l.styles.desktop={}),l.styles.mobile||(l.styles.mobile={}),l.styles[o][e]=n,g(l)})("linkColor",e)})}),qe(vr,{label:d("label_align"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:i||"left",onChange:e=>(e=>{const n=xt(t.data);n.styles||(n.styles={desktop:{},mobile:{}}),n.styles.desktop||(n.styles.desktop={}),n.styles.mobile||(n.styles.mobile={}),n.styles[o].textAlign=e,"string"==typeof n.text&&(n.text=n.text.replace(/(\s+style\s*=\s*)(["'])([^"']*)\2/gi,(e,t,n,o)=>{const l=o.replace(/\s*text-align\s*:[^;]+;?/gi,"").replace(/;+\s*$/,"").trim();return l?`${t}${n}${l}${n}`:""})),g(n)})(e),"aria-label":d("text_align"),items:[{value:"left",label:qe(B,{icon:he,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:qe(B,{icon:ye,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:qe(B,{icon:be,className:"tag-style-size"}),iconOnly:!0},{value:"justify",label:qe(B,{icon:fe,className:"tag-style-size"}),iconOnly:!0}]})}),qe(vr,{label:d("font_weight"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:c,onChange:e=>H("fontWeight",e),"aria-label":d("font_weight"),items:[{value:"400",label:"Reg"},{value:"500",label:"Med"},{value:"600",label:"SBd"},{value:"700",label:"Bd"}]})}),qe(vr,{label:d("text_transform"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:y,onChange:e=>H("textTransform",e),"aria-label":d("text_transform"),items:[{value:"none",label:"Aa"},{value:"uppercase",label:"AA"},{value:"capitalize",label:"Cp"}]})}),qe(vr,{label:d("font_family"),children:qe(x,{className:"input-width ee-font-family-select",value:_,showSearch:!0,optionFilterProp:"label",labelRender:({value:e})=>qe("span",{children:Qo(e,l)}),onChange:e=>H("fontFamily",Zo(e,l)),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,options:f})}),qe(vr,{label:d("font_size"),children:qe(C,{className:"input-width ee-settings-input-affix",value:F,options:ts.map(e=>({value:String(e),label:`${e}px`})),onChange:e=>O(String(e??"")),onSelect:e=>K(e),filterOption:!1,getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:qe(h,{addonAfter:"px",onFocus:e=>e?.target?.select?.(),onBlur:()=>K(F),onPressEnter:e=>{K(F),e.currentTarget.blur()},onKeyDown:e=>{if("ArrowUp"!==e.key&&"ArrowDown"!==e.key)return;e.preventDefault();const t="ArrowUp"===e.key?1:-1,n=os(F,1,999,14)+t;K(n)}})})}),qe(vr,{label:d("line_height"),children:qe(h,{className:"input-width ee-settings-input-affix",addonAfter:"px",value:W,onChange:e=>j(e.target.value.replace(/[^\d]/g,"")),onFocus:e=>e?.target?.select?.(),onBlur:V,onPressEnter:e=>{V(),e.currentTarget.blur()}})}),qe(vr,{label:d("letter_spacing"),children:qe(k,{className:"input-width ee-settings-input-affix",addonAfter:"px",min:-20,max:100,step:.1,value:b,onFocus:e=>e?.target?.select?.(),onChange:e=>{const t=null==e||Number.isNaN(Number(e))?0:Number(e);m("letterSpacing")(`${t}px`)}})})]})})(),Je(Ye,{children:[qe(_r,{children:d("spacing")||"Spacing"}),qe(vr,{label:d("label_padding"),children:qe(mr,{padding:{paddingTop:u(t.data.styles,"paddingTop"),paddingRight:u(t.data.styles,"paddingRight"),paddingLeft:u(t.data.styles,"paddingLeft"),paddingBottom:u(t.data.styles,"paddingBottom")},setPadding:p})})]})]})};function is(e){if(null==e)return!0;const t=String(e).trim().toLowerCase();return""===t||"transparent"===t||"rgba(0, 0, 0, 0)"===t}function rs(e,t){const n=Bl(t);if(!e||"object"!=typeof e)return n;for(const t of["desktop","mobile"]){const o=e[t]?.backgroundColor;if(!is(o))return Tl(o)?n:o}for(const t of["desktop","mobile"]){const n=e[t]?.borderColor;if(!is(n))return n}return n}function ss(e,t,n){"solid"===t?(e.borderWidth=0,e.borderStyle="solid",e.borderColor=n,e.backgroundColor=n,e.color=function(e){const t=String(e??"").trim().replace(/^#/,"");if(3!==t.length&&6!==t.length)return"#ffffff";const n=(e=>3===e.length?e.split("").map(e=>e+e).join(""):e)(t),o=parseInt(n.slice(0,2),16),l=parseInt(n.slice(2,4),16),a=parseInt(n.slice(4,6),16);return[o,l,a].every(e=>Number.isFinite(e))&&(.299*o+.587*l+.114*a)/255>.62?"#171717":"#ffffff"}(n),e.textDecoration="none"):"outline"===t?(e.borderWidth=2,e.borderStyle="solid",e.borderColor=n,e.backgroundColor="transparent",e.color=n,e.textDecoration="none"):"ghost"===t?(e.borderWidth=0,e.borderStyle="none",e.borderColor="transparent",e.backgroundColor="transparent",e.color=n,e.textDecoration="none"):"underline"===t&&(e.borderWidth=0,e.borderStyle="none",e.borderColor="transparent",e.backgroundColor="transparent",e.color=n,e.textDecoration="underline")}const cs=()=>{const{currentItem:e,previewMode:t,templateData:o}=n(Ln),[i,r]=a(""),{t:s}=ja(),{containerBlock:c,containerType:d,contentIndex:u,effectiveContainerBlock:p,effectiveContainerType:m,effectiveCellIndex:g,effectiveColumnProduct:y}=Qr(),b="none"!==m?m:d,f=y??p?.columnProducts?.[g]??c?.columnProducts?.[u]??null,_=l(()=>({columnIndex:"product"===m?g:u,columnProduct:f}),[m,g,u,f]),v=l(()=>Yo(o),[o]),w=["header","footer","discount","product"].includes(b),{findStyleItem:S,colorChange:C,paddingChange:L,inputChange:T,updateItemStyles:A}=Rr(),{urlOptions:I}=l(()=>function(e,t,n={}){const o="product"===e?Uo:Do;return{labelOptions:Mo.map(({variableKey:e,labelKey:o})=>({value:co(e),labelKey:o,pasteValue:$o(t,e,n)})),urlOptions:o.map(({variableKey:e,labelKey:o})=>({value:co(e),labelKey:o,pasteValue:$o(t,e,n)}))}}(b,o,_),[b,o,_]);return Je("div",{className:"margin-y-30 ee-settings-block-form",children:[(()=>{const{linkURL:t,text:n,labelVariable:l,urlVariable:a}=e.data,c=n?.replace(/<[^>]+>/g,"").trim()??"",d=l||c&&/\{\{\w+\}\}/.test(c),u=l?l.replace(/^\{\{|\}\}$/g,"").trim():c.match(/\{\{(\w+)\}\}/)?.[1]||"CTALabel",p=o&&d?$o(o,u,_):null,m=null==p||String(p).startsWith("{{")?c:p,g=a?a.replace(/^\{\{|\}\}$/g,"").trim():"",y=null!=t?String(t).trim():"",b=y.match(/^\{\{(\w+)\}\}$/),f=a||(!a&&b?y:null)||void 0,k=b&&o?$o(o,b[1],_):null,v=null==k||"string"!=typeof k||String(k).startsWith("{{")?"":String(k).trim(),S=!y&&g&&o?$o(o,g,_):null,C=null==S||"string"!=typeof S||S.startsWith("{{")?"":String(S).trim(),N=v||C||y||"",L=e=>{r((e=>{const t=String(e??"").trim(),n=lt(t,!1,{allowMailtoTel:!0});return n?"empty"===n?"Button -> Link URL is empty. Add a destination like 'https://example.com' or 'mailto:support@example.com'.":"blocked_scheme"===n?`Button -> Link URL ('${t}') uses a blocked protocol. Use https://, http://, mailto:, or tel:.`:"duplicate_protocol"===n?`Button -> Link URL ('${t}') repeats the protocol. Keep only one, e.g. 'https://example.com'.`:"missing_hostname_dot"===n?`Button -> Link URL ('${t}') is missing a valid hostname. Use a full domain like 'https://example.com'.`:"invalid_protocol"===n?`Button -> Link URL ('${t}') has an unsupported protocol. Use https://, http://, mailto:, or tel:.`:`Button -> Link URL ('${t}') is invalid. Fix the URL format, for example 'https://example.com'.`:""})(e))};return Je(Ye,{children:[qe(_r,{children:s("button_action")}),qe(vr,{label:s("button_text"),children:qe(h,{className:"width-full",value:m,onChange:t=>{const n=t.target.value,o=xt(e.data);o.text=n,n&&n.startsWith("{{")||(o.labelVariable=""),A(o)},placeholder:s("button_label_manual")})}),w&&I.length>0?qe(vr,{label:s("button_url_variable"),children:qe(x,{className:"ee-variable-select width-full",placeholder:s("button_url_manual"),allowClear:!0,value:f,onChange:t=>{const n=xt(e.data);if(!t){n.urlVariable="";const e=String(n.linkURL??"").trim();return/^\{\{\w+\}\}$/.test(e)?n.linkURL="":n.linkURL=n.linkURL||"",void A(n)}const o=I.find(e=>e.value===t);n.urlVariable=t;const l=o?o.pasteValue:t;n.linkURL="string"==typeof l?l.replace(/^https?:\/\//,""):"",A(n)},getPopupContainer:()=>document.querySelector(".right-settings")||document.body,options:[{value:"",label:s("button_url_manual")},...I.map(e=>({value:e.value,label:s(e.labelKey)}))]})}):null,qe(vr,{label:s("link_url"),children:Je(Ye,{children:[qe(h,{className:"width-full",value:N,onChange:t=>{const n=t.target.value,o=xt(e.data);o.linkURL=n,n&&n.startsWith("{{")||(o.urlVariable=""),A(o),i&&L(n)},onBlur:e=>L(e.target.value),status:i?"error":"",placeholder:s("link_url_placeholder")}),i?qe("div",{className:"ee-field-error",role:"alert",children:i}):null]})})]})})(),(()=>{const n=S(e.data.styles,"width"),l=S(e.data.styles,"borderRadius"),a="number"==typeof l?l:parseInt(String(l||"").replace("px",""),10)||0,i=e.data.contentStyles?.[t]?.textAlign??"center",r="left"===i||"center"===i||"right"===i?i:"center",c=S(e.data.styles,"color"),d=S(e.data.styles,"fontFamily"),u=S(e.data.styles,"fontSize"),p=S(e.data.styles,"lineHeight"),m=function(e,t){const n=e?.buttonAccentColor;return null==n||is(n)?rs(e?.styles,t):n}(e.data,o),g=e.data.buttonVariant??"solid",h=e.data.hoverBg??"",y=e.data.hoverColor??"",b=S(e.data.styles,"letterSpacing")??"0em",f=S(e.data.styles,"textTransform")??"none",_=S(e.data.styles,"textDecoration")??"none",w=S(e.data.styles,"borderWidth"),I=S(e.data.styles,"borderStyle")??"solid",$=S(e.data.styles,"borderColor")??"#000000",P=e.data.shadowPreset??"none",R=t=>n=>{const o=xt(e.data);o[t]=n,A(o)},M={none:"",sm:"0 1px 2px rgba(0,0,0,0.12)",md:"0 4px 6px rgba(0,0,0,0.18)",lg:"0 10px 20px rgba(0,0,0,0.22)"},D=()=>document.querySelector(".right-settings")||document.body;return Je(Ye,{children:[qe(_r,{children:s("button_styles")}),qe(vr,{label:s("button_variant")||"Variant",children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:g,onChange:t=>(t=>{const n=xt(e.data);n.buttonVariant=t,n.styles=n.styles??{desktop:{},mobile:{}},n.styles.desktop={...n.styles.desktop??{}},n.styles.mobile={...n.styles.mobile??{}};const l=null==n.buttonAccentColor||is(n.buttonAccentColor)?rs(n.styles,o):n.buttonAccentColor;n.buttonAccentColor=l,ss(n.styles.desktop,t,l),ss(n.styles.mobile,t,l),A(n)})(t),"aria-label":s("button_variant")||"Variant",items:[{value:"solid",label:"Solid"},{value:"outline",label:"Outline"},{value:"ghost",label:"Ghost"},{value:"underline",label:"Underline"}]})}),qe(vr,{layout:"toggle",label:s("full_width")||"Full width",children:qe(pr,{checked:"auto"!==n,onChange:()=>{const e="auto"===n?"100%":"auto";T("width")(e)}})}),"auto"!==n?qe(vr,{label:s("width"),children:qe(N,{value:Number(String(n).replace("%","")),onChange:e=>T("width")(e+"%")})}):null,"auto"!==n?qe(vr,{label:s("align"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:r,onChange:n=>(n=>{const o=xt(e.data);o.contentStyles||(o.contentStyles={desktop:{},mobile:{}}),o.contentStyles[t]={...o.contentStyles[t]||{},textAlign:n},A(o)})(n),"aria-label":s("align"),items:[{value:"left",label:qe(B,{icon:he,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:qe(B,{icon:ye,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:qe(B,{icon:be,className:"tag-style-size"}),iconOnly:!0}]})}):null,qe(vr,{label:s("font_color"),children:qe(cr,{color:c,setColor:C("color")})}),qe(vr,{label:s("button_color"),children:qe(cr,{color:m,setColor:({hex:t})=>{const n=xt(e.data);n.styles=n.styles??{desktop:{},mobile:{}},n.styles.desktop={...n.styles.desktop??{}},n.styles.mobile={...n.styles.mobile??{}},n.buttonAccentColor=t;const o=n.buttonVariant??"solid";ss(n.styles.desktop,o,t),ss(n.styles.mobile,o,t),A(n)}})}),qe(vr,{label:s("hover_bg_color")||"Hover bg",children:qe(cr,{color:h||m,setColor:e=>R("hoverBg")(e.hex)})}),qe(vr,{label:s("hover_text_color")||"Hover text",children:qe(cr,{color:y||c,setColor:e=>R("hoverColor")(e.hex)})}),qe(vr,{label:s("font_family"),children:qe(x,{className:"width-full",showSearch:!0,optionFilterProp:"label",value:Zo(d??"sans-serif",o),onChange:e=>T("fontFamily")(Zo(e,o)),labelRender:({value:e})=>qe("span",{children:Qo(e,o)}),getPopupContainer:D,options:v})}),qe(vr,{label:s("font_size"),children:qe(k,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",value:u,onFocus:e=>e?.target?.select?.(),onChange:T("fontSize")})}),qe(vr,{label:s("line_height"),children:qe(k,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"%",value:Number(String(p||"100").replace("%","")),onFocus:e=>e?.target?.select?.(),onChange:e=>T("lineHeight")(`${e??0}%`)})}),qe(vr,{label:s("letter_spacing")||"Letter spacing",children:qe(k,{className:"input-width ee-settings-input-affix",addonAfter:"em",step:.01,value:parseFloat(String(b).replace("em",""))||0,onFocus:e=>e?.target?.select?.(),onChange:e=>T("letterSpacing")(`${e??0}em`)})}),qe(vr,{label:s("text_transform")||"Transform",children:qe(x,{className:"width-full",value:f,onChange:T("textTransform"),getPopupContainer:D,options:[{value:"none",label:"None"},{value:"uppercase",label:"UPPERCASE"},{value:"lowercase",label:"lowercase"},{value:"capitalize",label:"Capitalize"}]})}),qe(vr,{label:s("text_decoration")||"Decoration",children:qe(x,{className:"width-full",value:_,onChange:T("textDecoration"),getPopupContainer:D,options:[{value:"none",label:"None"},{value:"underline",label:"Underline"},{value:"line-through",label:"Strikethrough"}]})}),qe(_r,{children:s("border")||"Border"}),qe(vr,{label:s("border_width")||"Width",children:qe(k,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",value:"number"==typeof w?w:parseInt(String(w||"0"),10)||0,onFocus:e=>e?.target?.select?.(),onChange:e=>T("borderWidth")(Number(e)||0)})}),qe(vr,{label:s("border_style")||"Style",children:qe(x,{className:"width-full",value:I,onChange:T("borderStyle"),getPopupContainer:D,options:[{value:"solid",label:s("solid")},{value:"dashed",label:s("dashed")},{value:"dotted",label:s("dotted")},{value:"none",label:s("video_border_none")}]})}),qe(vr,{label:s("border_color"),children:qe(cr,{color:$,setColor:e=>T("borderColor")(e.hex)})}),qe(vr,{label:s("border_radius"),children:qe(k,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",value:a,onFocus:e=>e?.target?.select?.(),onChange:e=>T("borderRadius")(Number(e)||0)})}),qe(_r,{children:s("shadow")||"Shadow"}),qe(vr,{label:s("shadow_preset")||"Preset",children:qe(x,{className:"width-full",value:P,onChange:n=>{const o=xt(e.data);o.shadowPreset=n,o.styles=o.styles??{},o.styles[t]=o.styles[t]??{},o.styles[t].boxShadow=M[n]??"",A(o)},getPopupContainer:D,options:[{value:"none",label:"None"},{value:"sm",label:"Small"},{value:"md",label:"Medium"},{value:"lg",label:"Large"}]})}),qe(_r,{children:s("button_padding")}),qe(vr,{label:s("label_padding"),children:qe(mr,{padding:{paddingTop:S(e.data.styles,"paddingTop"),paddingRight:S(e.data.styles,"paddingRight"),paddingLeft:S(e.data.styles,"paddingLeft"),paddingBottom:S(e.data.styles,"paddingBottom")},setPadding:L})})]})})(),Je(Ye,{children:[qe(_r,{children:s("spacing")}),qe(vr,{label:s("label_padding"),children:qe(mr,{padding:{paddingTop:S(e.data.contentStyles,"paddingTop"),paddingRight:S(e.data.contentStyles,"paddingRight"),paddingLeft:S(e.data.contentStyles,"paddingLeft"),paddingBottom:S(e.data.contentStyles,"paddingBottom")},setPadding:n=>{const o=xt(e.data);o.contentStyles[t]={...o.contentStyles[t],...n},A(o)}})})]})]})},ds=()=>{const{currentItem:e,previewMode:t}=n(Ln),{t:o}=ja(),{findStyleItem:l,colorChange:a,updateItemStyles:i,inputChange:r}=Rr(),s=n=>{const o=xt(e.data);o.contentStyles[t]={...o.contentStyles[t],...n},i(o)};return qe("div",{className:"margin-y-30 ee-settings-block-form",children:(()=>{const n=l(e.data.contentStyles,"textAlign"),c=["left","center","right","justify"].includes(n)?n:"center",d=(e=>{if(null==e)return 100;if("number"==typeof e&&Number.isFinite(e))return Math.min(100,Math.max(0,e));const t=String(e).trim();if(/%$/.test(t)){const e=Number(t.replace(/%/,""));return Number.isFinite(e)?Math.min(100,Math.max(0,e)):100}const n=Number.parseFloat(t);return Number.isFinite(n)?Math.min(100,Math.max(0,n)):100})(l(e.data.styles,"width")),u=l(e.data.styles,"borderTopColor"),p=l(e.data.styles,"borderTopWidth"),m=l(e.data.styles,"borderTopStyle"),g=[{label:o("solid"),value:"solid"},{label:o("dotted"),value:"dotted"},{label:o("dashed"),value:"dashed"}];return Je(Ye,{children:[qe(_r,{children:o("divider")}),qe(vr,{label:o("divider_type"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:m||"solid",onChange:e=>r("borderTopStyle")(e),"aria-label":o("divider_type"),items:g.map(e=>({value:e.value,label:e.label}))})}),qe(vr,{label:o("height"),children:qe(k,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",value:"number"==typeof p?p:0,onFocus:e=>e?.target?.select?.(),onChange:e=>r("borderTopWidth")("number"==typeof e?e:0)})}),qe(vr,{label:o("divider_color"),children:qe(cr,{color:u,setColor:a("borderTopColor")})}),qe(vr,{label:o("width"),children:qe(N,{min:0,max:100,value:d,tooltip:{formatter:e=>`${e}%`},onChange:e=>r("width")(`${e}%`)})}),qe(vr,{label:o("align"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:c,onChange:n=>(n=>{const o=xt(e.data);o.contentStyles[t]={...o.contentStyles[t],textAlign:n},i(o)})(n),"aria-label":o("align"),items:[{value:"left",label:qe(B,{icon:he,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:qe(B,{icon:ye,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:qe(B,{icon:be,className:"tag-style-size"}),iconOnly:!0},{value:"justify",label:qe(B,{icon:fe,className:"tag-style-size"}),iconOnly:!0}]})}),qe(_r,{children:o("spacing")}),qe(vr,{label:o("label_padding"),children:qe(mr,{padding:{paddingTop:l(e.data.contentStyles,"paddingTop"),paddingRight:l(e.data.contentStyles,"paddingRight"),paddingLeft:l(e.data.contentStyles,"paddingLeft"),paddingBottom:l(e.data.contentStyles,"paddingBottom")},setPadding:s})})]})})()})};function us(e,t,n,o){const l=Number.parseInt(String(e??""),10);return Number.isNaN(l)?o:Math.min(n,Math.max(t,l))}const ps=()=>{const{currentItem:e}=n(Ln),{t:t}=ja(),{findStyleItem:o,inputChange:l}=Rr(),a=o(e.data.styles,"height"),i="number"==typeof a?a:parseInt(a,10)||16;return Je("div",{className:"margin-y-30 ee-settings-block-form",children:[qe(_r,{children:t("spacer")}),qe(vr,{label:Je("span",{className:"flex items-center gap-2",children:[qe(B,{icon:re,className:"tag-style-size"}),t("height")]}),children:qe(k,{min:0,max:200,step:1,className:"input-width ee-settings-input-affix",addonAfter:"px",value:i,onFocus:e=>e?.target?.select?.(),onChange:e=>l("height")(us(e,0,200,0)),onBlur:e=>l("height")(us(e?.target?.value,0,200,0)),onKeyDown:e=>{if("ArrowUp"!==e.key&&"ArrowDown"!==e.key)return;e.preventDefault();const t="ArrowUp"===e.key?1:-1;l("height")(us(i+t,0,200,0))}})})]})};function ms(e){if(null==e||""===e)return"400";const t=String(e).trim().toLowerCase();if("normal"===t||"regular"===t)return"400";if("bold"===t)return"700";if("bolder"===t)return"700";if("lighter"===t)return"300";if("light"===t)return"300";const n=Number(t);return Number.isNaN(n)?"400":n<=350?"300":n<=500?"400":n<=650?"600":"700"}const gs=new Set(["|","•","—","/","·"," "]);function hs(e){return[...String(e??"")].filter(e=>gs.has(e)).join("")}const ys=()=>{const{currentItem:e,previewMode:t,templateData:l}=n(Ln),{t:r}=ja(),{findStyleItem:s,updateItemStyles:d,colorChange:u,inputChange:p}=Rr(),{list:m=[],separator:g=" | "}=e.data;c(()=>{const t=e?.data?.separator,n=hs(String(t??""));if(String(t??"")!==n){const t=xt(e.data);t.separator=n,d(t)}},[e?.id,e?.data,d]);const[y,b]=a(!1),[f,_]=a(null),[v,w]=a({}),S=i(null),C=()=>document.querySelector(".right-settings")||document.body,N=(t,n)=>{const o=xt(e.data);o[t]=n,"list"===t&&(o.useNavigationLinks=!1),d(o)},L=(e,t,n)=>{const o=((e,t,n)=>{const o=String(e??"").trim(),l=`Menu item ${t+1}${n?` (${n})`:""} -> URL`,a=lt(o,!1,{allowMailtoTel:!0});return a?"empty"===a?`${l} is empty. Add a destination like 'https://example.com'.`:"blocked_scheme"===a?`${l} ('${o}') uses a blocked protocol. Use https://, http://, mailto:, or tel:.`:"duplicate_protocol"===a?`${l} ('${o}') repeats the protocol. Keep one protocol, e.g. 'https://example.com'.`:"missing_hostname_dot"===a?`${l} ('${o}') is missing a valid hostname. Use a full domain like 'https://example.com'.`:"invalid_protocol"===a?`${l} ('${o}') has an unsupported protocol. Use https://, http://, mailto:, or tel:.`:`${l} ('${o}') is invalid. Fix it to a valid URL like 'https://example.com'.`:""})(e,t,n);w(e=>{if(!o&&!e[t])return e;const n={...e};return o?n[t]=o:delete n[t],n})},T=o(St(e=>{e.preventDefault();const t=S.current,n=e.target?.closest?.(".social-link-item[data-index]");if(!n||!t?.contains(n))return;const o=Array.from(t.querySelectorAll(".social-link-item[data-index]")).indexOf(n);if(-1===o)return;const l=f,a=xt(m);null==l||l===o||a.length<2||([a[o],a[l]]=[a[l],a[o]],_(o),N("list",a))},50),[f]),A=Yo(l),I=Zo(s(e.data.styles,"fontFamily"),l),$=[{label:r("same_tab"),value:"_self"},{label:r("new_tab"),value:"_blank"}],P=e.data.layoutMode??"nav-only",R=Boolean(e.data.showLogo),M=Boolean(e.data.borderBottom),D=e.data.borderBottomColor??"#e5e7eb",U=e.data.borderBottomWidth??1,E=e.data.mobileLayout??"inline",z=e.data.linkGapPx,F="number"==typeof z&&Number.isFinite(z)?z:0,O=Boolean(e.data.linkUnderline),W=s(e.data.contentStyles,"textAlign"),j=["left","center","right"].includes(W)?W:"center";return Je("div",{className:"margin-y-30 ee-settings-block-form",children:[qe(_r,{children:r("menu_layout")||"Menu layout"}),qe(vr,{label:r("mobile_layout")||"Mobile layout",children:qe(x,{className:"width-full",value:E,onChange:e=>N("mobileLayout",e),getPopupContainer:C,options:[{value:"stack",label:r("stack")||"Stack"},{value:"inline",label:r("inline")||"Inline"}]})}),["logo-left","logo-right","stacked","logo-only"].includes(P)&&Je(Ye,{children:[qe(_r,{children:r("logo_section")}),qe(vr,{layout:"toggle",label:r("show_logo"),children:qe(pr,{checked:R,onChange:e=>N("showLogo",e)})}),R?Je(Ye,{children:[qe(vr,{label:r("logo_url")||"Logo URL",children:qe(h,{className:"width-full",placeholder:"https://...",value:e.data.logoSrc??"",onChange:e=>N("logoSrc",e.target.value)})}),qe(vr,{label:r("logo_text")||"Logo text",children:qe(h,{className:"width-full",placeholder:r("logo_text_placeholder")||"Brand",value:e.data.logoText??"",onChange:e=>N("logoText",e.target.value)})}),qe(vr,{label:r("logo_alt")||"Alt text",children:qe(h,{className:"width-full",placeholder:"Logo",value:e.data.logoAlt??"",onChange:e=>N("logoAlt",e.target.value)})}),qe(vr,{label:r("logo_link")||"Logo link",children:qe(h,{className:"width-full",value:e.data.logoHref??"",onChange:e=>N("logoHref",e.target.value),placeholder:r("link_url_placeholder")||"example.com"})}),qe(vr,{label:r("logo_max_width"),children:qe(k,{min:20,max:400,className:"input-width ee-settings-input-affix",addonAfter:"px",value:e.data.logoMaxWidth??120,onFocus:e=>e?.target?.select?.(),onChange:e=>N("logoMaxWidth",e??120)})})]}):null]}),qe(_r,{children:r("menu_items")}),qe("div",{ref:S,onDragOver:T,className:"margin-top-12",children:m.map((e,t)=>qe("div",{"data-index":t,draggable:!0,onDragStart:()=>{b(!0),_(t)},onDragEnd:e=>{e.currentTarget?.classList?.remove("social-link-item-current"),b(!1),_(null)},className:za("social-link-item","cursor-grab",y&&"social-link-item-drag_start",f===t?"social-link-item-current":"border-transparent"),children:Je("div",{className:"social-link-item-content ee-menu-item-content",children:[Je("div",{className:"ee-menu-item-header flex items-center justify-between margin-bottom-8",children:[Je("div",{className:"flex items-center ee-menu-item-drag-row",children:[qe("span",{className:"social-link-item-drag-handle ee-menu-item-drag-handle","aria-hidden":!0,children:qe(B,{icon:_e,className:"social-link-item-drag-handle-icon"})}),Je("span",{className:"font-semibold",children:[r("menu_item")," ",t+1]})]}),qe("div",{className:"social-link-item-icon social-link-item-icon-slate ee-menu-item-delete",role:"button",tabIndex:0,onClick:()=>N("list",m.filter((e,n)=>n!==t)),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),N("list",m.filter((e,n)=>n!==t)))},children:qe(B,{icon:J,className:"social-link-item-icon-svg social-link-item-icon-svg-deep"})})]}),Je("div",{className:"ee-menu-item-fields ee-settings-stack-flat",children:[qe(vr,{label:r("label"),children:qe(h,{className:"width-full ee-menu-item-input",value:e.label||"",onChange:e=>N("list",m.map((n,o)=>o===t?{...n,label:e.target.value}:n)),placeholder:r("page")||"Page"})}),Je(vr,{label:r("url"),children:[qe(h,{className:"width-full ee-menu-item-input",value:e.url||"",status:v[t]?"error":"",onChange:n=>{const o=n.target.value;N("list",m.map((e,n)=>n===t?{...e,url:o}:e)),v[t]&&L(o,t,e.label)},onBlur:n=>L(n.target.value,t,e.label),placeholder:r("link_url_placeholder")||"example.com"}),v[t]?qe("div",{className:"ee-field-error",role:"alert",children:v[t]}):null]}),qe(vr,{label:r("target"),children:qe(x,{className:"width-full ee-menu-item-input",value:e.target||"_self",onChange:e=>N("list",m.map((n,o)=>o===t?{...n,target:e}:n)),getPopupContainer:C,children:$.map(e=>qe(x.Option,{value:e.value,children:e.label},e.value))})})]})]})},t))}),Je("button",{type:"button",className:"menu-add-new-item margin-top-12",onClick:()=>N("list",m.concat({label:r("page")||"Page",url:"",target:"_self"})),children:[qe("span",{className:"menu-add-new-item-icon",children:"+"})," ",r("add_new_item")]}),qe(_r,{className:"margin-top-18",children:r("menu_styles")}),qe(vr,{label:r("font_family"),children:qe(x,{className:"width-full ee-font-family-select",value:I,showSearch:!0,optionFilterProp:"label",labelRender:({value:e})=>qe("span",{children:Qo(e,l)}),onChange:e=>p("fontFamily")(Zo(e,l)),getPopupContainer:C,options:A})}),qe(vr,{label:r("font_size"),children:qe(k,{min:8,max:72,className:"input-width ee-settings-input-affix",addonAfter:"px",value:s(e.data.styles,"fontSize")??14,onFocus:e=>e?.target?.select?.(),onChange:p("fontSize")})}),qe(vr,{label:r("letter_spacing"),children:qe(k,{className:"input-width ee-settings-input-affix",addonAfter:"px",value:s(e.data.styles,"letterSpacing")??0,onFocus:e=>e?.target?.select?.(),onChange:p("letterSpacing")})}),qe(vr,{label:r("text_color"),children:qe(cr,{color:s(e.data.styles,"color"),setColor:u("color")})}),qe(vr,{label:r("link_color"),children:qe(cr,{color:s(e.data.styles,"linkColor")||s(e.data.styles,"color"),setColor:u("linkColor")})}),qe(vr,{label:r("align"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:j,onChange:n=>(n=>{const o=xt(e.data);o.contentStyles||(o.contentStyles={desktop:{},mobile:{}}),o.contentStyles[t]={...o.contentStyles[t]??{},textAlign:n},d(o)})(n),"aria-label":r("align"),items:[{value:"left",label:qe(B,{icon:he,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:qe(B,{icon:ye,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:qe(B,{icon:be,className:"tag-style-size"}),iconOnly:!0}]})}),qe(vr,{label:r("separator"),hint:r("menu_separator_allowed_hint"),children:qe(h,{className:"width-full ee-menu-separator-input",value:hs(g),onChange:e=>N("separator",hs(e.target.value)),placeholder:r("menu_separator_placeholder")})}),qe(vr,{label:r("menu_link_gap")||"Link spacing",children:qe(k,{min:0,max:96,className:"input-width ee-settings-input-affix",addonAfter:"px",value:F,onFocus:e=>e?.target?.select?.(),onChange:t=>(t=>{const n="number"==typeof t&&Number.isFinite(t)&&t>=0?Math.min(96,t):0,o=xt(e.data);o.linkGapPx=n,d(o)})("number"==typeof t?t:0)})}),qe(vr,{layout:"toggle",label:r("menu_underline_links")||"Underline links",children:qe(pr,{checked:O,onChange:t=>{const n=xt(e.data);n.linkUnderline=!!t,d(n)}})}),qe(vr,{label:r("font_weight")||"Font weight",children:qe(x,{className:"width-full",value:ms(s(e.data.styles,"fontWeight")),onChange:p("fontWeight"),getPopupContainer:C,options:[{value:"300",label:r("font_weight_light")||"Light"},{value:"400",label:r("font_weight_regular")||"Regular"},{value:"600",label:r("font_weight_semibold")||"Semi-bold"},{value:"700",label:r("font_weight_bold")||"Bold"}]})}),qe(vr,{label:r("text_transform")||"Text transform",children:qe(x,{className:"width-full",value:s(e.data.styles,"textTransform")??"none",onChange:p("textTransform"),getPopupContainer:C,options:[{value:"none",label:"None"},{value:"uppercase",label:"UPPERCASE"},{value:"capitalize",label:"Capitalize"}]})}),qe(_r,{children:r("border_bottom")||"Border bottom"}),qe(vr,{layout:"toggle",label:r("show_border_bottom"),children:qe(pr,{checked:M,onChange:e=>N("borderBottom",e)})}),M?Je(Ye,{children:[qe(vr,{label:r("border_color")||"Color",children:qe(cr,{color:D,setColor:({hex:e})=>N("borderBottomColor",e)})}),qe(vr,{label:r("border_width")||"Width",children:qe(k,{min:1,max:8,className:"input-width ee-settings-input-affix",addonAfter:"px",value:U,onFocus:e=>e?.target?.select?.(),onChange:e=>N("borderBottomWidth",e??1)})})]}):null,qe(_r,{className:"ee-menu-settings-padding-heading",children:r("padding_settings")}),qe(vr,{children:qe(mr,{padding:{paddingTop:s(e.data.contentStyles,"paddingTop"),paddingRight:s(e.data.contentStyles,"paddingRight"),paddingLeft:s(e.data.contentStyles,"paddingLeft"),paddingBottom:s(e.data.contentStyles,"paddingBottom")},setPadding:n=>{const o=xt(e.data);o.contentStyles||(o.contentStyles={desktop:{},mobile:{}}),o.contentStyles[t]={...o.contentStyles[t]??{},...n},d(o)}})})]})};function bs(e,t){const n=String(e??""),o=parseFloat(n);if(!Number.isFinite(o))return 100;if(n.includes("px")){const e=Number(t)>0?Number(t):600;return Math.min(100,Math.max(0,Math.round(o/e*100)))}return Math.min(100,Math.max(0,Math.round(o)))}const fs=()=>{const{currentItem:e,previewMode:t,templateData:o,apiConfig:r,bodySettings:s}=n(Ln),{t:c}=ja(),{containerBlock:d,containerType:u,contentIndex:p,effectiveContainerBlock:m,effectiveContainerType:g,effectiveCellIndex:y,effectiveColumnProduct:b}=Qr(),f="none"!==g?g:u,_=b??m?.columnProducts?.[y]??d?.columnProducts?.[p]??null,{findStyleItem:C,inputChange:L,updateItemStyles:T}=Rr(),I=t=>{const n=xt(e.data);Object.assign(n,t),T(n)},$=i(null),[P,R]=a(!1),[M,D]=a(""),[U,E]=a(""),z=l(()=>({columnIndex:"product"===g?y:p,columnProduct:_}),[g,y,p,_]),F=l(()=>Wo(f,o,z),[f,o,z]),{uploadImageFile:O,isConfigured:W}=Hr({imageUploadEndpoint:r?.imageUploadEndpoint,headers:r?.headers||{},companyId:r?.companyId,imageUploadQueryParams:r?.imageUploadQueryParams,imageUploadCompanyField:r?.imageUploadCompanyField}),j=n=>{const o=xt(e.data);o.contentStyles[t]={...o.contentStyles[t],...n},T(o)};return Je("div",{className:"margin-y-30 ee-settings-block-form",children:[(()=>{const{linkURL:t}=e.data,n=jo(e.data),o=e=>{E((e=>{const t=String(e??"").trim(),n=lt(t,!1,{allowMailtoTel:!0});return n?"empty"===n?"Image -> Link URL is empty. Add a destination like 'https://example.com' or disable link action.":"blocked_scheme"===n?`Image -> Link URL ('${t}') uses a blocked protocol. Use https://, http://, mailto:, or tel:.`:"duplicate_protocol"===n?`Image -> Link URL ('${t}') repeats the protocol. Keep only one protocol, e.g. 'https://example.com'.`:"missing_hostname_dot"===n?`Image -> Link URL ('${t}') is missing a valid hostname. Use a full URL like 'https://example.com'.`:"invalid_protocol"===n?`Image -> Link URL ('${t}') has an unsupported protocol. Use https://, http://, mailto:, or tel:.`:`Image -> Link URL ('${t}') is invalid. Fix the URL format, for example 'https://example.com'.`:""})(e))};return Je(Ye,{children:[qe(_r,{children:c("image_action")}),qe(vr,{label:c("action_type"),children:Je("div",{className:"ee-settings-row ee-padding-link-sides-row",children:[qe("span",{className:za("link-tag",!n&&"ee-image-link-tag-inactive"),children:c("link")}),qe(pr,{checked:n,onChange:t=>{const n=xt(e);n.data.linkEnabled=Boolean(t),T(n.data)}})]})}),n?qe(vr,{label:c("link_url"),children:Je(Ye,{children:[qe(h,{value:t??"",onChange:t=>{const n=t.target.value??"",l=xt(e);l.data.linkURL=n,T(l.data),U&&o(n)},onBlur:e=>o(e.target.value),status:U?"error":"",placeholder:c("link_url_placeholder"),className:"width-full"}),U?qe("div",{className:"ee-field-error",role:"alert",children:U}):null]})}):null]})})(),(()=>{const{src:t,alt:n}=e.data,l="string"==typeof t&&/^\{\{\w+\}\}$/.test(t.trim())?String(t).replace(/\{\{|\}\}/g,"").trim():"",a=o&&l?$o(o,l,z):null,i=null==a||String(a).startsWith("{{")?t||"":a,r=e=>{D((e=>{const t=String(e??"").trim();if(/^\{\{\w+\}\}$/.test(t))return"";const n=lt(t,!1,{allowMailtoTel:!1});return n?"empty"===n?"Image -> Image URL is empty. Add an image URL like 'https://example.com/image.jpg' or choose a variable.":"blocked_scheme"===n?`Image -> Image URL ('${t}') uses a blocked protocol. Use only http:// or https:// image URLs.`:"duplicate_protocol"===n?`Image -> Image URL ('${t}') repeats the protocol. Keep only one protocol, e.g. 'https://example.com/image.jpg'.`:"missing_hostname_dot"===n?`Image -> Image URL ('${t}') is missing a valid hostname. Use a full URL like 'https://example.com/image.jpg'.`:"invalid_protocol"===n?`Image -> Image URL ('${t}') has an unsupported protocol. Use only http:// or https:// image URLs.`:`Image -> Image URL ('${t}') is invalid. Fix the URL format, for example 'https://example.com/image.jpg'.`:""})(e))},s=t=>n=>{const o=xt(e),l=n.target.value;o.data[t]=l,T(o.data),"src"===t&&M&&r(l)},d=t=>{const n=xt(e);n.data.src=t,T(n.data)},u=()=>{$.current?.click()};return Je(Ye,{children:[qe(_r,{children:c("image")}),qe(vr,{label:c("image_upload"),children:Je(Ye,{children:[qe("input",{ref:$,type:"file",accept:Wr,className:"ee-image-upload-input-hidden",onChange:async e=>{const t=e.target.files?.[0];if(!t)return;const n=jr(t);if("type"===n)return S.error(c("image_upload_invalid_type")||"Use PNG, JPEG, GIF, SVG, or WebP."),void(e.target.value="");if("size"===n)return S.error(c("image_file_too_large")),void(e.target.value="");if(!W)return S.error(c("image_upload_not_configured")||"Image upload not configured"),console.warn("[ImageStyleSettings] Image upload endpoint not configured"),void(e.target.value="");R(!0);try{const e=await O(t);e?(d(ol(e)),S.success(c("image_uploaded")||"Image uploaded successfully")):S.error(c("image_upload_failed")||"Failed to upload image")}catch(e){console.error("[ImageStyleSettings] Upload error:",e);const t="string"==typeof e?.message&&e.message.trim()?e.message.trim():null;S.error(t||c("image_upload_error")||"Error uploading image")}finally{R(!1),e.target.value=""}},disabled:P}),qe(w,{spinning:P,children:Je("div",{role:"button",tabIndex:0,className:"ee-image-upload-trigger",onClick:u,onDrop:async e=>{e.preventDefault(),e.stopPropagation();const t=e.dataTransfer?.files?.[0];if(!t)return;const n=jr(t);if("type"!==n)if("size"!==n){if(!W)return S.error(c("image_upload_not_configured")||"Image upload not configured"),void console.warn("[ImageStyleSettings] Image upload endpoint not configured");R(!0);try{const e=await O(t);e?(d(ol(e)),S.success(c("image_uploaded")||"Image uploaded successfully")):S.error(c("image_upload_failed")||"Failed to upload image")}catch(e){console.error("[ImageStyleSettings] Upload error:",e);const t="string"==typeof e?.message&&e.message.trim()?e.message.trim():null;S.error(t||c("image_upload_error")||"Error uploading image")}finally{R(!1),$.current.value=""}}else S.error(c("image_file_too_large"));else S.error(c("image_upload_invalid_type")||"Use PNG, JPEG, GIF, SVG, or WebP.")},onDragOver:e=>{e.preventDefault(),e.stopPropagation()},style:{opacity:P?.6:1,cursor:P?"not-allowed":"pointer"},children:[qe(B,{icon:me,className:"ee-image-upload-icon"}),qe("span",{children:P?c("uploading")||"Uploading...":c("image_upload_click")})]})}),Je("div",{className:"ee-image-toolbar",children:[Je("button",{type:"button",className:"ee-image-toolbar-btn",onClick:u,disabled:P,children:[qe(B,{icon:ge}),qe("span",{children:c("replace")||"Replace"})]}),Je("button",{type:"button",className:"ee-image-toolbar-btn ee-image-toolbar-btn--danger",onClick:()=>I({src:""}),children:[qe(B,{icon:J}),qe("span",{children:c("delete")||"Delete"})]})]}),qe("div",{className:"ee-image-upload-hint",children:c("image_upload_file_hint")||"PNG, JPEG, GIF, SVG, WebP · max 10 MB"})]})}),F.length>0?qe(vr,{label:c("image_source_variable"),children:qe(x,{className:"ee-variable-select width-full",placeholder:c("image_source_variable"),allowClear:!0,value:"string"==typeof t&&/^\{\{\w+\}\}$/.test(String(t).trim())?String(t).trim():void 0,onChange:e=>d(e??""),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,options:F.map(e=>({value:e.value,label:c(e.labelKey)}))})}):null,qe(vr,{label:c("image_url"),children:Je(Ye,{children:[qe(h,{className:"width-full",value:i,onChange:s("src"),onBlur:e=>r(e.target.value),status:M?"error":"",placeholder:"https://..."}),M?qe("div",{className:"ee-field-error",role:"alert",children:M}):null]})}),qe(vr,{label:c("image_alt"),children:qe(h,{className:"width-full",value:n||"",onChange:s("alt"),placeholder:c("image_alt_placeholder")})})]})})(),(()=>{const t=e.data,n=s?.styles?.fontFamily??"sans-serif",l=Boolean(t.textOverlayEnabled),a=t.overlayPosition??"bc",i=Boolean(t.scrimEnabled),r=Boolean(t.textShadowEnabled),d=t.overlayMaxWidth??100,u=t.overlayItemGap??8,p=Array.isArray(t.overlayItems)?t.overlayItems:[],m=[{value:"eyebrow",label:"Eyebrow",defaultSize:11},{value:"h1",label:"H1",defaultSize:32},{value:"h2",label:"H2",defaultSize:24},{value:"h3",label:"H3",defaultSize:18},{value:"subtitle",label:"Subtitle",defaultSize:16},{value:"body",label:"Body",defaultSize:14}],g=(e,t)=>{const n=[...p];n[e]={...n[e],...t},I({overlayItems:n})},y=(e,t)=>{const n=[...p],o="up"===t?e-1:e+1;o<0||o>=n.length||([n[e],n[o]]=[n[o],n[e]],I({overlayItems:n}))},b=(e,t,n,o)=>qe("button",{type:"button",disabled:t,onClick:e,style:{width:22,height:22,display:"inline-flex",alignItems:"center",justifyContent:"center",background:"transparent",border:"1px solid rgba(255,255,255,0.12)",borderRadius:3,cursor:t?"not-allowed":"pointer",color:o?"#f87070":"var(--ee-muted-foreground)",opacity:t?.35:1,padding:0,flexShrink:0},children:qe(B,{icon:n,style:{fontSize:9}})});return Je(Ye,{children:[qe(_r,{children:Je("span",{className:"ee-container-bg-heading-inline",children:[c("image_text_overlay"),qe(v,{title:Je("div",{children:[qe("p",{style:{marginBottom:8},children:c("image_text_overlay_tip")}),qe("p",{style:{margin:0,opacity:.85},children:c("image_text_overlay_container_tip")})]}),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:qe("span",{className:"ee-help-icon ee-container-bg-section-help",tabIndex:0,"aria-label":c("image_text_overlay"),children:qe(B,{icon:A})})})]})}),qe(vr,{layout:"toggle",label:c("image_text_overlay_enable"),children:qe(pr,{checked:l,onChange:e=>{if(e&&!t.textOverlayEnabled){const e=p.length>0?p:[{kind:"eyebrow",text:"EYEBROW TEXT",color:"#d8fe91",fontSize:11,fontFamily:n},{kind:"h1",text:"Heading Text",color:"#ffffff",fontSize:32,fontFamily:n},{kind:"body",text:"Body copy goes here.",color:"#ffffff",fontSize:14,fontFamily:n}];I({textOverlayEnabled:!0,overlayItems:e})}else I({textOverlayEnabled:e})}})}),l?Je(Ye,{children:[qe(vr,{label:c("add_overlay_item")||"Add element",children:qe("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:m.map(e=>Je("button",{type:"button",onClick:()=>(e=>{const t=m.find(t=>t.value===e)||m[5],o=[...p,{kind:e,text:"",color:"#ffffff",fontSize:t.defaultSize,fontFamily:n}];I({overlayItems:o})})(e.value),style:{padding:"4px 10px",background:"rgba(255,255,255,0.05)",border:"1px solid rgba(255,255,255,0.12)",borderRadius:4,color:"var(--ee-foreground)",cursor:"pointer",fontSize:11,fontFamily:"inherit"},children:["+ ",e.label]},e.value))})}),p.length>0&&qe("div",{style:{display:"flex",flexDirection:"column",gap:8,marginBottom:12},children:p.map((e,t)=>Je("div",{style:{background:"rgba(255,255,255,0.04)",border:"1px solid var(--ee-border)",borderRadius:6,padding:"10px 12px"},children:[Je("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:8},children:[b(()=>y(t,"up"),0===t,K,!1),b(()=>y(t,"down"),t===p.length-1,V,!1),qe(x,{size:"small",style:{flex:1},value:e.kind||"body",onChange:e=>g(t,{kind:e}),options:m.map(e=>({value:e.value,label:e.label})),getPopupContainer:()=>document.querySelector(".right-settings")||document.body}),b(()=>(e=>{I({overlayItems:p.filter((t,n)=>n!==e)})})(t),!1,J,!0)]}),qe(h,{size:"small",value:e.text||"",placeholder:"Text content...",onChange:e=>g(t,{text:e.target.value}),style:{marginBottom:8}}),Je("div",{style:{marginBottom:8},children:[qe("div",{style:{fontSize:11,color:"var(--ee-muted-foreground)",marginBottom:4},children:c("font_family")}),qe(x,{size:"small",className:"width-full ee-font-family-select",showSearch:!0,optionFilterProp:"label",value:Zo(null!=e.fontFamily&&""!==String(e.fontFamily).trim()?e.fontFamily:n,o),onChange:e=>g(t,{fontFamily:Zo(e,o)}),labelRender:({value:e})=>qe("span",{children:Qo(e,o)}),options:Yo(o),getPopupContainer:()=>document.querySelector(".right-settings")||document.body})]}),Je("div",{style:{display:"flex",alignItems:"center",gap:8},children:[qe(cr,{color:e.color||"#ffffff",setColor:({hex:e})=>g(t,{color:e}),fallbackColor:"#ffffff"}),qe(k,{size:"small",min:8,max:96,addonAfter:"px",value:e.fontSize||16,style:{flex:1},onChange:e=>g(t,{fontSize:"number"==typeof e?e:16})})]})]},t))}),qe(vr,{label:c("item_gap")||"Item gap",children:qe(k,{min:0,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:u,onChange:e=>I({overlayItemGap:"number"==typeof e?e:8})})}),qe(vr,{label:c("image_overlay_position"),children:qe("div",{className:"ee-image-overlay-position-grid",role:"group","aria-label":c("image_overlay_position"),children:cl.map(e=>qe("button",{type:"button",className:za("ee-image-overlay-position-cell",a===e&&"ee-image-overlay-position-cell-active"),title:c(`image_overlay_pos_${e}`),"aria-pressed":a===e,onClick:()=>I({overlayPosition:e}),children:qe("span",{className:"ee-image-overlay-dot","aria-hidden":!0})},e))})}),qe(vr,{label:c("overlay_max_width")||"Max width",children:qe(k,{min:20,max:100,className:"input-width ee-settings-input-affix",addonAfter:"%",value:d,onChange:e=>I({overlayMaxWidth:"number"==typeof e?e:100})})}),qe(vr,{label:c("image_overlay_box_bg"),children:qe(h,{className:"width-full",placeholder:"rgba(0,0,0,0.35)",value:t.overlayBoxBackground??"",onChange:e=>I({overlayBoxBackground:e.target.value})})}),qe(vr,{label:c("image_overlay_padding"),children:qe(k,{min:0,max:120,className:"input-width ee-settings-input-affix",addonAfter:"px",value:"number"==typeof t.overlayPadding?t.overlayPadding:16,onChange:e=>I({overlayPadding:"number"==typeof e?e:16})})}),qe(vr,{layout:"toggle",label:c("scrim")||"Scrim",children:qe(pr,{checked:i,onChange:e=>I({scrimEnabled:e})})}),qe(vr,{layout:"toggle",label:c("text_shadow")||"Text shadow",children:qe(pr,{checked:r,onChange:e=>I({textShadowEnabled:e})})})]}):null]})})(),(()=>{const n=C(e.data.styles,"width"),o=C(e.data.styles,"height"),l=C(e.data.styles,"borderRadius"),a="number"==typeof l?l:parseInt(String(l||"").replace("px",""),10)||0,i=C(e.data.contentStyles,"textAlign"),r=Boolean(e.data.fillColumn);return Je(Ye,{children:[qe(_r,{children:c("layout")}),qe(vr,{layout:"toggle",label:c("fill_column")||"Fill column",children:qe(pr,{checked:r,onChange:e=>I({fillColumn:e})})}),qe(vr,{layout:"toggle",label:c("auto_width"),children:qe(pr,{checked:"auto"===n,onChange:()=>{const e="auto"===n?"100%":"auto";L("width")(e)}})}),"auto"!==n?qe(vr,{label:c("width"),children:qe(N,{value:bs(n,s?.contentWidth),onChange:e=>L("width")(e+"%")})}):null,qe(vr,{label:c("height")||"Height",children:qe(k,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",placeholder:"auto",value:o&&parseInt(String(o).replace("px",""),10)||void 0,onChange:e=>L("height")(e?`${e}px`:"auto")})}),qe(vr,{label:c("border_radius"),children:qe(k,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",value:a,onFocus:e=>e?.target?.select?.(),onChange:e=>L("borderRadius")(Number(e)||0)})}),qe(vr,{label:c("align"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:i||"center",onChange:n=>(n=>{const o=xt(e.data);o.contentStyles||(o.contentStyles={desktop:{},mobile:{}}),o.contentStyles[t]||(o.contentStyles[t]={}),o.contentStyles[t]={...o.contentStyles[t],textAlign:n},T(o)})(n),"aria-label":c("align"),items:[{value:"left",label:qe(B,{icon:he,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:qe(B,{icon:ye,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:qe(B,{icon:be,className:"tag-style-size"}),iconOnly:!0},{value:"justify",label:qe(B,{icon:fe,className:"tag-style-size"}),iconOnly:!0}]})}),qe(_r,{children:c("spacing")}),qe(vr,{label:c("label_padding"),children:qe(mr,{padding:{paddingTop:C(e.data.contentStyles,"paddingTop"),paddingRight:C(e.data.contentStyles,"paddingRight"),paddingLeft:C(e.data.contentStyles,"paddingLeft"),paddingBottom:C(e.data.contentStyles,"paddingBottom")},setPadding:j})})]})})()]})},_s=()=>{const{currentItem:e,previewMode:t}=n(Ln),{t:o}=ja(),{findStyleItem:l,updateItemStyles:a}=Rr(),i=t=>{const n=xt(e.data);t(n),a(n)},r=n=>{const o=e.data.videoArea||{},l="desktop"===t?{}:o.desktop||{};return o[t]?.[n]??l[n]},s=e=>i(n=>{n.videoArea||(n.videoArea={desktop:{},mobile:{}}),n.videoArea[t]={...n.videoArea[t]||{},...e}}),c=l(e.data.contentStyles,"textAlign"),d=["left","center","right"].includes(c)?c:"center",u=Je("span",{className:"ee-container-bg-heading-inline",children:[o("video_url"),qe(v,{title:o("video_export_note"),children:qe("span",{className:"ee-help-icon ee-container-bg-section-help",tabIndex:0,"aria-label":o("video_export_note"),children:qe(B,{icon:A})})})]});return Je("div",{className:"margin-y-30 ee-settings-block-form",children:[qe(_r,{children:o("video_tab_display")}),qe(vr,{label:u,children:qe(h,{className:"width-full",value:e.data.videoUrl??"",onChange:e=>i(t=>{t.videoUrl=e.target.value}),placeholder:"https://www.youtube.com/watch?v=..."})}),qe(vr,{label:o("video_thumbnail_url"),children:qe(h,{className:"width-full",value:e.data.thumbnailUrl??"",onChange:e=>i(t=>{t.thumbnailUrl=e.target.value}),placeholder:o("video_thumbnail_url_placeholder")})}),qe(_r,{children:o("video_thumbnail_layout")}),qe(vr,{label:o("video_width"),children:qe(k,{min:0,className:"input-width ee-settings-input-affix ee-video-dim-field width-full",placeholder:"auto",addonAfter:"px",value:"number"==typeof l(e.data.styles,"width")?l(e.data.styles,"width"):void 0,onChange:e=>i(n=>{n.styles=n.styles||{desktop:{},mobile:{}},n.styles[t]={...n.styles[t]||{},width:null==e||""===e?"auto":e}})})}),qe(vr,{label:o("video_height"),children:qe(k,{min:0,className:"input-width ee-settings-input-affix ee-video-dim-field width-full",placeholder:"auto",addonAfter:"px",value:"number"==typeof l(e.data.styles,"height")?l(e.data.styles,"height"):void 0,onChange:e=>i(n=>{n.styles=n.styles||{desktop:{},mobile:{}},n.styles[t]={...n.styles[t]||{},height:null==e||""===e?"auto":e}})})}),qe(vr,{label:o("alignment"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:d,onChange:e=>i(n=>{n.contentStyles||(n.contentStyles={desktop:{},mobile:{}}),n.contentStyles[t]={...n.contentStyles[t]||{},textAlign:e}}),"aria-label":o("alignment"),items:[{value:"left",label:qe(B,{icon:he,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:qe(B,{icon:ye,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:qe(B,{icon:be,className:"tag-style-size"}),iconOnly:!0}]})}),qe(vr,{layout:"toggle",label:o("video_fill_column"),children:qe(pr,{checked:Boolean(l(e.data.styles,"fillColumn")),onChange:e=>i(n=>{n.styles=n.styles||{desktop:{},mobile:{}},n.styles[t]={...n.styles[t]||{},fillColumn:e}})})}),qe(vr,{layout:"toggle",label:o("video_fill_column_mobile"),children:qe(pr,{checked:Boolean(l(e.data.styles,"fillColumnMobile")),onChange:e=>i(n=>{n.styles=n.styles||{desktop:{},mobile:{}},n.styles[t]={...n.styles[t]||{},fillColumnMobile:e}})})}),qe(_r,{children:o("video_area_section")}),qe(vr,{label:o("label_padding"),children:qe(mr,{setPadding:e=>i(n=>{n.videoArea||(n.videoArea={desktop:{},mobile:{}}),n.videoArea[t]={...n.videoArea[t]||{},...e}}),padding:{paddingTop:r("paddingTop")??0,paddingBottom:r("paddingBottom")??0,paddingLeft:r("paddingLeft")??0,paddingRight:r("paddingRight")??0}})}),qe(vr,{label:o("background_color"),children:qe(cr,{color:"string"==typeof r("backgroundColor")&&r("backgroundColor").replace(/^#/,"")||"transparent",setColor:({hex:e})=>s({backgroundColor:e})})}),qe(vr,{label:o("divider_type"),children:Je(x,{className:"width-full",value:r("borderStyle")||"solid",onChange:e=>s({borderStyle:e}),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:[qe(x.Option,{value:"none",children:o("video_border_none")}),qe(x.Option,{value:"solid",children:o("solid")}),qe(x.Option,{value:"dashed",children:o("dashed")})]})}),qe(vr,{label:o("border_width"),children:qe(k,{min:0,className:"input-width ee-settings-input-affix",addonAfter:"px",value:r("borderWidth")??0,onFocus:e=>e?.target?.select?.(),onChange:e=>s({borderWidth:null==e?0:e})})}),qe(vr,{label:o("border_color"),children:qe(cr,{color:(r("borderColor")||"#cccccc").replace(/^#/,""),setColor:({hex:e})=>s({borderColor:e})})}),qe(_r,{children:o("video_block_section")}),qe(vr,{label:o("label_padding"),children:qe(mr,{padding:{paddingTop:l(e.data.contentStyles,"paddingTop")??0,paddingBottom:l(e.data.contentStyles,"paddingBottom")??0,paddingLeft:l(e.data.contentStyles,"paddingLeft")??0,paddingRight:l(e.data.contentStyles,"paddingRight")??0},setPadding:e=>i(n=>{n.contentStyles||(n.contentStyles={desktop:{},mobile:{}}),n.contentStyles[t]={...n.contentStyles[t]||{},...e}})})}),qe(vr,{label:o("background_color"),children:qe(cr,{color:(l(e.data.contentStyles,"backgroundColor")||"").replace(/^#/,"")||"transparent",setColor:({hex:e})=>i(n=>{n.contentStyles||(n.contentStyles={desktop:{},mobile:{}}),n.contentStyles[t]={...n.contentStyles[t]||{},backgroundColor:e}})})})]})},ks=()=>{const{currentItem:e,previewMode:t}=n(Ln),{t:o}=ja(),{findStyleItem:l,cardItemElement:a,updateItemStyles:i}=Rr(),{src:r,alt:s,linkURL:c}=e.data,d=l(e.data.styles,"width")??64,u=l(e.data.styles,"borderRadius"),p="50%"===u?50:parseInt(String(u).replace("px",""),10)||0;return Je("div",{className:"margin-y-30 ee-settings-block-form",children:[qe("div",{className:"right-setting-block-item-title",children:o("avatar_image")}),a(o("image_url"),qe(h,{value:r,onChange:t=>{const n=xt(e.data);n.src=t.target.value??"",i(n)}})),a(o("image_alt"),qe(h,{value:s,onChange:t=>{const n=xt(e.data);n.alt=t.target.value??"",i(n)},placeholder:"Avatar"})),a(o("link_url"),qe(h,{value:c,onChange:t=>{const n=xt(e.data);n.linkURL=t.target.value??"",i(n)},placeholder:o("link_url_placeholder")})),qe("div",{className:"right-setting-block-item-title margin-top-18",children:o("image_styles")}),a(o("width"),qe(k,{min:16,max:256,value:"number"==typeof d?d:64,onChange:t=>{const n=xt(e.data);n.styles.desktop||(n.styles.desktop={}),n.styles.desktop.width=t,i(n)},addonAfter:"px"})),a(o("avatar_border_radius"),qe(k,{min:0,max:50,value:p,onChange:t=>{const n=xt(e.data);n.styles.desktop||(n.styles.desktop={}),n.styles.desktop.borderRadius=50===t?"50%":`${t}px`,i(n)},addonAfter:50===p?"%":"px"})),qe("div",{className:"right-setting-block-item-title margin-top-18",children:o("padding_settings")}),qe(mr,{padding:{paddingTop:l(e.data.contentStyles,"paddingTop"),paddingRight:l(e.data.contentStyles,"paddingRight"),paddingLeft:l(e.data.contentStyles,"paddingLeft"),paddingBottom:l(e.data.contentStyles,"paddingBottom")},setPadding:n=>{const o=xt(e.data);o.contentStyles||(o.contentStyles={desktop:{},mobile:{}}),o.contentStyles[t]||(o.contentStyles[t]={}),o.contentStyles[t]={...o.contentStyles[t],...n},i(o)}})]})},vs="__ee_social_custom__";function ws({preset:e,settingsPanelIconColor:t,t:n}){const{src:o,style:l}=vt(e,t,22);return Je("span",{className:"ee-social-add-menu-item",children:[o?qe("img",{src:o,alt:"",className:"ee-social-add-menu-icon",style:l,draggable:!1}):null,qe("span",{children:at(e)?n("social_platform_x"):e.title})]})}function xs(e,t){const n=String(e?.image||"").trim(),o=String(t?.image||"").trim();if(n&&o&&n===o)return!0;const l=String(e?.title||"").trim().toLowerCase(),a=String(t?.title||"").trim().toLowerCase();return Boolean(l&&a&&l===a)}const Ss={facebook:"social_link_placeholder_facebook",linkedin:"social_link_placeholder_linkedin",instagram:"social_link_placeholder_instagram",tiktok:"social_link_placeholder_tiktok",youtube:"social_link_placeholder_youtube",pinterest:"social_link_placeholder_pinterest"};function Cs(e,t){if(at(e))return t("social_link_placeholder_x");const n=String(e?.title||"").trim().toLowerCase(),o=Ss[n];return t(o||"social_link_placeholder_generic")}function Ns({blockNode:e,onUpdateBlock:t,previewMode:n,findStyleItem:s,apiConfig:c,templateData:d,embedded:u=!1}){const{t:p}=ja(),m=l(()=>Array.isArray(e.list)?e.list:[],[e.list]),[g,y]=a(!1),[b,f]=a(null),[_,v]=a({}),[w,C]=a(null),N=i(null),T=i(null),[A,I]=a(null),[$,P]=a(null),{uploadImageFile:R,isConfigured:M}=Hr({imageUploadEndpoint:c?.imageUploadEndpoint,headers:c?.headers||{},companyId:c?.companyId,imageUploadQueryParams:c?.imageUploadQueryParams,imageUploadCompanyField:c?.imageUploadCompanyField}),D=[{image:pt("facebook"),title:"Facebook",linkURL:""},{image:pt("linkedin"),title:"LinkedIn",linkURL:""},{image:pt("instagram"),title:"Instagram",linkURL:""},{image:pt("tiktok"),title:"TikTok",linkURL:""},{image:pt("x"),title:"X",linkURL:""},{image:pt("youtube"),title:"YouTube",linkURL:""},{image:pt("pinterest"),title:"Pinterest",linkURL:""}];r(()=>{null!=w&&w>=m.length&&C(m.length?m.length-1:null)},[w,m.length]);const U=(n,o)=>{const l=xt(e),a=function(e){if(!Array.isArray(e))return e;const t=[];for(const n of e)t.some(e=>xs(e,n))||t.push(n);return t}(o);l[n]=a,l.useCompanySocialLinks=!1,t(l)},E=(e,t)=>{U("list",m.map((n,o)=>o===e?{...n,...t}:n))},z=(e,t,n)=>{const o=((e,t,n)=>{const o=String(e??"").trim(),l=`Social links -> ${n||`Item ${t+1}`} URL`,a=lt(o,!1,{allowMailtoTel:!1});return a?"empty"===a?`${l} is empty. Add a profile URL like 'https://example.com'.`:"blocked_scheme"===a?`${l} ('${o}') uses a blocked protocol. Use only http:// or https:// URLs.`:"duplicate_protocol"===a?`${l} ('${o}') repeats the protocol. Keep one protocol, e.g. 'https://example.com'.`:"missing_hostname_dot"===a?`${l} ('${o}') is missing a valid hostname. Use a full domain like 'https://example.com'.`:"invalid_protocol"===a?`${l} ('${o}') has an unsupported protocol. Use only http:// or https:// URLs.`:`${l} ('${o}') is invalid. Fix it to a valid URL like 'https://example.com'.`:""})(e,t,n);v(e=>{if(!o&&!e[t])return e;const n={...e};return o?n[t]=o:delete n[t],n})},F=o(St(e=>{e.preventDefault();const t=N.current,n=e.target?.closest?.(".social-link-item[data-index]");if(!n||!t?.contains(n))return;const o=Array.from(t.querySelectorAll(".social-link-item[data-index]")).indexOf(n);if(-1===o)return;const l=b,a=xt(m);l!==o&&([a[o],a[l]]=[a[l],a[o]],f(o),U("list",a),C(e=>e===l?o:e===o?l:e))},50),[b,m,u]),O=()=>document.querySelector(".right-settings")||document.body,W=s(e.contentStyles,"textAlign"),j=["left","center","right","justify"].includes(W)?W:"center",H=s(e.contentStyles,"columnGapPx"),G="number"==typeof H&&Number.isFinite(H)&&H>=0?H:8,q=function(e){if(e?.iconSize&&null!=ct[e.iconSize])return e.iconSize;const t=Number(e?.imageWidth);if(!Number.isFinite(t)||t<=0)return"medium";let n="medium",o=1/0;for(const[e,l]of Object.entries(ct)){const a=Math.abs(t-l);a<o&&(o=a,n=e)}return n}(e),Y=rt(e.iconColor),X="default"===Y?"default":"white",Z=Boolean(e.showTextLabel),Q=l(()=>[{value:"small",label:p("icon_size_small")},{value:"medium",label:p("icon_size_medium")},{value:"large",label:p("icon_size_large")}],[p]),ee=D.filter(e=>!m.some(t=>xs(t,e))),te=[...D.map(e=>({value:e.title,label:at(e)?p("social_platform_x"):e.title})),{value:vs,label:p("social_platform_custom")}],ne=[{value:"default",label:p("icon_color_default")},{value:"white",label:p("icon_color_white")},{value:"black",label:p("icon_color_black")},{value:"gray",label:p("icon_color_gray")}],oe=[...ee.map(e=>({key:e.title+e.image,label:qe(ws,{preset:e,settingsPanelIconColor:X,t:p}),onClick:()=>{U("list",m.concat({...e,id:Nt()})),C(m.length)}})),{key:"__add_custom_social_row__",label:Je("span",{className:"ee-social-add-menu-item ee-social-add-menu-item--custom",children:[qe("span",{className:"menu-add-new-item-icon",children:"+"}),qe("span",{children:p("social_platform_custom")})]}),onClick:()=>{U("list",m.concat({id:Nt(),image:"",title:"",linkURL:""})),C(m.length)}}];return Je("div",{className:za("ee-settings-block-form ee-social-link-settings",!u&&"margin-y-30"),children:[u?null:qe(_r,{className:"ee-social-link-settings-section",children:p("social_settings_icons")}),Je("div",{ref:N,onDragOver:F,className:"ee-social-link-icons-list",children:[qe("input",{ref:T,type:"file",accept:Wr,className:"ee-image-upload-input-hidden",onChange:async e=>{const t=e.target.files?.[0];e.target.value="";const n=A;if(I(null),null==t||null==n)return;const o=jr(t);if("type"!==o)if("size"!==o){P(n);try{const e=await R(t);e?(E(n,{image:ol(e)}),S.success(p("image_uploaded"))):S.error(p("image_upload_failed"))}catch(e){S.error(p("image_upload_error"))}finally{P(null)}}else S.error(p("image_file_too_large"));else S.error(p("image_upload_invalid_type"))}}),m.map((e,t)=>{const{title:n,linkURL:o}=e,l=at(e),a=function(e,t){const n=String(e?.image||"").trim(),o=t.find(e=>e.image===n);if(o)return o;if(at(e))return t.find(e=>at(e))??null;const l=String(e?.title||"").trim();return l?t.find(e=>e.title===l)??null:null}(e,D),i=!a,r=i&&!String(n||"").trim()?p("social_platform_custom"):l?p("social_platform_x"):n,s=i&&!String(n||"").trim()?p("social_platform_custom"):l?p("social_platform_x_alt"):n,c=vt(e,X,22),d=vt(e,X,28),u=a?a.title:vs,k=w===t;return qe("div",{"data-index":t,draggable:!0,onDragStart:()=>{y(!0),f(t)},onDragEnd:e=>{e.currentTarget?.classList?.remove("social-link-item-current"),y(!1),f(null)},className:za("social-link-item","cursor-grab",g&&"social-link-item-drag_start",b===t?"social-link-item-current":"border-transparent"),children:Je("div",{className:za("social-link-item-content","ee-menu-item-content","ee-social-link-row-shell"),children:[Je("div",{className:"ee-social-link-row-header",children:[qe("span",{className:"social-link-item-drag-handle","aria-hidden":!0,children:qe(B,{icon:_e,className:"social-link-item-drag-handle-icon"})}),c.src?qe("img",{src:c.src,alt:s,className:"social-link-item-img",style:c.style,draggable:!1}):qe("div",{className:"social-link-item-img ee-social-row-icon-placeholder","aria-hidden":!0}),qe("div",{className:"ee-social-link-row-header-main",children:Je("div",{className:"social-link-platform-title-wrap ee-social-link-row-title-wrap",children:[qe("div",{className:"font-semibold ee-social-link-row-primary-title",children:r}),l?qe("div",{className:"social-link-platform-former-name",children:p("social_platform_formerly_twitter")}):null]})}),Je("div",{className:"ee-social-link-row-tools",children:[qe("button",{type:"button",className:"ee-social-link-row-icon-btn","aria-expanded":k,"aria-label":p(k?"collapse":"expand"),onClick:e=>{e.stopPropagation(),(e=>{C(t=>t===e?null:e)})(t)},children:qe(B,{icon:k?K:V})}),qe("button",{type:"button",className:"ee-social-link-row-icon-btn ee-social-link-row-icon-btn-danger","aria-label":p("delete"),onClick:e=>{e.stopPropagation(),U("list",m.filter((e,n)=>n!==t)),C(e=>e===t?null:null!=e&&e>t?e-1:e)},children:qe(B,{icon:J,className:"social-link-item-icon-svg"})})]})]}),k?Je("div",{className:"ee-social-link-row-detail",children:[qe(vr,{label:p("social_platform_field"),children:qe(x,{className:"width-full ee-stack-control",value:u,options:te,getPopupContainer:O,onChange:e=>{if(e===vs)return void E(t,{title:"",image:""});const n=D.find(t=>t.title===e);n&&E(t,{image:n.image,title:n.title})}})}),qe(vr,{label:p("social_icon_label_field"),children:qe(h,{className:"width-full",value:n||"",placeholder:r,onChange:e=>E(t,{title:e.target.value})})}),Je(vr,{label:p("url"),children:[qe(h,{className:"width-full",placeholder:Cs(e,p),value:o||"",status:_[t]?"error":"",onChange:e=>{const n=e.target.value;U("list",m.map((e,o)=>o===t?{...e,linkURL:n}:e)),_[t]&&z(n,t,r)},onBlur:e=>z(e.target.value,t,r)}),_[t]?qe("div",{className:"ee-field-error",role:"alert",children:_[t]}):null]}),qe(vr,{label:p("social_custom_icon"),children:Je("div",{className:"ee-social-custom-icon-row",children:[qe("div",{className:"ee-social-custom-icon-preview",children:d.src?qe("img",{src:d.src,alt:"",style:d.style,draggable:!1}):qe("span",{className:"ee-social-custom-icon-preview-empty","aria-hidden":!0})}),qe("button",{type:"button",className:"menu-add-new-item ee-social-custom-upload-btn",disabled:!M||$===t,onClick:()=>(e=>{M?(I(e),requestAnimationFrame(()=>T.current?.click?.())):S.error(p("image_upload_not_configured"))})(t),children:p($===t?"uploading":"image_upload")})]})})]}):null]})},e.id??`${e.image??""}-${t}`)})]}),u?null:qe(L,{overlayClassName:"ee-social-add-platform-dropdown",menu:{items:oe},trigger:["click"],getPopupContainer:O,children:Je("button",{type:"button",className:"menu-add-new-item margin-top-12",children:[qe("span",{className:"menu-add-new-item-icon",children:"+"})," ",p("social_add_icon")]})}),qe(_r,{className:"ee-social-link-settings-section ee-social-link-settings-style-heading",children:p("social_settings_style")}),qe(_r,{className:"ee-social-link-settings-subsection",children:p("icon_styles")}),qe(vr,{label:p("icon_size"),children:qe(x,{className:"width-full ee-stack-control",value:q,onChange:n=>{const o=xt(e);o.iconSize=n,o.imageWidth=ct[n]??32,o.iconSizePx=null,t(o)},getPopupContainer:O,options:Q})}),qe(vr,{label:p("icon_color"),children:qe(x,{className:"width-full ee-stack-control",value:Y,onChange:n=>{const o=rt(n),l=xt(e);l.iconColor=o,l.iconColorHex=null,t(l)},getPopupContainer:O,options:ne})}),qe(vr,{layout:"toggle",label:p("show_text_label"),children:qe(pr,{checked:Z,onChange:n=>{const o=xt(e);o.showTextLabel=n,t(o)}})}),qe(vr,{label:p("social_icon_spacing"),children:qe(k,{min:0,max:96,className:"input-width ee-settings-input-affix",addonAfter:"px",value:G,onFocus:e=>e?.target?.select?.(),onChange:o=>(o=>{const l="number"==typeof o&&Number.isFinite(o)&&o>=0?Math.min(96,o):8,a=xt(e);a.contentStyles||(a.contentStyles={desktop:{},mobile:{}}),a.contentStyles[n]={...a.contentStyles[n]||{},columnGapPx:l},t(a)})(o)})}),qe(vr,{label:p("align"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:j,onChange:o=>(o=>{const l=xt(e);l.contentStyles[n]={...l.contentStyles[n],textAlign:o},t(l)})(o),"aria-label":p("align"),items:[{value:"left",label:qe(B,{icon:he,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:qe(B,{icon:ye,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:qe(B,{icon:be,className:"tag-style-size"}),iconOnly:!0},{value:"justify",label:qe(B,{icon:fe,className:"tag-style-size"}),iconOnly:!0}]})}),u?null:Je(Ye,{children:[qe(_r,{className:"ee-social-settings-padding-heading ee-social-link-settings-subsection",children:p("padding_settings")}),qe(vr,{children:qe(mr,{padding:{paddingTop:s(e.contentStyles,"paddingTop"),paddingRight:s(e.contentStyles,"paddingRight"),paddingLeft:s(e.contentStyles,"paddingLeft"),paddingBottom:s(e.contentStyles,"paddingBottom")},setPadding:o=>{const l=xt(e);l.contentStyles||(l.contentStyles={desktop:{},mobile:{}}),l.contentStyles[n]||(l.contentStyles[n]={}),l.contentStyles[n]={...l.contentStyles[n],...o},t(l)}})})]})]})}const Ls=()=>{const{currentItem:e,previewMode:t,apiConfig:l,templateData:a}=n(Ln),{findStyleItem:i,updateItemStyles:r}=Rr(),s=o(e=>{r(e)},[r]);return qe(Ns,{blockNode:e.data,onUpdateBlock:s,previewMode:t,findStyleItem:i,apiConfig:l,templateData:a,embedded:!1})},{TextArea:Ts}=h;const Bs=()=>{const{currentItem:e,previewMode:t}=n(Ln),{t:o}=ja(),{findStyleItem:l,updateItemStyles:a}=Rr(),i=n=>{const o=xt(e.data);o.contentStyles||(o.contentStyles={desktop:{},mobile:{}}),o.contentStyles[t]={...o.contentStyles[t]??{},...n},a(o)},r=l(e.data.contentStyles,"textAlign"),s=["left","center","right","justify"].includes(r)?r:"center",c=function(e){if(null==e||""===e)return 100;if("number"==typeof e)return Math.min(100,Math.max(10,Math.round(e)));const t=String(e).trim().match(/^(\d+(?:\.\d+)?)%$/);return t?Math.min(100,Math.max(10,Math.round(Number(t[1])))):100}(l(e.data.contentStyles,"width")),d=l(e.data.contentStyles,"backgroundColor"),u=function(e){if(null==e)return 0;if("number"==typeof e&&Number.isFinite(e))return Math.min(48,Math.max(0,Math.round(e)));const t=String(e).trim().replace(/px$/i,""),n=Number.parseFloat(t);return Number.isFinite(n)?Math.min(48,Math.max(0,Math.round(n))):0}(l(e.data.contentStyles,"borderRadius"));return Je("div",{className:"margin-y-30 ee-settings-block-form ee-raw-html-settings",children:[qe(_r,{className:"ee-raw-html-heading-row",children:Je("span",{className:"ee-raw-html-title-left",children:[qe(B,{icon:le,className:"ee-raw-html-title-icon","aria-hidden":!0}),qe("span",{className:"ee-raw-html-block-heading-text",children:o("raw_html_block")}),qe(v,{title:o("raw_html_code_hint"),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,children:qe("span",{className:"ee-help-icon ee-raw-html-title-help",tabIndex:0,"aria-label":o("raw_html_info_tooltip_aria"),children:qe(B,{icon:A})})})]})}),qe("p",{className:"ee-raw-html-block-description",children:o("raw_html_block_description")}),qe(vr,{label:o("raw_html_code_label"),children:qe(Ts,{className:"ee-raw-html-code-textarea",value:e.data.html??"",onChange:t=>(t=>{const n=xt(e.data);n.html=t,a(n)})(t.target.value),autoSize:{minRows:10,maxRows:28},spellCheck:!1})}),qe(_r,{children:o("raw_html_appearance")}),qe(vr,{label:o("width"),children:qe(N,{min:10,max:100,value:c,tooltip:{formatter:e=>`${e}%`},onChange:e=>{i({width:`${e}%`})}})}),qe(vr,{label:o("align"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:s,onChange:e=>(e=>{i({textAlign:e})})(e),"aria-label":o("align"),items:[{value:"left",label:qe(B,{icon:he,className:"tag-style-size"}),iconOnly:!0},{value:"center",label:qe(B,{icon:ye,className:"tag-style-size"}),iconOnly:!0},{value:"right",label:qe(B,{icon:be,className:"tag-style-size"}),iconOnly:!0},{value:"justify",label:qe(B,{icon:fe,className:"tag-style-size"}),iconOnly:!0}]})}),qe(vr,{label:o("border_radius"),children:qe(k,{min:0,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:u,onFocus:e=>e?.target?.select?.(),onChange:n=>(n=>{const o="number"==typeof n&&Number.isFinite(n)?Math.min(48,Math.max(0,Math.round(n))):0;if(0===o){const n=xt(e.data);n.contentStyles||(n.contentStyles={desktop:{},mobile:{}});const o={...n.contentStyles[t]??{}};return delete o.borderRadius,n.contentStyles[t]=o,void a(n)}i({borderRadius:o})})("number"==typeof n?n:0)})}),qe(vr,{label:o("background_color"),children:Je("div",{className:"ee-raw-html-bg-row",children:[qe(cr,{color:d,setColor:({hex:e})=>{i({backgroundColor:e})},fallbackColor:"#ffffff"}),null!=d&&""!==String(d).trim()&&"transparent"!==String(d).toLowerCase()?qe(_,{type:"link",size:"small",onClick:()=>{const n=xt(e.data),o=n.contentStyles[t]||{},{backgroundColor:l,...i}=o;n.contentStyles[t]=i,a(n)},children:o("raw_html_clear_background")}):null]})}),qe(_r,{className:"ee-raw-html-settings-padding-heading",children:o("padding_settings")}),qe(vr,{children:qe(mr,{padding:{paddingTop:l(e.data.contentStyles,"paddingTop"),paddingRight:l(e.data.contentStyles,"paddingRight"),paddingLeft:l(e.data.contentStyles,"paddingLeft"),paddingBottom:l(e.data.contentStyles,"paddingBottom")},setPadding:e=>{i(e)}})}),Je("div",{className:"ee-raw-html-email-warning",role:"note",children:[qe(B,{icon:ke,className:"ee-raw-html-email-warning-icon","aria-hidden":!0}),qe("span",{children:o("raw_html_email_client_warning")})]})]})},As=[{value:"none",label:"None"},{value:"solid",label:"Solid"},{value:"dashed",label:"Dashed"},{value:"dotted",label:"Dotted"}],Is=()=>{const{currentItem:e,previewMode:t}=n(Ln),{t:o}=ja(),{findStyleItem:a,updateItemStyles:i}=Rr(),r=()=>document.querySelector(".right-settings")||document.body,s=t=>{const n=xt(e.data);Object.assign(n,t),i(n)},c=n=>{const o=xt(e.data);o.styles||(o.styles={desktop:{},mobile:{}}),o.styles[t]||(o.styles[t]={}),Object.assign(o.styles[t],n),i(o)},d=e.data.rows??3,u=e.data.cols??3,p=Boolean(e.data.headerRow),m=Boolean(e.data.headerCol),g=e.data.selectedCell??null,y=e.data.structureMode??"static",b=a(e.data.styles,"fontSize")??14,f=a(e.data.styles,"color")??"#333333",_=a(e.data.styles,"borderColor")??"#e0e0e0",v=a(e.data.styles,"borderStyle")??"solid",w=a(e.data.styles,"borderWidth")??1,S=a(e.data.styles,"cellPadding")??8,C=a(e.data.styles,"textAlign")??"left",N=a(e.data.styles,"headerBg")??"#f5f5f5",L=a(e.data.styles,"headerColor")??"#333333",T=Boolean(e.data.stripedRows),A=a(e.data.styles,"stripedBg")??"#fafafa",I="number"==typeof u?u:3,$="number"==typeof d?d:3,P=l(()=>g&&e.data.cells?e.data.cells[g]??null:null,[g,e.data.cells]),R="image"===P?.type?"image":"text",M=t=>{if(!g)return;const n={...e.data.cells||{}};n[g]={...n[g]||{},...t},s({cells:n})},D=Math.min($,8),U=Math.min(I,8),E=l(()=>{if("string"!=typeof g)return null;const e=g.match(/^(\d+)-(\d+)$/);return e?{row:Number(e[1])+1,col:Number(e[2])+1}:null},[g]),z=l(()=>[{value:"left",label:o("table_align_left")},{value:"center",label:o("table_align_center")},{value:"right",label:o("table_align_right")}],[o]);return Je("div",{className:"margin-y-30 ee-settings-block-form ee-table-settings",children:[qe(_r,{children:o("table_structure")}),qe(vr,{label:o("table_structure_mode"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:y,onChange:e=>s({structureMode:e}),"aria-label":o("table_structure_mode"),items:[{value:"static",label:o("table_mode_static")},{value:"dynamic",label:o("table_mode_dynamic")}]})}),"dynamic"===y?qe("div",{className:"ee-table-dynamic-hint",role:"note",children:o("table_dynamic_structure_hint")}):null,qe(vr,{label:o("rows"),children:qe(k,{min:1,max:20,className:"width-full ee-settings-input-affix ee-table-dimension-input",value:$,onFocus:e=>e?.target?.select?.(),onChange:e=>{const t="number"==typeof e&&Number.isFinite(e)?Math.round(e):null;null!=t&&s({rows:Math.min(20,Math.max(1,t))})}})}),qe(vr,{label:o("columns"),children:qe(k,{min:1,max:12,className:"width-full ee-settings-input-affix ee-table-dimension-input",value:I,onFocus:e=>e?.target?.select?.(),onChange:e=>{const t="number"==typeof e&&Number.isFinite(e)?Math.round(e):null;null!=t&&s({cols:Math.min(12,Math.max(1,t))})}})}),Je("div",{className:"ee-table-add-actions",children:[Je("button",{type:"button",className:"ee-table-add-btn menu-add-new-item",onClick:()=>s({rows:Math.min(20,$+1)}),disabled:$>=20,children:[qe("span",{className:"menu-add-new-item-icon",children:"+"})," ",o("table_add_row")]}),Je("button",{type:"button",className:"ee-table-add-btn menu-add-new-item",onClick:()=>s({cols:Math.min(12,I+1)}),disabled:I>=12,children:[qe("span",{className:"menu-add-new-item-icon",children:"+"})," ",o("table_add_column")]})]}),qe(vr,{layout:"toggle",label:o("header_row"),children:qe(pr,{checked:p,onChange:e=>s({headerRow:e})})}),qe(vr,{layout:"toggle",label:o("header_column"),children:qe(pr,{checked:m,onChange:e=>s({headerCol:e})})}),qe(_r,{className:"margin-top-12",children:o("cell_selector")}),Je("div",{className:"ee-table-cell-picker-wrap",children:[qe("div",{className:"ee-table-cell-picker-grid",style:{gridTemplateColumns:`repeat(${U}, minmax(0, 1fr))`},children:Array.from({length:D*U}).map((t,n)=>{const o=Math.floor(n/U),l=n%U,a=`${o}-${l}`,i=g===a;return Je("button",{type:"button",className:`ee-table-cell-picker-btn${i?" ee-table-cell-picker-btn--selected":""}${p&&0===o||m&&0===l?" ee-table-cell-picker-btn--header":""}`,onClick:()=>{if(i)return void s({selectedCell:null});const t={...e.data.cells||{}};t[a]||(t[a]={type:"text",text:""}),s({selectedCell:a,cells:t})},children:[o+1,",",l+1]},a)})}),$>D||I>U?qe("div",{className:"ee-table-cell-picker-caption",children:o("table_cell_grid_truncated",{rows:D,cols:U})}):null,qe("div",g&&E?{className:"ee-table-selected-label",children:o("table_selected_cell",{row:E.row,col:E.col})}:{className:"ee-table-selected-label ee-table-selected-label--muted",children:o("table_select_cell_hint")})]}),g?Je(Ye,{children:[qe(_r,{className:"margin-top-12",children:o("cell_content")}),qe(vr,{label:o("cell_content_type"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:R,onChange:e=>{M("image"===e?{type:"image",src:"",alt:""}:{type:"text",text:P?.text??""})},"aria-label":o("cell_content_type"),items:[{value:"text",icon:qe(B,{icon:ce,className:"tag-style-size"}),label:o("text")},{value:"image",icon:qe(B,{icon:O,className:"tag-style-size"}),label:o("image")}]})}),qe(vr,"text"===R?{label:o("content"),children:qe(h.TextArea,{className:"ee-table-cell-textarea",rows:4,value:P?.text??"",placeholder:o("table_cell_text_placeholder"),onChange:e=>M({text:e.target.value})})}:{label:o("image"),children:qe(h,{className:"width-full",value:P?.src??"",placeholder:"https://...",onChange:e=>M({src:e.target.value})})})]}):null,qe(_r,{className:"margin-top-12",children:o("table_style")}),qe(vr,{label:o("font_size"),children:qe(k,{min:8,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:"number"==typeof b?b:parseInt(String(b||"14"),10),onFocus:e=>e?.target?.select?.(),onChange:e=>c({fontSize:e??14})})}),qe(vr,{label:o("text_color"),children:qe(cr,{color:f,setColor:({hex:e})=>c({color:e})})}),qe(vr,{label:o("text_align"),children:qe(x,{className:"width-full",value:C,onChange:e=>c({textAlign:e}),getPopupContainer:r,options:z})}),qe(vr,{label:o("cell_padding"),children:qe(k,{min:0,max:40,className:"input-width ee-settings-input-affix",addonAfter:"px",value:"number"==typeof S?S:parseInt(String(S||"8"),10),onFocus:e=>e?.target?.select?.(),onChange:e=>c({cellPadding:e??8})})}),qe(_r,{className:"margin-top-12",children:o("border")}),qe(vr,{label:o("border_style"),children:qe(x,{className:"width-full",value:v,onChange:e=>c({borderStyle:e}),getPopupContainer:r,options:As})}),"none"!==v?Je(Ye,{children:[qe(vr,{label:o("border_width"),children:qe(k,{min:0,max:10,className:"input-width ee-settings-input-affix",addonAfter:"px",value:"number"==typeof w?w:parseInt(String(w||"1"),10),onFocus:e=>e?.target?.select?.(),onChange:e=>c({borderWidth:e??1})})}),qe(vr,{label:o("border_color"),children:qe(cr,{color:_,setColor:({hex:e})=>c({borderColor:e})})})]}):null,qe(_r,{className:"margin-top-12",children:o("header_style")}),qe(vr,{label:o("header_background"),children:qe(cr,{color:N,setColor:({hex:e})=>c({headerBg:e})})}),qe(vr,{label:o("header_text_color"),children:qe(cr,{color:L,setColor:({hex:e})=>c({headerColor:e})})}),qe(vr,{layout:"toggle",label:o("striped_rows"),children:qe(pr,{checked:T,onChange:e=>s({stripedRows:e})})}),T?qe(vr,{label:o("stripe_color"),children:qe(cr,{color:A,setColor:({hex:e})=>c({stripedBg:e})})}):null,qe(_r,{className:"ee-table-settings-padding-heading",children:o("padding_settings")}),qe(vr,{children:qe(mr,{padding:{paddingTop:a(e.data.contentStyles,"paddingTop"),paddingRight:a(e.data.contentStyles,"paddingRight"),paddingLeft:a(e.data.contentStyles,"paddingLeft"),paddingBottom:a(e.data.contentStyles,"paddingBottom")},setPadding:n=>(n=>{const o=xt(e.data);o.contentStyles||(o.contentStyles={desktop:{},mobile:{}}),o.contentStyles[t]={...o.contentStyles[t]??{},...n},i(o)})(n)})})]})},$s={logo:"logo",brand:"brand",tagline:"tagline",address:"address",unsubscribe:"unsubscribe",social:"social",secondary:"secondary",copyright:"copyright"};function Ps(e,t,n){return e?e.id===t?n(e):Array.isArray(e.children)?{...e,children:e.children.map(e=>Ps(e,t,n))}:e:e}function Rs(e,t,n=new Set){if(!e||n.has(e.id))return null;if(n.add(e.id),e.footerSlot===t)return e;if(Array.isArray(e.children))for(const o of e.children){const e=Rs(o,t,n);if(e)return e}return null}function Ms(e,t=new Set){if(!e||t.has(e.id))return null;if(t.add(e.id),"image"===e.key&&e.footerBannerSlot)return e;if("image"===e.key&&String(e.src||"").includes("FooterBanner"))return e;if(Array.isArray(e.children))for(const n of e.children){const e=Ms(n,t);if(e)return e}return null}function Ds(e,t=new Set){if(!e||t.has(e.id))return null;if(t.add(e.id),"divider"===e.key&&e.footerBannerDividerSlot)return e;if(Array.isArray(e.children))for(const n of e.children){const e=Ds(n,t);if(e)return e}return null}function Us(e){return String(e??"").replace(/<[^>]+>/g,"").trim()}function Es(e){const t=/<div[^>]*>([\s\S]*?)<\/div>/i.exec(e||"");return t?t[1].trim():Us(e)}function zs(e){return`<div style="text-align:center">${e}</div>`}function Fs(e,t,n){const o=n||"{{unsubscribe_url}}",l=t||"Unsubscribe";return`<div style="text-align:center">${null!=e&&""!==String(e).trim()?String(e).trim():kl} ${`<a href="${o}">${l}</a>`}</div>`}function Os(e){const t={bodyText:kl,unsubLabel:"Unsubscribe",unsubUrl:"{{unsubscribe_url}}"};if(!e)return t;if("text"===e.key)return{bodyText:e.unsubscribeBodyText??t.bodyText,unsubLabel:e.unsubscribeLinkLabel??t.unsubLabel,unsubUrl:e.unsubscribeUrl??t.unsubUrl};if("menu"===e.key&&Array.isArray(e.list)){const n=e.list[0]||{};return{bodyText:t.bodyText,unsubLabel:String(n.label??t.unsubLabel),unsubUrl:String(n.url??t.unsubUrl)}}return t}function Ws(e,t){return{id:e.id,name:e.name,key:"text",footerSlot:"unsubscribe",hidden:e.hidden,text:Fs(t.bodyText,t.unsubLabel,t.unsubUrl),unsubscribeBodyText:t.bodyText??kl,unsubscribeLinkLabel:t.unsubLabel||"Unsubscribe",unsubscribeUrl:t.unsubUrl||"{{unsubscribe_url}}",contentStyles:e.contentStyles||{desktop:{paddingTop:2,paddingBottom:2,paddingLeft:4,paddingRight:4,textAlign:"center"},mobile:{}},styles:e.styles?.desktop||e.styles?.mobile?e.styles:{desktop:{fontSize:12,fontFamily:"Arial, sans-serif",color:"#737373"},mobile:{}},isPreset:e.isPreset}}const js=[10,11,12,13,14,16];function Hs(){const{currentItem:e,templateData:t,previewMode:o,apiConfig:i}=n(Ln),{t:s}=ja(),{findStyleItem:c,updateItemStyles:d}=Rr(),[u,p]=a(null);r(()=>{p(null)},[e?.id]);const m=e.data,g=e=>u===e,y=(e,n)=>g(e)?n:bl(n??"",t),b=(e,n)=>g(e)?n:fl(n??"",t),f=l(()=>{const e={};for(const t of Object.values($s))e[t]=Rs(m,t);return e},[m.id,JSON.stringify(m.children)]),_=e=>{d(e)},v=(e,t)=>{const n=f[e];n?.id&&_(Ps(xt(m),n.id,t))},w=(e,t)=>{v(e,e=>({...e,hidden:!t}))},S=e=>{const t=f[e];return!!t&&!0!==t.hidden},C=f[$s.logo],N=f[$s.brand],L=f[$s.tagline],T=f[$s.address],A=f[$s.unsubscribe],I=f[$s.social],$=f[$s.secondary],P=f[$s.copyright];r(()=>{if(!A||"menu"!==A.key)return;const e=Os(A);v($s.unsubscribe,t=>"menu"===t.key?Ws(t,e):t)},[A?.key]);const R=S($s.logo),M=S($s.brand),D=S($s.tagline),U=S($s.address),E=S($s.unsubscribe),z=S($s.social),F=S($s.secondary),O=S($s.copyright),W=C?.src??"{{LogoUrl}}",j=l(()=>{const e="string"==typeof W?W.trim():String(W??""),n=e&&/^\{\{\w+\}\}$/.test(e)?e.replace(/\{\{|\}\}/g,"").trim():"",o=t&&n?$o(t,n,{}):null;return null==o||String(o).startsWith("{{")?yl(W,t)||W||"":String(o)},[W,t]),H=C?.alt??"Logo",K=C?.linkURL??"",V=String(C?.styles?.desktop?.width??"30%"),G=parseInt(V.replace("%",""),10)||30,q=C?.contentStyles?.desktop?.paddingTop??C?.contentStyles?.desktop?.paddingLeft??12,J=l(()=>Ms(m),[m.id,JSON.stringify(m.children)]),Y=!0===m.showFooterBanner,X=J?.src??"{{FooterBanner}}",Z=l(()=>{const e="string"==typeof X?X.trim():String(X??""),n=e&&/^\{\{\w+\}\}$/.test(e)?e.replace(/\{\{|\}\}/g,"").trim():"",o=t&&n?$o(t,n,{}):null;return null==o||String(o).startsWith("{{")?X||"":String(o)},[X,t]),Q=J?.alt??"",ee=J?.linkURL??"",te=function(e){const t=/<b>([\s\S]*?)<\/b>/i.exec(e||"");return t?t[1].trim():Us(e)}(N?.text??""),ne=Es(L?.text??""),oe=Es(T?.text??""),le=Es(P?.text??"");const ae=Os(A),ie=$?.list??[],re=c(m.styles,"color")??"#737373",se=c(m.styles,"linkColor"),ce=null!=se&&""!==String(se).trim()?String(se).trim():"",de=c(m.styles,"backgroundColor")??"transparent",ue=c(m.styles,"contentBackground")??"#ffffff",pe=c(m.styles,"fontSize")??12,me=c(m.styles,"textAlign")??"center",ge=c(m.styles,"paddingTop")??28,fe=c(m.styles,"paddingBottom")??28,_e=c(m.styles,"paddingLeft")??24,ke=c(m.styles,"paddingRight")??24,ve=l(()=>js.map(e=>({value:e,label:`${e}px`})),[]),we=e=>{const t=xt(m);t.styles||(t.styles={desktop:{},mobile:{}}),t.styles.desktop||(t.styles.desktop={}),Object.assign(t.styles.desktop,e),_(t)},xe=e=>{J?.id&&_(Ps(xt(m),J.id,e))},Se=e=>{v($s.secondary,t=>({...t,list:e,useNavigationLinks:!1}))},Ce=e=>{v($s.unsubscribe,t=>{const n={...Os(t),...e},o=Fs(n.bodyText,n.unsubLabel,n.unsubUrl);return"text"===t.key?{...t,text:o,unsubscribeBodyText:n.bodyText,unsubscribeLinkLabel:n.unsubLabel,unsubscribeUrl:n.unsubUrl}:Ws(t,n)})},Ne=(new Date).getFullYear();return Je("div",{className:"margin-y-30 ee-settings-block-form ee-footer-native-shell-settings",children:[qe(_r,{children:s("footer_visible_lines")}),qe(vr,{layout:"toggle",label:s("show_logo"),children:qe(pr,{checked:R,onChange:e=>w($s.logo,e)})}),qe(vr,{layout:"toggle",label:s("show_footer_banner"),children:qe(pr,{checked:Y,onChange:e=>{let t=xt(m);t.showFooterBanner=e,e&&!Ms(t)&&(t=function(e,t){const n=xt(e),o=function(e){const t=e.children?.find(e=>"content"===e.key);return t||e.children?.[0]}(n);if(!o?.children)return n;const l=!0===e.showFooterBanner,a={id:Nt(),name:t("image"),key:"image",footerBannerSlot:!0,src:"{{FooterBanner}}",alt:"",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:8,paddingBottom:8,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}},hidden:!l},i={id:Nt(),name:t("divider"),key:"divider",footerBannerDividerSlot:!0,hidden:!l,contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"100%",borderTopStyle:"solid",borderTopColor:"#ccc",borderTopWidth:1,display:"inline-block",verticalAlign:"middle"},mobile:{}}},r=[...o.children];return r.splice(0,0,a,i),{...n,children:(n.children||[]).map(e=>e.id===o.id?{...e,children:r}:e)}}(t,s));const n=Ms(t);n?.id&&(t=Ps(t,n.id,t=>({...t,hidden:!e})));const o=Ds(t);o?.id&&(t=Ps(t,o.id,t=>({...t,hidden:!e}))),_(t)}})}),qe(vr,{layout:"toggle",label:s("footer_toggle_brand_name"),children:qe(pr,{checked:M,onChange:e=>w($s.brand,e)})}),qe(vr,{layout:"toggle",label:s("footer_toggle_tagline"),children:qe(pr,{checked:D,onChange:e=>w($s.tagline,e)})}),qe(vr,{layout:"toggle",label:s("footer_toggle_address"),children:qe(pr,{checked:U,onChange:e=>w($s.address,e)})}),qe(vr,{layout:"toggle",label:s("footer_toggle_social_row"),children:qe(pr,{checked:z,onChange:e=>w($s.social,e)})}),qe(vr,{layout:"toggle",label:s("footer_toggle_secondary_links"),children:qe(pr,{checked:F,onChange:e=>w($s.secondary,e)})}),qe(vr,{layout:"toggle",label:s("footer_toggle_unsubscribe"),children:qe(pr,{checked:E,onChange:e=>w($s.unsubscribe,e)})}),qe(vr,{layout:"toggle",label:s("footer_toggle_copyright"),children:qe(pr,{checked:O,onChange:e=>w($s.copyright,e)})}),R&&C?Je(Ye,{children:[qe(_r,{className:"margin-top-12",children:s("logo_section")}),qe(vr,{label:s("image_url"),children:qe(h,{className:"width-full",value:g("logoSrc")?W:j,placeholder:s("placeholder_https"),onFocus:()=>p("logoSrc"),onBlur:()=>p(e=>"logoSrc"===e?null:e),onChange:e=>v($s.logo,t=>({...t,src:e.target.value}))})}),qe(vr,{label:s("logo_alt"),children:qe(h,{className:"width-full",value:y("logoAlt",H),placeholder:"Logo",onFocus:()=>p("logoAlt"),onBlur:()=>p(e=>"logoAlt"===e?null:e),onChange:e=>v($s.logo,t=>({...t,alt:e.target.value}))})}),qe(vr,{label:s("logo_link"),children:qe(h,{className:"width-full",value:b("logoLink",K),placeholder:s("link_url_placeholder"),onFocus:()=>p("logoLink"),onBlur:()=>p(e=>"logoLink"===e?null:e),onChange:e=>v($s.logo,t=>({...t,linkURL:e.target.value,linkEnabled:Boolean(e.target.value)}))})}),qe(vr,{label:s("logo_max_width"),children:qe(k,{min:10,max:100,className:"input-width ee-settings-input-affix",addonAfter:"%",value:G,onFocus:e=>e?.target?.select?.(),onChange:e=>v($s.logo,t=>({...t,styles:{...t.styles,desktop:{...t.styles?.desktop,width:`${e||30}%`}}}))})}),qe(vr,{label:s("logo_padding"),children:qe(k,{min:0,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:"number"==typeof q?q:12,onFocus:e=>e?.target?.select?.(),onChange:e=>v($s.logo,t=>({...t,contentStyles:{...t.contentStyles,desktop:{...t.contentStyles?.desktop,paddingTop:e??12,paddingBottom:e??12,paddingLeft:e??12,paddingRight:e??12}}}))})})]}):null,Y&&J?Je(Ye,{children:[qe(_r,{className:"margin-top-12",children:s("footer_banner_section")}),qe(vr,{label:s("image_url"),children:qe(h,{className:"width-full",value:g("footerBannerSrc")?X:Z,placeholder:s("placeholder_https"),onFocus:()=>p("footerBannerSrc"),onBlur:()=>p(e=>"footerBannerSrc"===e?null:e),onChange:e=>xe(t=>({...t,src:e.target.value}))})}),qe(vr,{label:s("image_alt"),children:qe(h,{className:"width-full",value:y("footerBannerAlt",Q),placeholder:s("image_alt_placeholder"),onFocus:()=>p("footerBannerAlt"),onBlur:()=>p(e=>"footerBannerAlt"===e?null:e),onChange:e=>xe(t=>({...t,alt:e.target.value}))})}),qe(vr,{label:s("link_url"),children:qe(h,{className:"width-full",value:b("footerBannerLink",ee),placeholder:s("link_url_placeholder"),onFocus:()=>p("footerBannerLink"),onBlur:()=>p(e=>"footerBannerLink"===e?null:e),onChange:e=>xe(t=>({...t,linkURL:e.target.value,linkEnabled:Boolean(e.target.value)}))})})]}):null,qe(_r,{className:"margin-top-12",children:s("footer_content_heading")}),M&&N?qe(vr,{label:s("footer_label_brand"),children:qe(h,{className:"width-full",value:y("brandName",te),placeholder:s("footer_brand_name_placeholder"),onFocus:()=>p("brandName"),onBlur:()=>p(e=>"brandName"===e?null:e),onChange:e=>v($s.brand,t=>{return{...t,text:(n=e.target.value,`<div style="text-align:center"><b>${n}</b></div>`)};var n})})}):null,D&&L?qe(vr,{label:s("brand_tagline"),children:qe(h,{className:"width-full",value:y("tagline",ne),placeholder:s("footer_brand_tagline_placeholder"),onFocus:()=>p("tagline"),onBlur:()=>p(e=>"tagline"===e?null:e),onChange:e=>v($s.tagline,t=>({...t,text:zs(e.target.value)}))})}):null,U&&T?qe(vr,{label:s("address"),children:qe(h.TextArea,{className:"width-full",value:y("address",oe),rows:2,placeholder:s("footer_address_placeholder"),onFocus:()=>p("address"),onBlur:()=>p(e=>"address"===e?null:e),onChange:e=>v($s.address,t=>({...t,text:zs(e.target.value)}))})}):null,z&&I?Je(Ye,{children:[qe(_r,{className:"margin-top-12",children:s("footer_social_platforms_heading")}),qe(Ns,{blockNode:I,onUpdateBlock:e=>v($s.social,()=>e),previewMode:o,findStyleItem:c,apiConfig:i,templateData:t,embedded:!0},I.id)]}):null,F&&$?Je(Ye,{children:[qe(_r,{className:"margin-top-12",children:s("footer_secondary_links_heading")}),Je("div",{className:"margin-top-12 ee-settings-stack-flat",children:[ie.map((e,t)=>Je("div",{className:"margin-bottom-12",children:[qe(vr,{label:`${s("footer_secondary_link_text")} ${t+1}`,children:qe(h,{className:"width-full",value:e.label||"",onChange:e=>{const n=[...ie];n[t]={...n[t],label:e.target.value},Se(n)}})}),qe(vr,{label:s("footer_secondary_link_url"),children:qe(h,{className:"width-full",value:e.url||"",onChange:e=>{const n=[...ie];n[t]={...n[t],url:e.target.value},Se(n)}})})]},`${e.label}-${t}`)),Je("button",{type:"button",className:"menu-add-new-item",onClick:()=>Se([...ie,{label:s("footer_new_link_label"),url:"#",target:"_self"}]),children:[qe("span",{className:"menu-add-new-item-icon",children:"+"})," ",s("footer_add_link")]})]})]}):null,E&&A?Je(Ye,{children:[qe(_r,{className:"margin-top-12",children:s("footer_toggle_unsubscribe")}),qe(vr,{label:s("footer_unsubscribe_body_text"),children:qe(h,{className:"width-full",value:y("bodyText",ae.bodyText),placeholder:kl,onFocus:()=>p("bodyText"),onBlur:()=>p(e=>"bodyText"===e?null:e),onChange:e=>Ce({bodyText:e.target.value})})}),qe(vr,{label:s("footer_unsubscribe_link_label"),children:qe(h,{className:"width-full",value:y("unsubLabel",ae.unsubLabel),onFocus:()=>p("unsubLabel"),onBlur:()=>p(e=>"unsubLabel"===e?null:e),onChange:e=>Ce({unsubLabel:e.target.value})})}),qe(vr,{label:s("unsubscribe_url"),children:qe(h,{className:"width-full",value:b("unsubUrl",ae.unsubUrl),placeholder:s("footer_unsubscribe_url_placeholder"),onFocus:()=>p("unsubUrl"),onBlur:()=>p(e=>"unsubUrl"===e?null:e),onChange:e=>Ce({unsubUrl:e.target.value})})})]}):null,O&&P?qe(vr,{label:s("copyright_text"),children:qe(h,{className:"width-full",value:y("copyright",le),placeholder:s("footer_copyright_placeholder",{year:Ne}),onFocus:()=>p("copyright"),onBlur:()=>p(e=>"copyright"===e?null:e),onChange:e=>v($s.copyright,t=>{return{...t,text:(n=e.target.value,`<div style="text-align:center;font-size:11px;opacity:0.9">${n}</div>`)};var n})})}):null,qe(_r,{className:"margin-top-12",children:s("footer_style_heading")}),qe(vr,{label:s("footer_text_color"),children:qe(cr,{color:re,setColor:({hex:e})=>we({color:e})})}),qe(vr,{label:s("footer_link_color"),children:qe(cr,{color:ce||re,setColor:({hex:e})=>we({linkColor:e})})}),qe(vr,{label:s("footer_background_content"),children:qe(cr,{color:ue,setColor:({hex:e})=>we({contentBackground:e||"#ffffff"})})}),qe(vr,{label:s("footer_column_background"),children:qe(cr,{color:de,setColor:({hex:e})=>we({backgroundColor:e||"transparent"})})}),qe(vr,{label:s("font_size"),children:qe(x,{className:"width-full ee-stack-control",value:"number"==typeof pe?pe:parseInt(String(pe||"12"),10),onChange:e=>we({fontSize:e}),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,options:ve})}),qe(vr,{label:s("footer_align"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:me,onChange:e=>we({textAlign:e}),"aria-label":s("footer_align"),items:[{value:"left",label:qe(B,{icon:he})},{value:"center",label:qe(B,{icon:ye})},{value:"right",label:qe(B,{icon:be})}]})}),qe(vr,{label:s("label_padding"),children:qe(mr,{padding:{paddingTop:ge,paddingBottom:fe,paddingLeft:_e,paddingRight:ke},setPadding:we})})]})}const Ks=[10,11,12,13,14,16],Vs="__ee_footer_social_custom__",Gs=[{value:"instagram",image:pt("instagram"),labelKey:"footer_social_instagram",title:"Instagram"},{value:"facebook",image:pt("facebook"),labelKey:"footer_social_facebook",title:"Facebook"},{value:"twitter",image:pt("x"),labelKey:"footer_social_twitter",title:"Twitter"},{value:"linkedin",image:pt("linkedin"),labelKey:"footer_social_linkedin",title:"LinkedIn"},{value:"youtube",image:pt("youtube"),labelKey:"footer_social_youtube",title:"YouTube"},{value:"tiktok",image:pt("tiktok"),labelKey:"footer_social_tiktok",title:"TikTok"}];function qs(e){const t=String(e?.image||"").toLowerCase(),n=Gs.find(e=>String(e.image).toLowerCase()===t);return n?n.value:t.includes("brand-instagram")||t.includes("tc-instagram")?"instagram":t.includes("brand-facebook")||t.includes("tc-facebook")?"facebook":t.includes("brand-x")||t.includes("tc-x")?"twitter":t.includes("brand-linkedin")||t.includes("tc-linkedin")?"linkedin":t.includes("brand-youtube")||t.includes("tc-youtube")?"youtube":t.includes("brand-tiktok")||t.includes("tc-tiktok")?"tiktok":"custom"}const Js={facebook:"social_link_placeholder_facebook",linkedin:"social_link_placeholder_linkedin",instagram:"social_link_placeholder_instagram",tiktok:"social_link_placeholder_tiktok",youtube:"social_link_placeholder_youtube"};function Ys(e,t){if(at(e))return t("social_link_placeholder_x");const n=String(e?.title||"").trim().toLowerCase(),o=Js[n];return t(o||"social_link_placeholder_generic")}function Xs({preset:e,t:t}){const n={image:e.image,title:e.title},{src:o,style:l}=vt(n,"default",22);return Je("span",{className:"ee-social-add-menu-item",children:[o?qe("img",{src:o,alt:"",className:"ee-social-add-menu-icon",style:l,draggable:!1}):null,qe("span",{children:t(e.labelKey)})]})}const Zs=()=>{const{currentItem:e,apiConfig:t,templateData:s}=n(Ln),{t:c}=ja(),{findStyleItem:d,updateItemStyles:u}=Rr(),p=i(null),m=i(null),g=i(null),[y,b]=a(null),[f,_]=a(!1),[v,w]=a(null),[C,N]=a(!1),[T,A]=a(null),[I,$]=a(!1),[P,R]=a(null),[M,D]=a({}),[U,E]=a(null);r(()=>{E(null)},[e?.id]);const{uploadImageFile:z,isConfigured:F}=Hr({imageUploadEndpoint:t?.imageUploadEndpoint,headers:t?.headers||{},companyId:t?.companyId,imageUploadQueryParams:t?.imageUploadQueryParams,imageUploadCompanyField:t?.imageUploadCompanyField}),O=()=>document.querySelector(".right-settings")||document.body,W=l(()=>Ks.map(e=>({value:e,label:`${e}px`})),[]),j=t=>{const n=xt(e.data);Object.assign(n,t),"footer"===n.containerType&&Object.prototype.hasOwnProperty.call(t,"footerSocialList")&&(n.footerUseCompanySocial=!1),u(n)},H=t=>{const n=xt(e.data);n.styles||(n.styles={desktop:{},mobile:{}}),n.styles.desktop||(n.styles.desktop={}),Object.assign(n.styles.desktop,t),u(n)};r(()=>{const t=e?.data;if(!t||"footer"!==t.containerType||!t.footerUnifiedLayout)return;if(!s)return;const n=function(e,t){if(!t||!e)return{};const n={},o=t.companyContext||{},l=t.brandContext||{};if(hl(e.brandName)&&null!=o.name&&""!==String(o.name).trim()&&(n.brandName=String(o.name).trim()),hl(e.address)&&null!=o.address&&""!==String(o.address).trim()&&(n.address=String(o.address).trim()),hl(e.brandTagline)&&null!=l.tagline&&""!==String(l.tagline).trim()&&(n.brandTagline=String(l.tagline).trim()),hl(e.footerLogoSrc)&&null!=l.logo_url&&""!==String(l.logo_url).trim()&&(n.footerLogoSrc=String(l.logo_url).trim()),hl(e.footerLogoLink)&&null!=o.website&&""!==String(o.website).trim()&&(n.footerLogoLink=String(o.website).trim()),hl(e.footerLogoAlt)&&null!=o.name&&""!==String(o.name).trim()&&(n.footerLogoAlt=String(o.name).trim()),hl(e.copyrightText)&&null!=o.name&&""!==String(o.name).trim()){const e=(new Date).getFullYear();n.copyrightText=`© ${e} ${String(o.name).trim()}`}return n}(t,s);if(0===Object.keys(n).length)return;const o=xt(t);Object.assign(o,n),o.footerUnifiedLayout=!0,u(o)},[e?.data,s,u]);const G=Boolean(e.data.showBrand??!0),q=Boolean(e.data.showTagline??!0),Y=Boolean(e.data.footerShowLogo??!1),X=e.data.footerLogoSrc??"",Z=e.data.footerLogoAlt??"Logo",Q=e.data.footerLogoLink??"",ee="number"==typeof e.data.footerLogoMaxWidthPercent?e.data.footerLogoMaxWidthPercent:parseInt(String(e.data.footerLogoMaxWidthPercent??"30"),10)||30,te="number"==typeof e.data.footerLogoPaddingPx?e.data.footerLogoPaddingPx:parseInt(String(e.data.footerLogoPaddingPx??"24"),10)||24,ne=l(()=>yl(X,s),[X,s]),oe=e=>U===e,le=(e,t)=>oe(e)?t:bl(t??"",s),ae=Boolean(e.data.showAddress??!0),ie=Boolean(e.data.showUnsubscribe??!0),re=Boolean(e.data.showSocial??!1),se=Boolean(e.data.showSecondaryLinks??!1),ce=Boolean(e.data.showCopyright??!0),de=e.data.footerSelectedSegment??null,ue=e.data.brandName??"",pe=e.data.brandTagline??"",me=e.data.address??"",ge=vl(e.data),fe=null!=e.data.unsubscribeLinkLabel?String(e.data.unsubscribeLinkLabel):ge.unsubscribeLinkLabel,ke=e.data.unsubscribeBodyText??"",ve=e.data.unsubscribeUrl??"",we=e.data.copyrightText??"",xe=xl(e.data.secondaryLinks),Se=wl(e.data.footerSocialList);r(()=>{null!=v&&v>=Se.length&&w(Se.length?Se.length-1:null)},[v,Se.length]),r(()=>{de&&requestAnimationFrame(()=>{document.getElementById(`ee-footer-settings-segment-${de}`)?.scrollIntoView?.({block:"nearest",behavior:"smooth"})})},[de,e?.id]);const Ce=e.data.styles?.desktop??{},Ne=d(e.data.styles,"color")??"#737373",Le=d(e.data.styles,"linkColor"),Te=null!=Le&&""!==String(Le).trim()?String(Le).trim():"",Be=d(e.data.styles,"backgroundColor")??"transparent",Ae=gl(d(e.data.styles,"contentBackground")??""),Ie=d(e.data.styles,"fontSize")??12,$e=d(e.data.styles,"textAlign")??"center",Pe=d(e.data.styles,"paddingTop")??28,Re=d(e.data.styles,"paddingBottom")??28,Me=d(e.data.styles,"paddingLeft")??24,De=d(e.data.styles,"paddingRight")??24,Ue=Boolean(e.data.showDivider??!1),Ee=e.data.dividerColor??"#374151",ze=Boolean(e.data.showBorderTop??!1),Fe=e.data.borderTopColor??Ce.borderTopColor??"#e5e7eb",Oe="number"==typeof e.data.borderTopWidth?e.data.borderTopWidth:parseInt(String(e.data.borderTopWidth??"1"),10)||1,We=(new Date).getFullYear(),je=l(()=>Gs.map(e=>({value:e.value,label:c(e.labelKey)})),[c]),He=l(()=>[...je,{value:Vs,label:c("footer_social_custom_icon")}],[je,c]),Ke=l(()=>[{label:c("same_tab"),value:"_self"},{label:c("new_tab"),value:"_blank"}],[c]),Ve=e=>{const t=e.map(e=>({...e,id:e.id||Nt()}));j({secondaryLinks:xl(t)})},Ge=e=>{const t=e.map(e=>({...e,id:e.id||Nt()}));j({footerSocialList:wl(t)})},Xe=(e,t)=>{Ge(Se.map((n,o)=>o===e?{...n,...t,id:n.id||Nt()}:n))},Ze=(e,t,n)=>{const o=((e,t,n)=>{const o=String(e??"").trim(),l=`Footer link ${t+1}${n?` (${n})`:""} -> URL`,a=lt(o,!1,{allowMailtoTel:!0});return a?"empty"===a?`${l} is empty. Add a destination like 'https://example.com'.`:"blocked_scheme"===a?`${l} ('${o}') uses a blocked protocol. Use https://, http://, mailto:, or tel:.`:"duplicate_protocol"===a?`${l} ('${o}') repeats the protocol. Keep one protocol, e.g. 'https://example.com'.`:"missing_hostname_dot"===a?`${l} ('${o}') is missing a valid hostname. Use a full domain like 'https://example.com'.`:"invalid_protocol"===a?`${l} ('${o}') has an unsupported protocol. Use https://, http://, mailto:, or tel:.`:`${l} ('${o}') is invalid. Fix it to a valid URL like 'https://example.com'.`:""})(e,t,n);D(e=>{if(!o&&!e[t])return e;const n={...e};return o?n[t]=o:delete n[t],n})},Qe=o(St(e=>{e.preventDefault();const t=m.current,n=e.target?.closest?.(".social-link-item[data-index]");if(!n||!t?.contains(n))return;const o=Array.from(t.querySelectorAll(".social-link-item[data-index]")).indexOf(n);if(-1===o)return;const l=T,a=xt(Se);null==l||l===o||a.length<2||([a[o],a[l]]=[a[l],a[o]],A(o),Ge(a),w(e=>e===l?o:e===o?l:e))},50),[T,Se]),et=o(St(e=>{e.preventDefault();const t=g.current,n=e.target?.closest?.(".social-link-item[data-index]");if(!n||!t?.contains(n))return;const o=Array.from(t.querySelectorAll(".social-link-item[data-index]")).indexOf(n);if(-1===o)return;const l=P,a=xt(xe);null==l||l===o||a.length<2||([a[o],a[l]]=[a[l],a[o]],R(o),Ve(a))},50),[P,xe]),tt=new Set(Se.map(e=>qs(e)).filter(e=>"custom"!==e)),nt=[...Gs.filter(e=>!tt.has(e.value)).map(e=>({key:`footer-add-${e.value}`,label:qe(Xs,{preset:e,t:c}),onClick:()=>{const t=Se.length;Ge([...Se,{id:Nt(),image:e.image,title:e.title,linkURL:"",socialPlatformKey:e.value}]),w(t)}})),{key:"__footer_add_custom__",label:Je("span",{className:"ee-social-add-menu-item ee-social-add-menu-item--custom",children:[qe("span",{className:"menu-add-new-item-icon",children:"+"}),qe("span",{children:c("footer_social_custom_icon")})]}),onClick:()=>{const e=Se.length;Ge([...Se,{id:Nt(),image:"",title:"",linkURL:""}]),w(e)}}],ot=e=>za("ee-footer-settings-segment",de===e&&"ee-footer-settings-segment--focused");return e?.data?.footerUnifiedLayout?Je("div",{className:"margin-y-30 ee-settings-block-form",children:[qe(_r,{children:c("footer_visible_lines")}),qe(vr,{layout:"toggle",label:c("show_logo"),children:qe(pr,{checked:Y,onChange:e=>j({footerShowLogo:e})})}),qe(vr,{layout:"toggle",label:c("footer_toggle_brand_name"),children:qe(pr,{checked:G,onChange:e=>j({showBrand:e})})}),qe(vr,{layout:"toggle",label:c("footer_toggle_tagline"),children:qe(pr,{checked:q,onChange:e=>j({showTagline:e})})}),qe(vr,{layout:"toggle",label:c("footer_toggle_address"),children:qe(pr,{checked:ae,onChange:e=>j({showAddress:e})})}),qe(vr,{layout:"toggle",label:c("footer_toggle_unsubscribe"),children:qe(pr,{checked:ie,onChange:e=>j({showUnsubscribe:e})})}),qe(vr,{layout:"toggle",label:c("footer_toggle_social_row"),children:qe(pr,{checked:re,onChange:e=>j({showSocial:e})})}),qe(vr,{layout:"toggle",label:c("footer_toggle_secondary_links"),children:qe(pr,{checked:se,onChange:e=>j({showSecondaryLinks:e})})}),qe(vr,{layout:"toggle",label:c("footer_toggle_copyright"),children:qe(pr,{checked:ce,onChange:e=>j({showCopyright:e})})}),qe("div",{id:"ee-footer-settings-segment-logo",className:ot("logo"),children:Y?Je(Ye,{children:[qe(_r,{className:"margin-top-12",children:c("logo_section")}),qe(vr,{label:c("image_url"),children:qe(h,{className:"width-full",value:oe("logoSrc")?X:ne,placeholder:c("placeholder_https"),onFocus:()=>E("logoSrc"),onBlur:()=>E(e=>"logoSrc"===e?null:e),onChange:e=>j({footerLogoSrc:e.target.value})})}),qe(vr,{label:c("logo_alt"),children:qe(h,{className:"width-full",value:le("logoAlt",Z),placeholder:"Logo",onFocus:()=>E("logoAlt"),onBlur:()=>E(e=>"logoAlt"===e?null:e),onChange:e=>j({footerLogoAlt:e.target.value})})}),qe(vr,{label:c("logo_link"),children:qe(h,{className:"width-full",value:(it="logoLink",rt=Q,oe(it)?rt:fl(rt??"",s)),placeholder:c("link_url_placeholder"),onFocus:()=>E("logoLink"),onBlur:()=>E(e=>"logoLink"===e?null:e),onChange:e=>j({footerLogoLink:e.target.value})})}),qe(vr,{label:c("logo_max_width"),children:qe(k,{min:10,max:100,className:"input-width ee-settings-input-affix",addonAfter:"%",value:ee,onFocus:e=>e?.target?.select?.(),onChange:e=>j({footerLogoMaxWidthPercent:e??30})})}),qe(vr,{label:c("logo_padding"),children:qe(k,{min:0,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:te,onFocus:e=>e?.target?.select?.(),onChange:e=>j({footerLogoPaddingPx:e??24})})})]}):null}),qe(_r,{className:"margin-top-12",children:c("footer_content_heading")}),G?qe("div",{id:"ee-footer-settings-segment-brand",className:ot("brand"),children:qe(vr,{label:c("footer_label_brand"),children:qe(h,{className:"width-full",value:le("brandName",ue),placeholder:c("footer_brand_name_placeholder"),onFocus:()=>E("brandName"),onBlur:()=>E(e=>"brandName"===e?null:e),onChange:e=>j({brandName:e.target.value})})})}):null,q?qe("div",{id:"ee-footer-settings-segment-tagline",className:ot("tagline"),children:qe(vr,{label:c("brand_tagline"),children:qe(h,{className:"width-full",value:le("tagline",pe),placeholder:c("footer_brand_tagline_placeholder"),onFocus:()=>E("tagline"),onBlur:()=>E(e=>"tagline"===e?null:e),onChange:e=>j({brandTagline:e.target.value})})})}):null,ae?qe("div",{id:"ee-footer-settings-segment-address",className:ot("address"),children:qe(vr,{label:c("address"),children:qe(h.TextArea,{className:"width-full",value:le("address",me),rows:2,placeholder:c("footer_address_placeholder"),onFocus:()=>E("address"),onBlur:()=>E(e=>"address"===e?null:e),onChange:e=>j({address:e.target.value})})})}):null,ie?Je("div",{id:"ee-footer-settings-segment-unsubscribe",className:ot("unsubscribe"),children:[qe(vr,{label:c("footer_unsubscribe_body_text"),children:qe(h,{className:"width-full",value:ke,placeholder:kl,onChange:e=>j({unsubscribeBodyText:e.target.value})})}),qe(vr,{label:c("footer_unsubscribe_link_label"),children:qe(h,{className:"width-full",value:fe,placeholder:c("footer_default_unsubscribe_text"),onChange:e=>j({unsubscribeLinkLabel:e.target.value})})}),qe(vr,{label:c("unsubscribe_url"),children:qe(h,{className:"width-full",value:ve,placeholder:c("footer_unsubscribe_url_placeholder"),onChange:e=>j({unsubscribeUrl:e.target.value})})})]}):null,ce?qe("div",{id:"ee-footer-settings-segment-copyright",className:ot("copyright"),children:qe(vr,{label:c("copyright_text"),children:qe(h,{className:"width-full",value:le("copyright",we),placeholder:c("footer_copyright_placeholder",{year:We}),onFocus:()=>E("copyright"),onBlur:()=>E(e=>"copyright"===e?null:e),onChange:e=>j({copyrightText:e.target.value})})})}):null,se?Je("div",{id:"ee-footer-settings-segment-secondary",className:ot("secondary"),children:[qe(_r,{className:"margin-top-12",children:c("footer_secondary_links_heading")}),qe("div",{ref:g,onDragOver:et,className:"margin-top-12",children:xe.map((e,t)=>qe("div",{"data-index":t,draggable:!0,onDragStart:()=>{$(!0),R(t)},onDragEnd:e=>{e.currentTarget?.classList?.remove("social-link-item-current"),$(!1),R(null)},className:za("social-link-item","cursor-grab",I&&"social-link-item-drag_start",P===t?"social-link-item-current":"border-transparent"),children:Je("div",{className:"social-link-item-content ee-menu-item-content",children:[Je("div",{className:"ee-menu-item-header flex items-center justify-between margin-bottom-8",children:[Je("div",{className:"flex items-center ee-menu-item-drag-row",children:[qe("span",{className:"social-link-item-drag-handle ee-menu-item-drag-handle","aria-hidden":!0,children:qe(B,{icon:_e,className:"social-link-item-drag-handle-icon"})}),Je("span",{className:"font-semibold",children:[c("footer_secondary_link_text")," ",t+1]})]}),qe("div",{className:"social-link-item-icon social-link-item-icon-slate ee-menu-item-delete",role:"button",tabIndex:0,onClick:()=>{const e=xe.filter((e,n)=>n!==t);Ve(e.length?e:_l()),D(e=>{const n={...e};return delete n[t],n})},onKeyDown:e=>{if("Enter"===e.key||" "===e.key){e.preventDefault();const n=xe.filter((e,n)=>n!==t);Ve(n.length?n:_l())}},children:qe(B,{icon:J,className:"social-link-item-icon-svg social-link-item-icon-svg-deep"})})]}),Je("div",{className:"ee-menu-item-fields ee-settings-stack-flat",children:[qe(vr,{label:c("footer_secondary_link_text"),children:qe(h,{className:"width-full ee-menu-item-input",value:e.label||"",onChange:e=>Ve(xe.map((n,o)=>o===t?{...n,label:e.target.value}:n)),placeholder:c("footer_secondary_link_text")})}),Je(vr,{label:c("footer_secondary_link_url"),children:[qe(h,{className:"width-full ee-menu-item-input",value:e.url||"",status:M[t]?"error":"",onChange:n=>{const o=n.target.value;Ve(xe.map((e,n)=>n===t?{...e,url:o}:e)),M[t]&&Ze(o,t,e.label)},onBlur:n=>Ze(n.target.value,t,e.label),placeholder:c("link_url_placeholder")}),M[t]?qe("div",{className:"ee-field-error",role:"alert",children:M[t]}):null]}),qe(vr,{label:c("target"),children:qe(x,{className:"width-full ee-menu-item-input",value:e.target||"_self",onChange:e=>Ve(xe.map((n,o)=>o===t?{...n,target:e}:n)),getPopupContainer:O,options:Ke})})]})]})},e.id??`sec-${t}`))}),Je("button",{type:"button",className:"menu-add-new-item margin-top-12",onClick:()=>Ve([...xe,{id:Nt(),label:c("footer_new_link_label"),url:"#",target:"_self"}]),children:[qe("span",{className:"menu-add-new-item-icon",children:"+"})," ",c("footer_add_link")]})]}):null,re?Je("div",{id:"ee-footer-settings-segment-social",className:ot("social"),children:[qe(_r,{className:"margin-top-12",children:c("footer_social_platforms_heading")}),qe("input",{ref:p,type:"file",accept:Wr,className:"ee-image-upload-input-hidden",onChange:async e=>{const t=e.target.files?.[0];if(e.target.value="",null==t||null==y)return;const n=jr(t);if("type"!==n)if("size"!==n){if(!F)return S.error(c("image_upload_not_configured")),void b(null);_(!0);try{const e=await z(t);if(e){const t=[...Se],n=t[y];n&&(t[y]={...n,id:n.id||Nt(),image:ol(e)},Ge(t),S.success(c("image_uploaded")))}else S.error(c("image_upload_failed"))}catch(e){S.error(c("image_upload_error"))}finally{_(!1),b(null)}}else S.error(c("image_file_too_large"));else S.error(c("image_upload_invalid_type"))}}),qe("div",{ref:m,onDragOver:Qe,className:"ee-social-link-icons-list margin-top-12",children:Se.map((e,t)=>{const n=function(e){const t=String(e?.image||"").trim(),n=Gs.find(e=>String(e.image).trim()===t);if(n)return n;const o=qs(e);return o&&"custom"!==o?Gs.find(e=>e.value===o)??null:null}(e),o=at(e),l=!n,a=l&&!String(e.title||"").trim()?c("footer_social_custom_icon"):o?c("social_platform_x"):String(e.title||"").trim()?String(e.title||"").trim():c(n?n.labelKey:"footer_social_custom_icon"),i=l&&!String(e.title||"").trim()?c("footer_social_custom_icon"):o?c("social_platform_x_alt"):String(e.title||"").trim()||c(n?n.labelKey:"footer_social_custom_icon"),r=vt(e,"default",22),s=vt(e,"default",28),d=n?n.value:Vs,u=v===t;return qe("div",{"data-index":t,draggable:!0,onDragStart:()=>{N(!0),A(t)},onDragEnd:e=>{e.currentTarget?.classList?.remove("social-link-item-current"),N(!1),A(null)},className:za("social-link-item","cursor-grab",C&&"social-link-item-drag_start",T===t?"social-link-item-current":"border-transparent"),children:Je("div",{className:za("social-link-item-content","ee-menu-item-content","ee-social-link-row-shell"),children:[Je("div",{className:"ee-social-link-row-header",children:[qe("span",{className:"social-link-item-drag-handle","aria-hidden":!0,children:qe(B,{icon:_e,className:"social-link-item-drag-handle-icon"})}),r.src?qe("img",{src:r.src,alt:i,className:"social-link-item-img",style:r.style,draggable:!1}):qe("div",{className:"social-link-item-img ee-social-row-icon-placeholder","aria-hidden":!0}),qe("div",{className:"ee-social-link-row-header-main",children:Je("div",{className:"social-link-platform-title-wrap ee-social-link-row-title-wrap",children:[qe("div",{className:"font-semibold ee-social-link-row-primary-title",children:a}),o?qe("div",{className:"social-link-platform-former-name",children:c("social_platform_formerly_twitter")}):null]})}),Je("div",{className:"ee-social-link-row-tools",children:[qe("button",{type:"button",className:"ee-social-link-row-icon-btn","aria-expanded":u,"aria-label":c(u?"collapse":"expand"),onClick:e=>{e.stopPropagation(),(e=>{w(t=>t===e?null:e)})(t)},children:qe(B,{icon:u?K:V})}),qe("button",{type:"button",className:"ee-social-link-row-icon-btn ee-social-link-row-icon-btn-danger","aria-label":c("delete"),onClick:e=>{e.stopPropagation();const n=Se.filter((e,n)=>n!==t);Ge(n.length?n:$t([],{})),w(e=>e===t?null:null!=e&&e>t?e-1:e)},children:qe(B,{icon:J,className:"social-link-item-icon-svg"})})]})]}),u?Je("div",{className:"ee-social-link-row-detail",children:[qe(vr,{label:c("footer_platform_label"),children:qe(x,{className:"width-full ee-stack-control",value:d,options:He,getPopupContainer:O,onChange:e=>{e!==Vs?((e,t)=>{const n=Gs.find(e=>e.value===t),o=Se[e];if(!o)return;const l=[...Se];n&&(l[e]={...o,id:o.id||Nt(),image:n.image,title:n.title,socialPlatformKey:n.value}),Ge(l)})(t,e):Xe(t,{title:"",image:"",socialPlatformKey:void 0})}})}),qe(vr,{label:c("social_icon_label_field"),children:qe(h,{className:"width-full",value:e.title||"",placeholder:a,onChange:e=>Xe(t,{title:e.target.value})})}),qe(vr,{label:c("footer_social_profile_url"),children:qe(h,{className:"width-full",placeholder:Ys(e,c),value:e.linkURL||"",onChange:e=>Xe(t,{linkURL:e.target.value})})}),qe(vr,{label:c("social_custom_icon"),children:Je("div",{className:"ee-social-custom-icon-row",children:[qe("div",{className:"ee-social-custom-icon-preview",children:s.src?qe("img",{src:s.src,alt:"",style:s.style,draggable:!1}):qe("span",{className:"ee-social-custom-icon-preview-empty","aria-hidden":!0})}),qe("button",{type:"button",className:"menu-add-new-item ee-social-custom-upload-btn ee-footer-social-upload-btn",disabled:!F||f&&y===t,onClick:()=>{b(t),p.current?.click()},children:c(f&&y===t?"uploading":"footer_upload_icon")})]})})]}):null]})},e.id??`soc-${t}`)})}),qe(L,{overlayClassName:"ee-social-add-platform-dropdown",menu:{items:nt},trigger:["click"],getPopupContainer:O,children:Je("button",{type:"button",className:"menu-add-new-item margin-top-12",children:[qe("span",{className:"menu-add-new-item-icon",children:"+"})," ",c("footer_add_platform")]})})]}):null,qe(_r,{className:"margin-top-12",children:c("footer_style_heading")}),qe(vr,{label:c("footer_text_color"),children:qe(cr,{color:Ne,setColor:({hex:e})=>H({color:e})})}),qe(vr,{label:c("footer_link_color"),children:qe(cr,{color:Te||Ne,setColor:({hex:e})=>H({linkColor:e})})}),qe(vr,{label:c("footer_background_content"),children:qe(cr,{color:Ae,setColor:({hex:e})=>H({contentBackground:e||"#ffffff"})})}),qe(vr,{label:c("footer_column_background"),children:qe(cr,{color:Be,setColor:({hex:e})=>H({backgroundColor:e||"transparent"})})}),qe(vr,{label:c("font_size"),children:qe(x,{className:"width-full ee-stack-control",value:"number"==typeof Ie?Ie:parseInt(String(Ie||"12"),10),style:{width:"100%"},onChange:e=>H({fontSize:e}),getPopupContainer:O,options:W})}),qe(vr,{label:c("footer_align"),children:qe(Cr,{size:"sm",className:"ee-settings-segmented--stretch",value:$e,onChange:e=>H({textAlign:e}),"aria-label":c("footer_align"),items:[{value:"left",label:qe(B,{icon:he})},{value:"center",label:qe(B,{icon:ye})},{value:"right",label:qe(B,{icon:be})}]})}),qe(_r,{className:"margin-top-12",children:c("footer_border_heading")}),Je("div",{id:"ee-footer-settings-segment-divider",className:ot("divider"),children:[qe(vr,{layout:"toggle",label:c("footer_divider_above"),children:qe(pr,{checked:Ue,onChange:e=>j({showDivider:e})})}),Ue?qe(vr,{label:c("divider_color"),children:qe(cr,{color:Ee,setColor:({hex:e})=>j({dividerColor:e})})}):null]}),qe(vr,{layout:"toggle",label:c("footer_border_top"),children:qe(pr,{checked:ze,onChange:e=>j({showBorderTop:e})})}),ze?Je(Ye,{children:[qe(vr,{label:c("footer_border_top_color"),children:qe(cr,{color:Fe,setColor:({hex:e})=>j({borderTopColor:e})})}),qe(vr,{label:c("border_width"),children:qe(k,{min:1,max:8,className:"input-width ee-settings-input-affix",addonAfter:"px",value:Oe,onFocus:e=>e?.target?.select?.(),onChange:e=>j({borderTopWidth:e??1})})})]}):null,qe(vr,{label:c("label_padding"),children:qe(mr,{padding:{paddingTop:Pe,paddingBottom:Re,paddingLeft:Me,paddingRight:De},setPadding:e=>H({...e})})})]}):qe(Hs,{});var it,rt};function Qs(e,t,n=new Set){if(!e||n.has(e.id))return null;if(n.add(e.id),e.key===t)return e;if(Array.isArray(e.children))for(const o of e.children){const e=Qs(o,t,n);if(e)return e}return null}function ec(e,t,n=new Set){if(!e||n.has(e.id))return null;if(n.add(e.id),"image"===e.key&&String(e.src||"").includes(t))return e;if(Array.isArray(e.children))for(const o of e.children){const e=ec(o,t,n);if(e)return e}return null}function tc(e,t=new Set){if(!e||t.has(e.id))return null;if(t.add(e.id),"image"===e.key&&e.headerBannerSlot)return e;if("image"===e.key&&String(e.src||"").includes("HeroBanner"))return e;if(Array.isArray(e.children))for(const n of e.children){const e=tc(n,t);if(e)return e}return null}function nc(e,t=new Set){if(!e||t.has(e.id))return null;if(t.add(e.id),"divider"===e.key&&e.headerBannerDividerSlot)return e;if(Array.isArray(e.children))for(const n of e.children){const e=nc(n,t);if(e)return e}return null}function oc(e){const t=ec(e,"LogoUrl");if(t)return t;let n=null;return function e(t){if(t&&!n)if("image"!==t.key){if(Array.isArray(t.children))for(const n of t.children)e(n)}else n=t}(e),n}function lc(e,t,n){return e?e.id===t?n(e):Array.isArray(e.children)?{...e,children:e.children.map(e=>lc(e,t,n))}:e:e}function ac(e,t,n,o){const l=t?xt(t):{id:Nt(),name:"Image",key:"image",src:"{{LogoUrl}}",alt:"Logo",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:12,paddingBottom:12,paddingLeft:12,paddingRight:12,textAlign:"left"},mobile:{}},styles:{desktop:{width:"50%"},mobile:{}}},a=n?xt(n):{id:Nt(),name:"Menu",key:"menu",useNavigationLinks:!0,list:Pt.map(e=>({...e})),separator:" | ",contentStyles:{desktop:{paddingTop:16,paddingBottom:16,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}},styles:{desktop:{fontSize:13,fontFamily:"sans-serif",color:"#525252",linkColor:"#525252",letterSpacing:.02,fontWeight:"500",textTransform:"uppercase"},mobile:{}},isPreset:!0},i={paddingTop:20,paddingBottom:16},r=(e,t,n,o)=>({id:Nt(),name:"Content",key:"content",width:t||"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:e.map(e=>"image"===e.key?{...e,id:Nt(),contentStyles:{...e.contentStyles,desktop:{...e.contentStyles?.desktop,textAlign:n||"left",...o||{}}}}:"menu"===e.key?{...e,id:Nt(),contentStyles:{...e.contentStyles,desktop:{...e.contentStyles?.desktop,textAlign:n||"center",...o||{}}}}:{...e,id:Nt()})});let s;switch(e){case"logo_left_nav_right":default:s=[r([l],"50%","left"),r([a],"50%","right",i)];break;case"logo_right_nav_left":s=[r([a],"50%","left",i),r([l],"50%","right")];break;case"logo_center_nav_below":s=[r([l,a],"100%","center")];break;case"logo_only":s=[r([l],"100%","center")];break;case"nav_only":s=[r([a],"100%","center")]}return(e=>{if(!o||!o.banner&&!o.divider)return e;const t=[o.banner,o.divider].filter(Boolean).map(e=>xt(e));return[...e,r(t,"100%","center")]})(s)}const ic=()=>{const{blockMap:e,rootOrder:t,setBlocks:o,currentItem:a,setCurrentItem:i,templateData:r}=n(Ln),{t:s}=ja(),{findStyleItem:c}=Rr(),d=a.data,u=n=>{const{blockMap:l}=jt([n]),r={...e,...l};o(r,t,`edit_${Date.now()}`),i({...a,data:n})},p=l(()=>oc(d),[d.id,JSON.stringify(d.children)]),m=l(()=>Qs(d,"menu"),[d.id,JSON.stringify(d.children)]),g=l(()=>tc(d),[d.id,JSON.stringify(d.children)]),y=l(()=>[{value:"logo_left_nav_right",label:s("header_layout_logo_left_nav_right")},{value:"logo_right_nav_left",label:s("header_layout_logo_right_nav_left")},{value:"logo_center_nav_below",label:s("header_layout_logo_center_nav_below")},{value:"logo_only",label:s("header_layout_logo_only")},{value:"nav_only",label:s("header_layout_nav_only")}],[s]),b=l(()=>[{value:"400",label:s("font_weight_regular")},{value:"500",label:s("font_weight_medium")},{value:"600",label:s("font_weight_semibold")},{value:"700",label:s("font_weight_bold")}],[s]),f=l(()=>[{value:"none",label:s("nav_text_transform_sentence")},{value:"uppercase",label:s("nav_text_transform_uppercase")},{value:"capitalize",label:s("nav_text_transform_capitalize")}],[s]),_=l(()=>[{value:"stack",label:s("stack")},{value:"inline",label:s("inline")}],[s]),v=d.headerLayout||"logo_center_nav_below",w=!1!==d.showLogo,S=!0===d.showHeaderBanner,C=p?.src??"{{LogoUrl}}",N=l(()=>{const e="string"==typeof C?C.trim():String(C??""),t=e&&/^\{\{\w+\}\}$/.test(e)?e.replace(/\{\{|\}\}/g,"").trim():"",n=r&&t?$o(r,t,{}):null;return null==n||String(n).startsWith("{{")?C||"":String(n)},[C,r]),L=g?.src??"{{HeroBanner}}",T=l(()=>{const e="string"==typeof L?L.trim():String(L??""),t=e&&/^\{\{\w+\}\}$/.test(e)?e.replace(/\{\{|\}\}/g,"").trim():"",n=r&&t?$o(r,t,{}):null;return null==n||String(n).startsWith("{{")?L||"":String(n)},[L,r]),B=p?.alt??"Logo",A=p?.linkURL??"",I=String(p?.styles?.desktop?.width??"50%"),$=parseInt(I.replace("%",""),10)||50,P=p?.contentStyles?.desktop?.paddingLeft??12,R=g?.alt??"",M=g?.linkURL??"",D=m?.list??[],U=m?.styles?.desktop?.linkColor??"#525252",E=m?.styles?.desktop?.fontSize??13,z=String(m?.styles?.desktop?.fontWeight??"500"),F=m?.styles?.desktop?.textTransform??"uppercase",O=m?.styles?.desktop?.letterSpacing??.02,W=m?.styles?.desktop?.paddingLeft??8,j=m?.linkUnderline??!1,H=c(d.styles,"contentBackground")??"#ffffff",K=d.showBorderBottom??!1,V=d.mobileLayout??"inline",G=c(d.styles,"paddingTop")??0,q=c(d.styles,"paddingRight")??0,J=c(d.styles,"paddingBottom")??0,Y=c(d.styles,"paddingLeft")??0,X=e=>{p&&u(lc(xt(d),p.id,e))},Z=e=>{g&&u(lc(xt(d),g.id,e))},Q=e=>{m&&u(lc(xt(d),m.id,t=>({...e(t),useNavigationLinks:!1})))},ee=e=>{Q(t=>({...t,styles:{...t.styles,desktop:{...t.styles?.desktop,...e}}}))},te=e=>{u({...xt(d),...e})},ne=e=>{const t=xt(d);t.styles||(t.styles={desktop:{},mobile:{}}),t.styles.desktop||(t.styles.desktop={}),Object.assign(t.styles.desktop,e),u(t)},oe=(e,t,n)=>{Q(o=>{const l=[...o.list||[]];return l[e]={...l[e],[t]:n},{...o,list:l}})},le=["logo_left_nav_right","logo_right_nav_left","logo_center_nav_below","logo_only"].includes(v),ae=["logo_left_nav_right","logo_right_nav_left","logo_center_nav_below","nav_only"].includes(v),ie=()=>document.querySelector(".right-settings")||document.body;return Je("div",{className:"margin-y-30 ee-settings-block-form",children:[qe(_r,{children:s("layout")}),qe(vr,{label:s("style"),children:qe(x,{className:"width-full ee-stack-control",value:v,onChange:e=>{const t=xt(d),n=oc(t),o=Qs(t,"menu"),l=function(e){const t=tc(e),n=nc(e);return t||n?{banner:t,divider:n}:null}(t);t.headerLayout=e,t.children=ac(e,n,o,l);const a=!1!==t.showLogo,i=oc(t);let r=t;i?.id&&(r=lc(r,i.id,e=>({...e,hidden:!a})));const s=!0===r.showHeaderBanner,c=tc(r);c?.id&&(r=lc(r,c.id,e=>({...e,hidden:!s})));const p=nc(r);p?.id&&(r=lc(r,p.id,e=>({...e,hidden:!s}))),u(r)},options:y,getPopupContainer:ie})}),le&&Je(Ye,{children:[qe(_r,{children:s("logo_section")}),qe(vr,{layout:"toggle",label:s("show_logo"),children:qe(pr,{checked:w,onChange:e=>{let t=xt(d);t.showLogo=e;const n=p?.id;n&&(t=lc(t,n,t=>({...t,hidden:!e}))),u(t)}})}),w&&Je(Ye,{children:[qe(vr,{label:s("image_url"),children:qe(h,{className:"width-full",value:N,placeholder:s("placeholder_https"),onChange:e=>X(t=>({...t,src:e.target.value}))})}),qe(vr,{label:s("logo_text"),children:qe(h,{className:"width-full",value:d.logoText??"",placeholder:s("brand_name_placeholder"),onChange:e=>te({logoText:e.target.value})})}),qe(vr,{label:s("logo_alt"),children:qe(h,{className:"width-full",value:B,onChange:e=>X(t=>({...t,alt:e.target.value}))})}),qe(vr,{label:s("logo_link"),children:qe(h,{className:"width-full",value:A,placeholder:s("link_url_placeholder"),onChange:e=>X(t=>({...t,linkURL:e.target.value,linkEnabled:Boolean(e.target.value)}))})}),qe(vr,{label:s("logo_max_width"),children:qe(k,{min:10,max:100,className:"input-width ee-settings-input-affix",addonAfter:"%",value:$,onFocus:e=>e?.target?.select?.(),onChange:e=>X(t=>({...t,styles:{...t.styles,desktop:{...t.styles?.desktop,width:`${e||50}%`}}}))})}),qe(vr,{label:s("logo_padding"),children:qe(k,{min:0,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:P,onFocus:e=>e?.target?.select?.(),onChange:e=>X(t=>({...t,contentStyles:{...t.contentStyles,desktop:{...t.contentStyles?.desktop,paddingTop:e??12,paddingBottom:e??12,paddingLeft:e??12,paddingRight:e??12}}}))})})]})]}),qe(_r,{className:"margin-top-12",children:s("header_banner_section")}),qe(vr,{layout:"toggle",label:s("show_header_banner"),children:qe(pr,{checked:S,onChange:e=>{let t=xt(d);t.showHeaderBanner=e,e&&!tc(t)&&(t=function(e,t){const n=xt(e),o={id:Nt(),name:t("image"),key:"image",headerBannerSlot:!0,src:"{{HeroBanner}}",alt:"",type:"link",linkEnabled:!1,linkURL:"",contentStyles:{desktop:{paddingTop:8,paddingBottom:8,paddingLeft:12,paddingRight:12,textAlign:"center"},mobile:{}},styles:{desktop:{width:"auto"},mobile:{}}},l={id:Nt(),name:t("divider"),key:"divider",headerBannerDividerSlot:!0,contentStyles:{desktop:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0,textAlign:"center"},mobile:{}},styles:{desktop:{width:"100%",borderTopStyle:"solid",borderTopColor:"#ccc",borderTopWidth:1,display:"inline-block",verticalAlign:"middle"},mobile:{}}},a=!0===e.showHeaderBanner;o.hidden=!a,l.hidden=!a;const i={id:Nt(),name:"Content",key:"content",width:"100%",styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[o,l]};return n.children=[...n.children||[],i],n}(t,s));const n=tc(t);n?.id&&(t=lc(t,n.id,t=>({...t,hidden:!e})));const o=nc(t);o?.id&&(t=lc(t,o.id,t=>({...t,hidden:!e}))),u(t)}})}),S&&g?Je(Ye,{children:[qe(vr,{label:s("image_url"),children:qe(h,{className:"width-full",value:T,placeholder:s("placeholder_https"),onChange:e=>Z(t=>({...t,src:e.target.value}))})}),qe(vr,{label:s("image_alt"),children:qe(h,{className:"width-full",value:R,placeholder:s("image_alt_placeholder"),onChange:e=>Z(t=>({...t,alt:e.target.value}))})}),qe(vr,{label:s("link_url"),children:qe(h,{className:"width-full",value:M,placeholder:s("link_url_placeholder"),onChange:e=>Z(t=>({...t,linkURL:e.target.value,linkEnabled:Boolean(e.target.value)}))})})]}):null,ae&&Je(Ye,{children:[qe(_r,{children:s("navigation")}),qe("div",{className:"margin-top-12",children:D.map((e,t)=>Je("div",{className:"ee-header-nav-link-row",children:[qe(h,{className:"ee-header-nav-link-input",value:e.label,placeholder:s("page"),onChange:e=>oe(t,"label",e.target.value)}),qe(h,{className:"ee-header-nav-link-input",value:e.url,placeholder:s("link_url_placeholder"),onChange:e=>oe(t,"url",e.target.value)}),qe("button",{type:"button",className:"ee-header-nav-remove-btn",onClick:()=>(e=>{Q(t=>({...t,list:(t.list||[]).filter((t,n)=>n!==e)}))})(t),"aria-label":s("tooltip_remove_link"),children:"×"})]},`header-nav-${t}-${e.label??""}`))}),Je("button",{type:"button",className:"ee-header-add-nav-link-btn",onClick:()=>{Q(e=>({...e,list:[...e.list||[],{label:s("default_nav_link_label"),url:"#",target:"_blank"}]}))},children:[qe("span",{className:"ee-header-add-nav-link-btn-icon",children:"+"}),s("add_link")]}),qe(_r,{className:"margin-top-18",children:s("link_style")}),qe(vr,{label:s("color"),children:qe(cr,{color:U,setColor:({hex:e})=>ee({linkColor:e,color:e})})}),qe(vr,{label:s("size"),children:qe(k,{min:10,max:24,className:"input-width ee-settings-input-affix",addonAfter:"px",value:E,onFocus:e=>e?.target?.select?.(),onChange:e=>ee({fontSize:e??13})})}),qe(vr,{label:s("weight"),children:qe(x,{className:"width-full ee-stack-control",value:z,onChange:e=>ee({fontWeight:e}),options:b,getPopupContainer:ie})}),qe(vr,{label:s("transform"),children:qe(x,{className:"width-full ee-stack-control",value:F,onChange:e=>ee({textTransform:e}),options:f,getPopupContainer:ie})}),qe(vr,{label:s("spacing"),children:qe(k,{min:0,max:1,step:.01,className:"input-width ee-settings-input-affix",addonAfter:"em",value:O,onFocus:e=>e?.target?.select?.(),onChange:e=>ee({letterSpacing:e??0})})}),qe(vr,{label:s("gap"),children:qe(k,{min:0,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:W,onFocus:e=>e?.target?.select?.(),onChange:e=>ee({paddingLeft:e??8,paddingRight:e??8})})}),qe(vr,{layout:"toggle",label:s("underline"),children:qe(pr,{checked:j,onChange:e=>Q(t=>({...t,linkUnderline:e}))})})]}),qe(_r,{children:s("container_settings")}),qe(vr,{label:s("background_color"),children:qe(cr,{color:H,setColor:({hex:e})=>ne({contentBackground:e})})}),qe(vr,{layout:"toggle",label:s("border_bottom"),children:qe(pr,{checked:K,onChange:e=>te({showBorderBottom:e})})}),qe(vr,{label:s("mobile_layout"),children:qe(x,{className:"width-full ee-stack-control",value:V,onChange:e=>te({mobileLayout:e}),options:_,getPopupContainer:ie})}),qe(vr,{label:s("label_padding"),children:qe(mr,{padding:{paddingTop:G,paddingRight:q,paddingBottom:J,paddingLeft:Y},setPadding:ne})})]})};function rc(e,t,n){return e?e.id===t?n(e):Array.isArray(e.children)?{...e,children:e.children.map(e=>rc(e,t,n))}:e:e}function sc({columnCurrentItem:e,textBlockId:t}){const o=n(Ln),a=e?.id,i=o.blockMap?.[t],r=l(()=>{if(!a||!t||!i||"text"!==i.key)return null;const n={id:i.id,data:i,type:"edit"};return{...o,currentItem:n,setCurrentItem:n=>{if(n?.id===t&&null!=n?.data){const l=rc(xt(e.data),t,()=>n.data),{blockMap:i}=jt([l]),r={...o.blockMap,...i};return o.setBlocks(r,o.rootOrder,`edit_${Date.now()}`),void o.setCurrentItem({...e,id:a,data:l})}o.setCurrentItem(n)}}},[o,e,a,i,t]);return r?qe(Ln.Provider,{value:r,children:qe(as,{embedded:!0})}):null}function cc(e,t=[]){if(!e)return t;if("text"===e.key&&t.push(e),Array.isArray(e.children))for(const n of e.children)cc(n,t);return t}function dc(e,t,n){return e?e.id===t?n(e):Array.isArray(e.children)?{...e,children:e.children.map(e=>dc(e,t,n))}:e:e}const uc=()=>{const{blockMap:e,rootOrder:t,setBlocks:o,currentItem:a,setCurrentItem:i}=n(Ln),{t:r}=ja(),{findStyleItem:s}=Rr(),c=l(()=>[{value:"400",label:r("font_weight_regular")},{value:"500",label:r("font_weight_medium")},{value:"600",label:r("font_weight_semibold")},{value:"700",label:r("font_weight_bold")}],[r]),d=l(()=>[{value:"dashed",label:r("dashed")},{value:"solid",label:r("solid")},{value:"dotted",label:r("dotted")},{value:"none",label:r("border_none")}],[r]),u=l(()=>[{value:"left",label:r("table_align_left")},{value:"center",label:r("table_align_center")},{value:"right",label:r("table_align_right")}],[r]),p=a.data,m=p.discountVariant??"card",g="card"===m,y=n=>{const{blockMap:l}=jt([n]),r={...e,...l};o(r,t,`edit_${Date.now()}`),i({...a,data:n})},b=e=>{y({...xt(p),...e})},f=e=>{const t=xt(p);t.styles||(t.styles={desktop:{},mobile:{}}),t.styles.desktop||(t.styles.desktop={}),Object.assign(t.styles.desktop,e),y(t)},_=(e,t)=>{y(dc(xt(p),e,t))},v=cc(p),w=g?v[0]??null:null,S=g?v[1]??null:null,C=g?null:v[0]?.id,N=p.showTitle??!0,L=p.discountTitle??"{{DiscountValue}} off your first order",T=p.titleSize??22,B=String(p.titleWeight??"600"),A=p.discountCode??"{{DiscountCode}}",I=p.codeSize??16,$=p.codeSpacing??.08,P=p.codeBorder??"dashed",R=p.codeBorderWidth??1.5,M=p.codeBg??"none",D=p.codeRadius??4,U=s(p.styles,"contentBackground")??(g?"#D8FE91":"#ffa7aa"),E=s(p.styles,"color")??"#171717",z=p.discountAlign??"center",F=p.discountGap??14,O=s(p.styles,"paddingTop")??28,W=s(p.styles,"paddingRight")??24,j=s(p.styles,"paddingBottom")??28,H=s(p.styles,"paddingLeft")??24,K=()=>document.querySelector(".right-settings")||document.body,V=(e,t,n,o={})=>{if(!w)return;const l=void 0!==o.textColor?o.textColor:E,a=void 0!==o.discountAlign?o.discountAlign:z,i=void 0!==o.discountGap?o.discountGap:F;_(w.id,o=>({...o,text:`<p style="text-align:center;margin:0 0 0px"><span style="font-family:Arial;font-size:${t}px;font-weight:${n};color:${l}">${e}</span></p>`,styles:{...o.styles,desktop:{...o.styles?.desktop,fontSize:t,fontWeight:n,textAlign:a,paddingBottom:i}}}))},G=(e,t,n,o,l,a,i={})=>{if(!S)return;const r=void 0!==i.textColor?i.textColor:E,s=void 0!==i.codeBg?i.codeBg:M,c="none"!==s&&""!==s&&s?s:"transparent",d=void 0!==i.discountAlign?i.discountAlign:z,u="none"===o?"none":o,p="none"!==o?r:"transparent";_(S.id,i=>({...i,text:`<p style="text-align:center;margin:0"><span style="font-family:Arial;font-size:${t}px;letter-spacing:${n}em;color:${r}">${e}</span></p>`,styles:{...i.styles,desktop:{...i.styles?.desktop,fontSize:t,letterSpacing:n,textAlign:d,borderTopStyle:u,borderBottomStyle:u,borderLeftStyle:u,borderRightStyle:u,borderTopColor:p,borderBottomColor:p,borderLeftColor:p,borderRightColor:p,borderTopWidth:"none"!==o?`${l}px`:"0px",borderBottomWidth:"none"!==o?`${l}px`:"0px",borderLeftWidth:"none"!==o?`${l}px`:"0px",borderRightWidth:"none"!==o?`${l}px`:"0px",borderRadius:`${a}px`,display:"block",width:"fit-content",maxWidth:"100%",marginLeft:"auto",marginRight:"auto",backgroundColor:c}}}))};return Je("div",{className:"margin-y-30 ee-settings-block-form",children:[qe(_r,{children:r("layout")}),qe(vr,{label:r("style"),children:qe(x,{className:"width-full ee-stack-control",value:m,onChange:e=>{const t="card"===e?"card":"simple";if(t===(p.discountVariant??"card"))return;const n=Er("card"===t?"preset_discount":"preset_discount_simple");if(!n)return;const o=xt(n);o.id=p.id,y(o)},options:[{value:"card",label:r("discount_variant_card")},{value:"simple",label:r("discount_variant_simple")}],getPopupContainer:K})}),!g&&C&&qe(sc,{columnCurrentItem:a,textBlockId:C}),g&&Je(Ye,{children:[qe(_r,{children:r("title")}),qe(vr,{layout:"toggle",label:r("discount_show_title"),children:qe(pr,{checked:N,onChange:e=>{b({showTitle:e}),w&&_(w.id,t=>({...t,hidden:!e}))}})}),N&&Je(Ye,{children:[qe(vr,{label:r("text"),children:qe(h,{className:"width-full",value:L,onChange:e=>{const t=e.target.value;b({discountTitle:t}),V(t,T,B)}})}),qe(vr,{label:r("size"),children:qe(k,{min:12,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:T,onFocus:e=>e?.target?.select?.(),onChange:e=>{b({titleSize:e??22}),V(L,e??22,B)}})}),qe(vr,{label:r("weight"),children:qe(x,{className:"width-full ee-stack-control",value:B,onChange:e=>{b({titleWeight:e}),V(L,T,e)},options:c,getPopupContainer:K})})]}),qe(_r,{children:r("discount_code_section")}),qe(vr,{label:r("text"),children:qe(h,{className:"width-full",value:A,onChange:e=>{const t=e.target.value;b({discountCode:t}),G(t,I,$,P,R,D)}})}),qe(vr,{label:r("size"),children:qe(k,{min:10,max:32,className:"input-width ee-settings-input-affix",addonAfter:"px",value:I,onFocus:e=>e?.target?.select?.(),onChange:e=>{b({codeSize:e??16}),G(A,e??16,$,P,R,D)}})}),qe(vr,{label:r("spacing"),children:qe(k,{min:0,max:1,step:.01,className:"input-width ee-settings-input-affix",addonAfter:"em",value:$,onFocus:e=>e?.target?.select?.(),onChange:e=>{b({codeSpacing:e??0}),G(A,I,e??0,P,R,D)}})}),qe(vr,{label:r("border_style"),children:qe(x,{className:"width-full ee-stack-control",value:P,onChange:e=>{b({codeBorder:e}),G(A,I,$,e,R,D)},options:d,getPopupContainer:K})}),"none"!==P&&qe(vr,{label:r("border_width"),children:qe(k,{min:.5,max:6,step:.5,className:"input-width ee-settings-input-affix",addonAfter:"px",value:R,onFocus:e=>e?.target?.select?.(),onChange:e=>{b({codeBorderWidth:e??1.5}),G(A,I,$,P,e??1.5,D)}})}),qe(vr,{label:r("discount_code_background"),children:qe(cr,{color:"none"===M?"":M,setColor:({hex:e})=>{const t=e||"none";b({codeBg:t}),G(A,I,$,P,R,D,{codeBg:t})}})}),qe(vr,{label:r("discount_code_corner_radius"),children:qe(k,{min:0,max:32,className:"input-width ee-settings-input-affix",addonAfter:"px",value:D,onFocus:e=>e?.target?.select?.(),onChange:e=>{b({codeRadius:e??4}),G(A,I,$,P,R,e??4)}})})]}),qe(_r,{children:r("container_settings")}),qe(vr,{label:r("background_color"),children:qe(cr,{color:U,setColor:({hex:e})=>f({contentBackground:e})})}),g&&Je(Ye,{children:[qe(vr,{label:r("text_color"),children:qe(cr,{color:E,setColor:({hex:e})=>{f({color:e}),(e=>{g&&(V(L,T,B,{textColor:e}),G(A,I,$,P,R,D,{textColor:e}))})(e)}})}),qe(vr,{label:r("text_align"),children:qe(x,{className:"width-full ee-stack-control",value:z,onChange:e=>{b({discountAlign:e}),V(L,T,B,{discountAlign:e}),G(A,I,$,P,R,D,{discountAlign:e})},options:u,getPopupContainer:K})}),qe(vr,{label:r("gap"),children:qe(k,{min:0,max:48,className:"input-width ee-settings-input-affix",addonAfter:"px",value:F,onFocus:e=>e?.target?.select?.(),onChange:e=>{const t=e??14;b({discountGap:t}),V(L,T,B,{discountGap:t})}})})]}),qe(vr,{label:r("label_padding"),children:qe(mr,{padding:{paddingTop:O,paddingRight:W,paddingBottom:j,paddingLeft:H},setPadding:f})})]})},pc=new Set(["header","discount"]),mc=()=>{const{currentItem:e}=n(Ln),t=e?.data?.key,o=e?.data?.containerType,l="column"===t,a=l&&"footer"===o,i=l&&!pc.has(o)&&"footer"!==o;return Je(Ye,{children:[l&&"header"===o&&qe(ic,{}),l&&"discount"===o&&qe(uc,{}),a?qe(Zs,{}):null,i?qe(Xr,{}):null,"text"===t&&qe(as,{}),"button"===t&&qe(cs,{}),"divider"===t&&qe(ds,{}),"spacer"===t&&qe(ps,{}),"menu"===t&&qe(ys,{}),"image"===t&&qe(fs,{}),"video"===t&&qe(_s,{}),"avatar"===t&&qe(ks,{}),"social_link"===t&&qe(Ls,{}),"raw_html"===t&&qe(Bs,{}),"table"===t&&qe(Is,{})]})},gc={error:{icon:we,color:"#F87171",bg:"rgba(127, 29, 29, 0.35)",border:"rgba(248, 113, 113, 0.45)"},warning:{icon:ke,color:"#fbbf24",bg:"rgba(251, 191, 36, 0.08)",border:"rgba(251, 191, 36, 0.25)"},info:{icon:A,color:"#60a5fa",bg:"rgba(96, 165, 250, 0.08)",border:"rgba(96, 165, 250, 0.25)"}},hc=e=>{const t={},n=e=>{Array.isArray(e)&&e.forEach(e=>{e&&"object"==typeof e&&("text"===e.key&&"dynamic"===e.contentType&&(e.dynamicPrompt||e.dynamicSelectedContent)&&(t[e.id]={blockId:e.id,key:e.key,type:e.type||"p",prompt:e.dynamicPrompt??"",selectedContent:e.dynamicSelectedContent??"",options:e.dynamicOptions??[],variable:e.dynamicVariable??"",language:"bn-BD"===e.dynamicAiLanguage?"bn-BD":"en"}),Array.isArray(e.children)&&n(e.children))})};return n(e),t},yc=()=>{const{blockList:e,bodySettings:t,blockMap:o,setCurrentItem:a,setActionType:i,validationMarkers:r,ignoreValidationIssue:s,filterIgnoredValidationIssues:c}=n(Ln),{t:d}=ja(),u=l(()=>{const n=Ia({blockList:e??[],bodySettings:t??null,aiContentRefs:hc(e??[])});return"function"==typeof c?c(n):n},[e,t,c]),p=u.filter(e=>"error"===e.severity),m=u.filter(e=>"warning"===e.severity),g=u.filter(e=>"info"===e.severity),h=(e,t)=>{const n=gc[e.severity]||gc.info,l=`validation_${e.code}`,r=d(l),c=r&&r!==l?r:e.message,u=Boolean(e.blockId&&o?.[e.blockId]);return Je("div",{style:{padding:10,background:n.bg,border:`1px solid ${n.border}`,borderRadius:4,display:"flex",gap:10,marginBottom:8},children:[qe(B,{icon:n.icon,style:{width:14,height:14,color:n.color,flexShrink:0,marginTop:2}}),Je("div",{style:{flex:1,minWidth:0},children:[qe("div",{style:{fontSize:12,fontWeight:700,color:n.color,textTransform:"none"},children:e.location||e.code||d(`compliance_severity_${e.severity}`)||e.severity}),qe("div",{style:{fontSize:11,color:"var(--ee-foreground)",marginTop:2,lineHeight:1.5},children:c}),(u||"function"==typeof s)&&Je("div",{style:{marginTop:6,display:"flex",gap:8},children:[u&&qe("button",{type:"button",onClick:()=>{var t;(t=e.blockId)&&o?.[t]&&(a({id:t,data:o[t],type:"edit"}),i("edit"),"undefined"!=typeof window&&window.requestAnimationFrame(()=>{const e="function"==typeof window.CSS?.escape?window.CSS.escape(String(t)):String(t).replace(/([ #;?%&,.+*~':"!^$[\]()=>|/@])/g,"\\$1"),n=document.querySelector(`[data-block-id="${e}"]`);n&&"function"==typeof n.scrollIntoView&&n.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})}))},style:{background:"transparent",border:"1px solid rgba(255,255,255,0.18)",color:"var(--ee-foreground)",padding:"3px 8px",borderRadius:999,fontSize:11,cursor:"pointer",fontFamily:"inherit"},children:d("export_validation_open_block")||"Open block"}),"function"==typeof s&&qe("button",{type:"button",onClick:()=>s(e),style:{background:"transparent",border:"1px solid rgba(255,255,255,0.12)",color:"var(--ee-muted-foreground)",padding:"3px 8px",borderRadius:999,fontSize:11,cursor:"pointer",fontFamily:"inherit"},title:ma(e),children:d("ignore")})]})]})]},t)},y=0===u.length,b=l(()=>{try{const n=ql({blockList:e??[],bodySettings:t??{}}),o="undefined"!=typeof Blob?new Blob([n]).size:n.length;return Math.max(1,Math.round(o/1024))}catch{return 0}},[e,t]),f=l(()=>{const t=e=>Array.isArray(e)?e.reduce((e,n)=>{if(!n||"object"!=typeof n)return e;return e+("raw_html"===n.key?1:0)+t(n.children)},0):0;return t(e??[])},[e]),_=Math.min(100,b/200*100),k=b>=102,v=!k&&b>=80,w=k?"#f87070":v?"#fbbf24":"var(--ee-primary)",x=k?"#f87070":v?"#fbbf24":"#C6F065",S=k?d("compliance_above_clip")||"Above clip threshold":v?d("compliance_near_clip")||"Approaching clip threshold":d("compliance_below_clip")||"Below clip threshold",C=Je(Ye,{children:[qe(_r,{children:d("compliance_email_size")||"Email size"}),Je("div",{style:{padding:"10px 12px",background:"rgba(255,255,255,0.03)",border:"1px solid rgba(255,255,255,0.08)",borderRadius:6},children:[Je("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},children:[qe("span",{style:{fontSize:12,color:"#A3A3A3",fontVariantNumeric:"tabular-nums"},children:d("compliance_approx_kb",{n:String(b)})}),qe("span",{style:{fontSize:11,fontWeight:600,color:x,fontVariantNumeric:"tabular-nums"},children:S})]}),Je("div",{style:{position:"relative",height:6,background:"rgba(255,255,255,0.08)",borderRadius:99},children:[qe("div",{style:{position:"absolute",left:0,top:0,height:"100%",width:`${_}%`,background:w,borderRadius:99,transition:"width 0.3s ease"}}),qe("div",{style:{position:"absolute",left:"51%",top:-3,bottom:-3,width:1.5,background:"rgba(251,191,36,0.7)",borderRadius:1}})]}),qe("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:6},children:Je("span",{style:{fontSize:10,color:"rgba(251,191,36,0.85)"},children:[102," KB clip"]})}),(k||v||f>0)&&Je("div",{style:{marginTop:8,padding:"6px 8px",background:k?"rgba(248,112,112,0.08)":"rgba(251,191,36,0.08)",border:"1px solid "+(k?"rgba(248,112,112,0.25)":"rgba(251,191,36,0.25)"),borderRadius:4,fontSize:11,color:k?"#f87070":"#fbbf24",lineHeight:1.5},children:[k&&qe("div",{children:d("compliance_clip_reason_over")||"Gmail will clip this email. Reduce content or remove large blocks."}),v&&!k&&qe("div",{children:d("compliance_clip_reason_near")||"Close to Gmail’s clip limit. Consider trimming content."}),f>0&&qe("div",{style:{marginTop:k||v?4:0},children:d("compliance_clip_reason_raw_html",{n:String(f)})||`${f} raw HTML block${f>1?"s":""} — custom HTML is included verbatim and can significantly inflate email size.`})]})]})]});return Je("div",{style:{padding:"14px 14px 18px 14px"},children:[qe(_r,{className:"ee-settings-section-title--flush",children:d("compliance_preflight")||"Pre-flight"}),y?Je("div",{style:{display:"flex",alignItems:"center",gap:10,padding:12,background:"rgba(216, 254, 145, 0.08)",border:"1px solid rgba(216, 254, 145, 0.25)",borderRadius:4},children:[qe(B,{icon:ve,style:{width:16,height:16,color:"var(--ee-primary)"}}),Je("div",{children:[qe("div",{style:{fontSize:13,fontWeight:500},children:d("compliance_all_clear_title")}),qe("div",{style:{fontSize:11,color:"var(--ee-muted-foreground)",marginTop:2},children:d("compliance_all_clear_desc")})]})]}):Je(Ye,{children:[p.length>0&&Je("div",{style:{marginBottom:12},children:[Je("div",{className:"export-validation-errors-heading",style:{fontWeight:600,marginBottom:6,fontSize:12},children:[d("export_validation_errors")," (",p.length,")"]}),p.map((e,t)=>h(e,`e-${t}`))]}),m.length>0&&Je("div",{style:{marginBottom:12},children:[Je("div",{className:"export-validation-warnings-heading",style:{fontWeight:600,marginBottom:6,fontSize:12},children:[d("export_validation_warnings")," (",m.length,")"]}),m.map((e,t)=>h(e,`w-${t}`))]}),g.length>0&&Je("div",{children:[Je("div",{className:"export-validation-info-heading",style:{fontWeight:600,marginBottom:6,fontSize:12},children:[d("export_validation_info")," (",g.length,")"]}),g.map((e,t)=>h(e,`i-${t}`))]})]}),C]})},bc=({open:e,onUnlinkInstance:t,onKeepLinked:n,onClose:o})=>{const{t:l}=ja(),a=()=>{n?.(),o?.()};return Je(g,{className:"ee-modal-dark",title:l("unlink_modal_title")||"Edit universal block",open:e,onCancel:a,footer:[qe(_,{onClick:a,children:l("unlink_modal_keep")||"Keep linked"},"keep"),qe(_,{type:"primary",danger:!0,onClick:()=>{t?.(),o?.()},children:l("unlink_modal_unlink")||"Unlink this copy"},"unlink")],width:440,destroyOnClose:!0,children:[qe("p",{style:{color:"var(--ee-muted-foreground)",marginBottom:8},children:l("unlink_modal_body")||"This block is linked to a universal snippet. Editing it here will affect all uses of this block everywhere."}),qe("p",{style:{color:"var(--ee-muted-foreground)"},children:l("unlink_modal_body2")||"Choose “Unlink this copy” to make an independent copy that only affects this template, or “Keep linked” to edit all instances together."})]})},fc=({onSaveAsUniversal:e})=>{const{blockMap:t,rootOrder:o,setBlocks:l,currentItem:s,setCurrentItem:c,onSaveBlockAsGlobal:d}=n(Ln),{t:u}=ja(),[p,m]=a(!1),[h,y]=a(!1),b=i(null);r(()=>{if(!p)return;const e=e=>{b.current&&!b.current.contains(e.target)&&m(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[p]);const f=s?.id,_=f?t[f]:null;if(!f||!_)return null;const k=()=>m(!1),v="function"==typeof e||"function"==typeof d,w=Boolean(_?.universalBlockId);return Je(Ye,{children:[Je("div",{ref:b,className:"ee-block-actions-menu-wrap",onClick:e=>e.stopPropagation(),children:[qe("button",{type:"button",className:"ee-block-actions-trigger",onClick:()=>m(e=>!e),"aria-haspopup":"true","aria-expanded":p,"aria-label":u("more_actions"),title:u("more_actions"),children:qe(B,{icon:xe})}),p&&Je("div",{className:"ee-block-actions-menu",role:"menu",children:[Je("button",{type:"button",role:"menuitem",className:"ee-block-actions-item",onClick:()=>{k();const e=Ai(t,o,f);e&&(l(e.nextMap,e.nextRootOrder,"add"),c({id:e.newId,data:e.selectionData,type:"edit"}))},children:[qe(B,{icon:G}),qe("span",{children:u("layer_duplicate")})]}),v&&Je("button",{type:"button",role:"menuitem",className:"ee-block-actions-item",onClick:()=>{k(),"function"==typeof e&&e(_)},children:[qe(B,{icon:q}),qe("span",{children:u("save_as_universal")})]}),w&&Je("button",{type:"button",role:"menuitem",className:"ee-block-actions-item",onClick:()=>{k(),y(!0)},children:[qe(B,{icon:E}),qe("span",{children:u("unlink_universal")||"Unlink this copy"})]}),Je("button",{type:"button",role:"menuitem",className:"ee-block-actions-item",onClick:()=>{k();const e={..._,hidden:!_.hidden};l({...t,[f]:e},o,"edit")},children:[qe(B,{icon:_.hidden?Se:H}),qe("span",{children:_.hidden?u("layer_show"):u("layer_hide")})]}),qe("div",{className:"ee-block-actions-divider","aria-hidden":!0}),Je("button",{type:"button",role:"menuitem",className:"ee-block-actions-item ee-block-actions-item-danger",onClick:()=>{k();const e=()=>{const e=Ri(t,o,f,u);e&&(l(e.nextMap,e.nextRootOrder,"delete"),c(null))};"column"===_.key&&Pi(t,f)?g.confirm({title:u("shortcut_delete_confirm_title"),content:u("shortcut_delete_confirm_desc"),okText:u("confirm"),cancelText:u("cancel"),wrapClassName:"ee-modal-dark",onOk:e}):e()},children:[qe(B,{icon:J}),qe("span",{children:u("layer_delete")})]})]})]}),qe(bc,{open:h,onUnlinkInstance:()=>{const e={..._};delete e.universalBlockId,l({...t,[f]:e},o,`edit_${Date.now()}`),c({...s,data:e})},onKeepLinked:()=>{},onClose:()=>y(!1)})]})},_c=({open:e,block:t,onCreate:n,onClose:o})=>{const{t:l}=ja(),[i,s]=a("");r(()=>{e&&s("")},[e]);const c=()=>{i.trim()&&t&&n({name:i.trim(),block:t})};return Je(g,{className:"ee-modal-dark",title:l("universal_save_modal_title"),open:e,onCancel:o,footer:[qe(_,{onClick:o,children:l("cancel")},"cancel"),qe(_,{type:"primary",onClick:c,disabled:!i.trim(),children:l("universal_save_modal_confirm")},"save")],width:420,destroyOnClose:!0,children:[qe("p",{style:{color:"var(--ee-muted-foreground)",marginBottom:12},children:l("universal_save_modal_subtitle")}),qe(h,{autoFocus:!0,value:i,placeholder:l("universal_save_modal_placeholder"),onChange:e=>s(e.target.value),onPressEnter:c})]})},kc="content",vc="styles",wc="compliance";function xc({t:e}){return Je("div",{className:"ee-fill-product-slots-tooltip",children:[qe("p",{className:"ee-fill-product-slots-tooltip-title",children:e("fill_product_slots_tooltip_title")}),Je("div",{className:"ee-fill-product-slots-tooltip-block",children:[qe("p",{className:"ee-fill-product-slots-tooltip-heading",children:e("fill_product_slots_tooltip_on_heading")}),qe("p",{className:"ee-fill-product-slots-tooltip-body",children:e("fill_product_slots_tooltip_on_body")})]}),Je("div",{className:"ee-fill-product-slots-tooltip-block",children:[qe("p",{className:"ee-fill-product-slots-tooltip-heading",children:e("fill_product_slots_tooltip_off_heading")}),qe("p",{className:"ee-fill-product-slots-tooltip-body",children:e("fill_product_slots_tooltip_off_body")})]}),Je("div",{className:"ee-fill-product-slots-tooltip-block ee-fill-product-slots-tooltip-block--watch",children:[qe("p",{className:"ee-fill-product-slots-tooltip-heading",children:e("fill_product_slots_tooltip_watch_heading")}),Je("ul",{className:"ee-fill-product-slots-tooltip-list",children:[qe("li",{children:e("fill_product_slots_tooltip_watch_1")}),qe("li",{children:e("fill_product_slots_tooltip_watch_2")}),qe("li",{children:e("fill_product_slots_tooltip_watch_3")})]})]})]})}const Sc=()=>{const{currentItem:e,isDragStart:t,bodySettings:s,setBodySettings:d,fillProductSlots:u,setFillProductSlots:p,setCurrentItem:m,setActionType:g,blockMap:y,rootOrder:b,validationMarkers:f,onSaveBlockAsGlobal:_,templateData:w}=n(Ln),[C,N]=a(null),{t:L}=ja(),T=o(e=>e&&"object"==typeof e&&"column"===e.key&&e.id&&y[e.id]?Kt(e.id,y)??e:e,[y]),I=o(e=>{N(T(e))},[T]),$=o(async({name:e,block:t})=>{try{"function"==typeof _&&await Promise.resolve(_({name:e,block:t})),S.success(String(L("universal_save_success")||"").replace("{{name}}",e)||`Saved "${e}" as universal`),N(null)}catch(e){console.error("[EmailEditor] onSaveBlockAsGlobal:",e);const t=L("universal_save_error")||"Could not save universal block",n="string"==typeof e?.message&&e.message.trim()?e.message.trim():"string"==typeof e?e:t;S.error(n||t)}},[_,L]);r(()=>{const e=e=>{e.detail&&e.detail.block&&N(T(e.detail.block))};return window.addEventListener("ee:canvas-save-universal",e),()=>window.removeEventListener("ee:canvas-save-universal",e)},[T]);const P=l(()=>Yo(w),[w]),[R,M]=a(kc),D=i(null),E=f?Object.values(f).reduce((e,t)=>e+(t?.totalCount||0),0):0,z=e=>{if(!e)return X;switch(e.key){case"column":{const t=e.containerType;return"product"===t?ee:"discount"===t?te:Mi(e)===Di?X:ne}case"text":{const t=(e.type||"p").toLowerCase();return/^h[1-6]$/.test(t)?Te:ce}case"button":return U;case"image":return O;case"video":return j;case"divider":return se;case"spacer":return re;case"menu":return ie;case"avatar":return W;case"social_link":return ae;case"raw_html":return le;case"table":return oe;case"footer":return Le;default:return X}},F=()=>{if(!e?.id||!y[e.id])return[];const t=[e.id],n=new Set(t);let o=e.id;for(;;){const e=Vt(y,b,o);if(!e||n.has(e.containerId))break;t.unshift(e.containerId),n.add(e.containerId),o=e.containerId}return t.map(e=>({id:e,data:y[e]})).filter(e=>Boolean(e.data))},H=()=>{let t="Block";const n=e?.data.key;switch(n){case"text":{const n=(e?.data?.type||"p").toLowerCase();t=/^h[1-6]$/.test(n)?L("heading_settings"):L("text_settings");break}case"column":{const n=e?.data?.containerType;if("product"===n){t=L("block_product");break}if("header"===n){t=L("header_settings");break}if("discount"===n){t=L("discount_settings");break}if("footer"===n){t=L("footer_settings");break}if(Ei(e?.data)){t=L("additional_products_grid_layout");break}t=Mi(e?.data)===Ui?L("settings_title_column_layout"):L("container_settings");break}case"button":t=L("button_settings");break;case"divider":t=L("divider_settings");break;case"spacer":t=L("spacer_settings");break;case"menu":t=L("menu_settings");break;case"image":t=L("image_settings");break;case"video":t=L("video_settings");break;case"avatar":t=L("avatar_settings");break;case"social_link":t=L("social_link_settings");break;case"raw_html":t=L("raw_html_settings");break;case"table":t=L("table_settings");break;case"footer":t=L("footer_settings")}return t},K=e=>t=>{d({...s,styles:{...s.styles,[e]:t.hex}},"set_body_settings")},V=(e,t,n,o)=>qe(vr,{label:e,children:qe(cr,{color:t,setColor:n,fallbackColor:o})}),G=()=>Je("section",{className:"right-panel-styles-section",children:[qe("h3",{className:"right-panel-styles-section-title",children:L("product_recommendations_section")}),Je("div",{className:"right-panel-styles-section-body ee-settings-stack-flat",children:[qe(vr,{layout:"toggle",label:Je("span",{children:[L("fill_product_slots_label"),qe(v,{overlayClassName:"ee-fill-product-slots-tooltip-overlay",title:qe(xc,{t:L}),children:qe("span",{className:"ee-help-icon","aria-label":L("fill_product_slots_label"),children:qe(B,{icon:A})})})]}),children:qe(pr,{checked:!1!==u,onChange:e=>p(e,"set_fill_product_slots")})}),qe("p",{className:"ee-fill-product-slots-hint"+(!1===u?" ee-fill-product-slots-hint--off":""),children:L(!1!==u?"fill_product_slots_on_hint":"fill_product_slots_off_hint")})]})]}),q=()=>{const e=s.styles||{},t=e.headingColor||e.color||"#171717";return Je("section",{className:"right-panel-styles-section",children:[qe("h3",{className:"right-panel-styles-section-title",children:L("type_styles_section")}),Je("div",{className:"right-panel-styles-section-body ee-settings-stack-flat",children:[qe(vr,{label:L("body_font_short"),children:qe(x,{className:"input-width",showSearch:!0,optionFilterProp:"label",value:Zo(e.fontFamily,w),onChange:e=>{return t=Zo(e,w),void d({...s,styles:{...s.styles,fontFamily:t}},"set_body_settings");var t},labelRender:({value:e})=>qe("span",{children:Qo(e,w)}),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,options:P.map(e=>({label:e.label,value:e.value}))})}),V(L("body_text_short"),e.color,K("color"),"#171717"),V(L("body_heading_short"),t,K("headingColor"),"#171717"),V(L("body_link_short"),e.linkColor||"#338AF3",K("linkColor"),"#338AF3")]})]})},J=()=>{const e=s.styles||{},t=Ft(s);return Je("section",{className:"right-panel-styles-section",children:[qe("h3",{className:"right-panel-styles-section-title",children:L("document_section")}),Je("div",{className:"right-panel-styles-section-body ee-settings-stack-flat",children:[V(L("body_bg_color_short"),e.backgroundColor,K("backgroundColor"),"#F5F5F5"),qe(vr,{label:L("body_width_label"),children:qe(k,{className:"input-width ee-settings-input-affix ee-body-width-number",addonAfter:"px",min:Mt,max:Dt,value:t,onChange:e=>d({...s,contentWidth:e,contentWidthMode:Ut.CUSTOM_PX},"set_body_settings")})})]})]})},Y=()=>{const e=zt(s),t=Ft(s),n=s.styles||{};return Je(Ye,{children:[Je("section",{className:"right-panel-styles-section",children:[qe("h3",{className:"right-panel-styles-section-title",children:L("email_styles_section")}),Je("div",{className:"right-panel-styles-section-body ee-settings-stack-flat",children:[V(L("body_bg_color_short"),n.backgroundColor,K("backgroundColor"),"#F5F5F5"),qe(vr,{label:Je("span",{children:[L("email_width_mode"),qe(v,{title:L("full_bleed_tooltip"),children:qe("span",{className:"ee-help-icon","aria-label":"Help",children:qe(B,{icon:A})})})]}),children:qe(x,{className:"input-width ee-width-mode-select",value:e,onChange:e=>d({...s,contentWidthMode:e},"set_body_settings"),getPopupContainer:()=>document.querySelector(".right-settings")||document.body,options:[{value:Ut.EMAIL_WIDTH,label:L("email_width_default")},{value:Ut.CUSTOM_PX,label:L("custom_px")},{value:Ut.FULL_BLEED,label:L("full_bleed")}]})}),qe(vr,{label:L("custom_width_px"),children:qe(k,{className:"input-width ee-settings-input-affix ee-body-width-number",addonAfter:"px",min:Mt,max:Dt,value:t,disabled:e===Ut.FULL_BLEED,onChange:e=>d({...s,contentWidth:e,contentWidthMode:Ut.CUSTOM_PX},"set_body_settings")})})]})]}),q(),G(),Je("section",{className:"right-panel-styles-section",children:[qe("h3",{className:"right-panel-styles-section-title",children:L("text_and_headings")}),qe("div",{className:"right-panel-styles-section-body",children:qe(vr,{label:L("pre_header"),hint:L("pre_header_description"),children:qe(h,{value:s.preHeader,onChange:e=>d({...s,preHeader:e.target.value},"set_body_settings")})})})]}),Je("section",{className:"right-panel-styles-section",children:[qe("h3",{className:"right-panel-styles-section-title",children:L("mobile_optimization")||"Mobile optimization"}),Je("div",{className:"right-panel-styles-section-body ee-settings-stack-flat",children:[Je("div",{className:"ee-settings-row",children:[qe("span",{className:"ee-settings-row-label",children:L("stack_columns_on_mobile")||"Stack columns on mobile"}),qe(pr,{checked:!1!==s.stackColumnsOnMobile,onChange:e=>d({...s,stackColumnsOnMobile:e},"set_body_settings")})]}),Je("div",{className:"ee-settings-row",children:[qe("span",{className:"ee-settings-row-label",children:L("scale_font_on_mobile")||"Scale font on mobile"}),qe(pr,{checked:!1!==s.scaleFontOnMobile,onChange:e=>d({...s,scaleFontOnMobile:e},"set_body_settings")})]})]})]})]})},Z="undefined"!=typeof window&&"product-variables"===window.__eeDragSource,Q=e&&"edit"===e.type&&(!t||Z);c(()=>{if(!Q)return;M(kc);const e=D.current;e&&(e.scrollTop=0)},[Q,e?.id]);const de=()=>Je(Ye,{children:[Je("div",{className:"right-panel-block-settings-header",children:[qe("button",{type:"button",className:"right-panel-back-btn",onClick:()=>m(null),"aria-label":L("right_panel_back"),children:qe(B,{icon:Ce})}),qe("span",{className:"ee-block-settings-header-icon","aria-hidden":!0,children:qe(B,{icon:z(e?.data)})}),qe("h2",{className:"right-setting-block-title right-panel-block-title-inline",children:H()}),qe(fc,{onSaveAsUniversal:I})]}),Je("div",{className:"right-panel-layers-bar",children:[qe("div",{className:"right-panel-layers-header",children:L("layers_panel")}),qe("nav",{className:"right-panel-breadcrumbs-shell","aria-label":L("layers_panel"),children:qe("ol",{className:"right-panel-breadcrumbs-trail",children:F().map((e,t,n)=>{const o=t===n.length-1,l=(e=>{if(!e)return"";switch(e.key){case"column":{const t=e.containerType;if("product"===t)return L("block_product");if("discount"===t)return L("block_discount");if("header"===t)return L("block_header");if("footer"===t)return L("block_footer");const n=Mi(e);return L(n===Di?"block_palette_section":n===Ui?"block_palette_columns":"container")}case"text":{const t=(e.type||"p").toLowerCase();return/^h[1-6]$/.test(t)?L("heading"):L("text")}case"button":return L("button");case"image":return L("image");case"video":return L("video");case"divider":return L("divider");case"spacer":return L("spacer");case"menu":return L("menu");case"avatar":return L("avatar");case"social_link":return L("social_link");case"raw_html":return L("raw_html");case"table":return L("table");case"footer":return L("block_footer");case"empty":return L("drag_block_here");default:return e.name||"Block"}})(e.data),a=z(e.data);return Je("li",{className:"right-panel-breadcrumb-item right-panel-breadcrumb-crumb-slot",children:[t>0?qe("span",{className:"right-panel-breadcrumb-sep","aria-hidden":!0,children:qe(B,{icon:Ne})}):null,o?Je("span",{className:"right-panel-breadcrumb-segment right-panel-breadcrumb-current","aria-current":"page",children:[qe("span",{className:"right-panel-breadcrumb-ancestor-icon right-panel-breadcrumb-current-icon",children:qe(B,{icon:a})}),qe("span",{className:"right-panel-breadcrumb-label",children:l})]}):Je("button",{type:"button",className:"right-panel-breadcrumb-segment right-panel-breadcrumb-ancestor",onClick:(i=e.id,e=>{e.preventDefault(),e.stopPropagation();const t=y[i];t&&(m({id:i,data:t,type:"edit"}),g("edit"))}),children:[qe("span",{className:"right-panel-breadcrumb-ancestor-icon",children:qe(B,{icon:a})}),qe("span",{className:"right-panel-breadcrumb-label",children:l})]})]},`${e.id||"layer"}-${t}`);var i})})})]}),qe("div",{className:"right-panel-block-settings-form",children:qe(mc,{})})]});return Je(Ye,{children:[qe("div",{className:"right-settings",onClick:e=>{e.stopPropagation()},children:Je(Ye,{children:[Je("div",{className:"right-panel-tabs",children:[qe("button",{type:"button",className:"right-panel-tab "+(R===kc?"right-panel-tab-active":""),onClick:()=>M(kc),children:L("content")}),qe("button",{type:"button",className:"right-panel-tab "+(R===vc?"right-panel-tab-active":""),onClick:()=>M(vc),children:L("styles")}),Je("button",{type:"button",className:"right-panel-tab "+(R===wc?"right-panel-tab-active":""),onClick:()=>M(wc),children:[L("compliance"),E>0&&qe("span",{className:"right-panel-tab-badge","aria-label":L("compliance_tab_badge_label",{count:E>99?"99+":String(E)}),children:E>99?"99+":E})]})]}),Je("div",{ref:D,className:"right-panel-tab-content default-scrollbar"+(R===kc&&Q?" right-panel-tab-content--block-settings":""),children:[R===kc&&(Q?de():Je(Ye,{children:[J(),q(),G(),qe("div",{className:"ee-content-empty-hint",children:L("right_panel_empty_hint")})]})),R===vc&&Y(),R===wc&&qe(yc,{})]})]})}),qe(_c,{open:Boolean(C),block:C,onCreate:$,onClose:()=>N(null)})]})},Cc={column:ne,text:ce,button:Ae,divider:se,spacer:re,menu:ie,image:O,social_link:Be,raw_html:le,table:oe,video:j,product:ee,header:Z,footer:Q,discount:te},Nc={header:"header",footer:"footer",discount:"discount",product:"product",none:"product"};function Lc(e,t){const n=Nc[t];return n&&Cc[n]?Cc[n]:Cc.product}const Tc=["text","image","button","divider","spacer","social_link","menu","table","video","raw_html"],Bc={[Di]:X,[Ui]:ne};const Ac=({clearStyles:e,openConfigureColumnsModal:t})=>{const{setCurrentItem:o,setIsDragStart:l,setActionType:a,templateData:i,aiEnabled:r=!0}=n(Ln),{blockConfigsList:s}=fr(),{t:c}=ja(),{blockItems:d,layoutItems:u}=function(e,t){const n=[];Tc.forEach(o=>{const l=e.find(e=>e.key===o);l&&("text"===o&&t?n.push({...l,ai:!0,contentType:"static",dynamicPrompt:"",dynamicSelectedContent:"",dynamicOptions:[],dynamicVariable:"",isPreset:!1}):n.push({...l,isPreset:!1}))});const o=[],l=e.find(e=>"column"===e.key&&e.layoutRole===Di),a=e.find(e=>"column"===e.key&&e.layoutRole===Ui);return l&&o.push({...l,isPreset:!1,paletteIcon:Bc[Di],opensConfigureModal:!1}),a&&o.push({...a,isPreset:!1,paletteIcon:Bc[Ui],opensConfigureModal:!0}),{blockItems:n,layoutItems:o}}(s,r),p=Mr.presets.filter(e=>!Dr.has(e.id)).map(e=>({key:e.id,name:e.presetName,icon:Lc(e.presetName,e.containerType),isPreset:!0,getColumn:()=>Er(e.id)})),m=t=>{t.target.style.outline="",setTimeout(()=>{l(!1),e&&e()},50)},g=e=>t=>{const n=e.isPreset?xt(e.getColumn(c,i)):xt(e);o({id:null,data:n,type:"add"}),l(!0),t.target.style.outline="1px dashed var(--ee-primary)",a("add")},h=e=>{const n="boolean"==typeof e.opensConfigureModal?e.opensConfigureModal:Mi(e)===Ui;return Je("div",{className:"ee-blocks-palette-card",draggable:!0,onDragStart:g(e),onDragEnd:m,onClick:()=>{n&&t()},title:n?`${e.name} — ${c("configure_columns_hint")}`:e.name,children:[qe(B,{icon:e.paletteIcon||e.icon||Cc[e.key]||ce,className:"ee-blocks-palette-card-icon"}),qe("span",{className:"ee-blocks-palette-card-label",children:e.name}),e.ai&&Je("span",{className:"ee-blocks-palette-card-ai",children:[qe(B,{icon:q,className:"ee-blocks-palette-card-ai-icon","aria-hidden":!0}),"AI"]})]},`palette-card-${e.key}-${e.layoutRole??"base"}`)};return Je("div",{className:"ee-blocks-palette",children:[qe("div",{className:"ee-left-rail-section-title",children:c("blocks")}),qe("div",{className:"ee-blocks-palette-grid",children:d.map(h)}),u.length>0&&Je(Ye,{children:[qe("div",{className:"ee-left-rail-section-title",style:{paddingTop:16},children:c("layout")}),qe("div",{className:"ee-blocks-palette-grid",children:u.map(h)})]}),p.length>0&&Je(Ye,{children:[qe("div",{className:"ee-left-rail-section-title",style:{paddingTop:16},children:c("presets")}),qe("div",{className:"ee-blocks-palette-rows",children:p.map(e=>Je("div",{className:"ee-blocks-palette-row",draggable:!0,onDragStart:g(e),onDragEnd:m,title:e.name,children:[qe(B,{icon:_e,className:"ee-blocks-palette-row-grip"}),qe(B,{icon:e.icon,className:"ee-blocks-palette-row-icon"}),qe("span",{className:"ee-blocks-palette-row-label",children:e.name})]},e.key))})]})]})},Ic=({clearStyles:e})=>{const{universals:t=[],universalsLoading:o,setCurrentItem:l,setIsDragStart:a,setActionType:i,deleteUniversalEmailBlock:r}=n(Ln),{t:s}=ja(),c=e=>t=>{const n=JSON.parse(JSON.stringify(e.block||{}));n&&"object"==typeof n&&(l({id:null,data:n,type:"add"}),a(!0),t.currentTarget.style.outline="1px dashed var(--ee-primary)",i("add"))},d=t=>{t.currentTarget.style.outline="",setTimeout(()=>{a(!1),e&&e()},50)};return Je("div",{className:"ee-universal-panel",children:[Je("div",{className:"ee-left-rail-section-title",children:[s("universal_saved_blocks"),o?qe("span",{className:"ee-universal-loading",children:" · …"}):null]}),0===t.length?Je("div",{className:"ee-universal-empty",children:[s("universal_empty_state_line_1")," ",qe(B,{icon:q,style:{width:10,height:10,color:"var(--ee-primary)",verticalAlign:"middle"}})," ",s("universal_empty_state_line_2")]}):qe("div",{className:"ee-universal-list",children:t.map(e=>{const t=String(e?.block?.containerType||e?.block?.key||"block").replace(/[-_]/g," "),n="none"===t.trim().toLowerCase()?s("block_palette_section"):t;return Je("div",{className:"ee-universal-item",draggable:!0,onDragStart:c(e),onDragEnd:d,title:e.name,children:[qe(B,{icon:_e,className:"ee-blocks-palette-row-grip"}),qe(B,{icon:q,className:"ee-universal-item-icon"}),Je("div",{className:"ee-universal-item-body",children:[qe("div",{className:"ee-universal-item-name",children:e.name}),Je("div",{className:"ee-universal-item-meta",children:[n,null!=e.usedIn?` · ${s("universal_used_in_count").replace("{{count}}",String(e.usedIn))}`:""]})]}),"function"==typeof r?qe("button",{type:"button",className:"ee-universal-item-delete","aria-label":s("universal_delete"),title:s("universal_delete"),onMouseDown:e=>e.stopPropagation(),onClick:t=>{t.preventDefault(),t.stopPropagation(),g.confirm({title:s("universal_delete_confirm_title"),content:s("universal_delete_confirm_body"),okButtonProps:{danger:!0},okText:s("universal_delete_confirm_ok"),cancelText:s("cancel"),wrapClassName:"ee-modal-dark",onOk:async()=>{try{await r(e.resourceId??e.id)}catch(e){throw S.error(e?.message||s("universal_save_error")||"Could not delete"),e}}})},children:qe(B,{icon:J,className:"ee-universal-item-delete-icon"})}):null]},e.id)})})]})},$c={column:ne,text:ce,button:Ae,divider:se,spacer:re,menu:ie,image:O,video:j,social_link:Be,raw_html:le,table:oe,avatar:W,empty:X};function Pc(e){return e?"column"===e.key?"product"===e.containerType?ee:"discount"===e.containerType?te:Mi(e)===Di?X:ne:$c[e.key]||X:X}function Rc(e,t=28){const n=String(e??"").replace(/<[^>]+>/g,"").trim();return n?n.length>t?`${n.slice(0,t)}…`:n:null}function Mc(e,t){if("column"!==e?.key||"footer"!==e.containerType||!e.footerUnifiedLayout)return[];const n=[],o=(e,t,o,l)=>{n.push({segment:e,label:t,subtitle:Rc(o),icon:l})};if(e.showDivider&&o("divider",t("footer_divider_above"),null,se),e.footerShowLogo&&o("logo",`${t("image")} · ${t("logo_section")}`,e.footerLogoAlt||"",O),e.showBrand&&o("brand",`${t("text")} · ${t("footer_label_brand")}`,e.brandName||"",ce),e.showTagline&&o("tagline",`${t("text")} · ${t("brand_tagline")}`,e.brandTagline||"",ce),e.showAddress&&o("address",`${t("text")} · ${t("address")}`,e.address||"",ce),e.showSocial){const n=wl(e.footerSocialList).map(e=>String(e.title||"").trim()).filter(Boolean);o("social",t("footer_social_platforms_heading"),n.length?n.slice(0,4).join(", "):null,Be)}if(e.showUnsubscribe){const n=String(e.unsubscribeLinkLabel??"").trim()||"Unsubscribe";o("unsubscribe",`${t("menu")} · ${t("footer_toggle_unsubscribe")}`,n,ie)}if(e.showSecondaryLinks){const n=xl(e.secondaryLinks).map(e=>String(e.label||"").trim()).filter(Boolean);o("secondary",t("footer_secondary_links_heading"),n.length?n.slice(0,5).join(" · "):null,ie)}return e.showCopyright&&o("copyright",`${t("text")} · ${t("copyright_text")}`,e.copyrightText||"",ce),n}const Dc=()=>{const{blockMap:e,rootOrder:t,setBlocks:o,setCurrentItem:l,setActionType:i,currentItem:r,onSaveBlockAsGlobal:s}=n(Ln),{t:c}=ja(),[d,u]=a(null),[p,m]=a(null),h=r?.id||null,y=n=>{if(!n||!e[n])return;let a=e[n];if("column"===a.key&&"footer"===a.containerType&&a.footerUnifiedLayout&&null!=a.footerSelectedSegment&&""!==a.footerSelectedSegment){const l={...a};delete l.footerSelectedSegment,o({...e,[n]:l},t,`edit_${Date.now()}`),a=l}l({id:n,data:a,type:"edit"}),i("edit"),"undefined"!=typeof window&&window.requestAnimationFrame(()=>{const e="function"==typeof window.CSS?.escape?window.CSS.escape(String(n)):String(n).replace(/([ #;?%&,.+*~':"!^$[\]()=>|/@])/g,"\\$1"),t=document.querySelector(`[data-block-id="${e}"]`);t&&"function"==typeof t.scrollIntoView&&t.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})})},b=(n,a)=>{const r=e[n];if(!r)return;const s={...r,footerSelectedSegment:a};o({...e,[n]:s},t,`edit_${Date.now()}`),l({id:n,data:s,type:"edit"}),i("edit"),"undefined"!=typeof window&&window.requestAnimationFrame(()=>{const e="function"==typeof window.CSS?.escape?window.CSS.escape(String(n)):String(n).replace(/([ #;?%&,.+*~':"!^$[\]()=>|/@])/g,"\\$1"),t=document.querySelector(`[data-block-id="${e}"]`);t&&"function"==typeof t.scrollIntoView&&t.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})})},f=(n,l)=>{const a=t.indexOf(n);if(-1===a)return;const i=[...t],r="up"===l?a-1:a+1;r<0||r>=i.length||([i[a],i[r]]=[i[r],i[a]],o(e,i,"move"))},_=(n,l)=>{const a=t.indexOf(n);if(-1===a)return;const i=[...t];i.splice(a,1);const r=l>a?l-1:l;i.splice(Math.max(0,Math.min(r,i.length)),0,n),o(e,i,"move")},k=(n,a,i,r,v)=>{if(!n)return null;const w=h===n.id,x=function(e){if(!e)return null;const t=e.text||e.title||e.list&&e.list[0]?.label||e.alt||e.html||"",n=String(t).replace(/<[^>]+>/g,"").trim();return n?n.length>24?`${n.slice(0,24)}…`:n:null}(n),S=function(e,t){if(!e)return"";switch(e.key){case"column":{const n=e.containerType;if("product"===n)return t("block_product");if("discount"===n)return t("block_discount");if("header"===n)return t("block_header");if("footer"===n)return t("block_footer");if("introduction"===n)return t("block_introduction");if("body"===n)return t("block_body");const o=Mi(e);return t(o===Di?"block_palette_section":o===Ui?"block_palette_columns":"container")}case"text":return t("text");case"button":return t("button");case"image":return t("image");case"video":return t("video");case"divider":return t("divider");case"spacer":return t("spacer");case"menu":return t("menu");case"avatar":return t("avatar");case"social_link":return t("social_link");case"raw_html":return t("raw_html");case"table":return t("table")||"Table";case"empty":return t("drag_block_here");default:return e.name||"Block"}}(n,c),C=!!n.hidden,N=i&&d&&d!==n.id&&p===r;return Je("div",{children:[N&&qe("div",{className:"ee-layer-drop-indicator","aria-hidden":!0}),Je("div",{className:za("ee-layer-row",w&&"ee-layer-row-selected",C&&"ee-layer-row-hidden"),style:{paddingLeft:6+14*a},onClick:e=>{e.stopPropagation(),y(n.id)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),y(n.id))},role:"button",tabIndex:0,draggable:i,onDragStart:e=>{if(i){e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",n.id)}catch{}u(n.id)}},onDragOver:e=>{if(!i||!d||d===n.id)return;e.preventDefault();const t=e.currentTarget.getBoundingClientRect(),o=e.clientY-t.top<t.height/2;m(o?r:r+1)},onDrop:e=>{if(!i||!d)return;e.preventDefault();_(d,p??r),u(null),m(null)},onDragEnd:()=>{u(null),m(null)},children:[qe(B,{icon:Pc(n),className:"ee-layer-row-icon"}),Je("span",{className:"ee-layer-row-label",children:[S,x&&Je("span",{className:"ee-layer-row-sub",children:["· ",x]})]}),Je("div",{className:"ee-layer-row-actions",onClick:e=>e.stopPropagation(),children:[i&&Je(Ye,{children:[qe("button",{type:"button",className:"ee-layer-mini-btn",title:c("layer_move_up"),disabled:0===r,onClick:()=>f(n.id,"up"),children:qe(B,{icon:K})}),qe("button",{type:"button",className:"ee-layer-mini-btn",title:c("layer_move_down"),disabled:r===v-1,onClick:()=>f(n.id,"down"),children:qe(B,{icon:V})})]}),qe("button",{type:"button",className:"ee-layer-mini-btn",title:c("layer_duplicate"),onClick:()=>(n=>{const a=Ai(e,t,n);a&&(o(a.nextMap,a.nextRootOrder,"add"),l({id:a.newId,data:a.selectionData,type:"edit"}))})(n.id),children:qe(B,{icon:G})}),i&&"column"===n.key&&"function"==typeof s?qe("button",{type:"button",className:"ee-layer-mini-btn ee-layer-save-universal",title:c("save_as_universal"),"aria-label":c("save_as_universal"),onClick:e=>{e.stopPropagation(),window.dispatchEvent(new CustomEvent("ee:canvas-save-universal",{detail:{block:n}}))},children:qe(B,{icon:q})}):null,qe("button",{type:"button",className:"ee-layer-mini-btn ee-layer-mini-btn-danger",title:c("layer_delete"),onClick:()=>(n=>{const a=e[n];if(!a)return;const i=()=>{const a=Ri(e,t,n,c);a&&(o(a.nextMap,a.nextRootOrder,"delete"),l(null))};"column"===a.key&&Pi(e,n)?g.confirm({title:c("shortcut_delete_confirm_title"),content:c("shortcut_delete_confirm_desc"),okText:c("confirm"),cancelText:c("cancel"),wrapClassName:"ee-modal-dark",onOk:i}):i()})(n.id),children:qe(B,{icon:J})})]}),qe("button",{type:"button",className:"ee-layer-mini-btn ee-layer-row-vis",title:c(C?"layer_show":"layer_hide"),onClick:l=>{l.stopPropagation(),(n=>{const l=e[n];if(!l)return;const a={...e,[n]:{...l,hidden:!l.hidden}};o(a,t,"edit")})(n.id)},children:qe(B,{icon:C?H:Se})})]}),"column"===n.key&&Array.isArray(n.cells)&&n.cells.map((t,o)=>{const l=t.childrenIds||[],i=n.cells.length>1;return Je("div",{children:[i&&qe("div",{className:"ee-layer-cell-label",style:{paddingLeft:12+14*(a+1)},children:`${c("column")} ${o+1}`}),l.map(t=>{const n=e[t];return n&&"empty"!==n.key?k(n,a+2,!1,0,0):null})]},t.id||o)}),"column"===n.key&&"footer"===n.containerType&&n.footerUnifiedLayout&&Mc(n,c).map(({segment:t,label:o,subtitle:l,icon:i})=>{const r=e[n.id]||n,s=h===n.id&&r.footerSelectedSegment===t,c=a+2;return Je("div",{className:za("ee-layer-row","ee-layer-row--footer-segment",s&&"ee-layer-row-selected"),style:{paddingLeft:6+14*c},role:"button",tabIndex:0,onClick:e=>{e.stopPropagation(),b(n.id,t)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),b(n.id,t))},children:[qe(B,{icon:i,className:"ee-layer-row-icon"}),Je("span",{className:"ee-layer-row-label",children:[o,l?Je("span",{className:"ee-layer-row-sub",children:["· ",l]}):null]})]},`${n.id}:footer-seg:${t}`)})]},n.id)};return Je("div",{className:"ee-layers-panel",onDragOver:e=>{d&&e.preventDefault()},onDrop:e=>{if(!d)return;e.preventDefault();const n=p??t.length;_(d,n),u(null),m(null)},children:[Je("div",{className:"ee-layers-header",children:[qe("span",{children:c("layers")}),Je("span",{className:"ee-layers-header-count",children:[t.length," ",1===t.length?c("layer_one"):c("layer_many")]})]}),Je("button",{type:"button",className:za("ee-layers-document",!h&&"ee-layers-document-active"),onClick:()=>l(null),children:[qe(B,{icon:Ie}),qe("span",{children:c("document")})]}),t.map((n,o)=>{const l=e[n];return k(l,1,!0,o,t.length)}),d&&p===t.length&&qe("div",{className:"ee-layer-drop-indicator","aria-hidden":!0})]})},Uc=[{key:"full",label:"1 column",desc:"Full-width section"},{key:"1-1",label:"2 columns",desc:"Equal halves"},{key:"1-1-1",label:"3 columns",desc:"Equal thirds"},{key:"1-1-1-1",label:"4 columns",desc:"Equal quarters"},{key:"1-2",label:"1 : 2",desc:"Narrow + wide"},{key:"2-1",label:"2 : 1",desc:"Wide + narrow"},{key:"1-3",label:"1 : 3",desc:"Sidebar + body"},{key:"3-1",label:"3 : 1",desc:"Body + sidebar"},{key:"2-3",label:"2 : 3",desc:"Off-center"},{key:"3-2",label:"3 : 2",desc:"Off-center"},{key:"1-2-1",label:"1 : 2 : 1",desc:"Hero + edges"},{key:"2-1-1",label:"2 : 1 : 1",desc:"Lead + two"},{key:"1-1-2",label:"1 : 1 : 2",desc:"Two + lead"}],Ec=[{key:"6-col-equal",label:"6 cols equal",cols:6,parts:[1,1,1,1,1,1]},{key:"12-col-equal",label:"12 cols equal",cols:12,parts:[1,1,1,1,1,1,1,1,1,1,1,1]}],zc=["A","B","C","D"],Fc=["A","B","C","D","E","F","G","H","I","J","K","L"],Oc=({parts:e,rowCount:t})=>{const n=e.slice(0,Math.min(e.length,12)),o=Math.min(t,4);return Je("div",{className:"ee-grid-preview-wrap",children:[qe("div",{className:"ee-grid-preview-heading",children:"Live preview"}),Array.from({length:o}).map((e,t)=>Je("div",{className:"ee-grid-preview-row",children:[qe("div",{className:"ee-grid-preview-row-label",children:zc[t]}),n.map((e,n)=>Je("div",{className:"ee-grid-preview-cell",style:{flex:e},children:[Fc[n],zc[t]]},n))]},t))]})},Wc=e=>{const t="full"===e?[1]:e.split("-").map(e=>parseInt(e,10)),n=t.reduce((e,t)=>e+t,0);return qe("div",{className:"ee-layout-preview",children:t.map((e,t)=>qe("span",{className:"ee-layout-preview-cell",style:{flex:e/n}},t))})};function jc(e,t,n){const o=e[t]||e.full,l=e=>e&&"object"==typeof e?{...e,id:Nt(),...Array.isArray(e.children)?{children:e.children.map(l)}:{}}:e;return{id:Nt(),name:n("block_palette_columns"),key:"column",type:o.type,containerType:"none",layoutRole:Ui,columnLayoutOnly:!0,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"#fff"},mobile:{}},children:(o.children||[]).map(l)}}const Hc=({open:e,onClose:t,columnRootId:o})=>{const{t:l}=ja(),{columnsSetting:i}=fr(),{blockMap:s,rootOrder:c,setBlocks:d,setCurrentItem:u}=n(Ln),[p,m]=a("1-1"),[h,y]=a(1),[b,f]=a(!1),[k,v]=a("6-col-equal");r(()=>{e&&(m("1-1"),y(1),f(!1))},[e]);const w=(()=>{if(b){const e=Ec.find(e=>e.key===k);return e?e.parts:[1]}return"full"===p?[1]:p.split("-").map(e=>parseInt(e,10))})();return Je(g,{className:"ee-modal-dark ee-configure-columns-modal",title:l("configure_columns_title"),open:e,onCancel:t,footer:[qe(_,{onClick:t,children:l("cancel")},"cancel"),qe(_,{type:"primary",onClick:()=>{const e=b?"full":p;let n=s,a=[...c];const r=o&&"column"===n[o]?.key?o:null;let m=null;for(let t=0;t<h;t++){const o=jc(i,e,l);if(b){const e=Ec.find(e=>e.key===k);if(e){o.type=e.key;const t=e.cols,n=`${(100/t).toFixed(4)}%`;o.children=Array.from({length:t},(e,t)=>({id:Nt(),name:l("content"),key:"content",width:n,styles:{key:"column",desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0,contentBackground:"transparent"},mobile:{}},children:[{id:Nt(),name:l("drag_block_here"),key:"empty",width:"100%",styles:{desktop:{backgroundColor:"transparent",paddingTop:0,paddingLeft:0,paddingRight:0,paddingBottom:0},mobile:{}}}]}))}}if(r&&0===t&&"column"===n[r]?.key){o.id=r,n=en(n,r);const{blockMap:e}=jt([o]);n={...n,...e},m=r;continue}const{newBlockMap:s,rootId:c}=nn(n,o);c&&(n=s,a=[...a,c],m=c)}d(n,a,"add"),null!=m&&n[m]&&u({id:m,data:n[m],type:"edit"}),t()},children:l("configure_columns_insert")},"insert")],width:660,destroyOnClose:!0,children:[qe("p",{style:{color:"var(--ee-muted-foreground)",marginBottom:14},children:l("configure_columns_subtitle")}),Je("div",{className:"ee-layout-tab-group",role:"tablist","aria-label":"Layout type",children:[qe("button",{type:"button",role:"tab","aria-selected":!b,className:za("ee-layout-tab",!b&&"ee-layout-tab-active"),onClick:()=>f(!1),children:l("standard_layout")||"Standard"}),qe("button",{type:"button",role:"tab","aria-selected":b,className:za("ee-layout-tab",b&&"ee-layout-tab-active"),onClick:()=>f(!0),children:l("grid_layout")||"6/12 Grid"})]}),qe("div",b?{style:{display:"flex",gap:8},children:Ec.map(e=>Je("button",{type:"button",className:za("ee-layout-card",k===e.key&&"ee-layout-card-active"),onClick:()=>v(e.key),style:{flex:1},children:[qe("div",{className:"ee-layout-grid-mini-bar",children:e.parts.slice(0,6).map((e,t)=>qe("span",{className:"ee-layout-grid-mini-cell"},t))}),qe("div",{className:"ee-layout-card-label",children:e.label})]},e.key))}:{className:"ee-layout-grid",children:Uc.filter(e=>i[e.key]).map(e=>Je("button",{type:"button",className:za("ee-layout-card",p===e.key&&"ee-layout-card-active"),onClick:()=>m(e.key),children:[Wc(e.key),qe("div",{className:"ee-layout-card-label",children:e.label}),qe("div",{className:"ee-layout-card-desc",children:e.desc})]},e.key))}),qe(Oc,{parts:w,rowCount:h}),Je("div",{className:"ee-row-count-row",children:[qe("span",{children:l("configure_columns_row_count")||"Rows to insert:"}),qe(_,{className:"ee-configure-stepper-btn",type:"default",size:"small",icon:qe(B,{icon:ue}),onClick:()=>y(e=>Math.max(1,e-1)),disabled:h<=1}),qe("span",{className:"ee-row-count-value",children:h}),qe(_,{className:"ee-configure-stepper-btn",type:"default",size:"small",icon:qe(B,{icon:pe}),onClick:()=>y(e=>Math.min(4,e+1)),disabled:h>=4})]})]})},Kc="blocks",Vc="universal",Gc="layers",qc=({clearStyles:e})=>{const{t:t}=ja(),[n,o]=a(Kc),[l,i]=a(!1),[s,c]=a(null);r(()=>{const e=e=>{c(e?.detail?.rootId??null),i(!0)};return window.addEventListener(zi,e),()=>window.removeEventListener(zi,e)},[]);const d=[{id:Kc,label:t("blocks"),icon:$e},{id:Vc,label:t("universal"),icon:q},{id:Gc,label:t("layers"),icon:Pe}];return Je("aside",{className:"ee-left-rail","aria-label":"Editor sidebar",onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:[qe("div",{className:"ee-left-rail-tabs",role:"tablist",children:d.map(e=>Je("button",{type:"button",role:"tab","aria-selected":n===e.id,className:za("ee-left-rail-tab",n===e.id&&"ee-left-rail-tab-active"),onClick:()=>o(e.id),children:[qe(B,{icon:e.icon}),qe("span",{children:e.label})]},e.id))}),Je("div",{className:"ee-left-rail-body",children:[n===Kc&&qe(Ac,{clearStyles:e,openConfigureColumnsModal:()=>{c(null),i(!0)}}),n===Vc&&qe(Ic,{clearStyles:e}),n===Gc&&qe(Dc,{})]}),qe(Hc,{open:l,columnRootId:s,onClose:()=>{i(!1),c(null)}})]})},Jc=({open:e,issues:t,onClose:o,onExportAnyway:l})=>{const{setCurrentItem:a,setActionType:i,blockMap:r}=n(Ln),{t:s}=ja(),c=e=>{var t;e?.blockId&&((t=e.blockId)&&r?.[t]&&(a({id:t,data:r[t],type:"edit"}),i("edit"),"undefined"!=typeof window&&window.requestAnimationFrame(()=>{const e="function"==typeof window.CSS?.escape?window.CSS.escape(String(t)):String(t).replace(/([ #;?%&,.+*~':"!^$[\]()=>|/@])/g,"\\$1"),n=document.querySelector(`[data-block-id="${e}"]`);n&&"function"==typeof n.scrollIntoView&&n.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})}),1)&&o())},d=(e,t)=>{const n=Boolean(e?.blockId),o=`validation_${e.code}`,l=s(o),a=l&&l!==o?l:e.message;return qe("li",{className:"export-validation-issue-item",children:Je("button",{type:"button",className:"export-validation-issue-btn "+(n?"is-clickable":""),onClick:()=>c(e),disabled:!n,children:[qe("span",{className:"export-validation-issue-copy",children:a}),n&&qe("span",{className:"export-validation-issue-action",children:s("export_validation_open_block")||"Open block"})]})},t)},u=(t||[]).filter(e=>"error"===e.severity),p=(t||[]).filter(e=>"warning"===e.severity),m=(t||[]).filter(e=>"info"===e.severity);return Je(g,{className:"ee-modal-dark",title:s("export_validation_title"),open:e,onCancel:o,footer:[qe(_,{onClick:o,children:s("cancel")},"cancel"),qe(_,{type:"primary",onClick:l,children:s("export_anyway")},"export")],width:520,destroyOnClose:!0,children:[qe("p",{style:{marginBottom:12},children:s("export_validation_issues_found")}),Je("div",{style:{maxHeight:360,overflowY:"auto"},children:[u.length>0&&Je("div",{style:{marginBottom:12},children:[Je("div",{className:"export-validation-errors-heading",style:{fontWeight:600,marginBottom:6},children:[s("export_validation_errors")," (",u.length,")"]}),qe("ul",{className:"export-validation-issue-list",children:u.map((e,t)=>d(e,`e-${t}`))})]}),p.length>0&&Je("div",{style:{marginBottom:12},children:[Je("div",{className:"export-validation-warnings-heading",style:{fontWeight:600,marginBottom:6},children:[s("export_validation_warnings")," (",p.length,")"]}),qe("ul",{className:"export-validation-issue-list",children:p.map((e,t)=>d(e,`w-${t}`))})]}),m.length>0&&Je("div",{children:[Je("div",{className:"export-validation-info-heading",style:{fontWeight:600,marginBottom:6},children:[s("export_validation_info")," (",m.length,")"]}),qe("ul",{className:"export-validation-issue-list",children:m.map((e,t)=>d(e,`i-${t}`))})]})]})]})},{Option:Yc}=x,Xc=[{value:"none",label:"No payload"},{value:"profile",label:"Profile data"},{value:"event",label:"Event data"}],Zc=({open:e,onClose:t,onSend:n,templateName:o})=>{const{t:l}=ja(),[i,r]=a([]),[s,c]=a(""),[d,u]=a("none"),[p,m]=a(!0),[y,f]=a(!1),k=e=>{const t=String(e||"").trim();if(!t)return;const n=t.split(/[\s,;]+/).filter(Boolean);r(e=>{const t=new Set(e);return n.forEach(e=>t.add(e)),Array.from(t)}),c("")},v=e=>{r(t=>t.filter(t=>t!==e))},w=()=>{r([]),c(""),u("none"),m(!0),f(!1),t?.()};return qe(g,{className:"ee-modal-dark",title:l("send_test_title")||"Send test email",open:e,onCancel:w,footer:[qe(_,{onClick:w,disabled:y,children:l("cancel")},"cancel"),qe(_,{type:"primary",onClick:async()=>{if(0!==i.length){f(!0);try{await Promise.resolve(n?.({recipients:i,payloadType:d,testPrefix:p,subjectPrefix:p?"[TEST] ":"",name:o||"Untitled template"})),w()}finally{f(!1)}}},loading:y,disabled:0===i.length,children:l("send_test_send")||"Send test"},"send")],width:480,destroyOnClose:!0,children:Je("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[Je("div",{children:[qe("div",{style:{marginBottom:6,fontSize:13,fontWeight:500},children:l("send_test_recipients")||"Recipients"}),Je("div",{style:{display:"flex",flexWrap:"wrap",gap:4,minHeight:36,padding:"4px 8px",border:"1px solid var(--ee-border, #374151)",borderRadius:6,backgroundColor:"var(--ee-surface, #1a1a1a)",cursor:"text"},onClick:()=>document.getElementById("ee-send-test-input")?.focus(),children:[i.map(e=>qe(T,{closable:!0,onClose:()=>v(e),style:{margin:2},children:e},e)),qe(h,{id:"ee-send-test-input",bordered:!1,value:s,style:{flex:1,minWidth:160,padding:0},placeholder:0===i.length?l("send_test_recipients_placeholder")||"name@example.com, another@example.com":"",onChange:e=>c(e.target.value),onKeyDown:e=>{"Enter"!==e.key&&","!==e.key&&" "!==e.key&&"Tab"!==e.key||(e.preventDefault(),k(s)),"Backspace"===e.key&&!s&&i.length>0&&v(i[i.length-1])},onBlur:()=>{s.trim()&&k(s)}})]}),qe("div",{style:{fontSize:11,color:"var(--ee-muted-foreground)",marginTop:4},children:l("send_test_recipients_hint")||"Press Enter or comma to add each address."})]}),Je("div",{children:[qe("div",{style:{marginBottom:6,fontSize:13,fontWeight:500},children:l("send_test_payload")||"Payload context"}),qe(x,{style:{width:"100%"},value:d,onChange:u,getPopupContainer:()=>document.querySelector(".email-editor")||document.body,children:Xc.map(e=>qe(Yc,{value:e.value,children:l(`send_test_payload_${e.value}`)||e.label},e.value))})]}),Je("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 12px",borderRadius:6,backgroundColor:"var(--ee-surface, #1a1a1a)",border:"1px solid var(--ee-border, #374151)"},children:[Je("div",{children:[qe("div",{style:{fontSize:13,fontWeight:500},children:l("send_test_prefix_label")||"[TEST] prefix"}),qe("div",{style:{fontSize:12,color:"var(--ee-muted-foreground)"},children:l("send_test_prefix_hint")||"Prepends [TEST] to the subject line."})]}),qe(b,{checked:p,onChange:m})]})]})})},Qc=({templateName:e,onTemplateNameChange:t,onBack:s,onPreview:c,onSendTest:d,onSaveTemplate:u,onShowShortcuts:p,onSendTestIntent:m,onSaveTemplateIntent:y,saveStatusDetail:b,onExit:f,hideOverflowExportActions:_=!1})=>{const{previewMode:k,setPreviewMode:v,canUndo:w,canRedo:S,undo:C,redo:N,blockList:L,bodySettings:T,fillProductSlots:A,templateData:I,saveState:$,highContrastEditor:P,setHighContrastEditor:R,filterIgnoredValidationIssues:M}=n(Ln),{t:D}=ja(),[U,E]=a(!1),[z,F]=a(e||""),[O,W]=a(!1),[j,H]=a(!1),[K,V]=a([]),[G,q]=a(null),[J,Y]=a(!1),[X,Z]=a(!1),[Q,ee]=a(!1),[te,ne]=a(""),[oe,le]=a(!1),[ae,ie]=a("desktop"),re=i(null);r(()=>{oe&&ie("desktop")},[oe]);const se=l(()=>{if(!oe)return{html:"",error:null};try{return{html:Gl({bodySettings:T,blockList:L,templateData:I??void 0})??"",error:null}}catch(e){return console.error("[EmailEditor] HTML preview generation failed:",e),{html:"",error:D("html_email_preview_error")}}},[oe,T,L,I,D]);r(()=>{F(e||"")},[e]),r(()=>{if(!O)return;const e=e=>{re.current&&!re.current.contains(e.target)&&W(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[O]);const ce=()=>{E(!1),"function"==typeof t&&z!==e&&t(z)},de=o(e=>{const t={},n=(e,o=[])=>{Array.isArray(e)&&e.forEach(e=>{if(!e||"object"!=typeof e)return;const l={blockId:e.id??null,key:e.key??null,containerType:"column"===e.key?e.containerType??"none":null},a=[...o,l];if("text"===e.key&&"dynamic"===e.contentType){const n="string"==typeof e.dynamicPrompt?e.dynamicPrompt.trim():"",o="string"==typeof e.dynamicSelectedContent?e.dynamicSelectedContent.trim():"";if(!n&&!o)return;t[e.id]={blockId:e.id,path:a,key:e.key,type:e.type||"p",selectedContent:o,options:Array.isArray(e.dynamicOptions)?e.dynamicOptions:[],prompt:n,variable:e.dynamicVariable??"",language:"bn-BD"===e.dynamicAiLanguage?"bn-BD":"en"}}Array.isArray(e.children)&&n(e.children,a)})};return n(e,[]),t},[]),ue=o(e=>Array.isArray(e)?e.map(e=>{if(!e||"object"!=typeof e)return e;const{dynamicPrompt:t,dynamicOptions:n,dynamicSelectedContent:o,dynamicVariable:l,dynamicAiLanguage:a,staticTextBeforeAi:i,children:r,...s}=e;return{...s,children:ue(r)}}):e,[]),pe=o(()=>({blockList:ue(L??[]),bodySettings:T??null,aiContentRefs:de(L??[]),language:ga(L??[]),fillProductSlots:!1!==A}),[L,T,A,de,ue]),me=()=>{const t=pe(),n=JSON.stringify(t,null,2),o=new Blob([n],{type:"application/json"}),l=document.createElement("a");l.download=`${e||"email-template"}.json`,l.href=URL.createObjectURL(o),l.click()},ge=()=>{const t=Gl({bodySettings:T,blockList:L,templateData:I});if(null==t)return;const n=new Blob([t],{type:"text/html"}),o=document.createElement("a");o.download=`${e||"email-template"}.html`,o.href=URL.createObjectURL(n),o.click()},he=async e=>{Y(!0);try{const t=pe();let n=Ia({blockList:t.blockList??[],bodySettings:t.bodySettings??null,aiContentRefs:t.aiContentRefs??{}});const o=await Ua(t.blockList??[]);if(n=[...n,...o],"function"==typeof M&&(n=M(n)),0===n.length)return void("html"===e?ge():me());V(n),q(e),H(!0)}finally{Y(!1)}},ye=()=>{H(!1),V([]),q(null)},be="function"==typeof m||"function"==typeof d,fe="function"==typeof y||"function"==typeof u,_e="function"==typeof m,ke="function"==typeof y;return Je("header",{className:"ee-topbar",children:["function"==typeof s&&"function"!=typeof f&&Je(Ye,{children:[Je("button",{type:"button",className:"ee-topbar-back",onClick:s,"aria-label":D("topbar_back_to_templates"),children:[qe(B,{icon:Ce}),qe("span",{children:D("topbar_back_to_templates")})]}),qe("div",{className:"ee-topbar-divider","aria-hidden":!0})]}),Je("div",{className:"ee-topbar-breadcrumb",children:[qe(B,{icon:Re}),qe("span",{children:D("topbar_breadcrumb_email")}),qe(B,{icon:Ne,className:"ee-topbar-breadcrumb-sep"}),U?qe("input",{autoFocus:!0,className:"ee-topbar-name-input",value:z,onChange:e=>F(e.target.value),onBlur:ce,onKeyDown:t=>{"Enter"===t.key?ce():"Escape"===t.key&&(F(e||""),E(!1))},"aria-label":D("topbar_rename_template")}):qe("button",{type:"button",className:"ee-topbar-name-btn",onClick:()=>{"function"==typeof t&&E(!0)},title:"function"==typeof t?D("topbar_rename_template"):void 0,children:e||D("topbar_untitled_template")})]}),Je("div",{className:"ee-topbar-spacer",children:[(b||$)&&Je(Ye,{children:[Je("div",{className:"ee-topbar-status-cluster ee-topbar-status-cluster--lead",children:[qe("span",{className:za("header-save-state","saved"===$&&"header-save-state_saved","saving"===$&&"header-save-state_saving","unsaved"===$&&"header-save-state_unsaved","error"===$&&"header-save-state_error"),"aria-label":`save-state-${$}`,children:b||$&&(D(`save_state_${$}`)||$)}),"saved"===$&&qe(B,{icon:ve,className:"ee-topbar-saved-check","aria-hidden":!0}),"saving"===$&&qe(B,{icon:Me,spin:!0,className:"ee-topbar-saving-spinner","aria-hidden":!0})]}),qe("div",{className:"ee-topbar-divider","aria-hidden":!0})]}),qe("button",{type:"button",className:"ee-topbar-icon-btn",onClick:C,disabled:!w,title:D("undo"),"aria-label":D("undo"),children:qe(B,{icon:De})}),qe("button",{type:"button",className:"ee-topbar-icon-btn",onClick:N,disabled:!S,title:D("redo"),"aria-label":D("redo"),children:qe(B,{icon:Ue})}),qe("div",{className:"ee-topbar-divider","aria-hidden":!0}),Je("div",{className:"ee-topbar-segment",role:"tablist","aria-label":"Device preview",children:[qe("button",{type:"button",role:"tab","aria-selected":"desktop"===k,className:za("ee-topbar-segment-btn","desktop"===k&&"ee-topbar-segment-btn-active"),onClick:()=>v("desktop"),title:D("desktop"),children:qe(B,{icon:Ee})}),qe("button",{type:"button",role:"tab","aria-selected":"mobile"===k,className:za("ee-topbar-segment-btn","mobile"===k&&"ee-topbar-segment-btn-active"),onClick:()=>v("mobile"),title:D("mobile"),children:qe(B,{icon:ze})})]}),qe("button",{type:"button",className:"ee-topbar-icon-btn",onClick:()=>le(!0),title:D("html_email_preview"),"aria-label":D("html_email_preview"),children:qe(B,{icon:Se})}),qe("div",{className:"ee-topbar-divider","aria-hidden":!0}),be&&Je("button",{type:"button",className:"ee-topbar-btn ee-topbar-btn-ghost ee-topbar-btn-send-test",onClick:()=>{"function"!=typeof m?"function"==typeof d&&Z(!0):m()},title:D("send_test"),children:[qe(B,{icon:Fe}),qe("span",{className:"ee-topbar-btn-label",children:D("send_test")})]}),"function"==typeof c&&Je("button",{type:"button",className:"ee-topbar-btn ee-topbar-btn-outline",onClick:()=>{"function"==typeof c&&c()},title:D("preview"),children:[qe(B,{icon:Oe}),qe("span",{className:"ee-topbar-btn-label",children:D("preview")})]}),fe&&Je("button",{type:"button",className:"ee-topbar-btn ee-topbar-btn-primary",onClick:()=>{"function"!=typeof y?"function"==typeof u&&ee(!0):y()},title:D("save_template"),children:[qe(B,{icon:We}),qe("span",{className:"ee-topbar-btn-label",children:D("save_template")})]}),Je("div",{className:"ee-topbar-overflow-wrap",ref:re,children:[qe("button",{type:"button",className:"ee-topbar-icon-btn",onClick:()=>W(e=>!e),"aria-haspopup":"true","aria-expanded":O,"aria-label":D("more_actions"),title:D("more_actions"),children:qe(B,{icon:xe})}),O&&Je("div",{className:"ee-topbar-overflow-menu",role:"menu",children:[!_&&Je(Ye,{children:[Je("button",{type:"button",role:"menuitem",className:"ee-topbar-overflow-item",disabled:J,onClick:()=>{W(!1),he("json")},children:[qe(B,{icon:je}),qe("span",{children:D("export_json")})]}),Je("button",{type:"button",role:"menuitem",className:"ee-topbar-overflow-item",disabled:J,onClick:()=>{W(!1),he("html")},children:[qe(B,{icon:He}),qe("span",{children:D("export_html")})]})]}),"function"==typeof p&&Je(Ye,{children:[!_&&qe("div",{className:"ee-topbar-overflow-divider","aria-hidden":!0}),Je("button",{type:"button",role:"menuitem",className:"ee-topbar-overflow-item",onClick:()=>{W(!1),p()},children:[qe(B,{icon:Ke}),qe("span",{children:D("keyboard_shortcuts")})]})]}),"function"==typeof R&&Je("button",{type:"button",role:"menuitem",className:"ee-topbar-overflow-item",onClick:()=>{R(e=>!e),W(!1)},children:[qe(B,{icon:Ve}),qe("span",{children:D(P?"high_contrast_off":"high_contrast_on")})]})]})]}),"function"==typeof f&&Je(Ye,{children:[qe("div",{className:"ee-topbar-divider ee-topbar-divider-exit","aria-hidden":!0}),qe("button",{type:"button",className:"ee-topbar-exit-btn",onClick:f,children:D("topbar_exit")||"Exit"})]})]}),qe(g,{className:"ee-modal-dark ee-html-preview-modal",title:Je("div",{className:"ee-html-preview-modal-header-inner",children:[qe("span",{className:"ee-html-preview-modal-title-text",children:D("html_email_preview_title")}),Je("div",{className:"ee-topbar-segment ee-html-preview-modal-segment",role:"tablist","aria-label":D("html_email_preview_device_aria"),onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),children:[qe("button",{type:"button",role:"tab","aria-selected":"desktop"===ae,className:za("ee-topbar-segment-btn","desktop"===ae&&"ee-topbar-segment-btn-active"),onClick:()=>ie("desktop"),title:D("desktop"),children:qe(B,{icon:Ee})}),qe("button",{type:"button",role:"tab","aria-selected":"mobile"===ae,className:za("ee-topbar-segment-btn","mobile"===ae&&"ee-topbar-segment-btn-active"),onClick:()=>ie("mobile"),title:D("mobile"),children:qe(B,{icon:ze})})]})]}),open:oe,onCancel:()=>le(!1),footer:null,width:"min(960px, 96vw)",centered:!0,destroyOnClose:!0,children:se.error?qe("p",{className:"ee-html-preview-error",children:se.error}):qe("div",{className:za("ee-html-preview-viewport","mobile"===ae&&"ee-html-preview-viewport--mobile"),children:qe("iframe",{title:D("html_email_preview_title"),className:"ee-html-preview-iframe",sandbox:"allow-same-origin allow-popups allow-popups-to-escape-sandbox",srcDoc:se.html})})}),qe(Jc,{open:j,issues:K,onClose:ye,onExportAnyway:()=>{"html"===G?ge():"json"===G&&me(),ye()}}),!_e&&"function"==typeof d&&qe(Zc,{open:X,templateName:e,onClose:()=>Z(!1),onSend:t=>{if("function"!=typeof d)return;const n=pe();d({...n,name:e||"Untitled template",recipients:t.recipients,payloadType:t.payloadType,subjectPrefix:t.subjectPrefix})}}),!ke&&"function"==typeof u&&qe(g,{className:"ee-modal-dark",title:D("save_template_title")||"Save template",open:Q,onCancel:()=>{ee(!1),ne("")},onOk:()=>{if("function"!=typeof u)return;const t=pe();u({...t,name:e||"Untitled template",category:te}),ee(!1),ne("")},okText:D("save")||"Save",cancelText:D("cancel"),width:420,destroyOnClose:!0,children:Je("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[Je("div",{children:[qe("div",{style:{marginBottom:6,fontSize:13,fontWeight:500},children:D("template_name")||"Template name"}),qe(h,{value:e||D("topbar_untitled_template"),readOnly:!0})]}),Je("div",{children:[qe("div",{style:{marginBottom:6,fontSize:13,fontWeight:500},children:D("save_template_category")||"Category"}),qe(x,{style:{width:"100%"},value:te||void 0,placeholder:D("save_template_category_placeholder")||"Select or type a category…",allowClear:!0,showSearch:!0,onChange:e=>ne(e||""),getPopupContainer:()=>document.querySelector(".email-editor")||document.body,options:[{value:"promotional",label:D("category_promotional")||"Promotional"},{value:"transactional",label:D("category_transactional")||"Transactional"},{value:"newsletter",label:D("category_newsletter")||"Newsletter"},{value:"onboarding",label:D("category_onboarding")||"Onboarding"},{value:"announcement",label:D("category_announcement")||"Announcement"},{value:"other",label:D("category_other")||"Other"}]})]})]})})]})},ed=({keys:e,desc:t})=>Je("div",{className:"ee-shortcuts-row",children:[qe("span",{className:"ee-shortcuts-row-desc",children:t}),qe("kbd",{className:"ee-shortcuts-kbd",children:e})]}),td=({open:e,onClose:t})=>{const{t:n}=ja(),o=/Mac|iPhone|iPod|iPad/i.test("undefined"!=typeof navigator&&navigator.platform||"")?"⌘":"Ctrl";return Je(g,{wrapClassName:"ee-modal-dark ee-shortcuts-modal",title:n("shortcuts_modal_title"),open:e,onCancel:t,footer:null,width:520,destroyOnClose:!0,children:[qe(ed,{keys:`${o} + S`,desc:n("shortcut_save")}),qe(ed,{keys:`${o} + Z`,desc:n("shortcut_undo")}),qe(ed,{keys:`${o} + Shift + Z / ${o} + Y`,desc:n("shortcut_redo")}),qe(ed,{keys:`${o} + D`,desc:n("shortcut_duplicate")}),qe(ed,{keys:`${o} + C`,desc:n("shortcut_copy_block")}),qe(ed,{keys:`${o} + V`,desc:n("shortcut_paste_block")}),qe(ed,{keys:"Delete / Backspace",desc:n("shortcut_delete_block")}),qe(ed,{keys:"Esc",desc:n("shortcut_escape")}),qe(ed,{keys:"?",desc:n("shortcut_cheat_sheet")}),qe("p",{className:"ee-shortcuts-footnote",children:n("shortcuts_modal_footnote")})]})};function nd(e){return e&&"function"==typeof e.closest&&(e.closest('[data-type="empty-block-item"]')||e.closest('[data-type="empty-block"]')||e.closest('[data-type="drag-over-column"]')||e.closest('[data-type="block-item-move"]'))||e}const od=({language:e})=>{const{blockMap:t,rootOrder:l,setBlocks:i,currentItem:s,setCurrentItem:c,setIsDragStart:d,setLanguage:u,templateData:p,highContrastEditor:m,canUndo:h,canRedo:y,undo:b,redo:f,flushPendingRichText:_,onShortcutSave:k,templateName:v,onTemplateNameChange:w,onBack:x,onSaveTemplate:C,onSaveTemplateIntent:N,onSendTest:L,onSendTestIntent:T,saveStatusDetail:B,onExit:A,onPreview:I,hideOverflowExportActions:$}=n(Ln),{t:P}=ja(),{getColumnConfig:R}=fr(),[M,D]=a(!1),U=e=>{if(!e||"object"!=typeof e)return e;const t=p?.content?.products,n=p?.catalogProducts,o=p?.content?.primaryProductId,l=Array.isArray(t)&&t.length>0?t:Array.isArray(n)&&n.length>0?n:zr,a=o?l.find(e=>e.id===o):l[0],i=a?l.filter(e=>e?.id!==a.id):l,r=e=>{if(!e||"object"!=typeof e)return e;const t=Array.isArray(e.children)?e.children.map(r):e.children;if("column"!==e.key||"product"!==e.containerType||!a)return{...e,children:t};const n=Math.max(Array.isArray(t)?t.length:0,Array.isArray(e.columnProducts)?e.columnProducts.length:0,1),o="additional"===e.productRole?"additional":"main",l=Array.from({length:n},(e,t)=>"main"===o||0===i.length?a:i[t%i.length]);return{...e,children:t,columnProducts:l}};return r(e)};r(()=>{u(e)},[e,u]),r(()=>{const e=e=>{const t=e.target;if(n=t,Boolean(n&&n.closest&&n.closest(".email-editor")))return!0;var n;const o=t===document.body||t===document.documentElement||"string"==typeof t?.id&&"root"===t.id;return Boolean(o&&document.querySelector(".email-editor"))},n=e=>"Backspace"===e.key||"Delete"===e.key||"Backspace"===e.code||"Delete"===e.code,o=o=>{if(!e(o))return;const a=o.metaKey||o.ctrlKey,r=o.key,d=(u=o.target,Boolean(u?.closest?.(".text-content_editable[contenteditable='true']")));var u;const p=(e=>{if(!e)return!1;const t=e.tagName;return"INPUT"===t||"TEXTAREA"===t||"SELECT"===t||Boolean(e.closest?.(".ant-input, .ant-input-number, textarea.ant-input, .ant-select-selection-search-input"))})(o.target),m=()=>{if(!s?.id||"add"===s.type)return!1;const e=s.id,n=t[e];if(!n)return!1;const a=()=>{const n=Ri(t,l,e,P);n&&(i(n.nextMap,n.nextRootOrder,"delete"),c(null))};return"column"===n.key&&Pi(t,e)?(o.preventDefault(),o.stopPropagation(),g.confirm({title:P("shortcut_delete_confirm_title"),content:P("shortcut_delete_confirm_desc"),okText:P("confirm"),cancelText:P("cancel"),wrapClassName:"ee-modal-dark",onOk:a}),!0):(o.preventDefault(),o.stopPropagation(),a(),!0)};if(a&&"s"===String(r).toLowerCase())"function"==typeof k&&(o.preventDefault(),o.stopPropagation(),k());else if(d){if("Escape"===r)return o.preventDefault(),o.stopPropagation(),_(),D(!1),"function"==typeof document.activeElement?.blur&&document.activeElement.blur(),void c(null);if(!a&&n(o)&&(e=>"function"==typeof e?.closest&&e.closest("[data-block-id]")?.getAttribute?.("data-block-id")||null)(o.target)===s?.id&&(()=>{const e=window.getSelection();if(!e?.rangeCount)return!1;const t=e.anchorNode;if(!t)return!1;const n=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement,o="function"==typeof n?.closest?n.closest(".text-content_editable[contenteditable='true']"):null;return!!o&&0===String(o.innerText||"").replace(/[\u200b\uFEFF]/g,"").replace(/\u00a0/g," ").replace(/[\t\n\r\f]/g,"").trim().length})())return _(),void m();if(a&&"z"===String(r).toLowerCase()&&!o.shiftKey){if(!h)return;return o.preventDefault(),o.stopPropagation(),_(),void b()}if(a&&("z"===String(r).toLowerCase()&&o.shiftKey||"y"===String(r).toLowerCase())){if(!y)return;return o.preventDefault(),o.stopPropagation(),_(),void f()}}else if(!p){if(a&&"z"===String(r).toLowerCase()&&!o.shiftKey){if(!h)return;return o.preventDefault(),_(),void b()}if(a&&("z"===String(r).toLowerCase()&&o.shiftKey||"y"===String(r).toLowerCase())){if(!y)return;return o.preventDefault(),_(),void f()}if(a&&"d"===String(r).toLowerCase()){if(!s?.id||"add"===s.type)return;o.preventDefault();const e=Ai(t,l,s.id);if(!e)return;return i(e.nextMap,e.nextRootOrder,"add"),void c({id:e.newId,data:e.selectionData,type:"edit"})}if(a&&"c"===String(r).toLowerCase()){if(!s?.id||"add"===s.type)return;o.preventDefault();const e=Bi(t,l,s.id);return void(e&&(Ti.tree=e))}if(a&&"v"===String(r).toLowerCase()){if(!Ti.tree)return;o.preventDefault();const e=s?.id&&t[s.id]?s.id:null,n=$i(t,l,Ti.tree,e);if(!n)return;return i(n.nextMap,n.nextRootOrder,"add"),void c({id:n.newId,data:n.selectionData,type:"edit"})}return"Escape"===r?(o.preventDefault(),D(!1),void c(null)):"?"===r||o.shiftKey&&"Slash"===o.code?(o.preventDefault(),void D(!0)):void(n(o)&&m())}};return document.addEventListener("keydown",o,!0),()=>document.removeEventListener("keydown",o,!0)},[t,l,s,i,c,h,y,b,f,_,k,P]);const E=()=>{const e=document.getElementsByClassName("block-drag-label-content");Array.from(e).forEach(e=>{e.children[0]&&(e.children[0].style.visibility="hidden")})},z=()=>{const e=document.getElementsByClassName("block-content-drag-label-content");Array.from(e).forEach(e=>{e.children[0]&&(e.children[0].style.visibility="hidden")})},F=()=>{document.querySelectorAll(".block-empty-content").forEach(e=>{e.style.border=""})},O=()=>{document.querySelectorAll('[data-type="empty-block"]').forEach(e=>{e.style.border=""})},W=()=>{document.querySelectorAll('[data-drag-hovered="true"]').forEach(e=>{delete e.dataset.dragHovered})},j=e=>{const t=e?.closest?.(".block-item[data-block-id], .block[data-block-id]")||null;document.querySelectorAll('[data-drag-hovered="true"]').forEach(e=>{e!==t&&delete e.dataset.dragHovered}),t&&(t.dataset.dragHovered="true")},H=()=>{E(),z(),F(),O(),W()},K=o(e=>{e.preventDefault(),e.stopPropagation();const t=nd(e.target),{type:n}=t.dataset||{};switch(n){case"empty-block":E(),z(),W(),t.style.border="2px dashed var(--ee-drop-target-outline)";break;case"drag-over-column":{z(),j(t);const e=t.dataset.index,n=document.getElementsByClassName("block-drag-label-content");Array.from(n).forEach(t=>{const n=Number(t.dataset.index)===Number(e),o=t.querySelector(".block-move-top"),l=t.querySelector(".block-move-bottom");o&&(o.style.visibility=n?"visible":"hidden"),l&&(l.style.visibility=n?"visible":"hidden")});break}case"block-item-move":{E(),j(t);const e=t.dataset.dropKey,n=document.getElementsByClassName("block-content-drag-label-content");Array.from(n).forEach(t=>{t.dataset.dropKey===e?t.children[0].style.visibility="visible":t.children[0].style.visibility="hidden"});break}case"empty-block-item":E(),z(),j(t),t.classList?.contains("block-empty-content")&&(t.style.border="2px dashed var(--ee-drop-target-outline)");break;default:E(),z(),W()}},[]),V=(e,t)=>{const{blockMap:n,removedId:o}=Xt(e,t.containerId,t.cellIndex,t.itemIndex);return{result:n,removedId:o}},G=(e,t,n,o)=>{const l=e[t];if(!l||l.cells[n].childrenIds.length>0)return e;const a=Wt(o("drag_block_here"));return{...e,[a.id]:a,[t]:{...l,cells:l.cells.map((e,t)=>t===n?{...e,childrenIds:[a.id]}:e)}}},q=(e,t,n)=>{if(!t||!n)return!1;if(t===n)return!0;const o=t=>{const l=e[t];if(!l||"column"!==l.key)return!1;for(const e of l.cells||[])for(const t of e.childrenIds||[]){if(t===n)return!0;if(o(t))return!0}return!1};return o(t)};return Je(Ye,{children:[qe(td,{open:M,onClose:()=>D(!1)}),Je("div",{className:"email-editor"+(m?" ee-high-contrast":""),onDragOver:K,onDrop:e=>{e.preventDefault(),e.stopPropagation();const n=nd(e.target),{type:o}=n.dataset||{};W(),F(),O(),d(!1);const a="undefined"!=typeof window?window.__eeDragItemData:null,r=()=>{"undefined"!=typeof window&&(window.__eeDragItemData=null,window.__eeDragSource=null)},u="add"===s?.type&&null!=s?.data,p=u||a?"add":s?.type,m=u?function(e){if(!e||"object"!=typeof e)return e;const t="column"===e.key&&Array.isArray(e.children)&&e.children.length>0;if("column"===e.key&&Array.isArray(e.cells)&&e.cells.length>0&&!t){const t=tn(e,e.blockMap||e.blockSnapshotMap||{});if(t?.blockMap&&t.rootId){const e=Ht(t.blockMap,[t.rootId])[0];if(e)return Bt(e)}}return Bt(e)}(s.data):a?Bt(a):s?.data??null;if(m){switch(o){case"empty-block":{const e="column"===m.key?m:R(m),n=U(e),{newBlockMap:o,rootId:l}=nn(t,n);if(!l)return void r();i(o,[l],"add"),c({id:l,data:o[l],type:"edit"}),"add"===p&&"column"===o[l]?.key&&Mi(o[l])===Ui&&Fi(l);break}case"empty-block-item":{F();const e=n.dataset.containerId,o=Number(n.dataset.cellIndex),a=Number(n.dataset.itemIndex);if(!e)return void r();if("column"===m.key||"add"!==p&&s?.id&&"column"===t[s.id]?.key)return S.warning(P("section_nest_not_allowed")),r(),void H();let d={...t};if("add"===p){const t=Bt(m),n=U(t),{newBlockMap:s,rootId:u}=nn(d,n);if(!u)return void r();d=Yt(s,e,o,a,u),i(d,l,"add"),c({id:u,data:d[u],type:"edit"})}else{const t=s.id;if(q(d,t,e))return r(),void H();const n=Vt(d,l,t);if(!n)return void r();{const{result:t,removedId:l}=V(d,n);d=t?G(t,n.containerId,n.cellIndex,P):d,l&&(d=Yt(d,e,o,a,l))}i(d,l,"move"),c({...s,data:d[t]??s.data,type:"edit"})}break}case"drag-over-column":{const e=Number(n.dataset.index);let o,a=[...l],d={...t};if("add"===p){const t=Bt(m);if("column"===t.key){const n=U(t),{newBlockMap:l,rootId:i}=nn(d,n);if(!i)return void r();d=l,a.splice(e,0,i),o={id:i,data:d[i],type:"edit"}}else{const n=e>=a.length?a[a.length-1]:a[e],l=d[n];if(!l||"column"!==l.key)return void r();const{newBlockMap:i,rootId:s}=nn(d,t);if(!s)return void r();d=i;const c=0,u=d[n]?.cells?.[c],p=u?.childrenIds?.[0],m=p?d[p]:null;if("empty"===m?.key)d=Yt(d,n,c,0,s);else{d=Zt(d,n,c,u?.childrenIds?.length??0,s)}o={id:s,data:d[s],type:"edit"}}}else{const t=s.id,n=l.indexOf(t);if(-1===n)return void r();a.splice(n,1),a.splice(e>n?e-1:e,0,t),o={...s,type:"edit"}}i(d,a,"move"),c(o),"add"===p&&"column"===o?.data?.key&&Mi(o.data)===Ui&&Fi(o.id),setTimeout(()=>{const e=document.getElementsByClassName("block-drag-label-content");Array.from(e).forEach(e=>{const t=e.querySelector(".block-move-top");t&&(t.style.visibility="hidden")})},30);break}case"block-item-move":{const e=n.dataset.dropKey;if(!e)return void r();const[o,a,d]=e.split(":"),u=Number(a),g=Number(d);let h,y={...t};if("add"===p){if("column"===m.key)return S.warning(P("section_nest_not_allowed")),r(),void H();const e=Bt(m),t=U(e),{newBlockMap:n,rootId:l}=nn(y,t);if(!l)return void r();y=Zt(n,o,u,g,l),h={id:l,data:y[l],type:"edit"}}else{const e=s.id;if("column"===y[e]?.key)return S.warning(P("section_nest_not_allowed")),r(),void H();if(q(y,e,o))return r(),void H();const t=Vt(y,l,e);if(!t)return void r();const{blockMap:n,removedId:a}=Xt(y,t.containerId,t.cellIndex,t.itemIndex);y=n;const i=y[t.containerId];if(i&&0===i.cells[t.cellIndex].childrenIds.length){const e=Wt(P("drag_block_here"));y={...y,[e.id]:e,[t.containerId]:{...i,cells:i.cells.map((n,o)=>o===t.cellIndex?{...n,childrenIds:[e.id]}:n)}}}let c=g;t.containerId===o&&t.cellIndex===u&&t.itemIndex<g&&(c=g-1),y=Zt(y,o,u,c,a),h={...s,type:"edit"}}i(y,l,"move"),c(h),setTimeout(()=>{const e=document.getElementsByClassName("block-content-drag-label-content");Array.from(e).forEach(e=>{e.children[0]&&(e.children[0].style.visibility="hidden")})},30);break}}r()}else r()},onDragLeave:e=>{const t=e.currentTarget,n=e.relatedTarget,o=nd(e.target);setTimeout(()=>{if(t&&t.contains(n))switch(o?.dataset?.type){case"empty-block":o.style.border="";break;case"empty-block-item":o?.classList?.contains("block-empty-content")&&(o.style.border="")}else H()},50)},children:[qe(Qc,{templateName:v,onTemplateNameChange:w,onBack:x,onSaveTemplate:C,onSaveTemplateIntent:N,onSendTest:L,onSendTestIntent:T,saveStatusDetail:B,onExit:A,onPreview:I,hideOverflowExportActions:$,onShowShortcuts:()=>D(!0)}),Je("div",{className:"email-editor-main",onClick:e=>{e.preventDefault(),e.stopPropagation(),c(null)},children:[qe(qc,{clearStyles:H}),qe(or,{clearStyles:H}),qe(Sc,{clearStyles:H})]})]})]})},ld="markopolo-email-editor:undo:";const ad=e=>Array.isArray(e)?e.map(e=>e&&"object"==typeof e?{...e,children:ad(e.children)}:e):e&&"object"==typeof e?Object.values(e).map(e=>e&&"object"==typeof e?{...e,children:ad(e.children)}:e):[],id=e=>{const t={},n=(e,o=[])=>{Array.isArray(e)&&e.forEach(e=>{if(!e||"object"!=typeof e)return;const l={blockId:e.id??null,key:e.key??null,containerType:"column"===e.key?e.containerType??"none":null},a=[...o,l];if("text"===e.key&&"dynamic"===e.contentType){const n="string"==typeof e.dynamicPrompt?e.dynamicPrompt.trim():"",o="string"==typeof e.dynamicSelectedContent?e.dynamicSelectedContent.trim():"";if(!n&&!o)return;t[e.id]={blockId:e.id,path:a,key:e.key,type:e.type||"p",selectedContent:o,options:Array.isArray(e.dynamicOptions)?e.dynamicOptions:[],prompt:n,variable:e.dynamicVariable??"",language:"bn-BD"===e.dynamicAiLanguage?"bn-BD":"en"}}Array.isArray(e.children)&&n(e.children,a)})};return n(e,[]),t},rd=e=>Array.isArray(e)?e.map(e=>{if(!e||"object"!=typeof e)return e;const{dynamicPrompt:t,dynamicOptions:n,dynamicSelectedContent:o,dynamicVariable:l,dynamicAiLanguage:a,staticTextBeforeAi:i,children:r,...s}=e;return{...s,children:rd(r)}}):e,sd=d(({defaultBlockList:e,defaultBodySettings:t,fillProductSlots:n,aiContentRefs:s,language:c="en",customLanguageLibraries:d,templateData:m,variableDefinitions:g,apiConfig:h={},aiEnabled:y=!0,saveState:b="saved",onChange:f,undoPersistenceKey:_=null,onShortcutSave:k,onSaveBlockAsGlobal:v,templateName:w="",onTemplateNameChange:x,onBack:S,onSaveTemplate:C,onSaveTemplateIntent:N,onSendTest:L,onSendTestIntent:T,saveStatusDetail:B,onExit:A,onPreview:I,hideOverflowExportActions:$=!1,universals:P=[]},R)=>{const[M,D]=a(()=>{if("undefined"==typeof window)return!1;try{return"1"===window.localStorage.getItem("ee_high_contrast_editor")}catch{return!1}});r(()=>{if("undefined"!=typeof window)try{window.localStorage.setItem("ee_high_contrast_editor",M?"1":"0")}catch{}},[M]),r(()=>{var e;po=(e=g)&&"object"==typeof e?e:uo,vo()},[g]);const U=l(()=>oa(h),[h]),[E,z]=a([]),[F,O]=a(!1),W=o(async()=>{if(U?.companyId){O(!0);try{const e=await async function(e,t={}){const n=ia(e),o=e?.companyId;if(!n||!o)return[];const l=new URLSearchParams({companyId:String(o),page:String(t.page??1),limit:String(t.limit??100)});null!=t.blockType&&String(t.blockType).trim()&&l.set("blockType",String(t.blockType)),"boolean"==typeof t.isActive&&l.set("isActive",String(t.isActive));const a=await fetch(`${n}?${l.toString()}`,{method:"GET",headers:{...e?.headers||{}}}),i=await a.text();let r;try{r=i?JSON.parse(i):{}}catch{return[]}if(!a.ok)return console.warn("[universal-email-blocks]",a.status,r),[];const s=r?.data;return Array.isArray(s)?s.map(sa).filter(Boolean):[]}(U,{limit:100});z(Array.isArray(e)?e:[])}catch(e){console.warn("[EmailEditor] universal email blocks fetch",e)}finally{O(!1)}}else z([])},[U]);r(()=>{W()},[W]);const j=l(()=>{const e=E??[],t=P??[];if(!U?.companyId)return t;const n=new Set;return e.filter(e=>{const t=String(e?.resourceId??e?.id??"");return!(!t||n.has(t))&&(n.add(t),!0)})},[U?.companyId,E,P]),H=o(async e=>{U?.companyId&&(await async function(e,{name:t,block:n}){const o=ia(e),l=e?.companyId;if(!o||!l)throw new Error("Universal blocks API: missing endpoint or companyId");const a=la(t,n,l),i=await fetch(o,{method:"POST",headers:ra(e),body:JSON.stringify(a)}),r=await i.text();let s;try{s=r?JSON.parse(r):{}}catch{s={message:r}}if(!i.ok)throw new Error(aa(s,i.status));return s?.data??s}(U,e),await W()),"function"==typeof v&&await Promise.resolve(v(e))},[U,v,W]),K=o(async e=>{U?.companyId&&(await async function(e,t){const n=ia(e),o=e?.companyId;if(!n||!o||!t)throw new Error("Universal blocks API: missing endpoint, companyId, or id");const l=new URLSearchParams({companyId:String(o)}),a=`${n}/${encodeURIComponent(String(t))}?${l}`,i=await fetch(a,{method:"DELETE",headers:{...e?.headers||{}}});if(204===i.status)return!0;if(!i.ok){const e=await i.text();let t;try{t=e?JSON.parse(e):{}}catch{t={message:e}}throw new Error(aa(t,i.status))}return!0}(U,e),await W())},[U,W]),V=e&&!Array.isArray(e)&&"object"==typeof e?e:null,G=V?V.blocks??V.blockList??[]:e,q=(J=G,Array.isArray(J)?J.map(e=>e&&"object"==typeof e?{...e,children:ad(e.children)}:e):J&&"object"==typeof J?Object.values(J).map(e=>e&&"object"==typeof e?{...e,children:ad(e.children)}:e):[]);var J;const Y=s??V?.aiContentRefs??{},X=t??V?.bodySettings??Nn.bodySettings,Z=void 0!==n?!1!==n:void 0!==V?.fillProductSlots?!1!==V.fillProductSlots:Cn,Q=m??Nn.templateData,ee=((e,t)=>{if(!Array.isArray(e))return e;const n=t?.content?.products;if(!Array.isArray(n)||0===n.length)return e;const o=t?.content?.primaryProductId,l=(o?n.find(e=>e?.id===o):n[0])??n[0]??zr[0]??null;if(!l)return e;const a=n.filter(e=>e?.id!==l.id),i=e=>{if(!e||"object"!=typeof e)return e;const t=Array.isArray(e.children)?e.children.map(i):e.children;if("column"!==e.key||"product"!==e.containerType)return{...e,children:t};const n="additional"===e.productRole?"additional":"main",o=Math.max(Array.isArray(t)?t.length:0,Array.isArray(e.columnProducts)?e.columnProducts.length:0,1),r=Array.from({length:o},(e,t)=>"main"===n||0===a.length?l:a[t%a.length]);return{...e,children:t,columnProducts:r}};return e.map(i)})(q,Q),te=function(e,t={}){const n=Array.isArray(e)?e:e&&"object"==typeof e?Object.values(e):null;if(!Array.isArray(n))return e;const o=n.map(e=>Zl(e,t));return o.forEach(Lt),o}(ee,Y),{blockMap:ne,rootOrder:oe}=jt(te),le=Rt(ne,Q),ae=l(()=>function(e){if("undefined"==typeof sessionStorage||!e)return null;try{const t=sessionStorage.getItem(ld+e);if(!t)return null;const n=JSON.parse(t);return n&&"object"==typeof n?{undoStack:Array.isArray(n.undoStack)?n.undoStack:[],redoStack:Array.isArray(n.redoStack)?n.redoStack:[]}:null}catch{return null}}(_),[_]),[ie,re]=u(Rn,{...Nn,blockMap:le,rootOrder:oe,blockList:te,bodySettings:{...X,contentWidth:Et(X?.contentWidth)},fillProductSlots:Z,languageLibraries:d,templateData:Q,undoStack:ae?.undoStack??[],redoStack:ae?.redoStack??[]}),se=i(null);r(()=>{_&&function(e,t,n){if("undefined"!=typeof sessionStorage&&e)try{sessionStorage.setItem(ld+e,JSON.stringify({undoStack:t,redoStack:n}))}catch{}}(_,ie.undoStack,ie.redoStack)},[_,ie.undoStack,ie.redoStack]),r(()=>{re(vn(m??null,{skipUndo:!0}))},[m]);const[ce,de]=a([]);r(()=>{if("undefined"==typeof document)return;const e=ie.blockList??[],t="ee-font-runtime-imports",n=document.getElementById(t)||Object.assign(document.createElement("style"),{id:t}),o=tl(e,ie.bodySettings,ie.templateData);n.textContent=o||"",n.parentNode||document.head.appendChild(n)},[ie.blockList,ie.bodySettings,ie.templateData]);const ue=l(()=>new Set(ce),[ce]),pe=o(e=>(Array.isArray(e)?e:[]).filter(e=>!ue.has(ma(e))),[ue]),me=o(e=>{const t=ma(e);t&&de(e=>e.includes(t)?e:[...e,t])},[]),ge=o(()=>{const e=ie.blockList??[];return{blockList:rd(e),bodySettings:ie.bodySettings??null,aiContentRefs:id(e),language:ga(e),fillProductSlots:!1!==ie.fillProductSlots}},[ie.blockList,ie.bodySettings,ie.fillProductSlots]),he=l(()=>pe(Ia({blockList:ie.blockList??[],bodySettings:ie.bodySettings??null,aiContentRefs:id(ie.blockList??[])})).filter(e=>e?.blockId&&("warning"===e.severity||"error"===e.severity||"info"===e.severity)).reduce((e,t)=>{const n=t.blockId,o=e[n]??{severity:t.severity,warningCount:0,errorCount:0,infoCount:0,totalCount:0,messages:[],issues:[]};return"error"===t.severity&&(o.errorCount+=1),"warning"===t.severity&&(o.warningCount+=1),"info"===t.severity&&(o.infoCount+=1),o.totalCount+=1,o.severity=o.errorCount>0?"error":o.warningCount>0?"warning":"info",o.messages.push(t.message),o.issues.push(t),e[n]=o,e},{}),[ie.blockList,ie.bodySettings,pe]);p(R,()=>({blockList:rd(ie.blockList??[]),bodySettings:ie.bodySettings,fillProductSlots:!1!==ie.fillProductSlots,aiContentRefs:id(ie.blockList??[]),actionType:ie.actionType,exportJson:ge,filterIgnoredValidationIssues:pe,ignoreValidationIssue:me,focusBlock:e=>{if(!e||!ie.blockMap?.[e])return!1;const t=ie.blockMap[e],n="column"===t?.key?Kt(e,ie.blockMap)??t:t;return re(kn({id:e,data:n,type:"edit"})),re(_n("edit")),"undefined"!=typeof window&&window.requestAnimationFrame(()=>{const t="function"==typeof window.CSS?.escape?window.CSS.escape(String(e)):String(e).replace(/([ #;?%&,.+*~':\x22!^$\x5b\x5d()=>|/@])/g,"\\$1"),n=document.querySelector(`[data-block-id="${t}"]`);n&&"function"==typeof n.scrollIntoView&&n.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})}),!0},exportHtml:()=>Gl({bodySettings:ie.bodySettings,blockList:ie.blockList,templateData:ie.templateData})}),[ie.blockList,ie.blockMap,ie.bodySettings,ie.fillProductSlots,ie.actionType,ie.templateData,ge,pe,me]),r(()=>{"function"==typeof f&&"firstRender"!==ie.actionType&&f({blockList:rd(ie.blockList??[]),bodySettings:ie.bodySettings??null,aiContentRefs:id(ie.blockList??[]),fillProductSlots:!1!==ie.fillProductSlots,actionType:ie.actionType})},[ie.blockList,ie.bodySettings,ie.fillProductSlots,ie.actionType,f]);const ye=o(e=>{re((e=>({type:an,isDragStart:e}))(e))},[]),be=o((e,t,n)=>{t&&re(_n(t)),re(((e,t={})=>({type:dn,bodySettings:e,skipUndo:Boolean(t.skipUndo)}))(e,n||{}))},[]),fe=o((e,t,n)=>{t&&re(_n(t)),re(((e,t={})=>({type:un,fillProductSlots:!1!==e,skipUndo:Boolean(t.skipUndo)}))(e,n||{}))},[]),_e=o((e,t,n,o)=>{n&&re(_n(n)),re(((e,t,n={})=>({type:ln,blockMap:e,rootOrder:t,skipUndo:Boolean(n.skipUndo)}))(e,t,o||{}))},[]),ke=o((e,t,n)=>{t&&re(_n(t)),re(((e,t={})=>({type:on,blockList:e,skipUndo:Boolean(t.skipUndo)}))(e,n||{}))},[]),ve=o(e=>{re((e=>({type:sn,previewMode:e}))(e))},[]),we=o(e=>{re(kn(e))},[]),xe=o(e=>{re((e=>({type:pn,selectionRange:e}))(e))},[]),Se=o(e=>{re((e=>({type:mn,textRange:e}))(e))},[]),Ce=o(e=>{re(_n(e))},[]),Ne=o(e=>{re((e=>({type:gn,language:e}))(e))},[]),Le=o(e=>{re((e=>({type:hn,languageLibraries:e}))(e))},[]),Te=o((e,t)=>{re(vn(e,t||{}))},[]),Be=o(()=>{try{se.current?.()}catch{}},[]),Ae=o(e=>(se.current=e,()=>{se.current===e&&(se.current=null)}),[]),Ie=o(()=>{Be(),re({type:bn})},[Be]),$e=o(()=>{Be(),re({type:fn})},[Be]),Pe=l(()=>({blockMap:ie.blockMap,rootOrder:ie.rootOrder,blockList:ie.blockList,actionType:ie.actionType,previewMode:ie.previewMode,currentItem:ie.currentItem,bodySettings:ie.bodySettings,fillProductSlots:!1!==ie.fillProductSlots,isDragStart:ie.isDragStart,selectionRange:ie.selectionRange,textRange:ie.textRange,language:ie.language,languageLibraries:ie.languageLibraries,templateData:ie.templateData,apiConfig:U,validationMarkers:he,ignoreValidationIssue:me,aiEnabled:y,saveState:b,highContrastEditor:M,canUndo:ie.undoStack.length>0,canRedo:ie.redoStack.length>0,undo:Ie,redo:$e,flushPendingRichText:Be,registerRichTextFlush:Ae,onShortcutSave:k,onSaveBlockAsGlobal:H,templateName:w,onTemplateNameChange:x,onBack:S,onSaveTemplate:C,onSaveTemplateIntent:N,onSendTest:L,onSendTestIntent:T,saveStatusDetail:B,onExit:A,onPreview:I,hideOverflowExportActions:$,universals:j,universalsLoading:F,deleteUniversalEmailBlock:U?.companyId?K:void 0,setIsDragStart:ye,setBodySettings:be,setFillProductSlots:fe,setBlocks:_e,setBlockList:ke,setPreviewMode:ve,setCurrentItem:we,setSelectionRange:xe,setTextRange:Se,setActionType:Ce,setLanguage:Ne,setLanguageLibraries:Le,setTemplateData:Te,setHighContrastEditor:D}),[ie.blockMap,ie.rootOrder,ie.blockList,ie.actionType,ie.previewMode,ie.currentItem,ie.bodySettings,ie.fillProductSlots,ie.isDragStart,ie.selectionRange,ie.textRange,ie.language,ie.languageLibraries,ie.templateData,ie.undoStack.length,ie.redoStack.length,U,he,me,y,b,M,Ie,$e,Be,Ae,k,H,w,x,S,C,N,L,T,B,A,I,$,j,F,K,ye,be,fe,_e,ke,ve,we,xe,Se,Ce,Ne,Le,Te,D]);return qe(Ln.Provider,{value:Pe,children:qe(od,{language:c})})});const cd=["Product","Discount"],dd=["text","image","button"];function ud(e,t,n,o,l,a,i){if("column"===e.key&&e.containerType){const t=function(e){const t=e.toLowerCase();return"product"===t?"Product":"discount"===t?"Discount":"None"}(e.containerType),n=e.id??null;let r=o;"Product"===t&&(i.productIndex++,r=i.productIndex);for(const o of e.children??[])ud(o,t,n,r,l,a,i);return}if("content"===e.key){for(const r of e.children??[])ud(r,t,n,o,l,a,i);return}const r="dynamic"===e.contentType,s=cd.includes(t)&&dd.includes(e.key);if((r||s)&&n){let i=l.find(e=>e.containerId===n);i||(i={containerId:n,containerType:t,blocks:[]},l.push(i));const c=e.id?a[e.id]:void 0,d=function(e){return"image"===e.key?e.src??"":"button"===e.key?e.linkURL??"":e.text??""}(e);let u="";"Product"===t?u=function(e,t){const n=`product ${t}`;return e.includes("{{ProductImage}}")?`This block is meant for displaying the ${n} image`:e.includes("{{ProductName}}")?`This block is meant for displaying the ${n} name`:e.includes("{{ProductOldPrice}}")||e.includes("{{ProductNewPrice}}")?`This block is meant for displaying the ${n} original and discounted price`:e.includes("{{ProductPrice}}")||e.includes("{{ProductCurrency}}")?`This block is meant for displaying the ${n} price and currency`:e.includes("{{ProductDescription}}")?`This block is meant for displaying the ${n} description`:e.includes("{{ProductLink}}")?`This block is meant for displaying the ${n} link`:`This block is meant for displaying ${n} content`}(d,o):"Discount"===t&&(u=function(e){const t=[];return e.includes("{{DiscountValue}}")&&t.push("the discount value (e.g. 20% or $10)"),e.includes("{{DiscountCode}}")&&t.push("the discount/promo code"),e.includes("{{ValidUntil}}")&&t.push("the discount expiry date"),0===t.length?"This block is meant for displaying discount/offer information":`This block is meant for displaying ${t.join(", ")}`}(d));const p=c?.prompt||u,m=s&&!r;i.blocks.push({id:e.id??"",contentType:m||"dynamic"===e.contentType?"dynamic":"static",value:m?"":d,ai:{prompt:p,selectedSampleAiContent:m?"":c?.selectedContent??d}})}if(e.children)for(const r of e.children)ud(r,t,n,o,l,a,i)}const pd={text:"text",image:"src",button:"linkURL"};function md(e,t){if(0===t.size)return!0;if(e.id&&t.has(e.id)){const n=t.get(e.id),o=pd[e.key];o&&(e[o]=n,t.delete(e.id))}if(e.children)for(const n of e.children)if(md(n,t))return!0;return 0===t.size}var gd=Object.freeze({__proto__:null,jsonToHtml:function(e){return ql(e)},normalizeJson:function(e){const t="string"==typeof e?JSON.parse(e):e,n=[],o=t.aiContentRefs||{},l={productIndex:0},a=t.blockList||[];for(const e of a)ud(e,"None",null,0,n,o,l);return{groups:n}},updateJsonWithMlContent:function(e,t){const n="string"==typeof e?JSON.parse(e):e,o=structuredClone(n),l=new Map;for(const e of t)e.variations.length>0&&l.set(e.nodeId,e.variations[0].value);const a=o.blockList||[];for(const e of a)if(md(e,l))break;return o}});function hd(e,t={}){const{validate:n=!0}=t,o=e?.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 l=o.exportJson();if(!l||"object"!=typeof l)throw new Error("exportTemplateJson: exportJson() returned an invalid payload.");return{payload:l,issues:n?Ia({blockList:l.blockList,bodySettings:l.bodySettings,aiContentRefs:l.aiContentRefs}):[]}}async function yd(e,t={}){const{validate:n=!0,checkImages:o=!0,imageProbe:l}=t,a=e?.current;if(!a||"function"!=typeof a.exportJson)throw new Error("exportTemplateJsonAsync: ref must be attached to EmailEditor (expected ref.current.exportJson to be a function).");const i=a.exportJson();if(!i||"object"!=typeof i)throw new Error("exportTemplateJsonAsync: exportJson() returned an invalid payload.");if(!n)return{payload:i,issues:[]};return{payload:i,issues:o?await Ea({blockList:i.blockList,bodySettings:i.bodySettings,aiContentRefs:i.aiContentRefs},l):Ia({blockList:i.blockList,bodySettings:i.bodySettings,aiContentRefs:i.aiContentRefs})}}const bd=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."});function fd(e={}){const t={name:"",website:"",navigation_links:[],social_links:{}},n={brand_color:"#111111",logo_url:"",tagline:"",heroBanner:"",footerBanner:""},o=null;return{content:{...{products:[],primaryProductId:null},...e.content&&"object"==typeof e.content?e.content:{}},companyContext:{...t,...e.companyContext&&"object"==typeof e.companyContext?e.companyContext:{}},brandContext:{...n,..."string"==typeof e.brandColor&&e.brandColor.trim()?{brand_color:e.brandColor.trim()}:{},...e.brandContext&&"object"==typeof e.brandContext?e.brandContext:{}},companyId:null!=e.companyId?e.companyId:o}}function _d(e){const t=[];if(null==e||"object"!=typeof e)return{ok:!1,warnings:["templateData must be a non-null object"]};const n=e;if(null!=n.content&&"object"!=typeof n.content)t.push("templateData.content should be an object when provided");else if(n.content&&"object"==typeof n.content){const e=n.content;null==e.products||Array.isArray(e.products)||t.push("templateData.content.products should be an array when provided")}if(null==n.catalogProducts||Array.isArray(n.catalogProducts)||t.push("templateData.catalogProducts should be an array when provided"),null!=n.companyContext&&"object"!=typeof n.companyContext&&t.push("templateData.companyContext should be an object when provided"),null!=n.brandContext&&"object"!=typeof n.brandContext&&t.push("templateData.brandContext should be an object when provided"),n.brandContext&&"object"==typeof n.brandContext){const e=n.brandContext;null!=e.brand_color&&"string"!=typeof e.brand_color&&t.push("templateData.brandContext.brand_color should be a string when provided")}return{ok:0===t.length,warnings:t}}export{ta as DEFAULT_EMAIL_TEMPLATE_ID,Ql as DEFAULT_MARKOPOLO_API_BASE_V1,ea as DEFAULT_ML_GENERATION_API_BASE_V1,sd as EmailEditor,bd as TEMPLATE_DATA_SCHEMA,fd as createDefaultTemplateData,sd as default,ql as exportNormalizerToHtml,hd as exportTemplateJson,yd as exportTemplateJsonAsync,oa as mergeMarkopoloApiConfig,gd as utils,Ia as validateExportPayload,Ea as validateExportPayloadComplete,Ua as validateImageUrlsReachable,_d as validateTemplateDataShape};
|