@emailmaker/emailmaker 1.1.85-dev.2 → 1.1.85-dev.3

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 (43) hide show
  1. package/{emailmaker-core.aebc6ea7.js → emailmaker-core.fc1d4d9a.js} +8 -8
  2. package/emailmaker-esm.js +6 -6
  3. package/{emailmaker-po.aebc6ea7.js → emailmaker-po.fc1d4d9a.js} +1 -1
  4. package/emailmaker.js +11 -11
  5. package/iframe/.vite/manifest.json +4 -4
  6. package/iframe/js/{discussHandlers.kGLogf6J.js → discussHandlers.DPWv0hV2.js} +2 -2
  7. package/iframe/js/iframe-eblock.body.js +1 -1
  8. package/iframe/js/iframe-eblock.js +1 -1
  9. package/iframe/js/iframe.body.js +2 -2
  10. package/iframe/js/iframe.js +1 -1
  11. package/node_modules/@emailmaker/ui-kit/package.json +1 -1
  12. package/package.json +2 -2
  13. package/runtime/react/index.js +1 -1
  14. package/static/core/{60ec410f.js → 1655f40f.js} +1 -1
  15. package/static/core/{cebcf9a5.js → 2e39454c.js} +1 -1
  16. package/static/core/{fbccd907.js → 4138a1b9.js} +3 -3
  17. package/static/core/{c2e6de6c.js → 4598405b.js} +1 -1
  18. package/static/core/{a42770c7.js → 47e97e35.js} +1 -1
  19. package/static/core/{98a65bf6.js → 5c7e24b5.js} +1 -1
  20. package/static/core/{50109143.js → 72a579ec.js} +1 -1
  21. package/static/core/{1de56f23.js → 7b7c0c8c.js} +1 -1
  22. package/static/core/{6748af4b.js → 9a285b6a.js} +1 -1
  23. package/static/core/{44829f84.js → a215213f.js} +1 -1
  24. package/static/core/{613d8a7a.js → a6fed2cf.js} +6 -6
  25. package/static/core/{65870018.js → b73e046e.js} +1 -1
  26. package/static/core/{d1b67ebe.js → b9758690.js} +1 -1
  27. package/static/core/{56d131f3.js → bf9d8272.js} +1 -1
  28. package/static/core/{17461e5e.js → cc50fc65.js} +1 -1
  29. package/static/core/{649bbe61.js → d2342090.js} +1 -1
  30. package/static/core/{dea46f93.js → de611927.js} +1 -1
  31. package/static/core/{a984d7cb.js → e2f501f0.js} +1 -1
  32. package/static/core/{9388c451.js → e9fd7972.js} +1 -1
  33. package/static/core/{ddf40214.js → ebeee027.js} +1 -1
  34. package/static/core/{88f21f92.js → f0fb869f.js} +1 -1
  35. package/static/core/{bf8b37be.js → f4a519b0.js} +1 -1
  36. package/static/core/{c7d949de.js → fabc717f.js} +1 -1
  37. package/static/umd-runtime/runtime.js +1 -1
  38. package/vite/index.cjs +99 -3
  39. package/vite/index.js +99 -3
  40. package/webpack/index.cjs +93 -0
  41. package/webpack/index.js +93 -0
  42. /package/iframe/{iframe-eblock.aebc6ea7.html → iframe-eblock.fc1d4d9a.html} +0 -0
  43. /package/iframe/{iframe.aebc6ea7.html → iframe.fc1d4d9a.html} +0 -0
package/emailmaker-esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import{t as ei}from"./static/esm/50fbfdf6.js";import{$ as Ko,A as Wo,At as Yo,B as Xo,C as Jo,Ct as te,D as Qo,Dt as ft,E as Zo,Et as es,F as We,G as ti,H as Ye,I as ts,J as ns,K as rs,L as is,M as os,Mt as Q,N as Ze,O as ni,Ot as O,P as ss,Q as ri,R as as,S as ls,St as ds,T as cs,Tt as $,V as Hn,W as us,X as fs,Y as ii,Z as Re,_ as pt,_t as ps,a as ms,at as Xt,b as hs,bt as Gn,c as gs,ct as vs,d as bt,dt as bs,et as we,f as Es,ft as F,g as oi,gt as pe,h as ys,ht as Ce,i as _s,it as oe,j as ws,jt as Ss,k as Is,kt as le,l as M,lt as qn,m as vn,mt as bn,n as Ts,nt as De,o as Le,ot as me,p as As,pt as si,q as En,r as Cs,rt as Et,s as Ps,st as Rs,t as ce,tt as k,u as Ds,ut as Os,v as xs,vt as Jt,w as ai,wt as yn,x as $n,xt as Ls,y as Ms,yt as ks,z as Te}from"./static/esm/28ceddf3.js";(function(){"use strict";var e=window.__emailmaker__=window.__emailmaker__||{};e.__facadeSentinel="@shared-runtime:init-complete",e.publicPath||(e.publicPath=(function(){var m=(function(){if(typeof document<"u"&&document.querySelector)try{var _=document.querySelector('script[src*="emailmaker-esm.js"]')||document.querySelector('script[src*="emailmaker.js"]');if(_&&_.src)return _.src.substring(0,_.src.lastIndexOf("/")+1)}catch{}try{var T=import.meta.url;if(T)return T.substring(0,T.lastIndexOf("/")+1)}catch{}return"./"})();m||(m="./");try{var c=String(m);if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(c)||c.indexOf("//")===0)return c.charAt(c.length-1)==="/"?c:c+"/";var a=typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"",p=a?new URL(c,a).href:c;return p.charAt(p.length-1)==="/"?p:p+"/"}catch{var h=String(m);return h.charAt(h.length-1)==="/"?h:h+"/"}})()),typeof e.setPublicPath!="function"&&(e.setPublicPath=function(m){return e.publicPath=(function(){var c=m==null?"":String(m);c||(c="./");try{var a=String(c);if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(a)||a.indexOf("//")===0)return a.charAt(a.length-1)==="/"?a:a+"/";var p=typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"",h=p?new URL(a,p).href:a;return h.charAt(h.length-1)==="/"?h:h+"/"}catch{var _=String(c);return _.charAt(_.length-1)==="/"?_:_+"/"}})(),e.publicPath}),e.__publicPathDiagnosticsLogged||(e.__publicPathDiagnosticsLogged=!0,(function(){var m=String(e.publicPath||"");if(m.indexOf("file:")!==0&&!(m&&m!=="./")){var c="";try{if(typeof window<"u"){for(var a in window)if(!(a==="__emailmaker__"||!/^__[^_].*__$/.test(a))){var p;try{p=window[a]}catch{continue}if(p&&typeof p=="object"&&p.publicPath){c=" Another product namespace ("+a+") has publicPath set — verify the host bundler plugin matches the installed npm brand.";break}}}}catch{}}})()),e.assetUrl||(e.assetUrl=function(m){function c(R){try{var N=typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"";return N?new URL(String(R||""),N).href:String(R||"")}catch{return String(R||"")}}var a=String(m||"");if(!a)return"";if(/^(?:data:|blob:)/.test(a))return a;if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(a)||a.indexOf("//")===0||a.charAt(0)==="/")return c(a);var p=a.replace(/^\.\/+/,"").replace(/^\/+/,""),h="static/media".replace(/^\.\/+/,"").replace(/^\/+/,"").replace(/\/+$/,""),_=h&&p.indexOf(h+"/")!==0?h+"/"+p:p,T=e.publicPath||"./";try{return new URL(_,T).href}catch{return T.slice(-1)!=="/"&&(T+="/"),c(T+_)}}),e.version||(e.version="1.1.85-dev.2");var t=e.modules=Object.create(null);if(typeof e.define!="function"){var n=`/**
1
+ import{t as ei}from"./static/esm/50fbfdf6.js";import{$ as Ko,A as Wo,At as Yo,B as Xo,C as Jo,Ct as te,D as Qo,Dt as ft,E as Zo,Et as es,F as We,G as ti,H as Ye,I as ts,J as ns,K as rs,L as is,M as os,Mt as Q,N as Ze,O as ni,Ot as O,P as ss,Q as ri,R as as,S as ls,St as ds,T as cs,Tt as $,V as Hn,W as us,X as fs,Y as ii,Z as Re,_ as pt,_t as ps,a as ms,at as Xt,b as hs,bt as Gn,c as gs,ct as vs,d as bt,dt as bs,et as we,f as Es,ft as F,g as oi,gt as pe,h as ys,ht as Ce,i as _s,it as oe,j as ws,jt as Ss,k as Is,kt as le,l as M,lt as qn,m as vn,mt as bn,n as Ts,nt as De,o as Le,ot as me,p as As,pt as si,q as En,r as Cs,rt as Et,s as Ps,st as Rs,t as ce,tt as k,u as Ds,ut as Os,v as xs,vt as Jt,w as ai,wt as yn,x as $n,xt as Ls,y as Ms,yt as ks,z as Te}from"./static/esm/28ceddf3.js";(function(){"use strict";var e=window.__emailmaker__=window.__emailmaker__||{};e.__facadeSentinel="@shared-runtime:init-complete",e.publicPath||(e.publicPath=(function(){var m=(function(){if(typeof document<"u"&&document.querySelector)try{var _=document.querySelector('script[src*="emailmaker-esm.js"]')||document.querySelector('script[src*="emailmaker.js"]');if(_&&_.src)return _.src.substring(0,_.src.lastIndexOf("/")+1)}catch{}try{var T=import.meta.url;if(T)return T.substring(0,T.lastIndexOf("/")+1)}catch{}return"./"})();m||(m="./");try{var c=String(m);if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(c)||c.indexOf("//")===0)return c.charAt(c.length-1)==="/"?c:c+"/";var a=typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"",p=a?new URL(c,a).href:c;return p.charAt(p.length-1)==="/"?p:p+"/"}catch{var h=String(m);return h.charAt(h.length-1)==="/"?h:h+"/"}})()),typeof e.setPublicPath!="function"&&(e.setPublicPath=function(m){return e.publicPath=(function(){var c=m==null?"":String(m);c||(c="./");try{var a=String(c);if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(a)||a.indexOf("//")===0)return a.charAt(a.length-1)==="/"?a:a+"/";var p=typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"",h=p?new URL(a,p).href:a;return h.charAt(h.length-1)==="/"?h:h+"/"}catch{var _=String(c);return _.charAt(_.length-1)==="/"?_:_+"/"}})(),e.publicPath}),e.__publicPathDiagnosticsLogged||(e.__publicPathDiagnosticsLogged=!0,(function(){var m=String(e.publicPath||"");if(m.indexOf("file:")!==0&&!(m&&m!=="./")){var c="";try{if(typeof window<"u"){for(var a in window)if(!(a==="__emailmaker__"||!/^__[^_].*__$/.test(a))){var p;try{p=window[a]}catch{continue}if(p&&typeof p=="object"&&p.publicPath){c=" Another product namespace ("+a+") has publicPath set — verify the host bundler plugin matches the installed npm brand.";break}}}}catch{}}})()),e.assetUrl||(e.assetUrl=function(m){function c(R){try{var N=typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"";return N?new URL(String(R||""),N).href:String(R||"")}catch{return String(R||"")}}var a=String(m||"");if(!a)return"";if(/^(?:data:|blob:)/.test(a))return a;if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(a)||a.indexOf("//")===0||a.charAt(0)==="/")return c(a);var p=a.replace(/^\.\/+/,"").replace(/^\/+/,""),h="static/media".replace(/^\.\/+/,"").replace(/^\/+/,"").replace(/\/+$/,""),_=h&&p.indexOf(h+"/")!==0?h+"/"+p:p,T=e.publicPath||"./";try{return new URL(_,T).href}catch{return T.slice(-1)!=="/"&&(T+="/"),c(T+_)}}),e.version||(e.version="1.1.85-dev.3");var t=e.modules=Object.create(null);if(typeof e.define!="function"){var n=`/**
2
2
  * Async AMD Loader (IIFE version for injection)
3
3
  *
4
4
  * This file is injected at the beginning of iframe entry points.
@@ -993,12 +993,12 @@ import{t as ei}from"./static/esm/50fbfdf6.js";import{$ as Ko,A as Wo,At as Yo,B
993
993
  __amdEnv.syncRequire = syncRequire;
994
994
  __amdEnv.diagnosticsBuffer = diagBuffer;
995
995
  })();
996
- `,r=new Function("__amdEnv",n);r(e),typeof e.require=="function"&&typeof e.require.config=="function"&&e.require.config({baseUrl:"./",paths:{core:"emailmaker-core.aebc6ea7.js",po:"emailmaker-po.aebc6ea7.js",monaco:"static/monaco/index.js"}})}e.define("__delivery__/libs",[],function(){return import("./static/esm/delivery-libs.js")});var i=function(m){var c,a=function(){return c||(c=Promise.resolve().then(m))};return{then:function(p,h){return a().then(p,h)},catch:function(p){return a().catch(p)},finally:function(p){return a().finally(p)}}},o=i(function(){return e.require(["__delivery__/libs"]).then(function(m){return m[0]})});t.React=i(function(){return o.then(function(m){return m.React})}),t.ReactDom=i(function(){return o.then(function(m){return m.ReactDom})}),t.ReactDomClient=i(function(){return o.then(function(m){return m.ReactDomClient})}),t.ReactJsxRuntime=i(function(){return o.then(function(m){return m.ReactJsxRuntime})}),t.ReactJsxDevRuntime=i(function(){return o.then(function(m){return m.ReactJsxDevRuntime})}),t.AntDesignIconBase=i(function(){return o.then(function(m){return m.AntDesignIconBase})}),t.AntDesignCssinjs=i(function(){return o.then(function(m){return m.AntDesignCssinjs})}),t.Classnames=i(function(){return o.then(function(m){return m.Classnames})}),t.Dayjs=i(function(){return o.then(function(m){return m.Dayjs})});var s=i(function(){return Promise.all([o]).then(function(m){var c=m[0]||Object.create(null),a=Object.create(null);for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&(a[p]=c[p]);for(var h in a)Object.prototype.hasOwnProperty.call(a,h)&&(t[h]=a[h]);return a})}),d={},l={Antd:"[runtime] `antd` is not available: the compatibility layer for global plugins is not enabled. Add `import '@emailmaker/emailmaker/compat-globals';` before creating the editor, or turn on the `compatGlobals` option of the bundler plugin. ESM builds omit this layer by default so that plugin compatibility is not paid for by every integrator.",AntDesignIcons:"[runtime] `@ant-design/icons` is not available: the compatibility layer for global plugins is not enabled. Add `import '@emailmaker/emailmaker/compat-globals';` before creating the editor, or turn on the `compatGlobals` option of the bundler plugin. ESM builds omit this layer by default so that plugin compatibility is not paid for by every integrator."},f={Antd:"[runtime] `antd` is served from the host runtime for backward compatibility. Rebuild the plugin with the current CLI to bundle it from its own copy of the package. This compatibility layer is deprecated.",AntDesignIcons:"[runtime] `@ant-design/icons` is served from the host runtime for backward compatibility. Rebuild the plugin with the current CLI to bundle it from its own copy of the package. This compatibility layer is deprecated."},u=Object.create(null);if(e.registerCompat=function(m){if(!(!m||typeof m!="object"))for(var c in m)Object.prototype.hasOwnProperty.call(m,c)&&(u[c]=m[c])},e.__compatPending){for(var g=0;g<e.__compatPending.length;g+=1)e.registerCompat(e.__compatPending[g]);e.__compatPending=void 0}for(var b in l)Object.prototype.hasOwnProperty.call(l,b)&&(function(m,c,a){var p=!1,h=function(){if(!(m in u))throw new Error(c);return u[m]};Object.defineProperty(t,m,{configurable:!0,enumerable:!0,get:function(){var _=h();return p||(p=!0),_},set:function(_){u[m]=_}}),Object.defineProperty(d,m,{configurable:!0,enumerable:!0,get:h,set:function(_){u[m]=_}})})(b,l[b],f[b]);var E=t;for(var I in d)Object.prototype.hasOwnProperty.call(d,I)&&(E===t&&(E=Object.create(t)),Object.defineProperty(E,I,Object.getOwnPropertyDescriptor(d,I)));var v=s,y=[],w=function(){for(var m=[],c=0;c<y.length;c+=1)(function(a){var p=t[a];p&&typeof p.then=="function"&&m.push(Promise.resolve(p).then(function(h){t[a]=h}))})(y[c]);return Promise.all(m)},S=typeof e.prefetch=="function"?e.prefetch:void 0;if(e.prefetch=function(){return s.then(w).then(function(){if(typeof S=="function")return S.call(e)})},typeof e.define=="function"){let m=function(c){if(!c||typeof c!="object"&&typeof c!="function"||c.__esModule)return c;if(A){var a=A.get(c);if(a)return a}var p=Object.create(null);Object.defineProperties(p,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});for(var h=Reflect.ownKeys(c),_=0;_<h.length;_++){var T=h[_];if(T!=="__esModule"){var R=Object.getOwnPropertyDescriptor(c,T);R&&Object.defineProperty(p,T,R)}}return Object.prototype.hasOwnProperty.call(p,"default")||Object.defineProperty(p,"default",{enumerable:!0,value:c,writable:!1}),A&&A.set(c,p),p};var A=typeof WeakMap<"u"?new WeakMap:null;e.define("react",[],function(){var c=E.React;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.React)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.React;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/react",[],function(){var c=E.React;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.React)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.React;return m(p)})}),e.define("react-dom",[],function(){var c=E.ReactDom;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.ReactDom)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.ReactDom;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/react-dom",[],function(){var c=E.ReactDom;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.ReactDom)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.ReactDom;return m(p)})}),e.define("react-dom/client",[],function(){var c=E.ReactDomClient;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.ReactDomClient)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.ReactDomClient;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/react-dom/client",[],function(){var c=E.ReactDomClient;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.ReactDomClient)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.ReactDomClient;return m(p)})}),e.define("react/jsx-runtime",[],function(){var c=E.ReactJsxRuntime;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.ReactJsxRuntime)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.ReactJsxRuntime;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/react/jsx-runtime",[],function(){var c=E.ReactJsxRuntime;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.ReactJsxRuntime)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.ReactJsxRuntime;return m(p)})}),e.define("react/jsx-dev-runtime",[],function(){var c=E.ReactJsxDevRuntime;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.ReactJsxDevRuntime)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.ReactJsxDevRuntime;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/react/jsx-dev-runtime",[],function(){var c=E.ReactJsxDevRuntime;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.ReactJsxDevRuntime)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.ReactJsxDevRuntime;return m(p)})}),e.define("antd",[],function(){var c=E.Antd;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.Antd)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.Antd;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/antd",[],function(){var c=E.Antd;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.Antd)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.Antd;return m(p)})}),e.define("@ant-design/icons/es/components/AntdIcon",[],function(){var c=E.AntDesignIconBase;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.AntDesignIconBase)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.AntDesignIconBase;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/@ant-design/icons/es/components/AntdIcon",[],function(){var c=E.AntDesignIconBase;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.AntDesignIconBase)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.AntDesignIconBase;return m(p)})}),e.define("@ant-design/icons",[],function(){var c=E.AntDesignIcons;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.AntDesignIcons)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.AntDesignIcons;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/@ant-design/icons",[],function(){var c=E.AntDesignIcons;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.AntDesignIcons)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.AntDesignIcons;return m(p)})}),e.define("@ant-design/cssinjs",[],function(){var c=E.AntDesignCssinjs;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.AntDesignCssinjs)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.AntDesignCssinjs;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/@ant-design/cssinjs",[],function(){var c=E.AntDesignCssinjs;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.AntDesignCssinjs)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.AntDesignCssinjs;return m(p)})}),e.define("classnames",[],function(){var c=E.Classnames;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.Classnames)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.Classnames;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/classnames",[],function(){var c=E.Classnames;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.Classnames)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.Classnames;return m(p)})}),e.define("dayjs",[],function(){var c=E.Dayjs;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.Dayjs)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.Dayjs;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/dayjs",[],function(){var c=E.Dayjs;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.Dayjs)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.Dayjs;return m(p)})}),e.define("@emailmaker/ui-kit",[],function(){var c=E.UiKit;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.UiKit)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.UiKit;return m(p)})}),e.define("@emailmaker/emailmaker/ui-kit",[],function(){var c=E.UiKit;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.UiKit)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.UiKit;return m(p)})}),e.define("@emailmaker/emailmaker/ui-kit/icons",[],function(){var c=E.UiKitIcons;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.UiKitIcons)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.UiKitIcons;return m(p)})}),e.define("@emailmaker/ui-kit/icons",[],function(){var c=E.UiKitIcons;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.UiKitIcons)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.UiKitIcons;return m(p)})})}globalThis.__SHARED_RUNTIME_INIT_SENTINEL__="@shared-runtime:init-complete"})();var Ns=new Function("url","return import(url)");function Fs(e){if(typeof e!="function")return!1;try{return Reflect.construct(String,[],e),!0}catch{return!1}}function js(e){return typeof e=="object"&&e!==null&&"type"in e&&"url"in e}function Bs(e){return e.type==="umd"||e.resolve==="registry"}var Us=class{_context;_pluginRegistry;_options;_map=new Map;_optionsMap=new Map;_readyMap=new Map;_resolveMap=new Map;_initializingPlugins=new Map;_creatingPlugins=new Set;_initializedPlugins=new Set;_creationOrder=[];_lifecycleListeners=new Set;_activated=!1;constructor(e,t,n={}){this._context=e,this._pluginRegistry=t,this._options=n}activate(){return this._activated=!0,this._startPluginsBatch(Array.from(this._map.values()))}activateSync(){this._activated=!0,this._startPluginsBatch(Array.from(this._map.values()))}onLifecycle(e){return this._lifecycleListeners.add(e),{dispose:()=>this._lifecycleListeners.delete(e)}}_emitLifecycle(e){for(const t of Array.from(this._lifecycleListeners))try{t(e)}catch{}}async _resolveEntry(e){if(typeof e=="string"||typeof e=="symbol"){const t=await this._pluginRegistry.getAsync(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered.`);return{ctor:t}}if(typeof e=="function")return e.length===0?{ctor:await e()}:{ctor:e};if(Array.isArray(e)){const[t,n]=e;if(typeof t=="function")return{ctor:t,options:n};const r=await this._pluginRegistry.getAsync(t);if(!r)throw new Error(`Plugin "${String(t)}" not registered.`);return{ctor:r,options:n}}if(js(e))return this._resolveDescriptor(e);throw new Error(`Unknown plugin entry format: ${JSON.stringify(e)}`)}async _resolveDescriptor(e){const t=e.resolve??(e.type==="umd"?"window":"module");if(Bs(e)&&await this._options.ensureHostRuntimeReady?.(e),e.type==="esm"){const n=await Ns(e.url);if(t==="module")return{ctor:n.default??n};if(t==="registry"&&e.name){const r=await this._pluginRegistry.getAsync(e.name);if(!r)throw new Error(`Plugin "${e.name}" not found in registry after ESM load`);return{ctor:r}}}if(e.type==="umd"){if(await this._loadScript(e.url),t==="window"&&e.name){const n=globalThis[e.name];if(!n)throw new Error(`Plugin "${e.name}" not found on window after script load`);return{ctor:n}}if(t==="registry"&&e.name){const n=await this._pluginRegistry.getAsync(e.name);if(!n)throw new Error(`Plugin "${e.name}" not found in registry after script load`);return{ctor:n}}}throw new Error(`Cannot resolve descriptor: type=${e.type}, resolve=${t}, name=${e.name??"none"}`)}_loadScript(e){return new Promise((t,n)=>{if(typeof document>"u"){n(new Error("Cannot load UMD script in non-browser environment"));return}const r=document.createElement("script");r.src=e,r.onload=()=>t(),r.onerror=()=>n(new Error(`Failed to load script: ${e}`)),document.head.appendChild(r)})}initSync(e){const t=[];for(const n of e){const r=this._getOrCreate(n,void 0);t.push(r)}this._activated=!0,this._startPluginsBatch(t)}async init(e){const t=[],n=new Set;for(const r of e){const{ctor:i,options:o}=await this._resolveEntry(r),s=this._getOrCreate(i,o);n.has(s)||(n.add(s),t.push(s))}this._activated=!0,await this._startPluginsBatch(t)}async setPlugins(e){const t=new Set,n=[];for(const s of e){const d=await this._resolveEntry(s);t.add(d.ctor),n.push(d)}const r=[];this._map.forEach((s,d)=>{t.has(d)||r.push({key:d,plugin:s})});for(let s=r.length-1;s>=0;s--){const{key:d,plugin:l}=r[s];await this._initializingPlugins.get(l),await this._disposePlugin(l,l.constructor.name),this._map.delete(d),this._optionsMap.delete(d),this._readyMap.delete(l),this._resolveMap.delete(l),this._initializingPlugins.delete(l),this._initializedPlugins.delete(l);const f=this._creationOrder.indexOf(l);f>=0&&this._creationOrder.splice(f,1)}const i=[],o=new Set;for(const{ctor:s,options:d}of n){const l=this._getOrCreate(s,d);o.has(l)||(o.add(l),i.push(l))}this._activated&&await this._startPluginsBatch(i)}isReady(e){return this._initializedPlugins.has(e)}ready(e){return this._initializingPlugins.get(e)??this._readyMap.get(e)??Promise.resolve()}async waitFor(e,t){if(this._pluginRegistry.has(e))return this.useByKeyAsync(e);const{timeout:n}=t??{};return await new Promise((r,i)=>{let o,s=!1;const d=()=>{s||(s=!0,o&&clearTimeout(o),this._pluginRegistry.off(e,d),r())};this._pluginRegistry.on(e,d),n!==void 0&&n>0&&(o=setTimeout(()=>{s||(s=!0,this._pluginRegistry.off(e,d),i(new Error(`waitFor("${String(e)}") timed out after ${n}ms`)))},n))}),this.useByKeyAsync(e)}useByKey(e){const t=this._pluginRegistry.get(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered or not loaded yet. Use useByKeyAsync() for async plugins.`);const n=this._getOrCreate(t);return this._activated&&this._startPluginsBatch([n]),n}async useByKeyAsync(e){const t=await this._pluginRegistry.getAsync(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered.`);const n=this._getOrCreate(t);return this._activated&&await this._startPluginsBatch([n]),n}useByCtor(e,t){const n=this._getOrCreate(e,t);return this._activated&&this._startPluginsBatch([n]),n}use(e){return typeof e=="function"?this.useByCtor(e):this.useByKey(e)}async useAsync(e){const{ctor:t,options:n}=await this._resolveEntry(e),r=this._getOrCreate(t,n);return this._activated&&await this._startPluginsBatch([r]),r}_getOrCreate(e,t){const n=e;if(!this._map.has(n)){t!==void 0&&this._optionsMap.set(n,t);const r=this._optionsMap.get(n),i=this._createPluginInstance(e,r),o=i.constructor.name;this._emitLifecycle({type:"created",plugin:i,name:o}),i.required?.(),this._map.set(n,i),this._creationOrder.push(i),this._setupReadyPromise(i)}return this._map.get(n)}_createPluginInstance(e,t){const n=e;if(this._creatingPlugins.has(n))throw new Error(`Cyclic dependency for plugin ${e.name}`);this._creatingPlugins.add(n);try{return Fs(e)?new e(this._context,t):e(this._context,t)||{}}finally{this._creatingPlugins.delete(n)}}_setupReadyPromise(e){const t=new Promise(n=>{this._resolveMap.set(e,n)});this._readyMap.set(e,t)}async _startPluginsBatch(e){const t=Array.from(new Set(e)),n=new Set,r=[];for(const i of t){if(this._initializedPlugins.has(i))continue;const o=this._initializingPlugins.get(i);if(o){n.add(o);continue}r.push(i)}if(r.length>0){const i=this._runBatchLifecycle(r);for(const o of r)this._initializingPlugins.set(o,i);n.add(i),i.finally(()=>{for(const o of r)this._initializingPlugins.get(o)===i&&this._initializingPlugins.delete(o)})}await Promise.all(n)}async _runBatchLifecycle(e){const t=[];for(const n of e){const r=n.constructor.name;this._emitLifecycle({type:"init:start",plugin:n,name:r});try{await n.init?.(),this._emitLifecycle({type:"init:success",plugin:n,name:r}),t.push(n)}catch(i){this._emitLifecycle({type:"init:error",plugin:n,name:r,error:i})}}for(const n of t){const r=n.constructor.name;this._emitLifecycle({type:"afterInit:start",plugin:n,name:r});try{await n.afterInit?.(),this._emitLifecycle({type:"afterInit:success",plugin:n,name:r})}catch(i){this._emitLifecycle({type:"afterInit:error",plugin:n,name:r,error:i})}}for(const n of e)this._initializedPlugins.add(n),this._resolveMap.get(n)?.(),this._resolveMap.delete(n)}async _disposePlugin(e,t){this._emitLifecycle({type:"dispose:start",plugin:e,name:t});try{await e.dispose?.(),this._emitLifecycle({type:"dispose:success",plugin:e,name:t})}catch(n){this._emitLifecycle({type:"dispose:error",plugin:e,name:t,error:n})}}async dispose(){for(let e=this._creationOrder.length-1;e>=0;e--){const t=this._creationOrder[e];await this._initializingPlugins.get(t),await this._disposePlugin(t,t.constructor.name)}this._map.clear(),this._optionsMap.clear(),this._readyMap.clear(),this._resolveMap.clear(),this._initializingPlugins.clear(),this._initializedPlugins.clear(),this._creationOrder.length=0,this._lifecycleListeners.clear()}getStatus(){return Array.from(this._map.values()).map(e=>({name:e.constructor.name,initialized:this._initializedPlugins.has(e)}))}},Hs=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){const n=this._plugins.get(e);if(n?.overrides)for(const r of n.overrides)t=r(t)||t;return t}_notifyListeners(e,t){const n=this._listeners.get(e);if(!n||n.length===0)return;for(const i of n)try{i.callback(t)}catch{}const r=n.filter(i=>!i.once);r.length>0?this._listeners.set(e,r):this._listeners.delete(e)}get(e){const t=this._plugins.get(e);if(t?.ctor)return this._applyOverrides(e,t.ctor)}async getAsync(e){const t=this._plugins.get(e);if(t?.ctor)return this._applyOverrides(e,t.ctor);if(t?.loading){const n=await t.loading;return this._applyOverrides(e,n)}if(t?.factory){const n=Promise.resolve(t.factory()).then(i=>(t.ctor=i,t.loading=void 0,this._notifyListeners(e,i),i));t.loading=n;const r=await n;return this._applyOverrides(e,r)}return new Promise(n=>{this.on(e,r=>n(this._applyOverrides(e,r)))})}add(e,t){const n=this._getOrCreateEntry(e);n.ctor=t,this._notifyListeners(e,t)}addAll(e){for(const t of Object.keys(e)){const n=e[t];n!==void 0&&this.add(t,n)}}addAsync(e,t){const n=this._getOrCreateEntry(e);return n.factory=t,{dispose:()=>{n.ctor||(n.factory=void 0)}}}has(e){const t=this._plugins.get(e);return!!(t?.ctor||t?.factory)}isLoaded(e){return!!this._plugins.get(e)?.ctor}override(e,t){const n=this._getOrCreateEntry(e);return n.overrides.push(t),{dispose:()=>{const r=n.overrides.indexOf(t);r>=0&&n.overrides.splice(r,1)}}}on(e,t){const n=this.get(e);n&&t(n);let r=this._listeners.get(e);r||(r=[],this._listeners.set(e,r));const i={callback:t,once:!1};return r.push(i),{dispose:()=>this._removeListener(e,t)}}once(e,t){const n=this.get(e);if(n)return t(n),{dispose:()=>{}};let r=this._listeners.get(e);r||(r=[],this._listeners.set(e,r));const i={callback:t,once:!0};return r.push(i),{dispose:()=>this._removeListener(e,t)}}off(e,t){this._removeListener(e,t)}_removeListener(e,t){const n=this._listeners.get(e);if(n){const r=n.findIndex(i=>i.callback===t);r>=0&&n.splice(r,1),n.length===0&&this._listeners.delete(e)}}keys(){return Array.from(this._plugins.keys())}forContext(){const e=this;return{add(t,n){e.add(t,n)}}}},Gs=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()}},zn=class{capacity;items=[];constructor(e){this.capacity=e}push(e){this.items.length>=this.capacity&&this.items.shift(),this.items.push(e)}snapshot(){return this.items.slice()}size(){return this.items.length}clear(){this.items=[]}};function qs(e,t){return t+e}function $s(){return typeof performance>"u"?Date.now():qs(performance.now(),performance.timeOrigin)}var zs="emailmaker:diagnostics",Vs="diagnostics",Ks="diagnostics";function Vn(e,t){return t?`${e}${e.includes("?")?"&":"?"}${Ks}=1`:e}var At;function Ws(){try{const e=new URLSearchParams(window.location.search).get(Vs);return e===null?void 0:e!=="0"}catch{return}}function Ys(){const e=window.__DIAGNOSTICS__;return typeof e=="boolean"?e:void 0}function Xs(){try{const e=window.localStorage.getItem(zs);return e===null?void 0:e==="1"}catch{return}}function qe(){return At===void 0&&(At=typeof window>"u"?!1:Ws()??Ys()??Xs()??!1),At}function Js(e){return`__${(e||"emailmaker").toLowerCase().replaceAll("-","")}__`}var J={initStart:"loader:init:start",coreReady:"loader:core:ready",initEnd:"loader:init:end",chunksLoaded:"app:chunks:loaded",showStart:"show:start",showEnd:"show:end",canvasCreated:"canvas:created",canvasLoaded:"canvas:loaded",canvasPainted:"canvas:painted",appVisible:"app:visible",editorVisible:"editor:visible",canvasSettled:"canvas:settled"},ah=Object.values(J),lh=[J.canvasPainted,J.canvasSettled,J.appVisible,J.editorVisible],Qs=5e3,Zs=3e3,Kn="diagnosticsStore",et,Ne;function Wn(){return{marks:new zn(Qs),resources:new zn(Zs)}}function li(){if(Ne)return Ne;const e=_n();return e?(Ne=e[Kn]??et??Wn(),e[Kn]=Ne,et=void 0,Ne):(et??=Wn(),et)}function G(e,t){qe()&&li().marks.push({phase:e,at:$s(),...t})}function _n(){if(typeof window.__emailmaker__<"u"&&window.__emailmaker__)return window.__emailmaker__;if(typeof window>"u")return;const e=window[Js()];return e!==null&&typeof e=="object"?e:void 0}function ea(e){const t=e.length,n=li();return e.forEach(r=>n.marks.push(r)),e.length=0,t}function ta(){const e=_n();return!e||!Array.isArray(e.diagnosticsBuffer)?0:ea(e.diagnosticsBuffer)}var na="Editor instance was destroyed and cannot be reused. A fresh instance will be created instead.";function di(){const e=new Error(na);return e.name="DestroyedInstanceError",e}function Qt(e,t){if(e===t)return!0;if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const n=Array.isArray(e);if(n!==Array.isArray(t))return!1;if(n){const o=e,s=t;return o.length===s.length&&o.every((d,l)=>Qt(d,s[l]))}const r=Object.keys(e),i=Object.keys(t);return r.length!==i.length?!1:r.every(o=>Object.prototype.hasOwnProperty.call(t,o)&&Qt(e[o],t[o]))}function ci(e,t){const n={watch(r){let i,o=!1;return e.watch(s=>{const d=t(s);o&&Qt(i,d)||(i=d,o=!0,r(d))})},select(r){return ci(n,r)}};return n}function Me(...e){let t=e[0],n=e.length>0;const r=new Set,i={get(){return n?t:void 0},set(o){t=o,n=!0;for(const s of Array.from(r))s(o)},watch(o){return r.add(o),n&&o(t),{dispose:()=>r.delete(o)}},select(o){return ci(i,o)}};return i}var ui=class{http;constructor(e){this.http=e}app_init_create=(e,t={})=>this.http.request({path:"/app/v1/app_init",method:"POST",body:e,type:fs.UrlEncoded,...t})},fi=class{http;constructor(e){this.http=e}get_translations2=({file:e,...t},n={})=>this.http.request({path:`/translations/v1/${e}`,method:"GET",...n});get_translations3=({id:e,file:t,...n},r={})=>this.http.request({path:`/translations/v1/${t}/${e}`,method:"GET",...r})};function ra(e){return String(e||"").trim()||void 0}var ia=class extends Q{deps;_app;_baseUrl;_appInit;_restBaseUrl;_prevApp;constructor(e){super(),this.deps=e,this.addDisposable(e.options.select(t=>this._slice(t)).watch(t=>this._start(t)))}get app(){return this._app}_slice(e){return Object.prototype.hasOwnProperty.call(e,"baseUrl")&&(this._baseUrl=ra(e.baseUrl)),Object.prototype.hasOwnProperty.call(e,"appInit")&&(this._appInit=e.appInit),{appInit:this._appInit,user:e.user,project:e.project,baseUrl:this._baseUrl,restBaseUrl:this.deps.resolveRestBaseUrl(this._baseUrl),standalone:this.deps.isStandalone()}}_start(e){if(this._restBaseUrl!==e.restBaseUrl&&(this._restBaseUrl=e.restBaseUrl,this.deps.setRestBaseUrl(e.restBaseUrl)),e.standalone)return;const t=e.appInit||this.deps.fallbackAppInit,n=Promise.resolve(t({baseUrl:e.baseUrl,user:e.user,project:e.project,prevApp:this._prevApp}));this._app=n,n.then(r=>{this._app===n&&(this._prevApp=r)},()=>{}),this.deps.publish(n)}},wn=O("AppInitService");function oa(e){return async()=>{const t=await e();return(await new ui(t).app_init_create({})).data}}function sa(e){e.injectFactory(wn,()=>{const t=new ia({options:e.getInstance(oe),isStandalone:()=>!!e.getInstance(me),resolveRestBaseUrl:n=>n?$n(n):$n()||void 0,setRestBaseUrl:n=>{e.getInstance(xs)?.setOptions(n?{baseUrl:n}:{})},fallbackAppInit:oa(()=>e.getInstanceAsync(ns)),publish:n=>{e.inject(Re,n)}});return e.getInstance(k)?.addDisposable(t),t},!0)}var Sn=O("documentSession.emailDocuments");function Ct(e){return e?.getInstance(Sn)}var aa=O("RevisionServiceFlag");function la(e){return e.getOrCreateInstance(aa,()=>{let t=!1;return{isEnabled:()=>t,set:n=>{t=n}}})}function pi(e){return la(e).isEnabled()}var da=O("EmailRightsResolver");function ca(e,t){const n=e.getInstance(da);return n?n(t):!0}var mi=O("EmailHistoryAvailabilityResolver");function ua(e){return e.getInstance(mi)!==void 0}async function fa(e){const t=e.getInstance(mi);if(!t)return!0;try{return await t()}catch{return!1}}var In={INIT_START:5e3,SET_ENTITY:12e3,PREHEADER:5e3,SUBJECT:5e3,INITED:5e3,UPDATE_ENTITY:5e3},hi=["INIT_START","SET_ENTITY","PREHEADER","SUBJECT","INITED"],gi=2e4,pa=hi.reduce((e,t)=>e+In[t],0),vi=gi+pa+3e3;function ma(e){return hi.reduce((t,n)=>t+bi(n,e),0)}function bi(e,t){const n=t?.[e];return typeof n=="number"&&n>0?n:In[e]}function Ei(e){const t=e?.contentReady;return typeof t=="number"&&t>0?t:vi}function yi(e){const t=e?.sandboxReady;return typeof t=="number"&&t>0?t:gi}function _i(e=vi){return e+3e3}var ha=()=>_i();function ga(e,t){let n;return Promise.race([e,new Promise(r=>{n=setTimeout(()=>{r()},t)})]).finally(()=>{n!==void 0&&clearTimeout(n)})}function va(e){return t=>ga(e.getOrCreateInstance(F.BEFORE_SAVE_EMAIL,()=>new pe).fire(t),ha())}function ba(e){return e!=null&&e!==""}var Ea;function yt(e,t){return Ea?.capture(e,t)}function ya(e=""){let t=e;return{read:()=>t,write:n=>{t=n},dispose:()=>{t=""}}}function tt(e){return e.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var re=class{oldPosition;oldText;newPosition;newText;get oldLength(){return this.oldText.length}get oldEnd(){return this.oldPosition+this.oldText.length}get newLength(){return this.newText.length}get newEnd(){return this.newPosition+this.newText.length}constructor(e,t,n,r){this.oldPosition=e,this.oldText=t,this.newPosition=n,this.newText=r}toString(){return this.oldText.length===0?`(insert@${this.oldPosition} "${tt(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${tt(this.oldText)}")`:`(replace@${this.oldPosition} "${tt(this.oldText)}" with "${tt(this.newText)}")`}};function Yn(e,t){return e===null||e.length===0?t:new _a(e,t).compress()}var _a=class se{_prevEdits;_currEdits;_result;_resultLen;_prevLen;_prevDeltaOffset;_currLen;_currDeltaOffset;constructor(t,n){this._prevEdits=t,this._currEdits=n,this._result=[],this._resultLen=0,this._prevLen=this._prevEdits.length,this._prevDeltaOffset=0,this._currLen=this._currEdits.length,this._currDeltaOffset=0}compress(){let t=0,n=0,r=this._getPrev(t),i=this._getCurr(n);for(;t<this._prevLen||n<this._currLen;){if(r===null){if(i===null)break;this._acceptCurr(i),i=this._getCurr(++n);continue}if(i===null){this._acceptPrev(r),r=this._getPrev(++t);continue}if(i.oldEnd<=r.newPosition){this._acceptCurr(i),i=this._getCurr(++n);continue}if(r.newEnd<=i.oldPosition){this._acceptPrev(r),r=this._getPrev(++t);continue}if(i.oldPosition<r.newPosition){const[l,f]=se._splitCurr(i,r.newPosition-i.oldPosition);this._acceptCurr(l),i=f;continue}if(r.newPosition<i.oldPosition){const[l,f]=se._splitPrev(r,i.oldPosition-r.newPosition);this._acceptPrev(l),r=f;continue}let s,d;if(i.oldEnd===r.newEnd)s=r,d=i,r=this._getPrev(++t),i=this._getCurr(++n);else if(i.oldEnd<r.newEnd){const[l,f]=se._splitPrev(r,i.oldLength);s=l,d=i,r=f,i=this._getCurr(++n)}else{const[l,f]=se._splitCurr(i,r.newLength);s=r,d=l,r=this._getPrev(++t),i=f}this._result[this._resultLen++]=new re(s.oldPosition,s.oldText,d.newPosition,d.newText),this._prevDeltaOffset+=s.newLength-s.oldLength,this._currDeltaOffset+=d.newLength-d.oldLength}const o=se._merge(this._result);return se._removeNoOps(o)}_acceptCurr(t){this._result[this._resultLen++]=se._rebaseCurr(this._prevDeltaOffset,t),this._currDeltaOffset+=t.newLength-t.oldLength}_getCurr(t){return t<this._currLen?this._currEdits[t]:null}_acceptPrev(t){this._result[this._resultLen++]=se._rebasePrev(this._currDeltaOffset,t),this._prevDeltaOffset+=t.newLength-t.oldLength}_getPrev(t){return t<this._prevLen?this._prevEdits[t]:null}static _rebaseCurr(t,n){return new re(n.oldPosition-t,n.oldText,n.newPosition,n.newText)}static _rebasePrev(t,n){return new re(n.oldPosition,n.oldText,n.newPosition+t,n.newText)}static _splitPrev(t,n){const r=t.newText.substr(0,n),i=t.newText.substr(n);return[new re(t.oldPosition,t.oldText,t.newPosition,r),new re(t.oldEnd,"",t.newPosition+n,i)]}static _splitCurr(t,n){const r=t.oldText.substr(0,n),i=t.oldText.substr(n);return[new re(t.oldPosition,r,t.newPosition,t.newText),new re(t.oldPosition+n,i,t.newEnd,"")]}static _merge(t){if(t.length===0)return t;const n=[];let r=0,i=t[0];for(let o=1;o<t.length;o++){const s=t[o];i.oldEnd===s.oldPosition?i=new re(i.oldPosition,i.oldText+s.oldText,i.newPosition,i.newText+s.newText):(n[r++]=i,i=s)}return n[r++]=i,n}static _removeNoOps(t){if(t.length===0)return t;const n=[];let r=0;for(let i=0;i<t.length;i++){const o=t[i];o.oldText!==o.newText&&(n[r++]=o)}return n}};function wa(e){return new re(e.newPosition,e.newText,e.oldPosition,e.oldText)}function Sa(e){return e.map(wa)}function Xn(e,t){return t.every(n=>e.slice(n.oldPosition,n.oldEnd)===n.oldText)}function Ia(e,t){let n=e;for(let r=t.length-1;r>=0;r-=1){const i=t[r];n=n.slice(0,i.oldPosition)+i.newText+n.slice(i.oldEnd)}return n}function Ta(e,t,n){let r=0;const i=e.start===e.end;for(const o of t){const s=o.newLength-o.oldLength;if(o.oldLength===0){const d=o.oldPosition;if(i&&d===e.start)r+=n==="after"?s:0;else{if(e.start<d&&d<e.end)return null;d<=e.start&&(r+=s)}continue}if(i){if(e.start>=o.oldEnd)r+=s;else if(e.start>o.oldPosition)return null;continue}if(e.start>=o.oldEnd)r+=s;else if(e.end>o.oldPosition)return null}return{start:e.start+r,end:e.end+r}}var mt=class extends Error{reason;constructor(e){super("Открытие документа не удалось"),this.reason=e,this.name="DocumentOpenFailedError"}},Jn=0,Aa=Math.random().toString(36).slice(2,8);function Ca(){return Jn+=1,`doc-${Aa}-${Jn}`}function Pa(e){const t=e.createBuffer(),n=e.docId??Ca();let r=e.serverId??null,i=0,o=null,s=e.attributes??{};const d=new Set;let l=!1,f=!1,u;const g=new Set;let b=null;const E=()=>(b?.version!==i&&(b={version:i,value:t.read()}),b.value),I=v=>Object.entries(v).some(([y,w])=>s[y]!==w);return{get:()=>({docId:n,serverId:r,version:i,savedVersion:o,attributes:s}),getContent:E,mutate(v,{source:y}){if(l)return i;const w=v.changes?.length?v.changes:void 0,S=w?Ia(E(),w):v.content!==void 0?v.content:void 0,A=S!==void 0&&S!==E(),m=v.attributes!==void 0&&I(v.attributes);if(!A&&!m)return i;const c=!(i>(o??-1));return A&&t.write(S),m&&(s={...s,...v.attributes}),i+=1,y!=="user"&&c&&(o=i),d.forEach(a=>a({source:y,version:i,changes:w})),i},markSaved(v,y){const w={serverId:r,savedVersion:o};y!==void 0&&(r=y),(o===null||v>o)&&(o=v),(w.serverId!==r||w.savedVersion!==o)&&d.forEach(S=>S({source:"system",version:i}))},markReady(){f||u!==void 0||(f=!0,g.forEach(v=>v.resolve()),g.clear(),d.forEach(v=>v({source:"system",version:i})))},isReady:()=>f,markFailed(v){f||u!==void 0||l||(u=v,g.forEach(y=>y.reject(new mt(v))),g.clear(),d.forEach(y=>y({source:"system",version:i})))},failure:()=>u,whenReady(){return f?Promise.resolve():u!==void 0?Promise.reject(new mt(u)):l?Promise.reject(new Error("Документ закрыт до того, как наполнение закончилось")):new Promise((v,y)=>{g.add({resolve:v,reject:y})})},subscribe(v){return d.add(v),()=>d.delete(v)},isNew:()=>r===null,isDirty:()=>i>(o??-1),isDisposed:()=>l,dispose(){l=!0,g.forEach(v=>v.reject(new Error("Документ закрыт до того, как наполнение закончилось"))),g.clear(),d.clear(),t.dispose()}}}var Ra=500,Da=100,Pt=0;function Oa(e,t={}){const n=t.groupIntervalMs??Ra,r=t.maxSteps??Da,i=t.now??(()=>0);let o=[],s=0,d=Pt+=1,l=null,f=!1,u=!1,g=!1;const b=new Set,E=()=>b.forEach(a=>a()),I=(a,p)=>{if(a.length){u=!0;try{e.mutate({changes:a},{source:p})}finally{u=!1}}},v=a=>I(a,"user"),y=a=>{const p=i();f&&l!==null&&p-l<n?o[s-1]=Yn(o[s-1],a):(o=o.slice(0,s),o.push(a),s=o.length,f=!0,o.length>r&&(o=o.slice(o.length-r),s=o.length,d=Pt+=1)),l=p,E()},w=()=>{f=!1,l=null},S=a=>{if(!a.length)return;const p=o.length>s;p&&(o=o.slice(0,s)),s>0&&(o[s-1]=Yn(o[s-1],a)),w(),p&&E()},A=e.subscribe(({source:a,changes:p})=>{if(!(g||u||!p?.length)){if(a==="remote"){m();return}if(a!=="user"){S(p);return}y(p)}}),m=()=>{o=[],s=0,w(),d=Pt+=1,E()},c=()=>{if(s===0)return!1;const a=Sa(o[s-1]);return Xn(e.getContent(),a)?(v(a),s-=1,w(),!0):(o=o.slice(0,s-1),s=o.length,w(),E(),!1)};return{canUndo:()=>s>0,canRedo:()=>s<o.length,undo(){c()&&E()},redo(){if(!(s>=o.length)){if(!Xn(e.getContent(),o[s])){o=o.slice(0,s),w(),E();return}v(o[s]),s+=1,w(),E()}},clear:m,applyWithoutHistory(a){const p=e.get().version;if(I(a,"system"),e.get().version===p){w();return}S(a)},getPast:a=>o.slice(0,s).reverse().slice(0,a),getFuture:a=>o.slice(s).reverse().slice(0,a),createSnapshot:()=>({stackId:d,index:s}),restoreSnapshot(a){if(a.stackId!==d||a.index>s)return!1;for(;s>a.index;)if(!c())return E(),!1;return E(),!0},subscribe(a){return b.add(a),()=>b.delete(a)},dispose(){g=!0,A(),b.clear(),o=[],s=0}}}var xa=["edit","move","resize","insert"];function Rt(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function La(e){return typeof e=="string"?e:null}function Ma(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string")?null:e}function ka(e){return xa.includes(e)?e:null}function Na(e){const t=typeof e=="object"&&e!==null?e:{},n={originId:La(t.originId),changeId:Rt(t.changeId),rev:Rt(t.rev),baseRev:Rt(t.baseRev),expected:Ma(t.expected),intent:ka(t.intent)};return{...n,legacy:Object.values(n).every(r=>r===null)}}var Qn=class extends Error{reason;constructor(e){super(`сохранение не состоялось: ${e}`),this.name="SaveRefusedError",this.reason=e}},wi="draft";function Fe(e){return e==null||e===""?wi:String(e)}function Fa(e){return e==null||e===""?`${Zt}${wi}`:`${Zt}${String(e)}`}var Zt="block:";function he(e){return e?.startsWith(Zt)===!0}function je(e){return he(e.sessionKey())?void 0:e.current()}function Ue(e,t,n){const r=typeof performance<"u"?performance.now():Date.now();return G(`show:gate:${e}`,{kind:"wait"}),t.then(i=>(G(`show:gate:${e}:end`,{kind:"wait"}),i),i=>{const o=Math.round((typeof performance<"u"?performance.now():Date.now())-r);throw`${e}`,{error:String(i),...n},i})}function Si(e){return e?.length?[...e].sort((t,n)=>Date.parse(n.modified)-Date.parse(t.modified))[0]:null}function Ii(e,{freshSince:t}={}){return!(!e?.slug?.includes("autosave")||!e?.html?.trim()||t!==void 0&&Date.parse(e.modified)<t-5e3)}function ja(e,t={}){const n=Si((e??[]).filter(r=>r?.html?.trim()));return Ii(n,t)?n:null}function Ba(e){const t=Date.parse(Si(e)?.modified??"");return{autosave:ja(e),...Number.isFinite(t)?{latestAt:t}:{}}}function Ua({hasUnsavedUserEdit:e}){return e?"skip":"apply"}var Ti=e=>e.replace(/\r\n?/g,`
996
+ `,r=new Function("__amdEnv",n);r(e),typeof e.require=="function"&&typeof e.require.config=="function"&&e.require.config({baseUrl:"./",paths:{core:"emailmaker-core.fc1d4d9a.js",po:"emailmaker-po.fc1d4d9a.js",monaco:"static/monaco/index.js"}})}e.define("__delivery__/libs",[],function(){return import("./static/esm/delivery-libs.js")});var i=function(m){var c,a=function(){return c||(c=Promise.resolve().then(m))};return{then:function(p,h){return a().then(p,h)},catch:function(p){return a().catch(p)},finally:function(p){return a().finally(p)}}},o=i(function(){return e.require(["__delivery__/libs"]).then(function(m){return m[0]})});t.React=i(function(){return o.then(function(m){return m.React})}),t.ReactDom=i(function(){return o.then(function(m){return m.ReactDom})}),t.ReactDomClient=i(function(){return o.then(function(m){return m.ReactDomClient})}),t.ReactJsxRuntime=i(function(){return o.then(function(m){return m.ReactJsxRuntime})}),t.ReactJsxDevRuntime=i(function(){return o.then(function(m){return m.ReactJsxDevRuntime})}),t.AntDesignIconBase=i(function(){return o.then(function(m){return m.AntDesignIconBase})}),t.AntDesignCssinjs=i(function(){return o.then(function(m){return m.AntDesignCssinjs})}),t.Classnames=i(function(){return o.then(function(m){return m.Classnames})}),t.Dayjs=i(function(){return o.then(function(m){return m.Dayjs})});var s=i(function(){return Promise.all([o]).then(function(m){var c=m[0]||Object.create(null),a=Object.create(null);for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&(a[p]=c[p]);for(var h in a)Object.prototype.hasOwnProperty.call(a,h)&&(t[h]=a[h]);return a})}),d={},l={Antd:"[runtime] `antd` is not available: the compatibility layer for global plugins is not enabled. Add `import '@emailmaker/emailmaker/compat-globals';` before creating the editor, or turn on the `compatGlobals` option of the bundler plugin. ESM builds omit this layer by default so that plugin compatibility is not paid for by every integrator.",AntDesignIcons:"[runtime] `@ant-design/icons` is not available: the compatibility layer for global plugins is not enabled. Add `import '@emailmaker/emailmaker/compat-globals';` before creating the editor, or turn on the `compatGlobals` option of the bundler plugin. ESM builds omit this layer by default so that plugin compatibility is not paid for by every integrator."},f={Antd:"[runtime] `antd` is served from the host runtime for backward compatibility. Rebuild the plugin with the current CLI to bundle it from its own copy of the package. This compatibility layer is deprecated.",AntDesignIcons:"[runtime] `@ant-design/icons` is served from the host runtime for backward compatibility. Rebuild the plugin with the current CLI to bundle it from its own copy of the package. This compatibility layer is deprecated."},u=Object.create(null);if(e.registerCompat=function(m){if(!(!m||typeof m!="object"))for(var c in m)Object.prototype.hasOwnProperty.call(m,c)&&(u[c]=m[c])},e.__compatPending){for(var g=0;g<e.__compatPending.length;g+=1)e.registerCompat(e.__compatPending[g]);e.__compatPending=void 0}for(var b in l)Object.prototype.hasOwnProperty.call(l,b)&&(function(m,c,a){var p=!1,h=function(){if(!(m in u))throw new Error(c);return u[m]};Object.defineProperty(t,m,{configurable:!0,enumerable:!0,get:function(){var _=h();return p||(p=!0),_},set:function(_){u[m]=_}}),Object.defineProperty(d,m,{configurable:!0,enumerable:!0,get:h,set:function(_){u[m]=_}})})(b,l[b],f[b]);var E=t;for(var I in d)Object.prototype.hasOwnProperty.call(d,I)&&(E===t&&(E=Object.create(t)),Object.defineProperty(E,I,Object.getOwnPropertyDescriptor(d,I)));var v=s,y=[],w=function(){for(var m=[],c=0;c<y.length;c+=1)(function(a){var p=t[a];p&&typeof p.then=="function"&&m.push(Promise.resolve(p).then(function(h){t[a]=h}))})(y[c]);return Promise.all(m)},S=typeof e.prefetch=="function"?e.prefetch:void 0;if(e.prefetch=function(){return s.then(w).then(function(){if(typeof S=="function")return S.call(e)})},typeof e.define=="function"){let m=function(c){if(!c||typeof c!="object"&&typeof c!="function"||c.__esModule)return c;if(A){var a=A.get(c);if(a)return a}var p=Object.create(null);Object.defineProperties(p,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});for(var h=Reflect.ownKeys(c),_=0;_<h.length;_++){var T=h[_];if(T!=="__esModule"){var R=Object.getOwnPropertyDescriptor(c,T);R&&Object.defineProperty(p,T,R)}}return Object.prototype.hasOwnProperty.call(p,"default")||Object.defineProperty(p,"default",{enumerable:!0,value:c,writable:!1}),A&&A.set(c,p),p};var A=typeof WeakMap<"u"?new WeakMap:null;e.define("react",[],function(){var c=E.React;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.React)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.React;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/react",[],function(){var c=E.React;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.React)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.React;return m(p)})}),e.define("react-dom",[],function(){var c=E.ReactDom;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.ReactDom)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.ReactDom;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/react-dom",[],function(){var c=E.ReactDom;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.ReactDom)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.ReactDom;return m(p)})}),e.define("react-dom/client",[],function(){var c=E.ReactDomClient;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.ReactDomClient)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.ReactDomClient;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/react-dom/client",[],function(){var c=E.ReactDomClient;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.ReactDomClient)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.ReactDomClient;return m(p)})}),e.define("react/jsx-runtime",[],function(){var c=E.ReactJsxRuntime;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.ReactJsxRuntime)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.ReactJsxRuntime;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/react/jsx-runtime",[],function(){var c=E.ReactJsxRuntime;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.ReactJsxRuntime)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.ReactJsxRuntime;return m(p)})}),e.define("react/jsx-dev-runtime",[],function(){var c=E.ReactJsxDevRuntime;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.ReactJsxDevRuntime)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.ReactJsxDevRuntime;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/react/jsx-dev-runtime",[],function(){var c=E.ReactJsxDevRuntime;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.ReactJsxDevRuntime)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.ReactJsxDevRuntime;return m(p)})}),e.define("antd",[],function(){var c=E.Antd;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.Antd)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.Antd;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/antd",[],function(){var c=E.Antd;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.Antd)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.Antd;return m(p)})}),e.define("@ant-design/icons/es/components/AntdIcon",[],function(){var c=E.AntDesignIconBase;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.AntDesignIconBase)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.AntDesignIconBase;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/@ant-design/icons/es/components/AntdIcon",[],function(){var c=E.AntDesignIconBase;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.AntDesignIconBase)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.AntDesignIconBase;return m(p)})}),e.define("@ant-design/icons",[],function(){var c=E.AntDesignIcons;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.AntDesignIcons)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.AntDesignIcons;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/@ant-design/icons",[],function(){var c=E.AntDesignIcons;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.AntDesignIcons)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.AntDesignIcons;return m(p)})}),e.define("@ant-design/cssinjs",[],function(){var c=E.AntDesignCssinjs;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.AntDesignCssinjs)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.AntDesignCssinjs;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/@ant-design/cssinjs",[],function(){var c=E.AntDesignCssinjs;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.AntDesignCssinjs)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.AntDesignCssinjs;return m(p)})}),e.define("classnames",[],function(){var c=E.Classnames;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.Classnames)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.Classnames;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/classnames",[],function(){var c=E.Classnames;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.Classnames)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.Classnames;return m(p)})}),e.define("dayjs",[],function(){var c=E.Dayjs;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.Dayjs)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.Dayjs;return m(p)})}),e.define("@emailmaker/emailmaker/runtime/dayjs",[],function(){var c=E.Dayjs;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.Dayjs)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.Dayjs;return m(p)})}),e.define("@emailmaker/ui-kit",[],function(){var c=E.UiKit;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.UiKit)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.UiKit;return m(p)})}),e.define("@emailmaker/emailmaker/ui-kit",[],function(){var c=E.UiKit;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.UiKit)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.UiKit;return m(p)})}),e.define("@emailmaker/emailmaker/ui-kit/icons",[],function(){var c=E.UiKitIcons;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.UiKitIcons)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.UiKitIcons;return m(p)})}),e.define("@emailmaker/ui-kit/icons",[],function(){var c=E.UiKitIcons;return c&&typeof c.then=="function"?c.then(function(a){return a===void 0?v.then(function(p){return m(p.UiKitIcons)}):m(a)}):c!==void 0?m(c):v.then(function(a){var p=a.UiKitIcons;return m(p)})})}globalThis.__SHARED_RUNTIME_INIT_SENTINEL__="@shared-runtime:init-complete"})();var Ns=new Function("url","return import(url)");function Fs(e){if(typeof e!="function")return!1;try{return Reflect.construct(String,[],e),!0}catch{return!1}}function js(e){return typeof e=="object"&&e!==null&&"type"in e&&"url"in e}function Bs(e){return e.type==="umd"||e.resolve==="registry"}var Us=class{_context;_pluginRegistry;_options;_map=new Map;_optionsMap=new Map;_readyMap=new Map;_resolveMap=new Map;_initializingPlugins=new Map;_creatingPlugins=new Set;_initializedPlugins=new Set;_creationOrder=[];_lifecycleListeners=new Set;_activated=!1;constructor(e,t,n={}){this._context=e,this._pluginRegistry=t,this._options=n}activate(){return this._activated=!0,this._startPluginsBatch(Array.from(this._map.values()))}activateSync(){this._activated=!0,this._startPluginsBatch(Array.from(this._map.values()))}onLifecycle(e){return this._lifecycleListeners.add(e),{dispose:()=>this._lifecycleListeners.delete(e)}}_emitLifecycle(e){for(const t of Array.from(this._lifecycleListeners))try{t(e)}catch{}}async _resolveEntry(e){if(typeof e=="string"||typeof e=="symbol"){const t=await this._pluginRegistry.getAsync(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered.`);return{ctor:t}}if(typeof e=="function")return e.length===0?{ctor:await e()}:{ctor:e};if(Array.isArray(e)){const[t,n]=e;if(typeof t=="function")return{ctor:t,options:n};const r=await this._pluginRegistry.getAsync(t);if(!r)throw new Error(`Plugin "${String(t)}" not registered.`);return{ctor:r,options:n}}if(js(e))return this._resolveDescriptor(e);throw new Error(`Unknown plugin entry format: ${JSON.stringify(e)}`)}async _resolveDescriptor(e){const t=e.resolve??(e.type==="umd"?"window":"module");if(Bs(e)&&await this._options.ensureHostRuntimeReady?.(e),e.type==="esm"){const n=await Ns(e.url);if(t==="module")return{ctor:n.default??n};if(t==="registry"&&e.name){const r=await this._pluginRegistry.getAsync(e.name);if(!r)throw new Error(`Plugin "${e.name}" not found in registry after ESM load`);return{ctor:r}}}if(e.type==="umd"){if(await this._loadScript(e.url),t==="window"&&e.name){const n=globalThis[e.name];if(!n)throw new Error(`Plugin "${e.name}" not found on window after script load`);return{ctor:n}}if(t==="registry"&&e.name){const n=await this._pluginRegistry.getAsync(e.name);if(!n)throw new Error(`Plugin "${e.name}" not found in registry after script load`);return{ctor:n}}}throw new Error(`Cannot resolve descriptor: type=${e.type}, resolve=${t}, name=${e.name??"none"}`)}_loadScript(e){return new Promise((t,n)=>{if(typeof document>"u"){n(new Error("Cannot load UMD script in non-browser environment"));return}const r=document.createElement("script");r.src=e,r.onload=()=>t(),r.onerror=()=>n(new Error(`Failed to load script: ${e}`)),document.head.appendChild(r)})}initSync(e){const t=[];for(const n of e){const r=this._getOrCreate(n,void 0);t.push(r)}this._activated=!0,this._startPluginsBatch(t)}async init(e){const t=[],n=new Set;for(const r of e){const{ctor:i,options:o}=await this._resolveEntry(r),s=this._getOrCreate(i,o);n.has(s)||(n.add(s),t.push(s))}this._activated=!0,await this._startPluginsBatch(t)}async setPlugins(e){const t=new Set,n=[];for(const s of e){const d=await this._resolveEntry(s);t.add(d.ctor),n.push(d)}const r=[];this._map.forEach((s,d)=>{t.has(d)||r.push({key:d,plugin:s})});for(let s=r.length-1;s>=0;s--){const{key:d,plugin:l}=r[s];await this._initializingPlugins.get(l),await this._disposePlugin(l,l.constructor.name),this._map.delete(d),this._optionsMap.delete(d),this._readyMap.delete(l),this._resolveMap.delete(l),this._initializingPlugins.delete(l),this._initializedPlugins.delete(l);const f=this._creationOrder.indexOf(l);f>=0&&this._creationOrder.splice(f,1)}const i=[],o=new Set;for(const{ctor:s,options:d}of n){const l=this._getOrCreate(s,d);o.has(l)||(o.add(l),i.push(l))}this._activated&&await this._startPluginsBatch(i)}isReady(e){return this._initializedPlugins.has(e)}ready(e){return this._initializingPlugins.get(e)??this._readyMap.get(e)??Promise.resolve()}async waitFor(e,t){if(this._pluginRegistry.has(e))return this.useByKeyAsync(e);const{timeout:n}=t??{};return await new Promise((r,i)=>{let o,s=!1;const d=()=>{s||(s=!0,o&&clearTimeout(o),this._pluginRegistry.off(e,d),r())};this._pluginRegistry.on(e,d),n!==void 0&&n>0&&(o=setTimeout(()=>{s||(s=!0,this._pluginRegistry.off(e,d),i(new Error(`waitFor("${String(e)}") timed out after ${n}ms`)))},n))}),this.useByKeyAsync(e)}useByKey(e){const t=this._pluginRegistry.get(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered or not loaded yet. Use useByKeyAsync() for async plugins.`);const n=this._getOrCreate(t);return this._activated&&this._startPluginsBatch([n]),n}async useByKeyAsync(e){const t=await this._pluginRegistry.getAsync(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered.`);const n=this._getOrCreate(t);return this._activated&&await this._startPluginsBatch([n]),n}useByCtor(e,t){const n=this._getOrCreate(e,t);return this._activated&&this._startPluginsBatch([n]),n}use(e){return typeof e=="function"?this.useByCtor(e):this.useByKey(e)}async useAsync(e){const{ctor:t,options:n}=await this._resolveEntry(e),r=this._getOrCreate(t,n);return this._activated&&await this._startPluginsBatch([r]),r}_getOrCreate(e,t){const n=e;if(!this._map.has(n)){t!==void 0&&this._optionsMap.set(n,t);const r=this._optionsMap.get(n),i=this._createPluginInstance(e,r),o=i.constructor.name;this._emitLifecycle({type:"created",plugin:i,name:o}),i.required?.(),this._map.set(n,i),this._creationOrder.push(i),this._setupReadyPromise(i)}return this._map.get(n)}_createPluginInstance(e,t){const n=e;if(this._creatingPlugins.has(n))throw new Error(`Cyclic dependency for plugin ${e.name}`);this._creatingPlugins.add(n);try{return Fs(e)?new e(this._context,t):e(this._context,t)||{}}finally{this._creatingPlugins.delete(n)}}_setupReadyPromise(e){const t=new Promise(n=>{this._resolveMap.set(e,n)});this._readyMap.set(e,t)}async _startPluginsBatch(e){const t=Array.from(new Set(e)),n=new Set,r=[];for(const i of t){if(this._initializedPlugins.has(i))continue;const o=this._initializingPlugins.get(i);if(o){n.add(o);continue}r.push(i)}if(r.length>0){const i=this._runBatchLifecycle(r);for(const o of r)this._initializingPlugins.set(o,i);n.add(i),i.finally(()=>{for(const o of r)this._initializingPlugins.get(o)===i&&this._initializingPlugins.delete(o)})}await Promise.all(n)}async _runBatchLifecycle(e){const t=[];for(const n of e){const r=n.constructor.name;this._emitLifecycle({type:"init:start",plugin:n,name:r});try{await n.init?.(),this._emitLifecycle({type:"init:success",plugin:n,name:r}),t.push(n)}catch(i){this._emitLifecycle({type:"init:error",plugin:n,name:r,error:i})}}for(const n of t){const r=n.constructor.name;this._emitLifecycle({type:"afterInit:start",plugin:n,name:r});try{await n.afterInit?.(),this._emitLifecycle({type:"afterInit:success",plugin:n,name:r})}catch(i){this._emitLifecycle({type:"afterInit:error",plugin:n,name:r,error:i})}}for(const n of e)this._initializedPlugins.add(n),this._resolveMap.get(n)?.(),this._resolveMap.delete(n)}async _disposePlugin(e,t){this._emitLifecycle({type:"dispose:start",plugin:e,name:t});try{await e.dispose?.(),this._emitLifecycle({type:"dispose:success",plugin:e,name:t})}catch(n){this._emitLifecycle({type:"dispose:error",plugin:e,name:t,error:n})}}async dispose(){for(let e=this._creationOrder.length-1;e>=0;e--){const t=this._creationOrder[e];await this._initializingPlugins.get(t),await this._disposePlugin(t,t.constructor.name)}this._map.clear(),this._optionsMap.clear(),this._readyMap.clear(),this._resolveMap.clear(),this._initializingPlugins.clear(),this._initializedPlugins.clear(),this._creationOrder.length=0,this._lifecycleListeners.clear()}getStatus(){return Array.from(this._map.values()).map(e=>({name:e.constructor.name,initialized:this._initializedPlugins.has(e)}))}},Hs=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){const n=this._plugins.get(e);if(n?.overrides)for(const r of n.overrides)t=r(t)||t;return t}_notifyListeners(e,t){const n=this._listeners.get(e);if(!n||n.length===0)return;for(const i of n)try{i.callback(t)}catch{}const r=n.filter(i=>!i.once);r.length>0?this._listeners.set(e,r):this._listeners.delete(e)}get(e){const t=this._plugins.get(e);if(t?.ctor)return this._applyOverrides(e,t.ctor)}async getAsync(e){const t=this._plugins.get(e);if(t?.ctor)return this._applyOverrides(e,t.ctor);if(t?.loading){const n=await t.loading;return this._applyOverrides(e,n)}if(t?.factory){const n=Promise.resolve(t.factory()).then(i=>(t.ctor=i,t.loading=void 0,this._notifyListeners(e,i),i));t.loading=n;const r=await n;return this._applyOverrides(e,r)}return new Promise(n=>{this.on(e,r=>n(this._applyOverrides(e,r)))})}add(e,t){const n=this._getOrCreateEntry(e);n.ctor=t,this._notifyListeners(e,t)}addAll(e){for(const t of Object.keys(e)){const n=e[t];n!==void 0&&this.add(t,n)}}addAsync(e,t){const n=this._getOrCreateEntry(e);return n.factory=t,{dispose:()=>{n.ctor||(n.factory=void 0)}}}has(e){const t=this._plugins.get(e);return!!(t?.ctor||t?.factory)}isLoaded(e){return!!this._plugins.get(e)?.ctor}override(e,t){const n=this._getOrCreateEntry(e);return n.overrides.push(t),{dispose:()=>{const r=n.overrides.indexOf(t);r>=0&&n.overrides.splice(r,1)}}}on(e,t){const n=this.get(e);n&&t(n);let r=this._listeners.get(e);r||(r=[],this._listeners.set(e,r));const i={callback:t,once:!1};return r.push(i),{dispose:()=>this._removeListener(e,t)}}once(e,t){const n=this.get(e);if(n)return t(n),{dispose:()=>{}};let r=this._listeners.get(e);r||(r=[],this._listeners.set(e,r));const i={callback:t,once:!0};return r.push(i),{dispose:()=>this._removeListener(e,t)}}off(e,t){this._removeListener(e,t)}_removeListener(e,t){const n=this._listeners.get(e);if(n){const r=n.findIndex(i=>i.callback===t);r>=0&&n.splice(r,1),n.length===0&&this._listeners.delete(e)}}keys(){return Array.from(this._plugins.keys())}forContext(){const e=this;return{add(t,n){e.add(t,n)}}}},Gs=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()}},zn=class{capacity;items=[];constructor(e){this.capacity=e}push(e){this.items.length>=this.capacity&&this.items.shift(),this.items.push(e)}snapshot(){return this.items.slice()}size(){return this.items.length}clear(){this.items=[]}};function qs(e,t){return t+e}function $s(){return typeof performance>"u"?Date.now():qs(performance.now(),performance.timeOrigin)}var zs="emailmaker:diagnostics",Vs="diagnostics",Ks="diagnostics";function Vn(e,t){return t?`${e}${e.includes("?")?"&":"?"}${Ks}=1`:e}var At;function Ws(){try{const e=new URLSearchParams(window.location.search).get(Vs);return e===null?void 0:e!=="0"}catch{return}}function Ys(){const e=window.__DIAGNOSTICS__;return typeof e=="boolean"?e:void 0}function Xs(){try{const e=window.localStorage.getItem(zs);return e===null?void 0:e==="1"}catch{return}}function qe(){return At===void 0&&(At=typeof window>"u"?!1:Ws()??Ys()??Xs()??!1),At}function Js(e){return`__${(e||"emailmaker").toLowerCase().replaceAll("-","")}__`}var J={initStart:"loader:init:start",coreReady:"loader:core:ready",initEnd:"loader:init:end",chunksLoaded:"app:chunks:loaded",showStart:"show:start",showEnd:"show:end",canvasCreated:"canvas:created",canvasLoaded:"canvas:loaded",canvasPainted:"canvas:painted",appVisible:"app:visible",editorVisible:"editor:visible",canvasSettled:"canvas:settled"},ah=Object.values(J),lh=[J.canvasPainted,J.canvasSettled,J.appVisible,J.editorVisible],Qs=5e3,Zs=3e3,Kn="diagnosticsStore",et,Ne;function Wn(){return{marks:new zn(Qs),resources:new zn(Zs)}}function li(){if(Ne)return Ne;const e=_n();return e?(Ne=e[Kn]??et??Wn(),e[Kn]=Ne,et=void 0,Ne):(et??=Wn(),et)}function G(e,t){qe()&&li().marks.push({phase:e,at:$s(),...t})}function _n(){if(typeof window.__emailmaker__<"u"&&window.__emailmaker__)return window.__emailmaker__;if(typeof window>"u")return;const e=window[Js()];return e!==null&&typeof e=="object"?e:void 0}function ea(e){const t=e.length,n=li();return e.forEach(r=>n.marks.push(r)),e.length=0,t}function ta(){const e=_n();return!e||!Array.isArray(e.diagnosticsBuffer)?0:ea(e.diagnosticsBuffer)}var na="Editor instance was destroyed and cannot be reused. A fresh instance will be created instead.";function di(){const e=new Error(na);return e.name="DestroyedInstanceError",e}function Qt(e,t){if(e===t)return!0;if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const n=Array.isArray(e);if(n!==Array.isArray(t))return!1;if(n){const o=e,s=t;return o.length===s.length&&o.every((d,l)=>Qt(d,s[l]))}const r=Object.keys(e),i=Object.keys(t);return r.length!==i.length?!1:r.every(o=>Object.prototype.hasOwnProperty.call(t,o)&&Qt(e[o],t[o]))}function ci(e,t){const n={watch(r){let i,o=!1;return e.watch(s=>{const d=t(s);o&&Qt(i,d)||(i=d,o=!0,r(d))})},select(r){return ci(n,r)}};return n}function Me(...e){let t=e[0],n=e.length>0;const r=new Set,i={get(){return n?t:void 0},set(o){t=o,n=!0;for(const s of Array.from(r))s(o)},watch(o){return r.add(o),n&&o(t),{dispose:()=>r.delete(o)}},select(o){return ci(i,o)}};return i}var ui=class{http;constructor(e){this.http=e}app_init_create=(e,t={})=>this.http.request({path:"/app/v1/app_init",method:"POST",body:e,type:fs.UrlEncoded,...t})},fi=class{http;constructor(e){this.http=e}get_translations2=({file:e,...t},n={})=>this.http.request({path:`/translations/v1/${e}`,method:"GET",...n});get_translations3=({id:e,file:t,...n},r={})=>this.http.request({path:`/translations/v1/${t}/${e}`,method:"GET",...r})};function ra(e){return String(e||"").trim()||void 0}var ia=class extends Q{deps;_app;_baseUrl;_appInit;_restBaseUrl;_prevApp;constructor(e){super(),this.deps=e,this.addDisposable(e.options.select(t=>this._slice(t)).watch(t=>this._start(t)))}get app(){return this._app}_slice(e){return Object.prototype.hasOwnProperty.call(e,"baseUrl")&&(this._baseUrl=ra(e.baseUrl)),Object.prototype.hasOwnProperty.call(e,"appInit")&&(this._appInit=e.appInit),{appInit:this._appInit,user:e.user,project:e.project,baseUrl:this._baseUrl,restBaseUrl:this.deps.resolveRestBaseUrl(this._baseUrl),standalone:this.deps.isStandalone()}}_start(e){if(this._restBaseUrl!==e.restBaseUrl&&(this._restBaseUrl=e.restBaseUrl,this.deps.setRestBaseUrl(e.restBaseUrl)),e.standalone)return;const t=e.appInit||this.deps.fallbackAppInit,n=Promise.resolve(t({baseUrl:e.baseUrl,user:e.user,project:e.project,prevApp:this._prevApp}));this._app=n,n.then(r=>{this._app===n&&(this._prevApp=r)},()=>{}),this.deps.publish(n)}},wn=O("AppInitService");function oa(e){return async()=>{const t=await e();return(await new ui(t).app_init_create({})).data}}function sa(e){e.injectFactory(wn,()=>{const t=new ia({options:e.getInstance(oe),isStandalone:()=>!!e.getInstance(me),resolveRestBaseUrl:n=>n?$n(n):$n()||void 0,setRestBaseUrl:n=>{e.getInstance(xs)?.setOptions(n?{baseUrl:n}:{})},fallbackAppInit:oa(()=>e.getInstanceAsync(ns)),publish:n=>{e.inject(Re,n)}});return e.getInstance(k)?.addDisposable(t),t},!0)}var Sn=O("documentSession.emailDocuments");function Ct(e){return e?.getInstance(Sn)}var aa=O("RevisionServiceFlag");function la(e){return e.getOrCreateInstance(aa,()=>{let t=!1;return{isEnabled:()=>t,set:n=>{t=n}}})}function pi(e){return la(e).isEnabled()}var da=O("EmailRightsResolver");function ca(e,t){const n=e.getInstance(da);return n?n(t):!0}var mi=O("EmailHistoryAvailabilityResolver");function ua(e){return e.getInstance(mi)!==void 0}async function fa(e){const t=e.getInstance(mi);if(!t)return!0;try{return await t()}catch{return!1}}var In={INIT_START:5e3,SET_ENTITY:12e3,PREHEADER:5e3,SUBJECT:5e3,INITED:5e3,UPDATE_ENTITY:5e3},hi=["INIT_START","SET_ENTITY","PREHEADER","SUBJECT","INITED"],gi=2e4,pa=hi.reduce((e,t)=>e+In[t],0),vi=gi+pa+3e3;function ma(e){return hi.reduce((t,n)=>t+bi(n,e),0)}function bi(e,t){const n=t?.[e];return typeof n=="number"&&n>0?n:In[e]}function Ei(e){const t=e?.contentReady;return typeof t=="number"&&t>0?t:vi}function yi(e){const t=e?.sandboxReady;return typeof t=="number"&&t>0?t:gi}function _i(e=vi){return e+3e3}var ha=()=>_i();function ga(e,t){let n;return Promise.race([e,new Promise(r=>{n=setTimeout(()=>{r()},t)})]).finally(()=>{n!==void 0&&clearTimeout(n)})}function va(e){return t=>ga(e.getOrCreateInstance(F.BEFORE_SAVE_EMAIL,()=>new pe).fire(t),ha())}function ba(e){return e!=null&&e!==""}var Ea;function yt(e,t){return Ea?.capture(e,t)}function ya(e=""){let t=e;return{read:()=>t,write:n=>{t=n},dispose:()=>{t=""}}}function tt(e){return e.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var re=class{oldPosition;oldText;newPosition;newText;get oldLength(){return this.oldText.length}get oldEnd(){return this.oldPosition+this.oldText.length}get newLength(){return this.newText.length}get newEnd(){return this.newPosition+this.newText.length}constructor(e,t,n,r){this.oldPosition=e,this.oldText=t,this.newPosition=n,this.newText=r}toString(){return this.oldText.length===0?`(insert@${this.oldPosition} "${tt(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${tt(this.oldText)}")`:`(replace@${this.oldPosition} "${tt(this.oldText)}" with "${tt(this.newText)}")`}};function Yn(e,t){return e===null||e.length===0?t:new _a(e,t).compress()}var _a=class se{_prevEdits;_currEdits;_result;_resultLen;_prevLen;_prevDeltaOffset;_currLen;_currDeltaOffset;constructor(t,n){this._prevEdits=t,this._currEdits=n,this._result=[],this._resultLen=0,this._prevLen=this._prevEdits.length,this._prevDeltaOffset=0,this._currLen=this._currEdits.length,this._currDeltaOffset=0}compress(){let t=0,n=0,r=this._getPrev(t),i=this._getCurr(n);for(;t<this._prevLen||n<this._currLen;){if(r===null){if(i===null)break;this._acceptCurr(i),i=this._getCurr(++n);continue}if(i===null){this._acceptPrev(r),r=this._getPrev(++t);continue}if(i.oldEnd<=r.newPosition){this._acceptCurr(i),i=this._getCurr(++n);continue}if(r.newEnd<=i.oldPosition){this._acceptPrev(r),r=this._getPrev(++t);continue}if(i.oldPosition<r.newPosition){const[l,f]=se._splitCurr(i,r.newPosition-i.oldPosition);this._acceptCurr(l),i=f;continue}if(r.newPosition<i.oldPosition){const[l,f]=se._splitPrev(r,i.oldPosition-r.newPosition);this._acceptPrev(l),r=f;continue}let s,d;if(i.oldEnd===r.newEnd)s=r,d=i,r=this._getPrev(++t),i=this._getCurr(++n);else if(i.oldEnd<r.newEnd){const[l,f]=se._splitPrev(r,i.oldLength);s=l,d=i,r=f,i=this._getCurr(++n)}else{const[l,f]=se._splitCurr(i,r.newLength);s=r,d=l,r=this._getPrev(++t),i=f}this._result[this._resultLen++]=new re(s.oldPosition,s.oldText,d.newPosition,d.newText),this._prevDeltaOffset+=s.newLength-s.oldLength,this._currDeltaOffset+=d.newLength-d.oldLength}const o=se._merge(this._result);return se._removeNoOps(o)}_acceptCurr(t){this._result[this._resultLen++]=se._rebaseCurr(this._prevDeltaOffset,t),this._currDeltaOffset+=t.newLength-t.oldLength}_getCurr(t){return t<this._currLen?this._currEdits[t]:null}_acceptPrev(t){this._result[this._resultLen++]=se._rebasePrev(this._currDeltaOffset,t),this._prevDeltaOffset+=t.newLength-t.oldLength}_getPrev(t){return t<this._prevLen?this._prevEdits[t]:null}static _rebaseCurr(t,n){return new re(n.oldPosition-t,n.oldText,n.newPosition,n.newText)}static _rebasePrev(t,n){return new re(n.oldPosition,n.oldText,n.newPosition+t,n.newText)}static _splitPrev(t,n){const r=t.newText.substr(0,n),i=t.newText.substr(n);return[new re(t.oldPosition,t.oldText,t.newPosition,r),new re(t.oldEnd,"",t.newPosition+n,i)]}static _splitCurr(t,n){const r=t.oldText.substr(0,n),i=t.oldText.substr(n);return[new re(t.oldPosition,r,t.newPosition,t.newText),new re(t.oldPosition+n,i,t.newEnd,"")]}static _merge(t){if(t.length===0)return t;const n=[];let r=0,i=t[0];for(let o=1;o<t.length;o++){const s=t[o];i.oldEnd===s.oldPosition?i=new re(i.oldPosition,i.oldText+s.oldText,i.newPosition,i.newText+s.newText):(n[r++]=i,i=s)}return n[r++]=i,n}static _removeNoOps(t){if(t.length===0)return t;const n=[];let r=0;for(let i=0;i<t.length;i++){const o=t[i];o.oldText!==o.newText&&(n[r++]=o)}return n}};function wa(e){return new re(e.newPosition,e.newText,e.oldPosition,e.oldText)}function Sa(e){return e.map(wa)}function Xn(e,t){return t.every(n=>e.slice(n.oldPosition,n.oldEnd)===n.oldText)}function Ia(e,t){let n=e;for(let r=t.length-1;r>=0;r-=1){const i=t[r];n=n.slice(0,i.oldPosition)+i.newText+n.slice(i.oldEnd)}return n}function Ta(e,t,n){let r=0;const i=e.start===e.end;for(const o of t){const s=o.newLength-o.oldLength;if(o.oldLength===0){const d=o.oldPosition;if(i&&d===e.start)r+=n==="after"?s:0;else{if(e.start<d&&d<e.end)return null;d<=e.start&&(r+=s)}continue}if(i){if(e.start>=o.oldEnd)r+=s;else if(e.start>o.oldPosition)return null;continue}if(e.start>=o.oldEnd)r+=s;else if(e.end>o.oldPosition)return null}return{start:e.start+r,end:e.end+r}}var mt=class extends Error{reason;constructor(e){super("Открытие документа не удалось"),this.reason=e,this.name="DocumentOpenFailedError"}},Jn=0,Aa=Math.random().toString(36).slice(2,8);function Ca(){return Jn+=1,`doc-${Aa}-${Jn}`}function Pa(e){const t=e.createBuffer(),n=e.docId??Ca();let r=e.serverId??null,i=0,o=null,s=e.attributes??{};const d=new Set;let l=!1,f=!1,u;const g=new Set;let b=null;const E=()=>(b?.version!==i&&(b={version:i,value:t.read()}),b.value),I=v=>Object.entries(v).some(([y,w])=>s[y]!==w);return{get:()=>({docId:n,serverId:r,version:i,savedVersion:o,attributes:s}),getContent:E,mutate(v,{source:y}){if(l)return i;const w=v.changes?.length?v.changes:void 0,S=w?Ia(E(),w):v.content!==void 0?v.content:void 0,A=S!==void 0&&S!==E(),m=v.attributes!==void 0&&I(v.attributes);if(!A&&!m)return i;const c=!(i>(o??-1));return A&&t.write(S),m&&(s={...s,...v.attributes}),i+=1,y!=="user"&&c&&(o=i),d.forEach(a=>a({source:y,version:i,changes:w})),i},markSaved(v,y){const w={serverId:r,savedVersion:o};y!==void 0&&(r=y),(o===null||v>o)&&(o=v),(w.serverId!==r||w.savedVersion!==o)&&d.forEach(S=>S({source:"system",version:i}))},markReady(){f||u!==void 0||(f=!0,g.forEach(v=>v.resolve()),g.clear(),d.forEach(v=>v({source:"system",version:i})))},isReady:()=>f,markFailed(v){f||u!==void 0||l||(u=v,g.forEach(y=>y.reject(new mt(v))),g.clear(),d.forEach(y=>y({source:"system",version:i})))},failure:()=>u,whenReady(){return f?Promise.resolve():u!==void 0?Promise.reject(new mt(u)):l?Promise.reject(new Error("Документ закрыт до того, как наполнение закончилось")):new Promise((v,y)=>{g.add({resolve:v,reject:y})})},subscribe(v){return d.add(v),()=>d.delete(v)},isNew:()=>r===null,isDirty:()=>i>(o??-1),isDisposed:()=>l,dispose(){l=!0,g.forEach(v=>v.reject(new Error("Документ закрыт до того, как наполнение закончилось"))),g.clear(),d.clear(),t.dispose()}}}var Ra=500,Da=100,Pt=0;function Oa(e,t={}){const n=t.groupIntervalMs??Ra,r=t.maxSteps??Da,i=t.now??(()=>0);let o=[],s=0,d=Pt+=1,l=null,f=!1,u=!1,g=!1;const b=new Set,E=()=>b.forEach(a=>a()),I=(a,p)=>{if(a.length){u=!0;try{e.mutate({changes:a},{source:p})}finally{u=!1}}},v=a=>I(a,"user"),y=a=>{const p=i();f&&l!==null&&p-l<n?o[s-1]=Yn(o[s-1],a):(o=o.slice(0,s),o.push(a),s=o.length,f=!0,o.length>r&&(o=o.slice(o.length-r),s=o.length,d=Pt+=1)),l=p,E()},w=()=>{f=!1,l=null},S=a=>{if(!a.length)return;const p=o.length>s;p&&(o=o.slice(0,s)),s>0&&(o[s-1]=Yn(o[s-1],a)),w(),p&&E()},A=e.subscribe(({source:a,changes:p})=>{if(!(g||u||!p?.length)){if(a==="remote"){m();return}if(a!=="user"){S(p);return}y(p)}}),m=()=>{o=[],s=0,w(),d=Pt+=1,E()},c=()=>{if(s===0)return!1;const a=Sa(o[s-1]);return Xn(e.getContent(),a)?(v(a),s-=1,w(),!0):(o=o.slice(0,s-1),s=o.length,w(),E(),!1)};return{canUndo:()=>s>0,canRedo:()=>s<o.length,undo(){c()&&E()},redo(){if(!(s>=o.length)){if(!Xn(e.getContent(),o[s])){o=o.slice(0,s),w(),E();return}v(o[s]),s+=1,w(),E()}},clear:m,applyWithoutHistory(a){const p=e.get().version;if(I(a,"system"),e.get().version===p){w();return}S(a)},getPast:a=>o.slice(0,s).reverse().slice(0,a),getFuture:a=>o.slice(s).reverse().slice(0,a),createSnapshot:()=>({stackId:d,index:s}),restoreSnapshot(a){if(a.stackId!==d||a.index>s)return!1;for(;s>a.index;)if(!c())return E(),!1;return E(),!0},subscribe(a){return b.add(a),()=>b.delete(a)},dispose(){g=!0,A(),b.clear(),o=[],s=0}}}var xa=["edit","move","resize","insert"];function Rt(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function La(e){return typeof e=="string"?e:null}function Ma(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string")?null:e}function ka(e){return xa.includes(e)?e:null}function Na(e){const t=typeof e=="object"&&e!==null?e:{},n={originId:La(t.originId),changeId:Rt(t.changeId),rev:Rt(t.rev),baseRev:Rt(t.baseRev),expected:Ma(t.expected),intent:ka(t.intent)};return{...n,legacy:Object.values(n).every(r=>r===null)}}var Qn=class extends Error{reason;constructor(e){super(`сохранение не состоялось: ${e}`),this.name="SaveRefusedError",this.reason=e}},wi="draft";function Fe(e){return e==null||e===""?wi:String(e)}function Fa(e){return e==null||e===""?`${Zt}${wi}`:`${Zt}${String(e)}`}var Zt="block:";function he(e){return e?.startsWith(Zt)===!0}function je(e){return he(e.sessionKey())?void 0:e.current()}function Ue(e,t,n){const r=typeof performance<"u"?performance.now():Date.now();return G(`show:gate:${e}`,{kind:"wait"}),t.then(i=>(G(`show:gate:${e}:end`,{kind:"wait"}),i),i=>{const o=Math.round((typeof performance<"u"?performance.now():Date.now())-r);throw`${e}`,{error:String(i),...n},i})}function Si(e){return e?.length?[...e].sort((t,n)=>Date.parse(n.modified)-Date.parse(t.modified))[0]:null}function Ii(e,{freshSince:t}={}){return!(!e?.slug?.includes("autosave")||!e?.html?.trim()||t!==void 0&&Date.parse(e.modified)<t-5e3)}function ja(e,t={}){const n=Si((e??[]).filter(r=>r?.html?.trim()));return Ii(n,t)?n:null}function Ba(e){const t=Date.parse(Si(e)?.modified??"");return{autosave:ja(e),...Number.isFinite(t)?{latestAt:t}:{}}}function Ua({hasUnsavedUserEdit:e}){return e?"skip":"apply"}var Ti=e=>e.replace(/\r\n?/g,`
997
997
  `),Zn=["recovery","plugin","rest"],Ha=["subject","preheader"];function Ga(e){let t={},n;for(let i=Zn.length-1;i>=0;i--){const o=e.get(Zn[i]);o&&(o.attributes&&(t={...t,...o.attributes}),o.content!==void 0&&(n=o.content))}const r=e.get("plugin")?.attributes;for(const i of Ha){const o=r?.[i];typeof o=="string"&&o!==""&&(t={...t,[i]:o})}return n!==void 0?{content:n,attributes:t}:{attributes:t}}function Ai(e,t){if(!e||!t)return;const n=e.getContent(),r=t.content!==void 0?Ti(t.content):void 0,i=r!==void 0&&r!==n;e.get().docId,Object.keys(t.attributes??{}),e.mutate({attributes:t.attributes??{},...i?{changes:[new re(0,n,0,r)]}:{}},{source:"remote"})}var er=e=>typeof e=="string"?e.trim():"";function qa(e,t,n){const{version:r,attributes:i}=e.get(),o=i,s=er(o.title)||er(o.subject);return{version:r,payload:{html:e.getContent(),title:s,subject:o.subject,preheader:o.preheader,description:o.description,common_styles:o.common_styles||"",meta:o.meta,utm_parameters:o.utm_parameters,parent_email:o.parent_email,is_template:o.is_template||!1,is_inited:o.is_inited,tags:o.tags,emailtags:o.emailtags,group:o.group,renderGuid:e.get().docId,project:t.project??o.project,folder:t.folder,...n?.emailtags?{emailtags:n.emailtags}:{},...n?.group?{group:n.group}:{},source:t.source}}}async function $a(e,t,n,r,i){if(n==="materialize"||n==="publish"&&r==null)return e.createEmail(i);if(r==null)throw new Error("Письмо ещё не создано на сервере");return n==="publish"?e.updateEmail(r,i):t.saveAutosave(r,i)}function ge(e,t=!1){const n={};for(const r of Object.keys(e)){let i=e[r];i!==void 0&&!(typeof i=="number"&&Number.isNaN(i))&&(t&&typeof i=="object"&&i!==null&&(i=ge(i)),n[r]=i)}return n}var za=new Set(["html","id","renderGuid","showToken","showId","isNew"]);function Ci(e){return e?Object.fromEntries(Object.entries(e).filter(([t])=>!za.has(t))):{}}function ht(e,t,n={}){e&&e.mutate({attributes:Va(e.get().attributes,t)},{source:n.source??"user"})}function Va(e,t){return t.subject===void 0||t.title!==void 0?t:(e.title??"")===(e.subject??"")?{...t,title:t.subject}:t}function Tn(e,t){return e===void 0&&Object.keys(t).length===0?null:{...e!==void 0?{content:e}:{},attributes:t}}function Ka(e){return typeof e=="string"&&e.startsWith("{")?e:"{}"}function Pi(e){if(!e)return null;const t=Ci(e);return e.common_styles!==void 0&&(t.common_styles=Ka(e.common_styles)),Tn(e.html,t)}function Ri(e){return e?Tn(e.html,ge(Ci(e))):null}var Wa=["common_styles","subject","preheader","meta"];function tr(e){if(!e?.html?.trim())return null;const t={};for(const n of Wa)Ya(n,e[n])&&(t[n]=e[n]);return Tn(e.html,t)}function Ya(e,t){return e==="common_styles"?typeof t=="string"&&t.startsWith("{"):e==="meta"?typeof t=="object"&&t!==null&&!Array.isArray(t):typeof t=="string"}var Xa=10,Ja=(e,t)=>e.key===t.key&&Qa(e.serverId,t.serverId),Qa=(e,t)=>e==null||e===t;function Za(e){return typeof e?.then=="function"}var nr=e=>{e.timer!==void 0&&(clearTimeout(e.timer),e.timer=void 0)},Di=e=>{e.request.serverId!=null&&e.document.markSaved(e.document.get().version)},el=e=>{Ai(e.document,Ga(e.reports)),Di(e)},Dt=(e,t)=>{if(!e.ready){el(e);return}Ai(e.document,t)},tl=e=>{const{attributes:t,serverId:n,docId:r}=e.document.get();return{...t,html:e.document.getContent(),id:n??void 0,isNew:n==null,renderGuid:r}};function nl(e){const{resolveAdapters:t,timeoutMs:n,resolveWritePort:r,resolveHistoryPort:i,resolveTerms:o,canEdit:s,notifyBeforeSave:d,onAdapterError:l,onTimeout:f}=e;let u;const g=new Set,b=new Set,E=()=>g.forEach(h=>h()),I=(h,_)=>{if(!(h.closed||h.ready)){if(h.error!==void 0){h.document.markFailed(h.error),h.document.get().docId;return}Di(h),h.ready=!0,h.document.markReady(),h.document.get().docId,[...h.reports.keys()]}},v=(h,_,T)=>{l?.(_.id,T),!(!_.required||h.closed)&&(h.error=T,h.document.get().docId,_.id,E())},y=(h,_)=>{const T=new Set(_.map(P=>P.id));_.forEach(P=>{P.watch&&h.watchers.push(P.watch(D=>h.closed?!1:h.ready&&D?.content!==void 0&&Ua({hasUnsavedUserEdit:h.document.isDirty()})==="skip"?(h.document.get().docId,P.id,!1):(D&&h.reports.set(P.id,D),Dt(h,D),!0)))});const R=(P,D)=>{h.closed||(D&&h.reports.set(P.id,D),Dt(h,D))},N=()=>{T.size>0||h.closed||(nr(h),I(h,[]))},X=[];if(_.forEach(P=>{let D;try{D=P.load()}catch(q){v(h,P,q),T.delete(P.id);return}if(Za(D)){X.push({id:P.id,required:P.required,load:()=>D});return}R(P,D),T.delete(P.id)}),X.length===0){N();return}h.timer=setTimeout(()=>{h.timer=void 0,f?.([...T]),h.document.get().docId,[...T],I(h,[...T])},n),h.timer.unref?.(),X.forEach(P=>{P.load().then(D=>R(P,D)).catch(D=>{v(h,P,D)}).finally(()=>{T.delete(P.id),N()})})},w=async(h,_,T)=>{if(T==="snapshot"||T==="anchor")return;const R=o?.();if(R)return R.resolve({project:_.project??h.project,tags:(h.tags??[]).map(N=>({name:N}))})},S=h=>{if(h.lock===!0&&s?.(h)===!1)return new Qn("locked");const _=h.tags?.length??0,T=h.emailtags?.length??0;if(Math.max(_,T)>Xa)return new Qn("too-many-tags")},A=async(h,_,T)=>{try{await h.document.whenReady()}catch(D){return h.saveError=D,h.saveFailures+=1,h.saveFailures,!1}if(h.closed)return!1;const R=S(h.document.get().attributes);if(R)return h.saveError=R,h.saveFailures+=1,R.reason,E(),!1;if(d&&(await d(tl(h)).catch(()=>{}),h.closed))return!1;let N;try{N=await w(h.document.get().attributes,T,_)}catch(D){return h.saveError=D,h.saveFailures+=1,h.saveFailures,E(),!1}if(h.closed)return!1;const{payload:X,version:P}=qa(h.document,T,N);h.document.get().docId;try{const D=h.document.get().serverId!=null,q=await $a(r(),i(h.request.key),_,h.document.get().serverId,X);if(h.closed)return!0;let j;if(_==="snapshot"||_==="anchor"){const x=q?.modified!=null?Date.parse(q.modified):NaN;j=Number.isFinite(x)?x:Date.now(),h.snapshotVersion=P,h.lastRevisionAt=j}else h.document.markSaved(P,q?.id!=null?String(q.id):void 0);const K=h.document.get().serverId;!D&&K!=null&&(h.recoveryFacts={emailId:K,historyLoaded:!0,isRecovering:!1}),h.saveError=void 0,h.saveFailures=0,h.document.get().serverId,E();const de={intent:_,serverId:h.document.get().serverId,created:!D,...j!==void 0?{revisionAt:j}:{}};return b.forEach(x=>x(de)),!0}catch(D){return h.saveError=D,h.saveFailures+=1,h.saveFailures,E(),!1}},m=()=>{u&&(u.closed=!0,u.watchers.forEach(h=>h()),u.watchers=[],nr(u),u.history.dispose(),u.document.dispose(),u=void 0)},c=(h,_,T)=>{let R=!1;_.show&&(h.show?.id!==_.show.id||h.show.token!==_.show.token)&&(h.show=_.show,R=!0,{docId:h.document.get().docId,..._.show});const N=T==="show"?Ri(_.patch):null;N&&(h.reports.set("plugin",N),Dt(h,N)),R&&E()},a=(h,_={})=>{const T=u;return!T||T.closed?Promise.resolve(!1):T.saving?h==="snapshot"?Promise.resolve(!1):(T.inFlight??Promise.resolve(!1)).then(()=>a(h,_)):(T.saving=!0,T.inFlight=A(T,h,_).finally(()=>{T.saving=!1,T.inFlight=void 0}),T.inFlight)},p=(h,_="open")=>{if(u&&!u.closed&&_!=="new"&&Ja(u.request,h))return c(u,h,_),u.document;m();const T=Pa({createBuffer:()=>ya(""),serverId:h.serverId??null}),R={request:h,show:h.show,document:T,history:Oa(T,{now:Date.now}),watchers:[],saveFailures:0,saving:!1,reports:new Map,ready:!1,closed:!1};return u=R,T.get().docId,h.serverId,y(R,t(h,{publishRecoveryFacts(N){R.closed||(R.recoveryFacts=N,E())},readShownContent:()=>R.closed?null:R.document.getContent()})),E(),T};return{openWith:p,open:(h,_={})=>p({key:Fe(h),serverId:h,email:_.email,patch:_.patch,show:_.show},"open"),openDraft:(h,_={})=>p({key:Fe(void 0),serverId:null,email:h,patch:_.patch,show:_.show},"open"),startNewDraft:(h,_={})=>p({key:Fe(void 0),serverId:null,email:h,patch:_.patch,show:_.show},"new"),reload:(h,_={})=>p({key:Fe(h),serverId:h,email:_.email,patch:_.patch,show:_.show},"new"),openBlock:(h,_)=>p({key:he(h)?h:Fa(h),serverId:_?.id!=null?String(_.id):null,email:_},"open"),show:(h,_)=>{const T=u;if(!(!T||T.closed))return p({...T.request,patch:h,show:_},"show")},current:()=>u?.document,save:a,saveState:()=>({error:u?.saveError,failures:u?.saveFailures??0,saving:u?.saving===!0}),revisionFacts(){if(!u)return;const h=u.revisionFactsSnapshot;return h&&h.snapshotVersion===u.snapshotVersion&&h.lastRevisionAt===u.lastRevisionAt?h:(u.revisionFactsSnapshot={snapshotVersion:u.snapshotVersion,lastRevisionAt:u.lastRevisionAt},u.revisionFactsSnapshot)},recoveryFacts:()=>u?.recoveryFacts,history:()=>u?.history,forcedHeaders:()=>u?.forcedHeaders,beginForcedHeaders(h){u&&!u.closed&&(u.forcedHeaders=h)},endForcedHeaders(){u&&(u.forcedHeaders=void 0)},onSaved(h){return b.add(h),()=>b.delete(h)},showFacts:()=>u?.show,sessionKey:()=>u?.request.key,openError:()=>u?.error,subscribe(h){return g.add(h),()=>g.delete(h)},close(){u&&(m(),E())}}}var Oi=class extends Error{reason;constructor(e,t){super(`письмо не открылось: ${e}`),this.name="EmailOpenFailedError",this.reason=e,this.cause=t}};function xi(e){if(e instanceof Oi)return e.reason;if(e instanceof mt)return xi(e.reason)}function rl(e,t){return{id:"rest",required:!0,load:async()=>{const n=await e.readEmail(t);if(!n)throw new Oi("not-found");return Pi(n)}}}var Li=O("EmailPort");function il(e){return e.getInstance(Li)}function ol(e,t){e.inject(Li,t)}var Mi=O("documentSession.restEmailPortFactories");function ki(e){return e.getInstance(Mi)!==void 0}function Se(e){const t=e.getInstance(Mi);if(!t)throw new Error("[documentSession] порты поверх REST ещё не загружены — работа с сервером начинается с init()");return t}var sl=O("EmailTermsResolver");function al(e){return e.getInstance(sl)}var Ni=O("EmailHistoryPort"),ll=O("BlockHistoryPort");function Fi(e){return e.getInstance(ll)}function ji(e){return e.getInstance(Ni)}function dl(e,t){e.inject(Ni,t)}var cl="em_autosave_pending";function gt(e){return`${cl}_${e}`}function ul(e,t){try{sessionStorage.setItem(gt(e),JSON.stringify(t))}catch{}}function fl(e){try{const t=sessionStorage.getItem(gt(e));if(!t)return null;const n=JSON.parse(t);return Date.now()-n.sentAt>6e4?(sessionStorage.removeItem(gt(e)),null):n}catch{return null}}function nt(e){try{sessionStorage.removeItem(gt(e))}catch{}}var pl=2e3,ml=5e3,hl=5,gl=5e3,vl=4;function bl(){return typeof performance<"u"&&typeof performance.timeOrigin=="number"?performance.timeOrigin:Date.now()}function El(e,t){return e==null||t==null?!1:e.replaceAll(`\r
998
998
  `,`
999
999
  `)===t.replaceAll(`\r
1000
1000
  `,`
1001
- `)}function yl({emailId:e,readAutosave:t,revisionServiceEnabled:n,isHistoryAvailable:r,readShownContent:i,onFacts:o,onLate:s,onError:d,pageLoadTs:l=bl()}){let f=null,u=!1,g=!1,b=0,E={emailId:e,historyLoaded:!1,isRecovering:!1},I=null;const v=new Promise(P=>{I=P}),y=P=>{E={...E,...P},o(E)},w=P=>{b+=1,y({applied:{phase:P,seq:b}})},S=()=>{f?.timer&&clearTimeout(f.timer),f=null},A=P=>{if(!g){if(I){const D=I;I=null,D(P),P.revision&&w(P.phase);return}s(P)&&P.revision&&w(P.phase)}},m=()=>{if(!f||g)return;const P=f.phase==="fast",D=P?pl:gl,q=P?hl:vl;f.timer=setTimeout(()=>{const j=f;if(!(!j||g)){if(j.attempts+=1,_(),P&&j.attempts>=q){const{pending:K}=j;nt(e),y({isRecovering:!1}),A({revision:{html:K.html,common_styles:K.common_styles,subject:K.subject,preheader:K.preheader},phase:"timeout"}),u=!0,j.phase="bg",j.attempts=0,m();return}if(!P&&j.attempts>=q){nt(e),S(),y({isRecovering:!1}),u=!0;return}m()}},D),f.timer.unref?.()},c=P=>{f={phase:"fast",attempts:0,pending:P,timer:null},y({isRecovering:!0}),m()},a=(P,D)=>Ii(P.autosave,D===void 0?{}:{freshSince:D})?P.autosave:null,p=P=>{if(g)return;if(y({historyLoaded:!0,latestRevisionAt:P.latestAt!==void 0&&Number.isFinite(P.latestAt)?P.latestAt:void 0}),n&&f){const j=a(P,f.pending.sentAt);if(!j)return;const K=f.phase==="fast"?"found":"bg";nt(e),S(),y({isRecovering:!1}),u=!0,A({revision:j,phase:K});return}if(u)return;const D=n?fl(e):null,q=D&&(D.sentAt<l||!El(D.html,i()))?D:null;if(q){const j=a(P,q.sentAt);if(j){nt(e),u=!0,A({revision:j,phase:"found"});return}c(q);return}u=!0,A({revision:a(P),phase:"normal"})},h=P=>{g||(d?.(P),E.historyLoaded||(y({historyLoaded:!1,latestRevisionAt:void 0}),N()),!f&&A({revision:null,phase:"normal"}))},_=()=>t(e).then(p).catch(h);let T,R=!1;const N=()=>{R||f||g||(R=!0,T=setTimeout(()=>{T=void 0,!g&&!E.historyLoaded&&_()},ml))},X=()=>{g||(y({historyLoaded:!1,latestRevisionAt:void 0}),A({revision:null,phase:"normal"}))};return r?r().then(P=>P?_():X()):_(),{verdict:()=>v,dispose(){g=!0,T!==void 0&&(clearTimeout(T),T=void 0),S()}}}function _l({port:e,revisionServiceEnabled:t,isHistoryAvailable:n,emailId:r,readShownContent:i,onFacts:o}){let s=null;const d=yl({emailId:r,readAutosave:l=>e.readAutosave(l),revisionServiceEnabled:t,...n?{isHistoryAvailable:n}:{},readShownContent:i,onFacts:o,onLate:({revision:l,phase:f})=>{const u=tr(l);return s?.(u)??!1},onError:l=>{l instanceof Error&&l.message}});return{id:"recovery",load:()=>d.verdict().then(({revision:l})=>tr(l)),watch(l){return s=l,()=>{s=null,d.dispose()}}}}function Bi(e,t){return{readRevisions:(n,r)=>t.readRevisions(n,r),readAutosave:n=>t.readAutosave(n),async saveAutosave(n,r){ul(n,{sentAt:Date.now(),html:r.html??"",common_styles:r.common_styles??"",subject:r.subject,preheader:r.preheader});const i=await t.saveAutosave(n,r);return await e.saveAutosave(n,r),i}}}function wl(e,t){return{readEmail:n=>e.readEmail(n),createEmail:n=>e.createEmail(n),async updateEmail(n,r){const i=await t.updateEmail(n,r);return await e.updateEmail(n,r),i}}}var Ui=O("CurrentUser"),Hi={};function Gi(e){return e.getOrCreateInstance(Ui,()=>Me(Hi))}function qi(e){return e?.getInstance(Ui)?.get()??Hi}function $i(e){return e?.getInstance(we)?.get()??{}}var Sl=1.5;function Il(e){return!e.isEnabled||e.isUserBusy||!e.isReady||!e.isInited?"none":e.isNew?"create":!e.isDirty||e.isSnapshotSent||!e.isHistoryLoaded||e.latestRevisionAgeMs!==void 0&&e.latestRevisionAgeMs<=Sl*e.autosaveTimeoutMs?"none":"revision"}var Tl=4;function Al(e){const{readDocument:t,readEnvironment:n,onCreate:r,onRevision:i}=e,o=e.readFailures??(()=>0),s=()=>n().autosaveTimeoutMs*2**Math.min(o(),Tl),d=()=>{const w=t();if(!w||w.isDisposed())return"none";const{latestRevisionAt:S,snapshotVersion:A,...m}=n();return Il({...m,isDirty:w.isDirty(),isNew:w.isNew(),isReady:w.isReady(),latestRevisionAgeMs:S!=null?Date.now()-S:void 0,isSnapshotSent:A!=null&&A===w.get().version})},l=()=>{const w=t();if(!w||w.isDisposed())return!1;if(!w.isDirty())return w.isNew();const{snapshotVersion:S}=n();return!(S!=null&&S===w.get().version)};let f,u,g,b,E=!1;const I=()=>{u=void 0;const w=t();if(!w||w.isDisposed())return;if(w.get().docId!==f){v();return}const S=d();S==="create"?r():S==="revision"?i():l()&&(f=w.get().docId,u=setTimeout(I,s()))},v=()=>{const w=t();E||!w||u!==void 0||d()==="none"&&!l()||(f=w.get().docId,u=setTimeout(I,s()))},y=()=>{const w=t();w!==g&&(b?.(),g=w,b=w?.subscribe(v),u!==void 0&&(clearTimeout(u),u=void 0))};return y(),v(),{refresh:()=>{E||(y(),v())},stop:()=>{E=!0,b?.(),b=void 0,g=void 0,u!==void 0&&(clearTimeout(u),u=void 0)}}}var zi=O("documentSession.autosaveUiFacts"),Vi={isUserBusy:!1,saveContext:{}};function Cl(e){return e.getOrCreateInstance(zi,()=>Me(Vi))}function rr(e){return e?.getInstance(zi)?.get()??Vi}var Pl=1e4;function Rl(e,t){const n=()=>{const l=t.current(),f=l?.get().serverId??void 0,u=he(t.sessionKey()),g=t.recoveryFacts(),b=g?.emailId===f?g:void 0,E=t.revisionFacts(),I=b?.latestRevisionAt,v=E?.lastRevisionAt,y=qi(e).profile;return{isInited:u||l?.get().attributes.is_inited===!0,isEnabled:!!y?.autosaves,isHistoryLoaded:b?.historyLoaded===!0,isUserBusy:rr(e).isUserBusy,autosaveTimeoutMs:$i(e).autosaveTimeout||Pl,latestRevisionAt:I!==void 0||v!==void 0?Math.max(I??0,v??0):void 0,snapshotVersion:E?.snapshotVersion}},r=()=>{const l=rr(e).saveContext;return{...l,project:l.project??t.current()?.get().attributes.project}},i=Al({readDocument:()=>t.current(),readEnvironment:n,readFailures:()=>t.saveState().failures,onCreate:()=>{he(t.sessionKey())||t.save("materialize",r())},onRevision:()=>{t.save("snapshot",{project:r().project})}}),o=t.subscribe(i.refresh),s=Gi(e).watch(()=>i.refresh()),d=Cl(e).watch(()=>i.refresh());return()=>{o(),s.dispose(),d.dispose(),i.stop()}}var ir=12e3;function ve(e){return e.getOrCreateInstance(Sn,()=>{const t=nl({resolveAdapters:(r,i)=>xl(r,e,i),resolveWritePort:()=>Ki(e),resolveHistoryPort:r=>he(r)?Yi(e):Wi(e),resolveTerms:()=>al(e),canEdit:r=>ca(e,r),notifyBeforeSave:va(e),timeoutMs:ir,onAdapterError:(r,i)=>{i instanceof Error&&i.message,yt(i,{origin:"email-source-adapter",tags:{source:r}})},onTimeout:r=>{}}),n=Rl(e,t);return e.getInstance(k)?.addDispose(n),t})}function An(e){return e?.getInstance(Sn)}function Ki(e){const t=il(e);return t?Cn(e)?wl(t,Se(e).email(e)):t:Se(e).email(e)}function Dl(e){return ji(e)!==void 0||ki(e)}function Wi(e){const t=ji(e);return t?Cn(e)?(G("port:history:server-backed"),Bi(t,Se(e).history(e))):(G("port:history:integrator"),t):(G("port:history:rest (порт не зарегистрирован)"),Se(e).history(e))}function Yi(e){const t=Fi(e);return t?Cn(e)?(G("port:block-history:server-backed"),Bi(t,Se(e).blockHistory(e))):(G("port:block-history:integrator"),t):(G("port:block-history:rest (порт не зарегистрирован)"),Se(e).blockHistory(e))}function Ol(e){return Fi(e)!==void 0||ki(e)}function Cn(e){return pi(e)}function xl({email:e,patch:t,serverId:n,key:r},i,o){const s=[];e?s.push({id:"rest",load:()=>Pi(e),required:!0}):n&&s.push(rl(Ki(i),n)),t&&s.push({id:"plugin",load:()=>Ri(t)});const d=he(r);return ba(n)&&(d?Ol(i):Dl(i))&&s.push(_l({port:d?Yi(i):Wi(i),revisionServiceEnabled:pi(i),...!d&&ua(i)?{isHistoryAvailable:()=>fa(i)}:{},emailId:n,readShownContent:()=>o.readShownContent(),onFacts:l=>o.publishRecoveryFacts(l)})),s}function Y(e){return e.getOrCreateInstance(We,()=>new Ye)}var Xi=new WeakMap,en=new WeakMap;function ue(e){return Xi.get(e)??0}function Ji(e,t){let n=en.get(e);return n||(n=new Set,en.set(e,n)),n.add(t),()=>{n?.delete(t)}}function Ll(e){Xi.set(e,ue(e)+1),en.get(e)?.forEach(t=>t())}function Ml(e){const t=ve(e),n=Y(e).addListener(M.APPLICATION_HAS_AMP,r=>{je(t)?.mutate({attributes:{isAmp:r}},{source:"remote"})});e.getInstance(k)?.addDispose(()=>n.dispose())}function kl(e){return e.size>0&&(e.type===""||e.type.startsWith("image/"))}function Nl(e){const t=e.fetchImpl??((o,s)=>fetch(o,s)),n=e.pageHost??(()=>window.location.hostname),r=new Set,i=o=>{try{const s=new URL(o,window.location.href);return s.protocol!=="https:"&&s.protocol!=="http:"?!1:s.hostname===n()||e.sourceHosts().includes(s.hostname)}catch{return!1}};return{accepts:i,async load(o){if(!i(o))return;const s=!r.has(o);r.add(o);try{const d=await t(o,{mode:"cors",credentials:"omit",cache:s?"no-cache":"default"});if(!d.ok)return;const l=await d.blob();return kl(l)?l:void 0}catch{return}}}}var _e={maxBytes:67108864,maxImageBytes:4194304,ttlMs:18e5};function Fl(e){const t={maxBytes:e.maxBytes??_e.maxBytes,maxImageBytes:e.maxImageBytes??_e.maxImageBytes,ttlMs:e.ttlMs??_e.ttlMs},n=e.now??(()=>Date.now()),r=new Map,i=new Map,o={hits:0,loads:0,failures:0};let s=0;const d=g=>{const b=r.get(g);b&&(s-=b.bytes,r.delete(g))},l=g=>t.ttlMs<=0||n()-g.storedAt<t.ttlMs,f=()=>{if(s<=t.maxBytes)return;const g=[...r.entries()].sort((b,E)=>b[1].usedAt-E[1].usedAt);for(const[b]of g){if(s<=t.maxBytes)return;d(b)}},u=(g,b)=>{b.size>t.maxImageBytes||(r.set(g,{blob:b,bytes:b.size,storedAt:n(),usedAt:n()}),s+=b.size,f())};return{async get(g){const b=r.get(g);if(b&&l(b))return b.usedAt=n(),o.hits+=1,b.blob;b&&d(g);const E=i.get(g);if(E!==void 0)return E;o.loads+=1;const I=(async()=>{try{const v=await e.load(g);return v?u(g,v):o.failures+=1,v}catch{o.failures+=1;return}finally{i.delete(g)}})();return i.set(g,I),I},forget(g){d(g),i.delete(g)},clear(){r.clear(),i.clear(),s=0},stats(){return{entries:r.size,bytes:s,...o}}}}var jl=["emcdn.ru","scr.emcdn.ru"];function Bl(e){const t=String(e??"").trim();if(!t)return"";try{return new URL(t.includes("//")?t:`https://${t}`).hostname}catch{return t.split("/")[0].split(":")[0]}}function Ul(e,t){const n=(r,i)=>{const o=new Set(i?t:[]);for(const s of r){const d=Bl(s);d&&o.add(d)}return[...o]};return e?Array.isArray(e)?n(e,!0):n(e.value??[],e.replace!==!0):[...t]}function or(e){const t=e??{},n=t.isPlugin!==!0?jl:[],r=t.canvasImageCache;if(r===!1)return{enabled:!1,sourceHosts:[],..._e};const i=r===!0||r===void 0?{}:r;return{enabled:i.enabled!==!1,sourceHosts:Ul(i.sourceHosts,n),maxBytes:i.maxBytes??_e.maxBytes,maxImageBytes:i.maxImageBytes??_e.maxImageBytes,ttlMs:i.ttlMs??_e.ttlMs}}function Hl(e){const t=Y(e),n=e.getInstance(we);let r=or(n?.get());const i=Nl({sourceHosts:()=>r.sourceHosts}),o=Fl({load:I=>i.load(I),maxBytes:r.maxBytes,maxImageBytes:r.maxImageBytes,ttlMs:r.ttlMs}),s=()=>{t.send(M.SANDBOX_CANVAS_IMAGE_CACHE_SETUP,{enabled:r.enabled,sourceHosts:[...r.sourceHosts]})},d=t.onInit(()=>s()),l=n?.watch(()=>{const I=or(n.get()),v=JSON.stringify(I)!==JSON.stringify(r);r=I,I.enabled||o.clear(),v&&t.isInited()&&s()}),f={asked:0,served:0,refused:0},u=[],g=(I,v)=>(f.refused+=1,u.push({url:I,reason:v}),u.length>20&&u.shift(),{refused:!0}),b=Object.assign(globalThis,{__emmCanvasImages__:()=>({settings:r,counters:{...f},refusals:[...u],store:o.stats()})}),E=t.addListenerAsync(M.APPLICATION_CANVAS_IMAGE_GET,async I=>{const v=I?.url??"";if(f.asked+=1,!r.enabled||!v)return g(v,"disabled");if(!i.accepts(v))return g(v,"host");I.fresh&&o.forget(v);const y=await o.get(v);return y?(f.served+=1,{blob:y}):g(v,"load-failed")});e.getInstance(k)?.addDispose(()=>{d.dispose(),l?.dispose(),E.dispose(),o.clear(),delete b.__emmCanvasImages__})}var Gl=2e3;function ql(e){const t=Y(e),n=new Set,r=()=>{const s=t.getTarget();if(!s||t.hasPort(s))return;const d=new MessageChannel;let l=!1;const f=g=>{g.data?.operationId==="em:port-ready"&&(l=!0,d.port1.removeEventListener("message",f),t.drainWindow(s))};d.port1.addEventListener("message",f),t.sendPort(s,d.port2),t.usePort(d.port1,!1,s);const u=setTimeout(()=>{n.delete(u),!l&&(yt(new Error("canvas port did not come up, staying on window messaging"),{origin:"canvas-channel"}),d.port1.removeEventListener("message",f),t.useWindow(s))},Gl);n.add(u)},i=Object.assign(globalThis,{__emmCanvasPort__:()=>{const s=t.getTarget();return{usesPort:t.usesPort,windowDrained:s?t.isWindowDrained(s):!1}}}),o=t.onInit(()=>r());e.getInstance(k)?.addDispose(()=>{for(const s of n)clearTimeout(s);o.dispose(),delete i.__emmCanvasPort__})}var $l=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function zl(e){return $l.test(e)||e.indexOf("//")===0}function rt(e){return e&&(e.endsWith("/")?e:`${e}/`)}function Vl(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:""}function sr(e,t){const n=e==null||e===""?"./":String(e);if(zl(n))return rt(n);const r=t??Vl();if(!r)return rt(n);try{return rt(new URL(n,r).href)}catch{return rt(n)}}function Kl(){return typeof window.__emailmaker__<"u"&&window.__emailmaker__?.publicPath?sr(window.__emailmaker__.publicPath):sr("/")}var Wl=()=>"",Yl=()=>"aebc6ea7";function Qi(e){const t=e?"iframe-eblock":"iframe",n=Wl();if(n){const o=n.replace(/\/?$/,"/");return Vn(`${o}${t}.html`,qe())}const r=Yl(),i=`${Kl().replace(/\/?$/,"/")}iframe/`;return Vn(`${i}${t}${r?`.${r}`:""}.html`,qe())}var ar="allow-top-navigation allow-scripts allow-popups allow-popups-to-escape-sandbox";function tn(e){return/^file:/i.test(String(e||"").trim())}function Xl(e){return tn(e)?`${ar} allow-same-origin`:ar}var Jl="em:module-body-ack";function Ql(e,t,n){try{const r=new URL("./",new URL(t,n)).href,i=new URL(e,r).href;return i.startsWith(r)?i:void 0}catch{return}}function Pn(e){const t=e.split(/[?#]/)[0].split("/").pop()??"",n=/^(.+?)(?:\.[0-9a-f]{6,})?\.html$/.exec(t);return n?`js/${n[1]}.body.js`:void 0}function Zl(e,t){const n=Pn(t)?.replace(/^js\/|\.body\.js$/g,""),r=n?e[`${n}.html`]:void 0;return r?(r.imports??[]).map(i=>e[i]?.file).filter(i=>!!i):[]}function ed(e,t){const n=Pn(t)?.replace(/\.body\.js$/,".js");if(!n||!(n in e))return[];const r=new Set([n]),i=[n],o=[];for(;i.length>0;)for(const s of e[i.shift()]??[])r.has(s)||(r.add(s),o.push(s),i.push(s));return o}async function td(e){try{const t=await fetch(e);return t.ok?await t.blob():void 0}catch{return}}function nd(e){const t=new Map,n=r=>{const i=Ql(r,e.canvasSrc,e.origin);if(!i)return;const o=t.get(i);if(o!==void 0)return o;const s=e.fetchBody(i);return t.set(i,s),s};return{take(r){return n(r)??Promise.resolve(void 0)},warm(r){for(const i of r)n(i)},reset(){t.clear()},get size(){return t.size}}}async function rd(e,t,n){try{const r=new URL(".vite/manifest.json",new URL("./",new URL(e,t))).href,i=await fetch(r);if(!i.ok)return;const o=await i.json();n(Zl(o,e))}catch{}}function id(e){try{return tn(new URL(e,window.location.href).href)}catch{return tn(window.location.href)}}function od(e){Y(e);const t=Qi(!1);if(id(t))return;const n=nd({canvasSrc:t,origin:window.location.href,fetchBody:td}),r=Pn(t);r&&n.warm([r]);const i={"js/iframe-eblock.js":["js/discussHandlers.kGLogf6J.js","js/typograf.all.B0pVhMV_.js"],"js/iframe.js":["js/rolldown-runtime.qcwTIabA.js","js/discussHandlers.kGLogf6J.js"],"js/darkreader.CLd5EML2.js":[],"js/discussHandlers.kGLogf6J.js":["js/rolldown-runtime.qcwTIabA.js"],"js/rolldown-runtime.qcwTIabA.js":[],"js/rules.CnnzdMsj.js":[],"js/typograf.all.B0pVhMV_.js":["js/rolldown-runtime.qcwTIabA.js"]};i?n.warm(ed(i,t)):rd(t,window.location.href,s=>n.warm(s));const o=s=>{const d=s.data;if(!d||d.operationId!=="em:module-body"||!d.result)return;const l=s.source;l&&(l.postMessage({operationId:Jl,for:d.result},"*"),n.take(d.data?.url??"").then(f=>{l.postMessage({operationId:d.result,data:f??null},"*")}))};window.addEventListener("message",o),e.getInstance(k)?.addDispose(()=>{window.removeEventListener("message",o),n.reset()})}var Ae=/<script\b(?=[^>]*(?:\bbis_use(?:=|\s)|\bdata-bis-config(?:=|\s)|\bdata-dynamic-id(?:=|\s)|local\.adguard\.org|(?:chrome-extension|moz-extension|safari-extension):\/\/))[^>]*>[\s\S]*?<\/script>/gi,sd=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,Oe=/<style\b[^>]*>[\s\S]*?<\/style>/gi,lr=/display:\s*none\s*!important/gi,ad=/((?:html\s*,\s*body|body\s*,\s*html)\s*\{)([^}]*)(\})/gi,ld=/\s*height\s*:\s*100%\s*!important\s*;?/gi,dd=/height\s*:\s*100%\s*!important/i,cd=[".socialshare,",".advertisment,",".adHolder,",".adsbygoogle-noablate","#ab_adblock","#popmechanic-snippet","filter_ads_by_classname","clever-core-ads","--gn-ov-ad-height","pub_728x90.text-ad.textAd","html-load.com/player","content-loader.com/player",".adblock","#advblock","body { overflow: visible!important; }"];function ud(e){return lr.lastIndex=0,(e.match(lr)||[]).length}function Zi(e){const t=e.trim(),n=ud(t);if(n===0)return!1;if(t.includes(".advertisment,")&&t.includes(".adHolder,")&&(t.includes(".socialshare,")||n>=3||t.length>2e3))return!0;const r=cd.filter(i=>t.includes(i)).length;return r>=1&&(n>=3||t.length>2e3)||n>=5&&r>=1?!0:n>=20&&/\b(?:\.ad(?:s|vert|vertisment|Holder|banner|box|Container|Wrapper)?[,{]|#ad[-_]|ins\.adsbygoogle)/i.test(t)}function fd(e){Oe.lastIndex=0;for(const t of e.matchAll(Oe))if(Zi(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function pd(e){let t=!1;return Oe.lastIndex=0,{html:e.replace(Oe,n=>Zi(n.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):n),found:t}}function md(e){return Ae.lastIndex=0,Ae.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||fd(e)}function hd(e){if(!md(e))return{html:e,found:!1};let t=!1,n=e;Ae.lastIndex=0,Ae.test(n)&&(Ae.lastIndex=0,n=n.replace(Ae,""),t=!0),(/\sbis_[a-z0-9_-]+\s*=/.test(n)||/\sdata-bis-config\s*=/.test(n))&&(n=n.replace(sd,""),t=!0);const r=pd(n);return n=r.html,t=t||r.found,{html:n,found:t}}function gd(e){return!e||!dd.test(e)?e:(Oe.lastIndex=0,e.replace(Oe,t=>t.replace(ad,(n,r,i,o)=>`${r}${i.replace(ld,"")}${o}`)))}function eo(e){const t=hd(e.replaceAll(`\r
1001
+ `)}function yl({emailId:e,readAutosave:t,revisionServiceEnabled:n,isHistoryAvailable:r,readShownContent:i,onFacts:o,onLate:s,onError:d,pageLoadTs:l=bl()}){let f=null,u=!1,g=!1,b=0,E={emailId:e,historyLoaded:!1,isRecovering:!1},I=null;const v=new Promise(P=>{I=P}),y=P=>{E={...E,...P},o(E)},w=P=>{b+=1,y({applied:{phase:P,seq:b}})},S=()=>{f?.timer&&clearTimeout(f.timer),f=null},A=P=>{if(!g){if(I){const D=I;I=null,D(P),P.revision&&w(P.phase);return}s(P)&&P.revision&&w(P.phase)}},m=()=>{if(!f||g)return;const P=f.phase==="fast",D=P?pl:gl,q=P?hl:vl;f.timer=setTimeout(()=>{const j=f;if(!(!j||g)){if(j.attempts+=1,_(),P&&j.attempts>=q){const{pending:K}=j;nt(e),y({isRecovering:!1}),A({revision:{html:K.html,common_styles:K.common_styles,subject:K.subject,preheader:K.preheader},phase:"timeout"}),u=!0,j.phase="bg",j.attempts=0,m();return}if(!P&&j.attempts>=q){nt(e),S(),y({isRecovering:!1}),u=!0;return}m()}},D),f.timer.unref?.()},c=P=>{f={phase:"fast",attempts:0,pending:P,timer:null},y({isRecovering:!0}),m()},a=(P,D)=>Ii(P.autosave,D===void 0?{}:{freshSince:D})?P.autosave:null,p=P=>{if(g)return;if(y({historyLoaded:!0,latestRevisionAt:P.latestAt!==void 0&&Number.isFinite(P.latestAt)?P.latestAt:void 0}),n&&f){const j=a(P,f.pending.sentAt);if(!j)return;const K=f.phase==="fast"?"found":"bg";nt(e),S(),y({isRecovering:!1}),u=!0,A({revision:j,phase:K});return}if(u)return;const D=n?fl(e):null,q=D&&(D.sentAt<l||!El(D.html,i()))?D:null;if(q){const j=a(P,q.sentAt);if(j){nt(e),u=!0,A({revision:j,phase:"found"});return}c(q);return}u=!0,A({revision:a(P),phase:"normal"})},h=P=>{g||(d?.(P),E.historyLoaded||(y({historyLoaded:!1,latestRevisionAt:void 0}),N()),!f&&A({revision:null,phase:"normal"}))},_=()=>t(e).then(p).catch(h);let T,R=!1;const N=()=>{R||f||g||(R=!0,T=setTimeout(()=>{T=void 0,!g&&!E.historyLoaded&&_()},ml))},X=()=>{g||(y({historyLoaded:!1,latestRevisionAt:void 0}),A({revision:null,phase:"normal"}))};return r?r().then(P=>P?_():X()):_(),{verdict:()=>v,dispose(){g=!0,T!==void 0&&(clearTimeout(T),T=void 0),S()}}}function _l({port:e,revisionServiceEnabled:t,isHistoryAvailable:n,emailId:r,readShownContent:i,onFacts:o}){let s=null;const d=yl({emailId:r,readAutosave:l=>e.readAutosave(l),revisionServiceEnabled:t,...n?{isHistoryAvailable:n}:{},readShownContent:i,onFacts:o,onLate:({revision:l,phase:f})=>{const u=tr(l);return s?.(u)??!1},onError:l=>{l instanceof Error&&l.message}});return{id:"recovery",load:()=>d.verdict().then(({revision:l})=>tr(l)),watch(l){return s=l,()=>{s=null,d.dispose()}}}}function Bi(e,t){return{readRevisions:(n,r)=>t.readRevisions(n,r),readAutosave:n=>t.readAutosave(n),async saveAutosave(n,r){ul(n,{sentAt:Date.now(),html:r.html??"",common_styles:r.common_styles??"",subject:r.subject,preheader:r.preheader});const i=await t.saveAutosave(n,r);return await e.saveAutosave(n,r),i}}}function wl(e,t){return{readEmail:n=>e.readEmail(n),createEmail:n=>e.createEmail(n),async updateEmail(n,r){const i=await t.updateEmail(n,r);return await e.updateEmail(n,r),i}}}var Ui=O("CurrentUser"),Hi={};function Gi(e){return e.getOrCreateInstance(Ui,()=>Me(Hi))}function qi(e){return e?.getInstance(Ui)?.get()??Hi}function $i(e){return e?.getInstance(we)?.get()??{}}var Sl=1.5;function Il(e){return!e.isEnabled||e.isUserBusy||!e.isReady||!e.isInited?"none":e.isNew?"create":!e.isDirty||e.isSnapshotSent||!e.isHistoryLoaded||e.latestRevisionAgeMs!==void 0&&e.latestRevisionAgeMs<=Sl*e.autosaveTimeoutMs?"none":"revision"}var Tl=4;function Al(e){const{readDocument:t,readEnvironment:n,onCreate:r,onRevision:i}=e,o=e.readFailures??(()=>0),s=()=>n().autosaveTimeoutMs*2**Math.min(o(),Tl),d=()=>{const w=t();if(!w||w.isDisposed())return"none";const{latestRevisionAt:S,snapshotVersion:A,...m}=n();return Il({...m,isDirty:w.isDirty(),isNew:w.isNew(),isReady:w.isReady(),latestRevisionAgeMs:S!=null?Date.now()-S:void 0,isSnapshotSent:A!=null&&A===w.get().version})},l=()=>{const w=t();if(!w||w.isDisposed())return!1;if(!w.isDirty())return w.isNew();const{snapshotVersion:S}=n();return!(S!=null&&S===w.get().version)};let f,u,g,b,E=!1;const I=()=>{u=void 0;const w=t();if(!w||w.isDisposed())return;if(w.get().docId!==f){v();return}const S=d();S==="create"?r():S==="revision"?i():l()&&(f=w.get().docId,u=setTimeout(I,s()))},v=()=>{const w=t();E||!w||u!==void 0||d()==="none"&&!l()||(f=w.get().docId,u=setTimeout(I,s()))},y=()=>{const w=t();w!==g&&(b?.(),g=w,b=w?.subscribe(v),u!==void 0&&(clearTimeout(u),u=void 0))};return y(),v(),{refresh:()=>{E||(y(),v())},stop:()=>{E=!0,b?.(),b=void 0,g=void 0,u!==void 0&&(clearTimeout(u),u=void 0)}}}var zi=O("documentSession.autosaveUiFacts"),Vi={isUserBusy:!1,saveContext:{}};function Cl(e){return e.getOrCreateInstance(zi,()=>Me(Vi))}function rr(e){return e?.getInstance(zi)?.get()??Vi}var Pl=1e4;function Rl(e,t){const n=()=>{const l=t.current(),f=l?.get().serverId??void 0,u=he(t.sessionKey()),g=t.recoveryFacts(),b=g?.emailId===f?g:void 0,E=t.revisionFacts(),I=b?.latestRevisionAt,v=E?.lastRevisionAt,y=qi(e).profile;return{isInited:u||l?.get().attributes.is_inited===!0,isEnabled:!!y?.autosaves,isHistoryLoaded:b?.historyLoaded===!0,isUserBusy:rr(e).isUserBusy,autosaveTimeoutMs:$i(e).autosaveTimeout||Pl,latestRevisionAt:I!==void 0||v!==void 0?Math.max(I??0,v??0):void 0,snapshotVersion:E?.snapshotVersion}},r=()=>{const l=rr(e).saveContext;return{...l,project:l.project??t.current()?.get().attributes.project}},i=Al({readDocument:()=>t.current(),readEnvironment:n,readFailures:()=>t.saveState().failures,onCreate:()=>{he(t.sessionKey())||t.save("materialize",r())},onRevision:()=>{t.save("snapshot",{project:r().project})}}),o=t.subscribe(i.refresh),s=Gi(e).watch(()=>i.refresh()),d=Cl(e).watch(()=>i.refresh());return()=>{o(),s.dispose(),d.dispose(),i.stop()}}var ir=12e3;function ve(e){return e.getOrCreateInstance(Sn,()=>{const t=nl({resolveAdapters:(r,i)=>xl(r,e,i),resolveWritePort:()=>Ki(e),resolveHistoryPort:r=>he(r)?Yi(e):Wi(e),resolveTerms:()=>al(e),canEdit:r=>ca(e,r),notifyBeforeSave:va(e),timeoutMs:ir,onAdapterError:(r,i)=>{i instanceof Error&&i.message,yt(i,{origin:"email-source-adapter",tags:{source:r}})},onTimeout:r=>{}}),n=Rl(e,t);return e.getInstance(k)?.addDispose(n),t})}function An(e){return e?.getInstance(Sn)}function Ki(e){const t=il(e);return t?Cn(e)?wl(t,Se(e).email(e)):t:Se(e).email(e)}function Dl(e){return ji(e)!==void 0||ki(e)}function Wi(e){const t=ji(e);return t?Cn(e)?(G("port:history:server-backed"),Bi(t,Se(e).history(e))):(G("port:history:integrator"),t):(G("port:history:rest (порт не зарегистрирован)"),Se(e).history(e))}function Yi(e){const t=Fi(e);return t?Cn(e)?(G("port:block-history:server-backed"),Bi(t,Se(e).blockHistory(e))):(G("port:block-history:integrator"),t):(G("port:block-history:rest (порт не зарегистрирован)"),Se(e).blockHistory(e))}function Ol(e){return Fi(e)!==void 0||ki(e)}function Cn(e){return pi(e)}function xl({email:e,patch:t,serverId:n,key:r},i,o){const s=[];e?s.push({id:"rest",load:()=>Pi(e),required:!0}):n&&s.push(rl(Ki(i),n)),t&&s.push({id:"plugin",load:()=>Ri(t)});const d=he(r);return ba(n)&&(d?Ol(i):Dl(i))&&s.push(_l({port:d?Yi(i):Wi(i),revisionServiceEnabled:pi(i),...!d&&ua(i)?{isHistoryAvailable:()=>fa(i)}:{},emailId:n,readShownContent:()=>o.readShownContent(),onFacts:l=>o.publishRecoveryFacts(l)})),s}function Y(e){return e.getOrCreateInstance(We,()=>new Ye)}var Xi=new WeakMap,en=new WeakMap;function ue(e){return Xi.get(e)??0}function Ji(e,t){let n=en.get(e);return n||(n=new Set,en.set(e,n)),n.add(t),()=>{n?.delete(t)}}function Ll(e){Xi.set(e,ue(e)+1),en.get(e)?.forEach(t=>t())}function Ml(e){const t=ve(e),n=Y(e).addListener(M.APPLICATION_HAS_AMP,r=>{je(t)?.mutate({attributes:{isAmp:r}},{source:"remote"})});e.getInstance(k)?.addDispose(()=>n.dispose())}function kl(e){return e.size>0&&(e.type===""||e.type.startsWith("image/"))}function Nl(e){const t=e.fetchImpl??((o,s)=>fetch(o,s)),n=e.pageHost??(()=>window.location.hostname),r=new Set,i=o=>{try{const s=new URL(o,window.location.href);return s.protocol!=="https:"&&s.protocol!=="http:"?!1:s.hostname===n()||e.sourceHosts().includes(s.hostname)}catch{return!1}};return{accepts:i,async load(o){if(!i(o))return;const s=!r.has(o);r.add(o);try{const d=await t(o,{mode:"cors",credentials:"omit",cache:s?"no-cache":"default"});if(!d.ok)return;const l=await d.blob();return kl(l)?l:void 0}catch{return}}}}var _e={maxBytes:67108864,maxImageBytes:4194304,ttlMs:18e5};function Fl(e){const t={maxBytes:e.maxBytes??_e.maxBytes,maxImageBytes:e.maxImageBytes??_e.maxImageBytes,ttlMs:e.ttlMs??_e.ttlMs},n=e.now??(()=>Date.now()),r=new Map,i=new Map,o={hits:0,loads:0,failures:0};let s=0;const d=g=>{const b=r.get(g);b&&(s-=b.bytes,r.delete(g))},l=g=>t.ttlMs<=0||n()-g.storedAt<t.ttlMs,f=()=>{if(s<=t.maxBytes)return;const g=[...r.entries()].sort((b,E)=>b[1].usedAt-E[1].usedAt);for(const[b]of g){if(s<=t.maxBytes)return;d(b)}},u=(g,b)=>{b.size>t.maxImageBytes||(r.set(g,{blob:b,bytes:b.size,storedAt:n(),usedAt:n()}),s+=b.size,f())};return{async get(g){const b=r.get(g);if(b&&l(b))return b.usedAt=n(),o.hits+=1,b.blob;b&&d(g);const E=i.get(g);if(E!==void 0)return E;o.loads+=1;const I=(async()=>{try{const v=await e.load(g);return v?u(g,v):o.failures+=1,v}catch{o.failures+=1;return}finally{i.delete(g)}})();return i.set(g,I),I},forget(g){d(g),i.delete(g)},clear(){r.clear(),i.clear(),s=0},stats(){return{entries:r.size,bytes:s,...o}}}}var jl=["emcdn.ru","scr.emcdn.ru"];function Bl(e){const t=String(e??"").trim();if(!t)return"";try{return new URL(t.includes("//")?t:`https://${t}`).hostname}catch{return t.split("/")[0].split(":")[0]}}function Ul(e,t){const n=(r,i)=>{const o=new Set(i?t:[]);for(const s of r){const d=Bl(s);d&&o.add(d)}return[...o]};return e?Array.isArray(e)?n(e,!0):n(e.value??[],e.replace!==!0):[...t]}function or(e){const t=e??{},n=t.isPlugin!==!0?jl:[],r=t.canvasImageCache;if(r===!1)return{enabled:!1,sourceHosts:[],..._e};const i=r===!0||r===void 0?{}:r;return{enabled:i.enabled!==!1,sourceHosts:Ul(i.sourceHosts,n),maxBytes:i.maxBytes??_e.maxBytes,maxImageBytes:i.maxImageBytes??_e.maxImageBytes,ttlMs:i.ttlMs??_e.ttlMs}}function Hl(e){const t=Y(e),n=e.getInstance(we);let r=or(n?.get());const i=Nl({sourceHosts:()=>r.sourceHosts}),o=Fl({load:I=>i.load(I),maxBytes:r.maxBytes,maxImageBytes:r.maxImageBytes,ttlMs:r.ttlMs}),s=()=>{t.send(M.SANDBOX_CANVAS_IMAGE_CACHE_SETUP,{enabled:r.enabled,sourceHosts:[...r.sourceHosts]})},d=t.onInit(()=>s()),l=n?.watch(()=>{const I=or(n.get()),v=JSON.stringify(I)!==JSON.stringify(r);r=I,I.enabled||o.clear(),v&&t.isInited()&&s()}),f={asked:0,served:0,refused:0},u=[],g=(I,v)=>(f.refused+=1,u.push({url:I,reason:v}),u.length>20&&u.shift(),{refused:!0}),b=Object.assign(globalThis,{__emmCanvasImages__:()=>({settings:r,counters:{...f},refusals:[...u],store:o.stats()})}),E=t.addListenerAsync(M.APPLICATION_CANVAS_IMAGE_GET,async I=>{const v=I?.url??"";if(f.asked+=1,!r.enabled||!v)return g(v,"disabled");if(!i.accepts(v))return g(v,"host");I.fresh&&o.forget(v);const y=await o.get(v);return y?(f.served+=1,{blob:y}):g(v,"load-failed")});e.getInstance(k)?.addDispose(()=>{d.dispose(),l?.dispose(),E.dispose(),o.clear(),delete b.__emmCanvasImages__})}var Gl=2e3;function ql(e){const t=Y(e),n=new Set,r=()=>{const s=t.getTarget();if(!s||t.hasPort(s))return;const d=new MessageChannel;let l=!1;const f=g=>{g.data?.operationId==="em:port-ready"&&(l=!0,d.port1.removeEventListener("message",f),t.drainWindow(s))};d.port1.addEventListener("message",f),t.sendPort(s,d.port2),t.usePort(d.port1,!1,s);const u=setTimeout(()=>{n.delete(u),!l&&(yt(new Error("canvas port did not come up, staying on window messaging"),{origin:"canvas-channel"}),d.port1.removeEventListener("message",f),t.useWindow(s))},Gl);n.add(u)},i=Object.assign(globalThis,{__emmCanvasPort__:()=>{const s=t.getTarget();return{usesPort:t.usesPort,windowDrained:s?t.isWindowDrained(s):!1}}}),o=t.onInit(()=>r());e.getInstance(k)?.addDispose(()=>{for(const s of n)clearTimeout(s);o.dispose(),delete i.__emmCanvasPort__})}var $l=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function zl(e){return $l.test(e)||e.indexOf("//")===0}function rt(e){return e&&(e.endsWith("/")?e:`${e}/`)}function Vl(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:""}function sr(e,t){const n=e==null||e===""?"./":String(e);if(zl(n))return rt(n);const r=t??Vl();if(!r)return rt(n);try{return rt(new URL(n,r).href)}catch{return rt(n)}}function Kl(){return typeof window.__emailmaker__<"u"&&window.__emailmaker__?.publicPath?sr(window.__emailmaker__.publicPath):sr("/")}var Wl=()=>"",Yl=()=>"fc1d4d9a";function Qi(e){const t=e?"iframe-eblock":"iframe",n=Wl();if(n){const o=n.replace(/\/?$/,"/");return Vn(`${o}${t}.html`,qe())}const r=Yl(),i=`${Kl().replace(/\/?$/,"/")}iframe/`;return Vn(`${i}${t}${r?`.${r}`:""}.html`,qe())}var ar="allow-top-navigation allow-scripts allow-popups allow-popups-to-escape-sandbox";function tn(e){return/^file:/i.test(String(e||"").trim())}function Xl(e){return tn(e)?`${ar} allow-same-origin`:ar}var Jl="em:module-body-ack";function Ql(e,t,n){try{const r=new URL("./",new URL(t,n)).href,i=new URL(e,r).href;return i.startsWith(r)?i:void 0}catch{return}}function Pn(e){const t=e.split(/[?#]/)[0].split("/").pop()??"",n=/^(.+?)(?:\.[0-9a-f]{6,})?\.html$/.exec(t);return n?`js/${n[1]}.body.js`:void 0}function Zl(e,t){const n=Pn(t)?.replace(/^js\/|\.body\.js$/g,""),r=n?e[`${n}.html`]:void 0;return r?(r.imports??[]).map(i=>e[i]?.file).filter(i=>!!i):[]}function ed(e,t){const n=Pn(t)?.replace(/\.body\.js$/,".js");if(!n||!(n in e))return[];const r=new Set([n]),i=[n],o=[];for(;i.length>0;)for(const s of e[i.shift()]??[])r.has(s)||(r.add(s),o.push(s),i.push(s));return o}async function td(e){try{const t=await fetch(e);return t.ok?await t.blob():void 0}catch{return}}function nd(e){const t=new Map,n=r=>{const i=Ql(r,e.canvasSrc,e.origin);if(!i)return;const o=t.get(i);if(o!==void 0)return o;const s=e.fetchBody(i);return t.set(i,s),s};return{take(r){return n(r)??Promise.resolve(void 0)},warm(r){for(const i of r)n(i)},reset(){t.clear()},get size(){return t.size}}}async function rd(e,t,n){try{const r=new URL(".vite/manifest.json",new URL("./",new URL(e,t))).href,i=await fetch(r);if(!i.ok)return;const o=await i.json();n(Zl(o,e))}catch{}}function id(e){try{return tn(new URL(e,window.location.href).href)}catch{return tn(window.location.href)}}function od(e){Y(e);const t=Qi(!1);if(id(t))return;const n=nd({canvasSrc:t,origin:window.location.href,fetchBody:td}),r=Pn(t);r&&n.warm([r]);const i={"js/iframe-eblock.js":["js/discussHandlers.DPWv0hV2.js","js/typograf.all.B0pVhMV_.js"],"js/iframe.js":["js/rolldown-runtime.qcwTIabA.js","js/discussHandlers.DPWv0hV2.js"],"js/darkreader.CLd5EML2.js":[],"js/discussHandlers.DPWv0hV2.js":["js/rolldown-runtime.qcwTIabA.js"],"js/rolldown-runtime.qcwTIabA.js":[],"js/rules.CnnzdMsj.js":[],"js/typograf.all.B0pVhMV_.js":["js/rolldown-runtime.qcwTIabA.js"]};i?n.warm(ed(i,t)):rd(t,window.location.href,s=>n.warm(s));const o=s=>{const d=s.data;if(!d||d.operationId!=="em:module-body"||!d.result)return;const l=s.source;l&&(l.postMessage({operationId:Jl,for:d.result},"*"),n.take(d.data?.url??"").then(f=>{l.postMessage({operationId:d.result,data:f??null},"*")}))};window.addEventListener("message",o),e.getInstance(k)?.addDispose(()=>{window.removeEventListener("message",o),n.reset()})}var Ae=/<script\b(?=[^>]*(?:\bbis_use(?:=|\s)|\bdata-bis-config(?:=|\s)|\bdata-dynamic-id(?:=|\s)|local\.adguard\.org|(?:chrome-extension|moz-extension|safari-extension):\/\/))[^>]*>[\s\S]*?<\/script>/gi,sd=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,Oe=/<style\b[^>]*>[\s\S]*?<\/style>/gi,lr=/display:\s*none\s*!important/gi,ad=/((?:html\s*,\s*body|body\s*,\s*html)\s*\{)([^}]*)(\})/gi,ld=/\s*height\s*:\s*100%\s*!important\s*;?/gi,dd=/height\s*:\s*100%\s*!important/i,cd=[".socialshare,",".advertisment,",".adHolder,",".adsbygoogle-noablate","#ab_adblock","#popmechanic-snippet","filter_ads_by_classname","clever-core-ads","--gn-ov-ad-height","pub_728x90.text-ad.textAd","html-load.com/player","content-loader.com/player",".adblock","#advblock","body { overflow: visible!important; }"];function ud(e){return lr.lastIndex=0,(e.match(lr)||[]).length}function Zi(e){const t=e.trim(),n=ud(t);if(n===0)return!1;if(t.includes(".advertisment,")&&t.includes(".adHolder,")&&(t.includes(".socialshare,")||n>=3||t.length>2e3))return!0;const r=cd.filter(i=>t.includes(i)).length;return r>=1&&(n>=3||t.length>2e3)||n>=5&&r>=1?!0:n>=20&&/\b(?:\.ad(?:s|vert|vertisment|Holder|banner|box|Container|Wrapper)?[,{]|#ad[-_]|ins\.adsbygoogle)/i.test(t)}function fd(e){Oe.lastIndex=0;for(const t of e.matchAll(Oe))if(Zi(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function pd(e){let t=!1;return Oe.lastIndex=0,{html:e.replace(Oe,n=>Zi(n.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):n),found:t}}function md(e){return Ae.lastIndex=0,Ae.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||fd(e)}function hd(e){if(!md(e))return{html:e,found:!1};let t=!1,n=e;Ae.lastIndex=0,Ae.test(n)&&(Ae.lastIndex=0,n=n.replace(Ae,""),t=!0),(/\sbis_[a-z0-9_-]+\s*=/.test(n)||/\sdata-bis-config\s*=/.test(n))&&(n=n.replace(sd,""),t=!0);const r=pd(n);return n=r.html,t=t||r.found,{html:n,found:t}}function gd(e){return!e||!dd.test(e)?e:(Oe.lastIndex=0,e.replace(Oe,t=>t.replace(ad,(n,r,i,o)=>`${r}${i.replace(ld,"")}${o}`)))}function eo(e){const t=hd(e.replaceAll(`\r
1002
1002
  `,`
1003
1003
  `));return{html:gd(t.html),hasBrowserExtensionArtifacts:t.found}}function nn(e){return e?.getContent()??""}function to(e,t){e?.mutate({content:Ti(t)},{source:"remote"})}function no(e){return O(e)}function ie(e,t){return e.getOrCreateInstance(t,()=>new pe)}function V(e,t){return e.getOrCreateInstance(t,()=>new pe).event}function rn(e,t,n,r){return{html:e,guid:t,...Object.keys(n).length>0?{templateDirectivesPolicy:n}:{},...r!==void 0?{rev:r}:{}}}var vd=class extends Error{showId;constructor(e,t){super(`[emailmaker] show() timed out after ${t}ms waiting for editor init (showId=${e}). Check earlier console errors: wrong host-plugin publicPath (chunks return HTML), mount element removed without destroy(), or sandbox init never completed. Search for [show-pipeline] and [AMD] messages.`),this.name="ShowPipelineTimeoutError",this.showId=e}},bd=class{_activeRequest=null;_pending=new Map;_listeners=new Set;getActiveShowRequest(){return this._activeRequest}onShowRequested(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}requestShow(e,t,n){return this._rejectPending(te("Superseded by newer show()")),n.aborted?Promise.reject(te(n.reason)):(this._activeRequest=e,new Promise((r,i)=>{const o=setTimeout(()=>{this._settle(e.showId,()=>{i(new vd(e.showId,t))})},t);o.unref?.();const s=()=>{this._settle(e.showId,()=>{i(te(n.reason))})};n.addEventListener("abort",s,{once:!0});const d=()=>{clearTimeout(o),n.removeEventListener("abort",s)};this._pending.set(e.showId,{request:e,resolve:r,reject:i,timeoutId:o,dispose:d});for(const l of this._listeners)l(e)}))}completeShow(e){this._settle(e,t=>{t.resolve()})}hasPendingShow(e){return this._pending.has(e)}failShow(e,t){this._settle(e,n=>{n.reject(t)})}rejectAll(e){this._rejectPending(e),this._activeRequest=null}_settle(e,t){const n=this._pending.get(e);n&&(n.dispose(),this._pending.delete(e),this._activeRequest?.showId===e&&(this._activeRequest=null),t(n))}_rejectPending(e){for(const[,t]of this._pending)t.dispose(),t.reject(e);this._pending.clear()}};function Ed(e,t){return{contentReady:t.contentReady??e?.contentReady,sandboxReady:t.sandboxReady??e?.sandboxReady,sandbox:t.sandbox?{...e?.sandbox,...t.sandbox}:e?.sandbox}}function yd(e){if(!e||!(e.contentReady!==void 0||e.sandboxReady!==void 0||e.sandbox!==void 0))return;const t=Ei(e),n=yi(e),r=ma(e.sandbox);t<n+r}var ro=class{_controller=new AbortController;_externalSignalDisposable=new Q;_sessionChangeListeners=new Set;_showRegistry=new bd;_timeouts;_generation=0;_sessionStarted=!1;get signal(){return this._controller.signal}get generation(){return this._generation}get contentReadyTimeoutMs(){return Ei(this._timeouts)}getSandboxTimeoutMs(e){return bi(e,this._timeouts?.sandbox)}getSandboxReadyTimeoutMs(){return yi(this._timeouts)}bumpGeneration(){this._generation+=1}getActiveShowRequest(){return this._showRegistry.getActiveShowRequest()}onShowRequested(e){return this._showRegistry.onShowRequested(e)}requestShow(e){return this._showRegistry.requestShow(e,this.contentReadyTimeoutMs,this._controller.signal)}completeShow(e){this._showRegistry.completeShow(e)}hasPendingShow(e){return this._showRegistry.hasPendingShow(e)}failShow(e,t){this._showRegistry.failShow(e,t)}rejectAllPendingShows(e){this._showRegistry.rejectAll(e)}onSessionReplaced(e){return this._sessionChangeListeners.add(e),()=>{this._sessionChangeListeners.delete(e)}}configure(e){e.timeouts!==void 0&&(this._timeouts=Ed(this._timeouts,e.timeouts),yd(this._timeouts));const t=e.replaceSession===!0||!this._sessionStarted||e.timeouts!==void 0||e.signal!==void 0;this._sessionStarted=!0,t&&(this._replaceSessionController(),this.bumpGeneration()),(e.signal!==void 0||t)&&this._linkExternalSignal(e.signal)}abort(e){const t=e??te("Editor instance destroyed");this._showRegistry.rejectAll(t),this._controller.signal.aborted||(this._controller.abort(t),this.bumpGeneration()),this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new Q}_replaceSessionController(){this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new Q,this._showRegistry.rejectAll(te("Init session replaced")),this._controller.signal.aborted||this._controller.abort(te("Init session replaced")),this._controller=new AbortController,this._emitSessionReplaced()}_emitSessionReplaced(){for(const e of this._sessionChangeListeners)e()}_linkExternalSignal(e){if(!e)return;if(e.aborted){this._controller.signal.aborted||(this._controller.abort(e.reason??te()),this.bumpGeneration());return}const t=()=>{this._controller.signal.aborted||(this._controller.abort(e.reason??te()),this.bumpGeneration())};e.addEventListener("abort",t),this._externalSignalDisposable.addDispose(()=>{e.removeEventListener("abort",t)})}},Rn=(()=>{const e=new ro;return e.configure({}),e})(),_d=class extends Error{label;timeoutMs;constructor(e){super(`[sandbox:ready] iframe handshake timed out after ${e}ms`),this.name="SandboxReadyTimeoutError",this.label="sandbox:ready",this.timeoutMs=e}};function wd(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.isInited=="function"&&typeof t.getTarget=="function"&&typeof t.onInit=="function"}function Sd(e,t,n){return e.isInited()&&e.getTarget()?Promise.resolve():($(n),new Promise((r,i)=>{let o=!1,s,d;const l=u=>{o||(o=!0,s!==void 0&&(clearTimeout(s),s=void 0),d?.dispose(),n?.removeEventListener("abort",f),u())},f=()=>{l(()=>i(te(n?.reason)))};if(d=e.onInit(()=>{e.isInited()&&e.getTarget()&&l(()=>r())}),e.isInited()&&e.getTarget()){l(()=>r());return}t>0&&(s=setTimeout(()=>{l(()=>i(new _d(t)))},t)),n?.addEventListener("abort",f)}))}var Id=class extends Error{label;timeoutMs;constructor(e,t){super(`[${e}] timed out after ${t}ms`),this.name="OperationTimeoutError",this.label=e,this.timeoutMs=t}};function Td(e,t,n){return t<=0?e:new Promise((r,i)=>{let o=!1,s;const d=l=>{o||(o=!0,s!==void 0&&(clearTimeout(s),s=void 0),l())};s=setTimeout(()=>{d(()=>i(new Id(n,t)))},t),e.then(l=>{d(()=>r(l))},l=>{d(()=>i(l))})})}var Ad=2,it=Symbol("sandbox:frame-replaced");function ae(e,t,n,r,i,o,s){const d=`sandbox:${t}`,l=o?.getSandboxTimeoutMs(t)??In[t],f=()=>{let I=Td(e.sendAsync(n,r),l,d);return I=yn(I,o?.signal),Ue(d,I,i)};if(t==="INIT_START"&&wd(e)){const I=o?.getSandboxReadyTimeoutMs()??2e4,v=e,y=w=>{const S=Sd(v,I,o?.signal);return Ue("sandbox:INIT_START:ready-wait",S,i).then(()=>{if(!s||w<=0)return f();const A=s.getGeneration();let m;const c=new Promise((p,h)=>{m=s.onChange(()=>{s.getGeneration()!==A&&h(it)})}),a=f();return a.catch(()=>{}),Promise.race([a,c]).finally(()=>m?.()).catch(p=>{if(p!==it)throw p;return{...i},y(w-1)})})};return y(Ad)}if(!s)return f();const u=s.getGeneration();let g;const b=new Promise((I,v)=>{g=s.onChange(()=>{s.getGeneration()!==u&&v(it)})}),E=f();return E.catch(()=>{}),Promise.race([E,b]).finally(()=>g?.()).catch(I=>{throw I===it&&{...i},I})}var Cd=[["brace-percent",/<!--\{%/],["brace-hash",/<!--\{#/],["proscript",/<!--\[%/],["getresponse",/<!--\[\[(?:if|else\]\]|endif\]\])/i],["mailchimp",/<!--\*\|/],["expert-sender",/<!--<\/?(?:if|else|var)/i]],Pd=200;function Rd(e=new Set){const t=new Set;return(n,r)=>{if(!Cd.some(([o,s])=>!e.has(o)&&s.test(n)))return;const i=r??`new:${n.length}:${n.slice(0,200)}`;t.has(i)||(t.size>=Pd&&t.clear(),t.add(i))}}function Dd(){return{isConfigured:()=>!1,toEditorForm:e=>e,toOutputForm:e=>e,keepWrappedOnOutput:new Set,editorPolicy:{},warnAboutUnconfiguredInput:Rd()}}var Od=Dd();function ke(e){return e?.getInstance(ws)??Od}function xd(e){const t=ve(e),n=Y(e),r=()=>e.getInstance(De)??Rn;let i,o,s=!1,d=!1;const l=async(S,A,m)=>{const c=m.generation,a=()=>m.generation!==c||m.signal.aborted||t.current()!==S||d,p=ue(n);s=!0;try{if(await ae(n,"INIT_START",M.SANDBOX_INIT_START,{guid:A},void 0,m),a())return;const{html:h,hasBrowserExtensionArtifacts:_}=eo(nn(S));if(_&&ie(e,F.ON_BROWSER_EXTENSION_DETECTED_ID).fire(),to(S,h),await ae(n,"SET_ENTITY",M.SANDBOX_SET_ENTITY,rn(nn(S),A,ke(e).editorPolicy,S.get().version),void 0,m),a())return;await ae(n,"INITED",M.SANDBOX_INITED,{guid:A},void 0,m),i=A,o=p}finally{s=!1}},f=()=>he(t.sessionKey())?t.current():void 0,u=()=>{if(d||s)return;const S=f(),A=S?.get().docId;if(!S||!A||i===A&&o===ue(n)||!S.isReady())return;const m=r();m.signal.aborted||l(S,A,m).catch(()=>{})};let g=!1;const b=()=>{g||d||(g=!0,queueMicrotask(()=>{g=!1,u()}))};let E,I;const v=()=>{const S=f(),A=S?.get().docId;A!==I&&(E?.(),I=A,E=S?.subscribe(b)),b()},y=t.subscribe(v),w=Ji(n,b);v(),e.getInstance(k)?.addDispose(()=>{d=!0,w(),E?.(),y()})}var Ld=200;function Md({startVersion:e,limit:t=Ld}){let n=[],r=e;const i=o=>{n=n.filter(s=>s.version>o),r=Math.max(r,o)};return{record(o){!o.changes?.length&&!o.contentReplaced||(n.push(o),n.length>t&&i(n[n.length-t-1].version))},rebase(o,s){if(s<r)return null;const d=n.filter(f=>f.version>s);i(s);let l=o;for(const f of d){if(f.fromCanvas||f.contentReplaced||!f.changes)return null;const u=f.changes,g=[];for(const b of l){const E=Ta(b.range,u,"after");if(!E)return null;g.push({range:E,text:b.text})}l=g}return l}}}function kd(e,t){let n=0;return e.map(({start:r,end:i,text:o})=>{const s=new re(r,t.slice(r,i),r+n,o);return n+=o.length-(i-r),s})}function Nd(e,t){const n=[...e].sort((r,i)=>r.range.start-i.range.start);return kd(n.map(({range:r,text:i})=>({start:r.start,end:r.end,text:i})),t)}function Fd(e){return[...e].sort((t,n)=>n.oldPosition-t.oldPosition).map(t=>({range:{start:t.oldPosition,end:t.oldEnd},text:t.newText}))}var Dn=O("canvas.sandboxFill");function io(e){return e.getInstance(Dn)?.pipeline.isEventsLocked()===!0}function Ot(e){yt(e,{origin:"canvas-channel"})}function jd(e){const t=ve(e),n=Y(e);let r;const i=(l,f)=>{const u=l.get().docId;let g=!1,b=null,E=null;const I=Md({startVersion:l.get().version});let v=l.getContent();const y=async(c,a)=>{if(E){E.push({edits:c,rev:a});return}E=[{edits:c,rev:a}];try{do{const p=E.splice(0,E.length);await n.sendAsync(M.SANDBOX_UPDATE_ENTITY,{edits:p.map(h=>h.edits),guid:u,rev:p[p.length-1].rev})}while(E.length)}finally{E=null}},w=(c,a)=>{const p=E?.splice(0,E.length)??[];p.length&&n.sendAsync(M.SANDBOX_UPDATE_ENTITY,{edits:p.map(h=>h.edits),guid:u,rev:p[p.length-1].rev}).catch(Ot),n.sendAsync(M.SANDBOX_UPDATE_ENTITY,{edits:[c],guid:u,rev:l.get().version,...a!==null?{changeId:a}:{}}).catch(Ot)},S=c=>{const{guid:a,pushUndoStop:p}=c;if(a!==u)return;const h=Na(c);let{edits:_}=c;if(h.baseRev!==null){const R=I.rebase(_,h.baseRev);if(!R){yt(new Error("canvas batch conflicts with newer document changes"),{origin:"canvas-channel"}),w([],h.changeId);return}_=R}const T=l.get().version;try{g=!0,b=h.changeId;const R=Nd(_,l.getContent());p===!1?f.applyWithoutHistory(R):l.mutate({changes:R},{source:io(e)?"system":"user"})}finally{g=!1,b=null}l.get().version===T&&h.baseRev!==null&&w([],h.changeId)},A=l.subscribe(({changes:c,version:a})=>{const p=l.getContent(),h=!c?.length&&p!==v;if(v=p,I.record({version:a,changes:c,contentReplaced:h,fromCanvas:g}),!c?.length)return;const _=Fd(c);g?w(_,b):y(_,a).catch(Ot)}),m=n.addListener(M.APPLICATION_UPDATE_ENTITY,S);return()=>{A(),m.dispose()}};let o;const s=()=>{const l=t.current(),f=t.history(),u=l?.get().docId;u!==o&&(r?.(),r=void 0,o=u,l&&f&&(r=i(l,f)))},d=t.subscribe(s);s(),e.getInstance(k)?.addDispose(()=>{r?.(),d()})}var Bd=300,Ud=15e3,dr="em-canvas-busy-style";function Hd(){if(document.getElementById(dr))return;const e=document.createElement("style");e.id=dr,e.textContent="@keyframes em-canvas-busy-spin{to{transform:rotate(360deg)}}",document.head.appendChild(e)}function Gd(e){const t=e.getBoundingClientRect(),n=document.createElement("div");return n.setAttribute("aria-busy","true"),Object.assign(n.style,{position:"fixed",left:`${t.left}px`,top:`${t.top}px`,width:`${t.width}px`,height:`${t.height}px`,cursor:"progress",display:"flex",alignItems:"center",justifyContent:"center"}),e.appendChild(n),{showSpinner(){Hd(),n.style.background="rgba(128, 128, 128, 0.15)";const r=document.createElement("div");Object.assign(r.style,{width:"32px",height:"32px",borderRadius:"50%",border:"3px solid rgba(128, 128, 128, 0.35)",borderTopColor:"rgba(80, 80, 80, 0.9)",animation:"em-canvas-busy-spin 0.8s linear infinite"}),n.appendChild(r)},remove:()=>n.remove()}}var qd=8e3;function $d(){return{element:document.createElement("iframe"),ready:()=>Promise.reject(new Error("[canvas] нет элемента монтирования")),reload:()=>Promise.resolve(),reloadQuietly:()=>Promise.resolve(),scrollBy:()=>{},shown:!1,whenShown:()=>Promise.resolve(),alignTo:()=>{},resize:()=>{},dispose:()=>{}}}var zd=e=>{for(let t=e?.parentElement??null;t;t=t.parentElement){const n=getComputedStyle(t).overflowY;if(n==="auto"||n==="scroll"||n==="hidden")return t}return null};function Vd(e,t,n,r,i){const o=n.readyTimeoutMs??qd,s=document.createElement("div");s.dataset.canvasHost=e,r&&(s.dataset.canvasPlace=r),s.style.position="fixed",s.style.overflow="hidden",s.style.visibility="hidden";const d=n.resolveSrc(e),l=document.createElement("iframe");l.setAttribute("sandbox",n.resolveSandbox(d)),l.setAttribute("allow","clipboard-read; clipboard-write"),l.setAttribute("title","Email content"),l.style.width="100%",l.style.border="0",l.style.display="block",l.style.minHeight="600px",l.src=d,s.appendChild(l),t.appendChild(s),n.mark?.("created"),i||n.onCreated?.(l);const f=new Q;let u=!1,g=!1,b,E,I,v;const y=()=>{clearTimeout(v),v=setTimeout(()=>{g||(g=!0,E?.(new Error(`[canvas] ${e}: документ не загрузился за ${o} мс`)))},o)},w=()=>u?(I=Promise.resolve(),g=!0,I):(g=!1,I=new Promise((x,U)=>{b=x,E=U}),y(),I),S=()=>{if(clearTimeout(v),u=!0,g){I=Promise.resolve();return}g=!0,n.mark?.("loaded"),b?.()};l.addEventListener("load",S),f.addDispose(()=>{clearTimeout(v),l.removeEventListener("load",S)});let A;const m=()=>{A??=n.bindResizer?.(l)};let c=null,a=null,p;const h=()=>{if(!c){s.style.visibility="hidden",l.removeAttribute("id");return}n.elementId&&(l.id=n.elementId);const x=c.getBoundingClientRect(),U=a?.isConnected?a:zd(c),B=U?U.getBoundingClientRect():null,W=B?Math.max(x.top,B.top):x.top,be=B?Math.min(x.bottom,B.bottom):x.bottom,Qe=Math.max(0,be-W);s.style.visibility=Qe>0?"visible":"hidden",s.style.left=`${x.left}px`,s.style.top=`${W}px`,s.style.width=`${x.width}px`,s.style.height=`${Qe}px`,l.style.transform=`translateY(${x.top-W}px)`};let _="",T="",R=0,N;const X=()=>{if(!c){N=void 0;return}N=window.requestAnimationFrame(X);const x=c.getBoundingClientRect(),U=a?.isConnected?a.getBoundingClientRect():void 0,B=`${Math.round(x.left)}:${Math.round(x.top)}:${Math.round(x.width)}:${Math.round(x.height)}:${U?`${Math.round(U.top)}:${Math.round(U.height)}`:"-"}`;B!==_&&(_=B,h());const W=l.getBoundingClientRect().height;W>0&&W!==R&&(R=W,c.style.height=`${W}px`);const be=getComputedStyle(c).pointerEvents;be!==T&&(T=be,s.style.pointerEvents=be)},P=()=>{N===void 0&&c&&(N=window.requestAnimationFrame(X))},D=()=>{N!==void 0&&(window.cancelAnimationFrame(N),N=void 0)},q=()=>h();let j=[];const K=(x,U)=>{if(a=U,x&&j.length>0){const B=j;j=[],B.forEach(W=>W())}if(x===c){h();return}if(p?.disconnect(),p=void 0,c&&c.style.removeProperty("height"),_="",R=0,T="",c=x,!x){D(),h();return}n.onShown?.(l);try{if(typeof ResizeObserver=="function"){const B=new ResizeObserver(h);typeof B.observe=="function"&&(p=B,p.observe(x))}}catch{p=void 0}h(),m(),P()};window.addEventListener("scroll",q,!0),window.addEventListener("resize",q),f.addDispose(()=>{p?.disconnect(),N!==void 0&&window.cancelAnimationFrame(N),window.removeEventListener("scroll",q,!0),window.removeEventListener("resize",q)});const de=x=>{u=!1,x&&n.onReload?.(l);let U;g||I===void 0?U=w():(y(),U=I);try{l.contentWindow?.location.reload()}catch{l.src=d}return U};return{element:l,ready(){return I??w()},reload:()=>de(!0),reloadQuietly:()=>de(!1),get shown(){return c!==null},whenShown(){return c!==null?Promise.resolve():new Promise(x=>{j.push(x)})},alignTo(x,U){K(x,U??null)},scrollBy(x,U){for(let B=c?.parentElement??null;B;B=B.parentElement){const W=getComputedStyle(B);if((W.overflowY==="auto"||W.overflowY==="scroll")&&B.scrollHeight>B.clientHeight){B.scrollTop+=U,B.scrollLeft+=x;return}}window.scrollBy(x,U)},resize(){A?.resize()},dispose(){K(null,null),A?.dispose(),f.dispose(),s.remove()}}}function Kd(e){const t=new Map;let n="a";const r=()=>n==="a"?"b":"a",i=(u,g)=>u==="email"?`email:${g??n}`:u;let o,s=[];const d=()=>{s.forEach(u=>clearTimeout(u)),s=[],o?.remove(),o=void 0},l=new Map,f=(u,g,b)=>{const E=i(u,g),I=t.get(E);if(I)return I;const v=e.resolveMount();if(!v)return $d();const y=Vd(u,v,e,u==="email"?g??n:void 0,b);return t.set(E,y),y};return{get:u=>f(u),current:u=>f(u),peek:u=>t.get(i(u)),spare:()=>t.get(i("email",r())),ensureSpare:()=>f("email",r(),!0),promote(){const u=t.get(i("email",r()));if(!u)return;const g=t.get(i("email"));n=r();const b=l.get("email");u.alignTo(b?.slot??null,b?.clip??null),g?.alignTo(null)},alignSurface(u,g,b){l.set(u,{slot:g,clip:b??null}),(g?f(u):t.get(i(u)))?.alignTo(g,b??null)},visible(){for(const u of t.values())if(u.shown)return u},byWindow(u){if(u){for(const g of t.values())if(g.element.contentWindow===u)return g}},busy(u){d();const g=u?e.resolveMount():void 0;if(!g)return;const b=Gd(g);o=b,s=[setTimeout(()=>b.showSpinner(),Bd),setTimeout(d,Ud)]},dispose(){d(),t.forEach(u=>u.dispose()),t.clear(),l.clear(),n="a"}}}var Wd=O("canvas.resizerBinder"),on=O("canvas.service"),Yd={created:J.canvasCreated,loaded:J.canvasLoaded};function Xd(e,t){if(e.getInstance(on))return;const n=Kd({resolveMount:()=>t.resolveMount(),resolveSrc:i=>t.resolveSrc(i),resolveSandbox:Xl,elementId:t.elementId,bindResizer:i=>e.getInstance(Wd)?.(i),onCreated:i=>ct(e,i,"fresh"),onReload:i=>ct(e,i,"fresh"),onShown:i=>ct(e,i,"switch"),mark:i=>t.mark?.(Yd[i])}),r=Y(e).addListener(M.SANDBOX_WHEEL,i=>{n.visible()?.scrollBy(i?.deltaX??0,i?.deltaY??0)});e.inject(on,n),e.getInstance(k)?.addDispose(()=>{r.dispose(),n.dispose()})}function ct(e,t,n){const r=Y(e),i=t.contentWindow;if(!i)return;const o=r.getTarget()===i;o&&n==="switch"||(n==="fresh"&&(r.forget(i),o&&r.setTarget(void 0)),r.setTarget(i),Ll(r))}function Jd(e,t){ct(e,t,"promote")}function Qd(e,t){const n=t.contentWindow;n&&Y(e).greet(n)}function Zd(e,t){const n=t.contentWindow;n&&Y(e).forget(n)}function fe(e){return e.getInstance(on)}function ec(e){const t=Y(e),n=()=>fe(e)?.byWindow(t.getTarget()),r=t.addListenerAsync(M.RELOAD,async()=>{await n()?.reload()}),i=t.addListener(s=>{s.data?.operation===M.SANDBOX_RESIZED&&n()?.resize()}),o=V(e,F.ON_EMAIL_INIT_ID)(()=>{n()?.resize()});e.getInstance(k)?.addDispose(()=>{r.dispose(),i.dispose(),o.dispose()})}var dh=O("HeadlessMode"),tc=O("HiddenMount");function nc(e){return e.getOrCreateInstance(tc,()=>Me(!1))}function cr(){const e=document.createElement("div");return e.dataset.canvasOffscreen="true",e.style.position="absolute",e.style.left="-10000px",e.style.top="-10000px",e.style.width="1600px",e.style.height="1000px",document.body.appendChild(e),e}function rc(e){const t=e.getInstance(oe);let n,r;e.getInstance(k)?.addDispose(()=>{r?.remove(),r=void 0}),Xd(e,{resolveMount:()=>n,resolveSrc:o=>Qi(o==="block"),elementId:"email_iframe",mark:o=>G(o)}),t?.watch(o=>{if(n)return;const s=o?.element;if(s instanceof HTMLElement)n=s;else if(o!==void 0)n=r??=cr();else return;fe(e)?.get("email")});let i;e.getInstance(k)?.addDispose(()=>{i?.remove(),i=void 0}),nc(e).watch(o=>{const s=fe(e);if(s){if(o){i??=cr(),s.alignSurface("email",i,i);return}i&&(s.alignSurface("email",null),i.remove(),i=void 0)}})}var oo=O("canvas.headerFlow"),ur=["subject","preheader"],ic=3e3,oc={subject:M.SANDBOX_SUBJECT_UPDATE,preheader:M.SANDBOX_PREHEADER_UPDATE};function sc(e){const t=ve(e),n=Y(e),r=v=>v?"remote":io(e)?"system":"user",i=(v,{guid:y,value:w,forced:S})=>{const A=je(t);if(!A||typeof w!="string"||y&&y!==A.get().docId)return;const m=t.forcedHeaders();if(m?.[v]&&!S&&w!==m[v])return;S&&t.endForcedHeaders();const c=A.get().attributes[v]??"";d=!0;try{ht(A,{[v]:w},{source:r(S)})}finally{d=!1}o[v]=w,ie(e,F.ON_HEADER_APPLIED_ID).fire({field:v,value:w,forced:!!S,isGenerated:w!==c&&!!w})};let o={},s,d=!1,l=Promise.resolve();const f=(v,y,w)=>{l=n.sendAsync(oc[v],{value:y,guid:je(t)?.get().docId,...w?{force:!0,echo:!0}:{}}).catch(S=>{})};let u;e.inject(oo,{whenDelivered:async()=>{await l},reassert:v=>{const y=je(t),w=ur.filter(S=>v[S]);if(!(!y||w.length===0)){d=!0;try{ht(y,Object.fromEntries(w.map(S=>[S,v[S]])),{source:"system"})}finally{d=!1}t.beginForcedHeaders({subject:v.subject??"",preheader:v.preheader??""}),clearTimeout(u),u=setTimeout(()=>t.endForcedHeaders(),ic);for(const S of w)o[S]=v[S],f(S,v[S],!0)}}});const g=()=>{s?.(),s=void 0;const v=je(t);if(!v){o={};return}const y=v.get().attributes;o={subject:y.subject,preheader:y.preheader},s=v.subscribe(({source:w})=>{if(d)return;const S=v.get().attributes,A=t.forcedHeaders();for(const m of ur){const c=S[m];c!==o[m]&&(o[m]=c,f(m,c??"",w==="system"&&A?.[m]!==void 0))}})};g();const b=t.subscribe(g),E=n.addListenerAsync(M.APPLICATION_SUBJECT_UPDATE,v=>i("subject",v)),I=n.addListenerAsync(M.APPLICATION_PREHEADER_UPDATE,v=>i("preheader",v));e.getInstance(k)?.addDispose(()=>{E.dispose(),I.dispose(),b(),s?.(),clearTimeout(u)})}function fr(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function sn(e,t){const n={...e};for(const r of Object.keys(t)){const i=t[r],o=e[r];fr(i)&&fr(o)?n[r]=sn(o,i):i!==void 0&&(n[r]=i)}return n}function ac(e,t){const n=vn;if(typeof e=="string"){const r=e.trim();if(r.startsWith("{"))try{const i=JSON.parse(r);if(i&&typeof i=="object"&&!Array.isArray(i)&&Object.keys(i).length>0)return sn(n,i)}catch{}}return t&&typeof t=="object"&&!Array.isArray(t)?sn(n,t):n}function lc(){const e=window.localStorage.getItem(bt.em_color_scheme),t=matchMedia("(prefers-color-scheme: dark)").matches?gs:Ds;return e&&e!=="system"?e:t}function dc(){const e=window.localStorage.getItem(bt.em_code_mode_settings);if(!e)return!1;try{const t=JSON.parse(e);return!!(t?.isCodeMode&&(t.codeModeDirection==="left"||t.codeModeDirection==="right"))}catch{return!1}}function cc(e){const{config:t}=e;return{operation:M.UPDATE_PREVIEW,theme:e.theme,commonStyles:ac(e.emailCommonStyles,e.defaultCommonStyles),pathEnabled:t.pathEnabled,copyPasteEnabled:t.copyPasteEnabled,saveBlockEnabled:t.saveBlockEnabled,editImageControlEnabled:t.editImageControlEnabled,codeMode:e.codeMode,elementAIimageEnabled:t.elementAIimageEnabled,imageCenterStockEnabled:t.imageCenterStockEnabled,imageCenterGifEnabled:t.imageCenterGifEnabled,imageCenterEditorEnabled:t.imageCenterEditorEnabled,blocksAddPanelEnabled:t.blocksAddPanelEnabled!==!1&&t.blocksSectionsShow!==!1,lockEditor:t.lockEditor,appName:e.appName}}function uc(e){const t=Y(e),n=e.getInstance(we),r=e.getInstance(oe),i=ve(e);let o,s="";const d=()=>{const w=n?.get()??{},S=cc({config:w,emailCommonStyles:i.current()?.get().attributes?.common_styles,defaultCommonStyles:o,theme:lc(),codeMode:dc(),appName:"emailmaker"}),A=JSON.stringify(S);A!==s&&(s=A,t.send(S))},l=t.onInit(()=>{s="",d()}),f=()=>{t.isInited()&&d()},u=n?.watch(f),g=r?.watch(w=>{o=w?.commonStyles,f()});let b;const E=()=>{b?.(),b=i.current()?.subscribe(f),f()};E();const I=i.subscribe(E),v=matchMedia(Es),y=()=>f();v.addEventListener("change",y),e.getInstance(k)?.addDispose(()=>{l.dispose(),u?.dispose(),g?.dispose(),b?.(),I(),v.removeEventListener("change",y)})}var an;(function(e){function t(i,o,s=(d,l)=>d===l){if(i===o)return!0;if(i.length!==o.length)return!1;for(let d=0;d<i.length;d++)if(!s(i[d],o[d]))return!1;return!0}e.isEqual=t;function n(i,o=s=>s){const s=new Set;return i.filter(d=>{const l=o(d);return s.has(l)?!1:(s.add(l),!0)})}e.unique=n;function r(i=[],o=[],s=(d,l)=>d===l){const d=[],l=[],f=[];for(const u of i){const g=o.find(b=>s(u,b));g?f.push({prev:u,next:g}):l.push(u)}for(const u of o)i.find(g=>s(u,g))||d.push(u);return{added:d,removed:l,exists:f}}e.diff=r})(an||(an={}));function fc(e,t){return e.type===t.type&&e.key===t.key}function pc(e){const t=Y(e),n=()=>e.getServices(Te)??[];let r=[];const i=t.onInit(()=>{r=n(),t.send(M.SANDBOX_ADD_EXTENSIONS,r)}),o=Ss(Te),s=e.onInject(d=>{if(d!==o)return;const l=n();if(!t.isInited()){r=l;return}const{added:f,removed:u}=an.diff(r,l,fc);if(r=l,u.length){if(u.some(g=>g.type==="script")){t.send(M.RELOAD);return}t.send(M.SANDBOX_REMOVE_EXTENSIONS,u.map(g=>g.key))}f.length&&t.send(M.SANDBOX_ADD_EXTENSIONS,f)});e.getInstance(k)?.addDispose(()=>{i.dispose(),s?.dispose()})}var mc=O("prewarm.editorVisible");function hc(e){if(typeof requestAnimationFrame!="function"){setTimeout(e,0);return}requestAnimationFrame(()=>requestAnimationFrame(e))}function gc(e={}){const t=e.paint??hc;let n=!1,r=!1,i=!1,o=!1,s=!1;const d=[],l=()=>{s||o||!n||!r||!i||(o=!0,t(()=>{s=!0,G(J.editorVisible);for(const f of d.splice(0))f()}))};return{noteShellVisible(){n=!0,l()},notePagePainted(){r=!0,l()},noteContentShown(){i=!0,l()},whenVisible(f){if(s){f();return}d.push(f)},contentShown:()=>i}}function vc(e){return e.getOrCreateInstance(mc,()=>gc())}var bc=500,Ec=500,yc=5e3;function _c(e){const t=e.quietMs??bc,n=e.floorMs??Ec,r=e.ceilingMs??yc;let i,o,s=0;const d=()=>{clearTimeout(i),clearTimeout(o),i=void 0,o=void 0},l=()=>{d(),e.run()},f=()=>{clearTimeout(i);const u=n-(Date.now()-s);i=setTimeout(l,Math.max(t,u))};return{start(){d(),s=Date.now(),o=setTimeout(l,r),f()},notify(){i!==void 0&&f()},cancel:d}}function wc({attributes:e,readContent:t,docId:n,hasSession:r,serverId:i,show:o}){if(!r)return;const s={id:i??void 0,renderGuid:n,showId:o?.id,isNew:i==null,showToken:o?.token},d={...e,...s};return Object.defineProperty(d,"html",{get:()=>t()??"",enumerable:!0,configurable:!0}),d}var so="self-init:";function Sc(e){return e.startsWith(so)}function ao(e,t){const n=e.getActiveShowRequest();return Sc(t)?n===null:n?.showId===t&&e.hasPendingShow(t)}function Ic(e){const t=()=>e.initPipeline(),n=e.messageService,r=()=>e.waitScope?.()??t();let i="";const o=()=>e.readDocument()?nn(e.readDocument()):i,s=()=>ke(e.container).editorPolicy,d=()=>e.readEmail(),l=()=>{const f=d();return{...f,id:e.isTemplate()||f.isNew?void 0:f.id,html:o()}};return{readContent:o,publicEmail:l,sendInitStart:()=>ae(n,"INIT_START",M.SANDBOX_INIT_START,{guid:d().renderGuid},void 0,r()),sendInited:()=>ae(n,"INITED",M.SANDBOX_INITED,{guid:d().renderGuid},void 0,r()),async sendContent(){const f=d(),{html:u,hasBrowserExtensionArtifacts:g}=eo(f?.html||"");g&&e.events.browserExtensionDetected(),to(e.readDocument(),u),i=u,await ae(n,"SET_ENTITY",M.SANDBOX_SET_ENTITY,rn(o(),f.renderGuid,s(),e.readDocument()?.get().version),{guid:f.renderGuid,emailId:f.id??null},r())},refreshContent:()=>ae(n,"SET_ENTITY",M.SANDBOX_SET_ENTITY,rn(o(),d().renderGuid,s(),e.readDocument()?.get().version),void 0,r()),sendPreheader:async()=>{const f=d();if(f.preheader!==void 0)return ae(n,"PREHEADER",M.SANDBOX_PREHEADER_UPDATE,{value:f.preheader,guid:f.renderGuid,force:!0},void 0,r())},sendSubject:async()=>{const f=d();if(f.subject!==void 0)return ae(n,"SUBJECT",M.SANDBOX_SUBJECT_UPDATE,{value:f.subject,guid:f.renderGuid,force:!0},void 0,r())},revealFilled:()=>e.revealFilled?.()??Promise.resolve(),showFilled:f=>e.showFilled?.(f),readTarget:()=>e.readTarget?.(),fireWillInit:()=>e.events.willInit(l()),fireInit(f,u){if(!ao(t(),f)){t().getActiveShowRequest()?.showId;return}const g=d();g.id,g.renderGuid,t().completeShow(f),ht(e.readDocument(),{is_inited:!0},{source:"system"});const b=l();return u&&(b.reset=!0),e.events.inited(b)},fireEmailChanged(){e.events.emailChanged(l())},fireContentChanged(){e.events.contentChanged(o())}}}function Tc(e){const t=()=>e.initPipeline();let n=!1,r,i,o,s=0,d;const l=Ic({...e,waitScope:()=>({getSandboxTimeoutMs:y=>t().getSandboxTimeoutMs(y),getSandboxReadyTimeoutMs:()=>t().getSandboxReadyTimeoutMs(),signal:d?.signal??t().signal})});let f;const u=(y,w)=>{if(f===y)return;f=y;const S=s;setTimeout(()=>{s!==S||t().signal.aborted||I(y,w).catch(()=>{})},0)},g=()=>{d?.abort(),d=void 0};let b;const E=()=>{const y=t().signal;y!==b&&(b?.removeEventListener("abort",g),b=y,y.addEventListener("abort",g))};async function I(y,w){const S=++s;g(),d=new AbortController,E();const A=()=>s!==S,m=l.readTarget(),c=t().generation,a=()=>c===t().generation&&!t().signal.aborted,p=w?"init:reset-":"init:";if(!w){const T=l.publicEmail();T?.id,T?.renderGuid,T?.preheader}let h=!1,_=!1;try{n=!0,await l.sendInitStart(),l.fireWillInit(),await(w?l.refreshContent():l.sendContent()),h=!0,w||l.publicEmail()?.id;try{await l.sendPreheader()}catch(T){`${p}`,String(T)}try{await l.sendSubject()}catch(T){`${p}`,String(T)}if(A()||l.showFilled(m),await l.sendInited(),_=!0,i===y){const T=e.readSandboxGeneration?.()??o;T!==void 0&&(r=T)}await l.revealFilled()}catch(T){throw A()||(`${p}`,{...e.describeSurface?.(),error:String(T)},void 0),!A()&&ao(t(),y)&&t().failShow(y,T),T}finally{v(y,w,p,{superseded:A(),sessionGeneration:c,contentApplied:h,sandboxInitedAcked:_,commit:a()})}}function v(y,w,S,A){const{superseded:m,contentApplied:c,sandboxInitedAcked:a}=A;if(m){`${S}`;return}a&&A.commit?l.fireInit(y,w||void 0):a?(`${S}`,A.sessionGeneration,t().generation,t().signal.aborted,void 0):c?(`${S}`,void 0):(`${S}`,void 0),n=!1,d=void 0,!a&&i===y&&(i=void 0,r===o&&(r=void 0)),!a&&c&&u(y,w)}return{channel:l,isEventsLocked:()=>n,filledGeneration:()=>r,markFilled:y=>{r=y},lastCorrelation:()=>i,markCorrelation:y=>{i=y},bumpRunSeq:()=>{s+=1},noteSandboxGeneration:y=>{o=y},fill:y=>I(y,!1),refill:y=>I(y,!0),stop:()=>{s+=1,g(),n=!1,b?.removeEventListener("abort",g),b=void 0}}}function Ac(e,t,n){if(!e?.renderGuid||!e.showId||e.showId!==t.showId)return!1;if(t.isNew)return e.id==null;const r=t.emailId??t.navId;return r!=null&&String(e.id??"")!==String(r)?!1:lo(e,n)}function lo(e,t){return t?e?.id==null?!1:String(e.id)===String(t):!0}function Cc(e){const{pipeline:t,readEmail:n,readDocument:r,readRouteEmailId:i,readSandboxGeneration:o}=e,s=u=>{const g=n(),b=i();if(!Ac(g,u,b)){u.showId,u.navId,u.emailId,g?.id,g?.showId,g?.renderGuid;return}u.showId,g?.id,g?.renderGuid,t.markFilled(o()),t.markCorrelation(u.showId),t.fill(u.showId).catch(()=>{})};return{showRequested:u=>{s(u)},showRequestIdentityChanged:()=>{const u=e.initPipeline().getActiveShowRequest();u&&s(u)},selfInitChanged:()=>{if(e.initPipeline().getActiveShowRequest())return;const u=o();if(t.filledGeneration()===u)return;const g=n(),b=i();if(!g?.renderGuid||!lo(g,b))return;const E=`${so}${g.renderGuid}`;t.markFilled(u),t.markCorrelation(E);const I=r()?.isReady()===!0;g.id,g.renderGuid,(I?v=>t.refill(v):v=>t.fill(v))(E).catch(()=>{t.lastCorrelation()===E&&t.markFilled(void 0)})},saasChanged:()=>{const u=n();u?.renderGuid,u?.showToken,u?.id}}}function Pc(e){return e??""}function Rc(e,t,n,r){return[e??"",t??"",n==null?"":String(n),r??""].join("|")}function Dc(e){const t=ve(e),n=Y(e),r=()=>he(t.sessionKey())?void 0:t.current(),i=()=>{const C=r();return wc({attributes:C?.get().attributes??{},readContent:()=>C?.getContent(),docId:C?.get().docId,hasSession:!!C,serverId:C?.get().serverId,show:t.showFacts()})},o=()=>e.getInstance(De)??Rn;let s={},d=!1;const l=e.getInstance(oe)?.watch(C=>{d=!!C?.element});let f=!1,u=!1,g=!1,b=0;const E=()=>{const C=fe(e);if(!C)return;const z=++b,H=C.spare();return H&&Zd(e,H.element),(H?H.reloadQuietly():C.ensureSpare()?.ready())?.then(()=>{if(z!==b)return;f=!0;const ne=C.spare();ne&&Qd(e,ne.element),g&&(g=!1,T(),K())})},I=_c({run:()=>{g||E()?.catch(()=>{})}}),v=()=>{vc(e).noteContentShown(),!f&&!g&&I.start()};let y=!1;const A=Tc({container:e,messageService:n,initPipeline:o,readDocument:r,readEmail:i,revealFilled:()=>{const C=fe(e);return y&&C&&(y=!1,I.start()),d?C?.current("email").whenShown()??Promise.resolve():Promise.resolve()},showFilled:C=>{const z=fe(e),H=z?.spare()?.element.contentWindow;u&&z&&H&&C===H&&(u=!1,z.promote(),z.busy(!1),y=!0)},readTarget:()=>n.getTarget(),isTemplate:()=>!!s.isTemplate,readSandboxGeneration:()=>ue(n),describeSurface:()=>({canvasPath:_,promoted:u,spareClean:f,handshake:n.isInited(),generation:ue(n)}),events:{willInit:C=>{ie(e,F.WILL_EMAIL_INIT_ID).fire(C)},inited:C=>{v(),ie(e,F.ON_EMAIL_INIT_ID).fire(C)},contentChanged:C=>{ie(e,F.ON_CONTENT_CHANGED_ID).fire(C)},emailChanged:C=>{ie(e,F.ON_EMAIL_CHANGED_ID).fire(C)},browserExtensionDetected:()=>{ie(e,F.ON_BROWSER_EXTENSION_DETECTED_ID).fire()}}}),m=Cc({pipeline:A,initPipeline:o,readEmail:i,readDocument:r,readRouteEmailId:()=>s.emailId,readSandboxGeneration:()=>ue(n)});let c="",a="",p="";const h=C=>C.length>0;let _="none";const T=()=>{const C=fe(e)?.spare();C&&(n.send({operation:M.SANDBOX_LOCK_EDIT,data:!0}),f=!1,u=!0,Jd(e,C.element))},R=(C,z)=>{const H=fe(e);if(!H)return!0;const ne=H.spare(),Ee=ne&&f?"spare":"prepare";if(_=Ee,H.busy(!0),ne&&f)return T(),!0;I.cancel(),n.send({operation:M.SANDBOX_LOCK_EDIT,data:!0});const ye=E();if(ye===void 0)return _="reload",H.busy(!1),H.peek("email")?.reload(),!0;g=!0;const Tt=b;return ye.catch(()=>{!g||Tt!==b||(g=!1,_="reload",H.busy(!1),H.peek("email")?.reload())}),!1},N=()=>{be(),A.noteSandboxGeneration(ue(n));const C=i(),z=Rc(C?.renderGuid,C?.showId,C?.id,s.emailId),H=Pc(C?.renderGuid);if(H!==a){const ye=h(a),Tt=a;a=H,ye&&R(Tt,H)}if(g)return;z!==c&&(c=z,m.showRequestIdentityChanged());const ne=r(),Ee=`${z}|${ne?.get().docId??""}|${ue(n)}`;Ee!==p&&ne?.isReady()===!0&&(p=Ee,m.selfInitChanged()),m.saasChanged(),q()};let X=!1,P="",D="";const q=()=>{const C=i();if(!C?.renderGuid)return;const z=A.channel.readContent(),H=JSON.stringify([C.preheader,C.common_styles,C.meta,C.subject,C.utm_parameters?.utm_campaign??"",C.utm_parameters?.utm_content??"",C.utm_parameters?.utm_medium??"",C.utm_parameters?.utm_source??"",C.utm_parameters?.utm_term??""]),ne=X&&z!==D,Ee=X&&H!==P;if(X=!0,D=z,P=H,A.isEventsLocked())return;const ye={...C,id:s.isTemplate||C.isNew?void 0:C.id,html:z};if(ne){ie(e,F.ON_CONTENT_CHANGED_ID).fire(z),ie(e,F.ON_EMAIL_CHANGED_ID).fire(ye);return}Ee&&C.is_inited&&ie(e,F.ON_EMAIL_CHANGED_ID).fire(ye)};let j=!1;const K=()=>{j||(j=!0,queueMicrotask(()=>{j=!1,N()}))};e.inject(Dn,{pipeline:A,setRoute:C=>{C.emailId===s.emailId&&!!C.isTemplate==!!s.isTemplate||(s=C,K())}});let de,x;const U=()=>{const C=r()?.get().docId;C!==x&&(de?.(),x=C,de=r()?.subscribe(K)),K()};let B,W;const be=()=>{const C=e.getInstance(De);!C||C===B||(W?.(),B=C,W=C.onShowRequested(z=>m.showRequested(z)))},Qe=n.addListener(C=>{C.data?.operation===M.SANDBOX_RESIZED&&I.notify()}),zo=t.subscribe(U),Vo=Ji(n,K);U(),e.getInstance(k)?.addDispose(()=>{l?.dispose(),W?.(),Vo(),zo(),de?.(),Qe.dispose(),I.cancel(),A.stop()})}function Oc(){return As!=="emailmaker"}var pr={config:{mode:"freeUserBlocks",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!0,styles:"",revisionService:!1,headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!0,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!0,webversionEnabled:!0,commonStylesEnabled:!0,emailResponsiveControlEnabled:!0,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!1,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!0,emailDropdownMenuClone:!0,emailDropdownMenuImport:!0,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportZipEnabled:!0,exportTextEnabled:!0,exportMarkdownEnabled:!0,exportClipboardEnabled:!0,exportWebHookEnabled:!0,exportOutlookEnabled:!0,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!0,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!0,aiAssistentEnabled:!0,optimizeEnabled:!0,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!0,annotationsEnabled:!1,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!0,tagsEnabled:!0,isTemplateEnabled:!0,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!0,deleteButtonEnabled:!0,toggleSidePanel:!0,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!0,formFieldImageTitleEnabled:!0,formFieldBorderEnabled:!0,formFieldBorderRadiusEnabled:!0,formFieldBoxShadowEnabled:!0,formFieldVisibilityEnabled:!0,formFieldExportAsPictureEnabled:!0,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!0,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!0,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!0,formCellFieldVerticalAlignEnabled:!0,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!0,formButtonFieldReplacerEnabled:!0,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!0,formImageFieldReplacerEnabled:!0,formImageFieldHeightEnabled:!0,formTextFieldTypografEnabled:!0,formTextFieldReplacerEnabled:!0,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!1,elementCountdownEnabled:!0,elementVideoEnabled:!0,elementAIimageEnabled:!0,elementAItextEnabled:!0,elementCarouselEnabled:!0,elementAccordionEnabled:!0,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!1,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!0,formFieldAmpVisibilityEnabled:!0,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4},project:void 0},co={config:{mode:"pro",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!0,styles:"",revisionService:!1,headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!0,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!0,webversionEnabled:!0,commonStylesEnabled:!0,emailResponsiveControlEnabled:!0,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!0,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!0,emailDropdownMenuClone:!0,emailDropdownMenuImport:!0,emailDropdownMenuImportButton:!1,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportZipEnabled:!0,exportTextEnabled:!0,exportMarkdownEnabled:!0,exportClipboardEnabled:!0,exportWebHookEnabled:!0,exportOutlookEnabled:!0,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!0,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!0,aiAssistentEnabled:!0,optimizeEnabled:!0,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!0,annotationsEnabled:!0,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!0,tagsEnabled:!0,isTemplateEnabled:!0,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!0,deleteButtonEnabled:!0,toggleSidePanel:!0,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!0,formFieldImageTitleEnabled:!0,formFieldBorderEnabled:!0,formFieldBorderRadiusEnabled:!0,formFieldBoxShadowEnabled:!0,formFieldVisibilityEnabled:!0,formFieldExportAsPictureEnabled:!0,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!0,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!0,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!0,formButtonFieldReplacerEnabled:!0,formCellFieldVerticalAlignEnabled:!0,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!0,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!0,formImageFieldReplacerEnabled:!0,formImageFieldHeightEnabled:!0,formTextFieldTypografEnabled:!0,formTextFieldReplacerEnabled:!0,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!0,elementCountdownEnabled:!0,elementVideoEnabled:!0,elementAIimageEnabled:!0,elementAItextEnabled:!0,elementCarouselEnabled:!0,elementAccordionEnabled:!0,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!0,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!0,formFieldAmpVisibilityEnabled:!0,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4,fileManager:{defaultFolderName:"",enableMoveFolder:!0,enableEdit:!0,enableTrash:!0,enableCopyFile:!0}},project:void 0,page:{isNew:!0,type:"email",project:0,id:"",showToken:0}},mr=co,xc=["pro"],uo={};function Lc(e){uo=e}var fo=e=>xc.includes(e)?mr:uo[e]??mr,ln={config:{mode:"simple",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!1,styles:"",headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!0,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!0,webversionEnabled:!1,commonStylesEnabled:!1,emailResponsiveControlEnabled:!1,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!1,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!0,emailDropdownMenuClone:!0,emailDropdownMenuImport:!0,emailDropdownMenuImportButton:!1,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportZipEnabled:!0,exportTextEnabled:!0,exportMarkdownEnabled:!0,exportClipboardEnabled:!0,exportWebHookEnabled:!0,exportOutlookEnabled:!1,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!0,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!0,aiAssistentEnabled:!0,optimizeEnabled:!0,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!1,annotationsEnabled:!1,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!0,tagsEnabled:!0,isTemplateEnabled:!0,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!0,deleteButtonEnabled:!0,toggleSidePanel:!0,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!0,formFieldImageTitleEnabled:!0,formFieldBorderEnabled:!1,formFieldBorderRadiusEnabled:!1,formFieldBoxShadowEnabled:!1,formFieldVisibilityEnabled:!1,formFieldExportAsPictureEnabled:!1,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!0,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!0,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!0,formButtonFieldReplacerEnabled:!1,formCellFieldVerticalAlignEnabled:!0,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!1,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!1,formImageFieldReplacerEnabled:!1,formImageFieldHeightEnabled:!1,formTextFieldTypografEnabled:!1,formTextFieldReplacerEnabled:!1,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!1,elementCountdownEnabled:!1,elementVideoEnabled:!1,elementAIimageEnabled:!0,elementAItextEnabled:!1,elementCarouselEnabled:!1,elementAccordionEnabled:!1,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!0,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!1,formFieldAmpVisibilityEnabled:!1,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4,fileManager:{defaultFolderName:"",enableMoveFolder:!0,enableEdit:!0,enableTrash:!0}},project:void 0},Mc={config:{mode:"editor",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!1,styles:"",headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!1,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!1,webversionEnabled:!1,commonStylesEnabled:!1,emailResponsiveControlEnabled:!1,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!0,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!1,emailDropdownMenuClone:!0,emailDropdownMenuImport:!1,emailDropdownMenuImportButton:!1,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportTextEnabled:!1,exportMarkdownEnabled:!1,exportZipEnabled:!0,exportClipboardEnabled:!1,exportWebHookEnabled:!1,exportOutlookEnabled:!0,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!1,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!1,aiAssistentEnabled:!1,optimizeEnabled:!1,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!1,annotationsEnabled:!1,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!1,tagsEnabled:!0,isTemplateEnabled:!1,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!1,deleteButtonEnabled:!0,toggleSidePanel:!1,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!1,formFieldImageTitleEnabled:!1,formFieldBorderEnabled:!1,formFieldBorderRadiusEnabled:!1,formFieldBoxShadowEnabled:!1,formFieldVisibilityEnabled:!1,formFieldExportAsPictureEnabled:!1,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!1,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!1,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!1,formButtonFieldReplacerEnabled:!1,formCellFieldVerticalAlignEnabled:!1,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!1,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!1,formImageFieldReplacerEnabled:!1,formImageFieldHeightEnabled:!1,formTextFieldTypografEnabled:!1,formTextFieldReplacerEnabled:!1,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!0,elementCountdownEnabled:!0,elementVideoEnabled:!1,elementAIimageEnabled:!0,elementAItextEnabled:!1,elementCarouselEnabled:!1,elementAccordionEnabled:!1,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!0,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!1,formFieldAmpVisibilityEnabled:!1,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4},project:void 0},kc={...ln,config:{...ln.config,imageCenterFileManagerView:!1}};Lc({pro:co,editor:Mc,simple:Oc()?ln:kc,freeUserBlocks:pr,blocks:pr});var hr=new Set;function Nc(){return window.localStorage.getItem(bt.em_color_scheme)??void 0}function Fc(e){return hr.add(e),e(Nc()),{dispose(){hr.delete(e)}}}function On(e,t){return e.user.mode||e.serverSide.mode||t||"pro"}function jc(e,t){return t.modeDefaults(On(e,t.fallbackMode))}function Bc(e,t){const n=On(e,t);return e.serverSide.advancedConfigs?.[n]||{}}function Uc(e,t){const n=On(e,t),r=e.user?.advancedConfigs?.[n],i=r!==void 0?r:e.user?.advancedConfigs?.pro;return{...e.advancedConfigs?.[n],...i}}function Hc(e){let t;for(const n of e)n?.fileManager&&(t={...t,...n.fileManager});return t}function Gc(e){return Zo(e.map(t=>t?.resourceProxy))}function qc(e){return Qo(e.map(t=>t?.resourceProxyPolicy))}function $c(e){return cs(e.map(t=>t?.backendProxy))}function zc(e){return ni(e.map(t=>t?.backendProxyPolicy||{}).filter(Boolean))}function Vc(e,t){return[e.base,jc(e,t),e.profile,e.serverSide,Bc(e,t.fallbackMode),e.user,Uc(e,t.fallbackMode),e.local]}function xt(e,t){const n=Vc(e,t),r=ni(n),i=Hc(n);i!==void 0&&(r.fileManager=i);const o=Gc(n);o!==void 0&&(r.resourceProxy=o);const s=qc(n);s&&Object.keys(s).length>0&&(r.resourceProxyPolicy=s);const d=$c(n);d!==void 0&&(r.backendProxy=d);const l=zc(n);return l&&Object.keys(l).length>0&&(r.backendProxyPolicy=l),r}var Kc=["backendProxy","backendProxyPolicy","resourceProxy","resourceProxyPolicy"];function gr(e){return e==="server"?"serverSide":e}function Wc({env:e,base:t={},budgetMs:n}){const r={base:t,profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}},i=Me();let o={kind:"pending"},s;const d=new Promise(b=>{s=b}),l=n===void 0?void 0:setTimeout(()=>{u({kind:"absent",reason:`серверный слой не пришёл за ${n} мс`})},n);function f(){o.kind!=="pending"&&i.set(xt(r,e))}function u(b){if(o.kind!=="pending")return;clearTimeout(l),o=b;const E=xt(r,e);i.set(E),s(E)}function g(b,E){r[gr(b)]=E,b==="server"&&o.kind==="pending"?u({kind:"applied"}):f()}return{watch:b=>i.watch(b),select:b=>i.select(b),get:()=>i.get(),ready:()=>d,state:()=>o,layers:()=>({...r}),bootstrap(){const b=xt(r,e);return Object.fromEntries(Kc.map(E=>[E,b[E]]))},merge(b,E){g(E,{...r[gr(E)],...b})},replace(b,E){g(E,b)},setMode(b){r.user={...r.user,mode:b},f()},setAdvancedConfigs(b){r.advancedConfigs=b,f()},serverAbsent(b){u({kind:"absent",reason:b})},applyServerResponse(b){o.kind==="pending"&&g("server",{...r.serverSide,...b})},dispose(){clearTimeout(l)}}}var Yc=5e3;function Xc(){return{...fo("pro")?.config,mergeTags:void 0}}function Jc(e,t){e.getInstance(oe)?.watch(n=>{t.setAdvancedConfigs({...n.advancedConfigs,...n.config?.advancedConfigs}),t.replace(n.config??{},"user")})}function Qc(e,t){let n;Gi(e).watch(({profile:r})=>{const i=`${r?.theme??""}|${r?.locale??""}`;if(i===n)return;n=i;const o={};r?.theme&&(o.theme=r.theme),r?.locale&&(o.locale=r.locale),t.replace(o,"profile")})}function Zc(e,t){let n=null;const r=Fc(i=>{const o=typeof i=="string"&&i?i:void 0;o!==n&&(n=o,t.replace(o?{theme:o}:{},"local"))});e.getInstance(k)?.addDisposable(r)}async function eu(e,t){if(e.getInstance(wn)===void 0){t.serverAbsent("app_init не зарегистрирован");return}try{const n=await e.getInstanceAsync(Re);t.applyServerResponse(n?.app_config??{})}catch(n){t.serverAbsent(`app_init не выполнился: ${String(n)}`)}}function tu(e){e.injectFactory(we,(t,n)=>{if(n)return n;const r=Wc({base:Xc(),env:{modeDefaults:i=>fo(i)?.config||{},fallbackMode:localStorage.getItem("configSwither")||void 0},budgetMs:Yc});return Jc(e,r),Qc(e,r),Zc(e,r),eu(e,r),e.getInstance(k)?.addDisposable(r),r},!0)}var Pe=class extends Q{_event;_listener;_disposeEvent;constructor(e){super(),this._event=e}setListener(e){this._listener!==e&&(this._listener=e,this._disposeEvent&&this._disposeEvent(),e?this._disposeEvent=this._event(e):this._disposeEvent=void 0)}dispose(){this._disposeEvent&&this._disposeEvent(),super.dispose()}};function L(e,t,n){const r=ds(e);return(i,o,s)=>{const d=r(async l=>{const f=t?t(l):l;s&&i.bind(s);const u=await i(f);return n?n(u):u},o,s);return()=>d.dispose()}}var nu=class{deps;handleDestroy;constructor(e){this.deps=e;const t=new Jt;this.handleDestroy=L(t.event),e.lifetime.addDispose(()=>t.fire(e.getInstance()));const n=e.lifetime.addDisposable(new Pe(this.handleDestroy));e.lifetime.addDisposable(t),e.lifetime.addDisposable(e.options.watch(({handleDestroy:r})=>n.setListener(r))),e.lifetime.addDispose(()=>e.release())}destroy(){if(!this.deps.lifetime.isDisposed())try{this.deps.lifetime.dispose()}catch{}}},xn=O("DestroyableService");function ru(e){e.injectFactory(xn,()=>{const t=e.getInstance(k);if(!t)throw new Error("[plugin] время жизни экземпляра не зарегистрировано");return new nu({lifetime:t,options:e.getInstance(oe),getInstance:()=>e.getInstance(Et),release:()=>Is(e.getInstance(bs)??e)})},!0)}function iu(e){const t=e.getInstance(xn);if(!t)throw new Error("[plugin] provideDestroyable не выполнен до сборки поверхности");return{handleDestroy:t.handleDestroy,destroy:()=>t.destroy()}}var ou=1e3;function po(e,t,n=ou,r=0){if(r>n||e===t)return!0;if(typeof e!=typeof t||e===null||t===null)return!1;if(typeof e=="object"&&typeof t=="object"){if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;const i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;for(const s of i)if(!po(e[s],t[s],n,r+1))return!1;return!0}return!1}function He(e,t){if(!e||typeof e!="object")return t;if(!t||typeof t!="object")return{};const n={};for(const r of Object.keys(t)){const i=t[r],o=e[r];po(i,o)||(n[r]=i)}return n}var su=class extends Error{timeoutMs;constructor(e){super(`[emailmaker] handleSaveEmail не ответил за ${e}ms — письмо не сохранено`),this.timeoutMs=e,this.name="IntegratorSaveTimeoutError"}},au=({source:e,emailtags:t,group:n,tags:r,...i})=>i,lu=()=>_i();async function du({emails:e},t){const n=lu();let r;try{return await Promise.race([e.notifySave(t),new Promise((i,o)=>{r=setTimeout(()=>{const s=new su(n);t.value.id,o(s)},n)})])}finally{r!==void 0&&clearTimeout(r)}}function cu(e){const{emails:t}=e,n=async(r,i)=>{const o=au(i),s=r===void 0?void 0:await t.cache.getIfPresent(r),d=s?{...s,...o}:o,l=await du(e,{prev:s,patch:s?He(s,o):o,value:d,source:i.source??""}),f=String(l.id??r??le()),u=l.id===void 0?{...l,id:f}:l;return await t.cache.addOrUpdate(f,()=>u)};return{async readEmail(r){return await t.get(r)??null},async createEmail(r){const i=await n(void 0,r);return i?.renderGuid?i:{...i,renderGuid:le()}},async updateEmail(r,i){return await n(r,i)}}}var Lt=20,uu=({source:e,emailtags:t,group:n,tags:r,...i})=>i;function fu({revisions:e,revisionsByEmail:t}){const n=async(r,i)=>(t.clear(),await t.get(r,{page:i}),(await e.cache.values()??[]).filter(o=>String(o?.parent)===String(r)));return{async readRevisions(r,i=1){const o=await n(r,i);return{revisions:o.slice(Lt*(i-1),Lt*i),page:i,hasMore:o.length>Lt*i}},async readAutosave(r){return Ba(await n(r,1))},async saveAutosave(r,i){const o=uu(i);return await e.create({...o,parent:r,modified:new Date().toString()})}}}var pu=class extends ps{async execute([e],t){for(const n of t){const r=await n(e);r&&(r.id===void 0&&(r.id=e.value.id),e.value=r)}return e.value}},mu=class extends pe{};var vr=class extends Q{_items=new Map;_onChangeEmitter=new ks;async _getOrCreate(e,t){const n=this._items;let r;if(n.has(e))try{r=await n.get(e)}catch{t&&(r=await t())}else t&&(r=await t(),r&&this._onChangeEmitter.fire());return r}async _addOrUpdate(e,t){let n;const r=this._items;if(r.has(e))try{n=await r.get(e)}catch{}const i=await t(n);return pt(n,i)||this._onChangeEmitter.fire(),i}entries(){return Promise.all([...this._items.entries()].map(([e,t])=>t.then(n=>[e,n]))).then(e=>e.filter(([t,n])=>!!n))}values(){return Promise.all([...this._items.values()].map(e=>e).filter(e=>!!e))}getOrCreate(e,t){const n=this._getOrCreate(e,()=>t(e));return this._items.set(e,n),n}addOrUpdate(e,t){const n=this._addOrUpdate(e,t);return this._items.set(e,n),n}async getIfPresent(e){if(this._items.has(e))try{return await this._items.get(e)}catch{return}}add(e,t){const n=Promise.resolve(t);return this._items.set(e,n),n}remove(e){if(this._items.has(e)){const t=this._items.get(e);return this._items.delete(e),this._onChangeEmitter.fire(),t}return Promise.resolve(void 0)}async setAll(e){try{this.suspendChange();const t=[],n=new Set(Array.from(e).map(([i,o])=>i)),r=(await this.entries()).filter(([i,o])=>!n.has(i));for(const[i,o]of e)t.push(this.addOrUpdate(i,()=>o)),n.add(i);for(const[i]of r)t.push(this.remove(i));return await Promise.all(t),r}finally{this.resumeChange()}}clear(){this._items.clear(),this._onChangeEmitter.fire()}suspendChange(){this._onChangeEmitter.suspend()}resumeChange(){this._onChangeEmitter.resume()}onChange=this._onChangeEmitter.event};function hu(e,{filter:t,order:n="asc",orderBy:r,page:i,pageSize:o=20}={}){const s=e.length;let d=e.length;if(t!==void 0){const l=Object.keys(t);e=e.filter(f=>{for(const u of l){const g=f[u],b=t[u];return u==="id"||typeof g!="string"?g===b:typeof b=="string"&&g.startsWith(b)}return!0}),d=e.length}return r&&(e=e.sort((l,f)=>(l[r]>f[r]?1:f[r]>l[r]?-1:0)*(n==="asc"?1:-1))),i!==void 0&&(e=e.slice(o*(i-1),o*i)),{data:e,filteredTotal:d,total:s,totalPages:Math.ceil(d/o)}}function gu(e=[]){if(e=e.filter(n=>n),e.length<=1)return e[0];const t=new Map;for(const n of e)for(const r of n)if(r.id!==void 0){const i=t.get(r.id)||{};t.set(r.id,{...i,...r})}return[...t].map(([n,r])=>r)}function vu(e,t){return br(e)&&br(t)?String(e)===String(t):e===t}function br(e){return typeof e=="string"||typeof e=="number"}var bu=class extends Q{_cache=new vr;_readEmitter=new pe;_saveEmitter=this.addDisposable(new pu);_removeEmitter=this.addDisposable(new mu);_foreignCache=Object.create(null);async get(e){return this._cache.getOrCreate(e,async t=>Object.assign({id:e},...(await this._readEmitter.fire(e)).filter(n=>!!n)))}get cache(){return this._cache}byForeignKey(e){let t=this._foreignCache[e];if(!t){const n=this.addDisposable(new Q);n.addDispose(()=>delete this._foreignCache[e]);const r=n.addDisposable(new vr),i=n.addDisposable(new pe);t=this._foreignCache[e]={get:async(o,s={})=>{await r.getOrCreate(o,async()=>{try{const l=gu(await i.fire(o))||[];for(const f of l)f[e]=o,await this._cache.add(f.id,f);return l}catch{return[]}});const d=(await this._cache.values()||[]).filter(l=>{const f=l[e];return f==null||vu(f,o)});return hu(d,s)},first(o,s={}){return t.get(o,{...s,page:1,pageSize:1}).then(({data:d})=>d[0])},handleRead:i.event,clear(){r.clear()},dispose(){n.dispose()}}}return t}async create(e,{source:t="",silent:n}={}){let r=e;return n||(r=await this._saveEmitter.fire({prev:void 0,patch:e,value:r,source:t})),r.id===void 0&&(r.id=le()),await this._cache.addOrUpdate(r.id,()=>r)}notifySave(e){return this._saveEmitter.fire(e)}async update(e,t,{source:n="",silent:r}={}){return this._cache.addOrUpdate(e,async i=>{const o=i?{...i,...t}:t;if(!r)return t=i?He(i,t):t,await this._saveEmitter.fire({prev:i,patch:t,value:o,source:n})})}async remove(e,{source:t="",silent:n}={}){const r=await this._cache.remove(e);return n||await this._removeEmitter.fire({value:r,source:t}),r}refresh(){this._cache.clear();for(const e of Object.values(this._foreignCache))e.clear()}suspendChange(){this._cache.suspendChange()}resumeChange(){this._cache.resumeChange()}handlerRead=this._readEmitter.event;onSave=this._saveEmitter.event;onRemove=this._removeEmitter.event;onChange=this._cache.onChange};function Xe(e){const t=O(e);return n=>n.getOrCreateInstance(t,()=>new bu)}function Eu(e){const t=e.getInstance(k);if(!t)throw new Error("Failed");return t}function Er(e){return Object.prototype.hasOwnProperty.call(e,"meta")}function yu(e,t,n){return e&&!Er(t)&&Er(e)?{...n,meta:e.meta}:n}var mo=Xe("plugin.dataSource.emails"),ho=Xe("plugin.dataSource.emailRevisions"),yr=O("emailDocuments.provided");function _u(e){const t=mo(e),n=ho(e),r=n.byForeignKey("parent");return e.getInstance(yr)?{emails:t,emailRevisions:n}:(e.inject(yr,!0),ol(e,cu({emails:t})),dl(e,fu({revisions:n,revisionsByEmail:r})),Eu(e).addDisposable(t.onSave(({prev:i,patch:o,value:s})=>yu(i,o,s),Number.MIN_VALUE)),{emails:t,emailRevisions:n})}function _r(e,t){return!e?.data||!t||e.id!==t.locale?!1:t.contentHash?e.hash===t.contentHash:t.updatedAt>0&&t.updatedAt<=e.time}function wu(e){try{return localStorage.getItem(e)===null?!1:(localStorage.removeItem(e),!0)}catch{return!1}}var Su="po",ot=null;function Iu(){const e=typeof window.__emailmaker__<"u"?window.__emailmaker__?.require:void 0;return typeof e!="function"?Promise.reject(new Error("[loadPoParser] AMD loader is unavailable")):new Promise((t,n)=>{e([Su],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadPoParser] Failed to require po module")))})}function Tu(){return ot===null&&(ot=Iu().catch(e=>{throw ot=null,e})),ot}async function go(e){if(typeof e=="object")return Ln(e);if(typeof e!="string")return;const t=e.trim();if(t)return t.startsWith("{")||t.startsWith("[")?Au(t):Cu(t)}function Ln(e){if(!(e==null||typeof e!="object"||Array.isArray(e)))return e}function Au(e){try{return Ln(JSON.parse(e))}catch{return}}var wr=!1;async function Cu(e){try{return Ln((await Tu()).parsePoCatalog(e))}catch{wr||(wr=!0);return}}var Pu="em_locale",Ru="em_ant_locale",Du="locale",Ou="ant_locale";function Mn(e){try{return JSON.parse(localStorage.getItem(e)||"")}catch{return null}}function vo(e,t){const n=Mn(e);if(!n)return null;try{localStorage.removeItem(e),localStorage.setItem(t,JSON.stringify(n))}catch{}return n}function xu(){return Mn("em_locale")??vo(Du,"em_locale")}function Sr(e){try{localStorage.setItem(Pu,JSON.stringify(e))}catch{}}function Lu(){return Mn("em_ant_locale")??vo(Ou,"em_ant_locale")}function Mu(e,t){try{localStorage.setItem(Ru,JSON.stringify({id:e,data:t}))}catch{}}var ku=8e3;function Nu(e,t){const n=e,r=t,i=Object.keys(n).filter(o=>o!=="");return i.length!==Object.keys(r).filter(o=>o!=="").length?!1:i.every(o=>JSON.stringify(n[o])===JSON.stringify(r[o]))}function Fu(e){const t=xu(),n=Lu();let r={ready:!1},i;const o=Me(r);let s=0;const d=y=>{r={...r,...y},o.set(r)},l=()=>{r.ready||d({ready:!0})},f=setTimeout(l,e.unlockAfterMs??ku),u=y=>y!==s;let g;async function b(y,w){if(n?.id===y&&n.data&&d({antd:n.data}),!g)return;const S=await g(y).catch(()=>{});!S||u(w)||(d({antd:S}),Mu(y,S))}async function E(y,w){const S=await e.askHost(y).catch(()=>null);if(u(w))return!0;if(S==null)return!1;const A=await go(S);return u(w)||(A&&d({catalog:A}),l()),!0}async function I(y,w){const S=await e.readList();if(u(w))return;if("error"in S){d({failure:{kind:"GET_LOCALES_ERROR",error:S.error}}),l();return}const A=S.data.find(c=>c.locale===y);if(!A){wu("em_locale")&&d({catalog:void 0}),l();return}if(_r(t,A)&&(!i||i.catalog===t?.data)){l();return}if(i?.entry&&r.catalog===i.catalog&&_r(i.entry,A)){Sr(i.entry),l();return}const m=await e.readCatalog(y);if(!u(w)){if("error"in m){d({failure:{kind:"GET_LOCALE_ERROR",error:m.error}}),l();return}m.data&&(i?.id===y&&r.catalog===i.catalog&&Nu(i.catalog,m.data)||d({catalog:m.data}),Sr({id:y,time:A.updatedAt||Math.floor(Date.now()/1e3),hash:A.contentHash,data:m.data})),l()}}async function v(y,w){if(!await E(y,w)){if(!u(w)&&(i?.id===y&&r.catalog===i.catalog||y==="en_US")&&l(),e.canUseNetwork&&!e.canUseNetwork()){l();return}await I(y,w)}}return{set(y){if(!y||y===r.id)return;const w=s+=1;d({id:y,failure:void 0});const S=i?.id===y&&r.catalog===i.catalog;(i&&!S&&r.catalog===i.catalog||y==="en_US"&&r.catalog)&&d({catalog:void 0}),t?.id===y&&t.data&&(d({catalog:t.data}),l()),b(y,w),v(y,w)},prime(y,w,S){r.id||r.catalog||!w||(i=t?.id===y&&t.data&&(!S||t.time>=S.time)?{id:y,catalog:t.data}:{id:y,catalog:w,entry:S?{id:y,time:S.time,hash:S.hash,data:w}:void 0},d({catalog:i.catalog}))},useAntdLoader(y){g=y,r.id&&b(r.id,s)},state:o,snapshot:()=>r,dispose:()=>clearTimeout(f)}}var ju=class{http;constructor(e){this.http=e}jsonList=({locale:e},t={})=>this.http.request({path:`/translations/${e}.json`,method:"GET",format:"json",...t});getTranslations=({locale:e},t={})=>this.http.request({path:`/translations/${e}.po`,method:"GET",...t});localesList=(e={})=>this.http.request({path:"/translations/locales",method:"GET",format:"json",...e})},Bu=class{baseUrl="/api/v2";securityData=null;securityWorker;abortControllers=new Map;customFetch=(...e)=>fetch(...e);baseApiParams={credentials:"same-origin",headers:{},redirect:"follow",referrerPolicy:"no-referrer"};constructor(e={}){Object.assign(this,e)}setSecurityData=e=>{this.securityData=e};encodeQueryParam(e,t){return`${encodeURIComponent(e)}=${encodeURIComponent(typeof t=="number"?t:`${t}`)}`}addQueryParam(e,t){return this.encodeQueryParam(t,e[t])}addArrayQueryParam(e,t){return e[t].map(n=>this.encodeQueryParam(t,n)).join("&")}toQueryString(e){const t=e||{};return Object.keys(t).filter(n=>typeof t[n]<"u").map(n=>Array.isArray(t[n])?this.addArrayQueryParam(t,n):this.addQueryParam(t,n)).join("&")}addQueryParams(e){const t=this.toQueryString(e);return t?`?${t}`:""}contentFormatters={"application/json":e=>e!==null&&(typeof e=="object"||typeof e=="string")?JSON.stringify(e):e,"application/vnd.api+json":e=>e!==null&&(typeof e=="object"||typeof e=="string")?JSON.stringify(e):e,"text/plain":e=>e!==null&&typeof e!="string"?JSON.stringify(e):e,"multipart/form-data":e=>e instanceof FormData?e:Object.keys(e||{}).reduce((t,n)=>{const r=e[n];return t.append(n,r instanceof Blob?r:typeof r=="object"&&r!==null?JSON.stringify(r):`${r}`),t},new FormData),"application/x-www-form-urlencoded":e=>this.toQueryString(e)};mergeRequestParams(e,t){return{...this.baseApiParams,...e,...t||{},headers:{...this.baseApiParams.headers||{},...e.headers||{},...t&&t.headers||{}}}}createAbortSignal=e=>{if(this.abortControllers.has(e)){const n=this.abortControllers.get(e);return n?n.signal:void 0}const t=new AbortController;return this.abortControllers.set(e,t),t.signal};abortRequest=e=>{const t=this.abortControllers.get(e);t&&(t.abort(),this.abortControllers.delete(e))};request=async({body:e,secure:t,path:n,type:r,query:i,format:o,baseUrl:s,cancelToken:d,...l})=>{const f=(typeof t=="boolean"?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},u=this.mergeRequestParams(l,f),g=i&&this.toQueryString(i),b=this.contentFormatters[r||"application/json"],E=o||u.format;return this.customFetch(`${s||this.baseUrl||""}${n}${g?`?${g}`:""}`,{...u,headers:{...u.headers||{},...r&&r!=="multipart/form-data"?{"Content-Type":r}:{}},signal:(d?this.createAbortSignal(d):u.signal)||null,body:typeof e>"u"||e===null?null:b(e)}).then(async I=>{const v=I;v.data=null,v.error=null;const y=E?I.clone():I,w=E?await y[E]().then(S=>(v.ok?v.data=S:v.error=S,v)).catch(S=>(v.error=S,v)):v;return d&&this.abortControllers.delete(d),w})}},Uu=O("rest.v2.transport"),Ir=Symbol("rest.v2.secureRequest");function Hu(e){return e.getOrCreateInstance(Uu,()=>{const t=e.getInstance(ti)?.execute||fetch;return new Bu({baseUrl:"https://app.emailmaker.ru/api/v2",securityWorker:()=>({[Ir]:!0}),customFetch:(n,r={})=>{const{[Ir]:i,...o}=r;return t(n,{...o,[rs]:i!==!0})}})})}function Gu(e,t){const n=Hu(e);return Object.assign({},...t.map(r=>new r(n)))}function Tr(e,t){if(e!=null&&typeof e=="object"){const n=e[t];if(typeof n=="string"&&n!=="")return n}}function bo(e){const t=e.error,n=t?.error;return n&&typeof n=="object"?{status:e.status,data:{code:Tr(n.details,"wp_code")??n.code,message:Tr(n.details,"wp_message")??n.message,details:n.details}}:t&&typeof t=="object"?{status:e.status,data:t}:{status:e.status,data:{message:e.statusText||"request failed"}}}function Eo(e){return!e.ok||!!e.error}function qu(e){try{const t=localStorage.getItem(e);if(t==="true")return!0;if(t==="false")return!1}catch{}}function yo(){return qu(bt.em_translations_v2)??!0}function $u(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function zu(e){const t=e?Date.parse(e):NaN;return Number.isNaN(t)?0:Math.floor(t/1e3)}function Vu(e){return Array.isArray(e)?e.reduce((t,n)=>{const r=Array.isArray(n)?n:[],i=r[0];return typeof i=="string"&&i!==""&&t.push({locale:i,updatedAt:$u(r[1])}),t},[]):[]}function Ku(e){return(e?.items??[]).reduce((t,n)=>(n.locale&&t.push({locale:n.locale,updatedAt:zu(n.updated_at),contentHash:n.content_hash}),t),[])}function _o(e){return Gu(e,[ju])}function vt(e){return{error:{status:"FETCH_ERROR",error:e instanceof Error?e.message:"locale request failed"}}}function dn(e){return!e.ok||e.error!=null}function cn(e){const t=e.error;return{error:{status:e.status,data:t?.data??e.error}}}async function Mt(e){return{data:await go(e)??null}}async function Wu(e){if(yo())try{const n=await _o(e).localesList();return Eo(n)?{error:bo(n)}:{data:Ku(n.data)}}catch(n){return vt(n)}const t=ii(e,[fi]);try{const n=await t.get_translations2({file:"react_app"});return dn(n)?cn(n):{data:Vu(n.data)}}catch(n){return vt(n)}}async function Yu(e,t){if(yo())try{const r=await _o(e).jsonList({locale:t});return Eo(r)?{error:bo(r)}:Mt(r.data)}catch(r){return vt(r)}const n=ii(e,[fi]);try{const r=await n.get_translations3({id:t,file:"react_app"});return dn(r)?cn(r):Mt(r.data)}catch{try{const r=await n.get_translations3({id:"en_US",file:"react_app"});return dn(r)?cn(r):Mt(r.data)}catch(r){return vt(r)}}}var $e=O("locale.service");function Xu(e){if(e.getInstance($e))return;const t=Fu({readList:()=>Wu(e),readCatalog:n=>Yu(e,n),askHost:async n=>(await ie(e,F.READ_LOCALE).fire(n))[0],canUseNetwork:()=>!e.getInstance(me)});e.inject($e,t),e.getInstance(k)?.addDispose(()=>t.dispose())}function Ju(e){const t=e.getInstance(we);if(!t)return;const n=e.getInstance($e);if(!n)return;const r=t.select(i=>i.locale).watch(i=>n.set(i));e.getInstance(k)?.addDisposable(r)}var Qu="user_id",Zu="project_id",Ar=O("rest.identityHeadersProvided");function ef(e){if(e.getInstance(Ar))return;e.inject(Ar,!0);let t;e.getInstance(oe)?.watch(n=>{t=n}),e.addService(En,{execute(n,r){if(r?.public)return;const i=t?.user?.id??qi(e).profile?.id;i!=null&&i!==""&&n.headers.set(Qu,String(i));const o=t?.project;o!=null&&o!==""&&n.headers.set(Zu,String(o))}})}function tf(e){if(!e)return!1;try{return e.getInstance(me)!==void 0}catch{return!1}}var nf="Invalid standaloneKey.",ch=O("StandaloneMockGuard");function rf(){const e=new Error(nf);return e.name="InvalidStandaloneKeyError",e}function of(e){e.addService(En,{execute:()=>{if(tf(e))throw rf()}})}function sf(e){hs(e),of(e)}function af(e){const t=new ro;e.inject(De,t);let n;const r=e.getInstance(oe)?.watch(o=>{o&&(o.signal!==void 0&&(n=o.signal),t.configure({replaceSession:!0,...o.timeouts!==void 0?{timeouts:o.timeouts}:{},...n!==void 0?{signal:n}:{}}))}),i=e.getInstance(k);r&&i?.addDisposable(r),i?.addDispose(()=>{t.abort()})}var lf=Xe("plugin.dataSource.blocks"),df=Xe("plugin.dataSource.blockRevisions"),cf=Xe("plugin.dataSource.comments"),uf=no(),ff=no(),wo=`<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
1004
1004
  <html>
@@ -1044,7 +1044,7 @@ import{t as ei}from"./static/esm/50fbfdf6.js";import{$ as Ko,A as Wo,At as Yo,B
1044
1044
  </html>`;function pf(e){return{isNew:!0,is_inited:!1,subject:void 0,preheader:void 0,description:"",html:wo,project:e?.id,project_title:e?.title??"",tags:[],utm_parameters:{utm_source:"",utm_medium:"",utm_campaign:"",utm_term:"",utm_content:""},parent_email:null,common_styles:"{}",title:"",emailtags:[],isAmp:!1}}var mf=O("CurrentProject"),hf={};function _t(e){return e?.getInstance(mf)?.get()??hf}function So(e){const t=_t(e).card?.id,n=Number(t);return t!=null&&t!==""&&Number.isFinite(n)?n:void 0}var Io=new Set(["email","block","blocks","autosaves","revisions","comments","templateId","reload"]);function gf(e){return!Object.keys(e).some(t=>Io.has(t))}function vf(e){const t={},n={};for(const[r,i]of Object.entries(e))Io.has(r)?t[r]=i:n[r]=i;return{showOptions:t,misplacedEmailFields:n}}function Cr(e){const t=e.id;if(!(t===null||typeof t=="string"&&t.trim()===""))return e;const n={...e};return delete n.id,n}function wt(e){return{emails:mo(e),blocks:lf(e),emailRevisions:ho(e),blocksRevision:df(e),comments:cf(e)}}function bf(e){const t=Object.values(wt(e));return{suspendChange(){t.forEach(n=>n.suspendChange())},resumeChange(){t.forEach(n=>n.resumeChange())}}}function kn(e,t=!0){if(typeof e=="string")return{email:{code:e}};if(gf(e))return{email:Cr(e)};{const{showOptions:n,misplacedEmailFields:r}=vf(e),i=Object.keys(r);t&&i.length>0&&void 0;const o=typeof e.email=="string"?{code:e.email}:e.email;return{...n,email:Cr({...r,...o})}}}function To(e){return An(e)?.current()}function ut(e){return To(e)?.getContent()}function Ef(e,t){const n=t??pf(),r=To(e)?.get();return r?{...n,...r.attributes,id:r.serverId??void 0,isNew:r.serverId===null,html:ut(e)??n.html}:n}async function kt(e){return(await e.getInstanceAsync(Re))?.project}function xe({code:e,project:t,...n},r){const i=ge(n),o=So(r),s=ke(r);return e&&s.warnAboutUnconfiguredInput(e,n.id),{...i,...e?{html:s.toEditorForm(e)}:{},...o===void 0?{}:{project:o},utm_parameters:i.utm_parameters||{},_embedded:void 0}}function Z({html:e,renderGuid:t,showToken:n,showId:r,...i},o){const{requested:s}=_t(o),d=$i(o);return ge({...i,code:ke(o).toOutputForm(e),project:s===void 0?i.project:s,utm_parameters:d.UTMEnabled?i.utm_parameters:void 0,tags:void 0,template:void 0,guid:void 0,emailtags:void 0,project_title:void 0,project_author:void 0,is_template:void 0,is_inited:void 0})}function un(e){return e==null?"":e.replaceAll(`\r
1045
1045
  `,`
1046
1046
  `)}function Pr(e){return e.replace(/<title[^>]*>[\s\S]*?<\/title>/gi,"")}function yf(e,t,n,r){const i=_f(e,t,n,r);return i===void 0}function _f(e,t,n,r){const{email:i}=kn(t,!1),o=xe(i,e),s=o.id;if(s===void 0)return"no-id";if(r!==void 0&&r!==s)return"other-id-shown";const d=An(e)?.current();if(!d)return"no-session";const l=d.get(),f=l.attributes;if(l.serverId!==s)return"document-id";if(f.is_inited!==!0)return"not-inited";const u=Pr(un(n??d.getContent()));if(o.html!==void 0&&Pr(un(o.html))!==u)return"html";if(o.subject!==void 0&&o.subject!==f.subject)return"subject";if(o.preheader!==void 0&&o.preheader!==f.preheader)return"preheader";if(o.common_styles!==void 0&&o.common_styles!==f.common_styles)return"common_styles"}function Rr(e,t){const{email:n}=kn(t,!1),r=xe(n,e);if(r.id!==void 0)return JSON.stringify([r.id,r.html===void 0?null:un(r.html),r.subject??null,r.preheader??null,r.common_styles??null])}function wf(e,t){const n={...e};return delete n.id,{...n,...t}}function Sf(e){return e.html?e:{...e,html:wo}}function Be({code:e,project:t,...n},r,i){const o=i??So(r);return{...n,...e?{html:ke(r).toEditorForm(e)}:{},renderGuid:le(),...o===void 0?{}:{project:o}}}function st({html:e,renderGuid:t,...n},r){const{requested:i}=_t(r);return ge({...n,code:ke(r).toOutputForm(e),project:i===void 0?n.project:i,guid:void 0,link:void 0,status:void 0,slug:void 0,password:void 0,comment_status:void 0,template:void 0,blocktags:void 0,project_title:void 0,ping_status:void 0,lock:void 0,tag:void 0,is_template:void 0})}function Ao(e){return An(e)?.current()?.get().serverId??void 0}function fn(e,t,n){return n===void 0&&(n=e.post===void 0?Ao(t):e.post),{...e,content:e.content?`<p>${e.content}</p>`:"",post:n}}function at(e,t){return ge({...e,link:void 0,comment_status:void 0})}function pn({code:e,...t},n,r){return r===void 0&&(r=t.parent===void 0?Ao(n):t.parent),{...t,...e?{html:e}:{},parent:r}}function Dr({html:e,...t},n){return ge({...t,code:e,guid:void 0,compiled:ge({html:e,ampHtml:e&&""})})}var If=O("emailTemplate.reads");async function Tf(e,t){try{return await Se(e).email(e).readEmail(t)??void 0}catch(n){n instanceof Error&&n.message;return}}function Af(e,t){const n=e.getOrCreateInstance(If,()=>new Map),r=n.get(t);if(r!==void 0)return r;const i=Tf(e,t).then(o=>(o===void 0&&n.delete(t),o));return n.set(t,i),i}var Cf="EXTERNAL";function Pf(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"сохранение не состоялось")}var Rf="email_id",Df=class extends Q{_container;_prevCommand;_lastShow;_showToken=0;_showRequests=0;_dataSources;_eventLock;_queue=Ps();_currentEmail;constructor(e){super(),this._container=e;const t=e;this._dataSources=wt(t),this._eventLock=bf(t);const n=V(e,F.ON_EMAIL_CHANGED_ID);this.addDisposable(n(r=>{this._currentEmail=r})),this.addDisposable(e.addService(En,{execute:(r,i)=>{!i?.public&&this._currentEmail?.id&&!this._currentEmail.isNew&&r.headers.append(Rf,this._currentEmail.id)}}))}_getInitPipeline(){return this._container?.getInstance(De)??Rn}_throwIfDestroyed(){if(this.isDisposed())throw di()}async getTemplateEmail(e){const t=await Af(this._container,String(e));if(!t)return;const n={...t,lock:!1,parent_email:String(e)};return delete n.id,n}async setBlocks(e=[]){const{cache:t}=this._dataSources.blocks,n=await kt(this._container);await t.setAll(e.filter(r=>r.id!==void 0).map(r=>[r.id,Be(r,this._container,n)]))}async setEmailRevisions(e,t){if(e===void 0)return;const{cache:n}=this._dataSources.emailRevisions,r=e.filter(i=>i.id!==void 0).map(i=>[i.id,pn(i,this._container,t)]);await n.setAll(r)}async setComments(e=[],t){const{cache:n}=this._dataSources.comments,r=e.filter(i=>i.id!==void 0).map(i=>[i.id,fn(i,this._container,t)]);await n.setAll(r)}async setEmail(e,t,n,r,i){const o=this._dataSources.emails,s=o.cache,d=await kt(this._container),l=r??this._showToken;e=typeof e=="string"?{code:e}:{...e};let f=xe(e,this._container);const u=f.id;let g=u;if(u!==void 0){const b=await o.get(u);f={...b??{},...f,renderGuid:b?.renderGuid??le(),...l>0?{showToken:l}:{},...i?{showId:i}:{},project:d}}else{g=n??le();const b=await o.get(g);f={...f,renderGuid:b?.renderGuid??le(),...l>0?{showToken:l}:{},...i?{showId:i}:{},project:d},delete f.project}if(t){const b=await this.getTemplateEmail(String(t));b&&(f=wf(b,f))}return u===void 0&&(f=Sf(f)),await s.addOrUpdate(g,()=>f),f}_rememberShow(e){this._prevCommand=e}_isRepeatOfLastShow(e){const t=this._lastShow;if(!t||t.signature!==Rr(this._container,e))return!1;const n=ut(this._container);return n===void 0||n===t.html}_rememberShownContent(e){const t=Rr(this._container,e);this._lastShow=t===void 0?void 0:{signature:t,html:ut(this._container)??""}}async _show(e,t){if(this._throwIfDestroyed(),t!==void 0&&t!==this._showRequests){this._showRequests;return}if(!e)return;const n=this._getInitPipeline();if($(n.signal),yf(this._container,e,ut(this._container),this._prevCommand?.id)||this._isRepeatOfLastShow(e))return;const r=kn(e);r.email.id,this._prevCommand?.id;let i,o="",s=0,d=!1,l,f=Promise.resolve(),u,g=!1;try{this._eventLock.suspendChange();const{email:b,blocks:E,autosaves:I,comments:v,templateId:y,reload:w}=r;i=b.id;const S=xe(b,this._container),A=S.id,m=A??le(),c=await Ue("getProject",kt(this._container));$(n.signal),o=le();const a={isNew:A===void 0,id:String(m),project:c},p=w===!0&&A!==void 0;p&&(await this._dataSources.emails.remove(String(A),{silent:!0}),String(A)),s=++this._showToken,String(m);const h=[];h.push(this.setBlocks(E)),b.id!==void 0&&(h.push(this.setComments(v)),h.push(this.setEmailRevisions(I,String(b.id)))),h.push(this.setEmail(b,Number(y),A===void 0?String(m):void 0,s,o)),await Ue("setEmail+blocks+revisions",Promise.all(h),{emailId:A??String(m),showId:o,targetShowToken:s}),$(n.signal);const _=await this._dataSources.emails.get(String(m)),T=ve(this._container),R={id:o,token:s};A===void 0?u=T.startNewDraft(_??S,{patch:S,show:R}):p?u=T.reload(A,{email:_??S,patch:S,show:R}):T.sessionKey()===Fe(A)?u=T.show(S,R):u=T.open(A,{email:_??S,patch:S,show:R});const N=!!this._prevCommand&&pt(this._prevCommand,a);a.id,!this._prevCommand||pt(this._prevCommand,a),this._prevCommand?.id,this._rememberShow(a),f=n.requestShow({showId:o,navId:String(m),emailId:A,isNew:A===void 0}),g=!0,String(m),d=!0}catch(b){l=b,g&&o&&n.failShow(o,b),String(b)}finally{this._eventLock.resumeChange()}if(!d)throw l instanceof Error?l:new Error(`[emailmaker] show() setup failed: ${String(l??"unknown error")}`);return Ue("show-init-deferred",Promise.all([f,u?.whenReady().catch(b=>{if(b instanceof mt){const E=xi(b);throw E?new Error(`[emailmaker] show(): email open failed (${E})`,{cause:b}):b}})??Promise.resolve()]).then(()=>{}),{showId:o,emailId:i??null}).then(()=>{this._rememberShownContent(e)})}async _save(){this._throwIfDestroyed();const e=this._getInitPipeline();$(e.signal);const t=ve(this._container),n=await t.save("publish",{source:Cf});if($(e.signal),!n)throw Pf(t.saveState().error);return Z(Ef(this._container,this._currentEmail),this._container)}_queuedShow=this._queue.decorate((e,t)=>this._show(e,t),this);show=e=>{const t=this._showRequests+=1;return this._queuedShow(e,t)};save=this._queue.decorate(this._save,this)};function Of(e){return String(e).replace(/"/g,"&quot;")}function xf(e=new Date){const t=n=>String(n).padStart(2,"0");return String(e.getFullYear())+t(e.getMonth()+1)+t(e.getDate())+t(e.getHours())+t(e.getMinutes())+t(e.getSeconds())}function Lf(e){const t=/<(table|tr|div)(\s[^>]*)>/gi;let n;for(;(n=t.exec(e))!==null;){const r=n[2]??"";if(/\bem\s*=\s*["']block["']/i.test(r))return{full:n[0],index:n.index}}return null}function Or(e,t,n){const r=new RegExp(`\\b${t}\\s*=\\s*["'][^"']*["']`,"i"),i=Of(n);return r.test(e)?e.replace(r,`${t}="${i}"`):e.replace(/>$/,` ${t}="${i}">`)}function Mf(e,t,n){if(!e?.trim()||!t)return e;const r=Lf(e);if(!r)return e;const i=String(t),o=xf(n??new Date);let{full:s,index:d}=r;const l=s.length;return/\bem-block-id\s*=/.test(s)||(s=Or(s,"em-block-id",i)),s=Or(s,"em-block-version",o),e.slice(0,d)+s+e.slice(d+l)}function kf(e){if(e.meta!==void 0&&e.meta!==null&&typeof e.meta=="object")return e.meta;const t=e.catalogExtra?.meta;if(t!=null&&typeof t=="object")return t}function Nf(e,t){const n=e.insertFrom??t?.type,r=t?.blockId??(e.id!=null&&e.id!==""?String(e.id):void 0),i=t?.project??(e.project!==void 0&&e.project!==null?String(e.project):void 0);return{type:t?.type??n,insertFrom:n,name:t?.name??e.name,blockId:r,project:i,fragmentRole:e.fragmentRole,id:r,title:e.title??void 0,blockType:e.type,meta:kf(e)}}function Nt(e,t){return t?Nf(t,e):{type:e.type,name:e.name,blockId:e.blockId,project:e.project,insertFrom:e.type}}var Co=["title","slug","type","tags","blocktags","modified","author","lock","subject","description","excerpt","status","is_template","link","renderGuid","date","date_gmt","modified_gmt","comment_status","ping_status","template","related_email","project_title","project_author","isAmp","meta"],Ff=[...Co,"html","id","project","password"],uh=new Set(["html",...Co,"global_block","project"]);function jf(e){if(!e||typeof e!="object")return{};const t={};e.id!=null&&e.id!==""&&(t.id=String(e.id)),e.title!=null&&e.title!==""&&(t.title=e.title),e.slug!=null&&e.slug!==""&&(t.slug=e.slug),e.type!=null&&e.type!==""&&(t.type=e.type),e.tags!=null&&(t.tags=e.tags),e.blocktags!=null&&(t.blocktags=e.blocktags),e.modified!=null&&e.modified!==""&&(t.modified=e.modified),e.author!=null&&e.author!==""&&(t.author=String(e.author)),e.lock!=null&&(t.lock=e.lock),e.subject!=null&&e.subject!==""&&(t.subject=e.subject),e.description!=null&&e.description!==""&&(t.description=e.description),e.excerpt!=null&&e.excerpt!==""&&(t.excerpt=e.excerpt),e.status!=null&&e.status!==""&&(t.status=e.status),e.is_template!=null&&(t.is_template=e.is_template),e.link!=null&&e.link!==""&&(t.link=e.link),e.renderGuid!=null&&e.renderGuid!==""&&(t.renderGuid=e.renderGuid),e.date!=null&&e.date!==""&&(t.date=e.date),e.date_gmt!=null&&e.date_gmt!==""&&(t.date_gmt=e.date_gmt),e.modified_gmt!=null&&e.modified_gmt!==""&&(t.modified_gmt=e.modified_gmt),e.comment_status!=null&&e.comment_status!==""&&(t.comment_status=e.comment_status),e.ping_status!=null&&e.ping_status!==""&&(t.ping_status=e.ping_status),e.template!=null&&e.template!==""&&(t.template=e.template),e.related_email!=null&&e.related_email!==""&&(t.related_email=e.related_email),e.project_title!=null&&e.project_title!==""&&(t.project_title=e.project_title),e.project_author!=null&&e.project_author!==""&&(t.project_author=e.project_author),e.isAmp!=null&&(t.isAmp=e.isAmp),e.meta!==void 0&&e.meta!==null&&typeof e.meta=="object"&&(t.meta=e.meta);const n=new Set(Ff),r={};for(const i of Object.keys(e))n.has(i)||(r[i]=e[i]);return Object.keys(r).length>0&&(t.catalogExtra=r),t}function Bf(e,t={}){return!e||typeof e!="object"?{html:"",insertFrom:t.type,name:t.name,project:t.project,id:t.blockId}:{...jf(e),html:typeof e.html=="string"?e.html:"",insertFrom:t.type,name:t.name,project:t.project??e.project,id:e.id!=null&&e.id!==""?String(e.id):t.blockId}}var mn=new WeakMap;function Uf(e){let t=mn.get(e);return t||(t={byId:new Map,fallback:[]},mn.set(e,t)),t}function Hf(e){mn.delete(e)}function Gf(e,t){const{byId:n,fallback:r}=Uf(t);if(e.blockId){const i=n.get(e.blockId);if(i){n.delete(e.blockId);const o=r.indexOf(i);return o>=0&&r.splice(o,1),i}return}for(let i=r.length-1;i>=0;i--){const o=r[i],s=e.name!=null&&e.name!==""&&o.name!=null&&o.name!==""&&o.name===e.name,d=e.type!=null&&e.type!==""&&o.insertFrom===e.type;if(s&&d)return r.splice(i,1),o.id!=null&&o.id!==""&&n.delete(String(o.id)),o}}async function qf(e,t){const{blocks:n}=wt(e);return await n.cache.getIfPresent(t)??void 0}async function $f(e,t){if(!t.blockId)return;const n=await qf(e,t.blockId);if(n)return Bf(n,t)}async function zf(e,t){const n=Gf(e,t);if(n)return Nt(e,n);const r=await $f(t,e);return r?Nt(e,r):Nt(e,void 0)}var Vf=us("application_block_inserted"),Kf=-1e3,xr=new WeakSet;function Wf(e){if(e===null||typeof e!="object")return!1;const t=e;return typeof t.type=="string"||typeof t.name=="string"||typeof t.blockId=="string"||typeof t.project=="string"||typeof t.project=="number"}function Yf(e){if(!e||xr.has(e))return;xr.add(e);const t=new Q,n=Y(e);return t.addDisposable(n.addListenerAsyncPipe(Vf,async(r,i)=>{const o=Wf(r)?await zf(r,e):r;return i?i(o):o},Kf)),t.addDisposable({dispose:()=>{Hf(e)}}),t}var Lr=100,Xf=class extends Q{_container;_events;constructor(e){super(),this._container=e;const t=Yf(e);t&&this.addDisposable(t)}_get(){const e=this._container,{blocks:t,emails:n,comments:r,emailRevisions:i}=wt(e),o=V(e,F.ON_SHARE_ID),s=V(e,F.ON_SHOW_PREVIEW_ID),d=V(e,F.ON_EMAIL_CLONE_ID),l=V(e,F.ON_CODE_VALIDATE_ID),f=V(e,F.ON_SUBJECT_CHANGED_ID),u=V(e,F.ON_EMAIL_CHANGED_ID),g=V(e,F.ON_PREHEADER_CHANGED_ID),b=V(e,F.ON_SAVEBUTTON_CLICK_ID),E=V(e,F.ON_NEXTBUTTON_CLICK_ID),I=V(e,F.ON_SEND_LIVEPREVIEW_ID),v=V(e,F.ON_SEND_TESTEMAIL_ID),y=V(e,ff),w=V(e,F.ON_CONTENT_CHANGED_ID),S=V(e,uf),A=V(e,F.ON_PREVIOUSBUTTON_CLICK_ID),m=V(e,F.ON_SEND_EMAIL_MODAL_ID),c=Ls(V(e,F.ON_EMAIL_INIT_ID),a=>!a.reset);return{handlePreheaderChanged:L(g),handleSubjectChanged:L(f),handleValidate:L(l),handleReadEmail:L(n.handlerRead,a=>a,a=>a&&xe(a,e)),handleSaveEmail:L(n.onSave,function({prev:a,patch:p,value:h,source:_}){const T=a?Z(a,e):void 0;return{prev:T,patch:He(T,Z(p,e)),value:Z(h,e),source:_}},a=>a?xe(a,e):void 0),handleRemoveEmail:L(n.onRemove,({value:a,source:p})=>({value:Z(a,e),source:p}),()=>{}),handleReadCommonBlocks:L(y,a=>a.project,a=>a?.map(p=>Be(p,e))),handleReadTemplateBlocks:L(S,a=>a,a=>a?.map(p=>Be(p,e))),handleReadBlocks:L(t.byForeignKey("project").handleRead,a=>_t(e).requested||String(a),a=>a?.map(p=>Be(p,e))),handleSaveBlock:L(t.onSave,function({prev:a,patch:p,value:h,source:_}){const T=h.global_block===!0&&h.id&&typeof h.html=="string"?{...h,html:Mf(h.html,String(h.id))}:h,R=a?st(a,e):void 0;return{prev:R,patch:He(R,st(p,e)),value:st(T,e),source:_}},a=>a?Be(a,e):void 0),handleRemoveBlock:L(t.onRemove,({value:a,source:p})=>({value:st(a,e),source:p}),()=>{}),handleReadComments:L(r.byForeignKey("post").handleRead,a=>a,a=>a?.map(p=>fn(p,e))),handleSaveComment:L(r.onSave,function({prev:a,patch:p,value:h,source:_}){const T=a?at(a,e):void 0;return{prev:T,patch:He(T,at(p,e)),value:at(h,e),source:_}},a=>a?fn(a,e):void 0),handleRemoveComment:L(r.onRemove,({value:a,source:p})=>({value:at(a,e),source:p}),()=>{}),handleReadEmailRevisions:L(i.byForeignKey("parent").handleRead,a=>a,a=>a?.map(p=>pn(p,e))),handleEmailAutosave:L(i.onSave,function({prev:a,patch:p,value:h,source:_}){return{value:Dr(h,e),source:_}},a=>a?pn(a,e):void 0),handleRemoveEmailAutoSave:L(i.onRemove,({value:a,source:p})=>({value:Dr(a,e),source:p}),()=>{}),handleEmailChanged:L(Gn(u,Lr),a=>Z(a,e)),handleEmailInit:L(c,a=>Z(a,e)),handlePreviousButtonClick:L(A,a=>Z(a,e)),handleNextButtonClick:L(E,a=>Z(a,e)),handleSaveButtonClick:L(b,a=>Z(a,e)),handleHtmlChanged:L(Gn(w,Lr)),handleTestEmailSend:L(v,({html:a,...p})=>({...p,code:a,compiled:{html:a,ampHtml:""}})),handleTestEmailModal:L(m,a=>Z(a,e)),handleCloneEmail:L(d,a=>Z(a,e)),handleShareEmail:L(o),handlePreviewEmail:L(s),handleLivePreviewEmail:L(I)}}get(){return this._events||(this._events=this._get())}_listenersUpdaters;setOptions(e={}){const t=this.get();let n=this._listenersUpdaters;if(!n){n=this._listenersUpdaters={};for(const r of Object.keys(t))n[r]=this.addDisposable(new Pe(t[r]))}for(const r of Object.keys(t))n[r].setListener(e[r])}},Jf=O("DataController"),Qf=O("DataEvents");function Po(e){return e.getOrCreateInstance(Jf,()=>{const t=new Df(e);return e.getInstance(k)?.addDisposable(t),t})}function Ro(e){return e.getOrCreateInstance(Qf,()=>new Xf(e))}var Zf=O("plugin.startupShow");function ep(e){const t=Po(e),n=Ro(e),r=e.getInstance(oe),i=e.getInstance(k),o={current:Promise.resolve()};e.inject(Zf,o);const s=r?.watch(l=>{l&&n.setOptions(l)}),d=r?.select(l=>l?.content).watch(l=>{l!==void 0&&(G(J.showStart),o.current=(async()=>{try{await t.show(l)}catch{}finally{G(J.showEnd)}})())});s&&i?.addDisposable(s),d&&i?.addDisposable(d)}function tp(e){const t=Po(e);return{...Ro(e).get(),show(n){return G(J.showStart),t.show(n).finally(()=>G(J.showEnd))},save(){return t.save()}}}var np=[{name:"rest.client",setup:sf},{name:"auth.oauth",setup:ys},{name:"rest.identityHeaders",setup:ef},{name:"lifetime.destroyable",provides:[xn],setup:ru},{name:"appInit",provides:[Re,wn],setup:sa},{name:"config",provides:[we],setup:tu},{name:"email.documents",setup:_u},{name:"show.initPipeline",provides:[De],setup:af},{name:"show",setup:ep},{name:"locale.service",provides:[$e],setup:Xu},{name:"locale.fromConfig",awaits:{services:[we,$e]},setup:Ju},{name:"canvas.early",setup:rc},{name:"canvas.previewSettings",setup:uc},{name:"canvas.sandboxExtensions",setup:pc},{name:"canvas.headerSync",provides:[oo],setup:sc},{name:"canvas.ampSync",setup:Ml},{name:"canvas.moduleBridge",setup:od},{name:"canvas.port",setup:ql},{name:"canvas.images",setup:Hl},{name:"canvas.edits",setup:jd},{name:"canvas.blockContent",setup:xd},{name:"canvas.sandboxFill",provides:[Dn],setup:Dc},{name:"canvas.reactions",setup:ec}],rp=class extends Error{cycle;constructor(e){super(`[units] цикл в зависимостях: ${e.join(" → ")}`),this.cycle=e}};function ip(e){const t=new Map;for(const n of e)for(const r of n.provides??[]){const i=t.get(r)??[];i.push(n),t.set(r,i)}return t}function op(e,t){const n=[];for(const r of e.awaits?.services??[])for(const i of t.get(r)??[])i!==e&&n.push(i);return n}function Do(e){const t=ip(e),n=[],r=new Set,i=[],o=new Set,s=d=>{if(!r.has(d)){if(o.has(d)){const l=i.indexOf(d);throw new rp([...i.slice(l),d].map(f=>f.name))}o.add(d),i.push(d);for(const l of op(d,t))s(l);i.pop(),o.delete(d),r.add(d),n.push(d)}};for(const d of e)s(d);return n}var Mr;function Nn(e){const t=e.getInstance(oe);if(t)return t;e.getInstance(k)||e.inject(k,new Q);const n=Me();e.inject(oe,n),Mr??=Do(np);for(const r of Mr)r.setup(e);return n}function sp(e){}var ap=[{name:"save.previewFollow",setup:sp}],kr=O("plugin.lateUnitsInstalled");function lp(e){if(!e.getInstance(kr)){e.inject(kr,!0);for(const t of Do(ap))t.setup(e)}}function dp(e,t){return{project:Number(e),app_id:t?.app_id||0,app_config:t?.app_config||{},user:t?.user}}function cp(e){if(!e)return;const t=oi(e)?.data,n=t?.data?.scope??t?.scope;return(Array.isArray(n)?n.flatMap(r=>typeof r=="string"?r.split(/\s+/):[]):typeof n=="string"?n.split(/\s+/):[]).find(r=>/^project_\d+$/.test(r))?.replace(/^project_/,"")||void 0}var up=Le(e=>{let t,n,r;return{async setOptions(i){const o=r!==i.getAuthToken,s=!pt(t,i.user),d=n!==i.project;if(r=i.getAuthToken,t=i.user,n=i.project,!(!e.getInstance(me)||!i.getAuthToken)&&!(!o&&!s&&!d))try{const l=await i.getAuthToken(i.user,i.project);e.inject(vs,Promise.resolve(l||""));const f=cp(l);if(!f)return;e.inject(Os,f);const u=e.getInstance(Re),g=u?await u.catch(()=>{}):void 0;e.inject(Re,Promise.resolve(dp(f,g)))}catch{}}}});function fp(e,t){if(e.getInstance(qn))return;e.inject(qn,!0);const n=bn(e,F.FILE_PROXY_EVENT_ID);t.addDisposable(n(async({url:r})=>(await fetch(r)).blob(),Number.MIN_VALUE))}function pp(e){e.getInstance(Rs)||e.inject(me,void 0)}function St(e){return String(e.standaloneKey||"").trim()||void 0}function mp(e){return e.standaloneOnAuthFailure===!0?!0:e.config?.standaloneOnAuthFailure===!0}function Fn(e){return mp(e)?!!St(e):!1}function It(e){return!!St(e)&&!Fn(e)}var hp=Le(e=>{let t,n=!1;return{setOptions(r){const i=n;if(n=!0,!It(r)){t&&(pp(e),Fn(r)),t=void 0;return}const o=St(r);if(!o||t===o&&e.getInstance(me))return;t=o,e.inject(me,o);const s=e.getInstance(k);s&&fp(e,s)}}}),gp=Le(e=>{const t=e.getInstance(k),n=bn(e,ri),r=L(n),i=t.addDisposable(new Pe(r));return{setOptions({handleLoad:o}){i.setListener(o)},instance:{handleLoad:r},dispose:()=>t.dispose()}}),vp=Le(e=>{const t=e.getInstance(k),n=t.addDisposable(new pe),r=t.addDisposable(new pe),i=si(e,Ko),o=L(n.event),s=L(r.event),d=L(i.event),l=t.addDisposable(new Pe(o)),f=t.addDisposable(new Pe(s)),u=t.addDisposable(new Pe(d));return{instance:{handleSetOptions:o,handleOptionsChanged:s,handleConfigChanged:d},async setOptions(g){l.setListener(g.handleSetOptions),f.setListener(g.handleOptionsChanged),u.setListener(g.handleConfigChanged),await n.fire(g),await r.fire(g)},dispose(){}}}),Ft,Oo="core";function bp(){const e=window.__emailmaker__?.require;return typeof e!="function"?Promise.reject(new Error("[loadCore] AMD loader is unavailable")):new Promise((t,n)=>{e([Oo],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadCore] Failed to require core module")))})}function Ep(e){const t=window.__emailmaker__?.require?.warm;return typeof t!="function"?Je().then(()=>{}):t([Oo],e)}function Je(){return Ft===void 0&&(Ft=bp().then(e=>(qe()&&e.installDiagnostics().catch(t=>{}),e))),Ft}var jt=null,Bt=null;async function yp(e){typeof e?.prefetch=="function"&&await e.prefetch()}function jn(){return jt||(jt=Je().then(()=>{})),jt}function xo(e){return Bt||(Bt=yp(e)),Bt}function _p(){return xo(typeof window.__emailmaker__<"u"?window.__emailmaker__:void 0)}function wp(e){return Promise.all([jn(),xo(e)]).then(()=>{})}function Sp(e){const t=e?.preload?.start??e?.startupPrefetchMode;return t==="eager"||t==="idle"||t==="manual"||t==="off"?t:"idle"}function Nr(e,t){const n=e?.preload?.execute!==!1;Promise.resolve().then(()=>Ep(t?{priority:t}:void 0)).then(()=>n?jn():void 0).catch(()=>{})}function Ip(e){const t=Sp(e);if(t==="eager")Nr(e);else if(t==="idle"){const n=()=>Nr(e,"low");document.readyState==="complete"?n():window.addEventListener("load",n,{once:!0})}}var Lo="PluginRegistry";function Tp(e=Yo()){return e.getOrCreateInstance(Lo,()=>new Hs)}var Ap=new Gs(()=>Tp()),Cp=Le(e=>{let t;function n(){if(!t)throw new Error("PluginCollection not initialized. Call init() first.");return t}return{async setOptions(r){const i=e.getInstance(Et),o=e.getInstance(Lo);t||(t=new Us(i,o,{ensureHostRuntimeReady:_p}),e.inject(Xt,t));const s=r?.plugins||[];i&&await t.setPlugins(s)},instance:{use(r){return typeof r=="function"?n().useByCtor(r):n().useByKey(r)},useAsync(r){return n().useAsync(r)},waitPlugin(r){return n().waitFor(r)}},dispose(){t?.dispose(),t=void 0}}}),Mo=class{_listeners=[];add(e,t=0,n){const r={fn:n?e.bind(n):e,priority:t};return this._listeners.push(r),{dispose:()=>{const i=this._listeners.indexOf(r);i>=0&&this._listeners.splice(i,1)}}}async run(e){const t=[...this._listeners].sort((n,r)=>r.priority-n.priority);for(const{fn:n}of t){const r=await n(e);r!==null&&typeof r=="object"&&!Array.isArray(r)&&!(r instanceof Date)&&!(r instanceof RegExp)&&Object.assign(e,r)}return e}},Pp=O("ELEMENT_INSERT_HTML_PIPELINE"),Rp=O("BLOCK_INSERT_HTML_PIPELINE"),Dp="application_block_inserted",Op=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(Rp,()=>new Mo).add(e,t??0,n)}handleInject(e,t,n){const r=this._container.getOrCreateInstance(We,()=>new Ye),i=n?e.bind(n):e;return r.addListener(Dp,i,t)}},xp=O("ComponentRegistry"),Fr;function ze(e,t=xp){const n=ft.getInstance(t);if(n)return n;if(!Fr)throw new Error("[extensions] component registry is not loaded yet — UI work starts at init()");return ft.getOrCreateInstance(t,Fr)}var Lp=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}getNames(){return new Promise(e=>{const t=this._container.addService(Ze,{execute:n=>{t.dispose(),e(n.value.map(r=>({name:r.name,html:r.html})))}})})}update(e,t){const n=this._container,r=ze(n);return n.addService(Ze,{execute:i=>{const o=i.value.find(s=>s.name===e);if(o){const{icon:s,title:d,fallbackTooltip:l,...f}=t;s&&(o.icon=r.getReactNode(s)),d&&(o.title=r.getReactNode(d)),l&&(o.fallbackTooltip=r.getReactNode(l)),Object.assign(o,f)}}})}delete(e){this._container.addService(Ze,{execute:t=>{const n=t.value.findIndex(r=>r.name===e);n>=0&&t.value.splice(n,1)}})}insert(e,t){const n=this._container,r=ze(n);return n.addService(Ze,{execute:i=>{i.value.splice(t??i.value.length,0,{...e,title:r.getReactNode(e.title),icon:r.getReactNode(e.icon),fallbackTooltip:r.getReactNode(e.fallbackTooltip)})}})}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(Pp,()=>new Mo).add(e,t??0,n)}handleInject(e,t,n){return Ce(this._container,ss).event(r=>{e({name:r.name,className:r.className||"",html:r.html})},t,n)}},Mp=class{_messageService;constructor(e){this._messageService=e.container.getOrCreateInstance(We,()=>new Ye)}send(e,t,n){this._messageService.send(e,t,n)}sendAsync(e,t,n=!0){return this._messageService.sendAsync(e,t,n)}addListener(e,t,n){return this._messageService.addListener(e,t,n)}addListenerAsync(e,t,n=0){return this._messageService.addListenerAsync(e,t,n)}onInit(e,t=!0,n=0){return this._messageService.onInit(e,t,n)}isInited(){return this._messageService.isInited()}};function kp(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>n!==void 0))}var Np=class{_context;_showModalEmitter;_closeModalEmitter;_updateModalEmitter;constructor(e){this._context=e;const t=e.container;this._showModalEmitter=Ce(t,is),this._closeModalEmitter=Ce(t,ts),this._updateModalEmitter=Ce(t,as)}get _container(){return this._context.container}show(e){const t=ze(this._container),n=`modal_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,r=e.modalProps;return this._showModalEmitter.fire({...e,content:t.getReactNode(e.content),title:t.getReactNode(e.title),id:n,modalProps:r?{...r,footer:t.getReactNode(r.footer),okText:t.getReactNode(r.okText),cancelText:t.getReactNode(r.cancelText),closeIcon:t.getReactNode(r.closeIcon)}:void 0}),n}close(e){this._closeModalEmitter.fire(e)}closeAll(){this._closeModalEmitter.fire()}update(e,t){const n=ze(this._container),r=t.modalProps;this._updateModalEmitter.fire(kp({...t,content:n.getReactNode(t.content),title:n.getReactNode(t.title),id:e,modalProps:r?{...r,footer:n.getReactNode(r.footer),okText:n.getReactNode(r.okText),cancelText:n.getReactNode(r.cancelText),closeIcon:n.getReactNode(r.closeIcon)}:void 0}))}},Fp=class{_registration;_loadedDisposable;loaded;ready;_loadedSettled=!1;_readySettled=!1;constructor(e,t){this._registration=e,this._loadedDisposable=t,this.loaded=new Promise((n,r)=>{const i=()=>this._loadedDisposable.dispose(),o=()=>{this._loadedSettled||(this._loadedSettled=!0,this._readySettled&&i(),n())},s=d=>{this._loadedSettled||(this._loadedSettled=!0,this._readySettled&&i(),r(d))};this._resolveLoaded=o,this._rejectLoaded=s}),this.ready=new Promise((n,r)=>{const i=()=>this._loadedDisposable.dispose(),o=()=>{this._readySettled||(this._readySettled=!0,this._loadedSettled&&i(),n())},s=d=>{this._readySettled||(this._readySettled=!0,this._loadedSettled&&i(),r(d))};this._resolveReady=o,this._rejectReady=s})}_resolveLoaded=()=>{};_rejectLoaded=()=>{};_resolveReady=()=>{};_rejectReady=()=>{};resolveLoaded(){this._resolveLoaded()}resolveReady(){this._resolveReady()}rejectLoad(e){this._rejectLoaded(e),this._rejectReady(e)}rejectReady(e){this._rejectReady(e)}dispose(){this._registration.dispose();const e=new Error("Sandbox script registration disposed before completion.");this.rejectLoad(e),this.rejectReady(e)}},jp=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}get _messageService(){return this._container.getOrCreateInstance(We,()=>new Ye)}_createScriptHandle(e,t){const n=this._messageService.addListener(Xo,i=>{if(i.key===e){if(i.phase==="load"&&i.status==="success"){r.resolveLoaded();return}if(i.phase==="ready"&&i.status==="success"){r.resolveReady();return}if(i.phase==="load"){r.rejectLoad(new Error(i.error||`Sandbox script "${e}" failed to load.`));return}r.rejectReady(new Error(i.error||`Sandbox script "${e}" failed to initialize.`))}}),r=new Fp(t,n);return r}registerSandboxCSS(e){return this._container.addService(Te,{type:"link",key:e,parent:"head",attributes:{rel:"stylesheet",type:"text/css",href:e}})}registerSandboxCSSCode(e,t){return this._container.addService(Te,{type:"style",key:e,parent:"head",attributes:{type:"text/css"},innerHTML:t})}registerSandboxScript(e){const t=this._container.addService(Te,{type:"script",key:e,parent:"head",attributes:{src:e,type:"text/javascript"}});return this._createScriptHandle(e,t)}registerSandboxScriptCode(e,t){const n=this._container.addService(Te,{type:"script",key:e,parent:"head",attributes:{type:"text/javascript"},innerHTML:t});return this._createScriptHandle(e,n)}},Bp=new Set([Symbol.for("react.element"),Symbol.for("react.transitional.element")]);function hn(e){if(typeof e!="object"||e===null)return!1;const t=e.$$typeof;return typeof t=="symbol"&&Bp.has(t)}function ko(){const e=globalThis.crypto;if(e&&typeof e.randomUUID=="function")return e.randomUUID();if(e&&typeof e.getRandomValues=="function"){const t=new Uint8Array(16);return e.getRandomValues(t),Array.from(t,n=>n.toString(16).padStart(2,"0")).join("")}return`nohwcrypto-${Date.now()}`}function Ut(){return`__settingsPanel:${ko()}`}function Ht(e,t){return{type:e,props:t}}function Up(e){return typeof e=="object"&&e!==null&&"type"in e&&"props"in e&&!hn(e)}function jr(e,t,n){if(t==null||typeof t=="number"||typeof t=="boolean"||typeof t=="string")return t;if(hn(t)){const r=Ut();return n(e.add(r,t)),Ht(r,{})}if(typeof t=="function"){const r=Ut();return n(e.add(r,t)),Ht(r,{})}if(Up(t)){const r=t.type;if(typeof r=="string")return t;if(hn(r)||typeof r=="function"){const i=Ut();return n(e.add(i,r)),Ht(i,t.props)}return t}return t}var Hp=class{_context;_panelRegistrationDisposables=[];constructor(e){this._context=e}get _container(){return this._context.container}_clearPanelRegistrations(){for(const e of this._panelRegistrationDisposables)e.dispose();this._panelRegistrationDisposables.length=0}_trackRegistration(e){this._panelRegistrationDisposables.push(e)}showSettingsPanel(e){this._clearPanelRegistrations();const t=ze(this._container),n=s=>this._trackRegistration(s),r=jr(t,e.content,n),i=e.advancedTabs?.map(s=>({...s,content:jr(t,s.content,n)})),o=e.instanceKey??ko();Ce(this._container,Hn).fire({...e,content:r,advancedTabs:i,instanceKey:o,type:os})}closeSettingsPanel(){this._clearPanelRegistrations(),Ce(this._container,Hn).fire(null)}},No={SandboxScriptApi:jp,ElementsApi:Lp,BlocksApi:Op,MessageService:Mp,SettingsPanelApi:Hp,ModalApi:Np};function Gt(e,t,n,r={}){const i=Object.assign({},e);for(const[o,s]of Object.entries(t))if(s!==void 0)if(n.includes(o)&&typeof s=="object"&&s!==null){const d=i[o],l=r[o]??{};i[o]=Object.assign({},typeof d=="object"&&d!==null?d:l,s)}else i[o]=s;return i}var ee={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}},Gp={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"},qt={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},Br={color:"#1C52DC",contrastColor:"#FFFFFF",underline:!0},Ie={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:ee.border,borderRadius:ee.borderRadius,textAlign:"center",padding:ee.padding},Ur={backgroundColor:"#FFFFFF",contrastBackgroundColor:"#1C52DC",padding:ee.padding},$t={contrastBackgroundColor:"#1C52DC",contrastTextColor:"#FFFFFF",baseBackgroundColor:"#F8F8F8",baseTextColor:"#333333",border:ee.border,borderRadius:ee.borderRadiusCards};function qp(e){return{...Gp,...e}}function $p(e){return{...qt,...e,bold:e?.bold??qt.bold,italic:e?.italic??qt.italic}}function zp(e){return{...Br,...e,underline:e?.underline??Br.underline}}function Vp(e){return{...Ie,...e,bold:e?.bold??Ie.bold,italic:e?.italic??Ie.italic,border:{...Ie.border,...e?.border},borderRadius:{...Ie.borderRadius,...e?.borderRadius},padding:{...Ie.padding,...e?.padding}}}function Kp(e){return{...Ur,...e,padding:{...Ur.padding,...e?.padding}}}function Wp(e){return{...$t,...e,border:{...$t.border,...e?.border},borderRadius:{...$t.borderRadius,...e?.borderRadius}}}function zt(e={}){return{backgroundColor:e.backgroundColor||"",backgroundImage:(e.backgroundImage||[]).map(t=>({type:"url",value:t?.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}}function Hr(e){let t={...vn};try{e&&e!=="{}"&&(t=JSON.parse(e))}catch{}return t}function Vt(e){return{text:qp(e.text),headings:$p(e.headings),links:zp(e.links),buttons:Vp(e.buttons),block:Kp(e.block),cards:Wp(e.cards)}}var Gr=O("EmailSettingsPort"),Yp=1e4,Fo=class{_editor;_layoutSettingsChanged=new Jt;_contentStylesChanged=new Jt;_messageSubscription;_messageSubscriptionPromise;_prevLayoutSnapshot;_prevContentSnapshot;constructor(e){this._editor=e}onChangeEmailLayoutSettings(e){const t=this._layoutSettingsChanged.event(e);return this._ensureMessageSubscription(),{dispose:()=>{t.dispose(),this._disposeMessageSubscriptionIfUnused()}}}onChangeEmailContentStyles(e){const 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)}_settings(e=this._editor.container){const t=e.getInstance(Gr);if(!t)throw new Error("[extensions] настройки письма ещё не загружены — работа с UI начинается с init()");return t}_getCurrentLayoutSettings(){return zt(this._settings().read())}_getCurrentContentStyles(){const e=Ct(this._editor.container)?.current()?.get().attributes.common_styles;return Vt(Hr(e))}_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()=>{if(await this._editor.container.getInstanceAsync(Gr),this._messageSubscription)return;const e=this._editor.container.getOrCreateInstance(We,()=>new Ye),t=this._getCurrentLayoutSettings(),n=this._getCurrentContentStyles();this._prevLayoutSnapshot=this._getLayoutSnapshot(t),this._prevContentSnapshot=this._getContentSnapshot(n),this._messageSubscription=e.addListener(r=>{const i=r?.data,o=i?.operation;if(o===M.APPLICATION_EMAIL_SETTINGS_SET){const l=zt(i?.settings),f=this._getLayoutSnapshot(l);f!==this._prevLayoutSnapshot&&(this._prevLayoutSnapshot=f,this._layoutSettingsChanged.fire(l));return}if(o!==M.APPLICATION_COMMON_STYLES_UPDATE)return;const s=Vt(r.data?.settings?.commonStyles??{...vn}),d=this._getContentSnapshot(s);d!==this._prevContentSnapshot&&(this._prevContentSnapshot=d,this._contentStylesChanged.fire(s))})})();try{await this._messageSubscriptionPromise}finally{this._messageSubscriptionPromise=void 0}}}async getEmailLayoutSettings(){return await this._waitForEmailSettingsFromIframe(),this._getCurrentLayoutSettings()}async setEmailLayoutSettings(e){await this._waitForEmailSettingsFromIframe();const t=this._settings(),n={...t.read(),...e};t.write(n);const r=zt(n);this._prevLayoutSnapshot=this._getLayoutSnapshot(r),this._layoutSettingsChanged.fire(r)}async _waitForEmailSettingsFromIframe(e=Yp){const t=Ct(this._editor.container)?.current()?.get().attributes.is_inited,n=this._settings().read();if(t&&n&&Object.keys(n).length>0&&(n.backgroundColor||n.backgroundImage?.[0]?.value||n.width?.value||n.responsive!==void 0)||t)return;const r=this._editor.container,i=bn(r,F.ON_EMAIL_INIT_ID);return new Promise(o=>{let s=!1,d;const l=()=>{d&&(clearTimeout(d),d=void 0)},f=i(()=>{s||(s=!0,l(),f.dispose(),o())});d=setTimeout(()=>{s||(s=!0,f.dispose(),o())},e)})}async getEmailContentStyles(){return this._getCurrentContentStyles()}async setEmailContentStyles(e){const t=Ct(this._editor.container)?.current();if(!t)return;const n=Hr(t.get().attributes.common_styles);e.text!==void 0&&(n.text={...n.text||{},...e.text}),e.headings!==void 0&&(n.headings={...n.headings||{},...e.headings}),e.links!==void 0&&(n.links={...n.links||{},...e.links}),e.buttons!==void 0&&(n.buttons=Gt(n.buttons||{},e.buttons,["border","borderRadius","padding"],{border:ee.border,borderRadius:ee.borderRadius,padding:ee.padding})),e.block!==void 0&&(n.block=Gt(n.block||{},e.block,["padding"],{padding:ee.padding})),e.cards!==void 0&&(n.cards=Gt(n.cards||{},e.cards,["border","borderRadius"],{border:ee.border,borderRadius:ee.borderRadiusCards}));const r=JSON.stringify(n);ht(t,{common_styles:r}),this._settings().markAppearanceChanged();const i=Vt(n);this._prevContentSnapshot=this._getContentSnapshot(i),this._contentStylesChanged.fire(i)}},Xp={...No,EmailSettingsApi:Fo},Jp={...No},fh={...Jp,EmailSettingsApi:Fo},Qp={...Xp};function Zp(){Ap.addAll(Qp)}var em=[Le(()=>{Zp()}),gp,vp,hp,_s,up,Cs];async function tm(){return(await Je()).asyncMixins}var nm=Cp,rm=e=>{let t=null,n=!1;return{instance:{},async setOptions(r){if(!t&&!n){let i;try{i=await tm()}catch(s){throw e.failPendingWaits(s),s}t=i(e);const o=await e.getInstanceAsync(Et);Object.assign(o,t.instance||{})}t&&await t.setOptions(r)},dispose(){t?.dispose(),n=!0}}},im=ms([...em]);function Kt(){let e,t=!1;const n=new Map,r=new Map;function i(){for(const o of r.values())o();r.clear()}return{event(o,s,d){const l=Symbol("subscription");return t||(n.set(l,{listener:o,priority:s,thisArg:d}),e&&r.set(l,e(o,s,d))),()=>{n.delete(l),r.get(l)?.(),r.delete(l)}},attach(o){i(),e=o;for(const[s,{listener:d,priority:l,thisArg:f}]of n)r.set(s,o(d,l,f))},dispose(){t=!0,i(),n.clear(),e=void 0}}}var qr=O("NotificationService");function om(e){const t=Kt(),n=Kt(),r=Kt();return e.getInstance(k)?.addDispose(()=>{t.dispose(),n.dispose(),r.dispose()}),e.getInstanceAsync(qr).then(i=>{t.attach(i.onNotify),n.attach(i.onError),r.attach(i.onSuccess)},()=>{}),{handleNotify:t.event,handleError:n.event,handleSuccess:r.event,notify(i){const o=e.getInstance(qr);if(!o)throw new Error("[plugin] notify() вызван до загрузки редактора");o.notify(i)}}}var sm=[iu,tp,om];function am(e,t=sm){const n=Nn(e);lp(e);const r=im(e),i=nm(e),o=rm(e),s={...r.instance,...i.instance,...o.instance};for(const l of t)Object.assign(s,l(e));let d=!0;return{instance:s,async setOptions(l){await r.setOptions(l);const f=d&&n.get()===l;d=!1,f||n.set(l),await i.setOptions(l),await o.setOptions(l)}}}var lm=class{_storage=Object.create(null);get(e){const 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]}},dm="editor-runtime.react.copies",Wt=8;function Ve(e){return e&&typeof e=="object"?e:void 0}function $r(e){const t=Ve(e);if(!t)return;if(typeof t.useState=="function")return t.useState;const n=Ve(t.default);return n&&typeof n.useState=="function"?n.useState:void 0}function cm(e){const t=Ve(e),n=t&&typeof t.version=="string"?t.version:void 0,r=Ve(t?.default),i=r&&typeof r.version=="string"?r.version:void 0;return n??i??"unknown"}function um(e,t,n){return e.package===t&&e.version===n}function fm({ourReact:e,entries:t,packageName:n,version:r}){const i=$r(e);if(!i||!Array.isArray(t))return[];const o=[],s=new Set;for(const d of t){const l=Ve(d);if(!l||!um(l,n,r))continue;const f=$r(l.react);!f||f===i||s.has(f)||(s.add(f),o.push({package:n,version:r,reactVersion:cm(l.react),react:l.react}))}return o}function pm({packageName:e,copies:t}){const n=[`[${e}] A second copy of React is on this page (singleton invariant broken).`,`The editor runs on its own React, the plugin got another one from ${e}/runtime/react.`,`This shows up as "Cannot read properties of null (reading 'useState')" and takes down the whole`,"editor, not just the plugin panel: plugin components render inside the editor tree.","","Found:"];for(const r of t.slice(0,Wt))n.push(` • React ${r.reactVersion}, loaded through ${r.package}@${r.version}/runtime/react`);return t.length>Wt&&n.push(` …and ${t.length-Wt} more`),n.push("","Likely root cause: the editor is loaded from its UMD entry (a <script> on the page), while the","plugin was built as an ESM package by the host bundler. Those two never share a React.","","Fix it either way:"," • build the plugin on globals — it then takes React from the page registry, or"," • load the editor from its ESM entry and build both with the same bundler."),n.join(`
1047
- `)}var zr=new Set;function mm({packageName:e="@emailmaker/emailmaker",version:t="1.1.85-dev.2",log:n=r=>{}}={}){const r=i=>{try{const o=globalThis[Symbol.for(dm)],s=fm({ourReact:i,entries:o,packageName:e,version:t}).filter(d=>!zr.has(d.react));if(!s.length)return;s.forEach(d=>zr.add(d.react)),n(pm({packageName:e,copies:s}))}catch{}};try{const i=_n()?.modules?.React;if(i&&typeof i.then=="function"){i.then(r,()=>{});return}r(i)}catch{}}async function hm(e,t){$(e.signal);const n=t??ft.createChild();Nn(n);const r=n.getInstance(k);async function i(){n.inject(Wo,new lm),mm();const o=am(n),s={...o.instance,container:n,async reset(d){if($(d.signal),r.isDisposed())throw di();return await o.setOptions(d),s}};n.inject(Et,s);try{if(await o.setOptions(e),$(e.signal),r.isDisposed()||await n.getInstance(Xt)?.activate(),e.devTools)try{const d=n.getInstance(Xt);d&&await(await Je()).initDevTools(n,d)}catch{}return $(e.signal),si(n,ri).fire(s),s}catch(d){throw r.dispose(),d}}try{return await yn(i(),e.signal)}catch(o){throw r.isDisposed()||r.dispose(),o}}var Ke=new WeakMap;function gm(e){return e?Ke.get(e):void 0}function jo(e){try{e.getInstance(k)?.dispose()}catch{}try{e.dispose()}catch{}}function vm(e,t){if(!e)return;const n=Ke.get(e);n&&n!==t&&jo(n),Ke.set(e,t)}function bm(e,t){e&&Ke.get(e)===t&&Ke.delete(e)}function Em(e){const t=ft.createChild();return It(e)&&t.inject(me,St(e)),t}var Ge=new WeakMap,ym="data-emailmaker-config-styles";function _m(e){return typeof e=="string"?e.trim():""}function Vr(e,t){if(e.firstChild){e.insertBefore(t,e.firstChild);return}e.appendChild(t)}function wm(e,t,n){if(!e||typeof document>"u")return null;const r=_m(t),i=Ge.get(e),o=n||e;if(!r)return i&&(i.remove(),Ge.delete(e)),null;if(i)return i.textContent!==r&&(i.textContent=r),(i.parentNode!==o||i!==o.firstChild)&&Vr(o,i),i;const s=document.createElement("style");return s.setAttribute(ym,"true"),s.textContent=r,Vr(o,s),Ge.set(e,s),s}function Sm(e){if(!e)return;const t=Ge.get(e);t&&(t.remove(),Ge.delete(e))}function Bo(){return!1}var Im=`
1047
+ `)}var zr=new Set;function mm({packageName:e="@emailmaker/emailmaker",version:t="1.1.85-dev.3",log:n=r=>{}}={}){const r=i=>{try{const o=globalThis[Symbol.for(dm)],s=fm({ourReact:i,entries:o,packageName:e,version:t}).filter(d=>!zr.has(d.react));if(!s.length)return;s.forEach(d=>zr.add(d.react)),n(pm({packageName:e,copies:s}))}catch{}};try{const i=_n()?.modules?.React;if(i&&typeof i.then=="function"){i.then(r,()=>{});return}r(i)}catch{}}async function hm(e,t){$(e.signal);const n=t??ft.createChild();Nn(n);const r=n.getInstance(k);async function i(){n.inject(Wo,new lm),mm();const o=am(n),s={...o.instance,container:n,async reset(d){if($(d.signal),r.isDisposed())throw di();return await o.setOptions(d),s}};n.inject(Et,s);try{if(await o.setOptions(e),$(e.signal),r.isDisposed()||await n.getInstance(Xt)?.activate(),e.devTools)try{const d=n.getInstance(Xt);d&&await(await Je()).initDevTools(n,d)}catch{}return $(e.signal),si(n,ri).fire(s),s}catch(d){throw r.dispose(),d}}try{return await yn(i(),e.signal)}catch(o){throw r.isDisposed()||r.dispose(),o}}var Ke=new WeakMap;function gm(e){return e?Ke.get(e):void 0}function jo(e){try{e.getInstance(k)?.dispose()}catch{}try{e.dispose()}catch{}}function vm(e,t){if(!e)return;const n=Ke.get(e);n&&n!==t&&jo(n),Ke.set(e,t)}function bm(e,t){e&&Ke.get(e)===t&&Ke.delete(e)}function Em(e){const t=ft.createChild();return It(e)&&t.inject(me,St(e)),t}var Ge=new WeakMap,ym="data-emailmaker-config-styles";function _m(e){return typeof e=="string"?e.trim():""}function Vr(e,t){if(e.firstChild){e.insertBefore(t,e.firstChild);return}e.appendChild(t)}function wm(e,t,n){if(!e||typeof document>"u")return null;const r=_m(t),i=Ge.get(e),o=n||e;if(!r)return i&&(i.remove(),Ge.delete(e)),null;if(i)return i.textContent!==r&&(i.textContent=r),(i.parentNode!==o||i!==o.firstChild)&&Vr(o,i),i;const s=document.createElement("style");return s.setAttribute(ym,"true"),s.textContent=r,Vr(o,s),Ge.set(e,s),s}function Sm(e){if(!e)return;const t=Ge.get(e);t&&(t.remove(),Ge.delete(e))}function Bo(){return!1}var Im=`
1048
1048
  .blocks-app-initial-spinner-wrapper {
1049
1049
  width: 100%;
1050
1050
  height: 100%;
@@ -1073,7 +1073,7 @@ import{t as ei}from"./static/esm/50fbfdf6.js";import{$ as Ko,A as Wo,At as Yo,B
1073
1073
  100% {
1074
1074
  transform: rotate(360deg);
1075
1075
  }
1076
- }`;function Tm(){return()=>{}}function Am(e,t){if(!Bo()||!e||typeof document>"u")return Tm();e.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(s=>{s.remove()});const n=document.createElement("div");n.classList.add("blocks-app-initial-spinner-wrapper");const r=document.createElement("div");r.classList.add("blocks-app-initial-spinner"),n.appendChild(r);const i=document.createElement("style");i.setAttribute(t,"true"),i.textContent=Im,document.head?.appendChild(i),e.appendChild(n);let o=!1;return()=>{o||(o=!0,n.remove(),i.remove())}}function Cm(e){if(!(e instanceof Error))return!1;const t=e;return t.terminal===!0||t.status===403||t.status===404}function Pm({report:e}={}){const t=new Map,n=new Set,r=e??(i=>{});return{run(i,o){const s=t.get(i);if(s!==void 0)return s;const d=o().catch(l=>{throw n.has(i)||(n.add(i),r(l)),Cm(l)||t.delete(i),l});return t.set(i,d),d},clear(){t.clear(),n.clear()},size(){return t.size}}}var Bn=Pm();function Uo(){Bn.clear()}Jo(()=>Bn.clear());var Kr=new WeakMap,Wr=new WeakMap;function Rm(e,t){let n=Wr.get(t);n||(n=new Map,Wr.set(t,n));const r=n.get(e);if(r!==void 0)return r;const i=t.getInstance(ti),o=Ms({baseUrl:e,customFetch:i?.execute??fetch},t);return n.set(e,o),o}function Un(e){return ls(e)}function Dm(e,t){const n=new Error(`[Loader] appInit request failed: ${e} ${t}`);return n.status=e,n}function Om(){const e=new Error("[Loader] appInit skipped: empty auth token");return e.terminal=!0,e}async function xm(e){if(!e.getAuthToken)return;const t=await e.getAuthToken(e.user,e.project,void 0),n=String(t||"").trim();return n?`Bearer ${n}`:void 0}function Lm(e,t){return async({baseUrl:n})=>{const r=Un(n);if(!r)throw new Error("[Loader] appInit requires baseUrl or REACT_APP_OPENAPI_BASE_URL");const i=new Headers({Accept:"application/json"});if(e.getAuthToken&&!await xm(e))throw Om();const o=t();if(!o)throw new Error("[Loader] appInit requires the instance container");const s=new ui(Rm(r,o)),d={headers:Object.fromEntries(i.entries()),credentials:"same-origin",failoverAttemptTimeout:Fn(e)||void 0},l=await s.app_init_create({},d);if(!l.ok)throw Dm(l.status,l.statusText);return l.data}}function Mm(e){return JSON.stringify({baseUrl:Un(e.baseUrl)||"",project:e.project??"",userId:e.user?.id??""})}function km(e){return e.appInit?!0:!(e.jwtAuth&&!e.getAuthToken)}function Nm(e){return t=>Bn.run(Mm(t),()=>(G("appInit:start",{kind:"network"}),Promise.resolve(e(t)).finally(()=>G("appInit:end",{kind:"network"}))))}function Fm(e,t){if(It(e)||!e.appInit&&!Un(e.baseUrl)||!km(e))return e;const n=e.appInit??Lm(e,t);let r=Kr.get(n);return r||(r=Nm(n),Kr.set(n,r)),{...e,appInit:r}}var Ho=0;function jm(){return Ho}function Bm(){Ho+=1,Uo()}var Yr=new WeakMap,Xr=new WeakMap,Um=3e4;function Hm(e,t){return JSON.stringify({userId:e?.id??"",project:t??""})}function Gm(e,t){try{const n=oi(e)?.exp;if(typeof n=="number"&&Number.isFinite(n)&&n>0)return n*1e3}catch{}return t+Um}function qm(e){const t=new Map,n=new Map;return async(r,i,o)=>{const s=Hm(r,i);if(o)return n.delete(s),t.delete(s),Uo(),e(r,i,o);const d=n.get(s);if(d&&!t.has(s)){if(d.expiresAtMs>Date.now())return d.token;n.delete(s)}let l=t.get(s);return l===void 0&&(G("authToken:start",{kind:"network"}),l=Promise.resolve(e(r,i,o)).then(f=>{const u=String(f||"").trim();return u&&n.set(s,{token:f,expiresAtMs:Gm(u,Date.now())}),f}).finally(()=>{G("authToken:end",{kind:"network"}),t.delete(s)}),t.set(s,l)),l}}function $m(e){if(It(e))return e;const t=e.getAuthToken;if(!t)return e;let n=Yr.get(t);const r=jm();return(!n||Xr.get(t)!==r)&&(n=qm(t),Yr.set(t,n),Xr.set(t,r)),Promise.resolve(n(e.user,e.project,void 0)).catch(i=>{}),{...e,getAuthToken:n}}var Go="Editor mount element was removed from the document. Call instance.destroy() on host unmount.";function zm(){return te(Go)}function Vm(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===Go}function Km(e,t,n){if(typeof document>"u")return;let r=!1,i;const o=()=>{r=!0,i?.disconnect(),i=void 0},s=()=>{r||(o(),t())};if(n.addDispose(o),!e.isConnected){queueMicrotask(s);return}i=new MutationObserver(()=>{e.isConnected||s()});let d=e.parentNode;for(;d;)i.observe(d,{childList:!0}),d=d.parentNode}function Wm(e){const{hostElementOption:t,resolvedElement:n,externalSignal:r,disposable:i}=e;if(t===void 0||!(n instanceof Element))return r;const o=new AbortController;return Km(n,()=>{n.id,o.abort(zm())},i),ai(r,o.signal)}var qo="Superseded by newer init() on the same mount element";function Jr(){return te(qo)}function Ym(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===qo}var lt=new Map,dt=new WeakMap;function Xm(e){if(e instanceof Element){const t=e.id?.trim();if(t)return`#${t}`}}function Jm(e){if(!e)return{release:()=>{}};const t=Xm(e);dt.get(e)?.abort(Jr()),t&&lt.get(t)?.abort(Jr());const n=new AbortController;return dt.set(e,n),t&&lt.set(t,n),{signal:n.signal,release:()=>{dt.get(e)===n&&dt.delete(e),t&&lt.get(t)===n&&lt.delete(t)}}}var ph=ei({FileManagerApiError:()=>Qm}),Qm=class $o extends Error{code;status;details;get httpStatus(){return this.status}constructor(t,n,r,i){super(t),this.name="FileManagerApiError",this.code=n,this.status=r,this.details=i,Error.captureStackTrace&&Error.captureStackTrace(this,$o)}},mh=ei({mapHttpStatusToErrorCode:()=>es});function Zm(e,t){return{...e,element:t}}function gn(){return()=>{}}function eh(e){const t=e.element;return!t||typeof t=="string"||typeof document>"u"?gn():(wm(t,e.config?.styles,t),()=>{Sm(t)})}function th(e){if(!Bo()||e.initialSpinner===!1||typeof document>"u")return{options:e,cleanup:gn()};const t=e.element;if(!t||typeof t=="string")return{options:e,cleanup:gn()};t.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(i=>{i.remove()});const n=Am(t,"data-emailmaker"),r=e.handleChunkLoaded;return{options:{...e,handleChunkLoaded:()=>{n(),r?.()}},cleanup:n}}function Qr(e){return e instanceof DOMException&&e.name==="AbortError"}function Zr(e){try{e.destroy()}catch{}}function Yt(e,...t){const n=ce.get(e);t.some(r=>r!==void 0&&r===n)&&ce.delete(e)}var hh="1.1.85-dev.2";async function gh(e){await wp(typeof window.__emailmaker__<"u"?window.__emailmaker__:void 0)}async function vh(e){G(J.initStart);const t=await nh(e);return G(J.initEnd),t}async function nh(e){$(e.signal);const t=new Q;let n;try{const r=await Ts(e.element,t,e.signal),i=Wm({hostElementOption:e.element,resolvedElement:r,externalSignal:e.signal,disposable:t}),o=Jm(r);n=o.release;const s=ai(i,o.signal);return await yn(rh(e,r,s),s)}finally{n?.(),t.dispose()}}async function rh(e,t,n){$(n),Bm();const r=Zm(e,t),i=$m(r);let o;const s=Fm(i,()=>o),d=n!=null?{...s,signal:n}:s;if(t){const b=ce.get(t);if(b){let E;try{E=await b,$(n)}catch(I){if($(n),Yt(t,b),Qr(I))throw I;E=void 0}if(E)if(E.getElement()===t)try{return o=gm(t),await E.reset(d)}catch(I){if($(n),Ym(I)||Vm(I)||Qr(I)&&n?.aborted)throw I;Yt(t,b,E),Zr(E)}else Yt(t,b,E),Zr(E)}}$(n);const l=eh(s),f=th(s),u=n!=null?{...f.options,signal:n}:f.options;let g;try{o=Em(u),vm(t,o),Nn(o).set(u),await jn(),G(J.coreReady),$(n),$(n),g=hm(u,o),t&&ce.set(t,g);const b=await g;if(n?.aborted&&(b.destroy(),$(n)),t)if(ce.get(t)===g)ce.set(t,b);else throw b.destroy(),$(n),te(n?.reason);return b}catch(b){throw l(),f.cleanup(),o&&(jo(o),bm(t,o)),t&&g&&ce.get(t)===g&&ce.delete(t),b}}async function bh(e){return(await Je()).parseAMP(e)}typeof window<"u"&&(qe()&&ta(),Ip(typeof window.__emailmaker__<"u"?window.__emailmaker__:void 0));export{Go as ELEMENT_DETACHED_ABORT_MESSAGE,qo as SUPERSEDED_INIT_ABORT_MESSAGE,ph as errors,mh as helpers,vh as init,Vm as isElementDetachedError,Ym as isSupersededInitError,bh as parseAMP,Ap as pluginRegistry,gh as preload,hh as version};
1076
+ }`;function Tm(){return()=>{}}function Am(e,t){if(!Bo()||!e||typeof document>"u")return Tm();e.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(s=>{s.remove()});const n=document.createElement("div");n.classList.add("blocks-app-initial-spinner-wrapper");const r=document.createElement("div");r.classList.add("blocks-app-initial-spinner"),n.appendChild(r);const i=document.createElement("style");i.setAttribute(t,"true"),i.textContent=Im,document.head?.appendChild(i),e.appendChild(n);let o=!1;return()=>{o||(o=!0,n.remove(),i.remove())}}function Cm(e){if(!(e instanceof Error))return!1;const t=e;return t.terminal===!0||t.status===403||t.status===404}function Pm({report:e}={}){const t=new Map,n=new Set,r=e??(i=>{});return{run(i,o){const s=t.get(i);if(s!==void 0)return s;const d=o().catch(l=>{throw n.has(i)||(n.add(i),r(l)),Cm(l)||t.delete(i),l});return t.set(i,d),d},clear(){t.clear(),n.clear()},size(){return t.size}}}var Bn=Pm();function Uo(){Bn.clear()}Jo(()=>Bn.clear());var Kr=new WeakMap,Wr=new WeakMap;function Rm(e,t){let n=Wr.get(t);n||(n=new Map,Wr.set(t,n));const r=n.get(e);if(r!==void 0)return r;const i=t.getInstance(ti),o=Ms({baseUrl:e,customFetch:i?.execute??fetch},t);return n.set(e,o),o}function Un(e){return ls(e)}function Dm(e,t){const n=new Error(`[Loader] appInit request failed: ${e} ${t}`);return n.status=e,n}function Om(){const e=new Error("[Loader] appInit skipped: empty auth token");return e.terminal=!0,e}async function xm(e){if(!e.getAuthToken)return;const t=await e.getAuthToken(e.user,e.project,void 0),n=String(t||"").trim();return n?`Bearer ${n}`:void 0}function Lm(e,t){return async({baseUrl:n})=>{const r=Un(n);if(!r)throw new Error("[Loader] appInit requires baseUrl or REACT_APP_OPENAPI_BASE_URL");const i=new Headers({Accept:"application/json"});if(e.getAuthToken&&!await xm(e))throw Om();const o=t();if(!o)throw new Error("[Loader] appInit requires the instance container");const s=new ui(Rm(r,o)),d={headers:Object.fromEntries(i.entries()),credentials:"same-origin",failoverAttemptTimeout:Fn(e)||void 0},l=await s.app_init_create({},d);if(!l.ok)throw Dm(l.status,l.statusText);return l.data}}function Mm(e){return JSON.stringify({baseUrl:Un(e.baseUrl)||"",project:e.project??"",userId:e.user?.id??""})}function km(e){return e.appInit?!0:!(e.jwtAuth&&!e.getAuthToken)}function Nm(e){return t=>Bn.run(Mm(t),()=>(G("appInit:start",{kind:"network"}),Promise.resolve(e(t)).finally(()=>G("appInit:end",{kind:"network"}))))}function Fm(e,t){if(It(e)||!e.appInit&&!Un(e.baseUrl)||!km(e))return e;const n=e.appInit??Lm(e,t);let r=Kr.get(n);return r||(r=Nm(n),Kr.set(n,r)),{...e,appInit:r}}var Ho=0;function jm(){return Ho}function Bm(){Ho+=1,Uo()}var Yr=new WeakMap,Xr=new WeakMap,Um=3e4;function Hm(e,t){return JSON.stringify({userId:e?.id??"",project:t??""})}function Gm(e,t){try{const n=oi(e)?.exp;if(typeof n=="number"&&Number.isFinite(n)&&n>0)return n*1e3}catch{}return t+Um}function qm(e){const t=new Map,n=new Map;return async(r,i,o)=>{const s=Hm(r,i);if(o)return n.delete(s),t.delete(s),Uo(),e(r,i,o);const d=n.get(s);if(d&&!t.has(s)){if(d.expiresAtMs>Date.now())return d.token;n.delete(s)}let l=t.get(s);return l===void 0&&(G("authToken:start",{kind:"network"}),l=Promise.resolve(e(r,i,o)).then(f=>{const u=String(f||"").trim();return u&&n.set(s,{token:f,expiresAtMs:Gm(u,Date.now())}),f}).finally(()=>{G("authToken:end",{kind:"network"}),t.delete(s)}),t.set(s,l)),l}}function $m(e){if(It(e))return e;const t=e.getAuthToken;if(!t)return e;let n=Yr.get(t);const r=jm();return(!n||Xr.get(t)!==r)&&(n=qm(t),Yr.set(t,n),Xr.set(t,r)),Promise.resolve(n(e.user,e.project,void 0)).catch(i=>{}),{...e,getAuthToken:n}}var Go="Editor mount element was removed from the document. Call instance.destroy() on host unmount.";function zm(){return te(Go)}function Vm(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===Go}function Km(e,t,n){if(typeof document>"u")return;let r=!1,i;const o=()=>{r=!0,i?.disconnect(),i=void 0},s=()=>{r||(o(),t())};if(n.addDispose(o),!e.isConnected){queueMicrotask(s);return}i=new MutationObserver(()=>{e.isConnected||s()});let d=e.parentNode;for(;d;)i.observe(d,{childList:!0}),d=d.parentNode}function Wm(e){const{hostElementOption:t,resolvedElement:n,externalSignal:r,disposable:i}=e;if(t===void 0||!(n instanceof Element))return r;const o=new AbortController;return Km(n,()=>{n.id,o.abort(zm())},i),ai(r,o.signal)}var qo="Superseded by newer init() on the same mount element";function Jr(){return te(qo)}function Ym(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===qo}var lt=new Map,dt=new WeakMap;function Xm(e){if(e instanceof Element){const t=e.id?.trim();if(t)return`#${t}`}}function Jm(e){if(!e)return{release:()=>{}};const t=Xm(e);dt.get(e)?.abort(Jr()),t&&lt.get(t)?.abort(Jr());const n=new AbortController;return dt.set(e,n),t&&lt.set(t,n),{signal:n.signal,release:()=>{dt.get(e)===n&&dt.delete(e),t&&lt.get(t)===n&&lt.delete(t)}}}var ph=ei({FileManagerApiError:()=>Qm}),Qm=class $o extends Error{code;status;details;get httpStatus(){return this.status}constructor(t,n,r,i){super(t),this.name="FileManagerApiError",this.code=n,this.status=r,this.details=i,Error.captureStackTrace&&Error.captureStackTrace(this,$o)}},mh=ei({mapHttpStatusToErrorCode:()=>es});function Zm(e,t){return{...e,element:t}}function gn(){return()=>{}}function eh(e){const t=e.element;return!t||typeof t=="string"||typeof document>"u"?gn():(wm(t,e.config?.styles,t),()=>{Sm(t)})}function th(e){if(!Bo()||e.initialSpinner===!1||typeof document>"u")return{options:e,cleanup:gn()};const t=e.element;if(!t||typeof t=="string")return{options:e,cleanup:gn()};t.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(i=>{i.remove()});const n=Am(t,"data-emailmaker"),r=e.handleChunkLoaded;return{options:{...e,handleChunkLoaded:()=>{n(),r?.()}},cleanup:n}}function Qr(e){return e instanceof DOMException&&e.name==="AbortError"}function Zr(e){try{e.destroy()}catch{}}function Yt(e,...t){const n=ce.get(e);t.some(r=>r!==void 0&&r===n)&&ce.delete(e)}var hh="1.1.85-dev.3";async function gh(e){await wp(typeof window.__emailmaker__<"u"?window.__emailmaker__:void 0)}async function vh(e){G(J.initStart);const t=await nh(e);return G(J.initEnd),t}async function nh(e){$(e.signal);const t=new Q;let n;try{const r=await Ts(e.element,t,e.signal),i=Wm({hostElementOption:e.element,resolvedElement:r,externalSignal:e.signal,disposable:t}),o=Jm(r);n=o.release;const s=ai(i,o.signal);return await yn(rh(e,r,s),s)}finally{n?.(),t.dispose()}}async function rh(e,t,n){$(n),Bm();const r=Zm(e,t),i=$m(r);let o;const s=Fm(i,()=>o),d=n!=null?{...s,signal:n}:s;if(t){const b=ce.get(t);if(b){let E;try{E=await b,$(n)}catch(I){if($(n),Yt(t,b),Qr(I))throw I;E=void 0}if(E)if(E.getElement()===t)try{return o=gm(t),await E.reset(d)}catch(I){if($(n),Ym(I)||Vm(I)||Qr(I)&&n?.aborted)throw I;Yt(t,b,E),Zr(E)}else Yt(t,b,E),Zr(E)}}$(n);const l=eh(s),f=th(s),u=n!=null?{...f.options,signal:n}:f.options;let g;try{o=Em(u),vm(t,o),Nn(o).set(u),await jn(),G(J.coreReady),$(n),$(n),g=hm(u,o),t&&ce.set(t,g);const b=await g;if(n?.aborted&&(b.destroy(),$(n)),t)if(ce.get(t)===g)ce.set(t,b);else throw b.destroy(),$(n),te(n?.reason);return b}catch(b){throw l(),f.cleanup(),o&&(jo(o),bm(t,o)),t&&g&&ce.get(t)===g&&ce.delete(t),b}}async function bh(e){return(await Je()).parseAMP(e)}typeof window<"u"&&(qe()&&ta(),Ip(typeof window.__emailmaker__<"u"?window.__emailmaker__:void 0));export{Go as ELEMENT_DETACHED_ABORT_MESSAGE,qo as SUPERSEDED_INIT_ABORT_MESSAGE,ph as errors,mh as helpers,vh as init,Vm as isElementDetachedError,Ym as isSupersededInitError,bh as parseAMP,Ap as pluginRegistry,gh as preload,hh as version};
1077
1077
 
1078
1078
 
1079
- window.__emailmaker__.require.config({"graph":{"core":["__delivery__/libs"],"static/core/15ea858c.js":[],"static/core/17461e5e.js":[],"static/core/1922419a.js":[],"static/core/1de56f23.js":[],"static/core/28631044.js":[],"static/core/2bffd204.js":["static/core/fbccd907.js","__delivery__/libs"],"static/core/323c45d7.js":["static/core/fbccd907.js"],"static/core/370f04c3.js":[],"static/core/43a8b244.js":[],"static/core/44829f84.js":["static/core/370f04c3.js","__delivery__/libs","monaco"],"static/core/50109143.js":[],"static/core/56d131f3.js":["static/core/50109143.js","static/core/65870018.js","__delivery__/libs"],"static/core/60ec410f.js":[],"static/core/613d8a7a.js":["__delivery__/libs"],"static/core/649bbe61.js":["static/core/cebcf9a5.js","static/core/c2e6de6c.js","static/core/6748af4b.js"],"static/core/65870018.js":["static/core/613d8a7a.js","__delivery__/libs"],"static/core/6748af4b.js":["static/core/c2e6de6c.js"],"static/core/6933d533.js":[],"static/core/7c0a1f19.js":[],"static/core/88f21f92.js":["static/core/cebcf9a5.js"],"static/core/8a5b1c18.js":[],"static/core/8bf56b5b.js":[],"static/core/9388c451.js":[],"static/core/98a65bf6.js":[],"static/core/a42770c7.js":["static/core/fbccd907.js","static/core/50109143.js","__delivery__/libs"],"static/core/a984d7cb.js":["static/core/c2e6de6c.js"],"static/core/bebf981d.js":[],"static/core/bf8b37be.js":[],"static/core/c2e6de6c.js":[],"static/core/c7d949de.js":[],"static/core/cbcede3f.js":[],"static/core/cebcf9a5.js":[],"static/core/d1b67ebe.js":[],"static/core/ddf40214.js":[],"static/core/dea46f93.js":[],"static/core/fbccd907.js":["static/core/613d8a7a.js","__delivery__/libs"],"static/monaco/editor.api-DqgksfDR.js":[],"monaco":["static/monaco/editor.api-DqgksfDR.js","static/monaco/lspLanguageFeatures-BnvITcKb.js"],"static/monaco/lspLanguageFeatures-BnvITcKb.js":["static/monaco/editor.api-DqgksfDR.js"],"compat-globals.js":["static/esm/50fbfdf6.js"],"emailmaker-esm.js":["static/esm/50fbfdf6.js","static/esm/28ceddf3.js"],"static/esm/delivery-libs.js":[],"static/esm/28ceddf3.js":[],"static/esm/50fbfdf6.js":[]},"bundles":{"static/core/613d8a7a.js":["static/core/b71c0d7a.js","static/core/558bfe71.js","static/core/83330880.js","static/core/d0e368fa.js"],"static/core/88f21f92.js":["static/core/a54d9b28.js"],"static/core/2bffd204.js":["static/core/8292288a.js"],"static/core/65870018.js":["static/core/61378c9e.js"],"static/core/fbccd907.js":["static/core/d8c79fc5.js","static/core/666916bb.js","static/core/c178d933.js"],"core":["static/core/5dc34752.js","static/core/1970ffad.js","static/core/ad2a794d.js","static/core/dea98cd8.js","static/core/b2ec691e.js"]}});
1079
+ window.__emailmaker__.require.config({"graph":{"core":["__delivery__/libs"],"static/core/15ea858c.js":[],"static/core/1655f40f.js":[],"static/core/1922419a.js":[],"static/core/28631044.js":[],"static/core/2bffd204.js":["static/core/4138a1b9.js","__delivery__/libs"],"static/core/2e39454c.js":[],"static/core/323c45d7.js":["static/core/4138a1b9.js"],"static/core/370f04c3.js":[],"static/core/4138a1b9.js":["static/core/a6fed2cf.js","__delivery__/libs"],"static/core/43a8b244.js":[],"static/core/4598405b.js":[],"static/core/47e97e35.js":["static/core/4138a1b9.js","static/core/72a579ec.js","__delivery__/libs"],"static/core/5c7e24b5.js":[],"static/core/6933d533.js":[],"static/core/72a579ec.js":[],"static/core/7b7c0c8c.js":[],"static/core/7c0a1f19.js":[],"static/core/8a5b1c18.js":[],"static/core/8bf56b5b.js":[],"static/core/9a285b6a.js":["static/core/4598405b.js"],"static/core/a215213f.js":["static/core/370f04c3.js","__delivery__/libs","monaco"],"static/core/a6fed2cf.js":["__delivery__/libs"],"static/core/b73e046e.js":["static/core/a6fed2cf.js","__delivery__/libs"],"static/core/b9758690.js":[],"static/core/bebf981d.js":[],"static/core/bf9d8272.js":["static/core/72a579ec.js","static/core/b73e046e.js","__delivery__/libs"],"static/core/cbcede3f.js":[],"static/core/cc50fc65.js":[],"static/core/d2342090.js":["static/core/2e39454c.js","static/core/4598405b.js","static/core/9a285b6a.js"],"static/core/de611927.js":[],"static/core/e2f501f0.js":["static/core/4598405b.js"],"static/core/e9fd7972.js":[],"static/core/ebeee027.js":[],"static/core/f0fb869f.js":["static/core/2e39454c.js"],"static/core/f4a519b0.js":[],"static/core/fabc717f.js":[],"static/monaco/editor.api-DqgksfDR.js":[],"monaco":["static/monaco/editor.api-DqgksfDR.js","static/monaco/lspLanguageFeatures-BnvITcKb.js"],"static/monaco/lspLanguageFeatures-BnvITcKb.js":["static/monaco/editor.api-DqgksfDR.js"],"compat-globals.js":["static/esm/50fbfdf6.js"],"emailmaker-esm.js":["static/esm/50fbfdf6.js","static/esm/28ceddf3.js"],"static/esm/delivery-libs.js":[],"static/esm/28ceddf3.js":[],"static/esm/50fbfdf6.js":[]},"bundles":{"static/core/a6fed2cf.js":["static/core/ef34ebcd.js","static/core/17f92d3d.js","static/core/424385ee.js","static/core/cb533d3c.js"],"static/core/f0fb869f.js":["static/core/a54d9b28.js"],"static/core/2bffd204.js":["static/core/8292288a.js"],"static/core/b73e046e.js":["static/core/61378c9e.js"],"static/core/4138a1b9.js":["static/core/1b0f01de.js","static/core/666916bb.js","static/core/c178d933.js"],"core":["static/core/5dc34752.js","static/core/1970ffad.js","static/core/8ca96066.js","static/core/8b177b33.js","static/core/69df27c7.js"]}});