@emailmaker/emailmaker 1.1.4 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/emailmaker-core.7d5d6426.js +1 -0
- package/emailmaker-esm.js +3 -3
- package/emailmaker.d.ts +2 -2
- package/emailmaker.js +3 -3
- package/iframe/js/amp.BtGt-xkd.js +1 -0
- package/iframe/js/iframe-eblock.js +1 -1
- package/iframe/js/iframe.js +1 -1
- package/iframe/js/rules.CNqvmp_P.js +1 -1
- package/iframe/js/sanitize-html.BzjMWt1k.js +1 -0
- package/package.json +1 -1
- package/static/core/{857a130e.js → 2a6d9ce7.js} +1 -1
- package/static/core/{d1bf7655.js → 33d703fb.js} +1 -1
- package/static/core/{b1fd86b4.js → 37cc0ac5.js} +1 -1
- package/static/core/3872445e.js +1 -0
- package/static/core/{28ca49a6.js → 45958f0e.js} +1 -1
- package/static/core/{34b8b5ce.js → 69b8570a.js} +44 -44
- package/static/core/{786ef914.js → 72ee0271.js} +1 -1
- package/static/core/{a29e21f4.js → 771d97fd.js} +1 -1
- package/static/core/{7a60accf.js → 925dcb4a.js} +1 -1
- package/static/core/{fcb5a15a.js → 9ffd0912.js} +1 -1
- package/static/core/{62cd8965.js → a389d04a.js} +1 -1
- package/static/core/{24946254.js → bb9df2d2.js} +1 -1
- package/static/core/{31db2775.js → bd0eba9e.js} +1 -1
- package/static/core/d62f3e6a.js +47 -0
- package/static/core/{edf6a1bb.js → f11f8091.js} +1 -1
- package/static/esm/27964dfe.js +1 -0
- package/static/esm/c1e3467e.js +1 -0
- package/emailmaker-core.a1df38d3.js +0 -1
- package/iframe/js/amp.BiJ6w6WR.js +0 -1
- package/iframe/js/sanitize-html.3OUPclIN.js +0 -1
- package/static/core/39ea46f3.js +0 -1
- package/static/core/5cdb0560.js +0 -47
- package/static/esm/48de0f80.js +0 -1
- package/static/esm/53bd1900.js +0 -1
- /package/iframe/{iframe-eblock.a1df38d3.html → iframe-eblock.7d5d6426.html} +0 -0
- /package/iframe/{iframe.a1df38d3.html → iframe.7d5d6426.html} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./cadc597d.js";var t=class e{_inner;_isDisposed=!1;constructor(e=[]){this._inner=e}addDisposable(t){return this._inner.push(t),t instanceof e&&t.addDispose(()=>{this.removeDisposable(t)}),t}addDispose(e){this.addDisposable({dispose:e})}removeDisposable(e){let t=this._inner.indexOf(e);t>=0&&this._inner.splice(t,1)}isDisposed(){return this._isDisposed}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(let e of[...this._inner])e.dispose()}}};function n(e){return`service_container_${e}`}var r=class e extends t{_parent;_injectCallbacks=[];_injections=Object.create(null);_runCallbacks(e){this._injectCallbacks.forEach(t=>t(e))}constructor(e=null){super(),this._parent=e,e&&this.addDisposable(e.onInject(e=>this._runCallbacks(e)))}onInject=e=>(this._injectCallbacks.push(e),{dispose:()=>{let t=this._injectCallbacks.indexOf(e);t>=0&&this._injectCallbacks.splice(t,1)}});inject(e,t){this._injections[e]=()=>t,this._runCallbacks(e)}injectFactory(e,t,n){let r=this._injections[e],i=typeof r==`function`?r():r,a=this._injections[e]=()=>(i=t(this,i),i);n&&a(),this._runCallbacks(e)}_find(e,t=!0){return this._injections[e]||t&&this._parent?._find(e)}_onInject(e,n,r=new t){return r.addDisposable(this.onInject(t=>{e===t&&(r.dispose(),n(this.getInstance(t)))})),this._parent&&r.addDisposable(this._parent._onInject(e,n,r)),this.addDisposable(r),r}getInstance(e,t=!0){let n=this._find(e,t);if(typeof n==`function`)return n()}getOrCreateInstance(e,t){let n=this._find(e);if(typeof n==`function`)return n();let r=t(this);return this.inject(e,r),r}getInstanceAsync(e){let t=this._find(e);return typeof t==`function`?Promise.resolve(t()):new Promise(t=>this._onInject(e,()=>t(this.getInstance(e))))}addService(e,r){let i=n(e);this.injectFactory(i,(e,t=[])=>t.indexOf(r)<0?[...t,r]:t);let a=new t;return a.addDispose(()=>{this.injectFactory(i,(e,t=[])=>t.filter(e=>e!==r))}),a}addServiceFactory(e,r,i){let a=n(e),o;this.injectFactory(a,(e,t=[])=>(o=r(e,o),o===void 0?t:t.indexOf(o)<0?[...t,o]:t),i);let s=new t;return s.addDispose(()=>{this.injectFactory(a,(e,t=[])=>o===void 0?t:t.filter(e=>e!==o))}),s}getServices(e){let t=n(e);return[...this.getInstance(t,!1)||[],...this._parent?.getServices(e)||[]]}createChild(){return new e(this)}getOrCreateIsolatedContainer(t){return this.getOrCreateInstance(t,()=>{let n=this._parent?.getOrCreateIsolatedContainer(t);return new e(n)})}dispose(){this._injections=Object.create(null)}};function i(e){return e.startsWith(`__`)?e:`__${e}__`}function a(e){if(typeof globalThis>`u`)throw Error(`[di] globalThis is required for namespace container access.`);let t=i(e),n=globalThis;return n[t]??={}}function o(e){return typeof e==`object`&&!!e&&typeof e.inject==`function`&&typeof e.getInstance==`function`}function s(e){return i(e||`emailmaker`)}function c(e){let t=a(s(e));if(o(t.container))return t.container;let n=new r(null);return t.container=n,n}function l(e){return c(e)}function u(){let e=new Date().getTime(),t=typeof performance<`u`&&performance.now&&performance.now()*1e3||0;return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,function(n){let r=Math.random()*16;return e>0?(r=(e+r)%16|0,e=Math.floor(e/16)):(r=(t+r)%16|0,t=Math.floor(t/16)),(n===`x`?r:r&3|8).toString(16)})}function d(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():u()}function f(e=d()){return e}function p(){return`esm`}function m(e){if(typeof globalThis>`u`)return;let t=p(),n=globalThis[e]??{};globalThis[e]=n;let r=n.__diagnostics??={},i=r.diModuleEval??={evalCount:0,records:[],duplicateWarned:!1};i.records.push({buildSource:t,timestamp:Date.now(),stack:Error().stack}),i.evalCount+=1,!(i.evalCount<=1||i.duplicateWarned)&&(i.duplicateWarned=!0,i.evalCount,i.records)}function h(){return`__emailmaker__`}function g(e,t){if(m(t),typeof globalThis>`u`)return e;let n=p(),r=globalThis,i=r[t]=r[t]||{},a=i.__diagnostics=i.__diagnostics||{},o=a.dependencyResolver=a.dependencyResolver||{entries:[],warnings:[]},s={container:e,source:`packages/runtime-core/di/index.ts`,buildSource:n,timestamp:Date.now(),stack:Error().stack};if(o.entries.push(s),o.entries.length>1){let e=o.entries[0];if(o.entries.some(t=>t.container!==e.container)&&!o.duplicateWarningShown){o.duplicateWarningShown=!0;let e={message:`[di] Multiple DependencyResolver instances detected on namespace`,namespaceKey:t,buildSource:n,entries:o.entries};o.warnings.push(e)}}return e}var _;function v(){if(_)return _;let e=h();return _=g(c(e),e),_}new Proxy({},{get(e,t,n){let r=v(),i=Reflect.get(r,t,n);return typeof i==`function`?i.bind(r):i}});var y=class e extends Error{code;httpStatus;details;constructor(t,n,r,i){super(t),this.name=`FileManagerApiError`,this.code=n,this.httpStatus=r,this.details=i;let a=Error.captureStackTrace;a&&a(this,e)}};function b(e,t=`BackendError`){switch(e){case 400:return`ValidationError`;case 401:return`AuthenticationFailed`;case 403:return`AuthorizationFailed`;case 404:return`FileNotFound`;case 413:return`PayloadTooLarge`;case 415:return`UnsupportedMediaType`;case 429:return`RateLimitExceeded`;case 500:return`BackendError`;case 503:return`ServiceUnavailable`;case 504:return`Timeout`;default:return t}}var x=class{_plugins=new Map;_listeners=new Map;_getOrCreateEntry(e){let t=this._plugins.get(e);return t||(t={overrides:[]},this._plugins.set(e,t)),t}_applyOverrides(e,t){let n=this._plugins.get(e);if(n?.overrides)for(let e of n.overrides)t=e(t)||t;return t}_notifyListeners(e,t){let n=this._listeners.get(e);if(!n||n.length===0)return;for(let e of n)try{e.callback(t)}catch{}let r=n.filter(e=>!e.once);r.length>0?this._listeners.set(e,r):this._listeners.delete(e)}get(e){let t=this._plugins.get(e);if(t?.ctor)return this._applyOverrides(e,t.ctor)}async getAsync(e){let t=this._plugins.get(e);if(t?.ctor)return this._applyOverrides(e,t.ctor);if(t?.loading){let n=await t.loading;return this._applyOverrides(e,n)}if(t?.factory){let n=Promise.resolve(t.factory()).then(n=>(t.ctor=n,t.loading=void 0,this._notifyListeners(e,n),n));t.loading=n;let r=await n;return this._applyOverrides(e,r)}return new Promise(t=>{this.on(e,n=>t(this._applyOverrides(e,n)))})}add(e,t){let n=this._getOrCreateEntry(e);n.ctor=t,this._notifyListeners(e,t)}addAll(e){for(let t of Object.keys(e)){let n=e[t];n!==void 0&&this.add(t,n)}}addAsync(e,t){let n=this._getOrCreateEntry(e);return n.factory=t,{dispose:()=>{n.ctor||(n.factory=void 0)}}}has(e){let t=this._plugins.get(e);return!!(t?.ctor||t?.factory)}isLoaded(e){return!!this._plugins.get(e)?.ctor}override(e,t){let n=this._getOrCreateEntry(e);return n.overrides.push(t),{dispose:()=>{let e=n.overrides.indexOf(t);e>=0&&n.overrides.splice(e,1)}}}on(e,t){let n=this.get(e);n&&t(n);let r=this._listeners.get(e);r||(r=[],this._listeners.set(e,r));let i={callback:t,once:!1};return r.push(i),{dispose:()=>this._removeListener(e,t)}}once(e,t){let n=this.get(e);if(n)return t(n),{dispose:()=>{}};let r=this._listeners.get(e);r||(r=[],this._listeners.set(e,r));let i={callback:t,once:!0};return r.push(i),{dispose:()=>this._removeListener(e,t)}}off(e,t){this._removeListener(e,t)}_removeListener(e,t){let n=this._listeners.get(e);if(n){let r=n.findIndex(e=>e.callback===t);r>=0&&n.splice(r,1),n.length===0&&this._listeners.delete(e)}}keys(){return Array.from(this._plugins.keys())}forContext(){let e=this;return{add(t,n){e.add(t,n)}}}},S=class{resolveRegistry;constructor(e){this.resolveRegistry=e}target(){return this.resolveRegistry()}get(e){return this.target().get(e)}getAsync(e){return this.target().getAsync(e)}add(e,t){return this.target().add(e,t)}addAll(e){return this.target().addAll(e)}addAsync(e,t){return this.target().addAsync(e,t)}has(e){return this.target().has(e)}isLoaded(e){return this.target().isLoaded(e)}override(e,t){return this.target().override(e,t)}on(e,t){return this.target().on(e,t)}once(e,t){return this.target().once(e,t)}off(e,t){return this.target().off(e,t)}keys(){return this.target().keys()}forContext(){return this.target().forContext()}},C=`PluginRegistry`;function w(e=l()){return e.getOrCreateInstance(C,()=>new x)}var T=new S(()=>w());function E(e){return f(e)}E(`HANDLE_ATOM_INSERT`),E(`SETTINGS_PANEL_EVENT`),E(`MODAL_SHOW_EVENT`),E(`MODAL_CLOSE_EVENT`),E(`MODAL_UPDATE_EVENT`);var D=e({FileManagerApiError:()=>y}),O=e({mapHttpStatusToErrorCode:()=>b});export{t as a,f as i,D as n,T as r,O as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,i as t}from"./27964dfe.js";import"@emailmaker/emailmaker/runtime/react";function n(t,n){if(t!==void 0)if(typeof t==`string`){if(t=document.querySelector(t),t)return t;let r=n.addDisposable(new e);return new Promise((e,n)=>{let i=new MutationObserver(()=>{t=document.querySelector(t),t&&(r.dispose(),e(t))});i.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),r.addDisposable({dispose:()=>i.disconnect()})})}else return t;else return t}var r=new Map;t(`ELEMENT_INSERT_HTML_PIPELINE`),t(`BLOCK_INSERT_HTML_PIPELINE`),t(`DomComponentRegistry`),t(`ComponentRegistry`);function i(e){return t(e)}var a;(function(e){e.BEFORE_SAVE_EMAIL=i(),e.ON_SAVEBUTTON_CLICK_ID=i(),e.ON_NEXTBUTTON_CLICK_ID=i(),e.ON_PREVIOUSBUTTON_CLICK_ID=i(),e.ON_MODEL_CHANGE=i(),e.WILL_EMAIL_INIT_ID=i(),e.ON_EMAIL_INIT_ID=i(),e.ON_BLOCK_INIT_ID=i(),e.ON_CONTENT_CHANGED_ID=i(),e.ON_PREHEADER_CHANGED_ID=i(),e.ON_SUBJECT_CHANGED_ID=i(),e.ON_EMAIL_CHANGED_ID=i(),e.ON_BLOCK_CHANGED_ID=i(),e.ON_CHUNKS_LOADED=i(),e.ON_SEND_TESTEMAIL_ID=i(),e.ON_SEND_LIVEPREVIEW_ID=i(),e.ON_SHARE_ID=i(),e.ON_SHOW_PREVIEW_ID=i(),e.ON_EMAIL_CLONE_ID=i(),e.ON_SEND_EMAIL_MODAL_ID=i(),e.ON_NOTIFICATION=i(),e.READ_LOCALE=i(),e.ON_TRANSLATE_ID=i(),e.ON_CODE_VALIDATE_ID=i(),e.UPLOAD_EVENT_ID=i(),e.PROXY_URL_EVENT_ID=i(),e.FILE_PROXY_EVENT_ID=i(),e.ON_LIMIT_ID=i(),e.ON_GLOBAL_BLOCK_PROPAGATE_UPDATE_ID=i(),e.ON_BROWSER_EXTENSION_DETECTED_ID=i()})(a||={}),t(),t(),t(),t(),t(),t(),t(),t(),t(`PluginCollection`),i(`APP_LOAD_EVENT`),i(`CONFIG_CHANGED_EVENT`);export{n,r as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__emailmaker__.define(`core`,[`require`,`exports`,`module`,`static/core/354bf8a9.js`,`static/core/5cdb0560.js`,`static/core/b1fd86b4.js`,`static/core/62cd8965.js`,`static/core/7a60accf.js`],function(e,t,n){Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),e("./static/core/354bf8a9.js");let r=e("./static/core/5cdb0560.js"),i=e("./static/core/62cd8965.js"),a=e("./static/core/b1fd86b4.js"),o=e("./static/core/7a60accf.js");function s(e){return async()=>(await e.app.app_init_create({})).data}function c(e,t,n){e.inject(r.va,void 0);let i;e.injectFactory(r.va,async(e,r)=>i||(i=(async()=>{let e=r?await r:void 0;return t({baseUrl:n.baseUrl,user:n.user,project:n.project,prevApp:e})})(),i),!0)}var l=a.A(e=>{let t,n,i,a,o=!1;function l(e){let t=String(e||``).trim();return t?r.ia(t):void 0}return{setOptions(u){let d=!!e.getInstance(r.Ta),f=u.hasOwnProperty(`baseUrl`)?l(u.baseUrl):t;if(u.hasOwnProperty(`baseUrl`)){let n=e.getInstance(r.na);t!==f&&n?.setOptions(f?{baseUrl:f}:{})}let p=n!==u.appInit,m=!r.$i(i,u.user),h=a!==u.project,g=t!==f;if(n=u.appInit,i=u.user,a=u.project,t=f,d||o&&!p&&!m&&!h&&!g)return;let _=e.getInstance(r.ha);c(e,n||s(_),{baseUrl:t,user:u.user,project:u.project}),o=!0}}}),u=r.Qa(),d=r.Qa(),f=a.A(e=>({setOptions(t){let n=i.On();e.addService(r.ta,{execute:n.decorate(async n=>{if(!t.jwtAuth)return;let i=e.getInstance(u);if(!e.getInstance(d)){if(!i)try{let n=e.getInstance(r.na)?.getOptions()?.baseUrl||``,a=await fetch(`${n}/jwt-auth/token`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t.jwtAuth)});if(!a.ok)throw Error(`JWT auth failed: ${a.status}`);i=(await a.json()).token,e.inject(u,i)}catch{throw e.inject(d,r.hi),Error(r.hi)}i&&n.headers.append(`authorization`,`Bearer ${i}`)}})})}})),p=a.A(e=>{let t,n,a;return{async setOptions(o){let s=a!==o.getAuthToken,c=!r.$i(t,o.user),l=n!==o.project;if(a=o.getAuthToken,t=o.user,n=o.project,!(!e.getInstance(r.Ta)||!o.getAuthToken)&&!(!s&&!c&&!l))try{let t=await o.getAuthToken(o.user,o.project);e.inject(r.Ea,Promise.resolve(t||``));let n=i.I(t);if(!n)return;e.inject(r.Da,n);let a=e.getInstance(r.va),s=a?await a.catch(()=>void 0):void 0;e.inject(r.va,Promise.resolve(i.F(n,s)))}catch{}}}}),m=a.A(e=>{let t=e.getInstance(r.xa),n=new r.Ka,a=i.P(n.event);t.addDispose(()=>{let t=e.getInstance(r.Sa);n.fire(t)});let o=t.addDisposable(new i.N(a));return t.addDisposable(n),{setOptions({handleDestroy:e}){o.setListener(e)},instance:{handleDestroy:a,destroy:()=>t.dispose()}}}),h=a.A(e=>{let t=e.getInstance(r.xa),n=i.P(r.ja(e,r.ya)),a=t.addDisposable(new i.N(n));return{setOptions({handleLoad:e}){a.setListener(e)},instance:{handleLoad:n},dispose:()=>t.dispose()}}),g=a.A(e=>{let t=e.getInstance(r.xa),n=t.addDisposable(new r.Ga),a=t.addDisposable(new r.Ga),o=r.Aa(e,r.ba),s=i.P(n.event),c=i.P(a.event),l=i.P(o.event),u=t.addDisposable(new i.N(s)),d=t.addDisposable(new i.N(c)),f=t.addDisposable(new i.N(l));return{instance:{handleSetOptions:s,handleOptionsChanged:c,handleConfigChanged:l},async setOptions(e){u.setListener(e.handleSetOptions),d.setListener(e.handleOptionsChanged),f.setListener(e.handleConfigChanged),await n.fire(e),await a.fire(e)},dispose(){}}}),_=1e4;function v(e,t,n,r={}){let i=Object.assign({},e);for(let[e,a]of Object.entries(t))if(a!==void 0)if(n.includes(e)&&typeof a==`object`&&a){let t=i[e],n=r[e]??{};i[e]=Object.assign({},typeof t==`object`&&t?t:n,a)}else i[e]=a;return i}var y={border:{all:null,top:null,right:null,bottom:null,left:null},borderRadius:{all:5,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},borderRadiusCards:{all:10,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},padding:{all:null,top:null,right:null,bottom:null,left:null}},b={fontFamily:[`Safe Fonts`,`-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif`],fontSize:16,fontSizeDim:`px`,lineHeight:21,lineHeightDim:`px`,color:`#5a5a5a`,contrastColor:`#FFFFFF`,textAlign:`left`,paddingBottom:10,paddingBottomDim:`px`},x={fontFamily:[`Safe Fonts`,`-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif`],fontSize:24,fontSizeDim:`px`,lineHeight:32,lineHeightDim:`px`,color:`#333333`,contrastColor:`#FFFFFF`,textAlign:`left`,paddingTop:20,paddingTopDim:`px`,paddingBottom:20,paddingBottomDim:`px`,letterSpacing:0,letterSpacingDim:`px`,bold:!0,italic:!1},S={color:`#1C52DC`,contrastColor:`#FFFFFF`,underline:!0},C={fontFamily:[`Safe Fonts`,`-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif`],fontSize:16,fontSizeDim:`px`,letterSpacing:0,letterSpacingDim:`px`,color:`#FFFFFF`,contrastColor:`#1C52DC`,bold:!1,italic:!1,backgroundColor:`#1C52DC`,contrastBackgroundColor:`#FFFFFF`,marginTop:10,marginTopDim:`px`,marginBottom:10,marginBottomDim:`px`,border:y.border,borderRadius:y.borderRadius,textAlign:`center`,padding:y.padding},w={backgroundColor:`#FFFFFF`,contrastBackgroundColor:`#1C52DC`,padding:y.padding},T={contrastBackgroundColor:`#1C52DC`,contrastTextColor:`#FFFFFF`,baseBackgroundColor:`#F8F8F8`,baseTextColor:`#333333`,border:y.border,borderRadius:y.borderRadiusCards};function E(e){return{...b,...e}}function D(e){return{...x,...e,bold:e?.bold??x.bold,italic:e?.italic??x.italic}}function O(e){return{...S,...e,underline:e?.underline??S.underline}}function k(e){return{...C,...e,bold:e?.bold??C.bold,italic:e?.italic??C.italic,border:{...C.border,...e?.border??{}},borderRadius:{...C.borderRadius,...e?.borderRadius??{}},padding:{...C.padding,...e?.padding??{}}}}function A(e){return{...w,...e,padding:{...w.padding,...e?.padding??{}}}}function j(e){return{...T,...e,border:{...T.border,...e?.border??{}},borderRadius:{...T.borderRadius,...e?.borderRadius??{}}}}var M=class{_editor;_layoutSettingsChanged=new r.Ka;_contentStylesChanged=new r.Ka;_messageSubscription;_messageSubscriptionPromise;_prevLayoutSnapshot;_prevContentSnapshot;constructor(e){this._editor=e}onChangeEmailLayoutSettings(e){let t=this._layoutSettingsChanged.event(e);return this._ensureMessageSubscription(),{dispose:()=>{t.dispose(),this._disposeMessageSubscriptionIfUnused()}}}onChangeEmailContentStyles(e){let t=this._contentStylesChanged.event(e);return this._ensureMessageSubscription(),{dispose:()=>{t.dispose(),this._disposeMessageSubscriptionIfUnused()}}}_disposeMessageSubscriptionIfUnused(){this._layoutSettingsChanged.hasListeners()||this._contentStylesChanged.hasListeners()||(this._messageSubscription?.dispose(),this._messageSubscription=void 0)}_mapLayoutSettings(e={}){return{backgroundColor:e.backgroundColor||``,backgroundImage:(e.backgroundImage||[]).map(e=>({type:`url`,value:e?.value||``})),backgroundPositionX:e.backgroundPositionX||``,backgroundPositionY:e.backgroundPositionY||``,backgroundRepeat:e.backgroundRepeat||``,backgroundSize:e.backgroundSize||``,backgroundColorContent:e.backgroundColorContent||``,textStrong:e.textStrong||!1,textItalic:e.textItalic||!1,textUnderline:e.textUnderline||!1,width:e.width,responsive:e.responsive}}_parseCommonStyles(e){let t={...r.Zi};try{e&&e!==`{}`&&(t=JSON.parse(e))}catch{}return t}_mapCommonStylesToContentStyles(e){return{text:E(e.text),headings:D(e.headings),links:O(e.links),buttons:k(e.buttons),block:A(e.block),cards:j(e.cards)}}_getCurrentLayoutSettings(e){return this._mapLayoutSettings(o.O(e.getState()))}_getCurrentContentStyles(e){return this._mapCommonStylesToContentStyles(this._parseCommonStyles(o.w(e.getState())?.common_styles))}_getLayoutSnapshot(e){return JSON.stringify(e)}_getContentSnapshot(e){return JSON.stringify(e)}async _ensureMessageSubscription(){if(!this._messageSubscription){if(this._messageSubscriptionPromise)return this._messageSubscriptionPromise;this._messageSubscriptionPromise=(async()=>{let e=await this._editor.container.getInstanceAsync(r.Oa);if(this._messageSubscription)return;let t=this._editor.container.getOrCreateInstance(r.La,()=>new r.Ua),n=this._getCurrentLayoutSettings(e),i=this._getCurrentContentStyles(e);this._prevLayoutSnapshot=this._getLayoutSnapshot(n),this._prevContentSnapshot=this._getContentSnapshot(i),this._messageSubscription=t.addListener(e=>{let t=e?.data?.operation;if(t===r._i.APPLICATION_EMAIL_SETTINGS_SET){let t=this._mapLayoutSettings(e.data?.settings),n=this._getLayoutSnapshot(t);n!==this._prevLayoutSnapshot&&(this._prevLayoutSnapshot=n,this._layoutSettingsChanged.fire(t));return}if(t!==r._i.APPLICATION_COMMON_STYLES_UPDATE)return;let n=this._mapCommonStylesToContentStyles(e.data?.settings?.commonStyles??{...r.Zi}),i=this._getContentSnapshot(n);i!==this._prevContentSnapshot&&(this._prevContentSnapshot=i,this._contentStylesChanged.fire(n))})})();try{await this._messageSubscriptionPromise}finally{this._messageSubscriptionPromise=void 0}}}async getEmailLayoutSettings(){let e=await this._editor.container.getInstanceAsync(r.Oa);return await this._waitForEmailSettingsFromIframe(e),this._getCurrentLayoutSettings(e)}async setEmailLayoutSettings(e){let t=await this._editor.container.getInstanceAsync(r.Oa);await this._waitForEmailSettingsFromIframe(t);let n={...o.O(t.getState()),...e};t.dispatch(o.W(n));let i=this._mapLayoutSettings(n);this._prevLayoutSnapshot=this._getLayoutSnapshot(i),this._layoutSettingsChanged.fire(i)}async _waitForEmailSettingsFromIframe(e,t=_){let n=e.getState(),i=o.w(n),a=o.O(n);if(i?.is_inited&&a&&Object.keys(a).length>0&&(a.backgroundColor||a.backgroundImage?.[0]?.value||a.width?.value||a.responsive!==void 0)||i?.is_inited)return;let s=this._editor.container,c=r.ja(s,r.ka.ON_EMAIL_INIT_ID);return new Promise(e=>{let n=!1,r,i=()=>{r&&=(clearTimeout(r),void 0)},a=c(()=>{n||(n=!0,i(),a.dispose(),e())});r=setTimeout(()=>{n||(n=!0,a.dispose(),e())},t)})}async getEmailContentStyles(){let e=await this._editor.container.getInstanceAsync(r.Oa);return this._getCurrentContentStyles(e)}async setEmailContentStyles(e){let t=await this._editor.container.getInstanceAsync(r.Oa),n=o.w(t.getState());if(!n)return;let i=this._parseCommonStyles(n.common_styles);e.text!==void 0&&(i.text={...i.text||{},...e.text}),e.headings!==void 0&&(i.headings={...i.headings||{},...e.headings}),e.links!==void 0&&(i.links={...i.links||{},...e.links}),e.buttons!==void 0&&(i.buttons=v(i.buttons||{},e.buttons,[`border`,`borderRadius`,`padding`],{border:y.border,borderRadius:y.borderRadius,padding:y.padding})),e.block!==void 0&&(i.block=v(i.block||{},e.block,[`padding`],{padding:y.padding})),e.cards!==void 0&&(i.cards=v(i.cards||{},e.cards,[`border`,`borderRadius`],{border:y.border,borderRadius:y.borderRadiusCards})),t.dispatch(o.R({...n,common_styles:JSON.stringify(i)}));let a=this._mapCommonStylesToContentStyles(i);this._prevContentSnapshot=this._getContentSnapshot(a),this._contentStylesChanged.fire(a)}},N={...r.Ma,EmailSettingsApi:M};({...r.Ma});var P={...N};function F(){i.j.addAll(P)}var I=[m,h,g,f,p,a.E,l];async function L(){return(await Promise.resolve().then(()=>e("./static/core/34b8b5ce.js"))).default}var R=e=>{let t=null,n=!1;return{instance:{},async setOptions(i){if(!t&&!n){t=(await L())(e);let n=await e.getInstanceAsync(r.Sa);Object.assign(n,t.instance||{}),F()}t&&await t.setOptions(i)},dispose(){t?.dispose(),n=!0}}},z=a.k([...I,R]),B=class{_storage=Object.create(null);get(e){let t=this._storage[e];return t&&(!t.expires||t.expires<Date.now())?t.value:``}set(e,t,n){this._storage[e]={value:t,expires:n.expires?n.expires*1e3+Date.now():void 0}}remove(e){delete this._storage[e]}},V=100,H={events:[],container:null,collection:null};function U(e,t){H.container=e,H.collection=t,t.onLifecycle(e=>{H.events.push({...e,timestamp:Date.now()}),H.events.length>V&&(H.events=H.events.slice(-100))}),typeof window<`u`&&(window.__EMAILMAKER_DEVTOOLS__=W())}function W(){return{enabled:!0,plugins(){return H.collection?H.collection.getStatus().map(e=>({...e,hasInit:!0,hasDispose:!0,hasAfterInit:!0})):[]},registry(){if(!H.container)return[];try{return H.container.getInstance(i.M).keys().map(String)}catch{return[]}},events(e=50){return H.events.slice(-e)},clearEvents(){H.events=[]},getPlugin(e){if(H.collection)try{return H.collection.use(e)}catch{return}}}}var G=a.k([z]);async function K(e){let t=new r.no;async function n(){let n=r.Za.createChild();if(e.standaloneKey){n.inject(r.Ta,e.standaloneKey);let i=r.ja(n,r.ka.FILE_PROXY_EVENT_ID);t.addDisposable(i(async({url:e})=>(await fetch(e)).blob(),Number.MIN_VALUE))}n.inject(r.xa,t),n.inject(r.ma,new B),r.aa(n);let i=G(n),a={...i.instance,container:n};if(n.inject(r.Sa,a),await i.setOptions(e),e.devTools)try{let e=n.getInstance(r.wa);e&&U(n,e)}catch{}return r.Aa(n,r.ya).fire(a),a}return n()}async function q(e){let t=new Map;typeof e==`object`&&(e=e.code);let n=await i.a(e,async e=>{await i.g(e.document,e=>i.m.getEscapedText(e)===e?i.y(e):e,t);for(let t of e.document.querySelectorAll(`.em-amp-show-disabled`))t.remove();e.handleRender(async({contentDocument:e,managedNodeController:t})=>{await i.n(e,{mappedTags:{script:`___script`},commit:()=>t.commit()})})},[800]),r=await i.a(e,async e=>{await i.g(e.document,e=>i.m.getEscapedText(e)===e?i.y(e):e,t);for(let t of e.document.querySelectorAll(`.em-amp-show-only`))t.remove();await i.t(e.document,{mappedTags:{script:`___script`}})},[800]);return{code:e,html:r,ampHtml:n}}t.init=K,t.parseAMP=q,t.version=`1.1.4`});
|