@emailmaker/emailmaker 1.3.2 → 1.3.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.b63d7b8b.js → emailmaker-core.a4e11bd0.js} +9 -9
  2. package/emailmaker-esm.js +11 -11
  3. package/{emailmaker-po.b63d7b8b.js → emailmaker-po.a4e11bd0.js} +1 -1
  4. package/emailmaker.js +6 -6
  5. package/iframe/.vite/manifest.json +4 -4
  6. package/iframe/{iframe-eblock.b63d7b8b.html → iframe-eblock.a4e11bd0.html} +2 -2
  7. package/iframe/{iframe.b63d7b8b.html → iframe.a4e11bd0.html} +2 -2
  8. package/iframe/js/{elMarkupHelper.C4wWAApZ.js → elMarkupHelper.Dc_IFMml.js} +3 -3
  9. package/iframe/js/{iframe-eblock.body.b63d7b8b.js → iframe-eblock.body.a4e11bd0.js} +1 -1
  10. package/iframe/js/iframe-eblock.js +2 -2
  11. package/iframe/js/{iframe.body.b63d7b8b.js → iframe.body.a4e11bd0.js} +1 -1
  12. package/iframe/js/iframe.js +2 -2
  13. package/package.json +1 -1
  14. package/runtime/react/index.js +1 -1
  15. package/static/core/{c266ad76.js → 0c2b284d.js} +1 -1
  16. package/static/core/{fa6f5198.js → 1708db7c.js} +1 -1
  17. package/static/core/{a9d62c49.js → 1c5fcd3e.js} +1 -1
  18. package/static/core/{40574d12.js → 1d705ef4.js} +1 -1
  19. package/static/core/{e2694475.js → 2f2b6a03.js} +2 -2
  20. package/static/core/{7a9faff8.js → 44ad0bec.js} +1 -1
  21. package/static/core/{66a5de32.js → 462ebf44.js} +1 -1
  22. package/static/core/{aea50cd5.js → 5b124cab.js} +1 -1
  23. package/static/core/{8fdd9471.js → 5c396b20.js} +1 -1
  24. package/static/core/{85accd9c.js → 64c240c3.js} +1 -1
  25. package/static/core/{d402573d.js → 6dfc3524.js} +1 -1
  26. package/static/core/{4fef179c.js → 762d0d48.js} +1 -1
  27. package/static/core/{9f6b8cdd.js → 76d1e927.js} +1 -1
  28. package/static/core/{5e13bbc1.js → 7c519fb4.js} +1 -1
  29. package/static/core/{69842511.js → 8608a2b9.js} +1 -1
  30. package/static/core/{cd715a88.js → 892bb74e.js} +1 -1
  31. package/static/core/{3a876cdd.js → 9c4c7364.js} +1 -1
  32. package/static/core/{86e5503b.js → a30b0fae.js} +1 -1
  33. package/static/core/{bb58b8a1.js → a4d994c7.js} +5 -5
  34. package/static/core/{e8edbf21.js → aa75c19b.js} +1 -1
  35. package/static/core/{f85176c7.js → b0c57adf.js} +1 -1
  36. package/static/core/{a6518f19.js → b9f59067.js} +1 -1
  37. package/static/core/{253d6f68.js → c16f27f8.js} +2 -2
  38. package/static/core/{4f63baad.js → cd998f60.js} +1 -1
  39. package/static/core/{d0d2525d.js → e123b734.js} +1 -1
  40. package/static/core/{6319e32c.js → e70683db.js} +1 -1
  41. package/static/core/{89fb48c9.js → ec552634.js} +1 -1
  42. package/static/umd-runtime/{runtime.9w1dxMVc.js → runtime.C95Dj7XR.js} +1 -1
  43. package/vendor/@emailmaker/ui-kit/package.json +1 -1
package/emailmaker.js CHANGED
@@ -1014,7 +1014,7 @@ var __amdEnv = window.__emailmaker__ || (window.__emailmaker__ = {});
1014
1014
 
1015
1015
 
1016
1016
  // Configure AMD loader
1017
- __amdEnv.require.config({ baseUrl: "./", paths: {"core":"emailmaker-core.b63d7b8b.js","monaco":"static/monaco/index.CCINpETE.js","po":"emailmaker-po.b63d7b8b.js","static/umd-runtime/delivery-libs.js":"static/umd-runtime/delivery-libs.eFZaeVgo.js","static/umd-runtime/runtime.js":"static/umd-runtime/runtime.9w1dxMVc.js","static/umd-runtime/ui-kit-icons.js":"static/umd-runtime/ui-kit-icons.CSCUi7bp.js","static/umd-runtime/ui-kit.js":"static/umd-runtime/ui-kit.nmR1Bl60.js"} });
1017
+ __amdEnv.require.config({ baseUrl: "./", paths: {"core":"emailmaker-core.a4e11bd0.js","monaco":"static/monaco/index.CCINpETE.js","po":"emailmaker-po.a4e11bd0.js","static/umd-runtime/delivery-libs.js":"static/umd-runtime/delivery-libs.eFZaeVgo.js","static/umd-runtime/runtime.js":"static/umd-runtime/runtime.C95Dj7XR.js","static/umd-runtime/ui-kit-icons.js":"static/umd-runtime/ui-kit-icons.CSCUi7bp.js","static/umd-runtime/ui-kit.js":"static/umd-runtime/ui-kit.nmR1Bl60.js"} });
1018
1018
 
1019
1019
  // PublicPath (script detection: entry script lookup → document.currentScript)
1020
1020
  if (!__emailmaker__.publicPath) {
@@ -1362,7 +1362,7 @@ if (!ns.assetUrl) {
1362
1362
  }
1363
1363
 
1364
1364
  if (!ns.version) {
1365
- ns.version = "1.3.2";
1365
+ ns.version = "1.3.3";
1366
1366
  }
1367
1367
 
1368
1368
  var modules = ns.modules = Object.create(null);
@@ -2104,7 +2104,7 @@ __emailmaker__.define("emailmaker.js",["require","exports","module","static/umd/
2104
2104
  `,`
2105
2105
  `)===t.replaceAll(`\r
2106
2106
  `,`
2107
- `)}function Vt(e){return{html:e.html,common_styles:e.common_styles,subject:e.subject,preheader:e.preheader}}function ct(e,t){return Gn(e.autosave,t===void 0?{}:{freshSince:t})?e.autosave:null}function du(e,t,n){const{latest:r}=e,o=Ht(t.html,n);return!r||t.baseOpen||r.id===t.baseRevisionId||t.baseHtmls?.some(s=>Ht(s,r.html))?o?{revision:null,phase:"normal"}:{revision:Vt(t),phase:"timeout"}:o?{revision:ct(e),phase:"normal"}:Ht(t.html,r.html)?{revision:Vt(t),phase:"found"}:{revision:ct(e),phase:"normal"}}function uu({emailId:e,readAutosave:t,revisionServiceEnabled:n,pendingKey:r,historyIsSynchronous:o=!1,readShownContent:s,onFacts:i,onLate:a,onError:c,pageLoadTs:d=cu()}){const u=r??e;let p=null,m=!1,h=!1,_=0,S={emailId:e,historyLoaded:!1,isRecovering:!1},v=null;const b=new Promise(E=>{v=E}),D=E=>{S={...S,...E},i(S)};let j;const x=E=>{_+=1,D({applied:{phase:E,seq:_}})},C=()=>{p?.timer&&clearTimeout(p.timer),p=null},I=E=>{if(!h){if(v){const y=v;v=null,y(E),j=E.revision?E.phase:void 0;return}a(E)&&E.revision&&x(E.phase)}},R=()=>{if(!p||h)return;const E=p.phase==="fast",y=E?ou:au,B=E?iu:lu;p.timer=setTimeout(()=>{const U=p;if(!(!U||h)){if(U.attempts+=1,w(),E&&U.attempts>=B){const{pending:W}=U;Pe(u),D({isRecovering:!1}),I({revision:Vt(W),phase:"timeout"}),m=!0,U.phase="bg",U.attempts=0,R();return}if(!E&&U.attempts>=B){Pe(u),C(),D({isRecovering:!1}),m=!0;return}R()}},y),p.timer.unref?.()},A=E=>{p={phase:"fast",attempts:0,pending:E,timer:null},D({isRecovering:!0}),R()},O=E=>{if(h)return;if(D({historyLoaded:!0,latestRevisionAt:E.latestAt!==void 0&&Number.isFinite(E.latestAt)?E.latestAt:void 0}),n&&p){const U=ct(E,p.pending.sentAt);if(!U)return;const W=p.phase==="fast"?"found":"bg";Pe(u),C(),D({isRecovering:!1}),m=!0,I({revision:U,phase:W});return}if(m)return;const y=n?xt(u):null,B=y&&(y.sentAt<d||!Ht(y.html,s()))?y:null;if(B){if(o&&(B.baseRevisionId!==void 0||B.baseOpen)){Pe(u),m=!0,I(du(E,B,s()));return}const U=ct(E,B.sentAt);if(U){Pe(u),m=!0,I({revision:U,phase:"found"});return}if(o){if(Pe(u),m=!0,E.latestAt!==void 0&&E.latestAt>B.sentAt+5e3){I({revision:null,phase:"normal"});return}I({revision:Vt(B),phase:"timeout"});return}A(B);return}m=!0,I({revision:ct(E),phase:"normal"})},L=E=>{h||(c?.(E),S.historyLoaded||(D({historyLoaded:!1,latestRevisionAt:void 0}),F()),!p&&I({revision:null,phase:"normal"}))},w=()=>t(e).then(O).catch(L);let P,k=!1;const F=()=>{k||p||h||(k=!0,P=setTimeout(()=>{P=void 0,!h&&!S.historyLoaded&&w()},su))};return w(),{verdict:()=>b,confirmVerdict(E){const y=j;j=void 0,E&&y!==void 0&&!h&&x(y)},dispose(){h=!0,P!==void 0&&(clearTimeout(P),P=void 0),C()}}}function fu({port:e,revisionServiceEnabled:t,pendingKey:n,historyIsSynchronous:r,emailId:o,wpId:s,readShownContent:i,onFacts:a}){let c=null;const d=uu({emailId:o,readAutosave:u=>s?e.readAutosave(u,{wpId:s()}):e.readAutosave(u),revisionServiceEnabled:t,...n?{pendingKey:n}:{},...r?{historyIsSynchronous:r}:{},readShownContent:i,onFacts:a,onLate:({revision:u,phase:p})=>{const m=fs(u);return c?.(m)??!1},onError:u=>{u instanceof Error&&u.message}});return{id:"recovery",load:()=>d.verdict().then(({revision:u})=>fs(u)),loaded(u){d.confirmVerdict(u)},watch(u){return c=u,()=>{c=null,d.dispose()}}}}var pu=5e3,hu=l.createIdentifier$1("plugin.knownRevisions");function Ke(e){return e.getOrCreateInstance(hu,()=>new Map)}function Xn(e,t,n,r){const o=n?.get(t)??[],s=o.filter(i=>i!==r);return{...e.has(t)?{baseRevisionId:e.get(t)??null}:{},...o.length>Is?{baseOpen:!0}:s.length?{baseHtmls:s}:{}}}var mu=l.createIdentifier$1("plugin.uncertainWrites"),Is=3;function dt(e){return e.getOrCreateInstance(mu,()=>new Map)}function gu(e,t,n){const r=e.get(t)??[];r.includes(n)||r.length>Is||e.set(t,[...r,n])}function Ts(e,t){Mn(e,t)||!t.baseHtmls||Mn(e,{...t,baseHtmls:void 0,baseOpen:!0})}function Gt(e,t,n,r=!1){const o=xt(e);!n||o?.sentAt!==t||!(r||o.baseOpen||o.baseHtmls)||Mn(e,{...o,baseRevisionId:n,baseHtmls:void 0,baseOpen:void 0})}function Cs(e,t,n,r){(xt(e)?.sentAt??Number.NEGATIVE_INFINITY)>n||Ts(e,{sentAt:n,html:t.html??"",common_styles:t.common_styles??"",subject:t.subject,preheader:t.preheader,...r})}var vu=/(?:Z|[+-]\d{2}:?\d{2})$/i;function Eu(e,t){const n=e;if(n?.isAutosave!==!0)return!1;const r=n.modified??"",o=vu.test(r)?Date.parse(r):NaN;return!Number.isFinite(o)||o>=t-pu}function As(e,t,{pendingKey:n=i=>i,knownRevisions:r=new Map,uncertainWrites:o,synchronousHistory:s=!1}={}){return{readRevisions:(i,a,c)=>t.readRevisions(i,a,c),readRevision:(i,a,c)=>t.readRevision?t.readRevision(i,a,c):Promise.resolve(null),readAutosave:(i,a)=>t.readAutosave(i,a),async saveAutosave(i,a,c){const d=n(i),u=Date.now();Ts(d,{sentAt:u,html:a.html??"",common_styles:a.common_styles??"",subject:a.subject,preheader:a.preheader,...Xn(r,d,o,a.html??"")});const p=await t.saveAutosave(i,a,c),m=p?.id;return Eu(p,u)?Gt(d,u,m):m&&s&&(p.isAutosave===!0?Fn(d,u):Gt(d,u,m,!0)),await e.saveAutosave(i,a),p}}}function _u(e,t,n){return{readEmail:r=>e.readEmail(r),createEmail:r=>e.createEmail(r),async updateEmail(r,o){const s=Date.now();n&&Cs(r,o,s,Xn(n.knownRevisions,r,n.uncertainWrites,o.html??""));const i=await t.updateEmail(r,o);return n&&Gt(r,s,n.knownRevisions.get(r)??void 0),await e.updateEmail(r,o),Fn(r,s),i&&{...i,id:r}}}}var Ds=l.createIdentifier$1("CurrentUser"),Ps={};function Jn(e){return e.getOrCreateInstance(Ds,()=>fe(Ps))}function Os(e){return e?.getInstance(Ds)?.get()??Ps}var Rs=l.createIdentifier$1("HeadlessMode");function ks(e){return e.getOrCreateInstance(Rs,()=>fe(!1))}function bu(e){return e?.getInstance(Rs)?.get()??!1}var Su=l.createIdentifier$1("HiddenMount");function yu(e){return e.getOrCreateInstance(Su,()=>fe(!1))}function wu(e){if(!e)return!1;try{return!!l.decodeJwt(e).data?.act_as}catch{return!1}}function Iu(e){return wu(e?.getInstance(l.COOKIE_MANAGER_ID)?.get(l.APP_COOKIES.em_token))}function Ns(e){return e?.getInstance(l.CONFIG_SOURCE_ID)?.get()??{}}function Wt(e,t){return e.user.mode||e.serverSide.mode||t||"pro"}function Tu(e,t){return t.modeDefaults(Wt(e,t.fallbackMode))}function Ls(e,t){const n=Wt(e,t);return e.serverSide.advancedConfigs?.[n]||{}}function Ms(e,t){const n=Wt(e,t),r=e.user?.advancedConfigs?.[n],o=r!==void 0?r:e.user?.advancedConfigs?.pro;return{...e.advancedConfigs?.[n],...o}}function Cu(e){let t;for(const n of e)n?.fileManager&&(t={...t,...n.fileManager});return t}function Au(e){return l.mergeResourceProxyLayers(e.map(t=>t?.resourceProxy))}function Du(e){return l.mergeResourceProxyPolicyLayers(e.map(t=>t?.resourceProxyPolicy))}function Pu(e){return l.mergeBackendProxyLayers(e.map(t=>t?.backendProxy))}function Ou(e){return l.mergeShallowConfigLayers(e.map(t=>t?.backendProxyPolicy||{}).filter(Boolean))}function Ru(e,t){return[e.base,Tu(e,t),e.profile,e.serverSide,Ls(e,t.fallbackMode),e.local,e.user,Ms(e,t.fallbackMode)]}function Qn(e,t){const n=Ru(e,t),r=l.mergeShallowConfigLayers(n),o=Cu(n);o!==void 0&&(r.fileManager=o);const s=Au(n);s!==void 0&&(r.resourceProxy=s);const i=Du(n);i&&Object.keys(i).length>0&&(r.resourceProxyPolicy=i);const a=Pu(n);a!==void 0&&(r.backendProxy=a);const c=Ou(n);return c&&Object.keys(c).length>0&&(r.backendProxyPolicy=c),r}function ku(e,t,n){const r=Ls(e,n),o=Ms(e,n);return l.pickKey([o,e.user,r,e.serverSide],t)}var Nu=1.5;function Lu(e){return e.isHeadless||!e.isEnabled||e.isUserBusy||!e.isReady||!e.isInited?"none":e.isNew?"create":!e.isDirty||e.isSnapshotSent||!e.isHistoryLoaded||e.latestRevisionAgeMs!==void 0&&e.latestRevisionAgeMs<=Nu*e.autosaveTimeoutMs?"none":"revision"}var hS=5,mS=3;function Mu(e){const{readDocument:t,readEnvironment:n,onCreate:r,onRevision:o}=e,s=e.readFailures??(()=>0),i=e.readFailureRetryable??(()=>!0);let a;const c=O=>a!==void 0&&a.version===O.get().version?s()-a.failuresAtStart:0,d=O=>{const L=c(O);if(L<=0)return!1;const w=n().retryMaxAttempts??5;return!i()||L>w},u=()=>{const{autosaveTimeoutMs:O,retryIntervalMs:L}=n(),w=t();return w!==void 0&&c(w)>0&&L!==void 0&&L>0?L:O},p=O=>O.isNew()&&s()>=3,m=()=>{const O=t();if(!O||O.isDisposed()||d(O))return"none";const{latestRevisionAt:L,snapshotVersion:w,...P}=n(),k=Date.now(),F=Lu({...P,isDirty:O.isDirty(),isNew:O.isNew(),isReady:O.isReady(),latestRevisionAgeMs:L!=null&&L<=k?k-L:void 0,isSnapshotSent:w!=null&&w===O.get().version});return F==="create"&&p(O)?"none":F},h=()=>{const O=t();if(!O||O.isDisposed()||p(O)||d(O)||n().isHeadless)return!1;if(!O.isDirty())return O.isNew();const{snapshotVersion:L}=n();return!(L!=null&&L===O.get().version)};let _,S=0,v=0,b,D,j,x=!1;const C=()=>{b=void 0;const O=t();if(!O||O.isDisposed())return;if(O.get().docId!==_){I();return}const L=m();L!=="none"&&a?.version!==O.get().version&&(a={version:O.get().version,failuresAtStart:s()}),L==="create"?r():L==="revision"?o():h()&&(_=O.get().docId,S=u(),v=s(),b=setTimeout(C,S))},I=()=>{const O=t();if(x||!O)return;const L=a?.version===O.get().version&&v!==s();b!==void 0&&(S!==u()||L)&&(clearTimeout(b),b=void 0),!(b!==void 0||m()==="none"&&!h())&&(_=O.get().docId,S=u(),v=s(),b=setTimeout(C,S))},R=O=>{const L=t();O.source==="user"?a=void 0:a&&L&&(a.version=L.get().version),O.source==="user"&&b!==void 0&&(clearTimeout(b),b=void 0),I()},A=()=>{const O=t();O!==D&&(j?.(),D=O,a=void 0,j=O?.subscribe(R),b!==void 0&&(clearTimeout(b),b=void 0))};return A(),I(),{refresh:()=>{x||(A(),I())},stop:()=>{x=!0,j?.(),j=void 0,D=void 0,b!==void 0&&(clearTimeout(b),b=void 0)}}}var xs=l.createIdentifier$1("documentSession.autosaveUiFacts"),Fs={isUserBusy:!1,saveContext:{}};function xu(e){return e.getOrCreateInstance(xs,()=>fe(Fs))}function Zn(e){return e?.getInstance(xs)?.get()??Fs}function Bs(e){return Zn(e).saveContext.fallbackTitle||"Untitled email."}var Fu=1e4,Bu=3e4;function ju(e,t){const n=m=>{const h=e.getInstance(l.CONFIG_SOURCE_ID)?.layers?.(),_=h?ku(h,m):void 0;return typeof _=="number"&&_>=0?_:void 0};let r;const o=m=>{const{error:h,failures:_}=t.saveState();return os(h)?(r?.failures!==_&&(r={failures:_,saved:m??null}),r.saved===(m??null)):(r=void 0,!1)},s=()=>{const m=t.current(),h=m?.get().serverId??void 0,_=Z(t.sessionKey()),S=t.recoveryFacts(),v=S?.emailId===h?S:void 0,b=t.revisionFacts(),D=v?.latestRevisionAt,j=b?.lastRevisionAt,x=Os(e).profile;return{isInited:_||m?.get().attributes.is_inited===!0,isEnabled:!!x?.autosaves&&!Iu(e)&&!o(m?.get().savedVersion),isHistoryLoaded:v?.historyLoaded===!0,isUserBusy:Zn(e).isUserBusy,isHeadless:bu(e),autosaveTimeoutMs:Ns(e).autosaveTimeout||Fu,latestRevisionAt:D!==void 0||j!==void 0?Math.max(D??0,j??0):void 0,snapshotVersion:b?.snapshotVersion,retryIntervalMs:n("autosaveRetryIntervalMs")??Bu,retryMaxAttempts:n("autosaveRetryMaxAttempts")}},i=()=>{const m=Zn(e).saveContext;return{...m,project:m.project??t.current()?.get().attributes.project,fallbackTitle:Bs(e)}},a=Mu({readDocument:()=>t.current(),readEnvironment:s,readFailures:()=>t.saveState().failures,readFailureRetryable:()=>Ed(t.saveState().error),onCreate:()=>{Z(t.sessionKey())||t.save("materialize",i())},onRevision:()=>{t.save("snapshot",{project:i().project})}}),c=t.subscribe(()=>{o(t.current()?.get().savedVersion),a.refresh()}),d=Jn(e).watch(()=>a.refresh()),u=xu(e).watch(()=>a.refresh()),p=ks(e).watch(()=>a.refresh());return()=>{c(),d.dispose(),u.dispose(),p.dispose(),a.stop()}}var js=12e3;function de(e){return e.getOrCreateInstance(Rn,()=>{const t=Kd({resolveAdapters:(r,o)=>Hu(r,e,o),resolveWritePort:()=>Us(e),resolveHistoryPort:r=>Z(r)?Hs(e):$s(e),resolveTerms:()=>tu(e),canEdit:r=>_c(e,r),notifyBeforeSave:Ic(e),awaitCanvasSynced:Oc(e),savedEchoForm:r=>{const o=Ie(e);return o.toEditorForm(o.toOutputForm(r))},queuesOutsideWrites:r=>Z(r)&&(Mc()||Ge(e)),timeoutMs:js,onAdapterError:(r,o)=>{o instanceof Error&&o.message;const s=Xd(o),i=zd(o);it(o,{origin:"email-source-adapter",tags:{source:r,expected_refusal:String(s),network_failure:String(i)},level:s||i?"warning":"error"})},onTimeout:r=>{}}),n=ju(e,t);return e.getInstance(l.DISPOSABLE_ID)?.addDispose(n),t})}function Ne(e){return e?.getInstance(Rn)}function Us(e){const t=Qd(e);return t?Yt(e)?_u(t,ke(e).email(e),Ge(e)?{knownRevisions:Ke(e),uncertainWrites:dt(e)}:void 0):t:ke(e).email(e)}function Uu(e){return ws(e)!==void 0||bs(e)}function $s(e){const t=ws(e);return t?Yt(e)?(te("port:history:server-backed"),As(t,ke(e).history(e),{knownRevisions:Ke(e),uncertainWrites:dt(e),synchronousHistory:Ge(e)})):(te("port:history:integrator"),t):(te("port:history:rest (порт не зарегистрирован)"),ke(e).history(e))}function Hs(e){const t=ys(e);return t?Yt(e)?(te("port:block-history:server-backed"),As(t,ke(e).blockHistory(e),{pendingKey:xn,knownRevisions:Ke(e),uncertainWrites:dt(e),synchronousHistory:Ge(e)})):(te("port:block-history:integrator"),t):(te("port:block-history:rest (порт не зарегистрирован)"),ke(e).blockHistory(e))}function $u(e){return ys(e)!==void 0||bs(e)}function Yt(e){return Oo(e)}function Hu({email:e,patch:t,serverId:n,key:r},o,s){const i=[];e?i.push({id:"rest",load:()=>ds(e),required:!0}):n&&i.push(Jd(Us(o),n)),t&&i.push({id:"plugin",load:()=>us(t)});const a=Z(r);return kc(n)&&(a?$u(o):Uu(o))&&i.push(fu({port:a?Hs(o):$s(o),revisionServiceEnabled:Yt(o),pendingKey:$o(n,a),historyIsSynchronous:Ge(o),emailId:n,wpId:()=>s.readWpId(),readShownContent:()=>s.readShownContent(),onFacts:c=>s.publishRecoveryFacts(c)})),i}function Vu(e){const t=de(e),n=le(e).addListener(l.EVENT_TYPES.APPLICATION_HAS_AMP,r=>{Ye(t)?.mutate({attributes:{isAmp:r}},{source:"remote"})});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>n.dispose())}function Gu(e){return e.size>0&&(e.type===""||e.type.startsWith("image/"))}function Wu(e){const t=e.fetchImpl??((s,i)=>fetch(s,i)),n=e.pageHost??(()=>window.location.hostname),r=new Set,o=s=>{try{const i=new URL(s,window.location.href);return i.protocol!=="https:"&&i.protocol!=="http:"?!1:i.hostname===n()||e.sourceHosts().includes(i.hostname)}catch{return!1}};return{accepts:o,async load(s){if(!o(s))return;const i=!r.has(s);r.add(s);try{const a=await t(s,{mode:"cors",credentials:"omit",cache:i?"no-cache":"default"});if(!a.ok)return;const c=await a.blob();return Gu(c)?c:void 0}catch{return}}}}var Le={maxBytes:67108864,maxImageBytes:4194304,ttlMs:18e5};function Yu(e){const t={maxBytes:e.maxBytes??Le.maxBytes,maxImageBytes:e.maxImageBytes??Le.maxImageBytes,ttlMs:e.ttlMs??Le.ttlMs},n=e.now??(()=>Date.now()),r=new Map,o=new Map,s={hits:0,loads:0,failures:0};let i=0;const a=p=>{const m=r.get(p);m&&(i-=m.bytes,r.delete(p))},c=p=>t.ttlMs<=0||n()-p.storedAt<t.ttlMs,d=()=>{if(i<=t.maxBytes)return;const p=[...r.entries()].sort((m,h)=>m[1].usedAt-h[1].usedAt);for(const[m]of p){if(i<=t.maxBytes)return;a(m)}},u=(p,m)=>{m.size>t.maxImageBytes||(r.set(p,{blob:m,bytes:m.size,storedAt:n(),usedAt:n()}),i+=m.size,d())};return{async get(p){const m=r.get(p);if(m&&c(m))return m.usedAt=n(),s.hits+=1,m.blob;m&&a(p);const h=o.get(p);if(h!==void 0)return h;s.loads+=1;const _=(async()=>{try{const S=await e.load(p);return S?u(p,S):s.failures+=1,S}catch{s.failures+=1;return}finally{o.delete(p)}})();return o.set(p,_),_},forget(p){a(p),o.delete(p)},configure(p){Object.assign(t,{maxBytes:p.maxBytes??t.maxBytes,maxImageBytes:p.maxImageBytes??t.maxImageBytes,ttlMs:p.ttlMs??t.ttlMs});for(const[m,h]of r)h.bytes>t.maxImageBytes&&a(m);d()},clear(){r.clear(),o.clear(),i=0},stats(){return{entries:r.size,bytes:i,...s}}}}var qu=["emcdn.ru","scr.emcdn.ru"];function Ku(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 zu(e,t){const n=(r,o)=>{const s=new Set(o?t:[]);for(const i of r){const a=Ku(i);a&&s.add(a)}return[...s]};return e?Array.isArray(e)?n(e,!0):n(e.value??[],e.replace!==!0):[...t]}function Xu(e){const t=e??{},n=t.isPlugin!==!0?qu:[],r=t.canvasImageCache;if(r===!1)return{enabled:!1,sourceHosts:[],...Le};const o=r===!0||r===void 0?{}:r;return{enabled:o.enabled!==!1,sourceHosts:zu(o.sourceHosts,n),maxBytes:o.maxBytes??Le.maxBytes,maxImageBytes:o.maxImageBytes??Le.maxImageBytes,ttlMs:o.ttlMs??Le.ttlMs}}function Ju(e){const t=le(e),n=e.getInstance(l.CONFIG_SOURCE_ID),r=()=>Xu({...n?.get(),isPlugin:!0});let o=r();const s=Wu({sourceHosts:()=>o.sourceHosts}),i=Yu({load:S=>s.load(S),maxBytes:o.maxBytes,maxImageBytes:o.maxImageBytes,ttlMs:o.ttlMs}),a=()=>{t.send(l.EVENT_TYPES.SANDBOX_CANVAS_IMAGE_CACHE_SETUP,{enabled:o.enabled,sourceHosts:[...o.sourceHosts]})},c=t.onInit(()=>a()),d=n?.watch(()=>{const S=r(),v=JSON.stringify(S)!==JSON.stringify(o);o=S,i.configure(S),S.enabled||i.clear(),v&&t.isInited()&&a()}),u={asked:0,served:0,refused:0},p=[],m=(S,v)=>(u.refused+=1,p.push({url:S,reason:v}),p.length>20&&p.shift(),{refused:!0}),h=Object.assign(globalThis,{__emmCanvasImages__:()=>({settings:o,counters:{...u},refusals:[...p],store:i.stats()})}),_=t.addListenerAsync(l.EVENT_TYPES.APPLICATION_CANVAS_IMAGE_GET,async S=>{const v=S?.url??"";if(u.asked+=1,!o.enabled||!v)return m(v,"disabled");if(!s.accepts(v))return m(v,"host");S.fresh&&i.forget(v);const b=await i.get(v);return b?(u.served+=1,{blob:b}):m(v,"load-failed")});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{c.dispose(),d?.dispose(),_.dispose(),i.clear(),delete h.__emmCanvasImages__})}var Qu=2e3;function Zu(e){const t=le(e),n=new Map,r=()=>{const i=t.getTarget();if(!i||t.hasPort(i))return;clearTimeout(n.get(i));const a=new MessageChannel;let c=!1,d=!1;const u=m=>{m.data?.operationId==="em:port-ready"&&(c=!0,a.port1.removeEventListener("message",u),d&&t.resumePort(i),t.drainWindow(i))};a.port1.addEventListener("message",u),t.sendPort(i,a.port2),t.usePort(a.port1,!1,i);const p=setTimeout(()=>{n.get(i)===p&&n.delete(i),!(c||!t.hasPort(i,a.port1))&&(it(new Error("canvas port did not come up, staying on window messaging"),{origin:"canvas-channel"}),d=!0,t.holdPort(i))},Qu);n.set(i,p)},o=Object.assign(globalThis,{__emmCanvasPort__:()=>{const i=t.getTarget();return{usesPort:t.usesPort,windowDrained:i?t.isWindowDrained(i):!1}}}),s=t.onInit(()=>r());e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{for(const i of n.values())clearTimeout(i);s.dispose(),delete o.__emmCanvasPort__})}var ef=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function tf(e){return ef.test(e)||e.indexOf("//")===0}function qt(e){return e&&(e.endsWith("/")?e:`${e}/`)}function nf(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:""}function Vs(e,t){const n=e==null||e===""?"./":String(e);if(tf(n))return qt(n);const r=t??nf();if(!r)return qt(n);try{return qt(new URL(n,r).href)}catch{return qt(n)}}function rf(){return typeof __emailmaker__<"u"&&__emailmaker__?.publicPath?Vs(__emailmaker__.publicPath):Vs("/")}var of=()=>"",sf=()=>"b63d7b8b";function af(e,t){const n=new URL(e);return n.hostname!=="localhost"||t.hostname==="localhost"?e:(n.hostname=t.hostname,n.toString())}function Gs(e){const t=e?"iframe-eblock":"iframe",n=of();if(n){const s=af(n,window.location).replace(/\/?$/,"/");return wo(`${s}${t}.html`,rt())}const r=sf(),o=`${rf().replace(/\/?$/,"/")}iframe/`;return wo(`${o}${t}${r?`.${r}`:""}.html`,rt())}var Ws="allow-top-navigation allow-scripts allow-popups allow-popups-to-escape-sandbox";function er(e){return/^file:/i.test(String(e||"").trim())}function lf(e){return er(e)?`${Ws} allow-same-origin`:Ws}var gS="em:module-body",cf="em:module-body-ack";function df(e,t,n){try{const r=new URL("./",new URL(t,n)).href,o=new URL(e,r).href;return o.startsWith(r)?o:void 0}catch{return}}function tr(e){const t=e.split(/[?#]/)[0].split("/").pop()??"",n=/^(.+?)(?:\.([0-9a-f]{6,}))?\.html$/.exec(t);return n?{name:n[1],hash:n[2]}:void 0}function uf(e){const t=tr(e);if(t)return t.hash?`js/${t.name}.body.${t.hash}.js`:`js/${t.name}.body.js`}function ff(e,t){const n=tr(t)?.name,r=n?e[`${n}.html`]:void 0;return r?(r.imports??[]).map(o=>e[o]?.file).filter(o=>!!o):[]}function pf(e,t){const n=tr(t)?.name,r=n?`js/${n}.js`:void 0;if(!r||!(r in e))return[];const o=new Set([r]),s=[r],i=[];for(;s.length>0;)for(const a of e[s.shift()]??[])o.has(a)||(o.add(a),i.push(a),s.push(a));return i}var hf=/^(?=[\w-]{8}$)(?:.*\d|(?=.*[a-z]).*[A-Z])/;function mf(e){const t=(e.split(/[?#]/)[0].split("/").pop()??"").split(".");return t.length>=3&&hf.test(t[t.length-2])}async function gf(e,t){const n=mf(e)?{}:{cache:"no-cache"};t?.priority&&(n.priority=t.priority);try{const r=await fetch(e,n);return r.ok?await r.blob():void 0}catch{return}}function vf(e){const t=new Map,n=(r,o)=>{const s=df(r,e.canvasSrc,e.origin);if(!s)return;const i=t.get(s);if(i!==void 0)return i;const a=e.fetchBody(s,o);return t.set(s,a),a};return{take(r){return n(r)??Promise.resolve(void 0)},warm(r,o){for(const s of r)n(s,o)},reset(){t.clear()},get size(){return t.size}}}var Se;function Ef(e){try{return er(new URL(e,window.location.href).href)}catch{return er(window.location.href)}}function Ys(e){try{if(new URL(e,window.location.href).origin===window.location.origin)return!0}catch{return!1}return typeof __emailmaker__<"u"&&__emailmaker__?.preload?.canvasCrossOrigin===!0}var _f=()=>Promise.resolve(void 0);function qs(){const e=Gs(!1);if(!Ef(e)){if(!Se||Se.canvasSrc!==e){const t=Ys(e)?gf:_f;Se={canvasSrc:e,store:vf({canvasSrc:e,origin:window.location.href,fetchBody:t}),warmed:!1}}return Se.store}}async function bf(e,t){try{const n=new URL(".vite/manifest.json",new URL("./",new URL(e,window.location.href))).href,r=await fetch(n,{cache:"no-cache"});if(!r.ok)return;const o=await r.json();t(ff(o,e))}catch{}}function nr(e){const t=qs();if(!t||!Se||Se.warmed||!Ys(Se.canvasSrc))return;Se.warmed=!0;const{canvasSrc:n}=Se,r=uf(n);r&&t.warm([r],e);const o={"js/iframe-eblock.js":["js/elMarkupHelper.C4wWAApZ.js"],"js/iframe.js":["js/elMarkupHelper.C4wWAApZ.js"],"js/darkreader.CLd5EML2.js":[],"js/elMarkupHelper.C4wWAApZ.js":[],"js/rules.CnnzdMsj.js":[],"js/typograf.all.Mun9CrLC.js":[]};o?t.warm(pf(o,n),e):bf(n,s=>t.warm(s,e))}function Sf(e){const t=qs();if(!t)return;nr();const n=r=>{const o=r.data;if(!o||o.operationId!=="em:module-body"||!o.result)return;const s=r.source;s&&(s.postMessage({operationId:cf,for:o.result},"*"),t.take(o.data?.url??"").then(i=>{s.postMessage({operationId:o.result,data:i??null},"*")}))};window.addEventListener("message",n),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{window.removeEventListener("message",n)})}var ze=/<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,yf=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,Xe=/<style\b[^>]*>[\s\S]*?<\/style>/gi,Ks=/display:\s*none\s*!important/gi,wf=/((?:html\s*,\s*body|body\s*,\s*html)\s*\{)([^}]*)(\})/gi,If=/\s*height\s*:\s*100%\s*!important\s*;?/gi,Tf=/height\s*:\s*100%\s*!important/i,Cf=[".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 Af(e){return Ks.lastIndex=0,(e.match(Ks)||[]).length}function zs(e){const t=e.trim(),n=Af(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=Cf.filter(o=>t.includes(o)).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 Df(e){Xe.lastIndex=0;for(const t of e.matchAll(Xe))if(zs(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function Pf(e){let t=!1;return Xe.lastIndex=0,{html:e.replace(Xe,n=>zs(n.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):n),found:t}}function Of(e){return ze.lastIndex=0,ze.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||Df(e)}function Rf(e){if(!Of(e))return{html:e,found:!1};let t=!1,n=e;ze.lastIndex=0,ze.test(n)&&(ze.lastIndex=0,n=n.replace(ze,""),t=!0),(/\sbis_[a-z0-9_-]+\s*=/.test(n)||/\sdata-bis-config\s*=/.test(n))&&(n=n.replace(yf,""),t=!0);const r=Pf(n);return n=r.html,t=t||r.found,{html:n,found:t}}function kf(e){return!e||!Tf.test(e)?e:(Xe.lastIndex=0,e.replace(Xe,t=>t.replace(wf,(n,r,o,s)=>`${r}${o.replace(If,"")}${s}`)))}function Xs(e){const t=Rf(e.replaceAll(`\r
2107
+ `)}function Vt(e){return{html:e.html,common_styles:e.common_styles,subject:e.subject,preheader:e.preheader}}function ct(e,t){return Gn(e.autosave,t===void 0?{}:{freshSince:t})?e.autosave:null}function du(e,t,n){const{latest:r}=e,o=Ht(t.html,n);return!r||t.baseOpen||r.id===t.baseRevisionId||t.baseHtmls?.some(s=>Ht(s,r.html))?o?{revision:null,phase:"normal"}:{revision:Vt(t),phase:"timeout"}:o?{revision:ct(e),phase:"normal"}:Ht(t.html,r.html)?{revision:Vt(t),phase:"found"}:{revision:ct(e),phase:"normal"}}function uu({emailId:e,readAutosave:t,revisionServiceEnabled:n,pendingKey:r,historyIsSynchronous:o=!1,readShownContent:s,onFacts:i,onLate:a,onError:c,pageLoadTs:d=cu()}){const u=r??e;let p=null,m=!1,h=!1,_=0,S={emailId:e,historyLoaded:!1,isRecovering:!1},v=null;const b=new Promise(E=>{v=E}),D=E=>{S={...S,...E},i(S)};let j;const x=E=>{_+=1,D({applied:{phase:E,seq:_}})},C=()=>{p?.timer&&clearTimeout(p.timer),p=null},I=E=>{if(!h){if(v){const y=v;v=null,y(E),j=E.revision?E.phase:void 0;return}a(E)&&E.revision&&x(E.phase)}},R=()=>{if(!p||h)return;const E=p.phase==="fast",y=E?ou:au,B=E?iu:lu;p.timer=setTimeout(()=>{const U=p;if(!(!U||h)){if(U.attempts+=1,w(),E&&U.attempts>=B){const{pending:W}=U;Pe(u),D({isRecovering:!1}),I({revision:Vt(W),phase:"timeout"}),m=!0,U.phase="bg",U.attempts=0,R();return}if(!E&&U.attempts>=B){Pe(u),C(),D({isRecovering:!1}),m=!0;return}R()}},y),p.timer.unref?.()},A=E=>{p={phase:"fast",attempts:0,pending:E,timer:null},D({isRecovering:!0}),R()},O=E=>{if(h)return;if(D({historyLoaded:!0,latestRevisionAt:E.latestAt!==void 0&&Number.isFinite(E.latestAt)?E.latestAt:void 0}),n&&p){const U=ct(E,p.pending.sentAt);if(!U)return;const W=p.phase==="fast"?"found":"bg";Pe(u),C(),D({isRecovering:!1}),m=!0,I({revision:U,phase:W});return}if(m)return;const y=n?xt(u):null,B=y&&(y.sentAt<d||!Ht(y.html,s()))?y:null;if(B){if(o&&(B.baseRevisionId!==void 0||B.baseOpen)){Pe(u),m=!0,I(du(E,B,s()));return}const U=ct(E,B.sentAt);if(U){Pe(u),m=!0,I({revision:U,phase:"found"});return}if(o){if(Pe(u),m=!0,E.latestAt!==void 0&&E.latestAt>B.sentAt+5e3){I({revision:null,phase:"normal"});return}I({revision:Vt(B),phase:"timeout"});return}A(B);return}m=!0,I({revision:ct(E),phase:"normal"})},L=E=>{h||(c?.(E),S.historyLoaded||(D({historyLoaded:!1,latestRevisionAt:void 0}),F()),!p&&I({revision:null,phase:"normal"}))},w=()=>t(e).then(O).catch(L);let P,k=!1;const F=()=>{k||p||h||(k=!0,P=setTimeout(()=>{P=void 0,!h&&!S.historyLoaded&&w()},su))};return w(),{verdict:()=>b,confirmVerdict(E){const y=j;j=void 0,E&&y!==void 0&&!h&&x(y)},dispose(){h=!0,P!==void 0&&(clearTimeout(P),P=void 0),C()}}}function fu({port:e,revisionServiceEnabled:t,pendingKey:n,historyIsSynchronous:r,emailId:o,wpId:s,readShownContent:i,onFacts:a}){let c=null;const d=uu({emailId:o,readAutosave:u=>s?e.readAutosave(u,{wpId:s()}):e.readAutosave(u),revisionServiceEnabled:t,...n?{pendingKey:n}:{},...r?{historyIsSynchronous:r}:{},readShownContent:i,onFacts:a,onLate:({revision:u,phase:p})=>{const m=fs(u);return c?.(m)??!1},onError:u=>{u instanceof Error&&u.message}});return{id:"recovery",load:()=>d.verdict().then(({revision:u})=>fs(u)),loaded(u){d.confirmVerdict(u)},watch(u){return c=u,()=>{c=null,d.dispose()}}}}var pu=5e3,hu=l.createIdentifier$1("plugin.knownRevisions");function Ke(e){return e.getOrCreateInstance(hu,()=>new Map)}function Xn(e,t,n,r){const o=n?.get(t)??[],s=o.filter(i=>i!==r);return{...e.has(t)?{baseRevisionId:e.get(t)??null}:{},...o.length>Is?{baseOpen:!0}:s.length?{baseHtmls:s}:{}}}var mu=l.createIdentifier$1("plugin.uncertainWrites"),Is=3;function dt(e){return e.getOrCreateInstance(mu,()=>new Map)}function gu(e,t,n){const r=e.get(t)??[];r.includes(n)||r.length>Is||e.set(t,[...r,n])}function Ts(e,t){Mn(e,t)||!t.baseHtmls||Mn(e,{...t,baseHtmls:void 0,baseOpen:!0})}function Gt(e,t,n,r=!1){const o=xt(e);!n||o?.sentAt!==t||!(r||o.baseOpen||o.baseHtmls)||Mn(e,{...o,baseRevisionId:n,baseHtmls:void 0,baseOpen:void 0})}function Cs(e,t,n,r){(xt(e)?.sentAt??Number.NEGATIVE_INFINITY)>n||Ts(e,{sentAt:n,html:t.html??"",common_styles:t.common_styles??"",subject:t.subject,preheader:t.preheader,...r})}var vu=/(?:Z|[+-]\d{2}:?\d{2})$/i;function Eu(e,t){const n=e;if(n?.isAutosave!==!0)return!1;const r=n.modified??"",o=vu.test(r)?Date.parse(r):NaN;return!Number.isFinite(o)||o>=t-pu}function As(e,t,{pendingKey:n=i=>i,knownRevisions:r=new Map,uncertainWrites:o,synchronousHistory:s=!1}={}){return{readRevisions:(i,a,c)=>t.readRevisions(i,a,c),readRevision:(i,a,c)=>t.readRevision?t.readRevision(i,a,c):Promise.resolve(null),readAutosave:(i,a)=>t.readAutosave(i,a),async saveAutosave(i,a,c){const d=n(i),u=Date.now();Ts(d,{sentAt:u,html:a.html??"",common_styles:a.common_styles??"",subject:a.subject,preheader:a.preheader,...Xn(r,d,o,a.html??"")});const p=await t.saveAutosave(i,a,c),m=p?.id;return Eu(p,u)?Gt(d,u,m):m&&s&&(p.isAutosave===!0?Fn(d,u):Gt(d,u,m,!0)),await e.saveAutosave(i,a),p}}}function _u(e,t,n){return{readEmail:r=>e.readEmail(r),createEmail:r=>e.createEmail(r),async updateEmail(r,o){const s=Date.now();n&&Cs(r,o,s,Xn(n.knownRevisions,r,n.uncertainWrites,o.html??""));const i=await t.updateEmail(r,o);return n&&Gt(r,s,n.knownRevisions.get(r)??void 0),await e.updateEmail(r,o),Fn(r,s),i&&{...i,id:r}}}}var Ds=l.createIdentifier$1("CurrentUser"),Ps={};function Jn(e){return e.getOrCreateInstance(Ds,()=>fe(Ps))}function Os(e){return e?.getInstance(Ds)?.get()??Ps}var Rs=l.createIdentifier$1("HeadlessMode");function ks(e){return e.getOrCreateInstance(Rs,()=>fe(!1))}function bu(e){return e?.getInstance(Rs)?.get()??!1}var Su=l.createIdentifier$1("HiddenMount");function yu(e){return e.getOrCreateInstance(Su,()=>fe(!1))}function wu(e){if(!e)return!1;try{return!!l.decodeJwt(e).data?.act_as}catch{return!1}}function Iu(e){return wu(e?.getInstance(l.COOKIE_MANAGER_ID)?.get(l.APP_COOKIES.em_token))}function Ns(e){return e?.getInstance(l.CONFIG_SOURCE_ID)?.get()??{}}function Wt(e,t){return e.user.mode||e.serverSide.mode||t||"pro"}function Tu(e,t){return t.modeDefaults(Wt(e,t.fallbackMode))}function Ls(e,t){const n=Wt(e,t);return e.serverSide.advancedConfigs?.[n]||{}}function Ms(e,t){const n=Wt(e,t),r=e.user?.advancedConfigs?.[n],o=r!==void 0?r:e.user?.advancedConfigs?.pro;return{...e.advancedConfigs?.[n],...o}}function Cu(e){let t;for(const n of e)n?.fileManager&&(t={...t,...n.fileManager});return t}function Au(e){return l.mergeResourceProxyLayers(e.map(t=>t?.resourceProxy))}function Du(e){return l.mergeResourceProxyPolicyLayers(e.map(t=>t?.resourceProxyPolicy))}function Pu(e){return l.mergeBackendProxyLayers(e.map(t=>t?.backendProxy))}function Ou(e){return l.mergeShallowConfigLayers(e.map(t=>t?.backendProxyPolicy||{}).filter(Boolean))}function Ru(e,t){return[e.base,Tu(e,t),e.profile,e.serverSide,Ls(e,t.fallbackMode),e.local,e.user,Ms(e,t.fallbackMode)]}function Qn(e,t){const n=Ru(e,t),r=l.mergeShallowConfigLayers(n),o=Cu(n);o!==void 0&&(r.fileManager=o);const s=Au(n);s!==void 0&&(r.resourceProxy=s);const i=Du(n);i&&Object.keys(i).length>0&&(r.resourceProxyPolicy=i);const a=Pu(n);a!==void 0&&(r.backendProxy=a);const c=Ou(n);return c&&Object.keys(c).length>0&&(r.backendProxyPolicy=c),r}function ku(e,t,n){const r=Ls(e,n),o=Ms(e,n);return l.pickKey([o,e.user,r,e.serverSide],t)}var Nu=1.5;function Lu(e){return e.isHeadless||!e.isEnabled||e.isUserBusy||!e.isReady||!e.isInited?"none":e.isNew?"create":!e.isDirty||e.isSnapshotSent||!e.isHistoryLoaded||e.latestRevisionAgeMs!==void 0&&e.latestRevisionAgeMs<=Nu*e.autosaveTimeoutMs?"none":"revision"}var hS=5,mS=3;function Mu(e){const{readDocument:t,readEnvironment:n,onCreate:r,onRevision:o}=e,s=e.readFailures??(()=>0),i=e.readFailureRetryable??(()=>!0);let a;const c=O=>a!==void 0&&a.version===O.get().version?s()-a.failuresAtStart:0,d=O=>{const L=c(O);if(L<=0)return!1;const w=n().retryMaxAttempts??5;return!i()||L>w},u=()=>{const{autosaveTimeoutMs:O,retryIntervalMs:L}=n(),w=t();return w!==void 0&&c(w)>0&&L!==void 0&&L>0?L:O},p=O=>O.isNew()&&s()>=3,m=()=>{const O=t();if(!O||O.isDisposed()||d(O))return"none";const{latestRevisionAt:L,snapshotVersion:w,...P}=n(),k=Date.now(),F=Lu({...P,isDirty:O.isDirty(),isNew:O.isNew(),isReady:O.isReady(),latestRevisionAgeMs:L!=null&&L<=k?k-L:void 0,isSnapshotSent:w!=null&&w===O.get().version});return F==="create"&&p(O)?"none":F},h=()=>{const O=t();if(!O||O.isDisposed()||p(O)||d(O)||n().isHeadless)return!1;if(!O.isDirty())return O.isNew();const{snapshotVersion:L}=n();return!(L!=null&&L===O.get().version)};let _,S=0,v=0,b,D,j,x=!1;const C=()=>{b=void 0;const O=t();if(!O||O.isDisposed())return;if(O.get().docId!==_){I();return}const L=m();L!=="none"&&a?.version!==O.get().version&&(a={version:O.get().version,failuresAtStart:s()}),L==="create"?r():L==="revision"?o():h()&&(_=O.get().docId,S=u(),v=s(),b=setTimeout(C,S))},I=()=>{const O=t();if(x||!O)return;const L=a?.version===O.get().version&&v!==s();b!==void 0&&(S!==u()||L)&&(clearTimeout(b),b=void 0),!(b!==void 0||m()==="none"&&!h())&&(_=O.get().docId,S=u(),v=s(),b=setTimeout(C,S))},R=O=>{const L=t();O.source==="user"?a=void 0:a&&L&&(a.version=L.get().version),O.source==="user"&&b!==void 0&&(clearTimeout(b),b=void 0),I()},A=()=>{const O=t();O!==D&&(j?.(),D=O,a=void 0,j=O?.subscribe(R),b!==void 0&&(clearTimeout(b),b=void 0))};return A(),I(),{refresh:()=>{x||(A(),I())},stop:()=>{x=!0,j?.(),j=void 0,D=void 0,b!==void 0&&(clearTimeout(b),b=void 0)}}}var xs=l.createIdentifier$1("documentSession.autosaveUiFacts"),Fs={isUserBusy:!1,saveContext:{}};function xu(e){return e.getOrCreateInstance(xs,()=>fe(Fs))}function Zn(e){return e?.getInstance(xs)?.get()??Fs}function Bs(e){return Zn(e).saveContext.fallbackTitle||"Untitled email."}var Fu=1e4,Bu=3e4;function ju(e,t){const n=m=>{const h=e.getInstance(l.CONFIG_SOURCE_ID)?.layers?.(),_=h?ku(h,m):void 0;return typeof _=="number"&&_>=0?_:void 0};let r;const o=m=>{const{error:h,failures:_}=t.saveState();return os(h)?(r?.failures!==_&&(r={failures:_,saved:m??null}),r.saved===(m??null)):(r=void 0,!1)},s=()=>{const m=t.current(),h=m?.get().serverId??void 0,_=Z(t.sessionKey()),S=t.recoveryFacts(),v=S?.emailId===h?S:void 0,b=t.revisionFacts(),D=v?.latestRevisionAt,j=b?.lastRevisionAt,x=Os(e).profile;return{isInited:_||m?.get().attributes.is_inited===!0,isEnabled:!!x?.autosaves&&!Iu(e)&&!o(m?.get().savedVersion),isHistoryLoaded:v?.historyLoaded===!0,isUserBusy:Zn(e).isUserBusy,isHeadless:bu(e),autosaveTimeoutMs:Ns(e).autosaveTimeout||Fu,latestRevisionAt:D!==void 0||j!==void 0?Math.max(D??0,j??0):void 0,snapshotVersion:b?.snapshotVersion,retryIntervalMs:n("autosaveRetryIntervalMs")??Bu,retryMaxAttempts:n("autosaveRetryMaxAttempts")}},i=()=>{const m=Zn(e).saveContext;return{...m,project:m.project??t.current()?.get().attributes.project,fallbackTitle:Bs(e)}},a=Mu({readDocument:()=>t.current(),readEnvironment:s,readFailures:()=>t.saveState().failures,readFailureRetryable:()=>Ed(t.saveState().error),onCreate:()=>{Z(t.sessionKey())||t.save("materialize",i())},onRevision:()=>{t.save("snapshot",{project:i().project})}}),c=t.subscribe(()=>{o(t.current()?.get().savedVersion),a.refresh()}),d=Jn(e).watch(()=>a.refresh()),u=xu(e).watch(()=>a.refresh()),p=ks(e).watch(()=>a.refresh());return()=>{c(),d.dispose(),u.dispose(),p.dispose(),a.stop()}}var js=12e3;function de(e){return e.getOrCreateInstance(Rn,()=>{const t=Kd({resolveAdapters:(r,o)=>Hu(r,e,o),resolveWritePort:()=>Us(e),resolveHistoryPort:r=>Z(r)?Hs(e):$s(e),resolveTerms:()=>tu(e),canEdit:r=>_c(e,r),notifyBeforeSave:Ic(e),awaitCanvasSynced:Oc(e),savedEchoForm:r=>{const o=Ie(e);return o.toEditorForm(o.toOutputForm(r))},queuesOutsideWrites:r=>Z(r)&&(Mc()||Ge(e)),timeoutMs:js,onAdapterError:(r,o)=>{o instanceof Error&&o.message;const s=Xd(o),i=zd(o);it(o,{origin:"email-source-adapter",tags:{source:r,expected_refusal:String(s),network_failure:String(i)},level:s||i?"warning":"error"})},onTimeout:r=>{}}),n=ju(e,t);return e.getInstance(l.DISPOSABLE_ID)?.addDispose(n),t})}function Ne(e){return e?.getInstance(Rn)}function Us(e){const t=Qd(e);return t?Yt(e)?_u(t,ke(e).email(e),Ge(e)?{knownRevisions:Ke(e),uncertainWrites:dt(e)}:void 0):t:ke(e).email(e)}function Uu(e){return ws(e)!==void 0||bs(e)}function $s(e){const t=ws(e);return t?Yt(e)?(te("port:history:server-backed"),As(t,ke(e).history(e),{knownRevisions:Ke(e),uncertainWrites:dt(e),synchronousHistory:Ge(e)})):(te("port:history:integrator"),t):(te("port:history:rest (порт не зарегистрирован)"),ke(e).history(e))}function Hs(e){const t=ys(e);return t?Yt(e)?(te("port:block-history:server-backed"),As(t,ke(e).blockHistory(e),{pendingKey:xn,knownRevisions:Ke(e),uncertainWrites:dt(e),synchronousHistory:Ge(e)})):(te("port:block-history:integrator"),t):(te("port:block-history:rest (порт не зарегистрирован)"),ke(e).blockHistory(e))}function $u(e){return ys(e)!==void 0||bs(e)}function Yt(e){return Oo(e)}function Hu({email:e,patch:t,serverId:n,key:r},o,s){const i=[];e?i.push({id:"rest",load:()=>ds(e),required:!0}):n&&i.push(Jd(Us(o),n)),t&&i.push({id:"plugin",load:()=>us(t)});const a=Z(r);return kc(n)&&(a?$u(o):Uu(o))&&i.push(fu({port:a?Hs(o):$s(o),revisionServiceEnabled:Yt(o),pendingKey:$o(n,a),historyIsSynchronous:Ge(o),emailId:n,wpId:()=>s.readWpId(),readShownContent:()=>s.readShownContent(),onFacts:c=>s.publishRecoveryFacts(c)})),i}function Vu(e){const t=de(e),n=le(e).addListener(l.EVENT_TYPES.APPLICATION_HAS_AMP,r=>{Ye(t)?.mutate({attributes:{isAmp:r}},{source:"remote"})});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>n.dispose())}function Gu(e){return e.size>0&&(e.type===""||e.type.startsWith("image/"))}function Wu(e){const t=e.fetchImpl??((s,i)=>fetch(s,i)),n=e.pageHost??(()=>window.location.hostname),r=new Set,o=s=>{try{const i=new URL(s,window.location.href);return i.protocol!=="https:"&&i.protocol!=="http:"?!1:i.hostname===n()||e.sourceHosts().includes(i.hostname)}catch{return!1}};return{accepts:o,async load(s){if(!o(s))return;const i=!r.has(s);r.add(s);try{const a=await t(s,{mode:"cors",credentials:"omit",cache:i?"no-cache":"default"});if(!a.ok)return;const c=await a.blob();return Gu(c)?c:void 0}catch{return}}}}var Le={maxBytes:67108864,maxImageBytes:4194304,ttlMs:18e5};function Yu(e){const t={maxBytes:e.maxBytes??Le.maxBytes,maxImageBytes:e.maxImageBytes??Le.maxImageBytes,ttlMs:e.ttlMs??Le.ttlMs},n=e.now??(()=>Date.now()),r=new Map,o=new Map,s={hits:0,loads:0,failures:0};let i=0;const a=p=>{const m=r.get(p);m&&(i-=m.bytes,r.delete(p))},c=p=>t.ttlMs<=0||n()-p.storedAt<t.ttlMs,d=()=>{if(i<=t.maxBytes)return;const p=[...r.entries()].sort((m,h)=>m[1].usedAt-h[1].usedAt);for(const[m]of p){if(i<=t.maxBytes)return;a(m)}},u=(p,m)=>{m.size>t.maxImageBytes||(r.set(p,{blob:m,bytes:m.size,storedAt:n(),usedAt:n()}),i+=m.size,d())};return{async get(p){const m=r.get(p);if(m&&c(m))return m.usedAt=n(),s.hits+=1,m.blob;m&&a(p);const h=o.get(p);if(h!==void 0)return h;s.loads+=1;const _=(async()=>{try{const S=await e.load(p);return S?u(p,S):s.failures+=1,S}catch{s.failures+=1;return}finally{o.delete(p)}})();return o.set(p,_),_},forget(p){a(p),o.delete(p)},configure(p){Object.assign(t,{maxBytes:p.maxBytes??t.maxBytes,maxImageBytes:p.maxImageBytes??t.maxImageBytes,ttlMs:p.ttlMs??t.ttlMs});for(const[m,h]of r)h.bytes>t.maxImageBytes&&a(m);d()},clear(){r.clear(),o.clear(),i=0},stats(){return{entries:r.size,bytes:i,...s}}}}var qu=["emcdn.ru","scr.emcdn.ru"];function Ku(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 zu(e,t){const n=(r,o)=>{const s=new Set(o?t:[]);for(const i of r){const a=Ku(i);a&&s.add(a)}return[...s]};return e?Array.isArray(e)?n(e,!0):n(e.value??[],e.replace!==!0):[...t]}function Xu(e){const t=e??{},n=t.isPlugin!==!0?qu:[],r=t.canvasImageCache;if(r===!1)return{enabled:!1,sourceHosts:[],...Le};const o=r===!0||r===void 0?{}:r;return{enabled:o.enabled!==!1,sourceHosts:zu(o.sourceHosts,n),maxBytes:o.maxBytes??Le.maxBytes,maxImageBytes:o.maxImageBytes??Le.maxImageBytes,ttlMs:o.ttlMs??Le.ttlMs}}function Ju(e){const t=le(e),n=e.getInstance(l.CONFIG_SOURCE_ID),r=()=>Xu({...n?.get(),isPlugin:!0});let o=r();const s=Wu({sourceHosts:()=>o.sourceHosts}),i=Yu({load:S=>s.load(S),maxBytes:o.maxBytes,maxImageBytes:o.maxImageBytes,ttlMs:o.ttlMs}),a=()=>{t.send(l.EVENT_TYPES.SANDBOX_CANVAS_IMAGE_CACHE_SETUP,{enabled:o.enabled,sourceHosts:[...o.sourceHosts]})},c=t.onInit(()=>a()),d=n?.watch(()=>{const S=r(),v=JSON.stringify(S)!==JSON.stringify(o);o=S,i.configure(S),S.enabled||i.clear(),v&&t.isInited()&&a()}),u={asked:0,served:0,refused:0},p=[],m=(S,v)=>(u.refused+=1,p.push({url:S,reason:v}),p.length>20&&p.shift(),{refused:!0}),h=Object.assign(globalThis,{__emmCanvasImages__:()=>({settings:o,counters:{...u},refusals:[...p],store:i.stats()})}),_=t.addListenerAsync(l.EVENT_TYPES.APPLICATION_CANVAS_IMAGE_GET,async S=>{const v=S?.url??"";if(u.asked+=1,!o.enabled||!v)return m(v,"disabled");if(!s.accepts(v))return m(v,"host");S.fresh&&i.forget(v);const b=await i.get(v);return b?(u.served+=1,{blob:b}):m(v,"load-failed")});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{c.dispose(),d?.dispose(),_.dispose(),i.clear(),delete h.__emmCanvasImages__})}var Qu=2e3;function Zu(e){const t=le(e),n=new Map,r=()=>{const i=t.getTarget();if(!i||t.hasPort(i))return;clearTimeout(n.get(i));const a=new MessageChannel;let c=!1,d=!1;const u=m=>{m.data?.operationId==="em:port-ready"&&(c=!0,a.port1.removeEventListener("message",u),d&&t.resumePort(i),t.drainWindow(i))};a.port1.addEventListener("message",u),t.sendPort(i,a.port2),t.usePort(a.port1,!1,i);const p=setTimeout(()=>{n.get(i)===p&&n.delete(i),!(c||!t.hasPort(i,a.port1))&&(it(new Error("canvas port did not come up, staying on window messaging"),{origin:"canvas-channel"}),d=!0,t.holdPort(i))},Qu);n.set(i,p)},o=Object.assign(globalThis,{__emmCanvasPort__:()=>{const i=t.getTarget();return{usesPort:t.usesPort,windowDrained:i?t.isWindowDrained(i):!1}}}),s=t.onInit(()=>r());e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{for(const i of n.values())clearTimeout(i);s.dispose(),delete o.__emmCanvasPort__})}var ef=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function tf(e){return ef.test(e)||e.indexOf("//")===0}function qt(e){return e&&(e.endsWith("/")?e:`${e}/`)}function nf(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:""}function Vs(e,t){const n=e==null||e===""?"./":String(e);if(tf(n))return qt(n);const r=t??nf();if(!r)return qt(n);try{return qt(new URL(n,r).href)}catch{return qt(n)}}function rf(){return typeof __emailmaker__<"u"&&__emailmaker__?.publicPath?Vs(__emailmaker__.publicPath):Vs("/")}var of=()=>"",sf=()=>"a4e11bd0";function af(e,t){const n=new URL(e);return n.hostname!=="localhost"||t.hostname==="localhost"?e:(n.hostname=t.hostname,n.toString())}function Gs(e){const t=e?"iframe-eblock":"iframe",n=of();if(n){const s=af(n,window.location).replace(/\/?$/,"/");return wo(`${s}${t}.html`,rt())}const r=sf(),o=`${rf().replace(/\/?$/,"/")}iframe/`;return wo(`${o}${t}${r?`.${r}`:""}.html`,rt())}var Ws="allow-top-navigation allow-scripts allow-popups allow-popups-to-escape-sandbox";function er(e){return/^file:/i.test(String(e||"").trim())}function lf(e){return er(e)?`${Ws} allow-same-origin`:Ws}var gS="em:module-body",cf="em:module-body-ack";function df(e,t,n){try{const r=new URL("./",new URL(t,n)).href,o=new URL(e,r).href;return o.startsWith(r)?o:void 0}catch{return}}function tr(e){const t=e.split(/[?#]/)[0].split("/").pop()??"",n=/^(.+?)(?:\.([0-9a-f]{6,}))?\.html$/.exec(t);return n?{name:n[1],hash:n[2]}:void 0}function uf(e){const t=tr(e);if(t)return t.hash?`js/${t.name}.body.${t.hash}.js`:`js/${t.name}.body.js`}function ff(e,t){const n=tr(t)?.name,r=n?e[`${n}.html`]:void 0;return r?(r.imports??[]).map(o=>e[o]?.file).filter(o=>!!o):[]}function pf(e,t){const n=tr(t)?.name,r=n?`js/${n}.js`:void 0;if(!r||!(r in e))return[];const o=new Set([r]),s=[r],i=[];for(;s.length>0;)for(const a of e[s.shift()]??[])o.has(a)||(o.add(a),i.push(a),s.push(a));return i}var hf=/^(?=[\w-]{8}$)(?:.*\d|(?=.*[a-z]).*[A-Z])/;function mf(e){const t=(e.split(/[?#]/)[0].split("/").pop()??"").split(".");return t.length>=3&&hf.test(t[t.length-2])}async function gf(e,t){const n=mf(e)?{}:{cache:"no-cache"};t?.priority&&(n.priority=t.priority);try{const r=await fetch(e,n);return r.ok?await r.blob():void 0}catch{return}}function vf(e){const t=new Map,n=(r,o)=>{const s=df(r,e.canvasSrc,e.origin);if(!s)return;const i=t.get(s);if(i!==void 0)return i;const a=e.fetchBody(s,o);return t.set(s,a),a};return{take(r){return n(r)??Promise.resolve(void 0)},warm(r,o){for(const s of r)n(s,o)},reset(){t.clear()},get size(){return t.size}}}var Se;function Ef(e){try{return er(new URL(e,window.location.href).href)}catch{return er(window.location.href)}}function Ys(e){try{if(new URL(e,window.location.href).origin===window.location.origin)return!0}catch{return!1}return typeof __emailmaker__<"u"&&__emailmaker__?.preload?.canvasCrossOrigin===!0}var _f=()=>Promise.resolve(void 0);function qs(){const e=Gs(!1);if(!Ef(e)){if(!Se||Se.canvasSrc!==e){const t=Ys(e)?gf:_f;Se={canvasSrc:e,store:vf({canvasSrc:e,origin:window.location.href,fetchBody:t}),warmed:!1}}return Se.store}}async function bf(e,t){try{const n=new URL(".vite/manifest.json",new URL("./",new URL(e,window.location.href))).href,r=await fetch(n,{cache:"no-cache"});if(!r.ok)return;const o=await r.json();t(ff(o,e))}catch{}}function nr(e){const t=qs();if(!t||!Se||Se.warmed||!Ys(Se.canvasSrc))return;Se.warmed=!0;const{canvasSrc:n}=Se,r=uf(n);r&&t.warm([r],e);const o={"js/iframe-eblock.js":["js/elMarkupHelper.Dc_IFMml.js"],"js/iframe.js":["js/elMarkupHelper.Dc_IFMml.js"],"js/darkreader.CLd5EML2.js":[],"js/elMarkupHelper.Dc_IFMml.js":[],"js/rules.CnnzdMsj.js":[],"js/typograf.all.Mun9CrLC.js":[]};o?t.warm(pf(o,n),e):bf(n,s=>t.warm(s,e))}function Sf(e){const t=qs();if(!t)return;nr();const n=r=>{const o=r.data;if(!o||o.operationId!=="em:module-body"||!o.result)return;const s=r.source;s&&(s.postMessage({operationId:cf,for:o.result},"*"),t.take(o.data?.url??"").then(i=>{s.postMessage({operationId:o.result,data:i??null},"*")}))};window.addEventListener("message",n),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{window.removeEventListener("message",n)})}var ze=/<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,yf=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,Xe=/<style\b[^>]*>[\s\S]*?<\/style>/gi,Ks=/display:\s*none\s*!important/gi,wf=/((?:html\s*,\s*body|body\s*,\s*html)\s*\{)([^}]*)(\})/gi,If=/\s*height\s*:\s*100%\s*!important\s*;?/gi,Tf=/height\s*:\s*100%\s*!important/i,Cf=[".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 Af(e){return Ks.lastIndex=0,(e.match(Ks)||[]).length}function zs(e){const t=e.trim(),n=Af(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=Cf.filter(o=>t.includes(o)).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 Df(e){Xe.lastIndex=0;for(const t of e.matchAll(Xe))if(zs(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function Pf(e){let t=!1;return Xe.lastIndex=0,{html:e.replace(Xe,n=>zs(n.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):n),found:t}}function Of(e){return ze.lastIndex=0,ze.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||Df(e)}function Rf(e){if(!Of(e))return{html:e,found:!1};let t=!1,n=e;ze.lastIndex=0,ze.test(n)&&(ze.lastIndex=0,n=n.replace(ze,""),t=!0),(/\sbis_[a-z0-9_-]+\s*=/.test(n)||/\sdata-bis-config\s*=/.test(n))&&(n=n.replace(yf,""),t=!0);const r=Pf(n);return n=r.html,t=t||r.found,{html:n,found:t}}function kf(e){return!e||!Tf.test(e)?e:(Xe.lastIndex=0,e.replace(Xe,t=>t.replace(wf,(n,r,o,s)=>`${r}${o.replace(If,"")}${s}`)))}function Xs(e){const t=Rf(e.replaceAll(`\r
2108
2108
  `,`
2109
2109
  `));return{html:kf(t.html),hasBrowserExtensionArtifacts:t.found}}function ut(e){return e?.getContent()??""}function Js(e,t){e?.mutate({content:Un(t)},{source:"remote"})}function Kt(e){return l.createIdentifier$1(e)}function ue(e,t){return e.getOrCreateInstance(t,()=>new l.AsyncEmitter)}function J(e,t){return e.getOrCreateInstance(t,()=>new l.AsyncEmitter).event}function zt(e,t,n,r){return{html:e,guid:t,...Object.keys(n).length>0?{templateDirectivesPolicy:n}:{},...r!==void 0?{rev:r}:{}}}var Nf=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 Lf(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 Mf(e,t,n){return e.isInited()&&e.getTarget()?Promise.resolve():(l.throwIfAborted(n),new Promise((r,o)=>{let s=!1,i,a;const c=u=>{s||(s=!0,i!==void 0&&(clearTimeout(i),i=void 0),a?.dispose(),n?.removeEventListener("abort",d),u())},d=()=>{c(()=>o(l.createAbortError(n?.reason)))};if(a=e.onInit(()=>{e.isInited()&&e.getTarget()&&c(()=>r())}),e.isInited()&&e.getTarget()){c(()=>r());return}t>0&&(i=setTimeout(()=>{c(()=>o(new Nf(t)))},t)),n?.addEventListener("abort",d)}))}var xf=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 Ff(e,t,n){return t<=0?e:new Promise((r,o)=>{let s=!1,i;const a=c=>{s||(s=!0,i!==void 0&&(clearTimeout(i),i=void 0),c())};i=setTimeout(()=>{a(()=>o(new xf(n,t)))},t),e.then(c=>{a(()=>r(c))},c=>{a(()=>o(c))})})}var Bf=2,ft=Symbol("sandbox:frame-replaced");function Qs(e){return e===ft}function Me(e,t,n,r,o,s,i){const a=`sandbox:${t}`,c=s?.getSandboxTimeoutMs(t)??kn[t],d=()=>{let _=Ff(e.sendAsync(n,r),c,a);return _=l.raceWithAbortSignal(_,s?.signal),Re(a,_,o)};if(t==="INIT_START"&&Lf(e)){const _=s?.getSandboxReadyTimeoutMs()??2e4,S=e,v=b=>{const D=Mf(S,_,s?.signal);return Re("sandbox:INIT_START:ready-wait",D,o).then(()=>{if(!i||b<=0)return d();const j=i.getGeneration();let x;const C=new Promise((R,A)=>{x=i.onChange(()=>{i.getGeneration()!==j&&A(ft)})}),I=d();return I.catch(()=>{}),Promise.race([I,C]).finally(()=>x?.()).catch(R=>{if(R!==ft)throw R;return{...o},v(b-1)})})};return v(Bf)}if(!i)return d();const u=i.getGeneration();let p;const m=new Promise((_,S)=>{p=i.onChange(()=>{i.getGeneration()!==u&&S(ft)})}),h=d();return h.catch(()=>{}),Promise.race([h,m]).finally(()=>p?.()).catch(_=>{throw _===ft&&{...o},_})}var Zs="self-init:";function jf(e){return e.startsWith(Zs)}function rr(e,t){const n=e.getActiveShowRequest();return jf(t)?n===null:n?.showId===t&&e.hasPendingShow(t)}function Uf(e){const t=()=>e.initPipeline(),n=e.messageService,r=()=>e.waitScope?.()??t(),o=()=>e.frameWatch?.();let s="",i;const a=_=>{i={target:e.readTarget?.(),docId:_}},c=()=>e.readDocument()?ut(e.readDocument()):s,d=()=>Ie(e.container).editorPolicy,u=()=>e.readEmail(),p=()=>{const _=u();return{..._,id:e.isTemplate()||_.isNew?void 0:_.id,html:c()}};let m=!1;const h={readContent:c,publicEmail:p,sendInitStart:()=>Me(n,"INIT_START",l.EVENT_TYPES.SANDBOX_INIT_START,{guid:u().renderGuid},void 0,r()),sendInited:()=>Me(n,"INITED",l.EVENT_TYPES.SANDBOX_INITED,{guid:u().renderGuid},void 0,r(),o()),async sendContent(){const _=u(),{html:S,hasBrowserExtensionArtifacts:v}=Xs(_?.html||"");v&&e.events.browserExtensionDetected(),Js(e.readDocument(),S),s=S,a(_.renderGuid),await Me(n,"SET_ENTITY",l.EVENT_TYPES.SANDBOX_SET_ENTITY,zt(c(),_.renderGuid,d(),e.readDocument()?.get().version),{guid:_.renderGuid,emailId:_.id??null},r(),o())},refreshContent:()=>(a(u().renderGuid),Me(n,"SET_ENTITY",l.EVENT_TYPES.SANDBOX_SET_ENTITY,zt(c(),u().renderGuid,d(),e.readDocument()?.get().version),void 0,r(),o())),sendPreheader:async()=>{const _=u();if(_.preheader!==void 0)return Me(n,"PREHEADER",l.EVENT_TYPES.SANDBOX_PREHEADER_UPDATE,{value:_.preheader,guid:_.renderGuid,force:!0},void 0,r(),o())},sendSubject:async()=>{const _=u();if(_.subject!==void 0)return Me(n,"SUBJECT",l.EVENT_TYPES.SANDBOX_SUBJECT_UPDATE,{value:_.subject,guid:_.renderGuid,force:!0},void 0,r(),o())},revealFilled:()=>e.revealFilled?.()??Promise.resolve(),showFilled:_=>e.showFilled?.(_),noteFilled:(_,S)=>e.noteFilled?.(_,S),contentSent:()=>i,readTarget:()=>e.readTarget?.(),fireWillInit:()=>e.events.willInit(p()),fireInit(_,S){if(!rr(t(),_)){t().getActiveShowRequest()?.showId;return}const v=u();v.id,v.renderGuid,t().completeShow(_);const b=e.readDocument();qe(b,{is_inited:!0},{source:"system"});const D=()=>{const x=p();S&&(x.reset=!0);const C=e.events.inited(x);return S||(m&&h.fireEmailChanged(),m=!0),C};if(!b||b.isReady())return D();const{docId:j}=b.get();return b.whenReady().then(()=>e.readDocument()?.get().docId===j?D():void 0,()=>{})},fireEmailChanged(){e.events.emailChanged(p())},fireContentChanged(){e.events.contentChanged(c())}};return h}var $f=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}},Hf=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(l.createAbortError("Superseded by newer show()")),n.aborted?Promise.reject(l.createAbortError(n.reason)):(this._activeRequest=e,new Promise((r,o)=>{const s=setTimeout(()=>{this._settle(e.showId,()=>{o(new $f(e.showId,t))})},t);s.unref?.();const i=()=>{this._settle(e.showId,()=>{o(l.createAbortError(n.reason))})};n.addEventListener("abort",i,{once:!0});const a=()=>{clearTimeout(s),n.removeEventListener("abort",i)};this._pending.set(e.showId,{request:e,resolve:r,reject:o,timeoutId:s,dispose:a});for(const c of this._listeners)c(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 Vf(e,t){return{contentReady:t.contentReady??e?.contentReady,sandboxReady:t.sandboxReady??e?.sandboxReady,sandbox:t.sandbox?{...e?.sandbox,...t.sandbox}:e?.sandbox}}function Gf(e){if(!e||!(e.contentReady!==void 0||e.sandboxReady!==void 0||e.sandbox!==void 0))return;const t=Mo(e),n=xo(e),r=Sc(e.sandbox);t<n+r}var ei=class{_controller=new AbortController;_externalSignalDisposable=new l.Disposable;_sessionChangeListeners=new Set;_showRegistry=new Hf;_timeouts;_generation=0;_sessionStarted=!1;_externalSignal;get signal(){return this._controller.signal}get externalSignal(){return this._externalSignal}get generation(){return this._generation}get contentReadyTimeoutMs(){return Mo(this._timeouts)}getSandboxTimeoutMs(e){return Lo(e,this._timeouts?.sandbox)}getSandboxReadyTimeoutMs(){return xo(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=Vf(this._timeouts,e.timeouts),Gf(this._timeouts));const t=e.replaceSession===!0||!this._sessionStarted||e.timeouts!==void 0||e.signal!==void 0;this._sessionStarted=!0,e.signal!==void 0&&(this._externalSignal=e.signal),t&&(this._replaceSessionController(),this.bumpGeneration()),(e.signal!==void 0||t)&&this._linkExternalSignal(e.signal)}relinkExternalSignal(e){this._externalSignal=e,this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new l.Disposable,this._linkExternalSignal(e)}abort(e){const t=e??l.createAbortError("Editor instance destroyed");this._showRegistry.rejectAll(t),this._controller.signal.aborted||(this._controller.abort(t),this.bumpGeneration()),this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new l.Disposable}_replaceSessionController(){this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new l.Disposable,this._showRegistry.rejectAll(l.createAbortError("Init session replaced")),this._controller.signal.aborted||this._controller.abort(l.createAbortError("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??l.createAbortError()),this.bumpGeneration());return}const t=()=>{this._controller.signal.aborted||(this._controller.abort(e.reason??l.createAbortError()),this.bumpGeneration())};e.addEventListener("abort",t),this._externalSignalDisposable.addDispose(()=>{e.removeEventListener("abort",t)})}},or=(()=>{const e=new ei;return e.configure({}),e})();function xe(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.parentNode;return n instanceof ShadowRoot&&n.host instanceof HTMLElement?n.host:null}function Fe(e){return!e||e==="none"}function Wf(e){const t=e.contain??"",n=e.willChange??"";return!Fe(e.transform)||!Fe(e.perspective)||!Fe(e.filter)||!Fe(e.backdropFilter)||!Fe(e.translate)||!Fe(e.rotate)||!Fe(e.scale)||/transform|perspective|filter/.test(n)||/paint|layout|strict|content/.test(t)||!!e.containerType&&e.containerType!=="normal"}function ti(e){const t=/paint|strict|content/.test(e.contain??"");return{x:t||!!e.overflowX&&e.overflowX!=="visible",y:t||!!e.overflowY&&e.overflowY!=="visible"}}function Yf(e){const t=[],n=document.documentElement,r=ti(getComputedStyle(n)),o=r.x||r.y;let s="none";const i=getComputedStyle(e).position;(i==="absolute"||i==="fixed")&&(s=i);for(let a=xe(e);a&&a!==n;a=xe(a)){const c=getComputedStyle(a),d=s==="none"||Wf(c)||s==="absolute"&&!!c.position&&c.position!=="static",u=a===document.body&&!o;if(d){s="none";const p=u?{x:!1,y:!1}:ti(c);(p.x||p.y)&&t.push({node:a,...p})}(c.position==="absolute"||c.position==="fixed")&&(s==="none"||c.position==="fixed")&&(s=c.position==="fixed"?"fixed":"absolute")}return t}function ni(e){const t=e.getBoundingClientRect(),n=e.offsetWidth>0&&t.width>0?t.width/e.offsetWidth:1;return{x:n,y:e.offsetHeight>0&&t.height>0?t.height/e.offsetHeight:n}}function Xt(e){return Number.parseFloat(e)||0}function sr(e){const t=e.getBoundingClientRect(),n=getComputedStyle(e),r=ni(e),o=Xt(n.borderLeftWidth),s=Xt(n.borderTopWidth),i=Xt(n.borderRightWidth),a=Xt(n.borderBottomWidth),c=e.offsetWidth>0?Math.max(0,e.offsetWidth-e.clientWidth-o-i):0,d=e.offsetHeight>0?Math.max(0,e.offsetHeight-e.clientHeight-s-a):0;return{left:t.left+o*r.x,top:t.top+s*r.y,right:t.right-(i+c)*r.x,bottom:t.bottom-(a+d)*r.y}}function qf(e,t,n){const r={left:e.left,top:e.top,right:e.right,bottom:e.bottom},o=(s,i,a)=>{i&&(r.left=Math.max(r.left,s.left),r.right=Math.min(r.right,s.right)),a&&(r.top=Math.max(r.top,s.top),r.bottom=Math.min(r.bottom,s.bottom))};return t.forEach(s=>o(sr(s.node),s.x,s.y)),n&&o(sr(n),!0,!0),r}var ir={originX:0,originY:0,scaleX:1,scaleY:1};function Jt(e,t){return{left:(e.left-t.originX)/t.scaleX,top:(e.top-t.originY)/t.scaleY,width:Math.max(0,e.right-e.left)/t.scaleX,height:Math.max(0,e.bottom-e.top)/t.scaleY}}function ri(e,t,n){const r=t.width>0&&e.width>0?e.width/t.width:n.scaleX,o=t.height>0&&e.height>0?e.height/t.height:r;return{originX:e.left-t.left*r,originY:e.top-t.top*o,scaleX:r,scaleY:o}}function oi(e,t){return Math.abs(e.left-t.left)<=.5&&Math.abs(e.top-t.top)<=.5&&Math.abs(e.width-(t.right-t.left))<=.5&&Math.abs(e.height-(t.bottom-t.top))<=.5}var Kf=1e3;function zf(e){const{slot:t,own:n}=e;let r,o=0,s=!1;const i=()=>{if(r=void 0,!s){if(!t.isConnected||!n.isConnected){e.onDetached();return}(e.measure()||performance.now()<o)&&(r=window.requestAnimationFrame(i))}},a=()=>{!s&&r===void 0&&(r=window.requestAnimationFrame(i))},c=()=>{o=performance.now()+Kf,a()},d=[window],u=[document.documentElement];for(let v=t;v;v=xe(v)){const b=v.getRootNode();b instanceof ShadowRoot&&!d.includes(b)&&(d.push(b),u.push(b))}const p=[["scroll",a],["load",a],["transitionrun",c],["transitionend",a],["transitioncancel",a],["animationstart",c],["animationend",a],["animationcancel",a]];d.forEach(v=>p.forEach(([b,D])=>v.addEventListener(b,D,{capture:!0,passive:!0}))),window.addEventListener("resize",a),document.fonts?.addEventListener?.("loadingdone",a);const m=typeof MutationObserver=="function"?new MutationObserver(v=>{v.some(b=>!n.contains(b.target))&&a()}):void 0;u.forEach(v=>m?.observe(v,{attributes:!0,childList:!0,subtree:!0,characterData:!0}));let h;try{if(typeof ResizeObserver=="function"){const v=new ResizeObserver(a);typeof v.observe=="function"&&(h=v)}}catch{h=void 0}let _=[];return{schedule:a,observe:v=>{!h||v.length===_.length&&v.every((b,D)=>b===_[D])||(h.disconnect(),_=v,v.forEach(b=>h?.observe(b)))},dispose(){s=!0,r!==void 0&&(window.cancelAnimationFrame(r),r=void 0),d.forEach(v=>p.forEach(([b,D])=>v.removeEventListener(b,D,{capture:!0}))),window.removeEventListener("resize",a),document.fonts?.removeEventListener?.("loadingdone",a),m?.disconnect(),h?.disconnect()}}}var Xf="pluginZoom",Jf=/^(?:ant|vscode|monaco|docs)-/;function Qf(e){return Jf.test(e)}function Zf(){const e="em".trim();if(!/^[a-z][a-z0-9]*$/i.test(e))throw new Error(`[cssVars] REACT_APP_CSS_VAR_PREFIX="${e}" is not a valid CSS identifier fragment.`);return e}var ep=new Set(["animation-opacity","inline-edit-border-radius","separator-border","text-link-decoration"]);function tp(){return ep}var np=new Set;function rp(e,t,n=np){return e.startsWith(`${t}-`)?!1:!Qf(e)&&!n.has(e)}function op(e,t){return`--${t}-${e}`}function si(e){const t=Zf();return rp(e,t,tp())?op(e,t):`--${e}`}function sp(e,t){const n=si(e);return t!==void 0?`var(${n}, ${t})`:`var(${n})`}function ii(e,t){return sp(e,t)}var ai=300,li=15e3,ip=5e3,ci="em-canvas-busy-style";function ap(){if(document.getElementById(ci))return;const e=document.createElement("style");e.id=ci,e.textContent="@keyframes em-canvas-busy-spin{to{transform:rotate(360deg)}}",document.head.appendChild(e)}var lp="M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z";function cp(e){const t=ii("colorPrimary","#1677ff");return e&&getComputedStyle(e).getPropertyValue(si("colorPrimary")).trim()||t}function di(e){ap();const t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"svg");n.setAttribute("viewBox","0 0 1024 1024"),n.setAttribute("width","48"),n.setAttribute("height","48"),n.setAttribute("fill","currentColor"),n.setAttribute("aria-hidden","true");const r=document.createElementNS(t,"path");r.setAttribute("d",lp),n.appendChild(r);const o=document.createElement("span");return o.setAttribute("role","img"),o.setAttribute("aria-label","loading"),o.setAttribute("style",`display:inline-flex;color:${cp(e)};animation:em-canvas-busy-spin 1s linear infinite`),o.appendChild(n),o}function dp(e,t,n){const r=t??e,o=Math.max(r.left,e.left,0),s=Math.min(r.right,e.right,n.width),i=Math.max(r.top,e.top,0),a=Math.min(r.bottom,e.bottom,n.height);return s<=o||a<=i?{x:(e.left+e.right)/2-e.left,y:(e.top+e.bottom)/2-e.top}:{x:(o+s)/2-e.left,y:(i+a)/2-e.top}}function up(e,t){const n=e.getBoundingClientRect(),r=document.createElement("div");r.setAttribute("aria-busy","true"),Object.assign(r.style,{position:"fixed",left:`${n.left}px`,top:`${n.top}px`,width:`${n.width}px`,height:`${n.height}px`,cursor:"progress"}),e.appendChild(r);const o={left:n.left,top:n.top,right:n.right,bottom:n.bottom},s=r.getBoundingClientRect();if(s.width>0&&!oi({left:s.left,top:s.top,width:s.width,height:s.height},o)){const i=Jt(o,ri(s,Jt(o,ir),ir));Object.assign(r.style,{left:`${i.left}px`,top:`${i.top}px`,width:`${i.width}px`,height:`${i.height}px`})}return{showSpinner(){r.style.background="rgba(128, 128, 128, 0.15)";const i=dp(n,t(),{width:window.innerWidth,height:window.innerHeight}),a=document.createElement("div");Object.assign(a.style,{position:"absolute",left:`${i.x}px`,top:`${i.y}px`,transform:"translate(-50%, -50%)",lineHeight:"0"}),a.appendChild(di(e.querySelector(".ant-app")??e)),r.appendChild(a)},remove:()=>r.remove()}}function ar(e){const t=document.createElement("div");t.setAttribute("aria-busy","true"),Object.assign(t.style,{position:"absolute",inset:"0",display:"flex",alignItems:"center",justifyContent:"center",cursor:"progress"});const n=getComputedStyle(e).position!=="static";n||(e.style.position="relative"),e.appendChild(t);const r=setTimeout(()=>{t.appendChild(di(e))},ai);return{remove(){clearTimeout(r),t.remove(),n||(e.style.position="")}}}var fp=8e3;function pp(){return{element:document.createElement("iframe"),ready:()=>Promise.reject(new Error("[canvas] нет элемента монтирования")),reload:()=>Promise.resolve(),reloadQuietly:()=>Promise.resolve(),followReload:()=>{},moveTo:()=>Promise.resolve(),scrollBy:()=>{},shown:!1,slot:null,whenShown:()=>Promise.resolve(),filled:void 0,noteFilled:()=>{},alignTo:()=>{},resize:()=>{},hold:()=>{},dispose:()=>{}}}function hp(e,t){for(let n=xe(e);n;n=xe(n)){const r=getComputedStyle(n),o=r.overflowX!=="visible"||r.overflowY!=="visible",s=[r.borderTopLeftRadius,r.borderTopRightRadius,r.borderBottomRightRadius,r.borderBottomLeftRadius].some(i=>Je(i)>0);if(o&&s)return n;if(n===t)return null}return null}function Je(e){return Number.parseFloat(e)||0}function Qt(e,t){return Math.abs(e-t)<=1}function mp(e){const t=getComputedStyle(e),n=Je(t.borderTopWidth),r=Je(t.borderRightWidth),o=Je(t.borderBottomWidth),s=Je(t.borderLeftWidth),i=(a,c,d)=>Math.max(0,Je(a)-Math.max(c,d));return{...sr(e),radii:[i(t.borderTopLeftRadius,n,s),i(t.borderTopRightRadius,n,r),i(t.borderBottomRightRadius,o,r),i(t.borderBottomLeftRadius,o,s)]}}function gp(e,t){const n=Qt(t.top,e.top),r=Qt(t.bottom,e.bottom),o=Qt(t.left,e.left),s=Qt(t.right,e.right),i=[n&&o?e.radii[0]:0,n&&s?e.radii[1]:0,r&&s?e.radii[2]:0,r&&o?e.radii[3]:0];return i.every(a=>a===0)?"":i.map(a=>`${a}px`).join(" ")}function vp(e,t,n,r,o,s){const i=n.readyTimeoutMs??fp,a=document.createElement("div");a.dataset.canvasHost=e,r&&(a.dataset.canvasPlace=r),a.style.position="fixed",a.style.overflow="hidden",a.style.visibility="hidden",a.style.setProperty("zoom",ii(Xf,"1"));const c=n.resolveSrc(e),d=document.createElement("iframe");d.setAttribute("sandbox",n.resolveSandbox(c)),d.setAttribute("allow","clipboard-read; clipboard-write"),d.setAttribute("title","Email content"),d.style.width="100%",d.style.border="0",d.style.display="block",d.style.minHeight="600px",d.src=c,a.appendChild(d),t.appendChild(a),n.mark?.("created"),o||n.onCreated?.(d);const u=new l.Disposable;let p=!1,m,h=!1,_,S,v,b;const D=()=>{clearTimeout(b),b=setTimeout(()=>{h||(h=!0,S?.(new Error(`[canvas] ${e}: документ не загрузился за ${i} мс`)))},i)},j=()=>p?(v=Promise.resolve(),h=!0,v):(h=!1,v=new Promise((f,g)=>{_=f,S=g}),D(),v),x=()=>{if(clearTimeout(b),p=!0,h){v=Promise.resolve();return}h=!0,n.mark?.("loaded"),_?.()};d.addEventListener("load",x),u.addDispose(()=>{clearTimeout(b),d.removeEventListener("load",x)});let C;const I=()=>{C??=n.bindResizer?.(d)},R=()=>{C?.dispose(),C=void 0};let A=null,O=null,L,w=ir,P="",k="",F=0;const E=f=>{const g=JSON.stringify(f);return g===P?!1:(P=g,a.style.visibility=f.visibility,a.style.left=`${f.css.left}px`,a.style.top=`${f.css.top}px`,a.style.width=`${f.css.width}px`,a.style.height=`${f.css.height}px`,a.style.borderRadius=f.radius,d.style.width=f.elementWidth>0?`${f.elementWidth}px`:"100%",d.style.transform=f.shiftX!==0?`translate(${f.shiftX}px, ${f.shiftY}px)`:`translateY(${f.shiftY}px)`,!0)};let y=!1;const B=()=>{if(!A)return P="",a.style.visibility="hidden",d.removeAttribute("id"),!1;n.elementId&&(d.id=n.elementId);const f=A.getBoundingClientRect(),g=Yf(A),T=O?.isConnected?O:null;L?.observe([A,d,...g.map(se=>se.node),...T?[T]:[]]);const M=qf(f,g,T),$=Math.max(0,M.right-M.left),Y=Math.max(0,M.bottom-M.top),V=getComputedStyle(A).visibility==="visible",G=$<=0||Y<=0,Q=G?{left:M.left,top:M.top,right:M.left,bottom:M.top}:M,N=G?null:hp(A,T??g[0]?.node??null),z=N?gp(mp(N),Q):"",X=se=>E({visibility:V&&!y?"":"hidden",css:Jt(Q,se),elementWidth:f.width/se.scaleX,shiftX:(f.left-Q.left)/se.scaleX,shiftY:(f.top-Q.top)/se.scaleY,radius:z});let ee=X(w);if(!G){const se=a.getBoundingClientRect();se.width>0&&!oi({left:se.left,top:se.top,width:se.width,height:se.height},Q)&&(w=ri(se,Jt(Q,w),w),ee=X(w)||ee)}return ee},U=()=>{if(!A)return!1;let f=B();const g=d.getBoundingClientRect().height;g>0&&g!==F&&(F=g,A.style.height=`${g/ni(A).y}px`,f=!0);const T=getComputedStyle(A).pointerEvents;return T!==k&&(k=T,a.style.pointerEvents=T),f},W=()=>{L?.dispose(),L=void 0},ie=f=>{L=zf({slot:f,own:a,measure:U,onDetached:W})};let re=[];const q=(f,g)=>{if(O=g,f&&re.length>0){const T=re;re=[],T.forEach(M=>M())}if(f===A){f&&!L&&ie(f),U();return}if(W(),A&&A.style.removeProperty("height"),P="",F=0,k="",A=f,!f){B(),R();return}n.onShown?.(d),ie(f),U(),I()};u.addDispose(W);const K=f=>{p=!1,m=void 0,s?.(),f&&n.onReload?.(d);let g;h||v===void 0?g=j():(D(),g=v);try{d.contentWindow?.location.reload()}catch{d.src=c}return g};return{element:d,ready(){return v??j()},reload:()=>K(!0),reloadQuietly:()=>K(!1),followReload:()=>{m=void 0,s?.(),n.onReload?.(d)},moveTo(f){if(a.parentNode===f)return v??j();p=!1,m=void 0,s?.();let g;return h||v===void 0?g=j():(D(),g=v),f.appendChild(a),n.onReload?.(d),P="",L?.schedule(),g},get shown(){return A!==null},get slot(){return A},whenShown(){return A!==null?Promise.resolve():new Promise(f=>{re.push(f)})},get filled(){return m},noteFilled(f){m=f},alignTo(f,g){q(f,g??null)},hold(f){y!==f&&(y=f,B())},scrollBy(f,g){let T=f,M=g;for(let $=A?xe(A):null;$;$=xe($)){if(Math.abs(T)<1&&Math.abs(M)<1)return;const Y=getComputedStyle($);if((Y.overflowY==="auto"||Y.overflowY==="scroll")&&$.scrollHeight>$.clientHeight){const V=$.scrollTop,G=$.scrollLeft;$.scrollBy({left:T,top:M,behavior:"instant"}),T-=$.scrollLeft-G,M-=$.scrollTop-V}}(Math.abs(T)>=1||Math.abs(M)>=1)&&window.scrollBy({left:T,top:M,behavior:"instant"})},resize(){C?.resize()},dispose(){q(null,null),R(),u.dispose(),a.remove()}}}function Ep(e){const t=new Map;let n="a";const r=()=>n==="a"?"b":"a",o=(w,P)=>w==="email"?`email:${P??n}`:w,s=new Map;let i,a=[],c=!1,d,u,p=!1,m,h,_="shown",S=0,v,b,D;const j=w=>u!==void 0&&w.filled!==void 0&&w.filled!==u,x=()=>{v=void 0;const w=m;!p||!w||u===void 0||b===u||!j(w)||(b=u,e.onForeignDocument?.({wanted:u,filled:w.filled,role:_,heldMs:Date.now()-S}))},C=()=>{p=!1,m=void 0,h=void 0,clearTimeout(v),v=void 0},I=(w,P)=>{const k=s.get("email"),F=k?.slot??null;return w&&F&&j(w)?(w.alignTo(null),p||(p=!0,S=Date.now(),v=setTimeout(x,ip)),_=P,m=w,!(i!==void 0||c)&&h!==w&&(h=w,e.onShown?.(w.element)),!d&&!i&&(d=ar(F)),!1):(p&&(C(),d?.remove(),d=void 0),w?.alignTo(F,k?.clip??null),!0)},R=()=>{p&&!c&&I(t.get(o("email")),"shown")},A=()=>{a.forEach(w=>clearTimeout(w)),a=[],i?.remove(),i=void 0,d?.remove(),d=void 0,(c||p)&&(c=!1,I(t.get(o("email")),"shown"))},O=(w,P,k)=>{const F=o(w,P),E=t.get(F);if(E)return E;const y=e.resolveMount();if(!y)return pp();const B=vp(w,y,e,w==="email"?P??n:void 0,k,w==="email"?()=>R():void 0);return t.set(F,B),B},L={get:w=>O(w),current:w=>O(w),peek:w=>t.get(o(w)),spare:()=>t.get(o("email",r())),ensureSpare:()=>O("email",r(),!0),promote(){const w=t.get(o("email",r()));if(!w)return;const P=t.get(o("email"));n=r(),D=void 0,I(w,"spare"),P?.alignTo(null)},alignSurface(w,P,k){const F=s.get(w);if(s.set(w,{slot:P,clip:k??null}),w==="email"&&c){d?.remove(),d=P?ar(P):void 0;return}const E=P?O(w):t.get(o(w));if(w!=="email"){E?.alignTo(P,k??null);return}if(!P){D=F?.slot&&E?.shown?{slot:F.slot,handle:E}:void 0,p&&(C(),d?.remove(),d=void 0),E?.alignTo(null);return}const y=D?.slot===P&&D.handle===E;if(D=void 0,F?.slot===P&&E?.shown||y){E?.alignTo(P,k??null);return}I(E,"shown")},want(w){u=w,w!==void 0&&R()},noteFilled(w,P){const k=L.byWindow(w);k&&(k.noteFilled(P),k===t.get(o("email"))&&R())},visible(){for(const w of t.values())if(w.shown)return w},byWindow(w){if(w){for(const P of t.values())if(P.element.contentWindow===w)return P}},busy(w){if(A(),!w)return;if(!L.visible()){c=!0,d?.remove(),d=void 0;const F=s.get("email");F?.slot&&(d=ar(F.slot)),a=[setTimeout(A,li)];return}const P=e.resolveMount();if(!P)return;const k=up(P,()=>L.visible()?.element.parentElement?.getBoundingClientRect()??null);i=k,a=[setTimeout(()=>k.showSpinner(),ai),setTimeout(A,li)]},remount(w){A();const P=o("email");t.forEach((k,F)=>{if(F===P){k.moveTo(w).catch(()=>{});return}k.dispose(),t.delete(F)})},dispose(){u=void 0,c=!1,C(),D=void 0,A(),t.forEach(w=>w.dispose()),t.clear(),s.clear(),n="a",u=void 0,b=void 0}};return L}var _p=l.createIdentifier$1("canvas.resizerBinder"),lr=l.createIdentifier$1("canvas.service"),bp={created:ce.canvasCreated,loaded:ce.canvasLoaded},ui=new WeakMap;function cr(e){return ui.get(e)??0}function Sp(e,t){if(e.getInstance(lr))return;const n=Ep({resolveMount:()=>t.resolveMount(),resolveSrc:o=>t.resolveSrc(o),resolveSandbox:lf,elementId:t.elementId,bindResizer:o=>e.getInstance(_p)?.(o),onCreated:o=>pt(e,o,"fresh"),onReload:o=>{ui.set(o,cr(o)+1),pt(e,o,"fresh")},onShown:o=>{const s=n.byWindow(le(e).getTarget());s&&s.element!==o&&fi(s.element)===fi(o)||pt(e,o,"switch")},mark:o=>t.mark?.(bp[o]),onForeignDocument:o=>{({...o},xc("canvas identity: place held, frame has another document",{origin:"canvas-identity",level:"warning",tags:{role:o.role},contexts:{canvasIdentity:{...o,path:window.location.pathname}}}))}}),r=le(e).addListener(l.EVENT_TYPES.SANDBOX_WHEEL,o=>{n.visible()?.scrollBy(o?.deltaX??0,o?.deltaY??0)});e.inject(lr,n),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r.dispose(),n.dispose()})}function fi(e){return e.parentElement?.dataset.canvasHost}function pt(e,t,n){const r=le(e),o=t.contentWindow;if(!o)return;const s=r.getTarget()===o;s&&n==="switch"||(n==="fresh"&&(r.forget(o),s&&r.setTarget(void 0)),r.setTarget(o),Tc(r))}function yp(e,t){pt(e,t,"promote")}function wp(e,t){pt(e,t,"switch")}function Ip(e,t){const n=t.contentWindow;n&&le(e).greet(n)}function pi(e,t){const n=t.contentWindow;n&&le(e).forget(n)}function Tp(e,t){const n=ae(e)?.byWindow(t)?.element;if(!n)return;const r=cr(n);return()=>cr(n)!==r}function ae(e){return e.getInstance(lr)}function hi({attributes:e,readContent:t,docId:n,hasSession:r,serverId:o,show:s}){if(!r)return;const i={id:o??void 0,renderGuid:n,showId:s?.id,isNew:o==null,showToken:s?.token},a={...e,...i};return Object.defineProperty(a,"html",{get:()=>t()??"",enumerable:!0,configurable:!0}),a}function Zt(e){return{...hi({attributes:e.get().attributes,readContent:()=>e.getContent(),docId:e.get().docId,hasSession:!0,serverId:e.get().serverId,show:void 0}),html:e.getContent()}}function en(e){const t=de(e),n=t.current();if(!n||!Z(t.sessionKey()))return;const r=Zt(n),o=n.isDirty();ue(e,l.events.ON_BLOCK_CLOSE_ID).fire({block:r,hasUnsavedChanges:o})}function Cp(e){const t=de(e);return!t.current()||!Z(t.sessionKey())?!1:(en(e),t.hasSuspended()?t.resumeSuspended()!==void 0:!1)}function Ap(e){const t=de(e),n=le(e),r=()=>e.getInstance(l.INIT_PIPELINE_ID)??or;let o,s,i=!1,a=!1,c,d;const u=k=>Zt(k),p=()=>{const k=j(),F=k?.get().docId;if(!k||!F||F!==c||i)return;const E=k.get().version;E!==d&&(d=E,ue(e,l.events.ON_BLOCK_CHANGED_ID).fire(u(k)))};let m;const h=k=>{const F=t.showFacts();!F||F.id===m||!rr(k,F.id)||(m=F.id,k.completeShow(F.id))},_=async(k,F,E)=>{const y=E.generation,B=()=>E.generation!==y||E.signal.aborted||t.current()!==k||a,U=me(n);let W;const ie=new Promise(q=>{W=Lt(n,()=>q("regenerated"))}),re=async(...q)=>await Promise.race([Me(...q).then(()=>"sent"),ie])==="sent";i=!0;try{if(!await re(n,"INIT_START",l.EVENT_TYPES.SANDBOX_INIT_START,{guid:F},void 0,E)||B())return;const{html:q,hasBrowserExtensionArtifacts:K}=Xs(ut(k));if(K&&ue(e,l.events.ON_BROWSER_EXTENSION_DETECTED_ID).fire(),Js(k,q),!await re(n,"SET_ENTITY",l.EVENT_TYPES.SANDBOX_SET_ENTITY,zt(ut(k),F,Ie(e).editorPolicy,k.get().version),void 0,E)||B()||!await re(n,"INITED",l.EVENT_TYPES.SANDBOX_INITED,{guid:F},void 0,E)||B())return;o=F,s=U,x(),d=k.get().version,c!==F&&(c=F,ue(e,l.events.ON_BLOCK_INIT_ID).fire(u(k))),h(E)}finally{W?.(),i=!1,me(n)!==U&&R()}};let S,v,b;const D=()=>{const k=ae(e)?.peek("block");return k?.reload?(k.reload().catch(()=>{}),!0):!1},j=()=>Z(t.sessionKey())?t.current():void 0,x=()=>{const k=j()?.get().docId,F=!k||b===k||o===k&&s===me(n);ae(e)?.peek("block")?.hold(!F)},C=()=>{if(a||(x(),p(),i))return;const k=j(),F=k?.get().docId;if(!k||!F)return;if(o===F&&s===me(n)){h(r());return}if(!k.isReady())return;const E=r();E.signal.aborted||o!==void 0&&o!==F&&S!==F&&(S=F,D())||_(k,F,E).catch(()=>{if(!(a||t.current()!==k)){if(v!==F){v=F,D();return}b=F,x()}})};let I=!1;const R=()=>{I||a||(I=!0,queueMicrotask(()=>{I=!1,C()}))};let A,O;const L=()=>{const k=j(),F=k?.get().docId;F!==O&&(A?.(),O=F,A=k?.subscribe(R)),x(),R()},w=t.subscribe(L),P=Lt(n,()=>{x(),R()});L(),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{a=!0,P(),A?.(),w()})}function Dp(e){const t=de(e);let n="email";const r=()=>{if(!t.current())return;const s=Z(t.sessionKey())?"block":"email",i=ae(e);if(s===n||!i)return;n=s;const a=i.peek(s);if(a){wp(e,a.element);return}i.get(s)},o=t.subscribe(r);e.getInstance(l.DISPOSABLE_ID)?.addDispose(o)}var Pp=200;function Op({startVersion:e,limit:t=Pp}){let n=[],r=e;const o=s=>{n=n.filter(i=>i.version>s),r=Math.max(r,s)};return{record(s){!s.changes?.length&&!s.contentReplaced||(n.push(s),n.length>t&&o(n[n.length-t-1].version))},rebase(s,i){if(i<r)return null;const a=n.filter(d=>d.version>i);o(i);let c=s;for(const d of a){if(d.contentReplaced||!d.changes)return null;const u=d.changes,p=[];for(const m of c){if(d.fromCanvas&&u.some(_=>m.range.start<=_.oldEnd&&m.range.end>=_.oldPosition))return null;const h=Wc(m.range,u,"after");if(!h)return null;p.push({range:h,text:m.text})}c=p}return c}}}function Rp(e,t){let n=0;return e.map(({start:r,end:o,text:s})=>{const i=new Ee(r,t.slice(r,o),r+n,s);return n+=s.length-(o-r),i})}function kp(e,t){const n=[...e].sort((r,o)=>r.range.start-o.range.start);return Rp(n.map(({range:r,text:o})=>({start:r.start,end:r.end,text:o})),t)}function Np(e){return[...e].sort((t,n)=>n.oldPosition-t.oldPosition).map(t=>({range:{start:t.oldPosition,end:t.oldEnd},text:t.newText}))}var Lp=32;function Mp(e=Lp){const t=new Map;return{find(n,r){const o=t.get(n);return o&&Ln(o.scope,r)?o.echo:void 0},remember(n,r,o){t.delete(n),t.set(n,{scope:r,echo:o}),t.size>e&&t.delete(t.keys().next().value)},echoes(n){return[...t.values()].filter(r=>Ln(r.scope,n)).map(r=>r.echo)}}}function xp(e,t){const n=l.findTextDiffBounds(e,t);return n?[{range:{start:n.start,end:n.fromEnd},text:t.slice(n.start,n.toEnd)}]:[]}var dr=l.createIdentifier$1("canvas.sandboxFill");function mi(e){return e.getInstance(dr)?.pipeline.isEventsLocked()===!0}var vS=.2,Fp=/<(style|script|template|noscript|textarea)\b[^>]*>[\s\S]*?<\/\1\s*>|<!--[\s\S]*?-->/gi,Bp=/<\/?[a-zA-Z]/g;function gi(e){return e.match(Bp)?.length??0}function vi(e){return[...e.matchAll(Fp)].map(t=>[t.index,t.index+t[0].length])}function ur(e,t,n){let r=0,o=0;for(const[s,i]of n){for(;o<t.length&&t[o][1]<=s;)o++;let a=s;for(let c=o;c<t.length&&t[c][0]<i;c++)r+=gi(e.substring(a,Math.max(a,t[c][0]))),a=Math.max(a,t[c][1]);r+=gi(e.substring(Math.min(a,i),i))}return r}function jp(e,t){const n=[...t].sort((c,d)=>c.oldPosition-d.oldPosition||c.oldEnd-d.oldEnd),r=[],o=[],s=[];let i=0,a=0;for(const c of n){const d=e.substring(i,c.oldPosition);r.push(d,c.newText),a+=d.length,o.push([c.oldPosition,c.oldEnd]),s.push([a,a+c.newText.length]),a+=c.newText.length,i=c.oldEnd}return r.push(e.substring(i)),{next:r.join(""),removed:o,inserted:s}}function Up(e,t){if(e.reduce((i,a)=>i+a.oldLength,0)<=200)return null;const n=vi(t),r=jp(t,e),o=ur(t,n,r.removed)-ur(r.next,vi(r.next),r.inserted),s=ur(t,n,[[0,t.length]]);return o>100&&o>s*.2?{removed:o,total:s}:null}function Be(e){it(e,{origin:"canvas-channel"})}var $p=100;function Hp(e){const t=e?.data,n=t?.action==="undo"||t?.action==="redo";return t?.operation===l.EVENT_TYPES.APPLICATION_ACTION&&n&&typeof t.actionId=="number"?{action:t.action,actionId:t.actionId}:void 0}function Vp(e){const t=de(e),n=le(e);let r;const o=(c,d)=>{const u=c.get().docId;let p=!1,m=null,h=null,_;const S=Op({startVersion:c.get().version});let v=c.getContent();const b=Mp(),D=Uo(e),j=D.open(u,()=>c.get().version);let x=!1;const C=g=>({generation:me(n),originId:g});let I=C(null),R=!0;const A=(g,T)=>{!R||t.current()!==c||(it(T,{origin:"canvas-channel"}),h?.splice(0,h.length),n.sendAsync(l.EVENT_TYPES.SANDBOX_SET_ENTITY,zt(ut(c),u,Ie(e).editorPolicy,c.get().version)).catch(Be))},O=g=>{const T=g[g.length-1],M=[...g].reverse().find(V=>V.answer?.actionId!==void 0)?.answer?.actionId,$=T.answer?.selection,Y=M!==void 0||$?{...M!==void 0?{actionId:M}:{},...$?{selection:$}:{}}:void 0;return{edits:g.map(V=>V.edits),guid:u,rev:T.rev,...Y?{historyAnswer:Y}:{}}},L=()=>{const g=d.activeMove(),T=g&&_?.action===g.kind?_:void 0;if(T&&(_=void 0),!(!T&&!g?.selection))return{...T?{actionId:T.actionId}:{},...g?.selection?{selection:g.selection}:{}}},w=g=>{P({edits:[],rev:c.get().version,answer:{actionId:g.actionId}}).catch(Be)},P=async g=>{if(h){h.push(g);return}h=[g];try{do await n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,O(h.splice(0,h.length)));while(h.length)}catch(T){A("app edits failed to reach the canvas",T)}finally{h=null}},k=g=>{g.length&&n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,O(g)).catch(Be)},F=(g,T)=>{x=!0,k(h?.splice(0,h.length)??[]);const M={edits:[g],guid:u,rev:c.get().version,...T!==null?{changeId:T}:{}};T!==null&&b.remember(T,I,M),n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,M).catch(Be)},E=new Set,y=(g,T,M)=>{F([],M);const{length:$,hash:Y}=l.textFingerprint(JSON.stringify(T.map(Q=>[Q.oldText,Q.newText]))),V=`${$}:${Y}`;if(E.has(V))return;E.add(V);const G=new Error(`canvas service batch removes ${g.removed} of ${g.total} tags`);A("canvas service batch removes a large part of the email",G)},B=({changeId:g,baseRev:T})=>{!x&&(g!==null||T!==null)&&F([],g)},U=g=>{if(g.guid!==u)return;const T=od(g);x=!1,I=C(T.originId);try{W(g,T)}catch(M){B(T),A("canvas batch failed to apply",M)}finally{B(T),T.changeId!==null&&D.note(T.changeId,I)}},W=(g,T)=>{const{pushUndoStop:M}=g,$=T.changeId!==null?b.find(T.changeId,I):void 0;if($){x=!0,n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,$).catch(Be);return}let{edits:Y,selection:V}=g;if(T.baseRev!==null){const G=S.rebase(Y,T.baseRev);if(!G){it(new Error("canvas batch conflicts with newer document changes"),{origin:"canvas-channel"}),F([],T.changeId);return}G!==Y&&(V=void 0),Y=G}try{p=!0,m=T.changeId;const G=kp(Y,c.getContent());if(M===!1){const Q=Up(G,c.getContent());if(Q){y(Q,G,T.changeId);return}d.applyWithoutHistory(G)}else d.recordAt(g.typedAt,()=>c.mutate({changes:G},{source:mi(e)?"system":"user"}),V),g.closesStep&&d.closeGroup()}finally{p=!1,m=null}},ie=c.subscribe(({changes:g,version:T})=>{const M=c.getContent(),$=!g?.length&&M!==v;if(v=M,S.record({version:T,changes:g,contentReplaced:$,fromCanvas:p}),!g?.length)return;const Y=Np(g);p?F(Y,m):P({edits:Y,rev:T,answer:L()}).catch(Be)}),re=n.addListener(l.EVENT_TYPES.APPLICATION_UPDATE_ENTITY,U),q=n.addListenerAsyncPipe(l.CUSTOM_MESSAGE,(g,T)=>{_=Hp(g);try{return T?.(g)}finally{const M=_;_=void 0,M&&w(M)}},$p),K=(g,T,{reportId:M,dropsCovered:$})=>{const Y=h?.splice(0,h.length)??[];n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,{edits:[xp(g,T)],guid:u,rev:c.get().version,resync:{textFingerprint:l.textFingerprint(T),reportId:M}}).catch(V=>A("canvas resync edit failed to reach the canvas",V)),$&&k(Y)},f=n.addListener(l.EVENT_TYPES.APPLICATION_SYNC_DRIFT,g=>{if(!((g.reason==="echo-timeout"||g.reason==="resync-failed")&&g.guid!==void 0&&g.guid!==u)){if(g.reason==="resync-failed"){A("canvas failed to apply the resync edit",new Error("canvas resync failed"));return}if(g.reason==="echo-timeout"){const{textFingerprint:T}=g,M=ut(c),$=l.textFingerprint(M);if(T?.length===$.length&&T.hash===$.hash){b.echoes(C(g.originId??null)).forEach(V=>{n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,V).catch(Be)}),g.reportId!==void 0&&K(M,M,g);return}const Y=new Error(`canvas echo timeout, ${g.unsent??0} edits unsent`);if(g.canvasText===void 0){A("canvas lost the echo of its batch",Y);return}K(g.canvasText,M,g)}}});return()=>{R=!1,j(),ie(),re.dispose(),q.dispose(),f.dispose()}};let s;const i=()=>{const c=t.current(),d=t.history(),u=c?.get().docId;u!==s&&(r?.(),r=void 0,s=u,c&&d&&(r=o(c,d)))},a=t.subscribe(i);i(),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r?.(),a()})}function Gp(e){const t=le(e),n=()=>ae(e)?.byWindow(t.getTarget()),r=t.addListenerAsync(l.EVENT_TYPES.RELOAD,()=>{n()?.followReload()}),o=t.addOffTargetListener(l.EVENT_TYPES.RELOAD,a=>{const c=ae(e)?.byWindow(a);c&&pi(e,c.element)}),s=t.addListener(a=>{a.data?.operation===l.EVENT_TYPES.SANDBOX_RESIZED&&n()?.resize()}),i=J(e,l.events.ON_EMAIL_INIT_ID)(()=>{n()?.resize()});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r.dispose(),o.dispose(),s.dispose(),i.dispose()})}function Ei(){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 Wp(e){const t=e.getInstance(l.OPTIONS_SOURCE_ID);let n,r;e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r?.remove(),r=void 0}),Sp(e,{resolveMount:()=>n,resolveSrc:s=>Gs(s==="block"),elementId:"email_iframe",mark:s=>te(s)}),t?.watch(s=>{const i=s?.element;if(n&&i instanceof HTMLElement&&i!==n){n=i,ae(e)?.remount(i),r?.remove(),r=void 0;return}if(!n){if(i instanceof HTMLElement)n=i;else if(s!==void 0){n=r??=Ei(),ae(e)?.alignSurface("email",r,r);return}else return;ae(e)?.get("email")}});let o;e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{o?.remove(),o=void 0}),yu(e).watch(s=>{const i=ae(e);if(i){if(s){o??=Ei(),i.alignSurface("email",o,o);return}o&&(i.alignSurface("email",null),o.remove(),o=void 0)}})}var fr=l.createIdentifier$1("canvas.headerFlow"),_i=["subject","preheader"],bi=3e3,Yp=3,qp={subject:l.EVENT_TYPES.SANDBOX_SUBJECT_UPDATE,preheader:l.EVENT_TYPES.SANDBOX_PREHEADER_UPDATE};function Kp(e){const t=de(e),n=le(e),r=C=>C?"remote":mi(e)?"system":"user",o=(C,{guid:I,value:R,forced:A})=>{const O=Ye(t);if(!O||typeof R!="string"||I&&I!==O.get().docId)return;const L=t.forcedHeaders();if(L?.[C]!==void 0&&!A&&R!==L[C])return;const w=O.get().attributes[C];if(!A&&h(C,R,w))return;const P=!A&&p.delete(C);A&&(v.delete(C),v.size===0&&t.endForcedHeaders()),c=!0;try{qe(O,{[C]:R},{source:P?"system":r(A)})}finally{c=!1}s[C]=R};let s={},i,a,c=!1,d=Promise.resolve();const u={},p=new Map,m=(C,I)=>{s[C]=I;const R={};p.set(C,R);const A=()=>{p.get(C)===R&&p.delete(C)};_(C,I,{force:!0}).then(A),setTimeout(A,bi)},h=(C,I,R)=>{const A=t.showFill();if(!A||typeof R!="string")return!1;const O=u[C]?.showId===A.showId?u[C]:void 0;return I===R?(u[C]=O??{showId:A.showId,codeEdits:A.codeEdits,corrections:0},!1):O&&A.codeEdits>O.codeEdits&&I!==O.stale?!1:((!O||I===O.stale&&O.corrections<Yp)&&(u[C]={showId:A.showId,stale:I,codeEdits:A.codeEdits,corrections:(O?.corrections??0)+1},m(C,R)),!0)},_=(C,I,{force:R=!1,echo:A=!1,undoStep:O=!1})=>(d=n.sendAsync(qp[C],{value:I,guid:Ye(t)?.get().docId,...R?{force:!0}:{},...A?{echo:!0}:{},...O?{undoStep:!0}:{}}).catch(L=>{}),d);let S;const v=new Set;e.inject(fr,{whenDelivered:async()=>{await d},reassert:C=>{const I=Ye(t),R=_i.filter(A=>typeof C[A]=="string");if(!(!I||R.length===0)){c=!0;try{qe(I,Object.fromEntries(R.map(A=>[A,C[A]])),{source:"system"})}finally{c=!1}t.beginForcedHeaders(Object.fromEntries(R.map(A=>[A,C[A]]))),clearTimeout(S),S=setTimeout(()=>{v.clear(),t.endForcedHeaders()},bi),v.clear();for(const A of R)v.add(A);for(const A of R)s[A]=C[A],_(A,C[A],{force:!0,echo:!0})}}});const b=()=>{i?.(),i=void 0;const C=Ye(t);if(C!==a&&p.clear(),a=C,!C){s={};return}const I=C.get().attributes;s={subject:I.subject,preheader:I.preheader},i=C.subscribe(({source:R})=>{if(c)return;const A=C.get().attributes,O=t.forcedHeaders();for(const L of _i){const w=A[L];if(w===s[L])continue;s[L]=w,p.delete(L);const P=R==="system"&&O?.[L]!==void 0;_(L,w??"",{force:P,echo:P,undoStep:R==="user"})}})};b();const D=t.subscribe(b),j=n.addListenerAsync(l.EVENT_TYPES.APPLICATION_SUBJECT_UPDATE,C=>o("subject",C)),x=n.addListenerAsync(l.EVENT_TYPES.APPLICATION_PREHEADER_UPDATE,C=>o("preheader",C));e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{j.dispose(),x.dispose(),D(),i?.(),clearTimeout(S)})}function zp(e){const t=de(e);let n={document:void 0,seq:0};const r=()=>{const s=t.recoveryFacts(),i=Ye(t);if(!s?.applied||!i||String(s.emailId)!==String(i.get().serverId)||(n.document!==i&&(n={document:i,seq:0}),s.applied.seq<=n.seq))return;n={document:i,seq:s.applied.seq};const a=t.shownHeaders();(a.subject!==void 0||a.preheader!==void 0)&&e.getInstance(fr)?.reassert(a)},o=t.subscribe(r);e.getInstance(l.DISPOSABLE_ID)?.addDispose(o)}function Xp(e,t){return(e&&e!=="system"?e:t?"dark":"light")==="dark"?l.DARK:l.LIGHT}function Jp(e,t){return{copyPasteEnabled:e.copyPasteEnabled,saveBlockEnabled:t?!1:e.saveBlockEnabled,editImageControlEnabled:e.editImageControlEnabled,elementAIimageEnabled:e.elementAIimageEnabled,imageCenterStockEnabled:e.imageCenterStockEnabled,imageCenterGifEnabled:e.imageCenterGifEnabled,imageCenterEditorEnabled:e.imageCenterEditorEnabled,blocksAddPanelEnabled:e.blocksAddPanelEnabled!==!1&&e.blocksSectionsShow!==!1}}function Qp(e){return e.isCodeMode&&(e.direction==="left"||e.direction==="right")}function Si(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function pr(e,t){const n={...e};for(const r of Object.keys(t)){const o=t[r],s=e[r];Si(o)&&Si(s)?n[r]=pr(s,o):o!==void 0&&(n[r]=o)}return n}function Zp(e,t){const n=l.COMMON_STYLES;if(typeof e=="string"){const r=e.trim();if(r.startsWith("{"))try{const o=JSON.parse(r);if(o&&typeof o=="object"&&!Array.isArray(o)&&Object.keys(o).length>0)return pr(n,o)}catch{}}return t&&typeof t=="object"&&!Array.isArray(t)?pr(n,t):n}var eh=fe(void 0),yi=eh,wi=l.createIdentifier$1("CodeMode");function Ii(){let e;try{const t=window.localStorage?.getItem(l.LOCAL_STORAGE_ITEMS.em_code_mode_settings);e=t?JSON.parse(t):void 0}catch{e=void 0}return{isCodeMode:!!(e?.isCodeMode||e?.isCodeMode===void 0),direction:e?.codeModeDirection||"left"}}function th(e){try{window.localStorage?.setItem(l.LOCAL_STORAGE_ITEMS.em_code_mode_settings,JSON.stringify({isCodeMode:e.isCodeMode,codeModeDirection:e.direction}))}catch{}}function hr(e){return e.getOrCreateInstance(wi,()=>{const t=fe(Ii());return t.watch(th),t})}function Ti(e){return e?.getInstance(wi)?.get()??Ii()}function mr(e,t){const n=hr(e);n.get().isCodeMode!==t&&n.set({...n.get(),isCodeMode:t})}function nh(e,t){const n=hr(e);n.set({...n.get(),direction:t})}var rh=l.createIdentifier$1("DefaultCommonStyles");function Ci(e){return e.getOrCreateInstance(rh,()=>fe(void 0))}function oh(e,t){Ci(e).set(t)}var sh=l.createIdentifier$1("CanvasViewport"),ih=l.createIdentifier$1("CanvasPreviewPage");function Te(e,t,n){let r,o;const s=()=>{if(!r||!e.isInited())return;const c=r.value===void 0?"undefined":JSON.stringify(r.value);c!==o&&(o=c,e.send(t,r.value))},i=n.watch(c=>{r={value:c},s()}),a=e.onInit(()=>{o=void 0,s()});return{dispose(){i.dispose(),a.dispose()}}}function tn(e){const t=fe(e());return{source:t,refresh:()=>t.set(e())}}function ah(e){const t=le(e),n=e.getInstance(l.CONFIG_SOURCE_ID),r=e.getInstance(l.OPTIONS_SOURCE_ID),o=de(e),s=hr(e),i=matchMedia(l.PREFERS_COLOR_SCHEME_DARK),a=()=>n?.get()??{};let c;const d=tn(()=>Xp(yi.get()??a().theme,i.matches)),u=tn(()=>Jp(a(),Z(o.sessionKey()))),p=tn(()=>a().lockEditor),m=tn(()=>Zp(o.current()?.get().attributes?.common_styles,c)),h=e.getOrCreateInstance(sh,()=>fe()),_=e.getOrCreateInstance(ih,()=>fe()),S=[Te(t,l.CANVAS_FACTS.theme,d.source),Te(t,l.CANVAS_FACTS.flags,u.source),Te(t,l.CANVAS_FACTS.lockEditor,p.source),Te(t,l.CANVAS_FACTS.commonStyles,m.source),Te(t,l.CANVAS_FACTS.codeMode,s.select(Qp)),Te(t,l.CANVAS_FACTS.appName,fe("emailmaker")),Te(t,l.CANVAS_FACTS.previewPage,_),Te(t,l.CANVAS_FACTS.viewport,h)],v=()=>{d.refresh(),u.refresh(),p.refresh()},b=n?.watch(v),D=Ci(e).watch(O=>{c=O,m.refresh()}),j=r?.watch(O=>{O&&"commonStyles"in O&&(c=O.commonStyles),m.refresh()});let x;const C=()=>{x?.(),x=o.current()?.subscribe(()=>m.refresh()),m.refresh(),u.refresh()};C();const I=o.subscribe(C),R=()=>d.refresh();i.addEventListener("change",R);const A=yi.watch(()=>d.refresh());e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{S.forEach(O=>O.dispose()),b?.dispose(),D.dispose(),j?.dispose(),x?.(),I(),i.removeEventListener("change",R),A.dispose()})}var gr;(function(e){function t(o,s,i=(a,c)=>a===c){if(o===s)return!0;if(o.length!==s.length)return!1;for(let a=0;a<o.length;a++)if(!i(o[a],s[a]))return!1;return!0}e.isEqual=t;function n(o,s=i=>i){const i=new Set;return o.filter(a=>{const c=s(a);return i.has(c)?!1:(i.add(c),!0)})}e.unique=n;function r(o=[],s=[],i=(a,c)=>a===c){const a=[],c=[],d=[];for(const u of o){const p=s.find(m=>i(u,m));p?d.push({prev:u,next:p}):c.push(u)}for(const u of s)o.find(p=>i(u,p))||a.push(u);return{added:a,removed:c,exists:d}}e.diff=r})(gr||(gr={}));function lh(e,t){return e.type===t.type&&e.key===t.key}function ch(e){const t=le(e),n=()=>e.getServices(l.SANDBOX_EXTENSIONS_ID)??[];let r=[];const o=t.onInit(()=>{r=n(),t.send(l.EVENT_TYPES.SANDBOX_ADD_EXTENSIONS,r)}),s=l.getServiceContainerId(l.SANDBOX_EXTENSIONS_ID),i=e.onInject(a=>{if(a!==s)return;const c=n();if(!t.isInited()){r=c;return}const{added:d,removed:u}=gr.diff(r,c,lh);if(r=c,u.length){if(u.some(p=>p.type==="script")){t.send(l.EVENT_TYPES.RELOAD);return}t.send(l.EVENT_TYPES.SANDBOX_REMOVE_EXTENSIONS,u.map(p=>p.key))}d.length&&t.send(l.EVENT_TYPES.SANDBOX_ADD_EXTENSIONS,d)});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{o.dispose(),i?.dispose()})}var dh=new Set([...Object.values(l.EVENT_TYPES).map(e=>String(e)),"INIT_MESSAGE","FETCH_USER","USER_LOGGED_IN",String(l.SANDBOX_EXTENSION_SCRIPT_STATUS_ID)]);function uh(e){return e.length>0&&!e.startsWith("em:")&&!dh.has(e)}function fh(e){const t=le(e),n=new Map;let r=!1,o=-1,s=new Set;const i=d=>(d!==o&&(o=d,s=new Set),s),a=t.observeOutgoing((d,u)=>{if(!r||!uh(d))return;const p=me(t);n.set(d,{data:u,generation:p,scripts:new Set(i(p))})}),c=t.addListener(l.SANDBOX_EXTENSION_SCRIPT_STATUS_ID,d=>{if(d.phase!=="ready"||d.status!=="success")return;r=!0;const u=me(t),p=i(u);p.add(d.key);for(const[m,h]of n)h.generation===u||![...h.scripts].every(_=>p.has(_))||(h.generation=u,t.send(l.createIdentifier(m),h.data))});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{a.dispose(),c.dispose()})}var ph=l.createIdentifier$1("prewarm.editorVisible");function hh(e){if(typeof requestAnimationFrame!="function"){setTimeout(e,0);return}requestAnimationFrame(()=>requestAnimationFrame(e))}function mh(e={}){const t=e.paint??hh;let n=!1,r=!1,o=!1,s=!1,i=!1;const a=[],c=()=>{i||s||!n||!r||!o||(s=!0,t(()=>{i=!0,te(ce.editorVisible);for(const d of a.splice(0))d()}))};return{noteShellVisible(){n=!0,c()},notePagePainted(){r=!0,c()},noteContentShown(){o=!0,c()},whenVisible(d){if(i){d();return}a.push(d)},contentShown:()=>o}}function gh(e){return e.getOrCreateInstance(ph,()=>mh())}var vh=500,Eh=500,_h=5e3;function bh(e){const t=e.quietMs??vh,n=e.floorMs??Eh,r=e.ceilingMs??_h;let o,s,i=0;const a=()=>{clearTimeout(o),clearTimeout(s),o=void 0,s=void 0},c=()=>{a(),e.run()},d=()=>{clearTimeout(o);const u=n-(Date.now()-i);o=setTimeout(c,Math.max(t,u))};return{start(){a(),i=Date.now(),s=setTimeout(c,r),d()},notify(){o!==void 0&&d()},cancel:a}}var Sh=2;function Ai(){return new Error("[sandbox] document reloaded during fill")}function yh(e,t,n){return{showId:e,reset:t,emailId:n?.id,renderGuid:n?.renderGuid}}function vr(e){try{e()}catch{}}function wh(e){let t;return vr(()=>{t=e()}),{stage:n=>vr(()=>t?.stage(n)),end:(n,r)=>vr(()=>t?.end(n,r))}}function Ih(e){const t=()=>e.initPipeline();let n=!1,r,o,s,i=0,a,c;const d=()=>{const I=e.readTarget?.(),R=e.readSandboxGeneration?.();return I===void 0||R===void 0?void 0:{target:I,generation:R}},u=()=>{const I=d();return I&&{...I,canvasReplaced:e.trackDocument?.(I.target)}},p=I=>{if(I?.canvasReplaced?.())return!0;const R=d();return I!==void 0&&R?.target===I.target&&R.generation!==I.generation},h=Uf({...e,waitScope:()=>({getSandboxTimeoutMs:I=>t().getSandboxTimeoutMs(I),getSandboxReadyTimeoutMs:()=>t().getSandboxReadyTimeoutMs(),signal:a?.signal??t().signal}),frameWatch:()=>{const I=c;if(!(!I||!e.onSandboxGenerationChange))return{getGeneration:()=>d()?.generation??I.generation,onChange:R=>e.onSandboxGenerationChange?.(()=>{(e.readTarget?.()===I.target||I.canvasReplaced?.())&&R()})??(()=>{})}}});let _;const S=(I,R)=>{if(_===I)return;_=I;const A=i;setTimeout(()=>{i!==A||t().signal.aborted||j(I,R).catch(()=>{})},0)},v=()=>{a?.abort(),a=void 0};let b;const D=()=>{const I=t().signal;I!==b&&(b?.removeEventListener("abort",v),b=I,I.addEventListener("abort",v))};async function j(I,R,A=0){const O=++i;v(),a=new AbortController,c=void 0,D();const L=()=>i!==O,w=h.readTarget(),P=t().generation,k=()=>P===t().generation&&!t().signal.aborted,F=R?"init:reset-":"init:",E=wh(()=>e.observeShow?.(yh(I,R,e.readEmail())));if(!R){const q=h.publicEmail();q?.id,q?.renderGuid,q?.preheader}let y=!1,B=!1,U,W=!1;const ie=()=>{if(p(U))throw Ai()},re=()=>{if(L())throw l.createAbortError("Fill superseded")};try{n=!0,await h.sendInitStart(),re(),U=u(),c=U,A===0&&h.fireWillInit(),await(R||A>0?h.refreshContent():h.sendContent()),y=!0,re(),ie();const q=h.contentSent();h.noteFilled(q?.target,q?.docId),E.stage("content"),R||h.publicEmail()?.id;try{await h.sendPreheader()}catch(K){if(Qs(K)||L())throw K;`${F}`,String(K)}re();try{await h.sendSubject()}catch(K){if(Qs(K)||L())throw K;`${F}`,String(K)}if(re(),ie(),h.showFilled(w),await h.sendInited(),re(),ie(),B=!0,o===I){const K=e.readSandboxGeneration?.()??s;K!==void 0&&(r=K)}E.stage("reveal"),await h.revealFilled(),ie(),E.end("revealed")}catch(q){const K=!L()&&k()&&p(U),f=K?Ai():void 0,g=f??q,T=K&&A<Sh?C(I,R,A+1):void 0;W=K&&T===void 0;const M=L()?void 0:{showId:I,contentApplied:y,sandboxInitedAcked:B,superseded:!1,...e.describeSurface?.(),error:String(f??q)};M&&(`${F}`,void 0);const $=!L()&&e.recoverFailedFill?.(w)===!0;if(E.end(L()?"superseded":$?"recovered":l.isAbortError(g)||!k()?"aborted":"failed",M),!$&&!L()&&rr(t(),I)&&t().failShow(I,g),T!==void 0)return T;throw g}finally{x(I,R,F,{superseded:L(),sessionGeneration:P,contentApplied:y,sandboxInitedAcked:B&&!W,retry:!W,commit:k()})}}function x(I,R,A,O){const{superseded:L,contentApplied:w,sandboxInitedAcked:P}=O;if(L){`${A}`;return}P&&O.commit?h.fireInit(I,R||void 0):P?(`${A}`,O.sessionGeneration,t().generation,t().signal.aborted,void 0):w?(`${A}`,void 0):(`${A}`,void 0),n=!1,a=void 0,!P&&o===I&&(o=void 0,r===s&&(r=void 0)),!P&&w&&O.retry&&S(I,R)}function C(I,R,A){return j(I,R,A)}return{channel:h,isEventsLocked:()=>n,filledGeneration:()=>r,markFilled:I=>{r=I},lastCorrelation:()=>o,markCorrelation:I=>{o=I},bumpRunSeq:()=>{i+=1},noteSandboxGeneration:I=>{s=I},fill:I=>j(I,!1),refill:I=>j(I,!0),stop:()=>{i+=1,v(),n=!1,b?.removeEventListener("abort",v),b=void 0}}}function Th(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:Di(e,n)}function Di(e,t){return t?e?.id==null?!1:String(e.id)===String(t):!0}function Ch(e){const{pipeline:t,readEmail:n,readDocument:r,readRouteEmailId:o,readSandboxGeneration:s}=e,i=u=>{const p=n(),m=o();if(!Th(p,u,m)){u.showId,u.navId,u.emailId,p?.id,p?.showId,p?.renderGuid;return}u.showId,p?.id,p?.renderGuid,t.markFilled(s()),t.markCorrelation(u.showId),t.fill(u.showId).catch(()=>{})};return{showRequested:u=>{i(u)},showRequestIdentityChanged:()=>{const u=e.initPipeline().getActiveShowRequest();u&&i(u)},selfInitChanged:()=>{if(e.initPipeline().getActiveShowRequest())return;const u=s();if(t.filledGeneration()===u)return;const p=n(),m=o();if(!p?.renderGuid||!Di(p,m))return;const h=`${Zs}${p.renderGuid}`;t.markFilled(u),t.markCorrelation(h);const _=r()?.isReady()===!0;p.id,p.renderGuid,(_?S=>t.refill(S):S=>t.fill(S))(h).catch(()=>{t.lastCorrelation()===h&&t.markFilled(void 0)})},saasChanged:()=>{const u=n();u?.renderGuid,u?.showToken,u?.id,r()}}}var Ah=l.createIdentifier$1("canvas.health");function Dh(e){return e??""}function Ph(e,t,n,r){return[e??"",t??"",n==null?"":String(n),r??""].join("|")}function Pi(e){return e.length>0}function Oh(e){const t=de(e),n=le(e),r=()=>Z(t.sessionKey())?void 0:t.current(),o=()=>{const N=r();return hi({attributes:N?.get().attributes??{},readContent:()=>N?.getContent(),docId:N?.get().docId,hasSession:!!N,serverId:N?.get().serverId,show:t.showFacts()})},s=()=>e.getInstance(l.INIT_PIPELINE_ID)??or;let i={},a=!1;const c=e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(N=>{a=!!N?.element});let d=!1,u=!1,p=!1,m=0;const h=()=>{const N=ae(e);if(!N)return;const z=++m,X=N.spare();return X&&pi(e,X.element),(X?X.reloadQuietly():N.ensureSpare()?.ready())?.then(()=>{if(z!==m)return;d=!0;const ee=N.spare();ee&&Ip(e,ee.element),p&&(p=!1,P(),K())})},_=bh({run:()=>{p||h()?.catch(()=>{})}}),S=()=>{gh(e).noteContentShown(),!d&&!p&&_.start()};let v=!1;const b=N=>{const z=ae(e),X=z?.spare()?.element.contentWindow;u&&z&&X&&N===X&&(u=!1,z.promote(),z.busy(!1),v=!0)};let D=!1;const C=Ih({container:e,messageService:n,initPipeline:s,readDocument:r,readEmail:o,revealFilled:()=>{const N=ae(e);return v&&N&&(v=!1,_.start()),a?N?.current("email").whenShown()??Promise.resolve():Promise.resolve()},showFilled:b,noteFilled:(N,z)=>ae(e)?.noteFilled(N,z),recoverFailedFill:N=>{const z=ae(e),X=z?.spare()?.element.contentWindow;return!u||!z||!X||N!==X?!1:(u=!1,d=!1,L="reload",z.busy(!1),z.peek("email")?.reload(),D=!0,K(),!0)},readTarget:()=>n.getTarget(),isTemplate:()=>!!i.isTemplate,readSandboxGeneration:()=>me(n),onSandboxGenerationChange:N=>Lt(n,N),trackDocument:N=>Tp(e,N),observeShow:N=>e.getInstance(Ah)?.begin(N),describeSurface:()=>({canvasPath:L,promoted:u,spareClean:d,handshake:n.isInited(),generation:me(n)}),events:{willInit:N=>{ue(e,l.events.WILL_EMAIL_INIT_ID).fire(N)},inited:N=>{S(),ue(e,l.events.ON_EMAIL_INIT_ID).fire(N)},contentChanged:N=>{ue(e,l.events.ON_CONTENT_CHANGED_ID).fire(N)},emailChanged:N=>{ue(e,l.events.ON_EMAIL_CHANGED_ID).fire(N)},browserExtensionDetected:()=>{ue(e,l.events.ON_BROWSER_EXTENSION_DETECTED_ID).fire()}}}),I=Ch({pipeline:C,initPipeline:s,readEmail:o,readDocument:r,readRouteEmailId:()=>i.emailId,readSandboxGeneration:()=>me(n)});let R="",A="",O="",L="none";const w=()=>{const N=ae(e)?.spare()?.element.contentWindow;N&&n.getTarget()===N||n.sendNow({operation:l.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!0})},P=()=>{const N=ae(e)?.spare();N&&(w(),d=!1,u=!0,yp(e,N.element))},k=(N,z)=>{const X=ae(e);if(!X)return!0;const ee=X.spare(),se=ee&&d?"spare":"prepare";if(L=se,X.busy(!0),ee&&d)return P(),!0;_.cancel(),w();const He=h();if(He===void 0)return L="reload",X.busy(!1),X.peek("email")?.reload(),!0;p=!0;const Ae=m;return He.catch(()=>{!p||Ae!==m||(p=!1,L="reload",X.busy(!1),X.peek("email")?.reload())}),!1},F=()=>{if(Z(t.sessionKey()))return;Y(),C.noteSandboxGeneration(me(n));const N=o(),z=Ph(N?.renderGuid,N?.showId,N?.id,i.emailId),X=Dh(N?.renderGuid);if(X!==A){const He=A;A=X;const Ae=ae(e)?.peek("email")?.filled,oS=Ae!==void 0&&Ae!==X;Pi(X)&&(Pi(He)||oS)&&k(He||(Ae??""),X)}if(p)return;(z!==R||D)&&(D=!1,R=z,I.showRequestIdentityChanged());const ee=r(),se=`${z}|${ee?.get().docId??""}|${me(n)}`;se!==O&&ee?.isReady()===!0&&(O=se,I.selfInitChanged()),I.saasChanged(),re()};let E=!1,y="",B="",U=!1,W=!1;const ie=N=>{N.source==="user"?W=!0:(r()?.isReady()===!1||t.forcedHeaders()!==void 0)&&(U=!0),K()},re=()=>{const N=o();if(!N?.renderGuid)return;const z=C.channel.readContent(),X=JSON.stringify([N.preheader,N.common_styles,N.meta,N.subject,N.utm_parameters?.utm_campaign??"",N.utm_parameters?.utm_content??"",N.utm_parameters?.utm_medium??"",N.utm_parameters?.utm_source??"",N.utm_parameters?.utm_term??""]),ee=E&&z!==B,se=E&&X!==y;E=!0,B=z,y=X;const He=U&&!W;if(U=!1,W=!1,C.isEventsLocked()||He)return;const Ae={...N,id:i.isTemplate||N.isNew?void 0:N.id,html:z};if(ee){ue(e,l.events.ON_CONTENT_CHANGED_ID).fire(z),ue(e,l.events.ON_EMAIL_CHANGED_ID).fire(Ae);return}se&&N.is_inited&&ue(e,l.events.ON_EMAIL_CHANGED_ID).fire(Ae)};let q=!1;const K=()=>{q||(q=!0,queueMicrotask(()=>{q=!1,F()}))};e.inject(dr,{pipeline:C,setRoute:N=>{N.emailId===i.emailId&&!!N.isTemplate==!!i.isTemplate||(i=N,K())}});let f,g;const T=()=>{const N=r()?.get().docId;N!==g&&(f?.(),g=N,f=r()?.subscribe(ie)),K()};let M,$;const Y=()=>{const N=e.getInstance(l.INIT_PIPELINE_ID);!N||N===M||($?.(),M=N,$=N.onShowRequested(z=>I.showRequested(z)))},V=n.addListener(N=>{N.data?.operation===l.EVENT_TYPES.SANDBOX_RESIZED&&_.notify()}),G=t.subscribe(T),Q=Lt(n,K);T(),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{c?.dispose(),$?.(),Q(),G(),f?.(),V.dispose(),_.cancel(),C.stop()})}function Rh(){return l.USEBLOCKS!=="emailmaker"}var kh={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:"",saveHotkeyEnabled:!0,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},Oi={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:"",saveHotkeyEnabled:!0,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}},Ri=Oi,Nh=["pro"],Er={};function Lh(e){Er=e}var ki=e=>Nh.includes(e)?Ri:Er[e]??Er.editor??Ri,_r={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:"",saveHotkeyEnabled:!0,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},Mh={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:"",saveHotkeyEnabled:!0,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},xh={..._r,config:{..._r.config,imageCenterFileManagerView:!1}};Lh({pro:Oi,editor:Mh,simple:Rh()?_r:xh,blocks:kh});function Fh(e,t,n=e.getInstance(l.CONFIG_SOURCE_ID)){n?.setMode(t),n?.get()?.codeEnabled===!1&&Ti(e).isCodeMode&&mr(e,!1)}function Bh(e){e.getInstance(l.STANDALONE_ACTIVATED_ID)||e.inject(l.SECURITY_MODULE_ID,void 0)}function nn(e){return String(e.standaloneKey||"").trim()||void 0}function jh(e){return e.standaloneOnAuthFailure===!0?!0:e.config?.standaloneOnAuthFailure===!0}function br(e){return jh(e)?!!nn(e):!1}function ht(e){return!!nn(e)&&!br(e)}var Uh=["backendProxy","backendProxyPolicy","resourceProxy","resourceProxyPolicy"];function Ni(e){return e==="server"?"serverSide":e}function $h({env:e,base:t={},budgetMs:n}){const r={base:t,profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}},o=fe();let s={kind:"pending"},i;const a=new Promise(m=>{i=m}),c=n===void 0?void 0:setTimeout(()=>{u({kind:"absent",reason:`серверный слой не пришёл за ${n} мс`})},n);function d(){s.kind!=="pending"&&o.set(Qn(r,e))}function u(m){if(s.kind!=="pending")return;clearTimeout(c),s=m;const h=Qn(r,e);o.set(h),i(h)}function p(m,h){r[Ni(m)]=h,m==="server"&&s.kind==="pending"?u({kind:"applied"}):d()}return{watch:m=>o.watch(m),select:m=>o.select(m),get:()=>o.get(),ready:()=>a,state:()=>s,layers:()=>({...r}),bootstrap(){const m=Qn(r,e);return Object.fromEntries(Uh.map(h=>[h,m[h]]))},merge(m,h){p(h,{...r[Ni(h)],...m})},replace(m,h){p(h,m)},setMode(m){r.user={...r.user,mode:m},d()},setAdvancedConfigs(m){r.advancedConfigs=m,d()},serverAbsent(m){u({kind:"absent",reason:m})},applyServerResponse(m){s.kind==="pending"&&p("server",{...r.serverSide,...m})},dispose(){clearTimeout(c)}}}var Hh=5e3,ES="pro";function Vh(){return{...ki("pro")?.config,mergeTags:void 0}}function Gh(e,t){e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(n=>{t.setAdvancedConfigs({...n.advancedConfigs,...n.config?.advancedConfigs});const r=n.config??{},o=t.layers().user.mode;t.replace(r.mode===void 0&&o!==void 0?{...r,mode:o}:r,"user")})}function Wh(e,t){let n;Jn(e).watch(({profile:r})=>{const o=`${r?.theme??""}|${r?.locale??""}`;if(o===n)return;n=o;const s={};r?.theme&&(s.theme=r.theme),r?.locale&&(s.locale=r.locale),t.replace(s,"profile")})}function Yh(e){if(!(!e||typeof e!="string"))return e==="simple"?"pro":e}function qh(e,t){let n,r=!1,o;const s=a=>{o??=Wt(t.layers(),localStorage.getItem("configSwither")||void 0),t.get()?.mode!==a&&Fh(e,a,t)},i=Jn(e).watch(({profile:a})=>{const c=a?.email_builder_config,d=Yh(c);if(d===void 0||c===n)return;const u=n===void 0;n=c,!(u&&r)&&s(d)});e.getInstance(l.DISPOSABLE_ID)?.addDisposable(i),t.ready().then(a=>{if(!a.configSwither)return;const c=localStorage.getItem("configSwither")||(n===void 0?a.mode:o)||"editor";localStorage.setItem("configSwither",c),r=n===void 0,s(c)})}var Li="замкнутый контур: app_init не выполняется";function Kh(e,t){if(e.getInstance(l.SECURITY_MODULE_ID)){t.serverAbsent(Li);return}const n=e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(r=>{ht(r)&&t.serverAbsent(Li)});n&&e.getInstance(l.DISPOSABLE_ID)?.addDisposable(n)}async function zh(e,t){if(e.getInstance(On)===void 0){t.serverAbsent("app_init не зарегистрирован");return}try{const n=await e.getInstanceAsync(l.APP_ID);t.applyServerResponse(n?.app_config??{})}catch(n){t.serverAbsent(`app_init не выполнился: ${String(n)}`)}}function Xh(e){e.injectFactory(l.CONFIG_SOURCE_ID,(t,n)=>{if(n)return n;const r=$h({base:Vh(),env:{modeDefaults:o=>ki(o)?.config||{},fallbackMode:localStorage.getItem("configSwither")||void 0},budgetMs:Hh});return Gh(e,r),Wh(e,r),qh(e,r),Kh(e,r),zh(e,r),e.getInstance(l.DISPOSABLE_ID)?.addDisposable(r),r},!0)}var Qe=class extends l.Disposable{_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 H(e,t,n){const r=l.snapshot(e);return(o,s,i)=>{const a=r(async c=>{const d=t?t(c):c;i&&o.bind(i);const u=await o(d);return n?n(u):u},s,i);return()=>a.dispose()}}var Jh=class{deps;handleDestroy;constructor(e){this.deps=e;const t=new l.Emitter;this.handleDestroy=H(t.event),e.lifetime.addDispose(()=>t.fire(e.getInstance()));const n=e.lifetime.addDisposable(new Qe(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{}}},Sr=l.createIdentifier$1("DestroyableService");function Qh(e){e.injectFactory(Sr,(t,n)=>{if(n)return n;const r=e.getInstance(l.DISPOSABLE_ID);if(!r)throw new Error("[plugin] время жизни экземпляра не зарегистрировано");return new Jh({lifetime:r,options:e.getInstance(l.OPTIONS_SOURCE_ID),getInstance:()=>e.getInstance(l.INSTANCE_ID),release:()=>l.releaseContainer(e.getInstance(l.STORE_ID)??e)})},!0)}function Zh(e){const t=e.getInstance(Sr);if(!t)throw new Error("[plugin] provideDestroyable не выполнен до сборки поверхности");return{handleDestroy:t.handleDestroy,destroy:()=>t.destroy()}}var em=1e3;function Mi(e,t,n=em,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 o=Object.keys(e),s=Object.keys(t);if(o.length!==s.length)return!1;for(const i of o)if(!Mi(e[i],t[i],n,r+1))return!1;return!0}return!1}function mt(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 o=t[r],s=e[r];Mi(o,s)||(n[r]=o)}return n}var tm=({source:e,emailtags:t,group:n,tags:r,...o})=>o;async function nm(e,t){try{return{id:(await t(await e)).id}}catch{return}}async function rm({emails:e,saveTimeoutMs:t},n,r){const o=t?.()??st();let s;try{const i=e.notifySave(n);return await Promise.race([i,new Promise((a,c)=>{s=setTimeout(()=>{const d=new Nt(o);n.value.id,hd(d,nm(i,r)),c(d)},o)})])}catch(i){throw rs(i),i}finally{s!==void 0&&clearTimeout(s)}}function om(e){const{emails:t}=e,n=async(r,o)=>{const s=tm(o),i=r===void 0?void 0:await t.cache.getIfPresent(r),a=i?{...i,...s}:s,c=i?mt(i,s):s,d=u=>{const p=String(u.id??r??l.generateUUID()),m=u.id===void 0?{...u,id:p}:u;return t.cache.addOrUpdate(p,()=>m)};return await d(await rm(e,{prev:i,patch:c,value:a,source:o.source??""},d))};return{async readEmail(r){return await t.get(r)??null},async createEmail(r){const o=await n(void 0,r);return o?.renderGuid?o:{...o,renderGuid:l.generateUUID()}},async updateEmail(r,o){return await n(r,o)}}}var yr=20;function sm(e){const t=im(e);return e.saveTimeoutMs?am(t,e.saveTimeoutMs):t}function im({revisions:e,revisionsByEmail:t,readAutosave:n,savedAt:r,emailAuthor:o,integratorProject:s}){const i=async(a,c)=>(t.clear(),await t.get(a,{page:c}),(await e.cache.values()??[]).filter(d=>String(d?.parent)===String(a)));return{async readRevisions(a,c=1){const d=await i(a,c);return{revisions:d.slice(yr*(c-1),yr*c),page:c,hasMore:d.length>yr*c}},async readAutosave(a){const c=await r?.(a)??NaN,d=Number.isFinite(c)?c:void 0,u=await n?.(a);if(!u?.asked)return yd(await i(a,1),d);if(!u.revision)return as([],d);const p={...u.revision,parent:a,isAutosave:!0};return as([p],d,await i(a,1))},async saveAutosave(a,c){const d=await o?.(a),u=s?.();return await e.create({...Dd(c),...d!==void 0?{author:d}:{},...u!==void 0?{project:u}:{},parent:a,isAutosave:!0,modified:new Date().toString()})}}}function am(e,t,n){return{...e,async saveAutosave(r,o){const s=t();if(s===void 0)return e.saveAutosave(r,o);let i;try{return await Promise.race([e.saveAutosave(r,o),new Promise((a,c)=>{i=setTimeout(()=>c(new Bo(s,n)),s)})])}catch(a){throw rs(a),a}finally{i!==void 0&&clearTimeout(i)}}}}var lm=class extends l.BaseEmitter{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}},cm=class extends l.AsyncEmitter{};function _S(e){return e}var xi=class extends l.Disposable{_items=new Map;_onChangeEmitter=new l.Signal;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 o=await t(n);return l.deepEqual(n,o)||this._onChangeEmitter.fire(),o}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(([o,s])=>o)),r=(await this.entries()).filter(([o,s])=>!n.has(o));for(const[o,s]of e)t.push(this.addOrUpdate(o,()=>s)),n.add(o);for(const[o]of r)t.push(this.remove(o));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 dm(e,{filter:t,order:n="asc",orderBy:r,page:o,pageSize:s=20}={}){const i=e.length;let a=e.length;if(t!==void 0){const c=Object.keys(t);e=e.filter(d=>{for(const u of c){const p=d[u],m=t[u];return u==="id"||typeof p!="string"?p===m:typeof m=="string"&&p.startsWith(m)}return!0}),a=e.length}return r&&(e=e.sort((c,d)=>(c[r]>d[r]?1:d[r]>c[r]?-1:0)*(n==="asc"?1:-1))),o!==void 0&&(e=e.slice(s*(o-1),s*o)),{data:e,filteredTotal:a,total:i,totalPages:Math.ceil(a/s)}}function um(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 o=t.get(r.id)||{};t.set(r.id,{...o,...r})}return[...t].map(([n,r])=>r)}function fm(e,t){return Fi(e)&&Fi(t)?String(e)===String(t):e===t}function Fi(e){return typeof e=="string"||typeof e=="number"}var pm=class extends l.Disposable{_cache=new xi;_readEmitter=new l.AsyncEmitter;_saveEmitter=this.addDisposable(new lm);_removeEmitter=this.addDisposable(new cm);_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)))}hasReadHandler(){return this._readEmitter.hasListeners()}get cache(){return this._cache}byForeignKey(e){let t=this._foreignCache[e];if(!t){const n=this.addDisposable(new l.Disposable);n.addDispose(()=>delete this._foreignCache[e]);const r=n.addDisposable(new xi),o=n.addDisposable(new l.AsyncEmitter);t=this._foreignCache[e]={get:async(s,i={})=>{await r.getOrCreate(s,async()=>{try{const c=um(await o.fire(s))||[];for(const d of c)d[e]=s,await this._cache.add(d.id,d);return c}catch{return[]}});const a=(await this._cache.values()||[]).filter(c=>{const d=c[e];return d==null||fm(d,s)});return dm(a,i)},first(s,i={}){return t.get(s,{...i,page:1,pageSize:1}).then(({data:a})=>a[0])},handleRead:o.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=l.generateUUID()),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 o=>{const s=o?{...o,...t}:t;if(!r)return t=o?mt(o,t):t,await this._saveEmitter.fire({prev:o,patch:t,value:s,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 gt(e){const t=l.createIdentifier$1(e);return n=>n.getOrCreateInstance(t,()=>new pm)}function Bi(e){const t=e.getInstance(l.DISPOSABLE_ID);if(!t)throw new Error("Failed");return t}function ji(e){return Object.prototype.hasOwnProperty.call(e,"meta")}function rn(e,t){const n={...e};return t===void 0?(delete n.meta,n):(n.meta={...e.meta??{},...t},n)}function hm(e,t,n){return e&&!ji(t)&&ji(e)?{...n,meta:e.meta}:n}var mm=l.createIdentifier$1("CurrentProject"),gm={};function vt(e){return e?.getInstance(mm)?.get()??gm}function wr(e){const t=vt(e).card?.id,n=Number(t);return t!=null&&t!==""&&Number.isFinite(n)?n:void 0}var Ui=gt("plugin.dataSource.emails"),$i=gt("plugin.dataSource.emailRevisions"),Hi=Kt("plugin.readEmailAutosave"),Vi=l.createIdentifier$1("emailDocuments.provided");function vm(e){const t=Ui(e),n=$i(e),r=n.byForeignKey("parent");if(e.getInstance(Vi))return{emails:t,emailRevisions:n};e.inject(Vi,!0);const o=()=>st(e.getInstance(l.INIT_PIPELINE_ID)?.contentReadyTimeoutMs),s=om({emails:t,saveTimeoutMs:o}),i=new Map,a=(c,d)=>u=>{const p=u?.id??d;return(typeof p=="string"||typeof p=="number")&&i.set(String(p),c),u};return Zd(e,{...s,createEmail:c=>s.createEmail(c).then(a(Date.now())),updateEmail:(c,d)=>s.updateEmail(c,d).then(a(Date.now(),c))}),ru(e,sm({revisions:n,revisionsByEmail:r,readAutosave:async c=>{const d=await ue(e,Hi).fire(c);return d.length===0?{asked:!1}:{asked:!0,revision:d[0]??null}},savedAt:async c=>{const d=bd((await t.cache.getIfPresent(c))?.modified),u=i.get(String(c))??NaN;return Number.isFinite(u)&&!(d>=u)?u:d},emailAuthor:async c=>(await t.cache.getIfPresent(c))?.author,saveTimeoutMs:o,integratorProject:()=>vt(e).requested})),Bi(e).addDisposable(t.onSave(({prev:c,patch:d,value:u})=>hm(c,d,u),Number.MIN_VALUE)),{emails:t,emailRevisions:n}}function Gi(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 Em(e){try{return localStorage.getItem(e)===null?!1:(localStorage.removeItem(e),!0)}catch{return!1}}var _m="po",on=null;function bm(){const e=typeof __emailmaker__<"u"?__emailmaker__?.require:void 0;return typeof e!="function"?Promise.reject(new Error("[loadPoParser] AMD loader is unavailable")):new Promise((t,n)=>{e([_m],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadPoParser] Failed to require po module")))})}function Sm(){return on===null&&(on=bm().catch(e=>{throw on=null,e})),on}async function Wi(e){if(typeof e=="object")return Ir(e);if(typeof e!="string")return;const t=e.trim();if(t)return t.startsWith("{")||t.startsWith("[")?ym(t):wm(t)}function Ir(e){if(!(e==null||typeof e!="object"||Array.isArray(e)))return e}function ym(e){try{return Ir(JSON.parse(e))}catch{return}}var Yi=!1;async function wm(e){try{return Ir((await Sm()).parsePoCatalog(e))}catch{Yi||(Yi=!0);return}}var Im="em_locale",Tm="em_ant_locale",Cm="locale",Am="ant_locale";function Tr(e){try{return JSON.parse(localStorage.getItem(e)||"")}catch{return null}}function qi(e,t){const n=Tr(e);if(!n)return null;try{localStorage.removeItem(e),localStorage.setItem(t,JSON.stringify(n))}catch{}return n}function Dm(){return Tr("em_locale")??qi(Cm,"em_locale")}function Ki(e){try{localStorage.setItem(Im,JSON.stringify(e))}catch{}}function Pm(){return Tr("em_ant_locale")??qi(Am,"em_ant_locale")}function Om(e,t){try{localStorage.setItem(Tm,JSON.stringify({id:e,data:t}))}catch{}}var bS="en_US",Rm=8e3;function km(e,t){const n=e,r=t,o=Object.keys(n).filter(s=>s!=="");return o.length!==Object.keys(r).filter(s=>s!=="").length?!1:o.every(s=>JSON.stringify(n[s])===JSON.stringify(r[s]))}function Nm(e){const t=Dm(),n=Pm();let r={ready:!1},o;const s=fe(r);let i=0;const a=v=>{r={...r,...v},s.set(r)},c=()=>{r.ready||a({ready:!0})},d=setTimeout(c,e.unlockAfterMs??Rm),u=v=>v!==i;let p;async function m(v,b){if(n?.id===v&&n.data&&a({antd:n.data}),!p)return;const D=await p(v).catch(()=>{});!D||u(b)||(a({antd:D}),Om(v,D))}async function h(v,b){const D=await e.askHost(v).catch(()=>null);if(u(b))return!0;if(D==null)return!1;const j=await Wi(D);return u(b)||(j&&a({catalog:j}),c()),!0}async function _(v,b){const D=await e.readList();if(u(b))return;if("error"in D){a({failure:{kind:"GET_LOCALES_ERROR",error:D.error}}),c();return}const j=D.data.find(C=>C.locale===v);if(!j){Em("em_locale")&&a({catalog:void 0}),c();return}if(Gi(t,j)&&(!o||o.catalog===t?.data)){c();return}if(o?.entry&&r.catalog===o.catalog&&Gi(o.entry,j)){Ki(o.entry),c();return}const x=await e.readCatalog(v);if(!u(b)){if("error"in x){a({failure:{kind:"GET_LOCALE_ERROR",error:x.error}}),c();return}x.data&&(o?.id===v&&r.catalog===o.catalog&&km(o.catalog,x.data)||a({catalog:x.data}),Ki({id:v,time:j.updatedAt||Math.floor(Date.now()/1e3),hash:j.contentHash,data:x.data})),c()}}async function S(v,b){if(!await h(v,b)){if(!u(b)&&(o?.id===v&&r.catalog===o.catalog||v==="en_US")&&c(),e.canUseNetwork&&!e.canUseNetwork()){c();return}await _(v,b)}}return{set(v){if(!v||v===r.id)return;const b=i+=1;a({id:v,failure:void 0});const D=o?.id===v&&r.catalog===o.catalog;(o&&!D&&r.catalog===o.catalog||v==="en_US"&&r.catalog)&&a({catalog:void 0}),t?.id===v&&t.data&&(a({catalog:t.data}),c()),m(v,b),S(v,b)},prime(v,b,D){r.id&&r.id!==v||r.catalog||!b||(o=t?.id===v&&t.data&&(!D||t.time>=D.time)?{id:v,catalog:t.data}:{id:v,catalog:b,entry:D?{id:v,time:D.time,hash:D.hash,data:b}:void 0},a({catalog:o.catalog}))},useAntdLoader(v){p=v,r.id&&m(r.id,i)},state:s,snapshot:()=>r,dispose:()=>clearTimeout(d)}}var Lm=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})},zi=(function(e){return e.Json="application/json",e.JsonApi="application/vnd.api+json",e.FormData="multipart/form-data",e.UrlEncoded="application/x-www-form-urlencoded",e.Text="text/plain",e})({}),Mm=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:o,format:s,baseUrl:i,cancelToken:a,...c})=>{const d=(typeof t=="boolean"?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},u=this.mergeRequestParams(c,d),p=o&&this.toQueryString(o),m=this.contentFormatters[r||"application/json"],h=s||u.format;return this.customFetch(`${i||this.baseUrl||""}${n}${p?`?${p}`:""}`,{...u,headers:{...u.headers||{},...r&&r!=="multipart/form-data"?{"Content-Type":r}:{}},signal:(a?this.createAbortSignal(a):u.signal)||null,body:typeof e>"u"||e===null?null:m(e)}).then(async _=>{const S=_;S.data=null,S.error=null;const v=h?_.clone():_,b=h?await v[h]().then(D=>(S.ok?S.data=D:S.error=D,S)).catch(D=>(S.error=D,S)):S;return a&&this.abortControllers.delete(a),b})}},xm=l.createIdentifier$1("rest.v2.transport"),Xi=Symbol("rest.v2.secureRequest");function Fm(e){return e.getOrCreateInstance(xm,()=>{const t=e.getInstance(l.CUSTOM_FETCH_ID)?.execute||fetch;return new Mm({baseUrl:"https://app.emailmaker.ru/api/v2",securityWorker:()=>({[Xi]:!0}),customFetch:(n,r={})=>{const{[Xi]:o,...s}=r;return t(n,{...s,[l.PUBLIC_REQUEST]:o!==!0})}})})}function Ji(e,t){const n=Fm(e);return Object.assign({},...t.map(r=>new r(n)))}function Qi(e,t){if(e!=null&&typeof e=="object"){const n=e[t];if(typeof n=="string"&&n!=="")return n}}function sn(e){const t=e.error,n=t?.error;return n&&typeof n=="object"?{status:e.status,data:{code:Qi(n.details,"wp_code")??n.code,message:Qi(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 Zi(e){return!e.ok||!!e.error}function ea(){return Ho(l.LOCAL_STORAGE_ITEMS.em_translations_v2)??!0}function Bm(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function jm(e){const t=e?Date.parse(e):NaN;return Number.isNaN(t)?0:Math.floor(t/1e3)}function Um(e){return Array.isArray(e)?e.reduce((t,n)=>{const r=Array.isArray(n)?n:[],o=r[0];return typeof o=="string"&&o!==""&&t.push({locale:o,updatedAt:Bm(r[1])}),t},[]):[]}function $m(e){return(e?.items??[]).reduce((t,n)=>(n.locale&&t.push({locale:n.locale,updatedAt:jm(n.updated_at),contentHash:n.content_hash}),t),[])}function ta(e){return Ji(e,[Lm])}function an(e){return{error:{status:"FETCH_ERROR",error:e instanceof Error?e.message:"locale request failed"}}}function Cr(e){return!e.ok||e.error!=null}function Ar(e){const t=e.error;return{error:{status:e.status,data:t?.data??e.error}}}async function Dr(e){return{data:await Wi(e)??null}}async function Hm(e){if(ea())try{const n=await ta(e).localesList();return Zi(n)?{error:sn(n)}:{data:$m(n.data)}}catch(n){return an(n)}const t=l.getApi(e,[Do]);try{const n=await t.get_translations2({file:"react_app"});return Cr(n)?Ar(n):{data:Um(n.data)}}catch(n){return an(n)}}async function Vm(e,t){if(ea())try{const r=await ta(e).jsonList({locale:t});return Zi(r)?{error:sn(r)}:Dr(r.data)}catch(r){return an(r)}const n=l.getApi(e,[Do]);try{const r=await n.get_translations3({id:t,file:"react_app"});return Cr(r)?Ar(r):Dr(r.data)}catch{try{const r=await n.get_translations3({id:"en_US",file:"react_app"});return Cr(r)?Ar(r):Dr(r.data)}catch(r){return an(r)}}}var ln=new WeakMap;function Gm(e){const t=ln.get(e);if(t!==void 0)return t;const n=Hm(e).then(r=>("error"in r&&ln.delete(e),r),r=>{throw ln.delete(e),r});return ln.set(e,n),n}var Ze=l.createIdentifier$1("locale.service");function Wm(e){if(e.getInstance(Ze))return;const t=Nm({readList:()=>Gm(e),readCatalog:n=>Vm(e,n),askHost:async n=>(await ue(e,l.events.READ_LOCALE).fire(n))[0],canUseNetwork:()=>!e.getInstance(l.SECURITY_MODULE_ID)});e.inject(Ze,t),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>t.dispose())}function Ym(e){const t=e.getInstance(l.CONFIG_SOURCE_ID);if(!t)return;const n=e.getInstance(Ze);if(!n)return;const r=t.select(o=>o.locale).watch(o=>n.set(o||"ru_RU"));e.getInstance(l.DISPOSABLE_ID)?.addDisposable(r)}var qm="user_id",Km="project_id",na=l.createIdentifier$1("rest.identityHeadersProvided");function zm(e){if(e.getInstance(na))return;e.inject(na,!0);let t;e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(n=>{t=n}),e.addService(l.REQUEST_HANDLER_ID,{execute(n,r){if(r?.public)return;const o=t?.user?.id??Os(e).profile?.id;o!=null&&o!==""&&n.headers.set(qm,String(o));const s=t?.project;s!=null&&s!==""&&n.headers.set(Km,String(s))}})}function Xm(e){const t=e?.[""];return typeof t?.lang=="string"?t.lang:void 0}function Jm(e){return e.id??Xm(e.catalog)}function Qm(e){if(e==="uk"||e.startsWith("uk_"))return"uk";const t=e.search(/[_-]/);return t>0?e.slice(0,t):e}function Zm(e){return Qm(e||"en_US")}var eg="Accept-Language",ra=l.createIdentifier$1("rest.localeHeaderProvided");function tg(e){e.getInstance(ra)||(e.inject(ra,!0),e.addService(l.REQUEST_HANDLER_ID,{execute(t){const n=e.getInstance(Ze)?.snapshot();t.headers.set(eg,Zm(n&&Jm(n)))}}))}function ng(e){if(!e)return!1;try{return e.getInstance(l.SECURITY_MODULE_ID)!==void 0}catch{return!1}}var rg="Invalid standaloneKey.",SS=l.createIdentifier$1("StandaloneMockGuard");function og(){const e=new Error(rg);return e.name="InvalidStandaloneKeyError",e}function sg(e){e.addService(l.REQUEST_HANDLER_ID,{execute:()=>{if(ng(e))throw og()}})}function ig(e){l.registerRestTransport(e),sg(e)}function ag(e){const t=new ei;e.inject(l.INIT_PIPELINE_ID,t);const n=e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(o=>{if(!o)return;const s=o.signal??t.externalSignal;t.configure({replaceSession:!0,...o.timeouts!==void 0?{timeouts:o.timeouts}:{},...s!==void 0?{signal:s}:{}})}),r=e.getInstance(l.DISPOSABLE_ID);n&&r?.addDisposable(n),r?.addDispose(()=>{t.abort()})}var oa=gt("plugin.dataSource.blocks"),lg=gt("plugin.dataSource.blockRevisions"),cg=gt("plugin.dataSource.comments"),dg=Kt(),ug=Kt(),sa=`<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2110
2110
  <html>
@@ -2150,7 +2150,7 @@ __emailmaker__.define("emailmaker.js",["require","exports","module","static/umd/
2150
2150
  </html>`;function fg(e){return{isNew:!0,is_inited:!1,subject:void 0,preheader:void 0,description:"",html:sa,project:e?.id,project_title:e?.title??"",utm_parameters:{utm_source:"",utm_medium:"",utm_campaign:"",utm_term:"",utm_content:""},parent_email:null,common_styles:"{}",title:"",emailtags:[],isAmp:!1}}var ia=new Set(["email","block","blocks","autosaves","revisions","comments","templateId","reload"]);function pg(e){return!Object.keys(e).some(t=>ia.has(t))}function hg(e){const t={},n={};for(const[r,o]of Object.entries(e))ia.has(r)?t[r]=o:n[r]=o;return{showOptions:t,misplacedEmailFields:n}}function aa(e){const t=e.id;if(!(t===null||typeof t=="string"&&t.trim()===""))return e;const n={...e};return delete n.id,n}function yS(e){}function cn(e){return typeof e=="object"&&e!==null&&Object.prototype.hasOwnProperty.call(e,"block")&&!Object.prototype.hasOwnProperty.call(e,"email")}function mg(e){const t=typeof e.block=="string"?{code:e.block}:{...e.block},n=t.id!==void 0&&t.id!==""&&t.code===void 0,r=e.reload===!0&&t.id!==void 0&&t.id!=="";return{block:t,byId:n,blocks:e.blocks,revisions:e.revisions,reload:r}}function Et(e){return{emails:Ui(e),blocks:oa(e),emailRevisions:$i(e),blocksRevision:lg(e),comments:cg(e)}}function gg(e){const t=Object.values(Et(e));return{suspendChange(){t.forEach(n=>n.suspendChange())},resumeChange(){t.forEach(n=>n.resumeChange())}}}function dn(e,t=!0){if(typeof e=="string")return{email:{code:e}};if(pg(e))return{email:aa(e)};{const{showOptions:n,misplacedEmailFields:r}=hg(e),o=Object.keys(r);t&&o.length>0&&void 0;const s=typeof e.email=="string"?{code:e.email}:e.email;return{...n,email:aa({...r,...s})}}}function Pr(e){const t=Ne(e);return t&&Z(t.sessionKey())?t.suspendedDocument():t?.current()}function un(e){return Pr(e)?.getContent()}function la(e,t){const n=t??fg(),r=Pr(e)?.get();return r?{...n,...r.attributes,id:r.serverId??void 0,isNew:r.serverId===null,html:un(e)??n.html}:n}async function _t(e){return(await e.getInstanceAsync(l.APP_ID))?.project}async function ca(e){return wr(e)??await _t(e)}async function da(e,t){const n=oa(e);if(n.hasReadHandler()){const r=await n.get(t);if(r&&Object.keys(r).some(o=>o!=="id"))return r;await n.remove(t,{silent:!0});return}return n.byForeignKey("project").first(await ca(e),{filter:{id:t}})}function ua(e){if(!e)return;if(cn(e)){const n=typeof e.block=="string"?e.block:e.block.id;return n==null?void 0:`block:${n}`}const t=dn(e,!1).email.id;return t==null?void 0:String(t)}function vg(e,t){return e.ticket===t.ticket?!1:e.emailId===void 0||e.emailId!==t.emailId}function Eg(e){return typeof e=="object"&&e!==null&&"reload"in e&&e.reload===!0}async function _g(e,t,n){const r=st(e.getInstance(l.INIT_PIPELINE_ID)?.contentReadyTimeoutMs);let o;try{return await Promise.race([t,new Promise((s,i)=>{o=setTimeout(()=>{t.then(n,()=>{}),i(new Nt(r,"handleSaveBlock","block"))},r)})])}finally{clearTimeout(o)}}function et({code:e,project:t,...n},r){const o=be(n),s=wr(r),i=Ie(r);return e&&i.warnAboutUnconfiguredInput(e,n.id),{...o,...e?{html:i.toEditorForm(e)}:{},...s===void 0?{}:{project:s},..."utm_parameters"in o?{utm_parameters:o.utm_parameters||{}}:{},_embedded:void 0}}function ge({html:e,renderGuid:t,showToken:n,showId:r,...o},s){const{requested:i}=vt(s),a=Ns(s);return be({...o,code:Ie(s).toOutputForm(e),project:i===void 0?o.project:i,utm_parameters:a.UTMEnabled?o.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,secretHash:void 0})}function Or(e){return e==null?"":e.replaceAll(`\r
2151
2151
  `,`
2152
2152
  `)}function fa(e){return e.replace(/<title[^>]*>[\s\S]*?<\/title>/gi,"")}function bg(e,t,n,r){const o=Sg(e,t,n,r);return o===void 0}function Sg(e,t,n,r){if(cn(t))return"block";const{email:o}=dn(t,!1),s=et(o,e),i=s.id;if(i===void 0)return"no-id";if(r!==void 0&&r!==i)return"other-id-shown";const a=Ne(e)?.current();if(!a)return"no-session";const c=a.get(),d=c.attributes;if(c.serverId!==i)return"document-id";if(d.is_inited!==!0)return"not-inited";const u=fa(Or(n??a.getContent()));if(s.html!==void 0&&fa(Or(s.html))!==u)return"html";if(s.subject!==void 0&&s.subject!==d.subject)return"subject";if(s.preheader!==void 0&&s.preheader!==d.preheader)return"preheader";if(s.common_styles!==void 0&&s.common_styles!==d.common_styles)return"common_styles"}function pa(e,t){if(cn(t))return;const{email:n}=dn(t,!1),r=et(n,e);if(r.id!==void 0)return JSON.stringify([r.id,r.html===void 0?null:Or(r.html),r.subject??null,r.preheader??null,r.common_styles??null])}function yg(e){return Array.isArray(e)?e.some(t=>$n(t)):$n(e)}function wg(e){const t={...e};delete t.wpId,delete t.secretHash,delete t.projectCategories;for(const n of["author","folder","project"])yg(t[n])&&delete t[n];return t}function Ig(e,t){const n={...e};return delete n.id,{...n,...t}}function Tg(e){return e.html?e:{...e,html:sa}}function je({code:e,project:t,...n},r,o){const s=o??wr(r);return{...n,...e?{html:Ie(r).toEditorForm(e)}:{},renderGuid:l.generateUUID(),...s===void 0?{}:{project:s}}}function pe({html:e,renderGuid:t,...n},r){const{requested:o}=vt(r);return be({...n,code:Ie(r).toOutputForm(e),project:o===void 0?n.project:o,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 ha(e){return Ne(e)?.current()?.get().serverId??void 0}function Rr(e,t,n){return n===void 0&&(n=e.post===void 0?ha(t):e.post),{...e,content:e.content?`<p>${e.content}</p>`:"",post:n}}function bt(e,t){return be({...e,link:void 0,comment_status:void 0})}function fn({code:e,autosave:t,...n},r,o){return o===void 0&&(o=n.parent===void 0?ha(r):n.parent),{...n,...e?{html:e}:{},isAutosave:t===!0||Od(n.slug),parent:o}}function kr({html:e,isAutosave:t,...n},r){return be({...n,autosave:t?!0:void 0,code:e,guid:void 0,compiled:be({html:e,ampHtml:e&&""})})}function pn({code:e,autosave:t,...n},r){return{...n,...e?{html:e}:{},isAutosave:t===!0,parent:r??n.parent}}function ma({html:e,isAutosave:t,...n}){return be({...n,autosave:t?!0:void 0,code:e,guid:void 0})}function Cg(e){return String(e).replace(/"/g,"&quot;")}function Ag(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 ga(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 va(e,t,n){const r=new RegExp(`\\b${t}\\s*=\\s*["'][^"']*["']`,"i"),o=Cg(n);return r.test(e)?e.replace(r,`${t}="${o}"`):e.replace(/>$/,` ${t}="${o}">`)}function Ea(e,t){const n=new RegExp(`\\b${t}\\s*=\\s*["']([^"']*)["']`,"i").exec(e);return n?n[1]:void 0}function _a(e){if(!e?.trim())return{};const t=ga(e);return t?{emBlockId:Ea(t.full,"em-block-id"),emBlockVersion:Ea(t.full,"em-block-version")}:{}}function ba(e,t,n){if(!e?.trim()||!t)return e;const r=ga(e);if(!r)return e;const o=String(t),s=Ag(n??new Date);let{full:i,index:a}=r;const c=i.length;return/\bem-block-id\s*=/.test(i)||(i=va(i,"em-block-id",o)),i=va(i,"em-block-version",s),e.slice(0,a)+i+e.slice(a+c)}function Dg(e,t){const{emBlockId:n,emBlockVersion:r}=_a(e);return n&&r?e:ba(e,t)}var tt=l.createIdentifier$1("NotificationService"),Pg=l.createIdentifier$1("emailTemplate.reads");async function Og(e,t){try{const n=ke(e);return await(n.template?n.template(e):n.email(e)).readEmail(t)??void 0}catch(n){n instanceof Error&&n.message,kg(e,t,n);return}}var Rg=l.createIdentifier$1("emailTemplate.notifiedFailures");function kg(e,t,n){if(n instanceof DOMException&&n.name==="AbortError")return;const r=e.getOrCreateInstance(Rg,()=>new Set);r.has(t)||(r.add(t),e.getInstanceAsync(tt).then(()=>{l.getEmitter(e,l.events.ON_NOTIFICATION).fire({type:"warning",id:"TEMPLATE_READ_ERROR",data:{templateId:t},innerException:n})},()=>{}))}function Ng(e,t){const n=e.getOrCreateInstance(Pg,()=>new Map),r=n.get(t);if(r!==void 0)return r;const o=Og(e,t).then(s=>(s===void 0&&n.delete(t),s));return n.set(t,o),o}var Lg=class{http;constructor(e){this.http=e}blocksRevisionsList=({entityId:e},t={})=>this.http.request({path:`/app/blocks/${e}/revisions`,method:"GET",secure:!0,format:"json",...t});blocksRevisionsCreate=({entityId:e,...t},n,r={})=>this.http.request({path:`/app/blocks/${e}/revisions`,method:"POST",query:t,body:n,secure:!0,type:zi.Json,format:"json",...r});blocksRevisionsDetail=({entityId:e,revisionId:t},n={})=>this.http.request({path:`/app/blocks/${e}/revisions/${t}`,method:"GET",secure:!0,format:"json",...n});blocksRevisionsLatestList=({entityId:e},t={})=>this.http.request({path:`/app/blocks/${e}/revisions/latest`,method:"GET",secure:!0,format:"json",...t});emailsRevisionsList=({entityId:e},t={})=>this.http.request({path:`/app/emails/${e}/revisions`,method:"GET",secure:!0,format:"json",...t});emailsRevisionsCreate=({entityId:e,...t},n,r={})=>this.http.request({path:`/app/emails/${e}/revisions`,method:"POST",query:t,body:n,secure:!0,type:zi.Json,format:"json",...r});emailsRevisionsDetail=({entityId:e,revisionId:t},n={})=>this.http.request({path:`/app/emails/${e}/revisions/${t}`,method:"GET",secure:!0,format:"json",...n});emailsRevisionsLatestList=({entityId:e},t={})=>this.http.request({path:`/app/emails/${e}/revisions/latest`,method:"GET",secure:!0,format:"json",...t});initCreate=(e={})=>this.http.request({path:"/app/init",method:"POST",secure:!0,format:"json",...e})},wS=l.createIdentifier$1("projects.v2IdByWpId"),IS=l.createIdentifier$1("projects.wpIdByV2Id"),TS=l.createIdentifier$1("emails.v2SavedAtOnOpen"),CS=l.createIdentifier$1("emails.v2OpeningReads"),Nr=class extends Error{v2Error;operation;status;data;creation;constructor(e,t){const n=typeof t.data.message=="string"?t.data.message.trim():"";super(n||`${e==="создание"?"create":"update"}: ${t.status} ${t.data.code??""}`.trim()),this.name="EmailWriteFailedError",this.operation=e,this.creation=e==="создание",this.v2Error=t,this.status=t.status,this.data=t.data}};function Mg(e,t){if(!t)throw new Nr(e,{status:0,data:{code:"no_response"}});if(!t.ok)throw new Nr(e,sn(t))}function xg(e){const t=e;return{...e.id!==void 0?{id:e.id}:{},...e.author_id?{author:e.author_id}:{},...t.author_name?{authorName:t.author_name}:{},...e.created_at!==void 0?{date:e.created_at,modified:e.created_at}:{},isAutosave:e.autosave===!0,...t.html!==void 0?{html:t.html}:{},...t.common_styles!==void 0?{common_styles:t.common_styles}:{}}}var Fg=/^[A-Za-z0-9_-]{1,128}$/,Bg=new Set(["apps.invalid_entity_id","apps.history_locked_by_plan"]),Sa=new Set;function jg(e){return Fg.test(e)?!0:(Sa.has(e)||Sa.add(e),!1)}function Ug(e){return e&&!e.ok?String(sn(e).data.code??""):""}var ya=()=>({isAutosave:!1});function wa(e,t){return e==="email"?{html:t.html??"",common_styles:t.common_styles??""}:{html:t.html??""}}async function $g(e,t){const n=new AbortController,r=st(e.getInstance(l.INIT_PIPELINE_ID)?.contentReadyTimeoutMs);let o;const s=new Promise((i,a)=>{o=setTimeout(()=>{n.abort(),a(new Nr("обновление",{status:0,data:{code:"timeout"}}))},r)});try{return await Promise.race([t(n.signal),s])}finally{clearTimeout(o)}}function Hg(e,t){return $o(t,e==="block")}async function Vg(e,t,n,r,o){if(!jg(n))return ya();const s=Ke(e),i=dt(e),a=Hg(t,n);try{const c=await Gg(e,t,n,r,o);return c.id&&(s.set(a,c.id),i.delete(a)),c}catch(c){throw gu(i,a,r.html??""),c}}async function Gg(e,t,n,r,o){const s=Ji(e,[Lg]),i={entityId:n,...o?{autosave:!0}:{}},a=await $g(e,c=>t==="email"?s.emailsRevisionsCreate(i,wa(t,r),{signal:c}):s.blocksRevisionsCreate(i,wa(t,r),{signal:c}));return Bg.has(Ug(a))?ya():(Mg("обновление",a),xg(a.data??{}))}function Wg(e,t,n,r){return Vg(e,t,n,r,!1)}async function Yg(e,t,n){if(t==null||t===""||n===void 0||!Ge(e))return Ia;const r=Date.now(),o=xn(String(t));return Cs(o,{html:n},r,Xn(Ke(e),o,dt(e),n)),await Wg(e,"block",String(t),{html:n}),Gt(o,r,Ke(e).get(o)??void 0),()=>Fn(o,r)}function Ia(){}var Lr="EXTERNAL",Ta=Symbol("supersededShow");function qg(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"[emailmaker] save failed")}var Kg="email_id";function Mr(e){return Object.entries(e).some(([t,n])=>t!=="id"&&n!==void 0)}var zg=class extends l.Disposable{_container;_prevCommand;_lastShow;_showToken=0;_showRequests=0;_latestShowEmailId;_latestShow=Promise.resolve();_dataSources;_eventLock;_queue=l.createQueue();_currentEmail;constructor(e){super(),this._container=e;const t=e;this._dataSources=Et(t),this._eventLock=gg(t);const n=J(e,l.events.ON_EMAIL_CHANGED_ID);this.addDisposable(n(r=>{this._currentEmail=r})),this.addDisposable(J(e,l.events.OPEN_BLOCK_REQUEST_ID)(r=>this.openBlock(r))),this.addDisposable(e.addService(l.REQUEST_HANDLER_ID,{execute:(r,o)=>{!o?.public&&this._currentEmail?.id&&!this._currentEmail.isNew&&r.headers.append(Kg,this._currentEmail.id)}}))}_getInitPipeline(){return this._container?.getInstance(l.INIT_PIPELINE_ID)??or}_throwIfDestroyed(){if(this.isDisposed())throw we()}async getTemplateEmail(e){const t=await Ng(this._container,String(e));if(!t)return;const n={...t,lock:!1,parent_email:String(e)};return delete n.id,wg(n)}async setBlocks(e=[]){const{cache:t}=this._dataSources.blocks,n=await _t(this._container);await t.setAll(e.filter(r=>r.id!==void 0).map(r=>[r.id,je(r,this._container,n)]))}async setEmailRevisions(e,t){if(e===void 0)return;const{cache:n}=this._dataSources.emailRevisions,r=e.filter(o=>o.id!==void 0).map(o=>[o.id,fn(o,this._container,t)]);await n.setAll(r)}async setComments(e=[],t){const{cache:n}=this._dataSources.comments,r=e.filter(o=>o.id!==void 0).map(o=>[o.id,Rr(o,this._container,t)]);await n.setAll(r)}async setEmail(e,t,n,r,o){const s=this._dataSources.emails,i=s.cache,a=await _t(this._container),c=r??this._showToken;e=typeof e=="string"?{code:e}:{...e};let d=et(e,this._container);const u=d.id;let p=u;if(u!==void 0){const m=await s.get(u);d={...m??{},...d,utm_parameters:d.utm_parameters??m?.utm_parameters??{},renderGuid:m?.renderGuid??l.generateUUID(),...c>0?{showToken:c}:{},...o?{showId:o}:{},project:a}}else{p=n??l.generateUUID();const m=await s.get(p);d={...d,utm_parameters:d.utm_parameters??{},renderGuid:m?.renderGuid??l.generateUUID(),...c>0?{showToken:c}:{},...o?{showId:o}:{},project:a},delete d.project}if(t){const m=await this.getTemplateEmail(String(t));m&&(d=Ig(m,d))}return u===void 0&&(d=Tg(d)),await i.setAll([[p,d]]),d}_rememberShow(e){this._prevCommand=e}_isRepeatOfLastShow(e){const t=this._lastShow;if(!t||t.signature!==pa(this._container,e))return!1;const n=un(this._container);return n===void 0||n===t.html}_rememberShownContent(e){const t=pa(this._container,e);this._lastShow=t===void 0?void 0:{signature:t,html:un(this._container)??""}}async _show(e,t){if(this._throwIfDestroyed(),t!==void 0&&vg({ticket:t,emailId:ua(e)},{ticket:this._showRequests,emailId:this._latestShowEmailId}))return this._showRequests,Ta;if(!e)return;const n=this._getInitPipeline();if(l.throwIfAborted(n.signal),cn(e))return this._showBlock(e,n);const r=Z(de(this._container).sessionKey()),o=Eg(e);if(!r&&!o&&bg(this._container,e,un(this._container),this._prevCommand?.id)||!r&&!o&&this._isRepeatOfLastShow(e))return;const s=dn(e);s.email.id,this._prevCommand?.id;let i,a="",c=0,d=!1,u,p=Promise.resolve(),m,h=!1;try{this._eventLock.suspendChange();const{email:_,blocks:S,autosaves:v,comments:b,templateId:D,reload:j}=s;i=_.id;const x=et(_,this._container),C=x.id,I=C??l.generateUUID(),R=await Re("getProject",_t(this._container));l.throwIfAborted(n.signal),a=l.generateUUID();const A={isNew:C===void 0,id:String(I),project:R},O=j===!0&&C!==void 0;O&&(await this._dataSources.emails.remove(String(C),{silent:!0}),String(C)),c=++this._showToken,String(I);const L=[];L.push(this.setBlocks(S)),_.id!==void 0&&(L.push(this.setComments(b)),L.push(this.setEmailRevisions(v,String(_.id)))),L.push(this.setEmail(_,$n(D)?D:Number(D),C===void 0?String(I):void 0,c,a)),await Re("setEmail+blocks+revisions",Promise.all(L),{emailId:C??String(I),showId:a,targetShowToken:c}),l.throwIfAborted(n.signal);const w=await this._dataSources.emails.get(String(I)),P=de(this._container),k={id:a,token:c};if(r){en(this._container);const y=P.suspendedDocument()?.get().serverId;!O&&C!==void 0&&y!=null&&String(y)===String(C)&&P.resumeSuspended()}C===void 0?m=P.startNewDraft(w??x,{patch:x,show:k}):O?m=P.reload(C,{email:w??x,patch:x,show:k}):P.sessionKey()===We(C)?m=P.show(x,k):m=P.open(C,{email:w??x,patch:x,show:k}),P.beginShowFill(a);const F=!!this._prevCommand&&l.deepEqual(this._prevCommand,A);A.id,!this._prevCommand||l.deepEqual(this._prevCommand,A),this._prevCommand?.id,this._rememberShow(A),p=n.requestShow({showId:a,navId:String(I),emailId:C,isNew:C===void 0}),h=!0;const E=()=>P.endShowFill(a);Promise.allSettled([p,m.whenReady()]).then(E),String(I),d=!0}catch(_){u=_,h&&a&&n.failShow(a,_),a&&Ne(this._container)?.endShowFill(a),l.isAbortError(_)||(Fo(_),void 0)}finally{this._eventLock.resumeChange()}if(!d)throw u instanceof Error?u:new Error(`[emailmaker] show() setup failed: ${String(u??"unknown error")}`);return Re("show-init-deferred",Promise.all([p,m?.whenReady().catch(_=>{if(_ instanceof Oe){const S=zn(_);throw S?new Error(`[emailmaker] show(): email open failed (${S})`,{cause:_}):_}})??Promise.resolve()]).then(()=>{}),{showId:a,emailId:i??null}).then(()=>{this._rememberShownContent(e)})}async _showBlock(e,t){const{block:n,byId:r,blocks:o,revisions:s,reload:i}=mg(e),a=l.generateUUID();let c=!1;try{await this.setBlocks(o),l.throwIfAborted(t.signal),i&&(await this._dataSources.blocks.remove(String(n.id),{silent:!0}),this._dataSources.blocks.byForeignKey("project").clear(),String(n.id));const d=n.id!==void 0&&n.id!==""?String(n.id):void 0,u=de(this._container);if(!i&&d!==void 0&&u.sessionKey()===Bt(d)){const D=Mr(n)?await this._storeShownBlock(n):void 0,j={id:a,token:++this._showToken},x=u.show(D,j),C=t.requestShow({showId:a,navId:d,emailId:void 0,isNew:!1});c=!0,await Re("show-block-init",Promise.all([C,x?.whenReady().catch(()=>{})]),{showId:a});return}const p=r||i?await da(this._container,String(n.id)):void 0,m=p&&(i||Mr(n))?await this._storeShownBlock({...pe(p,this._container),...n}):r||i?p:await this._storeShownBlock(n);if(l.throwIfAborted(t.signal),!m)throw new Error(`[emailmaker] show(): block ${String(n.id)} not found`);s!==void 0&&m.id!==void 0&&await this._dataSources.blocksRevision.cache.setAll(s.filter(D=>D.id!==void 0).map(D=>[D.id,pn(D,String(m.id))])),this._prevCommand=void 0,this._lastShow=void 0;const h=m.id!==void 0?String(m.id):l.generateUUID(),_={id:a,token:++this._showToken};en(this._container);const S=i?u.reloadBlock(h,m,_):u.openBlock(h,m,_);m.id;const v=t.requestShow({showId:a,navId:h,emailId:void 0,isNew:m.id===void 0});c=!0;const b=S.whenReady().catch(D=>{if(D instanceof Oe)throw D});await Re("show-block-init",Promise.all([v,b]),{showId:a})}catch(d){throw c&&t.failShow(a,d),d}}async _storeShownBlock(e){const t=je(e,this._container,await _t(this._container));return t.id!==void 0&&await this._dataSources.blocks.cache.add(t.id,t),t}async _save(){this._throwIfDestroyed();const e=this._getInitPipeline();l.throwIfAborted(e.signal);const t=de(this._container);if(Z(t.sessionKey())&&!t.hasSuspended())throw new Error("[emailmaker] save(): no open email — a block is open, use saveBlock()");const n=await t.saveEmail("publish",{source:Lr,fallbackTitle:Bs(this._container)});if(l.throwIfAborted(e.signal),!n)throw qg(t.emailSaveState().error);return ge(la(this._container,this._currentEmail),this._container)}async _saveBlock(){this._throwIfDestroyed();const e=de(this._container),t=e.current();if(!t||!Z(e.sessionKey()))throw new Error("[emailmaker] saveBlock(): no open block");return ad(t,async()=>{await t.whenReady();const n=Zt(t),r=t.get().version,o=t.get().serverId,s=typeof n.global_block=="boolean"?n.global_block:o!=null&&_a(n.html??"").emBlockId===String(o),i=o!=null&&s?ba(n.html,String(o),new Date):n.html,a={title:n.title,project:n.project,type:n.type??"Other",description:n.description,html:i,blocktags:n.blocktags,...n.meta?{meta:n.meta}:{}},c=this._dataSources.blocks,d=await Yg(this._container,t.get().serverId,a.html),u=t.get().serverId==null?c.create(a,{source:Lr}):c.update(String(t.get().serverId),a,{source:Lr}),p=await _g(this._container,u,m=>{m&&d(),m&&de(this._container).current()===t&&t.get().serverId==null&&m.id!==void 0&&t.markSaved(r,String(m.id))});if(!p)throw new Error("[emailmaker] save(): block was not saved");return d(),t.markSaved(r,p.id!==void 0?String(p.id):void 0),pe(p,this._container)})}_queuedShow=this._queue.decorate((e,t)=>this._show(e,t),this);show=e=>{const t=this._showRequests+=1;this._latestShowEmailId=ua(e);const n=this._queuedShow(e,t).then(r=>r===Ta?this._latestShow.catch(()=>{}):void 0);return this._latestShow=n,n};_queuedSave=this._queue.decorate(()=>this._save(),this);save=()=>this._queuedSave();_queuedSaveBlock=this._queue.decorate(()=>this._saveBlock(),this);saveBlock=()=>this._queuedSaveBlock();showBlock=(e,t={})=>this.show({...t,block:e});async _openBlock(e){this._throwIfDestroyed(),l.throwIfAborted(this._getInitPipeline().signal);const t=typeof e=="string"?{id:e}:e,n=t.id!==void 0&&t.id!==""?String(t.id):void 0,r=de(this._container);if(n!==void 0&&r.sessionKey()===Bt(n))return;const o=t.code===void 0&&n!==void 0?await da(this._container,n):void 0,s=o&&Mr(t)?await this._storeShownBlock({...pe(o,this._container),...t}):t.code===void 0&&n!==void 0?o:await this._storeShownBlock(t);if(!s)throw new Error(`[emailmaker] openBlock(): block ${String(n)} not found`);en(this._container);const i=r.openBlockOver(s.id!==void 0?String(s.id):l.generateUUID(),s);s.id,r.hasSuspended(),ue(this._container,l.events.ON_BLOCK_OPEN_ID).fire({block:s}),await i.whenReady().catch(a=>{if(a instanceof Oe)throw r.current()===i&&(ue(this._container,l.events.ON_BLOCK_CLOSE_ID).fire({block:s,hasUnsavedChanges:!1}),r.resumeSuspended()),a})}async _closeBlock(){this._throwIfDestroyed(),Cp(this._container)}_queuedOpenBlock=this._queue.decorate(e=>this._openBlock(e),this);_queuedCloseBlock=this._queue.decorate(()=>this._closeBlock(),this);openBlock=e=>this._queuedOpenBlock(e);closeBlock=()=>this._queuedCloseBlock()};function Xg(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 Jg(e,t){const n=e.insertFrom??t?.type,r=t?.blockId??(e.id!=null&&e.id!==""?String(e.id):void 0),o=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:o,fragmentRole:e.fragmentRole,id:r,title:e.title??void 0,blockType:e.type,meta:Xg(e)}}function xr(e,t){return t?Jg(t,e):{type:e.type,name:e.name,blockId:e.blockId,project:e.project,insertFrom:e.type}}var Ca=["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"],Qg=[...Ca,"html","id","project","password"],AS=new Set(["html",...Ca,"global_block","project"]);function Zg(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(Qg),r={};for(const o of Object.keys(e))n.has(o)||(r[o]=e[o]);return Object.keys(r).length>0&&(t.catalogExtra=r),t}function ev(e,t={}){return!e||typeof e!="object"?{html:"",insertFrom:t.type,name:t.name,project:t.project,id:t.blockId}:{...Zg(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 Fr=new WeakMap;function tv(e){let t=Fr.get(e);return t||(t={byId:new Map,fallback:[]},Fr.set(e,t)),t}function nv(e){Fr.delete(e)}function rv(e,t){const{byId:n,fallback:r}=tv(t);if(e.blockId){const o=n.get(e.blockId);if(o){n.delete(e.blockId);const s=r.indexOf(o);return s>=0&&r.splice(s,1),o}return}for(let o=r.length-1;o>=0;o--){const s=r[o],i=e.name!=null&&e.name!==""&&s.name!=null&&s.name!==""&&s.name===e.name,a=e.type!=null&&e.type!==""&&s.insertFrom===e.type;if(i&&a)return r.splice(o,1),s.id!=null&&s.id!==""&&n.delete(String(s.id)),s}}async function ov(e,t){const{blocks:n}=Et(e);return await n.cache.getIfPresent(t)??void 0}async function sv(e,t){if(!t.blockId)return;const n=await ov(e,t.blockId);if(n)return ev(n,t)}async function iv(e,t){const n=rv(e,t);if(n)return xr(e,n);const r=await sv(t,e);return r?xr(e,r):xr(e,void 0)}var av=l.createIdentifier("application_block_inserted"),lv=-1e3,Aa=new WeakSet;function cv(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 dv(e){if(!e||Aa.has(e))return;Aa.add(e);const t=new l.Disposable,n=le(e);return t.addDisposable(n.addListenerAsyncPipe(av,async(r,o)=>{const s=cv(r)?await iv(r,e):r;return o?o(s):s},lv)),t.addDisposable({dispose:()=>{nv(e)}}),t}var uv=Kt("plugin.readBlockAutosave"),DS=l.createIdentifier$1("blockDocuments.provided"),Da=l.createIdentifier$1("plugin.earlyWindow");function fv(e){return e.getOrCreateInstance(Da,()=>({depth:0}))}function pv(e){const t=fv(e);t.depth+=1;let n=!1;return()=>{n||(n=!0,t.depth-=1)}}function Pa(e){return(e?.getInstance(Da)?.depth??0)>0}function Oa(e,t){let n,r=!1;return e(o=>{n=o,r=!0}),(o,s,i)=>{const a=e(o,s,i);if(r&&Pa(t)){const c=n;queueMicrotask(()=>{o.call(i,c)})}return a}}var Br=100,hv=class extends l.Disposable{_container;_events;constructor(e){super(),this._container=e;const t=dv(e);t&&this.addDisposable(t)}_get(){const e=this._container,{blocks:t,emails:n,comments:r,emailRevisions:o,blocksRevision:s}=Et(e),i=J(e,l.events.ON_SHARE_ID),a=J(e,l.events.ON_SHOW_PREVIEW_ID),c=J(e,l.events.ON_EMAIL_CLONE_ID),d=J(e,l.events.ON_BLOCK_OPEN_ID),u=J(e,l.events.ON_BLOCK_CLOSE_ID),p=J(e,l.events.ON_BLOCK_CLONE_ID),m=J(e,l.events.ON_BLOCK_INIT_ID),h=J(e,l.events.ON_BLOCK_CHANGED_ID),_=J(e,l.events.ON_CODE_VALIDATE_ID),S=J(e,l.events.ON_IMPORT_VALIDATE_ID),v=J(e,l.events.ON_SUBJECT_CHANGED_ID),b=J(e,l.events.ON_EMAIL_CHANGED_ID),D=J(e,l.events.ON_PREHEADER_CHANGED_ID),j=J(e,l.events.ON_SAVEBUTTON_CLICK_ID),x=J(e,l.events.ON_BLOCK_SAVEBUTTON_CLICK_ID),C=J(e,l.events.ON_NEXTBUTTON_CLICK_ID),I=J(e,l.events.ON_SEND_LIVEPREVIEW_ID),R=J(e,l.events.ON_SEND_TESTEMAIL_ID),A=J(e,ug),O=J(e,l.events.ON_CONTENT_CHANGED_ID),L=J(e,dg),w=J(e,l.events.ON_PREVIOUSBUTTON_CLICK_ID),P=J(e,l.events.ON_SEND_EMAIL_MODAL_ID),k=l.filter(J(e,l.events.ON_EMAIL_INIT_ID),E=>!E.reset),F=J(e,l.events.ON_ANALYTICS_EVENT);return{handlePreheaderChanged:H(D),handleSubjectChanged:H(v),handleValidate:H(_),handleImportValidate:H(S),handleReadEmail:H(n.handlerRead,E=>E,E=>E&&et(E,e)),handleSaveEmail:H(n.onSave,function({prev:E,patch:y,value:B,source:U}){const W=E?ge(E,e):void 0;return{prev:W,patch:mt(W,ge(y,e)),value:ge(B,e),source:U}},E=>E?et(E,e):void 0),handleRemoveEmail:H(n.onRemove,({value:E,source:y})=>({value:ge(E,e),source:y}),()=>{}),handleReadCommonBlocks:H(A,E=>E.project,E=>E?.map(y=>je(y,e))),handleReadTemplateBlocks:H(L,E=>E,E=>E?.map(y=>je(y,e))),handleReadBlocks:H(t.byForeignKey("project").handleRead,E=>vt(e).requested||String(E),E=>E?.map(y=>je(y,e))),handleReadBlock:H(t.handlerRead,E=>E,E=>E?je(E,e):void 0),handleOpenBlock:H(d,({block:E})=>({block:pe(E,e)})),handleCloseBlock:H(u,({block:E,hasUnsavedChanges:y})=>({block:pe(E,e),hasUnsavedChanges:y})),handleCloneBlock:H(p,E=>pe(E,e)),handleSaveBlock:H(t.onSave,function({prev:E,patch:y,value:B,source:U}){const W=B.global_block===!0&&B.id&&typeof B.html=="string"?{...B,html:Dg(B.html,String(B.id))}:B,ie=E?pe(E,e):void 0;return{prev:ie,patch:mt(ie,pe(y,e)),value:pe(W,e),source:U}},E=>E?je(E,e):void 0),handleRemoveBlock:H(t.onRemove,({value:E,source:y})=>({value:pe(E,e),source:y}),()=>{}),handleReadComments:H(r.byForeignKey("post").handleRead,E=>E,E=>E?.map(y=>Rr(y,e))),handleSaveComment:H(r.onSave,function({prev:E,patch:y,value:B,source:U}){const W=E?bt(E,e):void 0;return{prev:W,patch:mt(W,bt(y,e)),value:bt(B,e),source:U}},E=>E?Rr(E,e):void 0),handleRemoveComment:H(r.onRemove,({value:E,source:y})=>({value:bt(E,e),source:y}),()=>{}),handleReadEmailRevisions:H(o.byForeignKey("parent").handleRead,E=>E,E=>E?.map(y=>fn(y,e))),handleReadEmailAutosave:H(J(e,Hi),E=>E,E=>E?fn(E,e):null),handleEmailAutosave:H(o.onSave,function({prev:E,patch:y,value:B,source:U}){return{value:kr(B,e),source:U}},E=>E?fn(E,e):void 0),handleRemoveEmailAutoSave:H(o.onRemove,({value:E,source:y})=>({value:kr(E,e),source:y}),()=>{}),handleReadBlockRevisions:H(s.byForeignKey("parent").handleRead,E=>E,E=>E?.map(y=>pn(y))),handleReadBlockAutosave:H(J(e,uv),E=>E,E=>E?pn(E):null),handleBlockAutosave:H(s.onSave,({value:E,source:y})=>({value:ma(E),source:y}),E=>E?pn(E):void 0),handleRemoveBlockAutoSave:H(s.onRemove,({value:E,source:y})=>({value:ma(E),source:y}),()=>{}),handleBlockInit:H(m,E=>pe(E,e)),handleBlockChanged:H(l.debounce(h,Br),E=>pe(E,e)),handleEmailChanged:H(l.debounce(b,Br),E=>ge(E,e)),handleEmailInit:Oa(H(k,E=>ge(E,e)),e),handlePreviousButtonClick:H(w,E=>ge(E,e)),handleNextButtonClick:H(C,E=>ge(E,e)),handleSaveButtonClick:H(j,E=>ge(E,e)),handleSaveBlockButtonClick:H(x,E=>pe(E,e)),handleHtmlChanged:H(l.debounce(O,Br)),handleTestEmailSend:H(R,({html:E,...y})=>({...y,code:E,compiled:{html:E,ampHtml:""}})),handleTestEmailModal:H(P,E=>ge(E,e)),handleCloneEmail:H(c,E=>ge(E,e)),handleShareEmail:H(i),handlePreviewEmail:H(a),handleLivePreviewEmail:H(I),handleAnalyticsEvent:H(F)}}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 Qe(t[r]))}for(const r of Object.keys(t))n[r].setListener(e[r])}},mv=l.createIdentifier$1("DataController"),gv=l.createIdentifier$1("DataEvents");function Ra(e){return e.getOrCreateInstance(mv,()=>{const t=new zg(e);return e.getInstance(l.DISPOSABLE_ID)?.addDisposable(t),t})}function ka(e){return e.getOrCreateInstance(gv,()=>new hv(e))}var vv=l.createIdentifier$1("plugin.pluginStart");function Na(e){return e.getOrCreateInstance(vv,()=>{let t;const n=new Promise(r=>{t=r});return e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>t()),{done:n,finish:t}})}function Ev(e){return Na(e).done}function _v(e){const t=Na(e);return t.run===void 0&&(t.run=(e.getInstance(l.PLUGIN_COLLECTION_ID)?.activate()??Promise.resolve()).finally(t.finish)),t.run}var bv=l.createIdentifier$1("plugin.startupShow");function Sv(e){const t=Ra(e),n=ka(e),r=e.getInstance(l.OPTIONS_SOURCE_ID),o=e.getInstance(l.DISPOSABLE_ID),s={current:Promise.resolve()};e.inject(bv,s);let i=!1;const a=r?.watch(d=>{d&&n.setOptions(d),i=(d?.plugins?.length??0)>0,s.current=s.current.catch(()=>{})}),c=r?.select(d=>d?.content).watch(d=>{if(d===void 0)return;const u=()=>(te(ce.showStart),t.show(d).finally(()=>te(ce.showEnd))),p=i?Ev(e).then(u):u();p.catch(()=>{}),s.current=p});a&&o?.addDisposable(a),c&&o?.addDisposable(c)}function yv(e){const t=Ra(e);return{...ka(e).get(),show(n){return te(ce.showStart),t.show(n).finally(()=>te(ce.showEnd))},openBlock(n){return t.openBlock(n)},closeBlock(){return t.closeBlock()},showBlock(n,r){return te(ce.showStart),t.showBlock(n,r).finally(()=>te(ce.showEnd))},save(){return t.save()},saveBlock(){return t.saveBlock()}}}function La(e){return/#set\s*\(\s*.*=.*\)/.test(e)}function hn(e){const t=e.indexOf("(");if(t<0)return!0;let n=0,r="",o=!1;for(let s=t;s<e.length;s++){const i=e[s];if(o){o=!1;continue}if(i==="\\"){o=!0;continue}if(r){i===r&&(r="");continue}if(i==='"'||i==="'"){r=i;continue}if(i==="("){n++;continue}if(i===")"&&(n--,n<0))return!1}return n===0}function wv(e){return(t,n,r)=>hn(t)?e(t,n,r):!1}function Iv(e){return t=>hn(t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t)?e(t):!1}function Tv(e){return(t,n,r)=>hn(t)?La(t)?e(t,n,r):t:!1}function Cv(e){return t=>{const n=t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t;return hn(n)?La(n)?e(t):t:!1}}function Av(e){const t=/[<>&]/g;for(;t.exec(e)!==null;)return!0;return!1}function jr(e,t){const n=e.length;for(let r=0;r<n;r++){const o=e.charCodeAt(r);if(o===0||t==='"'&&o===34||t==="'"&&o===39||t===""&&(o===32||o===9||o===10||o===13||o===12||o===34||o===39||o===60||o===62||o===61||o===96))return!1}return!0}function Dv(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",r=new Uint8Array(e);crypto.getRandomValues(r);let o="";for(let s=0;s<e;s++){const i=r[s]%62;o+=t.charAt(i)}return o}var Pv=8,Ov=class{_byKey=Object.create(null);_byValue=Object.create(null);getOrCreateByKey(e){let t=this._byKey[e];return t===void 0&&(t=Dv(Pv),this._byKey[e]=t,this._byValue[t]=e),t}getByValue(e){return this._byValue[e]}},mn=new Ov;function Ma(e,t){return t!==void 0&&!jr(e,t)?`%|{${mn.getOrCreateByKey(e)}}|%`:e}function Rv(e){const t=mn.getByValue(e.slice(3,e.length-3));return t===void 0?e:t}function oe(e,t,n){return t!==void 0?jr(e,t)?e:`%|{${mn.getOrCreateByKey(e)}}|%`:`<!--${e}-->`}function kv(e){return e.replace(/&gt;/g,">").replace(/&lt;/g,"<").replace(/&amp;/g,"&")}function ne(e){return e.startsWith("<!--")&&e.endsWith("-->")?kv(e.slice(4,-3)):e}function Nv(e){const t=/^(IF|ELSE|ELSIF|ELSEIF|END|FOREACH|WHILE|NEXT|LAST|BREAK|DO|UNLESS|CONTINUE|SET|UNSET|DEFINE|INCLUDE)\b/i,n=/\w+\s*\(/;let r=e;const o=e.match(/\[%\s*([^%]*?)\s*%\]/);o&&(r=o[1]);const s=r.trim();return t.test(s)||n.test(s)}function Lv(e,t,n){return t!==void 0?jr(e,t)?e:`%|{${mn.getOrCreateByKey(e)}}|%`:n||Av(e)||Nv(e)?`<!--${e}-->`:e}var Ue=wv(oe),$e=Iv(ne),Mv=Tv(oe),xv=Cv(ne),xa=e=>{e.escape("<!--","-->",t=>t,!1),e.escape("<style","</style>",t=>t,!1),e.escape("<script","<\/script>",t=>t,!1),e.unescape("%|{","}|%",Rv),e.escape("@{","}",oe,!0).unescape("<!--@{","}-->",ne,!0),e.unescape("<!--%%%{{{","}}}%%%-->",t=>t.substring(10,t.length-9),!1),e.escape("${","}",Ma,!0),e.escape("{{","}}",Ma,!0),e.createSyntax("brace-percent").escape("{%","%}",oe).unescape("<!--{%","%}-->",ne),e.createSyntax("brace-hash").escape("{#","#}",oe).unescape("<!--{#","#}-->",ne),e.createSyntax("proscript").escape("[%","%]",Lv,!0).unescape("<!--[%","%]-->",ne,!0),e.createSyntax("getresponse").escape("[[IF","]]",oe).escape("[[if","]]",oe).escape("[[ELSE]]","",oe).escape("[[else]]","",oe).escape("[[ENDIF]]","",oe).escape("[[endif]]","",oe).unescape("<!--[[IF","]]-->",ne).unescape("<!--[[if","]]-->",ne).unescape("<!--[[ELSE]]","-->",ne).unescape("<!--[[else]]","-->",ne).unescape("<!--[[ENDIF]]","-->",ne).unescape("<!--[[endif]]","-->",ne),e.createSyntax("expert-sender").escape("<if",">",oe).escape("</if",">",oe).escape("<else",">",oe).escape("</else",">",oe).escape("<var ",">",oe,!0).unescape("<!--<if ",">-->",ne).unescape("<!--</if",">-->",ne).unescape("<!--<else ",">-->",ne).unescape("<!--</else",">-->",ne).unescape("<!--<var",">-->",ne,!0),e.createSyntax("velocity").escape("#if",")",Ue).escape("#elseif",")",Ue).escape("#else","",oe).escape("#foreach",")",Ue).escape("#macro",")",Ue).escape("#set",")",Mv,!0).escape("#parse",")",Ue).escape("#include",")",Ue).escape("#evaluate",")",Ue).escape("#end","",oe).escape("#break","",oe).escape("#stop","",oe).unescape("<!--#macro","-->",$e).unescape("<!--#if","-->",$e).unescape("<!--#elseif","-->",$e).unescape("<!--#else","-->",ne).unescape("<!--#foreach","-->",$e).unescape("<!--#parse","-->",$e).unescape("<!--#include","-->",$e).unescape("<!--#evaluate","-->",$e).unescape("<!--#end","-->",ne).unescape("<!--#break","-->",ne).unescape("<!--#stop","-->",ne).unescape("<!--#set","-->",xv,!0),e.createSyntax("mailchimp").escape("*|","|*",oe).unescape("<!--*|","|*-->",ne)},Ur="bare",Fv=new Map;function Bv(e){return e?Fv.get(e)??Ur:Ur}var Fa=["brace-percent","brace-hash","proscript","getresponse","expert-sender","mailchimp","velocity"];function Ba(e){return Fa.includes(e)}function St(e){return e==="bare"||e==="html-comment"}function $r(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function jv(e,t=n=>{}){const n={output:{},editor:{}};if(e==null)return n;let r;if(typeof e=="string"){if(!St(e))return t(`templateDirectives: unknown form "${String(e)}", falling back to the default ("bare").`),n;r={output:e}}else if(typeof e=="object"&&!Array.isArray(e))r=e;else return t(`templateDirectives: expected a string or an object, got ${typeof e}. Ignored.`),n;for(const[d,u]of[["output",r.output],["editor",r.editor]])if(u!==void 0&&!St(u))return t(`templateDirectives.${d}: unknown form "${String(u)}", configuration ignored.`),n;if(r.syntaxes!==void 0&&!$r(r.syntaxes))return t("templateDirectives.syntaxes: expected an object, configuration ignored."),n;if(r.syntaxes){for(const[d,u]of Object.entries(r.syntaxes))if(!(!Ba(d)||u===void 0||St(u))){if(!$r(u))return t(`templateDirectives.syntaxes.${d}: expected a form or an object, configuration ignored.`),n;for(const p of["output","editor"]){const m=u[p];if(m!==void 0&&!St(m))return t(`templateDirectives.syntaxes.${d}.${p}: unknown form "${String(m)}", configuration ignored.`),n}}}if(r.output===void 0&&r.editor===void 0&&r.syntaxes===void 0)return n;const o=r.output??Ur;let s=r.editor;o==="bare"&&r.editor==="html-comment"&&(t('templateDirectives: editor="html-comment" requires output="html-comment"; editor was reset to match output.'),s=void 0);const i=[];if(r.syntaxes)for(const d of Object.keys(r.syntaxes)){if(!Ba(d)){t(`templateDirectives.syntaxes: unknown syntax id "${d}", entry ignored.`);continue}i.push(d)}else i.push(...Fa);const a={},c={};for(const d of i){const u=r.syntaxes?.[d],p=$r(u)?u:void 0,m=(St(u)?u:p?.output)??o;let h=p?.editor??s??m;m==="bare"&&h==="html-comment"&&(t(`templateDirectives.syntaxes.${d}: editor="html-comment" requires output="html-comment" for this id; editor was reset to "bare" for it.`),h="bare"),a[d]=m,c[d]=h}return{output:a,editor:c}}function ja(e,t,n,r){for(let o=t;o<n;o++){const s=e[o];r.insideAttributeValue?r.attributeQuoteChar==='"'||r.attributeQuoteChar==="'"?s===r.attributeQuoteChar&&(r.insideAttributeValue=!1,r.attributeQuoteChar=void 0):r.unquotedAttr&&/[\s>]/.test(s)&&(r.insideAttributeValue=!1,r.attributeQuoteChar=void 0,r.unquotedAttr=!1):s==="<"?r.insideTag=!0:s===">"?r.insideTag=!1:r.insideTag&&(s==='"'||s==="'")?(r.insideAttributeValue=!0,r.attributeQuoteChar=s,r.unquotedAttr=!1):r.insideTag&&/\S/.test(s)&&r.attributeQuoteChar===void 0&&e[o-1]==="="&&!['"',"'","`"].includes(s)&&(r.insideAttributeValue=!0,r.attributeQuoteChar="",r.unquotedAttr=!0)}}function yt(e,t){return e.start<t.end&&t.start<e.end}function Ua(e,t,n,r,o=[]){if(n&&(t=t.filter(u=>u.isVariable)),!t.length)return[];const s=t.flatMap(u=>u.match(e).flatMap(p=>!Number.isInteger(p.start)||!Number.isInteger(p.end)||p.start<0||p.end>e.length||p.start>=p.end?[]:[{range:p,mapFn:u.mapFn,overrideBuiltins:u.overrideBuiltins,syntax:u.syntax,isVariable:u.isVariable}])).sort((u,p)=>u.range.start-p.range.start||u.range.end-p.range.end),i=[],a=o.slice().sort((u,p)=>u.start-p.start),c={insideTag:!1,insideAttributeValue:!1,attributeQuoteChar:void 0,unquotedAttr:!1};let d=0;for(const{range:u,mapFn:p,overrideBuiltins:m,syntax:h,isVariable:_}of s){if(r?(c.insideAttributeValue=!0,c.attributeQuoteChar='"'):ja(e,d,u.start,c),d=u.end,a.some(D=>yt(D,u)))continue;const S=c.insideAttributeValue?c.attributeQuoteChar??"":void 0,v=e.substring(u.start,u.end),b=p(v,S,c.insideTag);b!==!1&&b!==v&&(i.push({range:u,text:b,overrideBuiltins:m,syntax:h,isVariable:_}),a.push(u))}return i.sort((u,p)=>u.range.start-p.range.start||u.range.end-p.range.end)}function Uv(e,t){const n=t.reduce((a,{mapFn:c,start:d,end:u,syntax:p,isVariable:m})=>(a[d]||(a[d]=[]),a[d].push({value:u,mapFn:c,syntax:p,isVariable:m}),a),Object.create(null)),r=Object.keys(n).map(a=>a.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&")).join("|"),o=new RegExp(r,"g"),s=[];let i;for(;(i=o.exec(e))!==null;){const a=i[0];s.push({start:i.index,startToken:a,endTokens:n[a]})}return s}function Hr(e,t,n,r,o=!1){const s=[];if(n&&(t=t.filter(d=>d.isVariable)),!t.length)return s;const i=Uv(e,t),a={insideTag:!1,insideAttributeValue:!1,attributeQuoteChar:void 0,unquotedAttr:!1};let c=0;for(let d=0;d<i.length;d++){const{start:u,startToken:p,endTokens:m}=i[d];r?(a.insideAttributeValue=!0,a.attributeQuoteChar='"'):ja(e,c,u,a),c=u;const h=a.insideAttributeValue?a.attributeQuoteChar??"":void 0;let _=!1;for(const{mapFn:S,value:v,syntax:b,isVariable:D}of m){let j=u+p.length,x=e.indexOf(v,j);for(;x!==-1;){let C=x,I=u+p.length,R=0;for(;C!==-1;){const P=e.indexOf(p,I);if(P!==-1&&P<C)R++,I=P+p.length,C=e.indexOf(v,I);else if(R>0)R--,I=C+v.length,C=e.indexOf(v,I);else break}if(C<0)break;const A=C+v.length,O=e.substring(u,A),L=S(O,h,a.insideTag);if(L===!1){j=x+Math.max(v.length,1),x=e.indexOf(v,j);continue}(o||L!==O)&&s.push({range:{start:u,end:A},text:o?O:L,syntax:b,isVariable:D});const w=i.findIndex(({start:P})=>P>=A);w>d?d=w-1:d=i.length,_=!0;break}if(_)break}}return s}function gn(e,t){if(!t.length)return e;const n=t.slice().sort((o,s)=>s.range.start-o.range.start);let r=e;for(const{text:o,range:s}of n)r=r.slice(0,s.start)+o+r.slice(s.end);return r}var $v=class{_disposables=[];_escapes=[];_unescapes=[];_escapeMatchers=[];_unescapeMatchers=[];constructor(e=xa){const{_escapes:t,_unescapes:n}=this;e({createSyntax(r){return{...this,syntax:r}},escape(r,o,s,i){return t.push({start:r,end:o,mapFn:s,isVariable:i,syntax:this.syntax||r}),this},unescape(r,o,s,i){return n.push({start:r,end:o,mapFn:s,isVariable:i,syntax:this.syntax||r}),this}})}registerMatcherPair(e){const t=e.syntax||"matcher",n={syntax:t,match:e.escape.match,mapFn:e.escape.mapFn,isVariable:e.escape.isVariable,overrideBuiltins:e.escape.overrideBuiltins},r={syntax:t,match:e.unescape.match,mapFn:e.unescape.mapFn,isVariable:e.unescape.isVariable,overrideBuiltins:e.unescape.overrideBuiltins};this._escapeMatchers.push(n),this._unescapeMatchers.push(r);let o=!1;const s={dispose:()=>{o||(o=!0,this._escapeMatchers=this._escapeMatchers.filter(i=>i!==n),this._unescapeMatchers=this._unescapeMatchers.filter(i=>i!==r))}};return this.addDisposable(s),s}_collectMappings(e,t,n){const r=Hr(e,this._escapes,t,n),o=Ua(e,this._escapeMatchers,t,n),s=o.filter(c=>c.overrideBuiltins).map(c=>c.range),i=r.filter(c=>!s.some(d=>yt(d,c.range))),a=o.filter(c=>c.overrideBuiltins||!i.some(d=>yt(c.range,d.range)));return[...i,...a].sort((c,d)=>c.range.start-d.range.start||c.range.end-d.range.end)}getMappings(e,t,n){return this._collectMappings(e,t,n)}_collectRevertMappings(e,t){const n=Hr(e,this._unescapes,t),r=Ua(e,this._unescapeMatchers,t,!1),o=r.filter(a=>a.overrideBuiltins).map(a=>a.range),s=n.filter(a=>!o.some(c=>yt(c,a.range))),i=r.filter(a=>a.overrideBuiltins||!s.some(c=>yt(a.range,c.range)));return[...s,...i].sort((a,c)=>a.range.start-c.range.start||a.range.end-c.range.end)}getRevertMappings(e,t,n){const r=n?o=>o!==void 0&&n.has(o):o=>Bv(o)==="html-comment";return this._collectRevertMappings(e,t).filter(o=>o.isVariable||!r(o.syntax))}getDetectedMappings(e,t,n){return Hr(e,this._escapes,t,n,!0)}getEscapedText(e,t){return gn(e,this.getMappings(e,t))}getUnescapedText(e,t,n){return gn(e,this.getRevertMappings(e,t,n))}normalizeToPolicy(e,t){const n=s=>s===void 0?void 0:t[s],r=Object.values(t);let o=e;return r.includes("bare")&&(o=gn(o,this._collectRevertMappings(o).filter(s=>n(s.syntax)==="bare"))),r.includes("html-comment")&&(o=gn(o,this._collectMappings(o).filter(s=>!s.isVariable&&n(s.syntax)==="html-comment"&&s.text.startsWith("<!--")&&s.text.endsWith("-->")))),o}hasDetectedMappings(e,t,n){return this.getDetectedMappings(e,t,n).length>0}addDisposable(e){this._disposables.push(e)}dispose(){for(const e of this._disposables)e.dispose()}},$a="em___script",wt=`<${$a}`,Vr=`</${$a}>`;function Ha(e){return e.replace("<script",wt).replace("<\/script>",Vr)}var Va=new $v(e=>{e.escape("<script","<\/script>",t=>Ha(t)).unescape(wt,Vr,t=>t.replace(wt,"<script").replace(Vr,"<\/script>")),e.escape("<script","/>",t=>Ha(t)).unescape(wt,"/>",t=>t.replace(wt,"<script")),xa(e)});function Hv(e){const t=jv(e);if(!(Object.keys(t.output).length>0||Object.keys(t.editor).length>0))return Yo();const n=new Set(Object.keys(t.output).filter(o=>t.output[o]==="html-comment")),r=new Set(Object.keys(t.output));return{isConfigured:()=>!0,toEditorForm:o=>Va.normalizeToPolicy(o,t.editor),toOutputForm:o=>Va.normalizeToPolicy(o,t.output),keepWrappedOnOutput:n,editorPolicy:t.editor,warnAboutUnconfiguredInput:Wo(r)}}function Vv(e){let t;e.injectFactory(l.TEMPLATE_DIRECTIVES_ID,()=>{const n=e.getInstance(l.CONFIG_SOURCE_ID)?.layers().user.templateDirectives;return(!t||t.raw!==n)&&(t={raw:n,policy:Hv(n)}),t.policy})}function PS(e){return e}var Gv=class extends Error{cycle;constructor(e){super(`[units] цикл в зависимостях: ${e.join(" → ")}`),this.cycle=e}};function Wv(e){const t=new Map;for(const n of e)for(const r of n.provides??[]){const o=t.get(r)??[];o.push(n),t.set(r,o)}return t}function Yv(e,t){const n=[];for(const r of e.awaits?.services??[])for(const o of t.get(r)??[])o!==e&&n.push(o);return n}function Ga(e){const t=Wv(e),n=[],r=new Set,o=[],s=new Set,i=a=>{if(!r.has(a)){if(s.has(a)){const c=o.indexOf(a);throw new Gv([...o.slice(c),a].map(d=>d.name))}s.add(a),o.push(a);for(const c of Yv(a,t))i(c);o.pop(),s.delete(a),r.add(a),n.push(a)}};for(const a of e)i(a);return n}var qv=[{name:"rest.client",setup:ig},{name:"auth.oauth",setup:l.provideOAuth},{name:"rest.identityHeaders",setup:zm},{name:"rest.localeHeader",setup:tg},{name:"lifetime.destroyable",provides:[Sr],setup:Qh},{name:"appInit",provides:[l.APP_ID,On],setup:gc},{name:"config",provides:[l.CONFIG_SOURCE_ID],setup:Xh},{name:"templateDirectives",provides:[l.TEMPLATE_DIRECTIVES_ID],setup:Vv},{name:"email.documents",setup:vm},{name:"show.initPipeline",provides:[l.INIT_PIPELINE_ID],setup:ag},{name:"show",setup:Sv},{name:"locale.service",provides:[Ze],setup:Wm},{name:"locale.fromConfig",awaits:{services:[l.CONFIG_SOURCE_ID,Ze]},setup:Ym},{name:"canvas.early",setup:Wp},{name:"canvas.previewSettings",setup:ah},{name:"canvas.sandboxExtensions",setup:ch},{name:"canvas.sandboxScriptRelay",setup:fh},{name:"canvas.headerSync",provides:[fr],setup:Kp},{name:"canvas.headersAfterRecovery",setup:zp},{name:"canvas.ampSync",setup:Vu},{name:"canvas.moduleBridge",setup:Sf},{name:"canvas.port",setup:Zu},{name:"canvas.images",setup:Ju},{name:"canvas.edits",setup:Vp},{name:"canvas.surfaceFollowsSession",setup:Dp},{name:"canvas.blockContent",setup:Ap},{name:"canvas.sandboxFill",provides:[dr],setup:Oh},{name:"canvas.reactions",setup:Gp}],Wa;function Gr(e){const t=e.getInstance(l.OPTIONS_SOURCE_ID);if(t)return t;e.getInstance(l.DISPOSABLE_ID)||e.inject(l.DISPOSABLE_ID,new l.Disposable);const n=fe();e.inject(l.OPTIONS_SOURCE_ID,n),Wa??=Ga(qv);for(const r of Wa)r.setup(e);return n}function Kv(e){}var zv=[{name:"save.previewFollow",setup:Kv}],Ya=l.createIdentifier$1("plugin.lateUnitsInstalled");function Xv(e){if(!e.getInstance(Ya)){e.inject(Ya,!0);for(const t of Ga(zv))t.setup(e)}}function Jv(e,t){return{project:Number(e),app_id:t?.app_id||0,app_config:t?.app_config||{},user:t?.user}}function Qv(e){if(!e)return;const t=l.decodeJwt(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 Zv=l.defineMixin(e=>{let t,n,r;return{async setOptions(o){const s=r!==o.getAuthToken,i=!l.deepEqual(t,o.user),a=n!==o.project;if(r=o.getAuthToken,t=o.user,n=o.project,!(!e.getInstance(l.SECURITY_MODULE_ID)||!o.getAuthToken)&&!(!s&&!i&&!a))try{const c=await o.getAuthToken(o.user,o.project);e.inject(l.STANDALONE_BOOTSTRAP_TOKEN_ID,Promise.resolve(c||""));const d=Qv(c);if(!d)return;e.inject(l.STANDALONE_PROJECT_ID,d);const u=e.getInstance(l.APP_ID),p=u?await u.catch(()=>{}):void 0;e.inject(l.APP_ID,Promise.resolve(Jv(d,p)))}catch{}}}});function eE(e,t){if(e.getInstance(l.STANDALONE_FILE_PROXY_REGISTERED_ID))return;e.inject(l.STANDALONE_FILE_PROXY_REGISTERED_ID,!0);const n=l.getEvent(e,l.events.FILE_PROXY_EVENT_ID);t.addDisposable(n(async({url:r})=>(await fetch(r)).blob(),Number.MIN_VALUE))}var tE=l.defineMixin(e=>{let t,n=!1;return{setOptions(r){const o=n;if(n=!0,!ht(r)){t&&(Bh(e),br(r)),t=void 0;return}const s=nn(r);if(!s||t===s&&e.getInstance(l.SECURITY_MODULE_ID))return;t=s,e.inject(l.SECURITY_MODULE_ID,s);const i=e.getInstance(l.DISPOSABLE_ID);i&&eE(e,i)}}}),nE=l.defineMixin(e=>{const t=e.getInstance(l.DISPOSABLE_ID),n=l.getEvent(e,l.APP_LOAD_EVENT_ID),r=H(n),o=t.addDisposable(new Qe(r));return{setOptions({handleLoad:s}){o.setListener(s)},instance:{handleLoad:r},dispose:()=>t.dispose()}});function qa(e,t,n=!0){const r=e,o=t;for(const s of Object.keys(o)){const i=o[s];i!=null&&(n&&typeof i=="object"?r[s]=qa(r[s]||{},i,!0):r[s]=i)}return e}async function rE(e){const t=(await $l.__vitePreload(()=>Promise.resolve().then(()=>Promise.resolve(Rt("./static/umd/3f12d6ff.js")).then(n=>Tn.__toESM(n.default))),void 0,{}.url)).default;return new Promise((n,r)=>{t.load({google:{families:[e]},classes:!1,active:()=>n(),inactive:()=>r(new Error(`Шрифт не загрузился: ${e}`))})})}var Ka=l.createIdentifier$1("EditorOptions"),Wr=l.MONACO_EDITOR_OPTIONS;function oE(e){const t=typeof e.font_family=="string"?`${e.font_family}, sans-serif`:void 0,n=e.word_wrap===void 0?void 0:e.word_wrap?"on":"off";return{tabSize:e.tab_size,fontFamily:t,fontSize:e.font_size,wordWrap:n,insertSpaces:e.insert_spaces,minimap:{enabled:e.minimap}}}function sE(e){return e.getOrCreateInstance(Ka,()=>{const t=fe(Wr);let n=Wr.fontFamily;return t.watch(r=>{!r.fontFamily||r.fontFamily===n||(n=r.fontFamily,Promise.resolve(rE(r.fontFamily.split(",")[0])).catch(()=>{}))}),t})}function iE(e){return e?.getInstance(Ka)?.get()??Wr}function aE(e,t={}){const n=sE(e);n.set(qa({...n.get()},oE(t)))}function lE(e){return{font_size:e.fontSize,font_family:e.fontFamily,tab_size:e.tabSize,word_wrap:e.wordWrap,minimap:e.minimap,insert_spaces:e.insertSpaces}}function cE(e){return{fontSize:e.fontSize,fontFamily:e.fontFamily,tabSize:e.tabSize,wordWrap:e.wordWrap!=="off",minimap:e.minimap?.enabled,insertSpaces:e.insertSpaces}}var dE=l.createIdentifier$1("plugin.publicConfig");function Yr(e){return e.getInstance(l.CONFIG_SOURCE_ID)?.get()??{}}function za(e){return e.getInstance(l.CONFIG_SOURCE_ID)?.layers()??{base:{},profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}}}function Xa(e){const t=Ti(e),n=Yr(e);return{...n,locale:n.locale||"ru_RU",theme:n.theme||"light",editor:cE(iE(e)),codeModeDirection:t.isCodeMode?t.direction:"none"}}function Ja(e){return e.getInstance(l.CONFIG_SOURCE_ID)?.get()!==void 0}function uE(e){const t=l.createQueue(),n=ue(e,l.CONFIG_CHANGED_EVENT_ID);let r,o,s=!1;const i=async()=>{try{return e.getInstance(l.APP_ID)===void 0?{}:(await e.getInstanceAsync(l.APP_ID))?.app_config||{}}catch{return{}}},a=async({onlyChangedCodeMode:p=!1}={})=>{await e.getInstance(l.CONFIG_SOURCE_ID)?.ready(),Po(e).set(Yr(e).revisionService===!0);const{codeModeDirection:m,editor:h}=Yr(e);h&&aE(e,lE(h)),m!==void 0&&!(p&&m===o)&&(o=m,m==="none"?mr(e,!1):(mr(e,!0),nh(e,m)))},c=async()=>{if(!Ja(e))return;const p=Xa(e),m=JSON.stringify(p);m!==r&&(r=m,await n.fire(p))},d=async p=>{const m=e.getInstance(l.CONFIG_SOURCE_ID),h={advancedConfigs:za(e).advancedConfigs,serverSide:await i(),user:p};m?.setAdvancedConfigs({...h.advancedConfigs,...h.user?.advancedConfigs});const _=m?.layers().user.mode;m?.replace(h.user?.mode===void 0&&_!==void 0?{...h.user,mode:_}:h.user,"user"),m?.replace(h.serverSide,"server"),await a(),await c()},u=p=>{const{commonStyles:m,...h}=p;return"commonStyles"in p&&oh(e,m===void 0?void 0:m),h};return{queue:t,reactToConfig:a,emitConfigChanged:c,resolveServerSideConfig:i,getConfig:()=>Ja(e)?Xa(e):{},setConfig:t.decorate(async p=>{await d(u(p))}),updateConfig:t.decorate(async p=>{const m=u(p);await d({...za(e).user,...m})}),announceAssembled(){s||(s=!0,e.getInstance(l.CONFIG_SOURCE_ID)?.ready().then(t.decorate(async()=>{await a({onlyChangedCodeMode:!0}),await c()})))}}}function Qa(e){return e.getOrCreateInstance(dE,()=>uE(e))}function fE(e){const t=Qa(e);return{getConfig:()=>t.getConfig(),setConfig:n=>t.setConfig(n),updateConfig:n=>t.updateConfig(n)}}var pE=l.defineMixin(e=>{const t=e.getInstance(l.DISPOSABLE_ID),n=t.addDisposable(new l.AsyncEmitter),r=t.addDisposable(new l.AsyncEmitter),o=l.getEmitter(e,l.CONFIG_CHANGED_EVENT_ID),s=H(n.event),i=H(r.event),a=Oa(H(o.event),e),c=t.addDisposable(new Qe(s)),d=t.addDisposable(new Qe(i)),u=t.addDisposable(new Qe(a));return{instance:{handleSetOptions:s,handleOptionsChanged:i,handleConfigChanged:a},async setOptions(p){c.setListener(p.handleSetOptions),d.setListener(p.handleOptionsChanged),u.setListener(p.handleConfigChanged),Qa(e).announceAssembled(),await n.fire(p),await r.fire(p)},dispose(){}}}),qr,Za="core";function hE(){const e=__emailmaker__?.require;return typeof e!="function"?Promise.reject(new Error("[loadCore] AMD loader is unavailable")):new Promise((t,n)=>{e([Za],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadCore] Failed to require core module")))})}function mE(e){const t=__emailmaker__?.require?.warm;return typeof t!="function"?It().then(()=>{}):t([Za],e)}function It(){return qr===void 0&&(qr=hE().then(e=>(rt()&&e.installDiagnostics().catch(t=>{}),e))),qr}var Kr=null,zr=null;async function gE(e){typeof e?.prefetch=="function"&&await e.prefetch()}function Xr(){return Kr||(Kr=It().then(()=>{})),Kr}function el(e){return zr||(zr=gE(e)),zr}function vE(){return el(typeof __emailmaker__<"u"?__emailmaker__:void 0)}function EE(){const e=typeof __emailmaker__<"u"?__emailmaker__:void 0,t=e?.__compatMissingReason;return e&&(e.__compatMissingReason=void 0),typeof t=="string"?t:void 0}function _E(e){return Promise.all([Xr(),el(e)]).then(()=>{})}function bE(e){const t=e?.preload?.start??e?.startupPrefetchMode;return t==="eager"||t==="idle"||t==="manual"||t==="off"?t:"idle"}function tl(e,t){const n=e?.preload?.execute!==!1;Promise.resolve().then(()=>mE(t?{priority:t}:void 0)).then(()=>(nr(t?{priority:t}:void 0),n?Xr():void 0)).catch(()=>{})}function SE(e){const t=bE(e);if(t==="eager")tl(e);else if(t==="idle"){const n=()=>tl(e,"low");document.readyState==="complete"?n():window.addEventListener("load",n,{once:!0})}}var nl="PluginRegistry";function yE(e=l.resolveContainer()){return e.getOrCreateInstance(nl,()=>new zl)}var rl=new Xl(()=>yE()),wE=["handleAIImageRequest","handleAITextRequest","handleAnalyticsEvent","handleBlockAutosave","handleBlockChanged","handleBlockInit","handleCloneBlock","handleCloneEmail","handleCloseBlock","handleConfigChanged","handleDestroy","handleEmailAutosave","handleEmailChanged","handleEmailInit","handleError","handleFileProxy","handleHtmlChanged","handleImportValidate","handleLimitUsage","handleLivePreviewEmail","handleLoad","handleLoadImage","handleNextButtonClick","handleNotify","handleOpenBlock","handleOptionsChanged","handlePreheaderChanged","handlePreviewEmail","handlePreviousButtonClick","handleReadBlock","handleReadBlockAutosave","handleReadBlockRevisions","handleReadBlocks","handleReadComments","handleReadCommonBlocks","handleReadEmail","handleReadEmailAutosave","handleReadEmailRevisions","handleReadLocale","handleReadTemplateBlocks","handleRemoveBlock","handleRemoveBlockAutoSave","handleRemoveComment","handleRemoveEmail","handleRemoveEmailAutoSave","handleSaveBlock","handleSaveBlockButtonClick","handleSaveButtonClick","handleSaveComment","handleSaveEmail","handleSetOptions","handleShareEmail","handleSubjectChanged","handleSuccess","handleTestEmailModal","handleTestEmailSend","handleTranslate","handleUrlProxy","handleValidate"],IE=["closeBlock","compileEmail","getBlockSnapshot","getBlocks","getComments","getEmail","getEmailRevisions","getEmailSnapshot","openBlock","save","saveBlock","setConfig","show","showBlock","updateConfig","useAsync","validateCode","waitPlugin"],vn=new Map([...wE.map(e=>[e,"event"]),...IE.map(e=>[e,"async"]),["setEmailMeta","queued"],["setBlockMeta","queued"],["notify","queued"],["getConfig","sync"],["use","sync"],["getElement","element"],["getCodeErrors","codeErrors"],["container","field"],["undoRedoService","field"]]),TE=new Map([["use","use `useAsync()` or await `ready` first"]]);function CE(e){return TE.get(e)??"await `ready` first"}var AE=new Set(["async","queued"]),DE=Symbol.for("emailmaker.earlyCtxPlaceholder");function ol(e){return e[DE]=!0,e}function PE(e){return new Error(`[emailmaker] ${e}() is not available in a plugin constructor: the editor core is still loading. Call it from init() or later (${CE(e)}).`)}function OE(e){return new Error(`[emailmaker] ${e}() is missing from the editor instance after the core has loaded.`)}function RE(e){return[...vn].filter(([t,n])=>n!=="field"&&e[t]===void 0).map(([t])=>t).sort((t,n)=>t.localeCompare(n))}function kE(e,t){for(const n of RE(e)){const r=vn.get(n);if(r!==void 0&&AE.has(r)){const o=async(...s)=>{await t;const i=e[n];if(typeof i!="function"||i===o)throw OE(n);return i.apply(e,s)};e[n]=ol(o);continue}e[n]=ol(()=>{throw PE(n)})}}function NE(e,t,n){e.getInstanceAsync(tt).then(()=>{l.getEmitter(e,l.events.ON_NOTIFICATION).fire({type:"error",id:"PLUGIN_CREATE_ERROR",data:{plugin:t},innerException:n})},()=>{})}function LE(e,t){e.getInstanceAsync(tt).then(()=>{l.getEmitter(e,l.events.ON_NOTIFICATION).fire({type:"error",id:"PLUGIN_LOAD_ERROR",data:{plugin:t.name,url:t.url,message:t.error.message},innerException:t.error})},()=>{})}var ME=l.defineMixin(e=>{let t;function n(){return new Promise(o=>{const s=e.getOrCreateInstance(l.LATE_SURFACE_LISTENERS_ID,()=>new Set),i=()=>{s.delete(i),o()};s.add(i)})}function r(){if(!t)throw new Error("PluginCollection not initialized. Call init() first.");return t}return{async setOptions(o){const s=e.getInstance(l.INSTANCE_ID),i=e.getInstance(nl);if(!t){t=new Kl(s,i,{ensureHostRuntimeReady:vE,explainScriptFailure:EE,openEarlyWindow:()=>pv(e),reportLoadFailure:d=>LE(e,d)}),e.inject(l.PLUGIN_COLLECTION_ID,t);const c=t.onLifecycle(d=>{d.type==="create:error"&&NE(e,d.name,d.error)});e.getInstance(l.DISPOSABLE_ID)?.addDisposable(c)}const a=o?.plugins||[];s&&(ks(e),a.length>0&&kE(s,n()),await t.setPlugins(a))},instance:{use(o){return typeof o=="function"?r().useByCtor(o):r().useByKey(o)},useAsync(o){return r().useAsync(o)},waitPlugin(o){return r().waitFor(o)}},dispose(){t?.dispose(),t=void 0}}}),sl=class{_listeners=[];add(e,t=0,n){const r={fn:n?e.bind(n):e,priority:t};return this._listeners.push(r),{dispose:()=>{const o=this._listeners.indexOf(r);o>=0&&this._listeners.splice(o,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}},xE=l.createIdentifier$1("ELEMENT_INSERT_HTML_PIPELINE"),FE=l.createIdentifier$1("BLOCK_INSERT_HTML_PIPELINE"),BE="application_block_inserted",jE=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(FE,()=>new sl).add(e,t??0,n)}handleInject(e,t,n){const r=this._container.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService),o=n?e.bind(n):e;return r.addListener(BE,o,t)}},Jr=l.createIdentifier$1("ComponentRegistry"),UE=l.createIdentifier$1("ComponentRegistryGate");function Qr(){return l.DependencyResolver.getOrCreateInstance(UE,()=>({pending:[]}))}function $E(e=Jr){return Qr().factory!==void 0||l.DependencyResolver.getInstance(e)!==void 0}function Zr(e,t,n=Jr){if($E(n)){t(En(e,n));return}Qr().pending.push(()=>t(En(e,n)))}function En(e,t=Jr){const n=l.DependencyResolver.getInstance(t);if(n)return n;const r=Qr().factory;if(!r)throw new Error("[extensions] component registry is not loaded yet — UI work starts at init()");return l.DependencyResolver.getOrCreateInstance(t,r)}var HE=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}getNames(){return new Promise(e=>{const t=[];let n=!1;const r=s=>{if(!n){n=!0;for(const i of t)i.dispose();e(s)}};t.push(this._container.addService(l.ATOMS_HANDLERS_ID,{execute:s=>{r(s.value.map(i=>({name:i.name,html:i.html})))}}));const o=this._container.getInstance(l.HEADLESS_MODE_ID)?.watch(s=>{s&&r([])});o&&(n?o.dispose():t.push(o))})}update(e,t){const n=this._container;return n.addService(l.ATOMS_HANDLERS_ID,{execute:r=>{const o=En(n),s=r.value.find(i=>i.name===e);if(s){const{icon:i,title:a,fallbackTooltip:c,...d}=t;i&&(s.icon=o.getReactNode(i)),a&&(s.title=o.getReactNode(a)),c&&(s.fallbackTooltip=o.getReactNode(c)),Object.assign(s,d)}}})}delete(e){this._container.addService(l.ATOMS_HANDLERS_ID,{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;return n.addService(l.ATOMS_HANDLERS_ID,{execute:r=>{const o=En(n);r.value.splice(t??r.value.length,0,{...e,title:o.getReactNode(e.title),icon:o.getReactNode(e.icon),fallbackTooltip:o.getReactNode(e.fallbackTooltip)})}})}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(xE,()=>new sl).add(e,t??0,n)}handleInject(e,t,n){return l.getEmitter$1(this._container,l.HANDLE_ATOM_INSERT_ID).event(r=>{e({name:r.name,className:r.className||"",html:r.html})},t,n)}},VE=class{_messageService;constructor(e){this._messageService=e.container.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService)}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 GE(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>n!==void 0))}function il(e,t){if(!t)return;const n=r=>r===void 0?void 0:e.getReactNode(r);return{...t,footer:n(t.footer),okText:n(t.okText),cancelText:n(t.cancelText),closeIcon:n(t.closeIcon)}}var WE=class{_context;_showModalEmitter;_closeModalEmitter;_updateModalEmitter;constructor(e){this._context=e;const t=e.container;this._showModalEmitter=l.getEmitter$1(t,l.MODAL_SHOW_EVENT),this._closeModalEmitter=l.getEmitter$1(t,l.MODAL_CLOSE_EVENT),this._updateModalEmitter=l.getEmitter$1(t,l.MODAL_UPDATE_EVENT)}get _container(){return this._context.container}show(e){const t=`modal_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,n=e.modalProps;return Zr(this._container,r=>{this._showModalEmitter.fire({...e,content:r.getReactNode(e.content),title:r.getReactNode(e.title),id:t,modalProps:il(r,n)})}),t}close(e){this._closeModalEmitter.fire(e)}closeAll(){this._closeModalEmitter.fire()}update(e,t){const n=t.modalProps;Zr(this._container,r=>{this._updateModalEmitter.fire(GE({...t,content:r.getReactNode(t.content),title:r.getReactNode(t.title),id:e,modalProps:il(r,n)}))})}};function _n(e){return e?.surfaces?{surfaces:[...e.surfaces]}:{}}var YE=class{_registration;_loadedDisposable;loaded;ready;_loadedSettled=!1;_readySettled=!1;_readyListeners=new Set;constructor(e,t){this._registration=e,this._loadedDisposable=t,this.loaded=new Promise((n,r)=>{this._resolveLoaded=()=>{this._loadedSettled||(this._loadedSettled=!0,n())},this._rejectLoaded=o=>{this._loadedSettled||(this._loadedSettled=!0,r(o))}}),this.ready=new Promise((n,r)=>{this._resolveReady=()=>{this._readySettled||(this._readySettled=!0,n())},this._rejectReady=o=>{this._readySettled||(this._readySettled=!0,r(o))}})}_resolveLoaded=()=>{};_rejectLoaded=()=>{};_resolveReady=()=>{};_rejectReady=()=>{};resolveLoaded(){this._resolveLoaded()}resolveReady(){this._resolveReady();for(const e of Array.from(this._readyListeners))try{e()}catch{}}onReady(e){return this._readyListeners.add(e),this._readySettled&&e(),{dispose:()=>{this._readyListeners.delete(e)}}}rejectLoad(e){this._rejectLoaded(e),this._rejectReady(e)}rejectReady(e){this._rejectReady(e)}dispose(){this._registration.dispose(),this._loadedDisposable.dispose(),this._readyListeners.clear();const e=new Error("Sandbox script registration disposed before completion.");this.rejectLoad(e),this.rejectReady(e)}},qE=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}get _messageService(){return this._container.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService)}_createScriptHandle(e,t){const n=this._messageService.addListener(l.SANDBOX_EXTENSION_SCRIPT_STATUS_ID,o=>{if(o.key===e){if(o.phase==="load"&&o.status==="success"){r.resolveLoaded();return}if(o.phase==="ready"&&o.status==="success"){r.resolveReady();return}if(o.phase==="load"){r.rejectLoad(new Error(o.error||`Sandbox script "${e}" failed to load.`));return}r.rejectReady(new Error(o.error||`Sandbox script "${e}" failed to initialize.`))}}),r=new YE(t,n);return r}registerSandboxCSS(e,t){return this._container.addService(l.SANDBOX_EXTENSIONS_ID,{..._n(t),type:"link",key:e,parent:"head",attributes:{rel:"stylesheet",type:"text/css",href:e}})}registerSandboxCSSCode(e,t,n){return this._container.addService(l.SANDBOX_EXTENSIONS_ID,{..._n(n),type:"style",key:e,parent:"head",attributes:{type:"text/css"},innerHTML:t})}registerSandboxScript(e,t){const n=this._container.addService(l.SANDBOX_EXTENSIONS_ID,{..._n(t),type:"script",key:e,parent:"head",attributes:{src:e,type:"text/javascript"}});return this._createScriptHandle(e,n)}registerSandboxScriptCode(e,t,n){const r=this._container.addService(l.SANDBOX_EXTENSIONS_ID,{..._n(n),type:"script",key:e,parent:"head",attributes:{type:"text/javascript"},innerHTML:t});return this._createScriptHandle(e,r)}},KE=new Set([Symbol.for("react.element"),Symbol.for("react.transitional.element")]);function eo(e){if(typeof e!="object"||e===null)return!1;const t=e.$$typeof;return typeof t=="symbol"&&KE.has(t)}function al(){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 to(){return`__settingsPanel:${al()}`}function no(e,t){return{type:e,props:t}}function zE(e){return typeof e=="object"&&e!==null&&"type"in e&&"props"in e&&!eo(e)}function ll(e,t,n){if(t==null||typeof t=="number"||typeof t=="boolean"||typeof t=="string")return t;if(eo(t)){const r=to();return n(e.add(r,t)),no(r,{})}if(typeof t=="function"){const r=to();return n(e.add(r,t)),no(r,{})}if(zE(t)){const r=t.type;if(typeof r=="string")return t;if(eo(r)||typeof r=="function"){const o=to();return n(e.add(o,r)),no(o,t.props)}return t}return t}var XE=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=e.instanceKey??al();Zr(this._container,n=>{const r=i=>this._trackRegistration(i),o=ll(n,e.content,r),s=e.advancedTabs?.map(i=>({...i,content:ll(n,i.content,r)}));l.getEmitter$1(this._container,l.SETTINGS_PANEL_EVENT).fire({...e,content:o,advancedTabs:s,instanceKey:t,type:l.ADVANCED_SETTINGS_PANEL})})}closeSettingsPanel(){this._clearPanelRegistrations(),l.getEmitter$1(this._container,l.SETTINGS_PANEL_EVENT).fire(null)}},cl={SandboxScriptApi:qE,ElementsApi:HE,BlocksApi:jE,MessageService:VE,SettingsPanelApi:XE,ModalApi:WE};function ro(e,t,n,r={}){const o=Object.assign({},e);for(const[s,i]of Object.entries(t))if(i!==void 0)if(n.includes(s)&&typeof i=="object"&&i!==null){const a=o[s],c=r[s]??{};o[s]=Object.assign({},typeof a=="object"&&a!==null?a:c,i)}else o[s]=i;return o}var ve={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}},JE={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"},oo={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},dl={color:"#1C52DC",contrastColor:"#FFFFFF",underline:!0},nt={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:ve.border,borderRadius:ve.borderRadius,textAlign:"center",padding:ve.padding},ul={backgroundColor:"#FFFFFF",contrastBackgroundColor:"#1C52DC",padding:ve.padding},so={contrastBackgroundColor:"#1C52DC",contrastTextColor:"#FFFFFF",baseBackgroundColor:"#F8F8F8",baseTextColor:"#333333",border:ve.border,borderRadius:ve.borderRadiusCards};function QE(e){return{...JE,...e}}function ZE(e){return{...oo,...e,bold:e?.bold??oo.bold,italic:e?.italic??oo.italic}}function e_(e){return{...dl,...e,underline:e?.underline??dl.underline}}function t_(e){return{...nt,...e,bold:e?.bold??nt.bold,italic:e?.italic??nt.italic,border:{...nt.border,...e?.border},borderRadius:{...nt.borderRadius,...e?.borderRadius},padding:{...nt.padding,...e?.padding}}}function n_(e){return{...ul,...e,padding:{...ul.padding,...e?.padding}}}function r_(e){return{...so,...e,border:{...so.border,...e?.border},borderRadius:{...so.borderRadius,...e?.borderRadius}}}function io(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 fl(e){let t={...l.COMMON_STYLES};try{e&&e!=="{}"&&(t=JSON.parse(e))}catch{}return t}function ao(e){return{text:QE(e.text),headings:ZE(e.headings),links:e_(e.links),buttons:t_(e.buttons),block:n_(e.block),cards:r_(e.cards)}}var pl=l.createIdentifier$1("EmailSettingsPort"),o_=1e4,hl=class{_editor;_layoutSettingsChanged=new l.Emitter;_contentStylesChanged=new l.Emitter;_messageSubscription;_messageSubscriptionPromise;_prevLayoutSnapshot;_prevContentSnapshot;constructor(e){this._editor=e}onChangeEmailLayoutSettings(e){const t=this._layoutSettingsChanged.event(e);return this._ensureMessageSubscription(),this._replayToEarlyPlugin(e,()=>this._getCurrentLayoutSettings()),{dispose:()=>{t.dispose(),this._disposeMessageSubscriptionIfUnused()}}}onChangeEmailContentStyles(e){const t=this._contentStylesChanged.event(e);return this._ensureMessageSubscription(),this._replayToEarlyPlugin(e,()=>this._getCurrentContentStyles()),{dispose:()=>{t.dispose(),this._disposeMessageSubscriptionIfUnused()}}}_replayToEarlyPlugin(e,t){if(!Pa(this._editor.container)||!Ve(this._editor.container)?.current()?.get().attributes.is_inited)return;const n=t();queueMicrotask(()=>e(n))}_disposeMessageSubscriptionIfUnused(){this._layoutSettingsChanged.hasListeners()||this._contentStylesChanged.hasListeners()||(this._messageSubscription?.dispose(),this._messageSubscription=void 0)}_settings(e=this._editor.container){const t=e.getInstance(pl);if(!t)throw new Error("[extensions] email settings are not loaded yet — UI work starts at init()");return t}_getCurrentLayoutSettings(){return io(this._settings().read())}_getCurrentContentStyles(){const e=Ve(this._editor.container)?.current()?.get().attributes.common_styles;return ao(fl(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(pl),this._messageSubscription)return;const e=this._editor.container.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService),t=this._getCurrentLayoutSettings(),n=this._getCurrentContentStyles();this._prevLayoutSnapshot=this._getLayoutSnapshot(t),this._prevContentSnapshot=this._getContentSnapshot(n),this._messageSubscription=e.addListener(r=>{const o=r?.data,s=o?.operation;if(s===l.EVENT_TYPES.APPLICATION_EMAIL_SETTINGS_SET){const c=io(o?.settings),d=this._getLayoutSnapshot(c);d!==this._prevLayoutSnapshot&&(this._prevLayoutSnapshot=d,this._layoutSettingsChanged.fire(c));return}if(s!==l.EVENT_TYPES.APPLICATION_COMMON_STYLES_UPDATE)return;const i=ao(r.data?.settings?.commonStyles??{...l.COMMON_STYLES}),a=this._getContentSnapshot(i);a!==this._prevContentSnapshot&&(this._prevContentSnapshot=a,this._contentStylesChanged.fire(i))})})();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=io(n);this._prevLayoutSnapshot=this._getLayoutSnapshot(r),this._layoutSettingsChanged.fire(r)}async _waitForEmailSettingsFromIframe(e=o_){const t=Ve(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,o=l.getEvent(r,l.events.ON_EMAIL_INIT_ID);return new Promise(s=>{let i=!1,a;const c=()=>{a&&(clearTimeout(a),a=void 0)},d=o(()=>{i||(i=!0,c(),d.dispose(),s())});a=setTimeout(()=>{i||(i=!0,d.dispose(),s())},e)})}async getEmailContentStyles(){return this._getCurrentContentStyles()}async setEmailContentStyles(e){const t=Ve(this._editor.container)?.current();if(!t)return;const n=fl(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=ro(n.buttons||{},e.buttons,["border","borderRadius","padding"],{border:ve.border,borderRadius:ve.borderRadius,padding:ve.padding})),e.block!==void 0&&(n.block=ro(n.block||{},e.block,["padding"],{padding:ve.padding})),e.cards!==void 0&&(n.cards=ro(n.cards||{},e.cards,["border","borderRadius"],{border:ve.border,borderRadius:ve.borderRadiusCards}));const r=JSON.stringify(n);qe(t,{common_styles:r},{source:"system"}),this._settings().markAppearanceChanged();const o=ao(n);this._prevContentSnapshot=this._getContentSnapshot(o),this._contentStylesChanged.fire(o)}},s_={...cl,EmailSettingsApi:hl},i_={...cl},OS={...i_,EmailSettingsApi:hl},a_={...s_};function l_(){rl.addAll(a_)}var c_=[l.defineMixin(()=>{l_()}),nE,pE,tE,l.JWTMixin,Zv,l.OAuthMixin];async function d_(){return(await It()).asyncMixins}var u_=ME,f_=e=>{let t=null,n=!1;return{instance:{},async setOptions(r){if(!t&&!n){let o;try{o=await d_()}catch(i){throw e.failPendingWaits(i),i}t=o(e);const s=await e.getInstanceAsync(l.INSTANCE_ID);Object.assign(s,t.instance||{});for(const i of e.getInstance(l.LATE_SURFACE_LISTENERS_ID)??[])i()}t&&await t.setOptions(r)},dispose(){t?.dispose(),n=!0}}},p_=l.combineMixins([...c_]);function lo(){let e,t=!1;const n=new Map,r=new Map;function o(){for(const s of r.values())s();r.clear()}return{event(s,i,a){const c=Symbol("subscription");return t||(n.set(c,{listener:s,priority:i,thisArg:a}),e&&r.set(c,e(s,i,a))),()=>{n.delete(c),r.get(c)?.(),r.delete(c)}},attach(s){o(),e=s;for(const[i,{listener:a,priority:c,thisArg:d}]of n)r.set(i,s(a,c,d))},dispose(){t=!0,o(),n.clear(),e=void 0}}}function h_(e){const t=lo(),n=lo(),r=lo();return e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{t.dispose(),n.dispose(),r.dispose()}),e.getInstanceAsync(tt).then(o=>{t.attach(o.onNotify),n.attach(o.onError),r.attach(o.onSuccess)},()=>{}),{handleNotify:t.event,handleError:n.event,handleSuccess:r.event,notify(o){const s=e.getInstance(tt);if(s){s.notify(o);return}e.getInstanceAsync(tt).then(i=>i.notify(o),()=>{})}}}var ml=l.createIdentifier$1("CodeErrors"),m_=[];function g_(e){return e?.getInstance(ml)?.get()??m_}function v_(e){return e?.getInstance(ml)!==void 0}var E_=class extends l.Disposable{_container;_dataSources;_currentEmail;_blockMetaWrites=Promise.resolve();constructor(e){super(),this._container=e,this._dataSources=Et(e),this.addDisposable(l.getEvent(e,l.events.ON_EMAIL_CHANGED_ID)(t=>{this._currentEmail=t}))}openEmail(){const e=Ne(this._container);if(e&&Z(e.sessionKey())&&!e.hasSuspended())throw new Error("[emailmaker] no open email: only a block is shown");return la(this._container,this._currentEmail)}async getBlocks(){const e=await this._readProjectBlocks();return await this._blockMetaWrites,(await this._dataSources.blocks.cache.values()).filter(t=>String(t.project)===String(e)).map(t=>pe(t,this._container))}async _readProjectBlocks(){const e=await ca(this._container);return await this._dataSources.blocks.byForeignKey("project").get(e),e}async getComments(){const{cache:e}=this._dataSources.comments,t=await this.getEmailSnapshot();return(await e.values()).filter(n=>n.post===t.id).map(n=>bt(n,this._container))}async getEmailRevisions(){const{cache:e}=this._dataSources.emailRevisions,t=await this.getEmailSnapshot();return(await e.values()).filter(n=>n.parent===t.id).map(n=>kr(n,this._container))}async getEmailSnapshot(){return ge(this.openEmail(),this._container)}async getBlockSnapshot(){const e=Ne(this._container),t=e?.current();return!e||!t||!Z(e.sessionKey())?null:(await t.whenReady(),pe(Zt(t),this._container))}setEmailMeta(e){const t=Pr(this._container);if(!t)return;const n=t.get().attributes.meta;qe(t,{meta:rn({meta:n},e).meta});const r=t.get().serverId;r!=null&&this._dataSources.emails.cache.addOrUpdate(r,o=>o&&rn(o,e))}setBlockMeta(e,t){const n=Ne(this._container);if(n?.sessionKey()===Bt(e)){const o=n.current();o&&qe(o,{meta:rn({meta:o.get().attributes.meta},t).meta})}const r=async()=>{await this._readProjectBlocks();const{cache:o}=this._dataSources.blocks;await o.getIfPresent(e)&&await o.addOrUpdate(e,s=>s&&rn(s,t))};this._blockMetaWrites=this._blockMetaWrites.then(r).catch(()=>{})}getCodeErrors(){return v_(this._container)?g_(this._container):void 0}},__=l.createIdentifier$1("EmailDataController");function b_(e){return e.getOrCreateInstance(__,()=>{const t=new E_(e);return e.getInstance(l.DISPOSABLE_ID)?.addDisposable(t),t})}function S_(e){const t=b_(e);return{getEmailSnapshot:()=>t.getEmailSnapshot(),getBlockSnapshot:()=>t.getBlockSnapshot(),getCodeErrors:()=>t.getCodeErrors(),getBlocks:()=>t.getBlocks(),getComments:()=>t.getComments(),getEmailRevisions:()=>t.getEmailRevisions(),setEmailMeta:n=>t.setEmailMeta(n),setBlockMeta:(n,r)=>t.setBlockMeta(n,r)}}function y_(e){return{undo:()=>e.undo(),redo:()=>e.redo(),clear:()=>e.clear(),canUndo:()=>e.canUndo(),canRedo:()=>e.canRedo(),createSnapshot:()=>e.createSnapshot(),restoreSnapshot:t=>{e.restoreSnapshot(t)},getPast:t=>e.getPast(t).map(n=>({changes:n})),getFuture:t=>e.getFuture(t).map(n=>({changes:n}))}}function w_(e){let t;const n=Bi(e),r=l.getEvent(e,l.events.ON_DOCUMENT_SESSION_CHANGE);n.addDisposable(r(({history:s})=>{t=s}));const o=()=>t?y_(t):void 0;return{undoRedoService:{undo:()=>o()?.undo(),redo:()=>o()?.redo(),clear:()=>o()?.clear(),getPast:s=>o()?.getPast(s)??[],getFuture:s=>o()?.getFuture(s)??[],canUndo:()=>o()?.canUndo()??!1,canRedo:()=>o()?.canRedo()??!1,createSnapshot:()=>o()?.createSnapshot(),restoreSnapshot:s=>o()?.restoreSnapshot(s)}}}var I_=l.createIdentifier$1("plugin.mountElement");function T_(e){const t=e.getInstance(l.OPTIONS_SOURCE_ID)?.get()?.element;if(typeof Element<"u"&&t instanceof Element||typeof DocumentFragment<"u"&&t instanceof DocumentFragment)return t}function C_(e){return e.getOrCreateInstance(I_,()=>{let t=!1,n;return{get:()=>t?n:T_(e),set(r){t=!0,n=r}}})}function A_(e){const t=C_(e);return{getElement:()=>t.get()}}function D_(e){return{handleLoadImage:H(l.getEvent(e,l.events.UPLOAD_EVENT_ID)),handleFileProxy:H(l.getEvent(e,l.events.FILE_PROXY_EVENT_ID)),handleUrlProxy:H(l.getEvent(e,l.events.PROXY_URL_EVENT_ID)),handleAITextRequest:H(l.getEvent(e,l.events.AI_TEXT_REQUEST_ID)),handleAIImageRequest:H(l.getEvent(e,l.events.AI_IMAGE_REQUEST_ID)),handleReadLocale:H(l.getEvent(e,l.events.READ_LOCALE)),handleLimitUsage:H(l.getEvent(e,l.events.ON_LIMIT_ID)),handleTranslate:H(l.getEvent(e,l.events.ON_TRANSLATE_ID))}}var P_=[Zh,yv,h_,fE,S_,w_,A_,D_];function O_(e,t=P_){const n=Gr(e);Xv(e);const r=p_(e),o=u_(e),s=f_(e),i={...r.instance,...o.instance,...s.instance};for(const c of t)Object.assign(i,c(e));let a=!0;return{instance:i,async setOptions(c){await r.setOptions(c);const d=a&&n.get()===c;a=!1,d||n.set(c),await o.setOptions(c),await s.setOptions(c)}}}function R_(e){return{get:t=>e.get(t),remove:(t,n)=>e.remove(t,n),set:(t,n,r)=>{if(n==null){e.get(t),e.remove(t,r);return}e.set(t,n,r)}}}var k_=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]}},N_="editor-runtime.react.copies",co=8;function Tt(e){return e&&typeof e=="object"?e:void 0}function gl(e){const t=Tt(e);if(!t)return;if(typeof t.useState=="function")return t.useState;const n=Tt(t.default);return n&&typeof n.useState=="function"?n.useState:void 0}function L_(e){const t=Tt(e),n=t&&typeof t.version=="string"?t.version:void 0,r=Tt(t?.default),o=r&&typeof r.version=="string"?r.version:void 0;return n??o??"unknown"}function M_(e,t,n){return e.package===t&&e.version===n}function x_({ourReact:e,entries:t,packageName:n,version:r}){const o=gl(e);if(!o||!Array.isArray(t))return[];const s=[],i=new Set;for(const a of t){const c=Tt(a);if(!c||!M_(c,n,r))continue;const d=gl(c.react);!d||d===o||i.has(d)||(i.add(d),s.push({package:n,version:r,reactVersion:L_(c.react),react:c.react}))}return s}function F_({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,co))n.push(` • React ${r.reactVersion}, loaded through ${r.package}@${r.version}/runtime/react`);return t.length>co&&n.push(` …and ${t.length-co} 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(`
2153
- `)}var vl=new Set;function B_({packageName:e="@emailmaker/emailmaker",version:t="1.3.2",log:n=r=>{}}={}){const r=o=>{try{const s=globalThis[Symbol.for(N_)],i=x_({ourReact:o,entries:s,packageName:e,version:t}).filter(a=>!vl.has(a.react));if(!i.length)return;i.forEach(a=>vl.add(a.react)),n(F_({packageName:e,copies:i}))}catch{}};try{const o=Dn()?.modules?.React;if(o&&typeof o.then=="function"){o.then(r,()=>{});return}r(o)}catch{}}async function j_(e,t,n){l.throwIfAborted(e.signal);const r=t??l.DependencyResolver.createChild();Gr(r);const o=r.getInstance(l.DISPOSABLE_ID);let s;async function i(){r.inject(l.COOKIE_MANAGER_ID,R_(new k_)),B_();const a=O_(r),c={...a.instance,container:r,get ready(){return s??Promise.resolve(c)},async reset(d){if(l.throwIfAborted(d.signal),o.isDisposed())throw we();return await a.setOptions(d),c}};r.inject(l.INSTANCE_ID,c);try{if(n?.onInstance?.(c),await a.setOptions(e),l.throwIfAborted(e.signal),o.isDisposed()||await _v(r),e.devTools)try{const d=r.getInstance(l.PLUGIN_COLLECTION_ID);d&&await(await It()).initDevTools(r,d)}catch{}return l.throwIfAborted(e.signal),l.getEmitter(r,l.APP_LOAD_EVENT_ID).fire(c),c}catch(d){throw o.dispose(),d}}try{return s=l.raceWithAbortSignal(i(),e.signal),s.catch(()=>{}),await s}catch(a){throw o.isDisposed()||o.dispose(),a}}var Ct=new WeakMap;function U_(e){return e?Ct.get(e):void 0}function El(e){try{e.getInstance(l.DISPOSABLE_ID)?.dispose()}catch{}try{e.dispose()}catch{}}function $_(e,t){if(!e)return;const n=Ct.get(e);n&&n!==t&&El(n),Ct.set(e,t)}function H_(e,t){e&&Ct.get(e)===t&&Ct.delete(e)}function V_(e){const t=l.DependencyResolver.createChild();return ht(e)&&t.inject(l.SECURITY_MODULE_ID,nn(e)),t}var At=new WeakMap,G_="data-emailmaker-config-styles";function W_(e){return typeof e=="string"?e.trim():""}function _l(e,t){if(e.firstChild){e.insertBefore(t,e.firstChild);return}e.appendChild(t)}function Y_(e,t,n){if(!e||typeof document>"u")return null;const r=W_(t),o=At.get(e),s=n||e;if(!r)return o&&(o.remove(),At.delete(e)),null;if(o)return o.textContent!==r&&(o.textContent=r),(o.parentNode!==s||o!==s.firstChild)&&_l(s,o),o;const i=document.createElement("style");return i.setAttribute(G_,"true"),i.textContent=r,_l(s,i),At.set(e,i),i}function q_(e){if(!e)return;const t=At.get(e);t&&(t.remove(),At.delete(e))}var RS=!1;function bl(){return!1}var kS=28,K_=`
2153
+ `)}var vl=new Set;function B_({packageName:e="@emailmaker/emailmaker",version:t="1.3.3",log:n=r=>{}}={}){const r=o=>{try{const s=globalThis[Symbol.for(N_)],i=x_({ourReact:o,entries:s,packageName:e,version:t}).filter(a=>!vl.has(a.react));if(!i.length)return;i.forEach(a=>vl.add(a.react)),n(F_({packageName:e,copies:i}))}catch{}};try{const o=Dn()?.modules?.React;if(o&&typeof o.then=="function"){o.then(r,()=>{});return}r(o)}catch{}}async function j_(e,t,n){l.throwIfAborted(e.signal);const r=t??l.DependencyResolver.createChild();Gr(r);const o=r.getInstance(l.DISPOSABLE_ID);let s;async function i(){r.inject(l.COOKIE_MANAGER_ID,R_(new k_)),B_();const a=O_(r),c={...a.instance,container:r,get ready(){return s??Promise.resolve(c)},async reset(d){if(l.throwIfAborted(d.signal),o.isDisposed())throw we();return await a.setOptions(d),c}};r.inject(l.INSTANCE_ID,c);try{if(n?.onInstance?.(c),await a.setOptions(e),l.throwIfAborted(e.signal),o.isDisposed()||await _v(r),e.devTools)try{const d=r.getInstance(l.PLUGIN_COLLECTION_ID);d&&await(await It()).initDevTools(r,d)}catch{}return l.throwIfAborted(e.signal),l.getEmitter(r,l.APP_LOAD_EVENT_ID).fire(c),c}catch(d){throw o.dispose(),d}}try{return s=l.raceWithAbortSignal(i(),e.signal),s.catch(()=>{}),await s}catch(a){throw o.isDisposed()||o.dispose(),a}}var Ct=new WeakMap;function U_(e){return e?Ct.get(e):void 0}function El(e){try{e.getInstance(l.DISPOSABLE_ID)?.dispose()}catch{}try{e.dispose()}catch{}}function $_(e,t){if(!e)return;const n=Ct.get(e);n&&n!==t&&El(n),Ct.set(e,t)}function H_(e,t){e&&Ct.get(e)===t&&Ct.delete(e)}function V_(e){const t=l.DependencyResolver.createChild();return ht(e)&&t.inject(l.SECURITY_MODULE_ID,nn(e)),t}var At=new WeakMap,G_="data-emailmaker-config-styles";function W_(e){return typeof e=="string"?e.trim():""}function _l(e,t){if(e.firstChild){e.insertBefore(t,e.firstChild);return}e.appendChild(t)}function Y_(e,t,n){if(!e||typeof document>"u")return null;const r=W_(t),o=At.get(e),s=n||e;if(!r)return o&&(o.remove(),At.delete(e)),null;if(o)return o.textContent!==r&&(o.textContent=r),(o.parentNode!==s||o!==s.firstChild)&&_l(s,o),o;const i=document.createElement("style");return i.setAttribute(G_,"true"),i.textContent=r,_l(s,i),At.set(e,i),i}function q_(e){if(!e)return;const t=At.get(e);t&&(t.remove(),At.delete(e))}var RS=!1;function bl(){return!1}var kS=28,K_=`
2154
2154
  .blocks-app-initial-spinner-wrapper {
2155
2155
  width: 100%;
2156
2156
  height: 100%;
@@ -2179,11 +2179,11 @@ __emailmaker__.define("emailmaker.js",["require","exports","module","static/umd/
2179
2179
  100% {
2180
2180
  transform: rotate(360deg);
2181
2181
  }
2182
- }`;function z_(){return()=>{}}function X_(e,t){if(!bl()||!e||typeof document>"u")return z_();e.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(i=>{i.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 o=document.createElement("style");o.setAttribute(t,"true"),o.textContent=K_,document.head?.appendChild(o),e.appendChild(n);let s=!1;return()=>{s||(s=!0,n.remove(),o.remove())}}function J_(e){if(!(e instanceof Error))return!1;const t=e;return t.terminal===!0||t.status===403||t.status===404}function Q_({report:e}={}){const t=new Map,n=new Set,r=e??(o=>{});return{run(o,s){const i=t.get(o);if(i!==void 0)return i;const a=s().catch(c=>{throw n.has(o)||(n.add(o),r(c)),J_(c)||t.delete(o),c});return t.set(o,a),a},clear(){t.clear(),n.clear()},size(){return t.size}}}var uo=Q_();function Sl(){uo.clear()}l.setApiOriginFailoverHook(()=>uo.clear());var yl=new WeakMap;function fo(e){return l.resolveExplicitApiBaseUrl(e)}function Z_(e,t){const n=new Error(`[Loader] appInit request failed: ${e} ${t}`);return n.status=e,n}function eb(){const e=new Error("[Loader] appInit skipped: empty auth token");return e.terminal=!0,e}async function tb(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}var po=new WeakMap;function ho(e,t){po.set(e,t)}function nb(e){return po.get(e)}function rb(e,t){return async({baseUrl:n})=>{const r=t(),o=r&&po.get(r)||e,s=fo(n);if(!s)throw new Error("[Loader] appInit requires baseUrl or REACT_APP_OPENAPI_BASE_URL");const i=new Headers({Accept:"application/json","Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}),a=await tb(o);if(o.getAuthToken&&!a)throw eb();a&&i.set("authorization",a);const c=await l.fetchWithApiOriginFailover("/app/v1/app_init",{method:"POST",headers:i,body:new URLSearchParams,credentials:"same-origin"},s,{attemptTimeout:br(o)||void 0});if(!c.ok)throw Z_(c.status,c.statusText);return await c.json()}}function ob(e){return JSON.stringify({baseUrl:fo(e.baseUrl)||"",project:e.project??"",userId:e.user?.id??""})}function sb(e){return e.appInit?!0:!(e.jwtAuth&&!e.getAuthToken)}function ib(e){return t=>uo.run(ob(t),()=>(te("appInit:start",{kind:"network"}),Promise.resolve(e(t)).finally(()=>te("appInit:end",{kind:"network"}))))}function ab(e,t){if(ht(e)||!e.appInit&&!fo(e.baseUrl)||!sb(e))return e;const n=e.appInit??rb(e,t);let r=yl.get(n);return r||(r=ib(n),yl.set(n,r)),{...e,appInit:r}}var wl=0;function lb(){return wl}function cb(){wl+=1,Sl()}var Il=new WeakMap,Tl=new WeakMap,db=3e4;function ub(e,t){return JSON.stringify({userId:e?.id??"",project:t??""})}function fb(e,t){try{const n=l.decodeJwt(e)?.exp;if(typeof n=="number"&&Number.isFinite(n)&&n>0)return n*1e3}catch{}return t+db}function pb(e){const t=new Map,n=new Map;return async(r,o,s)=>{const i=ub(r,o);if(s)return n.delete(i),t.delete(i),Sl(),e(r,o,s);const a=n.get(i);if(a&&!t.has(i)){if(a.expiresAtMs>Date.now())return a.token;n.delete(i)}let c=t.get(i);return c===void 0&&(te("authToken:start",{kind:"network"}),c=Promise.resolve(e(r,o,s)).then(d=>{const u=String(d||"").trim();return u&&n.set(i,{token:d,expiresAtMs:fb(u,Date.now())}),d}).finally(()=>{te("authToken:end",{kind:"network"}),t.delete(i)}),t.set(i,c)),c}}function hb(e){if(ht(e))return e;const t=e.getAuthToken;if(!t)return e;let n=Il.get(t);const r=lb();return(!n||Tl.get(t)!==r)&&(n=pb(t),Il.set(t,n),Tl.set(t,r)),Promise.resolve(n(e.user,e.project,void 0)).catch(o=>{}),{...e,getAuthToken:n}}var mb="[emailmaker] This editor was destroyed: a later init()/create() into the same element failed to start, and the editor could not be handed back. Call init() again; the reason is in `cause`.";function gb(e){const t=new Error(mb,{cause:e});return t.name="EditorStartFailedError",t}var vb={getConfig:"await `ready` first",use:"use `useAsync()` or await `ready` first"};function Cl(e){return new Error(`[emailmaker] \`${e}\` is not available on this editor`)}var Al=["handleLoad","handleDestroy"];function Dl(e,t){let n=e;for(const r of Al){const o=e?.[r];typeof o=="function"&&(n={...n,[r]:(s,...i)=>o(t,...i)})}return n}function Eb(e){let t,n="pending",r,o,s,i;const a=new Set,c=[],d=new Set;let u,p;const m=new Promise((y,B)=>{u=y,p=B});m.catch(()=>{});const h={},_=y=>t?.[y],S=()=>r??we(),v=(y,B)=>{const U=_(y);if(typeof U!="function")throw Cl(y);return U.apply(t,B)},b=(y,B)=>{try{return Promise.resolve(v(y,B))}catch(U){return Promise.reject(U)}},D=()=>{const y=t?.container?.getInstance?.(l.DISPOSABLE_ID);if(!(n!=="ready"||y?.isDisposed()||typeof _("getConfig")!="function"))try{i=v("getConfig",[])}catch{}},j=()=>n==="dead"?Promise.reject(S()):n==="ready"?Promise.resolve():m,x=()=>{for(const[y,B]of vn)B==="field"&&(h[y]=_(y))},C=y=>{const B=_(y.name);y.dispose||typeof B!="function"||n==="dead"||(y.dispose=B.apply(t,y.args))},I=()=>a.forEach(C),R=()=>{for(const y of a){try{y.dispose?.()}catch{}y.dispose=void 0}},A=()=>{x(),I()},O=()=>{s?.delete(A),s=void 0},L=(y,B)=>{const[U,...W]=B;return!Al.includes(y)||typeof U!="function"?B:[(ie,...re)=>U(h,...re),...W]},w=(y,B)=>{if(n==="dead")return()=>{};if(n==="ready"&&typeof _(y)!="function")throw Cl(y);const U={name:y,args:L(y,B)};return a.add(U),C(U),()=>{a.delete(U),U.dispose?.(),U.dispose=void 0}},P=()=>t?.container?.getInstance(l.OPTIONS_SOURCE_ID)?.get()?.content,k=()=>{const y=e.element();return y!==void 0&&typeof y!="string"?y:void 0},F=(y,B)=>{switch(B){case"event":return(...U)=>w(y,U);case"async":return(...U)=>(y==="show"&&U[0]!==void 0&&e.shown?.(U[0]),n!=="dead"&&typeof _(y)=="function"?b(y,U):j().then(()=>v(y,U)));case"queued":return(...U)=>{if(n==="dead"){if(y==="notify")return;throw S()}if(n==="pending"){c.push({name:y,args:U});return}return v(y,U)};case"sync":return(...U)=>{if(n==="dead"){if(y==="getConfig")return i;throw S()}if(typeof _(y)!="function")throw new Error(`[emailmaker] \`${y}\` is not available before the editor is ready: ${vb[y]??"await `ready` first"}`);const W=v(y,U);return y==="getConfig"&&(i=W),W};case"element":return()=>{if(typeof _(y)!="function")return k();try{return v(y,[])}catch{return k()}};case"codeErrors":return()=>n==="ready"&&typeof _(y)=="function"?v(y,[]):[];case"field":return}};for(const[y,B]of vn)h[y]=F(y,B);h.reset=y=>(y?.content!==void 0&&e.shown?.(y.content),j().then(async()=>{const B=y?.content!==void 0&&l.deepEqual(y.content,P());await v("reset",[Dl(y,E)]),B&&await v("show",[y.content])}).then(()=>h)),h.destroy=()=>{if(n==="dead")return;const y=l.createAbortError("[emailmaker] editor was destroyed before it was ready");o?.catch(()=>{}),d.forEach(B=>B(y)),D(),e.destroy()},Object.defineProperty(h,"ready",{get:()=>o,enumerable:!0,configurable:!0});const E=h;return{object:E,get state(){return n},get editor(){return t},bind:y=>{n==="dead"||t===y||(R(),O(),t=y,x(),I(),n==="pending"&&(s=y.container.getOrCreateInstance(l.LATE_SURFACE_LISTENERS_ID,()=>new Set),s.add(A)))},settle:()=>{if(n==="pending"){n="ready",O(),x(),I();for(const y of c.splice(0))try{v(y.name,y.args)}catch(B){queueMicrotask(()=>{throw B})}u()}},kill:(y,B)=>{n!=="dead"&&(D(),n="dead",r=y,c.length=0,d.forEach(U=>U(y)),O(),B?.keepSubscriptions||(R(),a.clear()),p(y))},detach:()=>{R(),a.clear()},setReady:y=>{o=y},trackCall:y=>(d.add(y),()=>d.delete(y)),hasCalls:()=>d.size>0}}var mo="Editor mount element was removed from the document. Call instance.destroy() on host unmount.";function _b(){return l.createAbortError(mo)}function Pl(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===mo}function bb(e,t,n){if(typeof document>"u")return;let r=!1,o;const s=()=>{r=!0,o?.disconnect(),o=void 0},i=()=>{r||(s(),t())};if(n.addDispose(s),!e.isConnected){queueMicrotask(i);return}o=new MutationObserver(()=>{e.isConnected||i()});let a=e.parentNode;for(;a;)o.observe(a,{childList:!0}),a=a.parentNode}function Sb(e){const{hostElementOption:t,resolvedElement:n,externalSignal:r,disposable:o}=e;if(t===void 0||!(n instanceof Element))return r;const s=new AbortController;return bb(n,()=>{n.id,s.abort(_b())},o),l.composeAbortSignals(r,s.signal)}var go="Superseded by newer init() on the same mount element";function Ol(){return l.createAbortError(go)}function Rl(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===go}var Dt=new Map,kl=new WeakMap,bn=new WeakMap;function yb(e){if(e instanceof Element){const t=e.id?.trim();if(t)return`#${t}`}}function wb(e,{supersede:t=!1}={}){if(!e)return{previous:Promise.resolve(),release:()=>{}};const n=yb(e);(n?Dt.get(n):void 0)?.forEach(u=>{u.element!==e&&u.controller.abort(Ol())});const r=kl.get(e)??new Set;t&&r.forEach(u=>{u.supersedable&&u.controller.abort(Ol())});const o=bn.get(e)??Promise.resolve();let s;const i=new Promise(u=>{s=u}),a=o.then(()=>i);bn.set(e,a),a.then(()=>{bn.get(e)===a&&bn.delete(e)});const c=new AbortController,d={element:e,controller:c,supersedable:t};if(r.add(d),kl.set(e,r),n){const u=Dt.get(n)??new Set;u.add(d),Dt.set(n,u)}return{signal:c.signal,previous:o,release:()=>{s(),r.delete(d);const u=n?Dt.get(n):void 0;n&&u?.delete(d)&&u.size===0&&Dt.delete(n)}}}var Pt=new WeakMap;function vo(e,t){return typeof t=="function"&&(/^(handle|on)[A-Z]/.test(e)||e==="getAuthToken")}function Eo(e){return Object.entries(e).filter(([t,n])=>vo(t,n)).map(([t])=>t).sort()}function Nl(e){const t={};for(const[n,r]of Object.entries(e))n!=="signal"&&!vo(n,r)&&(t[n]=r);return t}function _o(e,t,{fresh:n=!1}={}){if(!e)return t;let r=n?void 0:Pt.get(e);r||(r={current:new Map,trampolines:new Map,lastOptions:t},Pt.set(e,r));const{current:o,trampolines:s}=r;o.clear();const i={...t};for(const a of Eo(t)){o.set(a,t[a]);let c=s.get(a);c||(c=(...d)=>o.get(a)?.(...d),s.set(a,c)),i[a]=c}return r.lastOptions=t,i}function Ll(e,t){const n=e?Pt.get(e):void 0;if(n)for(const r of n.trampolines.keys()){const o=t[r];vo(r,o)?n.current.set(r,o):n.current.delete(r)}}function Ib(e){const t=e?Pt.get(e):void 0;if(!t)return()=>{};const n=new Map(t.current),{lastOptions:r}=t;return()=>{t.current.clear(),n.forEach((o,s)=>t.current.set(s,o)),t.lastOptions=r}}function Tb(e,t,n){const r=e?Pt.get(e):void 0;if(!r||!n)return!1;const o=Eo(t),s=l.deepEqual(o,Eo(r.lastOptions)),i=o.every(a=>a==="getAuthToken"||n[a]===r.trampolines.get(a));return!s||!i||!l.deepEqual(Nl(t),Nl(r.lastOptions))?!1:(_o(e,t),!0)}var _e=new WeakMap,NS=0;function Sn(e){let t=_e.get(e);return t||(t={counted:new Set,leaving:new Set,order:[],options:new Map,latestCall:0,warned:!1},_e.set(e,t)),t}var Ce=e=>e!==void 0&&e.state!=="dead";function Cb(e){const t=_e.get(e)?.shared;return Ce(t)?t:void 0}function Ab(e,t){Sn(e).shared=t}function Db(e,t){!(Ce(e.shared)&&[...e.counted].some(Ce))||e.warned||!t.devTools||(e.warned=!0)}function Pb(e,t,n,r){const o=Sn(e);return o.latestCall+=1,o.releaseTimer!==void 0&&(clearTimeout(o.releaseTimer),o.releaseTimer=void 0),o.leaving.forEach(s=>s.detach()),o.leaving.clear(),n==="single"?o.shared=t:o.counted.add(t),o.options.set(t,r),o.order=[...o.order.filter(s=>s!==t&&Ce(s)),t],Db(o,r),o.latestCall}function Ob(e,t){return _e.get(e)?.latestCall===t}function Rb(e){const t=_e.get(e);if(t)return t.order=t.order.filter(Ce),t.order.at(-1)?.object}function Ot(e,t){const n=_e.get(e);return n?Ce(n.shared)&&n.shared!==t||[...n.counted].some(r=>r!==t&&Ce(r)):!1}function kb(e,t){const n=_e.get(e),r=n?.order.filter(o=>o!==t&&Ce(o)).at(-1);return r?n?.options.get(r):void 0}function Ml(e,t){Sn(e).content={value:t}}function Nb(e){return _e.get(e)?.content}function Lb(e,t,n,r){const o=Sn(e);if(o.counted.delete(t),o.options.delete(t),Ot(e)){t.kill(n);return}t.kill(n,{keepSubscriptions:!0}),o.leaving.add(t),xl(e,r)}function xl(e,t){const n=_e.get(e);!n||Ot(e)||n.releaseTimer!==void 0||(n.releaseTimer=setTimeout(()=>{n.releaseTimer=void 0,!Ot(e)&&(t(),n.leaving.forEach(r=>r.detach()),n.leaving.clear())},0))}function Mb(e,t){const n=_e.get(e);if(n){n.releaseTimer!==void 0&&clearTimeout(n.releaseTimer);for(const r of[n.shared,...n.counted,...n.leaving])r?.kill(t);_e.delete(e)}}var xb=Tn.__exportAll({FileManagerApiError:()=>Fb,IntegratorSaveTimeoutError:()=>Nt,SaveRefusedError:()=>De}),Fb=class Ul extends Error{code;status;details;get httpStatus(){return this.status}constructor(t,n,r,o){super(t),this.name="FileManagerApiError",this.code=n,this.status=r,this.details=o,Error.captureStackTrace&&Error.captureStackTrace(this,Ul)}},Bb=Tn.__exportAll({mapHttpStatusToErrorCode:()=>l.mapHttpStatusToErrorCode});function jb(e,t){return{...e,element:t}}function bo(){return()=>{}}function Ub(e){const t=e.element;return!t||typeof t=="string"||typeof document>"u"?bo():(Y_(t,e.config?.styles,t),()=>{q_(t)})}function $b(e){if(!bl()||e.initialSpinner===!1||typeof document>"u")return{options:e,cleanup:bo()};const t=e.element;if(!t||typeof t=="string")return{options:e,cleanup:bo()};t.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(o=>{o.remove()});const n=X_(t,"data-emailmaker"),r=e.handleChunkLoaded;return{options:{...e,handleChunkLoaded:()=>{n(),r?.()}},cleanup:n}}function Hb(e,t){if(e.appInit||!("appInit"in t))return t;const n={...t};return delete n.appInit,n}function yn(e){try{e.destroy()}catch{}}function wn(e,...t){const n=l.ELEMENT_MAP.get(e);t.some(r=>r!==void 0&&r===n)&&l.ELEMENT_MAP.delete(e)}var Vb="1.3.2";async function Gb(e){nr(),await _E(typeof __emailmaker__<"u"?__emailmaker__:void 0)}async function Wb(e){return Fl(e).ready}function Yb(e){if(typeof e!="string")return e??void 0;try{return document.querySelector(e)??void 0}catch{return}}function qb(e){const t=l.ELEMENT_MAP.get(e);return t&&!(t instanceof Promise)?t:void 0}function In(e,t,n){const r=t??qb(e);r&&(wn(e,r),yn(r)),Mb(e,n)}function Kb(e){const{control:t,mode:n,ref:r}=e,o=r.host;if(!o){const i=t.editor;zb(i),t.kill(we());return}if(n==="single"){In(o,t.editor,we());return}const s=kb(o,t);Lb(o,t,we(),()=>In(o,t.editor,we())),s&&Ot(o)&&Ll(o,s)}function zb(e){e&&yn(e)}function Fl(e){te(ce.initStart);const t=e.ownership==="counted"?"counted":"single",n=new AbortController,r=l.composeAbortSignals(e.signal,n.signal),o=t==="single"?Yb(e.element):void 0,s=o?Cb(o):void 0;let i;if(s)i={control:s,mode:t,ref:{host:o}};else{const u={},p=Eb({element:()=>u.host??e.element,destroy:()=>Kb(i),shown:m=>{u.host&&Ml(u.host,m)}});i={control:p,mode:t,ref:u},o&&Ab(o,p)}const{control:a}=i,c=a.trackCall(u=>n.abort(u)),d=tS(Dl({...e,signal:r},a.object),i).then(()=>(c(),te(ce.initEnd),a.settle(),a.object),u=>{c(),a.state==="pending"&&!a.hasCalls()&&a.kill(u);const p=i.ref.host;throw p&&xl(p,()=>In(p,void 0,we())),u});return a.setReady(d),a.object}function Xb(e){const t=typeof e=="string"?document.querySelector(e):e;return t?Rb(t):void 0}function Jb(e){let t,n,r=!1;try{t=e.container.getInstance(l.OPTIONS_SOURCE_ID)?.get(),n=e.container.getInstance(l.INIT_PIPELINE_ID)?.externalSignal;const o=Ve(e.container)?.current();r=o!==void 0&&o.get().savedVersion!==null&&o.isDirty()}catch{t=void 0}return{options:t,signal:n,email:Qb(e),dirty:r}}async function Qb(e){try{return await e.getEmailSnapshot()}catch{return}}function Zb(e){const t=Ve(e.container)?.current();t?.whenReady().then(()=>t.markUnsaved()).catch(()=>{})}function Bl(e,t){const{control:n,mode:r}=t;return r==="single"&&n.state==="ready"||Ot(e,n)}async function eS(e,t,n,r,o){if(r.mode==="counted"&&r.control.detach(),Rl(o)||Pl(o))return;const s=()=>In(t,e,gb(o)),{options:i}=n;if(!i||!Bl(t,r)){s();return}const a=await n.email,c=a&&(i.content!==void 0||a.id!==void 0)?a:void 0,d=typeof i.content=="object"&&"email"in i.content?i.content:void 0;try{await e.reset({...i,signal:i.signal??n.signal,content:c?{...d,email:c}:i.content}),n.dirty&&c&&Zb(e),Bl(t,r)?l.ELEMENT_MAP.set(t,e):s()}catch{s()}}async function tS(e,t){l.throwIfAborted(e.signal);const n=new l.Disposable;let r,o,s,i,a=0;try{const c=await l.waitForElement(e.element,n,e.signal);c&&(i=c,t.ref.host=c,a=Pb(c,t.control,t.mode,e));const d=Sb({hostElementOption:e.element,resolvedElement:c,externalSignal:e.signal,disposable:n}),u=wb(c,{supersede:t.mode==="single"});r=u.release;const p=l.composeAbortSignals(d,u.signal);l.throwIfAborted(p),s=Ib(c),Ll(c,e),await l.raceWithAbortSignal(u.previous,p),o=nS(e,c,t,p,s);const m=await l.raceWithAbortSignal(o,p);return c&&e.content!==void 0&&Ml(c,e.content),m}catch(c){throw i&&s&&Ob(i,a)&&s(),c}finally{const c=r;o!==void 0&&c?o.then(c,c):c?.(),n.dispose()}}async function jl(e,t,n,r){const o=Nb(t);n===void 0||r||!o||l.deepEqual(n,o.value)||await e.show(n)}async function nS(e,t,n,r,o){const{control:s}=n,i=S=>s.bind(S);l.throwIfAborted(r);let a;const c=S=>{cb();const v=hb(jb(S,t)),b=ab(v,()=>a);return{preparedOptions:b,preparedOptionsWithSignal:r!=null?{...b,signal:r}:b}};let d;if(t){const S=l.ELEMENT_MAP.get(t);if(S){let v;try{v=await S,l.throwIfAborted(r)}catch{l.throwIfAborted(r),wn(t,S),v=void 0}if(v)if(v.getElement()===t){const b=U_(t);a=b;const D=v.container.getInstance(l.OPTIONS_SOURCE_ID)?.get();if(Tb(t,e,D))return i(v),r&&v.container.getInstance(l.INIT_PIPELINE_ID)?.relinkExternalSignal(r),l.ELEMENT_MAP.set(t,v),await jl(v,t,e.content,!1),v;const j=!l.deepEqual(e.content,D?.content);d=c(_o(t,e));const{preparedOptions:x,preparedOptionsWithSignal:C}=d,I=b&&nb(b),R=Jb(v);try{b&&ho(b,x),i(v);const A=await v.reset(Hb(e,C));return l.throwIfAborted(r),l.ELEMENT_MAP.set(t,v),await jl(v,t,e.content,j),A}catch(A){if(b&&I&&ho(b,I),!uc(A))throw o(),await eS(v,t,R,n,A),A;wn(t,S,v),yn(v),l.throwIfAborted(r)}}else wn(t,S,v),yn(v)}}l.throwIfAborted(r),d??=c(_o(t,e,{fresh:!0}));const{preparedOptions:u}=d,p=Ub(u),m=$b(u),h=r!=null?{...m.options,signal:r}:m.options;let _;try{a=V_(h),$_(t,a),ho(a,u),Gr(a).set(h),await Xr(),te(ce.coreReady),l.throwIfAborted(r),l.throwIfAborted(r),_=j_(h,a,{onInstance:i}),t&&l.ELEMENT_MAP.set(t,_);const S=await _;if(r?.aborted&&(S.destroy(),l.throwIfAborted(r)),t)if(l.ELEMENT_MAP.get(t)===_)l.ELEMENT_MAP.set(t,S);else throw S.destroy(),l.throwIfAborted(r),l.createAbortError(r?.reason);return S}catch(S){throw p(),m.cleanup(),a&&(El(a),H_(t,a)),t&&_&&l.ELEMENT_MAP.get(t)===_&&l.ELEMENT_MAP.delete(t),S}}async function rS(e){return(await It()).parseAMP(e)}typeof window<"u"&&(rt()&&cc(),SE(typeof __emailmaker__<"u"?__emailmaker__:void 0)),he.ELEMENT_DETACHED_ABORT_MESSAGE=mo,he.SUPERSEDED_INIT_ABORT_MESSAGE=go,he.create=Fl,Object.defineProperty(he,"errors",{enumerable:!0,get:function(){return xb}}),he.getInstance=Xb,Object.defineProperty(he,"helpers",{enumerable:!0,get:function(){return Bb}}),he.init=Wb,he.isElementDetachedError=Pl,he.isSupersededInitError=Rl,he.parseAMP=rS,he.pluginRegistry=rl,he.preload=Gb,he.version=Vb});
2182
+ }`;function z_(){return()=>{}}function X_(e,t){if(!bl()||!e||typeof document>"u")return z_();e.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(i=>{i.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 o=document.createElement("style");o.setAttribute(t,"true"),o.textContent=K_,document.head?.appendChild(o),e.appendChild(n);let s=!1;return()=>{s||(s=!0,n.remove(),o.remove())}}function J_(e){if(!(e instanceof Error))return!1;const t=e;return t.terminal===!0||t.status===403||t.status===404}function Q_({report:e}={}){const t=new Map,n=new Set,r=e??(o=>{});return{run(o,s){const i=t.get(o);if(i!==void 0)return i;const a=s().catch(c=>{throw n.has(o)||(n.add(o),r(c)),J_(c)||t.delete(o),c});return t.set(o,a),a},clear(){t.clear(),n.clear()},size(){return t.size}}}var uo=Q_();function Sl(){uo.clear()}l.setApiOriginFailoverHook(()=>uo.clear());var yl=new WeakMap;function fo(e){return l.resolveExplicitApiBaseUrl(e)}function Z_(e,t){const n=new Error(`[Loader] appInit request failed: ${e} ${t}`);return n.status=e,n}function eb(){const e=new Error("[Loader] appInit skipped: empty auth token");return e.terminal=!0,e}async function tb(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}var po=new WeakMap;function ho(e,t){po.set(e,t)}function nb(e){return po.get(e)}function rb(e,t){return async({baseUrl:n})=>{const r=t(),o=r&&po.get(r)||e,s=fo(n);if(!s)throw new Error("[Loader] appInit requires baseUrl or REACT_APP_OPENAPI_BASE_URL");const i=new Headers({Accept:"application/json","Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}),a=await tb(o);if(o.getAuthToken&&!a)throw eb();a&&i.set("authorization",a);const c=await l.fetchWithApiOriginFailover("/app/v1/app_init",{method:"POST",headers:i,body:new URLSearchParams,credentials:"same-origin"},s,{attemptTimeout:br(o)||void 0});if(!c.ok)throw Z_(c.status,c.statusText);return await c.json()}}function ob(e){return JSON.stringify({baseUrl:fo(e.baseUrl)||"",project:e.project??"",userId:e.user?.id??""})}function sb(e){return e.appInit?!0:!(e.jwtAuth&&!e.getAuthToken)}function ib(e){return t=>uo.run(ob(t),()=>(te("appInit:start",{kind:"network"}),Promise.resolve(e(t)).finally(()=>te("appInit:end",{kind:"network"}))))}function ab(e,t){if(ht(e)||!e.appInit&&!fo(e.baseUrl)||!sb(e))return e;const n=e.appInit??rb(e,t);let r=yl.get(n);return r||(r=ib(n),yl.set(n,r)),{...e,appInit:r}}var wl=0;function lb(){return wl}function cb(){wl+=1,Sl()}var Il=new WeakMap,Tl=new WeakMap,db=3e4;function ub(e,t){return JSON.stringify({userId:e?.id??"",project:t??""})}function fb(e,t){try{const n=l.decodeJwt(e)?.exp;if(typeof n=="number"&&Number.isFinite(n)&&n>0)return n*1e3}catch{}return t+db}function pb(e){const t=new Map,n=new Map;return async(r,o,s)=>{const i=ub(r,o);if(s)return n.delete(i),t.delete(i),Sl(),e(r,o,s);const a=n.get(i);if(a&&!t.has(i)){if(a.expiresAtMs>Date.now())return a.token;n.delete(i)}let c=t.get(i);return c===void 0&&(te("authToken:start",{kind:"network"}),c=Promise.resolve(e(r,o,s)).then(d=>{const u=String(d||"").trim();return u&&n.set(i,{token:d,expiresAtMs:fb(u,Date.now())}),d}).finally(()=>{te("authToken:end",{kind:"network"}),t.delete(i)}),t.set(i,c)),c}}function hb(e){if(ht(e))return e;const t=e.getAuthToken;if(!t)return e;let n=Il.get(t);const r=lb();return(!n||Tl.get(t)!==r)&&(n=pb(t),Il.set(t,n),Tl.set(t,r)),Promise.resolve(n(e.user,e.project,void 0)).catch(o=>{}),{...e,getAuthToken:n}}var mb="[emailmaker] This editor was destroyed: a later init()/create() into the same element failed to start, and the editor could not be handed back. Call init() again; the reason is in `cause`.";function gb(e){const t=new Error(mb,{cause:e});return t.name="EditorStartFailedError",t}var vb={getConfig:"await `ready` first",use:"use `useAsync()` or await `ready` first"};function Cl(e){return new Error(`[emailmaker] \`${e}\` is not available on this editor`)}var Al=["handleLoad","handleDestroy"];function Dl(e,t){let n=e;for(const r of Al){const o=e?.[r];typeof o=="function"&&(n={...n,[r]:(s,...i)=>o(t,...i)})}return n}function Eb(e){let t,n="pending",r,o,s,i;const a=new Set,c=[],d=new Set;let u,p;const m=new Promise((y,B)=>{u=y,p=B});m.catch(()=>{});const h={},_=y=>t?.[y],S=()=>r??we(),v=(y,B)=>{const U=_(y);if(typeof U!="function")throw Cl(y);return U.apply(t,B)},b=(y,B)=>{try{return Promise.resolve(v(y,B))}catch(U){return Promise.reject(U)}},D=()=>{const y=t?.container?.getInstance?.(l.DISPOSABLE_ID);if(!(n!=="ready"||y?.isDisposed()||typeof _("getConfig")!="function"))try{i=v("getConfig",[])}catch{}},j=()=>n==="dead"?Promise.reject(S()):n==="ready"?Promise.resolve():m,x=()=>{for(const[y,B]of vn)B==="field"&&(h[y]=_(y))},C=y=>{const B=_(y.name);y.dispose||typeof B!="function"||n==="dead"||(y.dispose=B.apply(t,y.args))},I=()=>a.forEach(C),R=()=>{for(const y of a){try{y.dispose?.()}catch{}y.dispose=void 0}},A=()=>{x(),I()},O=()=>{s?.delete(A),s=void 0},L=(y,B)=>{const[U,...W]=B;return!Al.includes(y)||typeof U!="function"?B:[(ie,...re)=>U(h,...re),...W]},w=(y,B)=>{if(n==="dead")return()=>{};if(n==="ready"&&typeof _(y)!="function")throw Cl(y);const U={name:y,args:L(y,B)};return a.add(U),C(U),()=>{a.delete(U),U.dispose?.(),U.dispose=void 0}},P=()=>t?.container?.getInstance(l.OPTIONS_SOURCE_ID)?.get()?.content,k=()=>{const y=e.element();return y!==void 0&&typeof y!="string"?y:void 0},F=(y,B)=>{switch(B){case"event":return(...U)=>w(y,U);case"async":return(...U)=>(y==="show"&&U[0]!==void 0&&e.shown?.(U[0]),n!=="dead"&&typeof _(y)=="function"?b(y,U):j().then(()=>v(y,U)));case"queued":return(...U)=>{if(n==="dead"){if(y==="notify")return;throw S()}if(n==="pending"){c.push({name:y,args:U});return}return v(y,U)};case"sync":return(...U)=>{if(n==="dead"){if(y==="getConfig")return i;throw S()}if(typeof _(y)!="function")throw new Error(`[emailmaker] \`${y}\` is not available before the editor is ready: ${vb[y]??"await `ready` first"}`);const W=v(y,U);return y==="getConfig"&&(i=W),W};case"element":return()=>{if(typeof _(y)!="function")return k();try{return v(y,[])}catch{return k()}};case"codeErrors":return()=>n==="ready"&&typeof _(y)=="function"?v(y,[]):[];case"field":return}};for(const[y,B]of vn)h[y]=F(y,B);h.reset=y=>(y?.content!==void 0&&e.shown?.(y.content),j().then(async()=>{const B=y?.content!==void 0&&l.deepEqual(y.content,P());await v("reset",[Dl(y,E)]),B&&await v("show",[y.content])}).then(()=>h)),h.destroy=()=>{if(n==="dead")return;const y=l.createAbortError("[emailmaker] editor was destroyed before it was ready");o?.catch(()=>{}),d.forEach(B=>B(y)),D(),e.destroy()},Object.defineProperty(h,"ready",{get:()=>o,enumerable:!0,configurable:!0});const E=h;return{object:E,get state(){return n},get editor(){return t},bind:y=>{n==="dead"||t===y||(R(),O(),t=y,x(),I(),n==="pending"&&(s=y.container.getOrCreateInstance(l.LATE_SURFACE_LISTENERS_ID,()=>new Set),s.add(A)))},settle:()=>{if(n==="pending"){n="ready",O(),x(),I();for(const y of c.splice(0))try{v(y.name,y.args)}catch(B){queueMicrotask(()=>{throw B})}u()}},kill:(y,B)=>{n!=="dead"&&(D(),n="dead",r=y,c.length=0,d.forEach(U=>U(y)),O(),B?.keepSubscriptions||(R(),a.clear()),p(y))},detach:()=>{R(),a.clear()},setReady:y=>{o=y},trackCall:y=>(d.add(y),()=>d.delete(y)),hasCalls:()=>d.size>0}}var mo="Editor mount element was removed from the document. Call instance.destroy() on host unmount.";function _b(){return l.createAbortError(mo)}function Pl(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===mo}function bb(e,t,n){if(typeof document>"u")return;let r=!1,o;const s=()=>{r=!0,o?.disconnect(),o=void 0},i=()=>{r||(s(),t())};if(n.addDispose(s),!e.isConnected){queueMicrotask(i);return}o=new MutationObserver(()=>{e.isConnected||i()});let a=e.parentNode;for(;a;)o.observe(a,{childList:!0}),a=a.parentNode}function Sb(e){const{hostElementOption:t,resolvedElement:n,externalSignal:r,disposable:o}=e;if(t===void 0||!(n instanceof Element))return r;const s=new AbortController;return bb(n,()=>{n.id,s.abort(_b())},o),l.composeAbortSignals(r,s.signal)}var go="Superseded by newer init() on the same mount element";function Ol(){return l.createAbortError(go)}function Rl(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===go}var Dt=new Map,kl=new WeakMap,bn=new WeakMap;function yb(e){if(e instanceof Element){const t=e.id?.trim();if(t)return`#${t}`}}function wb(e,{supersede:t=!1}={}){if(!e)return{previous:Promise.resolve(),release:()=>{}};const n=yb(e);(n?Dt.get(n):void 0)?.forEach(u=>{u.element!==e&&u.controller.abort(Ol())});const r=kl.get(e)??new Set;t&&r.forEach(u=>{u.supersedable&&u.controller.abort(Ol())});const o=bn.get(e)??Promise.resolve();let s;const i=new Promise(u=>{s=u}),a=o.then(()=>i);bn.set(e,a),a.then(()=>{bn.get(e)===a&&bn.delete(e)});const c=new AbortController,d={element:e,controller:c,supersedable:t};if(r.add(d),kl.set(e,r),n){const u=Dt.get(n)??new Set;u.add(d),Dt.set(n,u)}return{signal:c.signal,previous:o,release:()=>{s(),r.delete(d);const u=n?Dt.get(n):void 0;n&&u?.delete(d)&&u.size===0&&Dt.delete(n)}}}var Pt=new WeakMap;function vo(e,t){return typeof t=="function"&&(/^(handle|on)[A-Z]/.test(e)||e==="getAuthToken")}function Eo(e){return Object.entries(e).filter(([t,n])=>vo(t,n)).map(([t])=>t).sort()}function Nl(e){const t={};for(const[n,r]of Object.entries(e))n!=="signal"&&!vo(n,r)&&(t[n]=r);return t}function _o(e,t,{fresh:n=!1}={}){if(!e)return t;let r=n?void 0:Pt.get(e);r||(r={current:new Map,trampolines:new Map,lastOptions:t},Pt.set(e,r));const{current:o,trampolines:s}=r;o.clear();const i={...t};for(const a of Eo(t)){o.set(a,t[a]);let c=s.get(a);c||(c=(...d)=>o.get(a)?.(...d),s.set(a,c)),i[a]=c}return r.lastOptions=t,i}function Ll(e,t){const n=e?Pt.get(e):void 0;if(n)for(const r of n.trampolines.keys()){const o=t[r];vo(r,o)?n.current.set(r,o):n.current.delete(r)}}function Ib(e){const t=e?Pt.get(e):void 0;if(!t)return()=>{};const n=new Map(t.current),{lastOptions:r}=t;return()=>{t.current.clear(),n.forEach((o,s)=>t.current.set(s,o)),t.lastOptions=r}}function Tb(e,t,n){const r=e?Pt.get(e):void 0;if(!r||!n)return!1;const o=Eo(t),s=l.deepEqual(o,Eo(r.lastOptions)),i=o.every(a=>a==="getAuthToken"||n[a]===r.trampolines.get(a));return!s||!i||!l.deepEqual(Nl(t),Nl(r.lastOptions))?!1:(_o(e,t),!0)}var _e=new WeakMap,NS=0;function Sn(e){let t=_e.get(e);return t||(t={counted:new Set,leaving:new Set,order:[],options:new Map,latestCall:0,warned:!1},_e.set(e,t)),t}var Ce=e=>e!==void 0&&e.state!=="dead";function Cb(e){const t=_e.get(e)?.shared;return Ce(t)?t:void 0}function Ab(e,t){Sn(e).shared=t}function Db(e,t){!(Ce(e.shared)&&[...e.counted].some(Ce))||e.warned||!t.devTools||(e.warned=!0)}function Pb(e,t,n,r){const o=Sn(e);return o.latestCall+=1,o.releaseTimer!==void 0&&(clearTimeout(o.releaseTimer),o.releaseTimer=void 0),o.leaving.forEach(s=>s.detach()),o.leaving.clear(),n==="single"?o.shared=t:o.counted.add(t),o.options.set(t,r),o.order=[...o.order.filter(s=>s!==t&&Ce(s)),t],Db(o,r),o.latestCall}function Ob(e,t){return _e.get(e)?.latestCall===t}function Rb(e){const t=_e.get(e);if(t)return t.order=t.order.filter(Ce),t.order.at(-1)?.object}function Ot(e,t){const n=_e.get(e);return n?Ce(n.shared)&&n.shared!==t||[...n.counted].some(r=>r!==t&&Ce(r)):!1}function kb(e,t){const n=_e.get(e),r=n?.order.filter(o=>o!==t&&Ce(o)).at(-1);return r?n?.options.get(r):void 0}function Ml(e,t){Sn(e).content={value:t}}function Nb(e){return _e.get(e)?.content}function Lb(e,t,n,r){const o=Sn(e);if(o.counted.delete(t),o.options.delete(t),Ot(e)){t.kill(n);return}t.kill(n,{keepSubscriptions:!0}),o.leaving.add(t),xl(e,r)}function xl(e,t){const n=_e.get(e);!n||Ot(e)||n.releaseTimer!==void 0||(n.releaseTimer=setTimeout(()=>{n.releaseTimer=void 0,!Ot(e)&&(t(),n.leaving.forEach(r=>r.detach()),n.leaving.clear())},0))}function Mb(e,t){const n=_e.get(e);if(n){n.releaseTimer!==void 0&&clearTimeout(n.releaseTimer);for(const r of[n.shared,...n.counted,...n.leaving])r?.kill(t);_e.delete(e)}}var xb=Tn.__exportAll({FileManagerApiError:()=>Fb,IntegratorSaveTimeoutError:()=>Nt,SaveRefusedError:()=>De}),Fb=class Ul extends Error{code;status;details;get httpStatus(){return this.status}constructor(t,n,r,o){super(t),this.name="FileManagerApiError",this.code=n,this.status=r,this.details=o,Error.captureStackTrace&&Error.captureStackTrace(this,Ul)}},Bb=Tn.__exportAll({mapHttpStatusToErrorCode:()=>l.mapHttpStatusToErrorCode});function jb(e,t){return{...e,element:t}}function bo(){return()=>{}}function Ub(e){const t=e.element;return!t||typeof t=="string"||typeof document>"u"?bo():(Y_(t,e.config?.styles,t),()=>{q_(t)})}function $b(e){if(!bl()||e.initialSpinner===!1||typeof document>"u")return{options:e,cleanup:bo()};const t=e.element;if(!t||typeof t=="string")return{options:e,cleanup:bo()};t.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(o=>{o.remove()});const n=X_(t,"data-emailmaker"),r=e.handleChunkLoaded;return{options:{...e,handleChunkLoaded:()=>{n(),r?.()}},cleanup:n}}function Hb(e,t){if(e.appInit||!("appInit"in t))return t;const n={...t};return delete n.appInit,n}function yn(e){try{e.destroy()}catch{}}function wn(e,...t){const n=l.ELEMENT_MAP.get(e);t.some(r=>r!==void 0&&r===n)&&l.ELEMENT_MAP.delete(e)}var Vb="1.3.3";async function Gb(e){nr(),await _E(typeof __emailmaker__<"u"?__emailmaker__:void 0)}async function Wb(e){return Fl(e).ready}function Yb(e){if(typeof e!="string")return e??void 0;try{return document.querySelector(e)??void 0}catch{return}}function qb(e){const t=l.ELEMENT_MAP.get(e);return t&&!(t instanceof Promise)?t:void 0}function In(e,t,n){const r=t??qb(e);r&&(wn(e,r),yn(r)),Mb(e,n)}function Kb(e){const{control:t,mode:n,ref:r}=e,o=r.host;if(!o){const i=t.editor;zb(i),t.kill(we());return}if(n==="single"){In(o,t.editor,we());return}const s=kb(o,t);Lb(o,t,we(),()=>In(o,t.editor,we())),s&&Ot(o)&&Ll(o,s)}function zb(e){e&&yn(e)}function Fl(e){te(ce.initStart);const t=e.ownership==="counted"?"counted":"single",n=new AbortController,r=l.composeAbortSignals(e.signal,n.signal),o=t==="single"?Yb(e.element):void 0,s=o?Cb(o):void 0;let i;if(s)i={control:s,mode:t,ref:{host:o}};else{const u={},p=Eb({element:()=>u.host??e.element,destroy:()=>Kb(i),shown:m=>{u.host&&Ml(u.host,m)}});i={control:p,mode:t,ref:u},o&&Ab(o,p)}const{control:a}=i,c=a.trackCall(u=>n.abort(u)),d=tS(Dl({...e,signal:r},a.object),i).then(()=>(c(),te(ce.initEnd),a.settle(),a.object),u=>{c(),a.state==="pending"&&!a.hasCalls()&&a.kill(u);const p=i.ref.host;throw p&&xl(p,()=>In(p,void 0,we())),u});return a.setReady(d),a.object}function Xb(e){const t=typeof e=="string"?document.querySelector(e):e;return t?Rb(t):void 0}function Jb(e){let t,n,r=!1;try{t=e.container.getInstance(l.OPTIONS_SOURCE_ID)?.get(),n=e.container.getInstance(l.INIT_PIPELINE_ID)?.externalSignal;const o=Ve(e.container)?.current();r=o!==void 0&&o.get().savedVersion!==null&&o.isDirty()}catch{t=void 0}return{options:t,signal:n,email:Qb(e),dirty:r}}async function Qb(e){try{return await e.getEmailSnapshot()}catch{return}}function Zb(e){const t=Ve(e.container)?.current();t?.whenReady().then(()=>t.markUnsaved()).catch(()=>{})}function Bl(e,t){const{control:n,mode:r}=t;return r==="single"&&n.state==="ready"||Ot(e,n)}async function eS(e,t,n,r,o){if(r.mode==="counted"&&r.control.detach(),Rl(o)||Pl(o))return;const s=()=>In(t,e,gb(o)),{options:i}=n;if(!i||!Bl(t,r)){s();return}const a=await n.email,c=a&&(i.content!==void 0||a.id!==void 0)?a:void 0,d=typeof i.content=="object"&&"email"in i.content?i.content:void 0;try{await e.reset({...i,signal:i.signal??n.signal,content:c?{...d,email:c}:i.content}),n.dirty&&c&&Zb(e),Bl(t,r)?l.ELEMENT_MAP.set(t,e):s()}catch{s()}}async function tS(e,t){l.throwIfAborted(e.signal);const n=new l.Disposable;let r,o,s,i,a=0;try{const c=await l.waitForElement(e.element,n,e.signal);c&&(i=c,t.ref.host=c,a=Pb(c,t.control,t.mode,e));const d=Sb({hostElementOption:e.element,resolvedElement:c,externalSignal:e.signal,disposable:n}),u=wb(c,{supersede:t.mode==="single"});r=u.release;const p=l.composeAbortSignals(d,u.signal);l.throwIfAborted(p),s=Ib(c),Ll(c,e),await l.raceWithAbortSignal(u.previous,p),o=nS(e,c,t,p,s);const m=await l.raceWithAbortSignal(o,p);return c&&e.content!==void 0&&Ml(c,e.content),m}catch(c){throw i&&s&&Ob(i,a)&&s(),c}finally{const c=r;o!==void 0&&c?o.then(c,c):c?.(),n.dispose()}}async function jl(e,t,n,r){const o=Nb(t);n===void 0||r||!o||l.deepEqual(n,o.value)||await e.show(n)}async function nS(e,t,n,r,o){const{control:s}=n,i=S=>s.bind(S);l.throwIfAborted(r);let a;const c=S=>{cb();const v=hb(jb(S,t)),b=ab(v,()=>a);return{preparedOptions:b,preparedOptionsWithSignal:r!=null?{...b,signal:r}:b}};let d;if(t){const S=l.ELEMENT_MAP.get(t);if(S){let v;try{v=await S,l.throwIfAborted(r)}catch{l.throwIfAborted(r),wn(t,S),v=void 0}if(v)if(v.getElement()===t){const b=U_(t);a=b;const D=v.container.getInstance(l.OPTIONS_SOURCE_ID)?.get();if(Tb(t,e,D))return i(v),r&&v.container.getInstance(l.INIT_PIPELINE_ID)?.relinkExternalSignal(r),l.ELEMENT_MAP.set(t,v),await jl(v,t,e.content,!1),v;const j=!l.deepEqual(e.content,D?.content);d=c(_o(t,e));const{preparedOptions:x,preparedOptionsWithSignal:C}=d,I=b&&nb(b),R=Jb(v);try{b&&ho(b,x),i(v);const A=await v.reset(Hb(e,C));return l.throwIfAborted(r),l.ELEMENT_MAP.set(t,v),await jl(v,t,e.content,j),A}catch(A){if(b&&I&&ho(b,I),!uc(A))throw o(),await eS(v,t,R,n,A),A;wn(t,S,v),yn(v),l.throwIfAborted(r)}}else wn(t,S,v),yn(v)}}l.throwIfAborted(r),d??=c(_o(t,e,{fresh:!0}));const{preparedOptions:u}=d,p=Ub(u),m=$b(u),h=r!=null?{...m.options,signal:r}:m.options;let _;try{a=V_(h),$_(t,a),ho(a,u),Gr(a).set(h),await Xr(),te(ce.coreReady),l.throwIfAborted(r),l.throwIfAborted(r),_=j_(h,a,{onInstance:i}),t&&l.ELEMENT_MAP.set(t,_);const S=await _;if(r?.aborted&&(S.destroy(),l.throwIfAborted(r)),t)if(l.ELEMENT_MAP.get(t)===_)l.ELEMENT_MAP.set(t,S);else throw S.destroy(),l.throwIfAborted(r),l.createAbortError(r?.reason);return S}catch(S){throw p(),m.cleanup(),a&&(El(a),H_(t,a)),t&&_&&l.ELEMENT_MAP.get(t)===_&&l.ELEMENT_MAP.delete(t),S}}async function rS(e){return(await It()).parseAMP(e)}typeof window<"u"&&(rt()&&cc(),SE(typeof __emailmaker__<"u"?__emailmaker__:void 0)),he.ELEMENT_DETACHED_ABORT_MESSAGE=mo,he.SUPERSEDED_INIT_ABORT_MESSAGE=go,he.create=Fl,Object.defineProperty(he,"errors",{enumerable:!0,get:function(){return xb}}),he.getInstance=Xb,Object.defineProperty(he,"helpers",{enumerable:!0,get:function(){return Bb}}),he.init=Wb,he.isElementDetachedError=Pl,he.isSupersededInitError=Rl,he.parseAMP=rS,he.pluginRegistry=rl,he.preload=Gb,he.version=Vb});
2183
2183
 
2184
2184
 
2185
2185
  // Возвращаем API из entry модуля
2186
2186
  return __emailmaker__.syncRequire("emailmaker.js");
2187
2187
  });
2188
2188
 
2189
- __emailmaker__.require.config({"graph":{"core":["__delivery__/libs"],"static/core/15ea858c.js":[],"static/core/1922419a.js":[],"static/core/253d6f68.js":["static/core/d0d2525d.js","__delivery__/libs"],"static/core/32a14159.js":[],"static/core/370f04c3.js":[],"static/core/3a876cdd.js":[],"static/core/40574d12.js":[],"static/core/43a8b244.js":[],"static/core/4797d4f7.js":[],"static/core/4f63baad.js":["static/core/370f04c3.js","__delivery__/libs","monaco"],"static/core/4fef179c.js":["static/core/85accd9c.js"],"static/core/5e13bbc1.js":["static/core/3a876cdd.js"],"static/core/6319e32c.js":[],"static/core/66a5de32.js":[],"static/core/6933d533.js":[],"static/core/69842511.js":["static/core/d0d2525d.js","static/core/253d6f68.js","static/core/aea50cd5.js","static/core/cd715a88.js","__delivery__/libs"],"static/core/7452d34b.js":[],"static/core/76d1f317.js":[],"static/core/7a9faff8.js":[],"static/core/85accd9c.js":[],"static/core/86e5503b.js":["static/core/d0d2525d.js","static/core/e6f6edff.js","__delivery__/libs"],"static/core/89fb48c9.js":[],"static/core/8a5b1c18.js":[],"static/core/8bf56b5b.js":[],"static/core/8fdd9471.js":["static/core/85accd9c.js"],"static/core/9f6b8cdd.js":[],"static/core/9f7f5230.js":["static/core/e6f6edff.js"],"static/core/a6518f19.js":[],"static/core/a8cb6e27.js":[],"static/core/a9d62c49.js":[],"static/core/aea50cd5.js":["static/core/d0d2525d.js","__delivery__/libs"],"static/core/bb58b8a1.js":["static/core/c266ad76.js","__delivery__/libs"],"static/core/c266ad76.js":["__delivery__/libs"],"static/core/cd715a88.js":["static/core/bb58b8a1.js","__delivery__/libs"],"static/core/d0b845c8.js":[],"static/core/d0d2525d.js":["static/core/a8cb6e27.js","static/core/e6f6edff.js","__delivery__/libs"],"static/core/d402573d.js":["static/core/3a876cdd.js","static/core/85accd9c.js","static/core/4fef179c.js"],"static/core/e2694475.js":["static/core/253d6f68.js","static/core/bb58b8a1.js","__delivery__/libs","static/core/d0d2525d.js"],"static/core/e6f6edff.js":[],"static/core/e8edbf21.js":["static/core/c266ad76.js","__delivery__/libs"],"static/core/f85176c7.js":[],"static/core/fa6f5198.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"],"emailmaker.js":[],"static/umd/17c59c44.js":[],"static/umd/3f12d6ff.js":["static/umd/790cf6cb.js"],"static/umd/790cf6cb.js":[],"static/umd/b3ebeaee.js":[]},"bundles":{"static/core/bb58b8a1.js":["static/core/bb03ea6d.js","static/core/29af64b8.js","static/core/bc15a359.js"],"static/core/5e13bbc1.js":["static/core/a54d9b28.js"],"static/core/86e5503b.js":["static/core/be880f91.js"],"static/core/cd715a88.js":["static/core/61378c9e.js"],"static/core/e2694475.js":["static/core/66a13e30.js"],"core":["static/core/5dc34752.js","static/core/ee980948.js","static/core/5c3dd765.js","static/core/21b044e5.js","static/core/f6b71452.js"]}});
2189
+ __emailmaker__.require.config({"graph":{"core":["__delivery__/libs"],"static/core/0c2b284d.js":["__delivery__/libs"],"static/core/15ea858c.js":[],"static/core/1708db7c.js":[],"static/core/1922419a.js":[],"static/core/1c5fcd3e.js":[],"static/core/1d705ef4.js":[],"static/core/2f2b6a03.js":["static/core/c16f27f8.js","static/core/a4d994c7.js","__delivery__/libs","static/core/e123b734.js"],"static/core/32a14159.js":[],"static/core/370f04c3.js":[],"static/core/43a8b244.js":[],"static/core/44ad0bec.js":[],"static/core/462ebf44.js":[],"static/core/4797d4f7.js":[],"static/core/5b124cab.js":["static/core/e123b734.js","__delivery__/libs"],"static/core/5c396b20.js":["static/core/64c240c3.js"],"static/core/64c240c3.js":[],"static/core/6933d533.js":[],"static/core/6dfc3524.js":["static/core/9c4c7364.js","static/core/64c240c3.js","static/core/762d0d48.js"],"static/core/7452d34b.js":[],"static/core/762d0d48.js":["static/core/64c240c3.js"],"static/core/76d1e927.js":[],"static/core/76d1f317.js":[],"static/core/7c519fb4.js":["static/core/9c4c7364.js"],"static/core/8608a2b9.js":["static/core/e123b734.js","static/core/c16f27f8.js","static/core/5b124cab.js","static/core/892bb74e.js","__delivery__/libs"],"static/core/892bb74e.js":["static/core/a4d994c7.js","__delivery__/libs"],"static/core/8a5b1c18.js":[],"static/core/8bf56b5b.js":[],"static/core/9c4c7364.js":[],"static/core/9f7f5230.js":["static/core/e6f6edff.js"],"static/core/a30b0fae.js":["static/core/e123b734.js","static/core/e6f6edff.js","__delivery__/libs"],"static/core/a4d994c7.js":["static/core/0c2b284d.js","__delivery__/libs"],"static/core/a8cb6e27.js":[],"static/core/aa75c19b.js":["static/core/0c2b284d.js","__delivery__/libs"],"static/core/b0c57adf.js":[],"static/core/b9f59067.js":[],"static/core/c16f27f8.js":["static/core/e123b734.js","__delivery__/libs"],"static/core/cd998f60.js":["static/core/370f04c3.js","__delivery__/libs","monaco"],"static/core/d0b845c8.js":[],"static/core/e123b734.js":["static/core/a8cb6e27.js","static/core/e6f6edff.js","__delivery__/libs"],"static/core/e6f6edff.js":[],"static/core/e70683db.js":[],"static/core/ec552634.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"],"emailmaker.js":[],"static/umd/17c59c44.js":[],"static/umd/3f12d6ff.js":["static/umd/790cf6cb.js"],"static/umd/790cf6cb.js":[],"static/umd/b3ebeaee.js":[]},"bundles":{"static/core/a4d994c7.js":["static/core/66cfac3d.js","static/core/86f3e5f8.js","static/core/a6f666b3.js"],"static/core/7c519fb4.js":["static/core/a54d9b28.js"],"static/core/a30b0fae.js":["static/core/be880f91.js"],"static/core/892bb74e.js":["static/core/61378c9e.js"],"static/core/2f2b6a03.js":["static/core/2ffe45f5.js"],"core":["static/core/5dc34752.js","static/core/ee980948.js","static/core/dd7229b2.js","static/core/b0a1816d.js","static/core/52afb633.js"]}});