useblocks 1.3.14 → 1.3.16

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.
Files changed (87) hide show
  1. package/CHANGELOG.md +50 -1
  2. package/iframe/.vite/manifest.json +4 -4
  3. package/iframe/{iframe-eblock.cd84d2b9.html → iframe-eblock.7594857d.html} +2 -2
  4. package/iframe/{iframe.cd84d2b9.html → iframe.7594857d.html} +2 -2
  5. package/iframe/js/elMarkupHelper.CsLyPjC1.js +278 -0
  6. package/iframe/js/{iframe-eblock.body.cd84d2b9.js → iframe-eblock.body.7594857d.js} +1 -1
  7. package/iframe/js/iframe-eblock.js +2 -2
  8. package/iframe/js/iframe.body.7594857d.js +129 -0
  9. package/iframe/js/iframe.js +2 -2
  10. package/package.json +1 -1
  11. package/runtime/react/index.js +1 -1
  12. package/static/core/{f9238279.js → 16612c9f.js} +1 -1
  13. package/static/core/{33588588.js → 1e160f23.js} +1 -1
  14. package/static/core/{b5da36e5.js → 23e22cd2.js} +1 -1
  15. package/static/core/25562e5d.js +1 -0
  16. package/static/core/2633e871.js +1 -0
  17. package/static/core/{58c51568.js → 2740933f.js} +3 -3
  18. package/static/core/{d4513bf2.js → 2a8b14c0.js} +1 -1
  19. package/static/core/{36ffa6e4.js → 2ae78ac6.js} +1 -1
  20. package/static/core/{4bfd6086.js → 31e587ab.js} +1 -1
  21. package/static/core/3454ca99.js +1 -0
  22. package/static/core/36071466.js +2 -0
  23. package/static/core/{18b86617.js → 3cd95e0a.js} +1 -1
  24. package/static/core/{6c59da82.js → 3e1acefc.js} +1 -1
  25. package/static/core/3e80379e.js +4 -0
  26. package/static/core/{209e2686.js → 3f3feb86.js} +1 -1
  27. package/static/core/{39d9efa2.js → 4adb5ee9.js} +7 -7
  28. package/static/core/4e07805d.js +19 -0
  29. package/static/core/{3a605273.js → 4f8847e6.js} +1 -1
  30. package/static/core/519dfcc7.js +4 -0
  31. package/static/core/{a6303cb2.js → 53c22855.js} +1 -1
  32. package/static/core/{f4e70f7f.js → 552f7d30.js} +2 -2
  33. package/static/core/{c571b1dd.js → 5de3cd2c.js} +1 -1
  34. package/static/core/{5cac7517.js → 66853555.js} +1 -1
  35. package/static/core/{b1edf5c5.js → 69688fad.js} +6 -6
  36. package/static/core/713de1e1.js +1 -0
  37. package/static/core/{de3f9bdc.js → 7ae6cf52.js} +7 -7
  38. package/static/core/{57948058.js → 80907514.js} +1 -1
  39. package/static/core/{5d315649.js → 86f73ee9.js} +1 -1
  40. package/static/core/{6100ddd2.js → 8b9a4f49.js} +1 -1
  41. package/static/core/9348ac64.js +1 -0
  42. package/static/core/9da6c313.js +1 -0
  43. package/static/core/{5f0554d8.js → a004861a.js} +1 -1
  44. package/static/core/aeec5659.js +1 -0
  45. package/static/core/b492a9b0.js +93 -0
  46. package/static/core/{e37ba502.js → b6418818.js} +1 -1
  47. package/static/core/{9d0b4233.js → beebdf4d.js} +1 -1
  48. package/static/core/c03fc17e.js +7 -0
  49. package/static/core/c3344bbc.js +1 -0
  50. package/static/core/{e0282a25.js → c3544cf4.js} +1 -1
  51. package/static/core/{4224aefb.js → cc4458d8.js} +1 -1
  52. package/static/core/{87edea39.js → d551e71d.js} +1 -1
  53. package/static/core/{ce93456f.js → d5be6857.js} +1 -1
  54. package/static/core/{605267a0.js → d6c7eb44.js} +1 -1
  55. package/static/core/d9ff5568.js +1 -0
  56. package/static/core/{f4b9148a.js → e2710fd3.js} +1 -1
  57. package/static/core/{2209544a.js → e7c7173a.js} +3 -3
  58. package/static/core/{1dfb486f.js → e81b521f.js} +3 -3
  59. package/static/core/{92fb4e07.js → e94e24b5.js} +1 -1
  60. package/static/core/{1a17438d.js → e98b0c61.js} +2 -2
  61. package/static/core/{e35eca7d.js → ec079650.js} +1 -1
  62. package/static/core/ecc4d431.js +1 -0
  63. package/static/core/f0f20c47.js +1 -0
  64. package/static/core/{550803ff.js → f5d42c73.js} +1 -1
  65. package/static/core/{ff7d14e8.js → f674f125.js} +1 -1
  66. package/static/core/{5a21c667.js → f97efb0a.js} +1 -1
  67. package/static/core/{b4e4af36.js → ff0af9ff.js} +1 -1
  68. package/static/esm/1d0ba521.js +1 -0
  69. package/static/umd-runtime/{runtime.DAdCc3rx.js → runtime.8gUPr0nE.js} +1 -1
  70. package/useblocks-core.7594857d.js +875 -0
  71. package/useblocks-esm.js +12 -12
  72. package/{useblocks-po.cd84d2b9.js → useblocks-po.7594857d.js} +1 -1
  73. package/useblocks.js +13 -13
  74. package/vendor/useblocks-ui-kit/package.json +1 -1
  75. package/iframe/js/elMarkupHelper.CgToMPJX.js +0 -278
  76. package/iframe/js/iframe.body.cd84d2b9.js +0 -129
  77. package/static/core/1c9acdf4.js +0 -1
  78. package/static/core/243ff5f9.js +0 -19
  79. package/static/core/555c0dda.js +0 -1
  80. package/static/core/5661be7c.js +0 -7
  81. package/static/core/8f57829b.js +0 -1
  82. package/static/core/91d46f38.js +0 -4
  83. package/static/core/a8634edd.js +0 -2
  84. package/static/core/bff175af.js +0 -4
  85. package/static/core/c6114314.js +0 -93
  86. package/static/esm/c5372168.js +0 -1
  87. package/useblocks-core.cd84d2b9.js +0 -875
@@ -1,129 +0,0 @@
1
- __useblocks__.define("js/iframe.js",["require","exports","module","js/elMarkupHelper.CgToMPJX.js"],function($,Ke,Ze){const s=$("./elMarkupHelper.CgToMPJX.js");var z="confetti:open-settings",U="confetti:start",j="confetti:stop",G="confetti:complete",Y=class{constructor(e){s._defineProperty(this,"_app",void 0),s._defineProperty(this,"_state","idle"),s._defineProperty(this,"_activeEffects",new Map),s._defineProperty(this,"_onDocumentClick",r=>{const i=r.target;if(!i)return;const n=i.closest(".confetti-placeholder");if(!n)return;const l=n.getAttribute("data-confetti-preset")||void 0;this._app.use("MessageService").send(z,{preset:l})}),this._app=e}init(){const e=this._app.use("MessageService");e.addListener(U,r=>this._handleStart(r.id,r.options)),e.addListener(j,r=>this._handleStop(r.id)),document.addEventListener("click",this._onDocumentClick,!0)}_handleStart(e,r){const i={id:e,options:r,startTime:Date.now()};this._activeEffects.set(e,i),this._state="running",this.onEffectStart(e,r),this.renderConfetti(e,r);const n=r.duration||3e3;setTimeout(()=>{this._completeEffect(e)},n)}_handleStop(e){if(this._state="stopping",e==="all")for(const r of this._activeEffects.keys())this._completeEffect(r,!0);else this._completeEffect(e,!0)}_completeEffect(e,r=!1){this._activeEffects.get(e)&&(this._activeEffects.delete(e),this.clearConfetti(e,r),this.onEffectComplete(e),this._activeEffects.size===0&&(this._state="idle"),this._app.use("MessageService").send(G,{id:e}))}onEffectStart(e,r){}onEffectComplete(e){}getState(){return this._state}isRunning(){return this._state==="running"}dispose(){document.removeEventListener("click",this._onDocumentClick,!0),this._handleStop("all"),this._activeEffects.clear()}},X=class extends Y{constructor(e){super(e),s._defineProperty(this,"_containers",new Map)}renderConfetti(e,r){const i=this._getRenderBounds(),n=document.createElement("div");n.id=`confetti-${e}`,n.setAttribute("data-confetti-overlay","true"),n.style.cssText=`
2
- position: absolute;
3
- top: ${i.top}px;
4
- left: ${i.left}px;
5
- width: ${i.width}px;
6
- height: ${i.height}px;
7
- pointer-events: none;
8
- z-index: 2147483647;
9
- overflow: hidden;
10
- display: block;
11
- line-height: 0;
12
- font-size: 0;
13
- `,n.innerHTML=this._generateStaticSvg(r,i.width,i.height),document.body.appendChild(n),this._containers.set(e,n)}clearConfetti(e,r){const i=this._containers.get(e);i&&(i.remove(),this._containers.delete(e))}_generateStaticSvg(e,r,i){const{particleCount:n=100,angle:l=90,spread:o=45,colors:t=["#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff"],originX:a=.5,originY:d=.5}=e,c=Math.max(r,320),u=Math.max(i,220),f=Math.max(Math.min(c,u)*.48,140),p=(Math.max(e.duration||3e3,1800)/1e3).toFixed(2),h=a===.5?.22:a,y=d===.5?.62:d,m=c*h,b=u*y,T=[],R=[];for(let M=0;M<n;M++){const W=(l-o/2+Math.random()*o)*(Math.PI/180),I=30+Math.random()*f,Ge=m+Math.cos(W)*I,Ye=b-Math.sin(W)*I,w=Ge-m,B=Ye-b,H=t[Math.floor(Math.random()*t.length)],S=6+Math.random()*10,L=Math.random()*360,D=90+Math.random()*180,C=.78+Math.random()*.22,k=(1.6+Math.random()*1.8).toFixed(2),E=(Math.random()*.35).toFixed(2);if(Math.random()>.5?T.push(`
14
- <g transform="translate(${m} ${b})">
15
- <circle cx="0" cy="0" r="${S/2}" fill="${H}" opacity="${C}">
16
- <animateTransform attributeName="transform" type="translate" values="0 0; ${w*.72} ${B*.72}; ${w} ${B}" dur="${k}s" begin="${E}s" repeatCount="indefinite" />
17
- <animate attributeName="opacity" values="0; ${C}; ${C}; 0" dur="${k}s" begin="${E}s" repeatCount="indefinite" />
18
- <animate attributeName="r" values="${Math.max(S*.28,2)}; ${S/2}; ${Math.max(S*.18,1.5)}" dur="${k}s" begin="${E}s" repeatCount="indefinite" />
19
- </circle>
20
- </g>
21
- `):T.push(`
22
- <g transform="translate(${m} ${b}) rotate(${L})">
23
- <rect x="${-S/2}" y="${-Math.max(S/4,2)}" width="${S}" height="${Math.max(S/2,4)}" fill="${H}" opacity="${C}" rx="2" ry="2">
24
- <animateTransform attributeName="transform" type="translate" values="0 0; ${w*.74} ${B*.74}; ${w} ${B}" dur="${k}s" begin="${E}s" repeatCount="indefinite" additive="sum" />
25
- <animateTransform attributeName="transform" type="rotate" values="${L}; ${L+D}; ${L+D*1.7}" dur="${k}s" begin="${E}s" repeatCount="indefinite" additive="sum" />
26
- <animate attributeName="opacity" values="0; ${C}; ${C}; 0" dur="${k}s" begin="${E}s" repeatCount="indefinite" />
27
- </rect>
28
- </g>
29
- `),M<Math.max(8,Math.floor(n/6))){const g=10+Math.random()*10,Xe=m+w*(.35+Math.random()*.45),Ve=b+B*(.2+Math.random()*.5),O=(Math.random()*.6).toFixed(2);R.push(`
30
- <g transform="translate(${Xe} ${Ve})">
31
- <path
32
- d="M0 ${-g/2} L${g/6} ${-g/6} L${g/2} 0 L${g/6} ${g/6} L0 ${g/2} L${-g/6} ${g/6} L${-g/2} 0 L${-g/6} ${-g/6} Z"
33
- fill="rgba(255,255,255,0.9)"
34
- opacity="0"
35
- filter="url(#confettiGlow)"
36
- >
37
- <animate attributeName="opacity" values="0;0.9;0" dur="1.4s" begin="${O}s" repeatCount="indefinite" />
38
- <animateTransform attributeName="transform" type="scale" values="0.6;1;0.6" dur="1.4s" begin="${O}s" repeatCount="indefinite" />
39
- </path>
40
- </g>
41
- `)}}return`
42
- <svg
43
- xmlns="http://www.w3.org/2000/svg"
44
- viewBox="0 0 ${c} ${u}"
45
- width="${c}"
46
- height="${u}"
47
- preserveAspectRatio="none"
48
- style="display:block;width:100%;height:100%;pointer-events:none"
49
- >
50
- <defs>
51
- <filter id="confettiGlow" x="-50%" y="-50%" width="200%" height="200%">
52
- <feGaussianBlur stdDeviation="2.5" result="blur" />
53
- <feMerge>
54
- <feMergeNode in="blur" />
55
- <feMergeNode in="SourceGraphic" />
56
- </feMerge>
57
- </filter>
58
- <radialGradient id="confettiAura" cx="50%" cy="50%" r="50%">
59
- <stop offset="0%" stop-color="rgba(255,255,255,0.95)" />
60
- <stop offset="45%" stop-color="rgba(255,255,255,0.32)" />
61
- <stop offset="100%" stop-color="rgba(255,255,255,0)" />
62
- </radialGradient>
63
- <linearGradient id="confettiTrail" x1="0" y1="0" x2="1" y2="1">
64
- <stop offset="0%" stop-color="rgba(255,255,255,0.9)" />
65
- <stop offset="100%" stop-color="rgba(255,255,255,0)" />
66
- </linearGradient>
67
- </defs>
68
- <rect width="100%" height="100%" fill="transparent" />
69
- <g transform="translate(${m} ${b})">
70
- <circle cx="0" cy="0" r="18" fill="url(#confettiAura)" opacity="0.7">
71
- <animate attributeName="r" values="12;34;18" dur="${p}s" repeatCount="indefinite" />
72
- <animate attributeName="opacity" values="0.75;0.18;0.55" dur="${p}s" repeatCount="indefinite" />
73
- </circle>
74
- <circle cx="0" cy="0" r="4" fill="#ffffff" opacity="0.95" filter="url(#confettiGlow)">
75
- <animate attributeName="r" values="3;7;3" dur="1.6s" repeatCount="indefinite" />
76
- <animate attributeName="opacity" values="0.7;1;0.55" dur="1.6s" repeatCount="indefinite" />
77
- </circle>
78
- <path d="M0 0 L58 -14" stroke="url(#confettiTrail)" stroke-width="5" stroke-linecap="round" opacity="0.65">
79
- <animate attributeName="opacity" values="0.1;0.7;0.1" dur="1.8s" repeatCount="indefinite" />
80
- </path>
81
- </g>
82
- ${R.join("")}
83
- ${T.join("")}
84
- </svg>
85
- `}_getRenderBounds(){const e=this._getPlaceholderElement();if(e){const n=e.getBoundingClientRect(),l=320,o=220,t=Math.max(document.documentElement.clientWidth,window.innerWidth||0),a=Math.max(document.documentElement.clientHeight,window.innerHeight||0),d=n.right+12,c=n.left-l-12,u=d+l<=t?d:Math.max(8,c);return{top:Math.min(Math.max(8,n.top+n.height/2-o/2),Math.max(8,a-o-8))+window.scrollY,left:u+window.scrollX,width:l,height:o}}const r=this._getRenderRoot();if(!r)return{top:window.scrollY,left:window.scrollX,width:Math.max(window.innerWidth,800),height:Math.max(window.innerHeight,600)};const i=r.getBoundingClientRect();return{top:i.top+window.scrollY,left:i.left+window.scrollX,width:Math.max(Math.ceil(r.scrollWidth||i.width),Math.ceil(i.width),320),height:Math.max(Math.ceil(r.scrollHeight||i.height),Math.ceil(i.height),240)}}_getRenderRoot(){for(const e of['[em="block-contaner"]',".es-wrapper-color",".es-content-body",".es-content","body > table","body > div"]){const r=document.querySelector(e);if(r instanceof HTMLElement)return r}return document.body}_getPlaceholderElement(){const e=document.querySelector(".confetti-placeholder");return e instanceof HTMLElement?e:null}onEffectStart(e,r){}onEffectComplete(e){}dispose(){for(const e of this._containers.values())e.remove();this._containers.clear(),super.dispose()}},V=[X];function K(e){const r=e.find(t=>t instanceof DocumentType),i=document.documentElement;let n=e.find(t=>t instanceof HTMLHtmlElement);if(!n){n=i||document.createElement("html");let t=e.find(d=>d instanceof HTMLHeadElement);if(t&&t.parentNode!==n){const d=document.head;if(d){n.replaceChild(t,d);for(const c of d.childNodes)t.appendChild(c)}else n.insertBefore(t,n.firstChild)}let a=e.find(d=>d instanceof HTMLBodyElement);if(!a){a=document.body||document.createElement("body");const d=e.filter(c=>c!==t&&c!==r).reverse();if(d.length){let c=null;for(const u of d)(u.parentNode!==a||u.nextSibling!==c)&&a.insertBefore(u,c),c=u}}if(a.parentNode!==n){const d=document.body;if(d){n.replaceChild(a,d);for(const c of d.childNodes)a.appendChild(c)}else n.appendChild(a)}}const l=[...n.childNodes];if(!l.find(t=>t instanceof HTMLHeadElement)){const t=e.find(a=>a instanceof HTMLHeadElement)||document.createElement("head");n.insertBefore(t,n.firstChild)}if(!l.find(t=>t instanceof HTMLBodyElement)){const t=e.find(a=>a instanceof HTMLBodyElement)||document.createElement("body");n.appendChild(t)}const o=document.doctype;return o!==r&&(o?r?document.replaceChild(r,o):document.removeChild(o):r&&document.insertBefore(r,document.firstChild)),i!==n&&(i?n?document.replaceChild(n,i):document.removeChild(i):n&&document.appendChild(n)),e}var Z='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',Q={name:"email",mapHTMLRoots:K,createRoot:(e,r)=>{const n=r.length;let l=e.find(c=>c.tag==="html"),o=e.find(c=>c.type===s.NodeType.DOCTYPE);if(!l){e=e.filter(c=>c!==o),l=new s.Node(0,n,e),l.createdBy="createRoot",l.tag="html",l.children=e;for(const c of e)c.parent=l;l.startTagEnd=0,l.endTagStart=n,e=[l]}let t=l.children.find(c=>c.tag==="body"),a=l.children.find(c=>c.tag==="head");if(!t){const c=l.children.filter(u=>u!==a);t=new s.Node(a?a.end:l.startTagEnd||l.start,l.endTagStart||l.end,c,l),t.createdBy="createRoot",t.startTagEnd=t.start,t.endTagStart=t.end;for(const u of c)u.parent=t;t.tag="body",l.children=a?[a,t]:[t]}a||(a=new s.Node(l.startTagEnd||l.start,l.startTagEnd||l.start,[],l),a.createdBy="createRoot",a.startTagEnd=a.start,a.endTagStart=a.start,a.tag="head",l.children.unshift(a)),o||(o=new s.Node(0,0,[]),o.createdBy="createRoot",o.startTagEnd=0,o.endTagStart=0,o.type=s.NodeType.DOCTYPE,o.content=Z,e.unshift(o));const d=new s.Node(0,n,e);d.type=s.NodeType.ROOT;for(const c of e)c.parent=d,c.type===s.NodeType.ELEMENT&&c.tag!=="html"?(c.type=s.NodeType.COMMENT,c.content=r.substring(c.start,c.end),c.children=[]):c.type===s.NodeType.HTML&&(c.type=s.NodeType.COMMENT,c.content=c.content||"");return d}},Qe=s.require_iframeResizer_contentWindow_min();function J(){return s.messageService.addListenerAsync(s.EVENT_TYPES.SANDBOX_IS_EMAIL_EMPTY,e=>{const r=document.querySelector(".em-narrow-table");return r?!(r.querySelectorAll("tr").length>0):!0})}function ee(e){return{blocks:e.querySelectorAll('[em="block"]').length,textLength:(e.body?.textContent??"").replace(/\s+/g," ").trim().length}}function te(){return s.messageService.addListenerAsync(s.EVENT_TYPES.SANDBOX_CANVAS_HEALTH,()=>ee(document))}function oe(e){if(!e)return{backgroundColor:void 0,backgroundImage:void 0,backgroundPositionX:void 0,backgroundPositionY:void 0,backgroundRepeat:void 0,backgroundSize:void 0};const r={};if(e.style.backgroundColor?r.backgroundColor=e.style.backgroundColor:e.getAttribute("bgcolor")&&(r.backgroundColor=e.getAttribute("bgcolor")||void 0),e.style.backgroundImage){const i=e.style.backgroundImage;r.backgroundImage=[{type:"url",value:i?i.substring(5,i.length-2):""}]}else e.getAttribute("background")&&(r.backgroundImage=[{type:"url",value:e.getAttribute("background")||""}]);return r.backgroundPositionX=e.style.backgroundPositionX||void 0,r.backgroundPositionY=e.style.backgroundPositionY||void 0,r.backgroundRepeat=e.style.backgroundRepeat||void 0,r.backgroundSize=e.style.backgroundSize||void 0,r}function re(e){if(e){if(document.querySelector(".es-header")||document.querySelector(".es-content")||document.querySelector(".es-footer")){const r=e.querySelector(".es-content"),i=e.querySelector(".es-content-body");return parseFloat(r?.style.width||"")||parseFloat(i?.style.width||"")||void 0}if(document.querySelector(".nl-container")&&document.querySelector(".row")){const r=document.querySelector(".row-content");return parseFloat(r?.style.width||"")||parseFloat(r?.getAttribute("width")||"")||void 0}if(document.querySelector(".nl-container")&&!document.querySelector(".row")){const r=e.querySelector('[style*="max-width"]');return parseFloat(r?.style.maxWidth||"")||void 0}if(document.querySelector('[class*="letteros"]')||document.querySelector("[letteros-link]")){const r=e.querySelector("table:first-child");if(r?.style.maxWidth)return parseFloat(r.style.maxWidth)||void 0}if(document.querySelector(".container-div")){const r=e.querySelector("div:first-child");if(r?.style.maxWidth)return parseFloat(r.style.maxWidth)||void 0}if(document.querySelector(".email-container")){const r=document.querySelector(".email-container");return parseFloat(r?.getAttribute("width")||"")||void 0}return ie(e)}}function ie(e){const r=e.querySelector("table:first-child");if(!r)return;const i=parseFloat(r.getAttribute("width")||""),n=parseFloat(r.style.maxWidth||"");if(i>700||n>700){const o=e.querySelector('table:first-child [em="block"] > td > table');if(o){const t=o.getAttribute("width");return t&&t.indexOf("%")===-1?parseFloat(t):o.style.maxWidth?parseFloat(o.style.maxWidth):e.querySelector('table:first-child [em="block"]')?.clientWidth||660}return 660}const l=r.getAttribute("width");if(l&&l.indexOf("%")===-1)return parseFloat(l);if(r.style.maxWidth)return parseFloat(r.style.maxWidth)}function ne(e,r){const i={shutdown:void 0,styles:!0};if(!e||!r)return i;const n=e.querySelector("table:first-child");if(!n)return i;const l=n.getAttribute("width"),o=parseFloat(n.style.minWidth||"");return l&&l.indexOf("%")===-1&&o===parseFloat(l)||e.querySelector(".noresp-em-narrow-table")?{shutdown:!1,styles:!1}:{shutdown:!0,styles:!0}}var le=2;function ae(e,r){!e||!r||document.querySelector(".noresp-em-narrow-table, .em-narrow-table")&&(e.getBoundingClientRect().width<=r||document.querySelectorAll("img").forEach(i=>{const n=i.closest("td")?.getBoundingClientRect().width;n&&parseFloat(i.getAttribute("width")||"")>n+le&&n>10&&i.style.display!=="none"&&(i.setAttribute("width",String(Math.ceil(n))),i.style.maxWidth=Math.ceil(n)+"px")}))}function se(e){const r=e.findGlobalHolder();e.setGlobalHolder(r);const i={operation:"application_email_settings_set",settings:{subject:e.getSubject(),preheader:e.getPreheader(),responsive:{shutdown:void 0,styles:!0},structuresMedia:!(document.querySelector('[em="block"] div[style*="display: inline-block"]')&&!document.querySelector('[em="block"] .em-mob-wrap, [em="block"] .noresp-em-mob-wrap')),usedColors:e.getUsedColors(),noBlocks:!1,width:{value:void 0,dim:"px"},backgroundColor:void 0,backgroundImage:void 0,backgroundPositionX:void 0,backgroundPositionY:void 0,backgroundRepeat:void 0,backgroundSize:void 0,backgroundColorContent:void 0}};if(r){const a=oe(r);a.backgroundColor&&a.backgroundColor.startsWith("rgb")&&(a.backgroundColor=e.rgbToHex(a.backgroundColor)),Object.assign(i.settings,a)}e.elMarkupHelper(),document.querySelector('[em="block"]')||(i.settings.noBlocks=!0);const n=re(r),l=e.state.get("emailWidth"),o=e.getEmailWidth(),t=typeof l=="number"&&l>=320?l:typeof o=="number"&&o>=320?o:n;i.settings.width.value=t,r&&(i.settings.responsive=ne(r,t),typeof t=="number"&&e.state.set("emailWidth",t)),e.messageService.send(i),ae(r,e.getEmailWidth())}function de(e,r=!1){e.closeEditorInit(),document.body&&(e.removeHiddenClasses(document),se(e),e.commit(!1))}function A(e,r){r[1]==="Sans Serif"?e.style.fontFamily="Helvetica, Arial, sans-serif":r[1]==="Serif"?e.style.fontFamily='"Times New Roman", Times, serif':r[1]==="Project Fonts"&&s.applyProjectFontInlineFallback(e,r[2])}function ce(e,r){const i=e?.toLowerCase();return i==="#ffffff"&&i!==r?.toLowerCase()}function ue(e,r){const{lockEditor:i,commonStyles:n,globalHolder:l}=r;if(i)return;const o=document.querySelectorAll('div[style*="font-family"]');me(e,o,r),fe(e,o,r),ye(e,r),he(e,r),ve(e,r),Ce(e,r);const t={operation:"application_commonStyles_update",settings:{commonStyles:n}};r.messageService.send(t)}function me(e,r,i){const{commonStyles:n,rgbToHex:l}=i;if(e.textFontFamily!==void 0){let o=[];r.forEach(t=>{const a=t;let d;!a.style.display&&parseFloat(a.style.fontSize)<=20&&(o=e.textFontFamily,o[0]==="Safe Fonts"?(a.style.fontFamily=o[1],(d=[...a.classList].filter(c=>c.startsWith("em-font-"))[0])&&(a.classList.remove(d),n.text.fontFamily?.[2]&&i.clearLinkTags({elem:document.documentElement,fontFamilyClassName:s.buildEmFontClassName(n.text.fontFamily[2],n.text.fontFamily[3])}),i.clearProjectFontFaces())):o[0]==="Google Fonts"&&(A(a,o),i.removeClassesByPrefix(a,"em-font"),a.classList.add(i.createFontClassName(o)),s.markProjectFontClass(a,o)))}),o.length>0&&o[0]==="Google Fonts"&&i.addFontFamilyClass({fontFamilyArray:o}),i.clearProjectFontFaces(),n.text.fontFamily=e.textFontFamily}e.textFontSize!==void 0&&(r.forEach(o=>{const t=o;!t.style.display&&parseFloat(t.style.fontSize)<=20&&parseFloat(t.style.fontSize)>14&&(t.style.fontSize=e.textFontSize+"px")}),n.text.fontSize=e.textFontSize),e.textLineHeight!==void 0&&(r.forEach(o=>{const t=o;!t.style.display&&parseFloat(t.style.fontSize)<=20&&parseFloat(t.style.fontSize)>14&&(t.style.lineHeight=e.textLineHeight+"px")}),n.text.lineHeight=e.textLineHeight),e.textColor!==void 0&&(r.forEach(o=>{const t=o;!t.closest(".em-contrast-block")&&!t.style.display&&parseFloat(t.style.fontSize)<=20&&!ce(l(t.style.color),l(n.text.color))&&(t.style.color=e.textColor)}),n.text.color=e.textColor),e.textContrastColor!==void 0&&(r.forEach(o=>{const t=o;t.closest(".em-contrast-block")&&!t.style.display&&parseFloat(t.style.fontSize)<=20&&(t.style.color=e.textContrastColor)}),n.text.contrastColor=e.textContrastColor),e.textPaddingBottom!==void 0&&(r.forEach(o=>{const t=o;if(t.closest('[em="atom"]')){if(!t.style.display&&parseFloat(t.style.fontSize)<=20&&t.closest("table")?.getAttribute("em")=="atom"){const a=t.closest('[em="atom"]')?.querySelector(":scope > tr > td, :scope > tbody > tr > td");a&&(a.style.paddingBottom=e.textPaddingBottom+"px",a.querySelector(":scope > .em-vindent-paddingBottom")?.remove())}}else if(t.nextElementSibling){const a=t.nextElementSibling;if(!t.style.display&&parseFloat(t.style.fontSize)<=20&&t.parentElement?.getAttribute("em")=="atom"&&a&&a.tagName=="TABLE"&&(a.classList.contains("em-vindent-table")||a.querySelector("td")?.innerHTML=="")){a.querySelector("td")?.setAttribute("height",e.textPaddingBottom);const d=a.querySelector(".em-element-vindent-value");d&&(d.innerHTML=e.textPaddingBottom+"px",e.textPaddingBottom<30?a.querySelector(".em-vindent")?.classList.add("em-vindent_low"):a.querySelector(".em-vindent")?.classList.remove("em-vindent_low"))}}}),n.text.paddingBottom=e.textPaddingBottom)}function fe(e,r,i){const{commonStyles:n,rgbToHex:l}=i;if(e.headingFontFamily!==void 0){let o=[];r.forEach(t=>{const a=t;let d;!a.style.display&&parseFloat(a.style.fontSize)>20&&l(a.style.color).toLowerCase()!=="#eb3737"&&(o=e.headingFontFamily,o[0]==="Safe Fonts"?(a.style.fontFamily=o[1],(d=[...a.classList].filter(c=>c.startsWith("em-font-"))[0])&&(a.classList.remove(d),n.headings.fontFamily?.[2]&&i.clearLinkTags({elem:document.documentElement,fontFamilyClassName:s.buildEmFontClassName(n.headings.fontFamily[2],n.headings.fontFamily[3])}),i.clearProjectFontFaces())):o[0]==="Google Fonts"&&(A(a,o),i.removeClassesByPrefix(a,"em-font"),a.classList.add(i.createFontClassName(o)),s.markProjectFontClass(a,o)))}),o.length>0&&o[0]==="Google Fonts"&&i.addFontFamilyClass({fontFamilyArray:o}),i.clearProjectFontFaces(),n.headings.fontFamily=e.headingFontFamily}e.headingFontSize!==void 0&&(r.forEach(o=>{const t=o;!t.style.display&&parseFloat(t.style.fontSize)>=20&&l(t.style.color).toLowerCase()!=="#eb3737"&&parseFloat(t.style.fontSize)<=40&&(t.style.fontSize=e.headingFontSize+"px")}),n.headings.fontSize=e.headingFontSize),e.headingLineHeight!==void 0&&(r.forEach(o=>{const t=o;!t.style.display&&parseFloat(t.style.fontSize)>20&&l(t.style.color).toLowerCase()!=="#eb3737"&&parseFloat(t.style.fontSize)<=40&&(t.style.lineHeight=e.headingLineHeight+"px")}),n.headings.lineHeight=e.headingLineHeight),e.headingLetterSpacing!==void 0&&(r.forEach(o=>{const t=o;!t.style.display&&parseFloat(t.style.fontSize)>20&&l(t.style.color).toLowerCase()!=="#eb3737"&&(e.headingLetterSpacing>0?t.style.letterSpacing=e.headingLetterSpacing+"px":t.style.removeProperty("letter-spacing"))}),n.headings.letterSpacing=e.headingLetterSpacing),e.headingBold!==void 0&&(r.forEach(o=>{const t=o;!t.style.display&&parseFloat(t.style.fontSize)>20&&l(t.style.color).toLowerCase()!=="#eb3737"&&(e.headingBold?t.querySelector("b")?t.querySelector("b").replaceWith(...t.querySelector("b").childNodes):t.querySelector("strong")||(t.innerHTML="<strong>"+t.innerHTML+"</strong>"):t.querySelector("strong")?t.querySelector("strong").replaceWith(...t.querySelector("strong").childNodes):t.querySelector("b")&&t.querySelector("b").replaceWith(...t.querySelector("b").childNodes),t.style.fontWeight&&t.style.removeProperty("font-weight"))}),n.headings.bold=e.headingBold),e.headingItalic!==void 0&&(r.forEach(o=>{const t=o;!t.style.display&&parseFloat(t.style.fontSize)>20&&l(t.style.color).toLowerCase()!=="#eb3737"&&(e.headingItalic?t.querySelector("i")?t.querySelector("i").replaceWith(...t.querySelector("i").childNodes):t.querySelector("em")||(t.innerHTML="<em>"+t.innerHTML+"</em>"):t.querySelector("em")?t.querySelector("em").replaceWith(...t.querySelector("em").childNodes):t.querySelector("i")&&t.querySelector("i").replaceWith(...t.querySelector("i").childNodes),t.style.fontStyle&&t.style.removeProperty("font-style"))}),n.headings.italic=e.headingItalic),e.headingColor!==void 0&&(r.forEach(o=>{const t=o;!t.closest(".em-contrast-block")&&!t.style.display&&parseFloat(t.style.fontSize)>20&&l(t.style.color).toLowerCase()!=="#eb3737"&&(t.style.color=e.headingColor)}),n.headings.color=e.headingColor),e.headingContrastColor!==void 0&&(r.forEach(o=>{const t=o;t.closest(".em-contrast-block")&&!t.style.display&&parseFloat(t.style.fontSize)>20&&(t.style.color=e.headingContrastColor)}),n.headings.contrastColor=e.headingContrastColor),pe(e,r,i),e.blockDarkBackgroundColor!==void 0&&(n.block.darkBackgroundColor=e.blockDarkBackgroundColor)}function pe(e,r,i){const{commonStyles:n,rgbToHex:l}=i;e.headingPaddingTop!==void 0&&(r.forEach(o=>{const t=o;if(t.closest('[em="atom"]')){if(!t.style.display&&parseFloat(t.style.fontSize)>20&&l(t.style.color).toLowerCase()!=="#eb3737"&&t.closest("table")?.getAttribute("em")=="atom"){const a=t.closest('[em="atom"]')?.querySelector(":scope > tr > td, :scope > tbody > tr > td");a&&(a.style.paddingTop=e.headingPaddingTop+"px",a.querySelector(":scope > .em-vindent-paddingTop")?.remove())}}else if(t.previousElementSibling){const a=t.previousElementSibling;if(!t.style.display&&parseFloat(t.style.fontSize)>20&&l(t.style.color).toLowerCase()!=="#eb3737"&&t.parentElement?.getAttribute("em")=="atom"&&a&&a.tagName=="TABLE"&&(a.classList.contains("em-vindent-table")||a.querySelector("td")?.innerHTML=="")){a.querySelector("td")?.setAttribute("height",e.headingPaddingTop);const d=a.querySelector(".em-element-vindent-value");d&&(d.innerHTML=e.headingPaddingTop+"px",e.headingPaddingTop<30?a.querySelector(".em-vindent")?.classList.add("em-vindent_low"):a.querySelector(".em-vindent")?.classList.remove("em-vindent_low"))}}}),n.headings.paddingTop=e.headingPaddingTop),e.headingPaddingBottom!==void 0&&(document.querySelectorAll('div[style*="font-family"]').forEach(o=>{const t=o,a=t.closest('[em="atom"]');if(a){const d=a.querySelector(":scope > tr > td, :scope > tbody > tr > td");d?.style.paddingBottom&&!t.style.display&&parseFloat(t.style.fontSize)>20&&l(t.style.color).toLowerCase()!=="#eb3737"&&t.closest("table")?.getAttribute("em")=="atom"&&(d.style.paddingBottom=e.headingPaddingBottom+"px",d.querySelector(":scope > .em-vindent-paddingBottom")?.remove())}else if(t.nextElementSibling){const d=t.nextElementSibling;if(!t.style.display&&parseFloat(t.style.fontSize)>20&&l(t.style.color).toLowerCase()!=="#eb3737"&&t.parentElement?.getAttribute("em")=="atom"&&d&&d.tagName=="TABLE"&&(d.classList.contains("em-vindent-table")||d.querySelector("td")?.innerHTML=="")){d.querySelector("td")?.setAttribute("height",e.headingPaddingBottom);const c=d.querySelector(".em-element-vindent-value");c&&(c.innerHTML=e.headingPaddingBottom+"px",e.headingPaddingBottom<30?d.querySelector(".em-vindent")?.classList.add("em-vindent_low"):d.querySelector(".em-vindent")?.classList.remove("em-vindent_low"))}}}),n.headings.paddingBottom=e.headingPaddingBottom)}function ye(e,r){const{commonStyles:i}=r,n=document.querySelectorAll('a[style*="color"]');e.linkColor!==void 0&&(n.forEach(l=>{const o=l;!o.closest(".em-contrast-block")&&!o.style.display&&(o.style.color=e.linkColor)}),i.links.color=e.linkColor),e.linkContrastColor!==void 0&&(n.forEach(l=>{const o=l;o.closest(".em-contrast-block")&&!o.style.display&&(o.style.color=e.linkContrastColor)}),i.links.contrastColor=e.linkContrastColor),e.linkUnderline!==void 0&&(n.forEach(l=>{const o=l;if(!o.style.display){o.style.textDecoration=e.linkUnderline?"underline":"none";const t=o.parentElement;t&&t.tagName=="SPAN"&&t.style.textDecoration=="underline"&&t.replaceWith(...t.childNodes)}}),i.links.underline=e.linkUnderline)}function he(e,r){const{commonStyles:i}=r,n=document.querySelectorAll('a[style*="font-family"]');if(e.buttonsFontFamily!==void 0){let l=[];n.forEach(o=>{const t=o;let a;t.style.display&&t.style.display=="block"&&(l=e.buttonsFontFamily,l[0]==="Safe Fonts"?(t.style.fontFamily=l[1],(a=[...t.classList].filter(d=>d.startsWith("em-font-"))[0])&&(t.classList.remove(a),i.buttons.fontFamily?.[2]&&r.clearLinkTags({elem:document.documentElement,fontFamilyClassName:s.buildEmFontClassName(i.buttons.fontFamily[2],i.buttons.fontFamily[3])}),r.clearProjectFontFaces())):l[0]==="Google Fonts"&&(A(t,l),r.removeClassesByPrefix(t,"em-font"),t.classList.add(r.createFontClassName(l)),s.markProjectFontClass(t,l)))}),l.length>0&&l[0]==="Google Fonts"&&r.addFontFamilyClass({fontFamilyArray:l}),r.clearProjectFontFaces(),i.buttons.fontFamily=e.buttonsFontFamily}e.buttonsFontSize!==void 0&&(n.forEach(l=>{const o=l;o.style.display&&o.style.display=="block"&&(o.style.fontSize=e.buttonsFontSize+"px")}),i.buttons.fontSize=e.buttonsFontSize),e.buttonsLetterSpacing!==void 0&&(n.forEach(l=>{const o=l;o.style.display&&o.style.display=="block"&&(e.buttonsLetterSpacing>0?o.style.letterSpacing=e.buttonsLetterSpacing+"px":o.style.removeProperty("letter-spacing"))}),i.buttons.letterSpacing=e.buttonsLetterSpacing),be(e,n,r),ge(e,n,r),Se(e,n,r)}function be(e,r,i){const{commonStyles:n}=i;e.buttonsColor!==void 0&&(r.forEach(l=>{const o=l;!o.closest(".em-contrast-block")&&o.style.display&&o.style.display=="block"&&(o.style.color=e.buttonsColor)}),n.buttons.color=e.buttonsColor),e.buttonsContrastColor!==void 0&&(r.forEach(l=>{const o=l;o.closest(".em-contrast-block")&&o.style.display&&o.style.display=="block"&&(o.style.color=e.buttonsContrastColor)}),n.buttons.contrastColor=e.buttonsContrastColor),e.buttonsBold!==void 0&&(r.forEach(l=>{const o=l;o.style.display&&o.style.display=="block"&&(e.buttonsBold?o.querySelector("b")?o.querySelector("b").replaceWith(...o.querySelector("b").childNodes):o.querySelector("strong")||(o.innerHTML="<strong>"+o.innerHTML+"</strong>"):o.querySelector("strong")?o.querySelector("strong").replaceWith(...o.querySelector("strong").childNodes):o.querySelector("b")&&o.querySelector("b").replaceWith(...o.querySelector("b").childNodes),o.style.fontWeight&&o.style.removeProperty("font-weight"))}),n.buttons.bold=e.buttonsBold),e.buttonsItalic!==void 0&&(r.forEach(l=>{const o=l;o.style.display&&o.style.display=="block"&&(e.buttonsItalic?o.querySelector("i")?o.querySelector("i").replaceWith(...o.querySelector("i").childNodes):o.querySelector("em")||(o.innerHTML="<em>"+o.innerHTML+"</em>"):o.querySelector("em")?o.querySelector("em").replaceWith(...o.querySelector("em").childNodes):o.querySelector("i")&&o.querySelector("i").replaceWith(...o.querySelector("i").childNodes),o.style.fontStyle&&o.style.removeProperty("font-style"))}),n.buttons.italic=e.buttonsItalic),e.buttonsBackgroundColor!==void 0&&(r.forEach(l=>{const o=l;if(!o.closest(".em-contrast-block")&&o.style.display&&o.style.display=="block"){const t=o.closest("td");t&&(t.getAttribute("bgcolor")&&(e.buttonsBackgroundColor?t.setAttribute("bgcolor",e.buttonsBackgroundColor):t.removeAttribute("bgcolor")),e.buttonsBackgroundColor?t.style.backgroundColor=e.buttonsBackgroundColor:t.style.removeProperty("background-color"))}}),n.buttons.backgroundColor=e.buttonsBackgroundColor),e.buttonsContrastBackgroundColor!==void 0&&(r.forEach(l=>{const o=l;if(o.closest(".em-contrast-block")&&o.style.display&&o.style.display=="block"){const t=o.closest("td");t&&(t.getAttribute("bgcolor")&&(e.buttonsContrastBackgroundColor?t.setAttribute("bgcolor",e.buttonsContrastBackgroundColor):t.removeAttribute("bgcolor")),e.buttonsContrastBackgroundColor?t.style.backgroundColor=e.buttonsContrastBackgroundColor:t.style.removeProperty("background-color"))}}),n.buttons.contrastBackgroundColor=e.buttonsContrastBackgroundColor),e.buttonsAlign!==void 0&&(r.forEach(l=>{const o=l;o.style.display&&o.style.display=="block"&&o.closest("td")?.setAttribute("align",e.buttonsAlign)}),n.buttons.textAlign=e.buttonsAlign)}function ge(e,r,i){const{commonStyles:n}=i;e.buttonsMarginTop!==void 0&&(r.forEach(l=>{const o=l,t=o.closest('[em="atom"]');if(t){const a=t.querySelector(":scope > tr > td, :scope > tbody > tr > td");a?.style.paddingTop&&o.style.display&&o.style.display=="block"&&(a.style.paddingTop=e.buttonsMarginTop+"px",a.querySelector(":scope > .em-vindent-paddingTop")?.remove())}else{const a=o.closest("table");if(a?.previousElementSibling){const d=a.previousElementSibling,c=o.closest("div");if(o.style.display&&o.style.display=="block"&&c&&c.getAttribute("em")=="atom"&&d&&d.tagName=="TABLE"&&(d.classList.contains("em-vindent-table")||d.querySelector("td")?.innerHTML=="")){d.querySelector("td")?.setAttribute("height",e.buttonsMarginTop);const u=d.querySelector(".em-element-vindent-value");u&&(u.innerHTML=e.buttonsMarginTop+"px",e.buttonsMarginTop<30?d.querySelector(".em-vindent")?.classList.add("em-vindent_low"):d.querySelector(".em-vindent")?.classList.remove("em-vindent_low"))}}}}),n.buttons.marginTop=e.buttonsMarginTop),e.buttonsMarginBottom!==void 0&&(r.forEach(l=>{const o=l,t=o.closest('[em="atom"]');if(t){const a=t.querySelector(":scope > tr > td, :scope > tbody > tr > td");a?.style.paddingBottom&&o.style.display&&o.style.display=="block"&&(a.style.paddingBottom=e.buttonsMarginBottom+"px",a.querySelector(":scope > .em-vindent-paddingBottom")?.remove())}else{const a=o.closest("table");if(a?.previousElementSibling){const d=a.nextElementSibling,c=o.closest("div");if(o.style.display&&o.style.display=="block"&&c&&c.getAttribute("em")=="atom"&&d&&d.tagName=="TABLE"&&(d.classList.contains("em-vindent-table")||d.querySelector("td")?.innerHTML=="")){d.querySelector("td")?.setAttribute("height",e.buttonsMarginBottom);const u=d.querySelector(".em-element-vindent-value");u&&(u.innerHTML=e.buttonsMarginBottom+"px",e.buttonsMarginBottom<30?d.querySelector(".em-vindent")?.classList.add("em-vindent_low"):d.querySelector(".em-vindent")?.classList.remove("em-vindent_low"))}}}}),n.buttons.marginBottom=e.buttonsMarginBottom)}function Se(e,r,i){const{commonStyles:n,setElementBorder:l,setElementBorderRadius:o}=i;e.buttonsBorder!==void 0&&(r.forEach(t=>{const a=t;if(a.style.display&&a.style.display=="block"){const d=a.closest("td");d&&l({settings:{border:e.buttonsBorder},elem:d})}}),e.buttonsBorder.all!==void 0&&(n.buttons.border.all=e.buttonsBorder.all),e.buttonsBorder.top!==void 0&&(n.buttons.border.top=e.buttonsBorder.top),e.buttonsBorder.right!==void 0&&(n.buttons.border.right=e.buttonsBorder.right),e.buttonsBorder.bottom!==void 0&&(n.buttons.border.bottom=e.buttonsBorder.bottom),e.buttonsBorder.left!==void 0&&(n.buttons.border.left=e.buttonsBorder.left)),e.buttonsBorderRadius!==void 0&&(r.forEach(t=>{const a=t;if(a.style.display&&a.style.display=="block"){const d=a.closest("td");d&&o({settings:{borderRadius:e.buttonsBorderRadius},elem:d})}}),e.buttonsBorderRadius.all!==void 0&&(n.buttons.borderRadius.all=e.buttonsBorderRadius.all),e.buttonsBorderRadius.topLeft!==void 0&&(n.buttons.borderRadius.topLeft=e.buttonsBorderRadius.topLeft),e.buttonsBorderRadius.topRight!==void 0&&(n.buttons.borderRadius.topRight=e.buttonsBorderRadius.topRight),e.buttonsBorderRadius.bottomRight!==void 0&&(n.buttons.borderRadius.bottomRight=e.buttonsBorderRadius.bottomRight),e.buttonsBorderRadius.bottomLeft!==void 0&&(n.buttons.borderRadius.bottomLeft=e.buttonsBorderRadius.bottomLeft)),e.buttonsPadding!==void 0&&(r.forEach(t=>{const a=t;a.style.display&&a.style.display=="block"&&(e.buttonsPadding.all!==void 0?(a.style.paddingTop=e.buttonsPadding.all+"px",a.style.paddingRight=e.buttonsPadding.all+"px",a.style.paddingBottom=e.buttonsPadding.all+"px",a.style.paddingLeft=e.buttonsPadding.all+"px"):((e.buttonsPadding.top!==void 0||e.buttonsPadding.top==0)&&(a.style.paddingTop=e.buttonsPadding.top+"px"),(e.buttonsPadding.right!==void 0||e.buttonsPadding.right==0)&&(a.style.paddingRight=e.buttonsPadding.right+"px"),(e.buttonsPadding.bottom!==void 0||e.buttonsPadding.bottom==0)&&(a.style.paddingBottom=e.buttonsPadding.bottom+"px"),(e.buttonsPadding.left!==void 0||e.buttonsPadding.left==0)&&(a.style.paddingLeft=e.buttonsPadding.left+"px")))}),e.buttonsPadding.all!==void 0&&(n.buttons.padding={all:e.buttonsPadding.all}),e.buttonsPadding.top!==void 0&&(n.buttons.padding={top:e.buttonsPadding.top}),e.buttonsPadding.right!==void 0&&(n.buttons.padding={right:e.buttonsPadding.right}),e.buttonsPadding.bottom!==void 0&&(n.buttons.padding={bottom:e.buttonsPadding.bottom}),e.buttonsPadding.left!==void 0&&(n.buttons.padding={left:e.buttonsPadding.left}))}function ve(e,r){const{commonStyles:i,setElementBorder:n,setElementBorderRadius:l}=r;i.cards||(i.cards={});const o=document.querySelectorAll(".em-contrast-card");e.cardsContrastBackgroundColor!==void 0&&(o.forEach(d=>{const c=d;c.getAttribute("bgcolor")&&(e.cardsContrastBackgroundColor?c.setAttribute("bgcolor",e.cardsContrastBackgroundColor):c.removeAttribute("bgcolor")),e.cardsContrastBackgroundColor?c.style.backgroundColor=e.cardsContrastBackgroundColor:c.style.removeProperty("background-color")}),i.cards.contrastBackgroundColor=e.cardsContrastBackgroundColor),e.cardsContrastTextColor!==void 0&&(o.forEach(d=>{d.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(c=>{c.style.color=e.cardsContrastTextColor})}),i.cards.contrastTextColor=e.cardsContrastTextColor);const t=document.querySelectorAll(".em-card");e.cardsBaseBackgroundColor!==void 0&&(t.forEach(d=>{const c=d;c.getAttribute("bgcolor")&&(e.cardsBaseBackgroundColor?c.setAttribute("bgcolor",e.cardsBaseBackgroundColor):c.removeAttribute("bgcolor")),e.cardsBaseBackgroundColor?c.style.backgroundColor=e.cardsBaseBackgroundColor:c.style.removeProperty("background-color")}),i.cards.baseBackgroundColor=e.cardsBaseBackgroundColor),e.cardsBaseTextColor!==void 0&&(t.forEach(d=>{d.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach(c=>{c.style.color=e.cardsBaseTextColor})}),i.cards.baseTextColor=e.cardsBaseTextColor);const a=document.querySelectorAll(".em-card, .em-contrast-card");e.cardsBorderRadius!==void 0&&(i.cards.borderRadius||(i.cards.borderRadius={}),a.forEach(d=>{l({settings:{borderRadius:e.cardsBorderRadius},elem:d})}),e.cardsBorderRadius.all!==void 0&&(i.cards.borderRadius.all=e.cardsBorderRadius.all),e.cardsBorderRadius.topLeft!==void 0&&(i.cards.borderRadius.topLeft=e.cardsBorderRadius.topLeft),e.cardsBorderRadius.topRight!==void 0&&(i.cards.borderRadius.topRight=e.cardsBorderRadius.topRight),e.cardsBorderRadius.bottomRight!==void 0&&(i.cards.borderRadius.bottomRight=e.cardsBorderRadius.bottomRight),e.cardsBorderRadius.bottomLeft!==void 0&&(i.cards.borderRadius.bottomLeft=e.cardsBorderRadius.bottomLeft)),e.cardsBorder!==void 0&&(i.cards.border||(i.cards.border={}),a.forEach(d=>{n({settings:{border:e.cardsBorder},elem:d})}),e.cardsBorder.all&&(i.cards.border.all=e.cardsBorder.all),e.cardsBorder.top&&(i.cards.border.top=e.cardsBorder.top),e.cardsBorder.right&&(i.cards.border.right=e.cardsBorder.right),e.cardsBorder.bottom&&(i.cards.border.bottom=e.cardsBorder.bottom),e.cardsBorder.left&&(i.cards.border.left=e.cardsBorder.left))}function Ce(e,r){const{commonStyles:i,globalHolder:n}=r;if(!n)return;const l=n.classList.contains("full-wrap")?n.querySelector("td"):n;if(!l)return;(e.blockBackgroundColor!==void 0||e.blockBackgroundColor==="")&&F(e.blockBackgroundColor,l,!1,i),(e.blockContrastBackgroundColor!==void 0||e.blockContrastBackgroundColor==="")&&F(e.blockContrastBackgroundColor,l,!0,i);const o=document.querySelectorAll('[em="block"] > td');if(e.blockPadding!==void 0){const t=e.blockPadding;i.block||(i.block={}),i.block.padding||(i.block.padding={});const a=t.left!==void 0||t.right!==void 0;o.forEach(d=>{const c=d;t.top!==void 0&&(c.style.paddingTop=`${t.top}px`),t.right!==void 0&&(c.style.paddingRight=`${t.right}px`),t.bottom!==void 0&&(c.style.paddingBottom=`${t.bottom}px`),t.left!==void 0&&(c.style.paddingLeft=`${t.left}px`)}),["top","right","bottom","left"].forEach(d=>{t[d]!==void 0&&(i.block.padding[d]=t[d])}),a&&o.forEach(d=>{const c=d,u=c.querySelector(".em-mob-wrap"),f=c.parentElement?.getAttribute("em")==="block";u&&f&&c.querySelectorAll(":scope > table").forEach(p=>{r.setStructureBlocksWidth(p)})})}}function F(e,r,i,n){const l=r.querySelector(".em-narrow-table"),o=i?'[em="block"].em-contrast-block > td':'[em="block"]:not(.em-contrast-block) > td',t=i?'[em="block"] > td > table > tr > [bgcolor]':'[em="block"]:not(.em-contrast-block) > td > table > tr > [bgcolor]',a=i?'[em="block"] > td > table > tr > [style*="background-color"]':'[em="block"]:not(.em-contrast-block) > td > table > tr > [style*="background-color"]';l?e===""?r.querySelectorAll(o).forEach(d=>{const c=d;c.removeAttribute("bgcolor"),c.style.removeProperty("background-color")}):r.querySelectorAll(o).forEach(d=>{const c=d;c.setAttribute("bgcolor",e),c.style.backgroundColor=e}):e===""?r.querySelector(t)?r.querySelectorAll(t).forEach(d=>{const c=d;c.removeAttribute("bgcolor"),c.style.removeProperty("background-color")}):r.querySelector(a)&&r.querySelectorAll(a).forEach(d=>{const c=d;c.removeAttribute("bgcolor"),c.style.removeProperty("background-color")}):r.querySelector(t)?r.querySelectorAll(t).forEach(d=>{const c=d;c.style.backgroundColor=e,c.setAttribute("bgcolor",e)}):r.querySelector(a)&&r.querySelectorAll(a).forEach(d=>{const c=d;c.style.backgroundColor=e,c.setAttribute("bgcolor",e)}),i?n.block.contrastBackgroundColor=e:n.block.backgroundColor=e}var ke=320;function _(e){if(e==null||e==="")return null;if(typeof e=="number"&&!Number.isNaN(e))return e;if(typeof e=="object"&&e!==null&&"value"in e){const r=Number(e.value);return Number.isNaN(r)?null:r}return null}function q(){for(const e of document.body.children)if(e.tagName==="DIV"||e.tagName==="CENTER"){const r=e;if(r.style.background||r.style.backgroundColor)return e;for(const i of e.children)if(i.tagName==="DIV"){if(r.style.background||r.style.backgroundColor)return e;for(const n of i.children){const l=n;if(l.getAttribute("width")==="100%"||l.style.width==="100%")return n}}else{const n=i;if(n.getAttribute("width")==="100%"||n.style.width==="100%")return i}}else{const r=e;if(r.getAttribute("width")==="100%"||r.style.width==="100%")return e}return null}function Ee(e,r){const{globalHolder:i,emailWidth:n,state:l,findParentTr:o}=r,t=_(e.width);if(t==null||t<ke||!i)return!1;function a(d){if(d.elem.nodeName==="#comment"&&d.elem.textContent?.indexOf("mso")!==-1)d.elem.textContent=d.elem.textContent.replace(/width=".*"/gi,`width="${d.width}"`);else{const c=d.elem.previousSibling;c&&a({elem:c,width:d.width})}}return i.querySelector(".em-narrow-table")||i.querySelector(".noresp-em-narrow-table")?(Te(i,t,n,a),we(i,e,n,o,a)):Ae(i,t,n,a),n>500&&i.querySelectorAll(`[width="${n}"]`).forEach(d=>{d.setAttribute("width",String(t))}),xe(t),l.set("emailWidth",t),!0}function Te(e,r,i,n){e.querySelectorAll('[style*="width"]').forEach(l=>{const o=l;o.style.verticalAlign||(o.style.width&&parseFloat(o.style.width)===i&&(o.style.width=r+"px"),o.style.maxWidth&&parseFloat(o.style.maxWidth)===i&&(o.style.maxWidth=r+"px"),o.style.minWidth&&parseFloat(o.style.minWidth)===i&&(o.style.minWidth=r+"px"),n({elem:o,width:r}))})}function we(e,r,i,n,l){const o=[];e.querySelectorAll(".em-mob-wrap:nth-child(odd), .noresp-em-mob-wrap:nth-child(odd)").forEach(a=>{const d=n(a);d&&!o.includes(d)&&o.push(d)});const t=r.project==="useblocks"?640:660;o.forEach(a=>{const d=a.querySelector(".em-mob-wrap, .noresp-em-mob-wrap");if(!d)return;const c=d.parentElement?.closest("td"),u=parseFloat(c?.style.paddingLeft||"0")||0,f=parseFloat(c?.style.paddingRight||"0")||0,p=d.closest("table")?.parentElement?.getBoundingClientRect().width||0,h=a.querySelector(".em-mob-wrap:empty, .noresp-em-mob-wrap:empty")?660:t;if(a.querySelectorAll(".em-mob-wrap, .noresp-em-mob-wrap").length>1)Be(a)&&Le(a,p,u,f,h);else if(d.getAttribute("width")&&!d.classList.contains("em-insert-ignore")){const y=Math.round(p-u-f);d.setAttribute("width",String(y))}})}function Be(e){const r=e.querySelectorAll(".em-mob-wrap:nth-child(odd), .noresp-em-mob-wrap:nth-child(odd)");for(let i=0;i<r.length;i++){const n=r[i];if(n.classList.contains("em-insert-ignore"))continue;const l=n.getAttribute("width");if(l!=null&&l!=="")return!0}return!1}function Le(e,r,i,n,l){const o=e.querySelector(".em-mob-wrap:nth-child(even), .noresp-em-mob-wrap:nth-child(even)"),t=o?parseFloat(o.getAttribute("width")||"0"):0,a=e.querySelectorAll(".em-mob-wrap:nth-child(odd), .noresp-em-mob-wrap:nth-child(odd)"),d=a.length;let c=0,u=0;a.forEach(h=>{const y=h;if(y.getAttribute("width")&&!y.classList.contains("em-insert-ignore")){const m=parseFloat(y.getAttribute("width")||"0")/l,b=Math.round(r*m-t/(d*2));y.setAttribute("width",String(b)),c+=b}});const f=r-(i+n+t*(d-1)+c);a.forEach(h=>{const y=h;if(y.getAttribute("width")&&!y.classList.contains("em-insert-ignore")){const m=parseFloat(y.getAttribute("width")||"0")+Math.round(f/d);u+=m,y.setAttribute("width",String(m)),y.querySelectorAll("img").forEach(b=>{parseFloat(b.getAttribute("width")||"0")>m&&(b.setAttribute("width",String(m)),b.style.maxWidth=m+"px")})}}),u=u+t*(d-1)+i+n;const p=r-u;if(p!==0&&c>0){const h=e.querySelector(".em-mob-wrap:last-child, .noresp-em-mob-wrap:last-child");if(h&&!h.classList.contains("em-insert-ignore")){const y=parseFloat(h.getAttribute("width")||"0");h.setAttribute("width",String(y+p))}else{const y=e.querySelectorAll(".em-mob-wrap:nth-child(odd), .noresp-em-mob-wrap:nth-child(odd)");for(let m=y.length-1;m>=0;m--){const b=y[m];if(b.classList.contains("em-insert-ignore"))continue;const T=parseFloat(b.getAttribute("width")||"0");b.setAttribute("width",String(T+p));break}}}}function Ae(e,r,i,n){e.querySelectorAll('div[style*="inline-block"]').forEach(l=>{const o=l;if(!o.getAttribute("em-floatblock-width")){const t=o.parentElement?.getBoundingClientRect().width||1;o.setAttribute("em-floatblock-width",String(o.getBoundingClientRect().width/t))}}),e.querySelectorAll('[style*="width"]').forEach(l=>{const o=l;o.style.verticalAlign||(o.style.width&&parseFloat(o.style.width)===i&&(o.style.width=r+"px"),o.style.maxWidth&&parseFloat(o.style.maxWidth)===i&&(o.style.maxWidth=r+"px"),o.style.minWidth&&parseFloat(o.style.minWidth)===i&&(o.style.minWidth=r+"px"),n({elem:o,width:r}))}),e.querySelectorAll('div[style*="inline-block"]').forEach(l=>{const o=l,t=o.parentElement?.getBoundingClientRect().width||0,a=parseFloat(o.getAttribute("em-floatblock-width")||"0"),d=o.getBoundingClientRect().width-(o.firstElementChild?.getBoundingClientRect().width||0),c=o.getBoundingClientRect().width-d;let u=0;o.style.maxWidth?(o.style.maxWidth=Math.floor(t*a)+"px",u=o.getBoundingClientRect().width-d,o.firstElementChild&&(o.firstElementChild.setAttribute("width",String(Math.round(u))),o.firstElementChild.style.maxWidth=Math.round(u)+"px")):o.style.width&&(o.style.width=Math.floor(t*a)+"px",u=o.getBoundingClientRect().width-d,o.firstElementChild?.setAttribute("width",String(u))),n({elem:o,width:Math.floor(t*a)}),o.removeAttribute("em-floatblock-width"),o.querySelectorAll("img").forEach(f=>{const p=parseFloat(f.getAttribute("width")||"0");(p>=u||p===c)&&(f.setAttribute("width",String(u)),f.style.maxWidth=u+"px")})})}function xe(e){for(const r of document.head.querySelectorAll("style"))if(r.innerHTML.match(/@media.*?max((.|\n|\r)*?){/)){r.innerHTML=r.innerHTML.replace(/max-device-width:\d+px/gi,`max-device-width:${e}px`),r.innerHTML=r.innerHTML.replace(/max-width:\d+px/gi,`max-width:${e}px`);break}}function Me(e,r){e.querySelectorAll("img, amp-img").forEach(i=>{const n=i;if(r){const l=n.getAttribute("width");if(l)if(n.style.width="100%",l.includes("%"))n.style.maxWidth=l;else{const o=parseFloat(l);Number.isNaN(o)||(n.style.maxWidth=`${o}px`)}}else n.style.removeProperty("width"),n.style.removeProperty("max-width")})}function Fe(e,r){if(e.responsive===void 0||!r)return;const i=_(e.width);if(e.responsive.shutdown){const n=r.querySelector(".noresp-em-narrow-table");if(n)n.className=n.className.replace(/noresp-em-narrow/gi,"em-narrow");else{const l=r.querySelector("table:first-child");l&&(l.setAttribute("width","100%"),l.style.width="100%",i!=null&&(l.style.maxWidth=i+"px"),l.style.minWidth="320px")}document.querySelectorAll('[class*="noresp-em-mob"]').forEach(l=>{l.className=l.className.replace(/noresp-em-mob/gi,"em-mob")}),document.documentElement.removeAttribute("style")}else{const n=r.querySelector(".em-narrow-table");if(n)n.className=n.className.replace(/em-narrow/gi,"noresp-em-narrow");else{const l=r.querySelector("table:first-child");l&&i!=null&&(l.setAttribute("width",String(i)),l.style.width=i+"px",l.style.maxWidth=i+"px",l.style.minWidth=i+"px")}document.querySelectorAll('[class*="em-mob"]:not([class*="noresp-em-mob"])').forEach(l=>{l.className=l.className.replace(/em-mob/gi,"noresp-em-mob")})}Me(r,!!e.responsive.shutdown)}function _e(e,r){if(!e||!e.length)return;let i=document.head.querySelector('style[em="styles"]'),n="";i?n=r.getInnerHtml(i):(i=document.createElement("style"),i.setAttribute("em","styles"),i=document.head.insertAdjacentElement("beforeend",i));const l=document.createElement("div");l.insertAdjacentHTML("afterbegin",e.join(`
86
- `));let o=s.minifyStylesheet(n+`
87
- `+[...l.querySelectorAll("style")].map(t=>t.innerHTML).join(`
88
- `),{restructure:!0,forceMediaMerge:!0}).css;o=cssbeautify(o,{indent:" ",autosemicolon:!0}),i&&(i.textContent=`
89
- `+o+`
90
- `)}var P=`<style em="styles">
91
- @media only screen and (max-device-width:660px),only screen and (max-width:660px) {
92
- .em-mob-width-100perc {
93
- width: 100%!important;
94
- max-width: 100%!important;
95
- }
96
- }
97
- </style>
98
- <table cellpadding="0" cellspacing="0" border="0" width="100%" class="em-mob-width-100perc" em="atom"><tr><td style="padding-bottom: 10px;">
99
- <div style="font-family: -apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 21px; color: #5A5A5A;">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div>
100
- </td></tr></table>`,qe=`<style>
101
- @media only screen and (max-device-width: 660px), only screen and (max-width: 660px) {
102
- .em-mob-wrap {
103
- display: block!important;
104
- }
105
- .em-mob-width-100perc {
106
- width: 100%!important;
107
- max-width: 100%!important;
108
- }
109
- .em-mob-padding_right-20 {
110
- padding-right: 20px!important;
111
- }
112
- .em-mob-padding_left-20 {
113
- padding-left: 20px!important;
114
- }
115
- }
116
- </style>
117
- <tr em="block" class="em-structure">
118
- <td align="center" style="padding: 30px 40px;" class="em-mob-padding_left-20 em-mob-padding_right-20" bgcolor="#ffffff">
119
- <table align="center" border="0" cellspacing="0" cellpadding="0" class="em-mob-width-100perc">
120
- <tr>
121
- <td width="600" valign="top" class="em-mob-wrap em-mob-width-100perc">
122
- {{ATOM_HTML}}
123
- </td>
124
- </tr>
125
- </table>
126
- </td>
127
- </tr>`;function Pe(e,r){if(!(e&&(s.isEmptyTable(e)||!e.innerHTML.trim()))||r.getLockEditor())return!1;const i=P.match(/<style((.|\n|\r)*?)<\/style>/g);r.applyStylesToDocument(i||[]);let n=P.replaceAll(/<style((.|\n|\r)*?)<\/style>/gi,"").trim();n=r.commonStylesApply({html:n});let l=qe.replace("{{ATOM_HTML}}",n);const o=l.match(/<style((.|\n|\r)*?)<\/style>/g);r.applyStylesToDocument(o||[]),l=r.commonStylesApplyToBlock({html:l}),(l.indexOf("empty-structure")>-1||l.indexOf("em-structure")>-1)&&(l=r.setFloatBlocksWidth({blockHTML:l,targetBlock:e,project:r.appName})),s.insertAdjacentHTML(s.rowsHost(e),"beforeend",`
128
- `+l+`
129
- `);const t=e.querySelector('[em="block"]:last-child [em="atom"]');if(t){const a=t.querySelector("div");let d=null;a&&(a.innerHTML="",a.appendChild(document.createTextNode("​")),r.wrapEditor(a,!0),a.classList.add("em-just-inserted"),setTimeout(()=>{const c=a.closest("editor")||a,u=c?.querySelector("div")||a,f=u||c||a,p=f.getBoundingClientRect();["mouseover","mousedown","mouseup","click"].forEach(m=>{const b=new MouseEvent(m,{bubbles:!0,cancelable:!0,view:window,clientX:p.left+Math.min(1,Math.max(0,p.width/2)),clientY:p.top+Math.min(1,Math.max(0,p.height/2)),button:0});s.withForeignListenersPaused(()=>f.dispatchEvent(b))});let h=u.firstChild;h||(h=document.createTextNode("​"),u.appendChild(h)),s.withForeignListenersPaused(()=>c?.focus?.());const y=window.getSelection();if(y&&h){const m=document.createRange();m.setStart(h,0),m.collapse(!0),y.removeAllRanges(),s.withForeignListenersPaused(()=>y.addRange(m))}r.setCursorPosition(c||a),r.commit()},0),d=a.closest("editor")||a),a&&r.setCursorPosition(d||a)}return r.messageService.send("application_atom_inserted","text"),r.commit(),!0}function Ne({getGlobalHolder:e,view:r=window}){let i=0;const n=()=>{i=0,s.state.get("previewPage")&&s.fitEmailToWidth(e(),r)},l=()=>{!i&&s.state.get("previewPage")&&(i=r.requestAnimationFrame(n))},o=s.state.subscribeToKey("previewPage",t=>{t?l():s.applyRootScale(r.document.documentElement,1)&&r.parentIFrame?.size?.()});return r.addEventListener("resize",l),l(),{refit:l,dispose:()=>{o(),r.removeEventListener("resize",l),i&&(r.cancelAnimationFrame(i),i=0)}}}var v=s.createIdentifier("SandboxEmailGlobalHolder"),x=s.createIdentifier("SandboxPreviewFit");function Re(){s.setBlockGroupControlsPosition({scrollTop:s.state.get("scrollTop")})}var We=s.defineUnit({name:"sandbox.emailInitialState",setup(){s.editLock.reset(),s.state.update({activeCell:[],globalHolder:null,applicationTheme:"light",iframeOffsetTop:0,scrollTop:0,previewHeight:0,applicationMode:"default",emailWidth:0,elementPath:[],copyPasteEnabled:!0,saveBlockEnabled:!0,editImageControlEnabled:!0,elementAIimageEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterEditorEnabled:!0,blocksAddPanelEnabled:!0,blocksTemplateEnabled:!1,codeMode:!0,appName:"",commonStyles:{},isProgrammaticSelection:!1}),s.implementPolyfills()}}),Ie=s.defineUnit({name:"sandbox.emailGlobalHolder",provides:[v],setup(e){let r=null;s.state.subscribe(i=>{"globalHolder"in i&&(r=i.globalHolder??null)}),e.inject(v,{get:()=>r,set:i=>{r=i}})}}),He=s.defineUnit({name:"sandbox.emailPreview",provides:[s.INIT_PREVIEW_ID,x],awaits:{services:[v,s.SYNC_COMMIT_ID,s.EDIT_LOCK_ID]},setup(e){const r=s.requireService(e,v),i=s.commitOf(e),n=s.requireService(e,s.EDIT_LOCK_ID),l=Ne({getGlobalHolder:()=>r.get()});e.inject(x,l),e.inject(s.INIT_PREVIEW_ID,(o=!1)=>{de({state:s.state,getEmailWidth:()=>s.state.get("emailWidth"),closeEditorInit:()=>n.closeEditorInit(),messageService:s.messageService,removeHiddenClasses:s.removeHiddenClasses,findGlobalHolder:q,elMarkupHelper:()=>s.elMarkupHelper(r.get()),rgbToHex:s.rgbToHex,getSubject:s.getSubject,getPreheader:s.getPreheader,getUsedColors:s.getUsedColors,commit:i,setGlobalHolder:t=>r.set(t)},o),l.refit()})}}),De=s.defineUnit({name:"sandbox.emailInsertPolicy",provides:[s.INSERT_POLICY_ID],setup:e=>e.inject(s.INSERT_POLICY_ID,{})});function N(e){const r=s.requireService(e,s.HTML_DOCUMENT_ID),i=s.commitOf(e);return{commit:i,htmlDocument:r,applyStylesToDocument:n=>_e(n,r),setFloatBlocksWidth:n=>s.setFloatBlocksWidth(n,r),setBlockMaxWidth:n=>s.setBlockMaxWidth(n,r),commonStylesApply:n=>s.commonStylesApply(n,i)}}var Oe=s.defineUnit({name:"sandbox.emailNarrowTable",provides:[s.NARROW_TABLE_TEXT_ATOM_ID],awaits:{services:[s.HTML_DOCUMENT_ID,s.SYNC_COMMIT_ID,s.WRAP_EDITOR_ID,s.SET_CURSOR_ID,s.EDIT_LOCK_ID]},setup(e){const r=N(e),i=s.requireService(e,s.EDIT_LOCK_ID),n=s.requireService(e,s.WRAP_EDITOR_ID).now,l=s.requireService(e,s.SET_CURSOR_ID);e.inject(s.NARROW_TABLE_TEXT_ATOM_ID,o=>Pe(o,{getLockEditor:()=>i.isIntegratorLocked(),applyStylesToDocument:r.applyStylesToDocument,commonStylesApply:r.commonStylesApply,commonStylesApplyToBlock:s.commonStylesApplyToBlock,setFloatBlocksWidth:t=>r.setFloatBlocksWidth({...t,targetBlock:t.targetBlock}),appName:s.state.get("appName"),wrapEditor:n,setCursorPosition:l,messageService:s.messageService,commit:()=>r.commit()}))}}),$e=s.defineUnit({name:"sandbox.emailDocumentServices",awaits:{services:[s.HTML_DOCUMENT_ID,s.FOCUS_ID]},setup(e){const r=s.requireService(e,s.HTML_DOCUMENT_ID),{controller:i}=s.requireService(e,s.FOCUS_ID);J(),te(),s.registerPreheaderService(r,i),s.registerSubjectService(r,i)}}),ze=s.defineUnit({name:"sandbox.emailOperations",awaits:{services:[v,s.HTML_DOCUMENT_ID,s.SYNC_COMMIT_ID,s.SELECTION_LOCK_ID,s.EDIT_LOCK_ID]},setup(e){const r=s.requireService(e,v),i=s.requireService(e,s.SYNC_COMMIT_ID),n=s.requireService(e,s.SELECTION_LOCK_ID),l=s.requireService(e,s.EDIT_LOCK_ID),o=N(e),{commit:t,htmlDocument:a}=o,d=()=>({state:s.state,previewHeight:s.state.get("previewHeight"),iframeOffsetTop:s.state.get("iframeOffsetTop"),scrollTop:s.state.get("scrollTop"),globalHolder:r.get(),setBlockGroupControlsPosition:Re,messageService:s.messageService});s.messageService.addListener(function(c){const u=c.data??{};if(u.operation===s.EVENT_TYPES.SANDBOX_EMAIL_SETTINGS_SET){const f=u.settings??{};r.set(q());const p=r.get();if(p){const m=p.classList.contains("full-wrap")?p.querySelector("td"):p;m&&s.setEmailBackgroundSettings(m,f,s.getPreheaderElem())}f.subject!==void 0&&(document.title=f.subject);const h=Ee(f,{globalHolder:p,emailWidth:s.state.get("emailWidth"),state:s.state,findParentTr:s.findParentTr});Fe(f,p),ue(f,{globalHolder:p,commonStyles:s.state.get("commonStyles"),lockEditor:l.isIntegratorLocked(),removeClassesByPrefix:s.removeClassesByPrefix,createFontClassName:s.createFontClassName,addFontFamilyClass:m=>s.addFontFamilyClass(m,t),clearLinkTags:m=>s.clearLinkTags(m,t),clearProjectFontFaces:()=>s.clearProjectFontFaces(m=>t(m)),rgbToHex:s.rgbToHex,setElementBorder:s.setElementBorder,setElementBorderRadius:s.setElementBorderRadius,setStructureBlocksWidth:s.setStructureBlocksWidth,messageService:s.messageService});const y=Object.keys(f).filter(m=>f[m]!==void 0);(h||!(y.length===1&&y[0]==="width"))&&i.commitLockedAsync()}u.operation===s.EVENT_TYPES.SANDBOX_IFRAME_SETSIZE&&(s.state.get("previewPage")?e.getInstance(x)?.refit():s.iframeSetSize(u.settings,d()))}),s.messageService.addListenerAsync(s.EVENT_TYPES.SANDBOX_GLOBAL_BLOCK_REPLACE,c=>{const u=c??{};return s.globalBlockReplace({emBlockId:u.emBlockId,blockHTML:u.blockHTML,type:u.type,project:u.project,name:u.name},{selectionLock:n,commit:t,lockEditor:l.isIntegratorLocked(),emailWidth:s.state.get("emailWidth"),iframeOffsetTop:s.state.get("iframeOffsetTop"),previewHeight:s.state.get("previewHeight"),parseFromString:f=>s.parseFromString(f),getOuterHtml:s.getOuterHtml,HTMLDocument:a,minify:s.minifyStylesheet,cssbeautify,insertAdjacentHTML:(f,p,h)=>s.insertNewHTML(f,p,h),messageService:s.messageService,setDocumentStyles:f=>s.setDocumentStyles(f,{minify:s.minifyStylesheet,cssbeautify,HTMLDocument:a}),setImageWidth:s.setImageWidth,commonStylesApply:o.commonStylesApply,commonStylesApplyToBlock:s.commonStylesApplyToBlock,insertCountdown:f=>s.insertCountdown(f,t),uptimeCountdown:s.uptimeCountdown,setBlockMaxWidth:o.setBlockMaxWidth,setFloatBlocksWidth:o.setFloatBlocksWidth,fitImagesToColumns:s.fitImagesToColumns,checkBlockAdaptivity:s.checkBlockAdaptivity})})}}),Ue=[Ie,He,De,Oe,$e,ze],je=s.defineSurface({name:"email",profile:Q,units:[s.diagnosticsAgentUnit,We,...s.CANVAS_CORE_UNITS,s.ampUnit,...s.EMAIL_LAYOUT_UNITS,...Ue,s.extensionsUnit(V),s.paintGateUnit,s.wheelBridgeUnit,s.deviceWidthMediaGuardUnit]});s.startSandbox(je)});
@@ -1 +0,0 @@
1
- __useblocks__.define("static/core/1c9acdf4.js",["require","exports","module","static/core/2ff39ddf.js","static/core/cf7d1dd7.js","static/core/74875d47.js","static/core/8f57829b.js"],function(c,f,P){const j=c("./2ff39ddf.js"),n=c("./cf7d1dd7.js"),t=c("./74875d47.js"),p=c("./8f57829b.js");var I=["image/jpeg","image/png","image/jpg","image/webp","image/gif","image/svg+xml"],d=(e,i)=>({code:e,message:i}),E=e=>typeof e!="string";function _(e,i){const a=t.decodeFileNameFromUrl(i)??"image",o=p.normalizeImageFormatForDisplay(e.type);return new File([e],!o||a.includes(".")?a:`${a}.${o}`,{type:e.type||"application/octet-stream"})}async function v(e,i,a){const o=p.getImageBlobResolver(e),g=t.getEmitter(e,n.events.FILE_PROXY_EVENT_ID),r=t.getEmitter(e,n.events.PROXY_URL_EVENT_ID),u=p.canonicalImageUrlKey(i);return _(await o.resolve(u,void 0,(l,m)=>p.fetchEditorImageBlobByUrl(l,{appConfig:t.getAppConfig(e),isStandalone:t.isStandaloneRuntime(e),fireFileProxy:s=>g.fire({url:s,project:a}),fireProxyUrl:s=>r.fire({url:s,project:a})},m)),u)}async function F(e,i){const a=t.getCurrentProjectId(e),o=a===void 0?"":String(a);let g;try{g=await v(e,i,o)}catch(r){return d("downloadFailed",r instanceof Error&&r.message?r.message:"The image could not be downloaded from the URL.")}if(!I.includes(g.type))return d("unsupportedType","Only JPG, PNG, WEBP, GIF and SVG images can be uploaded.");try{const r=t.getAppConfig(e),u=await t.prepareImageForEditorUpload(g,r),l=await t.fireUploadImageEvent(t.getEmitter(e,n.events.UPLOAD_EVENT_ID),{file:u,project:o});if(l.url)return l.url;const m=t.isStandaloneRuntime(e),s=t.getCurrentUser(e).profile?.id,{dataProvider:y,usesBuiltInStorage:U}=t.buildResolvedFileManagerProviders({storageProvider:e.getInstance(n.STORAGE_PROVIDER_ID),projectId:o,restApi:n.getApi(e,t.EM_FILES_MODULES),restApiV2:t.createRestClientV2(e),i18n:t.defaultI18nContext,pathPostfix:s!==void 0&&String(s)!=="0"?String(s):"",appConfig:r,isStandalone:m,onIndexingStateChange:()=>{}});return t.shouldFallbackToBuiltInUpload(l,{isStandalone:m,targetIsOurBackend:U})?(await t.uploadFileViaDataProvider(u,y))?.url??d("uploadFailed","The image could not be uploaded."):d("uploadRejected",t.toUploadImageError(l).message)}catch(r){return d("uploadFailed",r instanceof Error&&r.message?r.message:"The image could not be uploaded.")}}f.isUploadFailure=E,f.saveImageFromUrl=F});