@emailmaker/emailmaker 1.1.5 → 1.1.7

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 (47) hide show
  1. package/{emailmaker-core.7d5d6426.js → emailmaker-core.0f53b24b.js} +1 -1
  2. package/emailmaker-esm.js +2 -2
  3. package/emailmaker.d.ts +81 -10
  4. package/emailmaker.js +2 -2
  5. package/iframe/js/amp.BtGt-xkd.js +1 -1
  6. package/iframe/js/iframe-eblock.js +1 -1
  7. package/iframe/js/iframe.js +1 -1
  8. package/iframe/js/rules.CNqvmp_P.js +1 -1
  9. package/iframe/js/sanitize-html.BzjMWt1k.js +1 -1
  10. package/package.json +1 -1
  11. package/static/core/{d5bba58c.js → 18a6d849.js} +1 -1
  12. package/static/core/{69b8570a.js → 37323be2.js} +9 -9
  13. package/static/core/37da3ac2.js +1 -0
  14. package/static/core/{b810b62b.js → 3ba2a2df.js} +1 -1
  15. package/static/core/425f6198.js +3 -0
  16. package/static/core/542c10a0.js +1 -0
  17. package/static/core/54c69205.js +1 -0
  18. package/static/core/5f66a133.js +47 -0
  19. package/static/core/{33d703fb.js → 6f1c8ca5.js} +2 -2
  20. package/static/core/92011db22.js +1 -0
  21. package/static/core/{e572105f.js → 92ad1565.js} +16 -16
  22. package/static/core/992af66a.js +1 -0
  23. package/static/core/{925dcb4a.js → 99f965a4.js} +1 -1
  24. package/static/core/{37cc0ac5.js → b330862b.js} +2 -2
  25. package/static/core/{c4ddaf1d.js → b949d092.js} +2 -2
  26. package/static/core/bbb9f7e92.js +1 -0
  27. package/static/core/{a389d04a.js → c19a7448.js} +6 -6
  28. package/static/core/{72ee0271.js → c7f99585.js} +1 -1
  29. package/static/core/de149603.js +1 -0
  30. package/static/core/{9ffd0912.js → e1ac64f3.js} +4 -4
  31. package/static/core/{5be0cf92.js → e46bb831.js} +1 -1
  32. package/static/core/{bd0eba9e.js → e5c35767.js} +1 -1
  33. package/static/core/{771d97fd.js → eb4e7505.js} +1 -1
  34. package/static/core/{bb9df2d2.js → f67b8fa2.js} +2 -2
  35. package/ui-kit/index.js +1589 -1589
  36. package/static/core/25f8e56b2.js +0 -1
  37. package/static/core/2a6d9ce7.js +0 -1
  38. package/static/core/3872445e.js +0 -1
  39. package/static/core/45958f0e.js +0 -1
  40. package/static/core/62164d9a2.js +0 -1
  41. package/static/core/8cc8d689.js +0 -1
  42. package/static/core/94941958.js +0 -1
  43. package/static/core/d62f3e6a.js +0 -47
  44. package/static/core/f11f8091.js +0 -3
  45. package/static/core/f96a3228.js +0 -1
  46. /package/iframe/{iframe-eblock.7d5d6426.html → iframe-eblock.0f53b24b.html} +0 -0
  47. /package/iframe/{iframe.7d5d6426.html → iframe.0f53b24b.html} +0 -0
@@ -1 +1 @@
1
- __emailmaker__.define(`core`,[`require`,`exports`,`module`,`static/core/354bf8a9.js`,`static/core/d62f3e6a.js`,`static/core/37cc0ac5.js`,`static/core/a389d04a.js`,`static/core/925dcb4a.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/d62f3e6a.js"),i=e("./static/core/a389d04a.js"),a=e("./static/core/37cc0ac5.js"),o=e("./static/core/925dcb4a.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,l=!1;function u(e){return String(e||``).trim()||void 0}return{setOptions(d){let f=!!e.getInstance(r.Ta),p=d.hasOwnProperty(`baseUrl`)?u(d.baseUrl):n,m=p?r.ia(p):void 0;if(d.hasOwnProperty(`baseUrl`)){let n=e.getInstance(r.na);t!==m&&n?.setOptions(m?{baseUrl:m}:{})}let h=i!==d.appInit,g=!r.$i(a,d.user),_=o!==d.project,v=t!==m;if(i=d.appInit,a=d.user,o=d.project,t=m,n=p,f||l&&!h&&!g&&!_&&!v)return;let y=e.getInstance(r.ha);c(e,i||s(y),{baseUrl:n,user:d.user,project:d.project}),l=!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/69b8570a.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.5`});
1
+ __emailmaker__.define(`core`,[`require`,`exports`,`module`,`static/core/354bf8a9.js`,`static/core/5f66a133.js`,`static/core/b330862b.js`,`static/core/c19a7448.js`,`static/core/99f965a4.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/5f66a133.js"),i=e("./static/core/c19a7448.js"),a=e("./static/core/b330862b.js"),o=e("./static/core/99f965a4.js");function s(e){return async()=>(await e.app.app_init_create({})).data}function c(e,t,n){e.inject(r._a,void 0);let i;e.injectFactory(r._a,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,l=!1;function u(e){return String(e||``).trim()||void 0}return{setOptions(d){let f=!!e.getInstance(r.wa),p=d.hasOwnProperty(`baseUrl`)?u(d.baseUrl):n,m=p?r.ia(p):void 0;if(d.hasOwnProperty(`baseUrl`)){let n=e.getInstance(r.na);t!==m&&n?.setOptions(m?{baseUrl:m}:{})}let h=i!==d.appInit,g=!r.$i(a,d.user),_=o!==d.project,v=t!==m;if(i=d.appInit,a=d.user,o=d.project,t=m,n=p,f||l&&!h&&!g&&!_&&!v)return;let y=e.getInstance(r.ma);c(e,i||s(y),{baseUrl:n,user:d.user,project:d.project}),l=!0}}}),u=r.Za(),d=r.Za(),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.wa)||!o.getAuthToken)&&!(!s&&!c&&!l))try{let t=await o.getAuthToken(o.user,o.project);e.inject(r.Ta,Promise.resolve(t||``));let n=i.I(t);if(!n)return;e.inject(r.Ea,n);let a=e.getInstance(r._a),s=a?await a.catch(()=>void 0):void 0;e.inject(r._a,Promise.resolve(i.F(n,s)))}catch{}}}}),m=a.A(e=>{let t=e.getInstance(r.ba),n=new r.Ga,a=i.P(n.event);t.addDispose(()=>{let t=e.getInstance(r.xa);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.ba),n=i.P(r.Aa(e,r.va)),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.ba),n=t.addDisposable(new r.Wa),a=t.addDisposable(new r.Wa),o=r.ka(e,r.ya),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.Ga;_contentStylesChanged=new r.Ga;_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.Da);if(this._messageSubscription)return;let t=this._editor.container.getOrCreateInstance(r.Ia,()=>new r.Ha),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.Da);return await this._waitForEmailSettingsFromIframe(e),this._getCurrentLayoutSettings(e)}async setEmailLayoutSettings(e){let t=await this._editor.container.getInstanceAsync(r.Da);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.Aa(s,r.Oa.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.Da);return this._getCurrentContentStyles(e)}async setEmailContentStyles(e){let t=await this._editor.container.getInstanceAsync(r.Da),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.ja,EmailSettingsApi:M};({...r.ja});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/37323be2.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.xa);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.to;async function n(){let n=r.Xa.createChild();if(e.standaloneKey){n.inject(r.wa,e.standaloneKey);let i=r.Aa(n,r.Oa.FILE_PROXY_EVENT_ID);t.addDisposable(i(async({url:e})=>(await fetch(e)).blob(),Number.MIN_VALUE))}n.inject(r.ba,t),n.inject(r.pa,new B),r.aa(n);let i=G(n),a={...i.instance,container:n};if(n.inject(r.xa,a),await i.setOptions(e),e.devTools)try{let e=n.getInstance(r.Ca);e&&U(n,e)}catch{}return r.ka(n,r.va).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.7`});
package/emailmaker-esm.js CHANGED
@@ -476,7 +476,7 @@ import{a as e,i as t,n,r,t as i}from"./static/esm/27964dfe.js";import{n as a,t a
476
476
  __amdEnv.require = require;
477
477
  __amdEnv.syncRequire = syncRequire;
478
478
  })();
479
- `)(e),typeof e.require==`function`&&typeof e.require.config==`function`&&e.require.config({baseUrl:`./`,paths:{core:`emailmaker-core.7d5d6426.js`}}));var s=typeof e.prefetch==`function`?e.prefetch:void 0;if(e.prefetch=function(){return i.then(function(){if(typeof s==`function`)return s.call(e)})},typeof e.define==`function`){var c=typeof WeakMap<`u`?new WeakMap:null;function t(e){if(!e||typeof e!=`object`&&typeof e!=`function`||e.__esModule)return e;if(c){var t=c.get(e);if(t)return t}var n=Object.create(null);Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});for(var r=Reflect.ownKeys(e),i=0;i<r.length;i++){var a=r[i];if(a!=="__esModule"){var o=Object.getOwnPropertyDescriptor(e,a);o&&Object.defineProperty(n,a,o)}}return Object.prototype.hasOwnProperty.call(n,`default`)||Object.defineProperty(n,"default",{enumerable:!0,value:e,writable:!1}),c&&c.set(e,n),n}e.define(`react`,[],function(){var e=a.React;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.React;return t(n)}):t(e)}),e.define(`@emailmaker/emailmaker/runtime/react`,[],function(){var e=a.React;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.React;return t(n)}):t(e)}),e.define(`react-dom`,[],function(){var e=a.ReactDom;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.ReactDom;return t(n)}):t(e)}),e.define(`@emailmaker/emailmaker/runtime/react-dom`,[],function(){var e=a.ReactDom;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.ReactDom;return t(n)}):t(e)}),e.define(`react-dom/client`,[],function(){var e=a.ReactDomClient;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.ReactDomClient;return t(n)}):t(e)}),e.define(`@emailmaker/emailmaker/runtime/react-dom/client`,[],function(){var e=a.ReactDomClient;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.ReactDomClient;return t(n)}):t(e)}),e.define(`react/jsx-runtime`,[],function(){var e=a.ReactJsxRuntime;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.ReactJsxRuntime;return t(n)}):t(e)}),e.define(`@emailmaker/emailmaker/runtime/react/jsx-runtime`,[],function(){var e=a.ReactJsxRuntime;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.ReactJsxRuntime;return t(n)}):t(e)}),e.define(`react/jsx-dev-runtime`,[],function(){var e=a.ReactJsxDevRuntime;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.ReactJsxDevRuntime;return t(n)}):t(e)}),e.define(`@emailmaker/emailmaker/runtime/react/jsx-dev-runtime`,[],function(){var e=a.ReactJsxDevRuntime;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.ReactJsxDevRuntime;return t(n)}):t(e)}),e.define(`prop-types`,[],function(){var e=a.PropTypes;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.PropTypes;return t(n)}):t(e)}),e.define(`@emailmaker/emailmaker/runtime/prop-types`,[],function(){var e=a.PropTypes;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.PropTypes;return t(n)}):t(e)}),e.define(`react-router-dom`,[],function(){var e=a.ReactRouterDom;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.ReactRouterDom;return t(n)}):t(e)}),e.define(`@emailmaker/emailmaker/runtime/react-router-dom`,[],function(){var e=a.ReactRouterDom;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.ReactRouterDom;return t(n)}):t(e)}),e.define(`antd`,[],function(){var e=a.Antd;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.Antd;return t(n)}):t(e)}),e.define(`@emailmaker/emailmaker/runtime/antd`,[],function(){var e=a.Antd;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.Antd;return t(n)}):t(e)}),e.define(`@ant-design/icons`,[],function(){var e=a.AntDesignIcons;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.AntDesignIcons;return t(n)}):t(e)}),e.define(`@emailmaker/emailmaker/runtime/@ant-design/icons`,[],function(){var e=a.AntDesignIcons;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.AntDesignIcons;return t(n)}):t(e)}),e.define(`@ant-design/cssinjs`,[],function(){var e=a.AntDesignCssinjs;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.AntDesignCssinjs;return t(n)}):t(e)}),e.define(`@emailmaker/emailmaker/runtime/@ant-design/cssinjs`,[],function(){var e=a.AntDesignCssinjs;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.AntDesignCssinjs;return t(n)}):t(e)}),e.define(`classnames`,[],function(){var e=a.Classnames;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.Classnames;return t(n)}):t(e)}),e.define(`@emailmaker/emailmaker/runtime/classnames`,[],function(){var e=a.Classnames;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.Classnames;return t(n)}):t(e)}),e.define(`dayjs`,[],function(){var e=a.Dayjs;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.Dayjs;return t(n)}):t(e)}),e.define(`@emailmaker/emailmaker/runtime/dayjs`,[],function(){var e=a.Dayjs;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.Dayjs;return t(n)}):t(e)}),e.define(`uuid`,[],function(){var e=a.Uuid;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.Uuid;return t(n)}):t(e)}),e.define(`@emailmaker/emailmaker/runtime/uuid`,[],function(){var e=a.Uuid;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.Uuid;return t(n)}):t(e)}),e.define(`@emailmaker/ui-kit`,[],function(){var e=a.UiKit;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.UiKit;return t(n)}):t(e)}),e.define(`@emailmaker/emailmaker/ui-kit`,[],function(){var e=a.UiKit;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.UiKit;return t(n)}):t(e)})}globalThis.__SHARED_RUNTIME_INIT_SENTINEL__=`@shared-runtime:init-complete`})();var s=null,c=`core`;function l(){return typeof window.__emailmaker__?.require==`function`?new Promise((e,t)=>{window.__emailmaker__.require([c],t=>e(t),e=>t(e instanceof Error?e:Error(`[loadEngine] Failed to require core module`)))}):Promise.reject(Error(`[loadEngine] AMD loader is unavailable`))}function u(){return s||=l(),s}var d=null,f=null;async function p(e){typeof e?.prefetch==`function`&&await e.prefetch()}function m(){return d||=u().then(()=>void 0),d}function h(e){return f||=p(e),f}function g(e){return Promise.all([m(),h(e)]).then(()=>void 0)}function _(e){let t=e?.startupPrefetchMode;return t===`eager`||t===`idle`||t===`manual`||t===`off`?t:`eager`}function v(e){Promise.resolve().then(()=>g(e)).catch(()=>{})}function y(e){Promise.resolve().then(()=>h(e)).catch(()=>{})}function b(e){let t=_(e);if(t===`eager`)v(e);else if(t===`idle`){let t=window.requestIdleCallback;typeof t==`function`?t(()=>v(e),{timeout:1500}):setTimeout(()=>v(e),0)}}var x=new WeakMap,S=`data-emailmaker-config-styles`;function C(e){return typeof e==`string`?e.trim():``}function w(e,t){if(e.firstChild){e.insertBefore(t,e.firstChild);return}e.appendChild(t)}function T(e,t,n){if(!e||typeof document>`u`)return null;let r=C(t),i=x.get(e),a=n||e;if(!r)return i&&(i.remove(),x.delete(e)),null;if(i)return i.textContent!==r&&(i.textContent=r),(i.parentNode!==a||i!==a.firstChild)&&w(a,i),i;let o=document.createElement(`style`);return o.setAttribute(S,`true`),o.textContent=r,w(a,o),x.set(e,o),o}function E(e){if(!e)return;let t=x.get(e);t&&(t.remove(),x.delete(e))}function D(){return!1}var O=`
479
+ `)(e),typeof e.require==`function`&&typeof e.require.config==`function`&&e.require.config({baseUrl:`./`,paths:{core:`emailmaker-core.0f53b24b.js`}}));var s=typeof e.prefetch==`function`?e.prefetch:void 0;if(e.prefetch=function(){return i.then(function(){if(typeof s==`function`)return s.call(e)})},typeof e.define==`function`){var c=typeof WeakMap<`u`?new WeakMap:null;function t(e){if(!e||typeof e!=`object`&&typeof e!=`function`||e.__esModule)return e;if(c){var t=c.get(e);if(t)return t}var n=Object.create(null);Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});for(var r=Reflect.ownKeys(e),i=0;i<r.length;i++){var a=r[i];if(a!=="__esModule"){var o=Object.getOwnPropertyDescriptor(e,a);o&&Object.defineProperty(n,a,o)}}return Object.prototype.hasOwnProperty.call(n,`default`)||Object.defineProperty(n,"default",{enumerable:!0,value:e,writable:!1}),c&&c.set(e,n),n}e.define(`react`,[],function(){var e=a.React;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.React;return t(n)}):t(e)}),e.define(`@emailmaker/emailmaker/runtime/react`,[],function(){var e=a.React;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.React;return t(n)}):t(e)}),e.define(`react-dom`,[],function(){var e=a.ReactDom;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.ReactDom;return t(n)}):t(e)}),e.define(`@emailmaker/emailmaker/runtime/react-dom`,[],function(){var e=a.ReactDom;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.ReactDom;return t(n)}):t(e)}),e.define(`react-dom/client`,[],function(){var e=a.ReactDomClient;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.ReactDomClient;return t(n)}):t(e)}),e.define(`@emailmaker/emailmaker/runtime/react-dom/client`,[],function(){var e=a.ReactDomClient;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.ReactDomClient;return t(n)}):t(e)}),e.define(`react/jsx-runtime`,[],function(){var e=a.ReactJsxRuntime;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.ReactJsxRuntime;return t(n)}):t(e)}),e.define(`@emailmaker/emailmaker/runtime/react/jsx-runtime`,[],function(){var e=a.ReactJsxRuntime;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.ReactJsxRuntime;return t(n)}):t(e)}),e.define(`react/jsx-dev-runtime`,[],function(){var e=a.ReactJsxDevRuntime;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.ReactJsxDevRuntime;return t(n)}):t(e)}),e.define(`@emailmaker/emailmaker/runtime/react/jsx-dev-runtime`,[],function(){var e=a.ReactJsxDevRuntime;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.ReactJsxDevRuntime;return t(n)}):t(e)}),e.define(`prop-types`,[],function(){var e=a.PropTypes;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.PropTypes;return t(n)}):t(e)}),e.define(`@emailmaker/emailmaker/runtime/prop-types`,[],function(){var e=a.PropTypes;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.PropTypes;return t(n)}):t(e)}),e.define(`react-router-dom`,[],function(){var e=a.ReactRouterDom;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.ReactRouterDom;return t(n)}):t(e)}),e.define(`@emailmaker/emailmaker/runtime/react-router-dom`,[],function(){var e=a.ReactRouterDom;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.ReactRouterDom;return t(n)}):t(e)}),e.define(`antd`,[],function(){var e=a.Antd;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.Antd;return t(n)}):t(e)}),e.define(`@emailmaker/emailmaker/runtime/antd`,[],function(){var e=a.Antd;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.Antd;return t(n)}):t(e)}),e.define(`@ant-design/icons`,[],function(){var e=a.AntDesignIcons;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.AntDesignIcons;return t(n)}):t(e)}),e.define(`@emailmaker/emailmaker/runtime/@ant-design/icons`,[],function(){var e=a.AntDesignIcons;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.AntDesignIcons;return t(n)}):t(e)}),e.define(`@ant-design/cssinjs`,[],function(){var e=a.AntDesignCssinjs;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.AntDesignCssinjs;return t(n)}):t(e)}),e.define(`@emailmaker/emailmaker/runtime/@ant-design/cssinjs`,[],function(){var e=a.AntDesignCssinjs;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.AntDesignCssinjs;return t(n)}):t(e)}),e.define(`classnames`,[],function(){var e=a.Classnames;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.Classnames;return t(n)}):t(e)}),e.define(`@emailmaker/emailmaker/runtime/classnames`,[],function(){var e=a.Classnames;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.Classnames;return t(n)}):t(e)}),e.define(`dayjs`,[],function(){var e=a.Dayjs;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.Dayjs;return t(n)}):t(e)}),e.define(`@emailmaker/emailmaker/runtime/dayjs`,[],function(){var e=a.Dayjs;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.Dayjs;return t(n)}):t(e)}),e.define(`uuid`,[],function(){var e=a.Uuid;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.Uuid;return t(n)}):t(e)}),e.define(`@emailmaker/emailmaker/runtime/uuid`,[],function(){var e=a.Uuid;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.Uuid;return t(n)}):t(e)}),e.define(`@emailmaker/ui-kit`,[],function(){var e=a.UiKit;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.UiKit;return t(n)}):t(e)}),e.define(`@emailmaker/emailmaker/ui-kit`,[],function(){var e=a.UiKit;return e&&typeof e.then==`function`||e===void 0?o.then(function(e){var n=e.UiKit;return t(n)}):t(e)})}globalThis.__SHARED_RUNTIME_INIT_SENTINEL__=`@shared-runtime:init-complete`})();var s=null,c=`core`;function l(){return typeof window.__emailmaker__?.require==`function`?new Promise((e,t)=>{window.__emailmaker__.require([c],t=>e(t),e=>t(e instanceof Error?e:Error(`[loadEngine] Failed to require core module`)))}):Promise.reject(Error(`[loadEngine] AMD loader is unavailable`))}function u(){return s||=l(),s}var d=null,f=null;async function p(e){typeof e?.prefetch==`function`&&await e.prefetch()}function m(){return d||=u().then(()=>void 0),d}function h(e){return f||=p(e),f}function g(e){return Promise.all([m(),h(e)]).then(()=>void 0)}function _(e){let t=e?.startupPrefetchMode;return t===`eager`||t===`idle`||t===`manual`||t===`off`?t:`eager`}function v(e){Promise.resolve().then(()=>g(e)).catch(()=>{})}function y(e){Promise.resolve().then(()=>h(e)).catch(()=>{})}function b(e){let t=_(e);if(t===`eager`)v(e);else if(t===`idle`){let t=window.requestIdleCallback;typeof t==`function`?t(()=>v(e),{timeout:1500}):setTimeout(()=>v(e),0)}}var x=new WeakMap,S=`data-emailmaker-config-styles`;function C(e){return typeof e==`string`?e.trim():``}function w(e,t){if(e.firstChild){e.insertBefore(t,e.firstChild);return}e.appendChild(t)}function T(e,t,n){if(!e||typeof document>`u`)return null;let r=C(t),i=x.get(e),a=n||e;if(!r)return i&&(i.remove(),x.delete(e)),null;if(i)return i.textContent!==r&&(i.textContent=r),(i.parentNode!==a||i!==a.firstChild)&&w(a,i),i;let o=document.createElement(`style`);return o.setAttribute(S,`true`),o.textContent=r,w(a,o),x.set(e,o),o}function E(e){if(!e)return;let t=x.get(e);t&&(t.remove(),x.delete(e))}function D(){return!1}var O=`
480
480
  .blocks-app-initial-spinner-wrapper {
481
481
  width: 100%;
482
482
  height: 100%;
@@ -505,4 +505,4 @@ import{a as e,i as t,n,r,t as i}from"./static/esm/27964dfe.js";import{n as a,t a
505
505
  100% {
506
506
  transform: rotate(360deg);
507
507
  }
508
- }`;function k(){return()=>{}}function A(e,t){if(!D()||!e||typeof document>`u`)return k();e.querySelectorAll(`.blocks-app-initial-spinner-wrapper`).forEach(e=>{e.remove()});let n=document.createElement(`div`);n.classList.add(`blocks-app-initial-spinner-wrapper`);let r=document.createElement(`div`);r.classList.add(`blocks-app-initial-spinner`),n.appendChild(r);let i=document.createElement(`style`);i.setAttribute(t,`true`),i.textContent=O,document.head?.appendChild(i),e.appendChild(n);let a=!1;return()=>{a||(a=!0,n.remove(),i.remove())}}function j(e){for(;e.endsWith(`/`);)e=e.slice(0,e.length-1);return/\/wp-json$/i.test(e)?e:`${e}/wp-json`}j(`https://app.emailmaker.ru/api/`),t(),t(),t(),t();var M;(function(e){let t=`https://racs.emcdn.ru/v3`;function n(e,n){let r={method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:JSON.stringify(n)};return fetch(`${t}?resource=${e}&dataset=${document.location.hostname}`,r)}e.post=n;async function r(e,n=0){let r={method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:`{"filter":{},"limit":${n}}`};return await(await fetch(`${t}/get?resource=${e}&dataset=${document.location.hostname}`,r)).json()}e.getAll=r})(M||={});var N=new Map,P=new WeakMap;function F(e){return j(String(e||``).trim()||`https://app.emailmaker.ru/api/`)}async function I(e){if(!e.getAuthToken)return;let t=await e.getAuthToken(e.user,e.project,void 0);return t?`Bearer ${t}`:void 0}function L(e){return async({baseUrl:t})=>{let n=F(t);if(!n)throw Error(`[Loader] appInit warmup requires baseUrl or REACT_APP_OPENAPI_BASE_URL`);let r=new Headers({Accept:`application/json`,"Content-Type":`application/x-www-form-urlencoded;charset=UTF-8`}),i=await I(e);i&&r.set(`authorization`,i);let a=await fetch(`${n}/app/v1/app_init`,{method:`POST`,headers:r,body:new URLSearchParams,credentials:`same-origin`});if(!a.ok)throw Error(`[Loader] appInit request failed: ${a.status} ${a.statusText}`);return a.json()}}function R(e){return JSON.stringify({baseUrl:F(e.baseUrl)||``,project:e.project??``,userId:e.user?.id??``})}function z(e){return async t=>{let n=R(t),r=N.get(n);if(r)return r;let i=Promise.resolve(e(t)).catch(e=>{throw N.delete(n),e});return N.set(n,i),i}}function B(e){if(e.standaloneKey)return e;let t=e.appInit||L(e),n=P.get(t);return n||(n=z(t),P.set(t,n)),Promise.resolve(n({baseUrl:e.baseUrl,user:e.user,project:e.project,prevApp:void 0})).catch(e=>{}),{...e,appInit:n}}var V=new WeakMap;function H(e){let t=null;return async(n,r,i)=>(t||=Promise.resolve(e(n,r,i)).finally(()=>{t=null}),t)}function U(e){if(e.standaloneKey)return e;let t=e.getAuthToken;if(!t)return e;let n=V.get(t);return n||(n=H(t),V.set(t,n)),Promise.resolve(n(e.user,e.project,void 0)).catch(e=>{}),{...e,getAuthToken:n}}function W(e,t){return{...e,element:t}}function G(){return()=>{}}function K(e){let t=e.element;return!t||typeof t==`string`||typeof document>`u`?G():(T(t,e.config?.styles,t),()=>{E(t)})}function q(e){if(!D()||e.initialSpinner===!1||typeof document>`u`)return{options:e,cleanup:G()};let t=e.element;if(!t||typeof t==`string`)return{options:e,cleanup:G()};t.querySelectorAll(`.blocks-app-initial-spinner-wrapper`).forEach(e=>{e.remove()});let n=A(t,`data-emailmaker`),r=e.handleChunkLoaded;return{options:{...e,handleChunkLoaded:()=>{n(),r?.()}},cleanup:n}}function J(e){return e?.length?e.some(e=>Array.isArray(e)?!1:!!(e&&typeof e==`object`&&`url`in e)):!1}var Y=`1.1.5`;async function X(e){await g(window.__emailmaker__===void 0?void 0:window.__emailmaker__)}async function Z(t){let n=new e,r=await a(t.element,n);n.dispose();let i=B(U(W(t,r)));if(r){let e=o.get(r);if(e)try{let t=await e;if(t.getElement()===r)return t.reset(i)}catch{o.get(r)===e&&o.delete(r)}}let s=K(i),c=q(i),l=c.options;await m();let d=window.__emailmaker__===void 0?void 0:window.__emailmaker__;J(l.plugins)?await h(d):y(d);let f=u().then(e=>e.init(l));r&&o.set(r,f);try{let e=await f;return r&&o.set(r,e),e}catch(e){throw s(),c.cleanup(),r&&o.get(r)===f&&o.delete(r),e}}async function Q(e){return(await u()).parseAMP(e)}typeof window<`u`&&b(window.__emailmaker__===void 0?void 0:window.__emailmaker__);export{n as errors,i as helpers,Z as init,Q as parseAMP,r as pluginRegistry,X as preload,Y as version};
508
+ }`;function k(){return()=>{}}function A(e,t){if(!D()||!e||typeof document>`u`)return k();e.querySelectorAll(`.blocks-app-initial-spinner-wrapper`).forEach(e=>{e.remove()});let n=document.createElement(`div`);n.classList.add(`blocks-app-initial-spinner-wrapper`);let r=document.createElement(`div`);r.classList.add(`blocks-app-initial-spinner`),n.appendChild(r);let i=document.createElement(`style`);i.setAttribute(t,`true`),i.textContent=O,document.head?.appendChild(i),e.appendChild(n);let a=!1;return()=>{a||(a=!0,n.remove(),i.remove())}}function j(e){for(;e.endsWith(`/`);)e=e.slice(0,e.length-1);return/\/wp-json$/i.test(e)?e:`${e}/wp-json`}j(`https://app.emailmaker.ru/api/`),t(),t(),t(),t();var M;(function(e){let t=`https://racs.emcdn.ru/v3`;function n(e,n){let r={method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:JSON.stringify(n)};return fetch(`${t}?resource=${e}&dataset=${document.location.hostname}`,r)}e.post=n;async function r(e,n=0){let r={method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:`{"filter":{},"limit":${n}}`};return await(await fetch(`${t}/get?resource=${e}&dataset=${document.location.hostname}`,r)).json()}e.getAll=r})(M||={});var N=new Map,P=new WeakMap;function F(e){return j(String(e||``).trim()||`https://app.emailmaker.ru/api/`)}async function I(e){if(!e.getAuthToken)return;let t=await e.getAuthToken(e.user,e.project,void 0);return t?`Bearer ${t}`:void 0}function L(e){return async({baseUrl:t})=>{let n=F(t);if(!n)throw Error(`[Loader] appInit warmup requires baseUrl or REACT_APP_OPENAPI_BASE_URL`);let r=new Headers({Accept:`application/json`,"Content-Type":`application/x-www-form-urlencoded;charset=UTF-8`}),i=await I(e);i&&r.set(`authorization`,i);let a=await fetch(`${n}/app/v1/app_init`,{method:`POST`,headers:r,body:new URLSearchParams,credentials:`same-origin`});if(!a.ok)throw Error(`[Loader] appInit request failed: ${a.status} ${a.statusText}`);return a.json()}}function R(e){return JSON.stringify({baseUrl:F(e.baseUrl)||``,project:e.project??``,userId:e.user?.id??``})}function z(e){return async t=>{let n=R(t),r=N.get(n);if(r)return r;let i=Promise.resolve(e(t)).catch(e=>{throw N.delete(n),e});return N.set(n,i),i}}function B(e){if(e.standaloneKey)return e;let t=e.appInit||L(e),n=P.get(t);return n||(n=z(t),P.set(t,n)),Promise.resolve(n({baseUrl:e.baseUrl,user:e.user,project:e.project,prevApp:void 0})).catch(e=>{}),{...e,appInit:n}}var V=new WeakMap;function H(e){let t=null;return async(n,r,i)=>(t||=Promise.resolve(e(n,r,i)).finally(()=>{t=null}),t)}function U(e){if(e.standaloneKey)return e;let t=e.getAuthToken;if(!t)return e;let n=V.get(t);return n||(n=H(t),V.set(t,n)),Promise.resolve(n(e.user,e.project,void 0)).catch(e=>{}),{...e,getAuthToken:n}}function W(e,t){return{...e,element:t}}function G(){return()=>{}}function K(e){let t=e.element;return!t||typeof t==`string`||typeof document>`u`?G():(T(t,e.config?.styles,t),()=>{E(t)})}function q(e){if(!D()||e.initialSpinner===!1||typeof document>`u`)return{options:e,cleanup:G()};let t=e.element;if(!t||typeof t==`string`)return{options:e,cleanup:G()};t.querySelectorAll(`.blocks-app-initial-spinner-wrapper`).forEach(e=>{e.remove()});let n=A(t,`data-emailmaker`),r=e.handleChunkLoaded;return{options:{...e,handleChunkLoaded:()=>{n(),r?.()}},cleanup:n}}function J(e){return e?.length?e.some(e=>Array.isArray(e)?!1:!!(e&&typeof e==`object`&&`url`in e)):!1}var Y=`1.1.7`;async function X(e){await g(window.__emailmaker__===void 0?void 0:window.__emailmaker__)}async function Z(t){let n=new e,r=await a(t.element,n);n.dispose();let i=B(U(W(t,r)));if(r){let e=o.get(r);if(e)try{let t=await e;if(t.getElement()===r)return t.reset(i)}catch{o.get(r)===e&&o.delete(r)}}let s=K(i),c=q(i),l=c.options;await m();let d=window.__emailmaker__===void 0?void 0:window.__emailmaker__;J(l.plugins)?await h(d):y(d);let f=u().then(e=>e.init(l));r&&o.set(r,f);try{let e=await f;return r&&o.set(r,e),e}catch(e){throw s(),c.cleanup(),r&&o.get(r)===f&&o.delete(r),e}}async function Q(e){return(await u()).parseAMP(e)}typeof window<`u`&&b(window.__emailmaker__===void 0?void 0:window.__emailmaker__);export{n as errors,i as helpers,Z as init,Q as parseAMP,r as pluginRegistry,X as preload,Y as version};
package/emailmaker.d.ts CHANGED
@@ -1909,16 +1909,6 @@ export declare namespace ExportedApi {
1909
1909
  interface Instance extends Events {
1910
1910
  /**
1911
1911
  * show block or email
1912
- *
1913
- * Промис резолвится, когда письмо **полностью инициализировано**: поднят редактор
1914
- * (`ON_EMAIL_INIT`) и — для сохранённого письма (есть `id`) — применена autosave-recovery
1915
- * из истории ревизий. Поэтому `getEmail()` сразу после `await show()` отдаёт финальный html.
1916
- *
1917
- * Ожидание ограничено таймаутом (~12 c, перекрывает fast-poll `revisionService`). При
1918
- * таймауте `show()` всё равно резолвится с текущим контентом, применение recovery
1919
- * продолжается в фоне и завершается событием `handleEmailChanged` (тихого возврата старого нет).
1920
- *
1921
- * Для нового письма (без `id`) контент синхронный — ждётся только инициализация редактора.
1922
1912
  * @param content entity content
1923
1913
  */
1924
1914
  show(content: Content): Promise<void>;
@@ -2836,12 +2826,93 @@ export declare namespace ExportedApi {
2836
2826
  };
2837
2827
  type ResourceProxyValue = string | ResourceProxyRule | Array<string | ResourceProxyRule>;
2838
2828
  type ResourceProxyConfig = ResourceProxyValue;
2829
+ /**
2830
+ * Hostnames that bypass the resourceProxy chain and are loaded directly.
2831
+ * Requires CORS on the asset host for `fetch` / blob paths (`downloadBlob`, `metadata`).
2832
+ * `<img src>` display loads do not require CORS, but still use direct URLs when listed here.
2833
+ *
2834
+ * - Plain array — union-merged with previous config layers (server + init).
2835
+ * - `{ replace: true, value: [...] }` — replaces the accumulated list instead of merging.
2836
+ *
2837
+ * Hostname only (no scheme), exact match, port suffix in config is normalized away.
2838
+ */
2839
+ type DirectHostsConfig = string[] | {
2840
+ replace?: boolean;
2841
+ value: string[];
2842
+ };
2843
+ /**
2844
+ * Runtime policy for {@link Config.resourceProxy}: which intents and resource families
2845
+ * use the proxy chain, plus direct-access shortcuts.
2846
+ *
2847
+ * Intent pair (main switches):
2848
+ * - {@link proxyBlobFetch} — `fetch()` + `Blob` (`downloadBlob`, `metadata`); solves CORS.
2849
+ * - {@link proxyImgSrc} — runtime `<img src>` in editor UI (`display` intent); does not rewrite exported email HTML.
2850
+ *
2851
+ * {@link proxySameOrigin} is a sub-policy for both flags above: when `false` (default),
2852
+ * same-origin URLs stay direct even if blob/img proxy is enabled. It does not enable proxy by itself.
2853
+ *
2854
+ * Hosted vs standalone defaults differ; see each field.
2855
+ */
2839
2856
  type ResourceProxyPolicy = {
2857
+ /**
2858
+ * Cooldown (ms) before a failed proxy candidate is retried after failover.
2859
+ * Used by the proxy runtime state machine (`getProxiedUrl`, `fetchWithResourceProxy`).
2860
+ * @default 300000 (5 minutes)
2861
+ */
2840
2862
  recoveryTtlMs?: number;
2863
+ /**
2864
+ * Enable `resourceProxy` chain for intent `downloadBlob` and `metadata`
2865
+ * (`fetch` + `Blob`: file download, editor load, upload-by-URL, icon metadata).
2866
+ * Primary use case: CORS and response validation on blob fetch.
2867
+ * @default hosted `true`; standalone `true`
2868
+ */
2841
2869
  proxyBlobFetch?: boolean;
2870
+ /**
2871
+ * Enable `resourceProxy` chain for intent `display` — runtime `<img src>` in editor UI
2872
+ * (file manager preview, stock/gif tabs, lightbox). Does **not** change image URLs in exported email HTML.
2873
+ * Use for closed-loop networks or hotlink-protected assets; not needed for CORS (img subresource).
2874
+ * @default hosted `false` (preview direct); standalone `true`
2875
+ */
2876
+ proxyImgSrc?: boolean;
2877
+ /**
2878
+ * Enable `resourceProxy` chain for product CDN URLs (`resourceType: 'cdn'`)
2879
+ * on `downloadBlob` / `metadata` paths. For CDN preview via `<img>`, use {@link proxyImgSrc}.
2880
+ * @default hosted `false`; standalone `true`
2881
+ */
2842
2882
  proxyCdn?: boolean;
2883
+ /**
2884
+ * Enable `resourceProxy` chain for emFiles asset URLs (`resourceType: 'emFiles'`)
2885
+ * on `downloadBlob` / `metadata` paths. For emFiles preview via `<img>`, use {@link proxyImgSrc}.
2886
+ * @default hosted `false`; standalone `true`
2887
+ */
2843
2888
  proxyEmFiles?: boolean;
2889
+ /**
2890
+ * Enable `resourceProxy` chain for stock image URLs (`resourceType: 'stockImages'`).
2891
+ * On hosted, `display` for stock is mandatory-proxy when this flag is on and stock rules exist.
2892
+ * @default hosted — `true` when mode-default stock proxy rules are available, else `false`; standalone `true`
2893
+ */
2844
2894
  proxyStockImages?: boolean;
2895
+ /**
2896
+ * When `true`, mode-default bundled `resourceProxy` rules (from the product build / deployment)
2897
+ * are merged as the **bottom** layer of {@link Config.resourceProxy}.
2898
+ * When `false`, only explicit client `resourceProxy` config is used.
2899
+ * @default hosted `true`; standalone `false`
2900
+ */
2901
+ inheritDefaults?: boolean;
2902
+ /**
2903
+ * Sub-policy for same-origin URLs (page origin === asset origin).
2904
+ * When `false` (default), same-origin is always direct — even if {@link proxyBlobFetch} or {@link proxyImgSrc} is `true`.
2905
+ * When `true`, same-origin may use the proxy chain if the corresponding intent flag is enabled.
2906
+ * Does not enable proxy by itself and does not affect cross-origin URLs.
2907
+ * @default `false`
2908
+ */
2909
+ proxySameOrigin?: boolean;
2910
+ /**
2911
+ * Hostnames loaded directly, skipping the proxy chain (see {@link DirectHostsConfig}).
2912
+ * Evaluated before proxy candidates; direct choice is final (no automatic fallback to proxy on failure).
2913
+ * @default `[]`
2914
+ */
2915
+ directHosts?: DirectHostsConfig;
2845
2916
  };
2846
2917
  type BackendProxyRequestType = 'generic' | 'emFiles' | 'ai';
2847
2918
  type BackendProxyMatchContext = {
package/emailmaker.js CHANGED
@@ -12,7 +12,7 @@
12
12
  })(typeof globalThis !== 'undefined' ? globalThis : typeof self !== 'undefined' ? self : this, function() {
13
13
  'use strict';
14
14
 
15
- var e=window.__emailmaker__||(window.__emailmaker__={});(function(){"use strict";if(e!==void 0&&e.define)return;e===void 0&&(window.__amdEnv={});var t={},n={},r={},i={},a={},o=`./`,s={};function c(e,t){var n=Error(`[AMD] Failed to load module "`+e+`"`+(t?`: `+t.message:``));return n.moduleId=e,n.cause=t,n}function l(e,t,n){var r=Error(`[AMD] Failed to resolve dependency "`+t+`" for module "`+e+`"`+(n?`: `+n.message:``));return r.moduleId=e,r.dependencyId=t,r.cause=n,r}function u(e){for(var t=String(e||``).split(`/`),n=[],r=0;r<t.length;r++){var i=t[r];if(!(!i||i===`.`)){if(i===`..`){n.length>0&&n.pop();continue}n.push(i)}}return n.join(`/`)}function d(e){var t=String(e||``).replace(/\\/g,`/`),n=String(o||`./`).replace(/\\/g,`/`);return n=n.replace(/^\.\/+/,``),n=n.replace(/^\/+/,``),n&&n.slice(-1)!==`/`&&(n+=`/`),n&&t.indexOf(n)===0&&(t=t.slice(n.length)),t.indexOf(`./`)===0&&(t=t.slice(2)),t}function f(e,t){var n=String(e||``);if(!n)return n;if(!(n.indexOf(`./`)===0||n.indexOf(`../`)===0))return d(u(n));var r=u(t||``),i=r?r.split(`/`):[];i.length>0&&i.pop();for(var a=n.split(`/`),o=0;o<a.length;o++){var s=a[o];if(!(!s||s===`.`)){if(s===`..`){i.length>0&&i.pop();continue}i.push(s)}}return d(i.join(`/`))}function p(e){return/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(e)||e.indexOf(`//`)===0}function m(e){var t=String(e||``);if(!t||p(t))return t;try{var n=typeof document<`u`&&document.baseURI?document.baseURI:typeof window<`u`&&window.location?window.location.href:``;return n?new URL(t,n).href:t}catch{return t}}function h(){var t=String(o||`./`);if(t.slice(-1)!==`/`&&(t+=`/`),p(t)||t.charAt(0)===`/`)return t;if(e!==void 0&&e&&e.publicPath)try{return new URL(t,m(e.publicPath)).href}catch{}return m(t)}function g(e,t){var n=f(e,t),r=h(),i=Object.prototype.hasOwnProperty.call(s,n)?String(s[n]||``):n;i.slice(-3)!==`.js`&&(i+=`.js`);try{return new URL(i,r).href}catch{return r+i}}function _(){if(typeof document>`u`)return``;var e=document.currentScript;if(e){var t=e.getAttribute(`data-amd-module-id`);if(t)return t}return``}function v(e,n,r){if(Array.isArray(e)?(r=n,n=e,e=_()):typeof e==`function`?(r=e,n=[],e=_()):typeof n==`function`&&(r=n,n=[]),!e)throw Error(`[AMD] Anonymous define() could not be associated with a module id`);e in t||(t[e]={deps:n||[],factory:r})}v.amd={async:!0};function y(){return function(){}}function b(e,t){return{id:e,exports:t,uri:g(e)}}function x(e,t,n,r){if(Array.isArray(e)){var i=Promise.all(e.map(function(e){return C(e,r)})).then(function(e){return t&&t.apply(null,e),e});return n&&i.catch(n),i}return C(e,r)}function S(e,o){if(Array.isArray(e))throw Error(`[AMD] syncRequire does not support dependency arrays`);var s=f(e,o);if(s in a)throw a[s];if(s in n)return n[s];if(s in r||s in i)throw c(s,Error(`Module is still loading asynchronously`));if(!(s in t))throw c(s,Error(`Module is not available for syncRequire`));return T(s)}function C(e,i){var o=f(e,i);return o in a?Promise.reject(a[o]):o in n?Promise.resolve(n[o]):o in r?r[o]:o in t?(r[o]=w(o),r[o]):(r[o]=D(o).then(function(){if(!(o in t)){var e=c(o,Error(`Module not defined after script load`));throw a[o]=e,e}return w(o)}).catch(function(e){delete r[o];var t=c(o,e);throw a[o]=t,t}),r[o])}function w(e){var i=t[e],o=E(e),s=y(),c=b(e,s);return Promise.all(i.deps.map(function(t){return t===`exports`?s:t===`require`?o:t===`module`?c:C(t,e).catch(function(n){throw l(e,t,n)})})).then(function(t){var a=i.factory.apply(null,t);return a&&typeof a.then==`function`?a.then(function(t){return n[e]=t===void 0?c.exports:t,delete r[e],n[e]}):(n[e]=a===void 0?c.exports:a,delete r[e],n[e])}).catch(function(t){throw delete r[e],a[e]=t,t})}function T(e){var r=t[e],i=E(e),o=y(),s=b(e,o);try{var u=r.deps.map(function(t){if(t===`exports`)return o;if(t===`require`)return i;if(t===`module`)return s;try{return S(t,e)}catch(n){throw l(e,t,n)}}),d=r.factory.apply(null,u);if(d&&typeof d.then==`function`)throw c(e,Error(`Module resolved asynchronously and cannot be syncRequired`));return n[e]=d===void 0?s.exports:d,n[e]}catch(t){throw a[e]=t,t}}function E(e){var r=function(r,i,a){if(Array.isArray(r))return x(r,i,a,e);var o=f(r,e);return o in n?n[o]:o in t?S(r,e):C(r,e)};return r.resolve=function(t){return f(t,e)},r.toUrl=function(t){return g(t,e)},r.sync=function(t){return S(t,e)},r}function D(e){if(e in i)return i[e];var t=g(e);return document.querySelector(`script[src="`+t+`"]`)?(i[e]=Promise.resolve(),i[e]):(i[e]=new Promise(function(n,r){var a=document.createElement(`script`);a.src=t,a.setAttribute(`data-amd-module-id`,e),a.async=!0,a.onload=function(){n()},a.onerror=function(){delete i[e],r(Error(`Failed to load script: `+t))},document.head.appendChild(a)}),i[e])}x.config=function(e){if(e.baseUrl&&(o=e.baseUrl),e.paths)for(var t in e.paths)Object.prototype.hasOwnProperty.call(e.paths,t)&&(s[t]=e.paths[t])},x.modules=t,x.resolved=n,x.errors=a,x.toUrl=g,x.sync=S,e.define=v,e.require=x,e.syncRequire=S})(),e.require.config({baseUrl:`./`,paths:{core:`emailmaker-core.7d5d6426.js`}});
15
+ var e=window.__emailmaker__||(window.__emailmaker__={});(function(){"use strict";if(e!==void 0&&e.define)return;e===void 0&&(window.__amdEnv={});var t={},n={},r={},i={},a={},o=`./`,s={};function c(e,t){var n=Error(`[AMD] Failed to load module "`+e+`"`+(t?`: `+t.message:``));return n.moduleId=e,n.cause=t,n}function l(e,t,n){var r=Error(`[AMD] Failed to resolve dependency "`+t+`" for module "`+e+`"`+(n?`: `+n.message:``));return r.moduleId=e,r.dependencyId=t,r.cause=n,r}function u(e){for(var t=String(e||``).split(`/`),n=[],r=0;r<t.length;r++){var i=t[r];if(!(!i||i===`.`)){if(i===`..`){n.length>0&&n.pop();continue}n.push(i)}}return n.join(`/`)}function d(e){var t=String(e||``).replace(/\\/g,`/`),n=String(o||`./`).replace(/\\/g,`/`);return n=n.replace(/^\.\/+/,``),n=n.replace(/^\/+/,``),n&&n.slice(-1)!==`/`&&(n+=`/`),n&&t.indexOf(n)===0&&(t=t.slice(n.length)),t.indexOf(`./`)===0&&(t=t.slice(2)),t}function f(e,t){var n=String(e||``);if(!n)return n;if(!(n.indexOf(`./`)===0||n.indexOf(`../`)===0))return d(u(n));var r=u(t||``),i=r?r.split(`/`):[];i.length>0&&i.pop();for(var a=n.split(`/`),o=0;o<a.length;o++){var s=a[o];if(!(!s||s===`.`)){if(s===`..`){i.length>0&&i.pop();continue}i.push(s)}}return d(i.join(`/`))}function p(e){return/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(e)||e.indexOf(`//`)===0}function m(e){var t=String(e||``);if(!t||p(t))return t;try{var n=typeof document<`u`&&document.baseURI?document.baseURI:typeof window<`u`&&window.location?window.location.href:``;return n?new URL(t,n).href:t}catch{return t}}function h(){var t=String(o||`./`);if(t.slice(-1)!==`/`&&(t+=`/`),p(t)||t.charAt(0)===`/`)return t;if(e!==void 0&&e&&e.publicPath)try{return new URL(t,m(e.publicPath)).href}catch{}return m(t)}function g(e,t){var n=f(e,t),r=h(),i=Object.prototype.hasOwnProperty.call(s,n)?String(s[n]||``):n;i.slice(-3)!==`.js`&&(i+=`.js`);try{return new URL(i,r).href}catch{return r+i}}function _(){if(typeof document>`u`)return``;var e=document.currentScript;if(e){var t=e.getAttribute(`data-amd-module-id`);if(t)return t}return``}function v(e,n,r){if(Array.isArray(e)?(r=n,n=e,e=_()):typeof e==`function`?(r=e,n=[],e=_()):typeof n==`function`&&(r=n,n=[]),!e)throw Error(`[AMD] Anonymous define() could not be associated with a module id`);e in t||(t[e]={deps:n||[],factory:r})}v.amd={async:!0};function y(){return function(){}}function b(e,t){return{id:e,exports:t,uri:g(e)}}function x(e,t,n,r){if(Array.isArray(e)){var i=Promise.all(e.map(function(e){return C(e,r)})).then(function(e){return t&&t.apply(null,e),e});return n&&i.catch(n),i}return C(e,r)}function S(e,o){if(Array.isArray(e))throw Error(`[AMD] syncRequire does not support dependency arrays`);var s=f(e,o);if(s in a)throw a[s];if(s in n)return n[s];if(s in r||s in i)throw c(s,Error(`Module is still loading asynchronously`));if(!(s in t))throw c(s,Error(`Module is not available for syncRequire`));return T(s)}function C(e,i){var o=f(e,i);return o in a?Promise.reject(a[o]):o in n?Promise.resolve(n[o]):o in r?r[o]:o in t?(r[o]=w(o),r[o]):(r[o]=D(o).then(function(){if(!(o in t)){var e=c(o,Error(`Module not defined after script load`));throw a[o]=e,e}return w(o)}).catch(function(e){delete r[o];var t=c(o,e);throw a[o]=t,t}),r[o])}function w(e){var i=t[e],o=E(e),s=y(),c=b(e,s);return Promise.all(i.deps.map(function(t){return t===`exports`?s:t===`require`?o:t===`module`?c:C(t,e).catch(function(n){throw l(e,t,n)})})).then(function(t){var a=i.factory.apply(null,t);return a&&typeof a.then==`function`?a.then(function(t){return n[e]=t===void 0?c.exports:t,delete r[e],n[e]}):(n[e]=a===void 0?c.exports:a,delete r[e],n[e])}).catch(function(t){throw delete r[e],a[e]=t,t})}function T(e){var r=t[e],i=E(e),o=y(),s=b(e,o);try{var u=r.deps.map(function(t){if(t===`exports`)return o;if(t===`require`)return i;if(t===`module`)return s;try{return S(t,e)}catch(n){throw l(e,t,n)}}),d=r.factory.apply(null,u);if(d&&typeof d.then==`function`)throw c(e,Error(`Module resolved asynchronously and cannot be syncRequired`));return n[e]=d===void 0?s.exports:d,n[e]}catch(t){throw a[e]=t,t}}function E(e){var r=function(r,i,a){if(Array.isArray(r))return x(r,i,a,e);var o=f(r,e);return o in n?n[o]:o in t?S(r,e):C(r,e)};return r.resolve=function(t){return f(t,e)},r.toUrl=function(t){return g(t,e)},r.sync=function(t){return S(t,e)},r}function D(e){if(e in i)return i[e];var t=g(e);return document.querySelector(`script[src="`+t+`"]`)?(i[e]=Promise.resolve(),i[e]):(i[e]=new Promise(function(n,r){var a=document.createElement(`script`);a.src=t,a.setAttribute(`data-amd-module-id`,e),a.async=!0,a.onload=function(){n()},a.onerror=function(){delete i[e],r(Error(`Failed to load script: `+t))},document.head.appendChild(a)}),i[e])}x.config=function(e){if(e.baseUrl&&(o=e.baseUrl),e.paths)for(var t in e.paths)Object.prototype.hasOwnProperty.call(e.paths,t)&&(s[t]=e.paths[t])},x.modules=t,x.resolved=n,x.errors=a,x.toUrl=g,x.sync=S,e.define=v,e.require=x,e.syncRequire=S})(),e.require.config({baseUrl:`./`,paths:{core:`emailmaker-core.0f53b24b.js`}});
16
16
 
17
17
  // PublicPath (script detection via document.currentScript)
18
18
  if (!__emailmaker__.publicPath) {
@@ -740,7 +740,7 @@ __emailmaker__.define(`emailmaker.js`,[`require`,`exports`,`module`],function(e,
740
740
  100% {
741
741
  transform: rotate(360deg);
742
742
  }
743
- }`;function ue(){return()=>{}}function de(e,t){if(!U()||!e||typeof document>`u`)return ue();e.querySelectorAll(`.blocks-app-initial-spinner-wrapper`).forEach(e=>{e.remove()});let n=document.createElement(`div`);n.classList.add(`blocks-app-initial-spinner-wrapper`);let r=document.createElement(`div`);r.classList.add(`blocks-app-initial-spinner`),n.appendChild(r);let i=document.createElement(`style`);i.setAttribute(t,`true`),i.textContent=W,document.head?.appendChild(i),e.appendChild(n);let a=!1;return()=>{a||(a=!0,n.remove(),i.remove())}}function G(e){return f(e)}G(`HANDLE_ATOM_INSERT`),G(`SETTINGS_PANEL_EVENT`),G(`MODAL_SHOW_EVENT`),G(`MODAL_CLOSE_EVENT`),G(`MODAL_UPDATE_EVENT`);var fe=i((e=>{var t={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},n=Object.assign,r={};function i(e,n,i){this.props=e,this.context=n,this.refs=r,this.updater=i||t}i.prototype.isReactComponent={},i.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},i.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function a(){}a.prototype=i.prototype;function o(e,n,i){this.props=e,this.context=n,this.refs=r,this.updater=i||t}var s=o.prototype=new a;s.constructor=o,n(s,i.prototype),s.isPureReactComponent=!0,Array.isArray}));i(((e,t)=>{t.exports=fe()}))();function K(e){return f(e)}var pe;(function(e){e.BEFORE_SAVE_EMAIL=K(),e.ON_SAVEBUTTON_CLICK_ID=K(),e.ON_NEXTBUTTON_CLICK_ID=K(),e.ON_PREVIOUSBUTTON_CLICK_ID=K(),e.ON_MODEL_CHANGE=K(),e.WILL_EMAIL_INIT_ID=K(),e.ON_EMAIL_INIT_ID=K(),e.ON_BLOCK_INIT_ID=K(),e.ON_CONTENT_CHANGED_ID=K(),e.ON_PREHEADER_CHANGED_ID=K(),e.ON_SUBJECT_CHANGED_ID=K(),e.ON_EMAIL_CHANGED_ID=K(),e.ON_BLOCK_CHANGED_ID=K(),e.ON_CHUNKS_LOADED=K(),e.ON_SEND_TESTEMAIL_ID=K(),e.ON_SEND_LIVEPREVIEW_ID=K(),e.ON_SHARE_ID=K(),e.ON_SHOW_PREVIEW_ID=K(),e.ON_EMAIL_CLONE_ID=K(),e.ON_SEND_EMAIL_MODAL_ID=K(),e.ON_NOTIFICATION=K(),e.READ_LOCALE=K(),e.ON_TRANSLATE_ID=K(),e.ON_CODE_VALIDATE_ID=K(),e.UPLOAD_EVENT_ID=K(),e.PROXY_URL_EVENT_ID=K(),e.FILE_PROXY_EVENT_ID=K(),e.ON_LIMIT_ID=K(),e.ON_GLOBAL_BLOCK_PROPAGATE_UPDATE_ID=K(),e.ON_BROWSER_EXTENSION_DETECTED_ID=K()})(pe||={}),K(`APP_LOAD_EVENT`),K(`CONFIG_CHANGED_EVENT`);function q(e){for(;e.endsWith(`/`);)e=e.slice(0,e.length-1);return/\/wp-json$/i.test(e)?e:`${e}/wp-json`}q(`https://app.emailmaker.ru/api/`);var me;(function(e){let t=`https://racs.emcdn.ru/v3`;function n(e,n){let r={method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:JSON.stringify(n)};return fetch(`${t}?resource=${e}&dataset=${document.location.hostname}`,r)}e.post=n;async function r(e,n=0){let r={method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:`{"filter":{},"limit":${n}}`};return await(await fetch(`${t}/get?resource=${e}&dataset=${document.location.hostname}`,r)).json()}e.getAll=r})(me||={});var J=new Map,Y=new WeakMap;function X(e){return q(String(e||``).trim()||`https://app.emailmaker.ru/api/`)}async function he(e){if(!e.getAuthToken)return;let t=await e.getAuthToken(e.user,e.project,void 0);return t?`Bearer ${t}`:void 0}function ge(e){return async({baseUrl:t})=>{let n=X(t);if(!n)throw Error(`[Loader] appInit warmup requires baseUrl or REACT_APP_OPENAPI_BASE_URL`);let r=new Headers({Accept:`application/json`,"Content-Type":`application/x-www-form-urlencoded;charset=UTF-8`}),i=await he(e);i&&r.set(`authorization`,i);let a=await fetch(`${n}/app/v1/app_init`,{method:`POST`,headers:r,body:new URLSearchParams,credentials:`same-origin`});if(!a.ok)throw Error(`[Loader] appInit request failed: ${a.status} ${a.statusText}`);return a.json()}}function _e(e){return JSON.stringify({baseUrl:X(e.baseUrl)||``,project:e.project??``,userId:e.user?.id??``})}function ve(e){return async t=>{let n=_e(t),r=J.get(n);if(r)return r;let i=Promise.resolve(e(t)).catch(e=>{throw J.delete(n),e});return J.set(n,i),i}}function ye(e){if(e.standaloneKey)return e;let t=e.appInit||ge(e),n=Y.get(t);return n||(n=ve(t),Y.set(t,n)),Promise.resolve(n({baseUrl:e.baseUrl,user:e.user,project:e.project,prevApp:void 0})).catch(e=>{}),{...e,appInit:n}}var Z=new WeakMap;function be(e){let t=null;return async(n,r,i)=>(t||=Promise.resolve(e(n,r,i)).finally(()=>{t=null}),t)}function xe(e){if(e.standaloneKey)return e;let t=e.getAuthToken;if(!t)return e;let n=Z.get(t);return n||(n=be(t),Z.set(t,n)),Promise.resolve(n(e.user,e.project,void 0)).catch(e=>{}),{...e,getAuthToken:n}}var Q=a({FileManagerApiError:()=>y}),Se=a({mapHttpStatusToErrorCode:()=>b});function Ce(e,t){return{...e,element:t}}function $(){return()=>{}}function we(e){let t=e.element;return!t||typeof t==`string`||typeof document>`u`?$():(z(t,e.config?.styles,t),()=>{B(t)})}function Te(e){if(!U()||e.initialSpinner===!1||typeof document>`u`)return{options:e,cleanup:$()};let t=e.element;if(!t||typeof t==`string`)return{options:e,cleanup:$()};t.querySelectorAll(`.blocks-app-initial-spinner-wrapper`).forEach(e=>{e.remove()});let n=de(t,`data-emailmaker`),r=e.handleChunkLoaded;return{options:{...e,handleChunkLoaded:()=>{n(),r?.()}},cleanup:n}}function Ee(e){return e?.length?e.some(e=>Array.isArray(e)?!1:!!(e&&typeof e==`object`&&`url`in e)):!1}var De=`1.1.5`;async function Oe(e){await D(typeof __emailmaker__<`u`?__emailmaker__:void 0)}async function ke(e){let t=new o,n=await V(e.element,t);t.dispose();let r=ye(xe(Ce(e,n)));if(n){let e=H.get(n);if(e)try{let t=await e;if(t.getElement()===n)return t.reset(r)}catch{H.get(n)===e&&H.delete(n)}}let i=we(r),a=Te(r),s=a.options;await T();let c=typeof __emailmaker__<`u`?__emailmaker__:void 0;Ee(s.plugins)?await E(c):A(c);let l=S().then(e=>e.init(s));n&&H.set(n,l);try{let e=await l;return n&&H.set(n,e),e}catch(e){throw i(),a.cleanup(),n&&H.get(n)===l&&H.delete(n),e}}async function Ae(e){return(await S()).parseAMP(e)}typeof window<`u`&&j(typeof __emailmaker__<`u`?__emailmaker__:void 0),Object.defineProperty(t,"errors",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(t,"helpers",{enumerable:!0,get:function(){return Se}}),t.init=ke,t.parseAMP=Ae,t.pluginRegistry=P,t.preload=Oe,t.version=De});
743
+ }`;function ue(){return()=>{}}function de(e,t){if(!U()||!e||typeof document>`u`)return ue();e.querySelectorAll(`.blocks-app-initial-spinner-wrapper`).forEach(e=>{e.remove()});let n=document.createElement(`div`);n.classList.add(`blocks-app-initial-spinner-wrapper`);let r=document.createElement(`div`);r.classList.add(`blocks-app-initial-spinner`),n.appendChild(r);let i=document.createElement(`style`);i.setAttribute(t,`true`),i.textContent=W,document.head?.appendChild(i),e.appendChild(n);let a=!1;return()=>{a||(a=!0,n.remove(),i.remove())}}function G(e){return f(e)}G(`HANDLE_ATOM_INSERT`),G(`SETTINGS_PANEL_EVENT`),G(`MODAL_SHOW_EVENT`),G(`MODAL_CLOSE_EVENT`),G(`MODAL_UPDATE_EVENT`);var fe=i((e=>{var t={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},n=Object.assign,r={};function i(e,n,i){this.props=e,this.context=n,this.refs=r,this.updater=i||t}i.prototype.isReactComponent={},i.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},i.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function a(){}a.prototype=i.prototype;function o(e,n,i){this.props=e,this.context=n,this.refs=r,this.updater=i||t}var s=o.prototype=new a;s.constructor=o,n(s,i.prototype),s.isPureReactComponent=!0,Array.isArray}));i(((e,t)=>{t.exports=fe()}))();function K(e){return f(e)}var pe;(function(e){e.BEFORE_SAVE_EMAIL=K(),e.ON_SAVEBUTTON_CLICK_ID=K(),e.ON_NEXTBUTTON_CLICK_ID=K(),e.ON_PREVIOUSBUTTON_CLICK_ID=K(),e.ON_MODEL_CHANGE=K(),e.WILL_EMAIL_INIT_ID=K(),e.ON_EMAIL_INIT_ID=K(),e.ON_BLOCK_INIT_ID=K(),e.ON_CONTENT_CHANGED_ID=K(),e.ON_PREHEADER_CHANGED_ID=K(),e.ON_SUBJECT_CHANGED_ID=K(),e.ON_EMAIL_CHANGED_ID=K(),e.ON_BLOCK_CHANGED_ID=K(),e.ON_CHUNKS_LOADED=K(),e.ON_SEND_TESTEMAIL_ID=K(),e.ON_SEND_LIVEPREVIEW_ID=K(),e.ON_SHARE_ID=K(),e.ON_SHOW_PREVIEW_ID=K(),e.ON_EMAIL_CLONE_ID=K(),e.ON_SEND_EMAIL_MODAL_ID=K(),e.ON_NOTIFICATION=K(),e.READ_LOCALE=K(),e.ON_TRANSLATE_ID=K(),e.ON_CODE_VALIDATE_ID=K(),e.UPLOAD_EVENT_ID=K(),e.PROXY_URL_EVENT_ID=K(),e.FILE_PROXY_EVENT_ID=K(),e.ON_LIMIT_ID=K(),e.ON_GLOBAL_BLOCK_PROPAGATE_UPDATE_ID=K(),e.ON_BROWSER_EXTENSION_DETECTED_ID=K()})(pe||={}),K(`APP_LOAD_EVENT`),K(`CONFIG_CHANGED_EVENT`);function q(e){for(;e.endsWith(`/`);)e=e.slice(0,e.length-1);return/\/wp-json$/i.test(e)?e:`${e}/wp-json`}q(`https://app.emailmaker.ru/api/`);var me;(function(e){let t=`https://racs.emcdn.ru/v3`;function n(e,n){let r={method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:JSON.stringify(n)};return fetch(`${t}?resource=${e}&dataset=${document.location.hostname}`,r)}e.post=n;async function r(e,n=0){let r={method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:`{"filter":{},"limit":${n}}`};return await(await fetch(`${t}/get?resource=${e}&dataset=${document.location.hostname}`,r)).json()}e.getAll=r})(me||={});var J=new Map,Y=new WeakMap;function X(e){return q(String(e||``).trim()||`https://app.emailmaker.ru/api/`)}async function he(e){if(!e.getAuthToken)return;let t=await e.getAuthToken(e.user,e.project,void 0);return t?`Bearer ${t}`:void 0}function ge(e){return async({baseUrl:t})=>{let n=X(t);if(!n)throw Error(`[Loader] appInit warmup requires baseUrl or REACT_APP_OPENAPI_BASE_URL`);let r=new Headers({Accept:`application/json`,"Content-Type":`application/x-www-form-urlencoded;charset=UTF-8`}),i=await he(e);i&&r.set(`authorization`,i);let a=await fetch(`${n}/app/v1/app_init`,{method:`POST`,headers:r,body:new URLSearchParams,credentials:`same-origin`});if(!a.ok)throw Error(`[Loader] appInit request failed: ${a.status} ${a.statusText}`);return a.json()}}function _e(e){return JSON.stringify({baseUrl:X(e.baseUrl)||``,project:e.project??``,userId:e.user?.id??``})}function ve(e){return async t=>{let n=_e(t),r=J.get(n);if(r)return r;let i=Promise.resolve(e(t)).catch(e=>{throw J.delete(n),e});return J.set(n,i),i}}function ye(e){if(e.standaloneKey)return e;let t=e.appInit||ge(e),n=Y.get(t);return n||(n=ve(t),Y.set(t,n)),Promise.resolve(n({baseUrl:e.baseUrl,user:e.user,project:e.project,prevApp:void 0})).catch(e=>{}),{...e,appInit:n}}var Z=new WeakMap;function be(e){let t=null;return async(n,r,i)=>(t||=Promise.resolve(e(n,r,i)).finally(()=>{t=null}),t)}function xe(e){if(e.standaloneKey)return e;let t=e.getAuthToken;if(!t)return e;let n=Z.get(t);return n||(n=be(t),Z.set(t,n)),Promise.resolve(n(e.user,e.project,void 0)).catch(e=>{}),{...e,getAuthToken:n}}var Q=a({FileManagerApiError:()=>y}),Se=a({mapHttpStatusToErrorCode:()=>b});function Ce(e,t){return{...e,element:t}}function $(){return()=>{}}function we(e){let t=e.element;return!t||typeof t==`string`||typeof document>`u`?$():(z(t,e.config?.styles,t),()=>{B(t)})}function Te(e){if(!U()||e.initialSpinner===!1||typeof document>`u`)return{options:e,cleanup:$()};let t=e.element;if(!t||typeof t==`string`)return{options:e,cleanup:$()};t.querySelectorAll(`.blocks-app-initial-spinner-wrapper`).forEach(e=>{e.remove()});let n=de(t,`data-emailmaker`),r=e.handleChunkLoaded;return{options:{...e,handleChunkLoaded:()=>{n(),r?.()}},cleanup:n}}function Ee(e){return e?.length?e.some(e=>Array.isArray(e)?!1:!!(e&&typeof e==`object`&&`url`in e)):!1}var De=`1.1.7`;async function Oe(e){await D(typeof __emailmaker__<`u`?__emailmaker__:void 0)}async function ke(e){let t=new o,n=await V(e.element,t);t.dispose();let r=ye(xe(Ce(e,n)));if(n){let e=H.get(n);if(e)try{let t=await e;if(t.getElement()===n)return t.reset(r)}catch{H.get(n)===e&&H.delete(n)}}let i=we(r),a=Te(r),s=a.options;await T();let c=typeof __emailmaker__<`u`?__emailmaker__:void 0;Ee(s.plugins)?await E(c):A(c);let l=S().then(e=>e.init(s));n&&H.set(n,l);try{let e=await l;return n&&H.set(n,e),e}catch(e){throw i(),a.cleanup(),n&&H.get(n)===l&&H.delete(n),e}}async function Ae(e){return(await S()).parseAMP(e)}typeof window<`u`&&j(typeof __emailmaker__<`u`?__emailmaker__:void 0),Object.defineProperty(t,"errors",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(t,"helpers",{enumerable:!0,get:function(){return Se}}),t.init=ke,t.parseAMP=Ae,t.pluginRegistry=P,t.preload=Oe,t.version=De});
744
744
 
745
745
  // Возвращаем API из entry модуля
746
746
  return __emailmaker__.syncRequire("emailmaker.js");