useblocks 1.1.102 → 1.1.104
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/README.md +1 -0
- package/iframe/.vite/manifest.json +4 -4
- package/iframe/css/sandbox.css +2 -1
- package/iframe/{iframe-eblock.1c4e77a0.html → iframe-eblock.a1be77d6.html} +2 -2
- package/iframe/{iframe.1c4e77a0.html → iframe.a1be77d6.html} +2 -2
- package/iframe/js/discussHandlers.CcQmhTtJ.js +88 -0
- package/iframe/js/{iframe-eblock.body.1c4e77a0.js → iframe-eblock.body.a1be77d6.js} +1 -1
- package/iframe/js/iframe-eblock.js +2 -2
- package/iframe/js/{iframe.body.1c4e77a0.js → iframe.body.a1be77d6.js} +71 -71
- package/iframe/js/iframe.js +2 -2
- package/package.json +1 -1
- package/runtime/react/index.js +1 -1
- package/static/core/{64be048b.js → 1c7109ca.js} +1 -1
- package/static/core/{6a671446.js → 2929f344.js} +1 -1
- package/static/core/{847338a8.js → 319ebaa7.js} +1 -1
- package/static/core/394d0d8b.js +28 -0
- package/static/core/{448f03f8.js → 3acb2fc4.js} +1 -1
- package/static/core/{ca4dad9b.js → 3cacdac0.js} +3 -3
- package/static/core/{ae22b7f6.js → 3fbfc93f.js} +1 -1
- package/static/core/{5d849eef.js → 485d0f3d.js} +1 -1
- package/static/core/{d7666ad0.js → 559147cb.js} +1 -1
- package/static/core/{b7aa9fec.js → 5d8f3441.js} +1 -1
- package/static/core/{1b68c0f0.js → 5d9ff4d5.js} +1 -1
- package/static/core/{b653f9c5.js → 727176a9.js} +1 -1
- package/static/core/{3fb172c7.js → 73d6d76e.js} +1 -1
- package/static/core/89044032.js +7 -0
- package/static/core/{91e07171.js → 8aef9403.js} +1 -1
- package/static/core/{53103851.js → 8f653f65.js} +2 -2
- package/static/core/{3ec42945.js → a11fe298.js} +1 -1
- package/static/core/{11b821ed.js → b17bcc2f.js} +1 -1
- package/static/core/{44d2c046.js → beafdd63.js} +1 -1
- package/static/core/{26cc947d.js → c7ba829b.js} +1 -1
- package/static/core/{cc180859.js → cbde9d66.js} +1 -1
- package/static/core/{a98b6879.js → cf249009.js} +1 -1
- package/static/core/{f1ee2bef.js → cf79afe3.js} +1 -1
- package/static/core/{a2e57e5f.js → f422ba3d.js} +1 -1
- package/static/core/{f323e60e.js → f7fba0d2.js} +1 -1
- package/static/umd-runtime/{runtime.2paN090q.js → runtime.UD7TEOVN.js} +1 -1
- package/useblocks-core.a1be77d6.js +859 -0
- package/useblocks-esm.js +11 -11
- package/{useblocks-po.1c4e77a0.js → useblocks-po.a1be77d6.js} +1 -1
- package/useblocks.d.ts +38 -6
- package/useblocks.js +11 -11
- package/vendor/useblocks-ui-kit/package.json +1 -1
- package/iframe/js/discussHandlers.Xh4-JUcT.js +0 -88
- package/static/core/5e7c221f.js +0 -28
- package/static/core/edf450a1.js +0 -7
- package/useblocks-core.1c4e77a0.js +0 -859
package/useblocks.js
CHANGED
|
@@ -1014,7 +1014,7 @@ var __amdEnv = window.__useblocks__ || (window.__useblocks__ = {});
|
|
|
1014
1014
|
|
|
1015
1015
|
|
|
1016
1016
|
// Configure AMD loader
|
|
1017
|
-
__amdEnv.require.config({ baseUrl: "./", paths: {"core":"useblocks-core.
|
|
1017
|
+
__amdEnv.require.config({ baseUrl: "./", paths: {"core":"useblocks-core.a1be77d6.js","monaco":"static/monaco/index.CO7s5UdA.js","po":"useblocks-po.a1be77d6.js","static/umd-runtime/delivery-libs.js":"static/umd-runtime/delivery-libs.3Svr0avG.js","static/umd-runtime/runtime.js":"static/umd-runtime/runtime.UD7TEOVN.js","static/umd-runtime/ui-kit-icons.js":"static/umd-runtime/ui-kit-icons.DqlZwgBU.js","static/umd-runtime/ui-kit.js":"static/umd-runtime/ui-kit.CoVNet0I.js"} });
|
|
1018
1018
|
|
|
1019
1019
|
// PublicPath (script detection: entry script lookup → document.currentScript)
|
|
1020
1020
|
if (!__useblocks__.publicPath) {
|
|
@@ -1362,7 +1362,7 @@ if (!ns.assetUrl) {
|
|
|
1362
1362
|
}
|
|
1363
1363
|
|
|
1364
1364
|
if (!ns.version) {
|
|
1365
|
-
ns.version = "1.1.
|
|
1365
|
+
ns.version = "1.1.104";
|
|
1366
1366
|
}
|
|
1367
1367
|
|
|
1368
1368
|
var modules = ns.modules = Object.create(null);
|
|
@@ -2099,14 +2099,14 @@ __useblocks__.define("static/umd/e8914784.js",["require","exports","module"],fun
|
|
|
2099
2099
|
__useblocks__.define("static/umd/d786efbb.js",["require","exports","module"],function(f,l,m){var v=(function(){const e=typeof document<"u"&&document.createElement("link").relList;return e&&e.supports&&e.supports("modulepreload")?"modulepreload":"preload"})(),k=function(n,e){return new URL(n,e).href},h={},c=function(e,E,P){let p=Promise.resolve();if(0)var R,w;function i(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return p.then(r=>{for(const t of r||[])t.status==="rejected"&&i(t.reason);return e().catch(i)})};Object.defineProperty(l,"__vitePreload",{enumerable:!0,get:function(){return c}})});
|
|
2100
2100
|
|
|
2101
2101
|
|
|
2102
|
-
__useblocks__.define("useblocks.js",["require","exports","module","static/umd/b11043e6.js","static/umd/e8914784.js","static/umd/d786efbb.js"],function(Et,ne,Xv){Object.defineProperties(ne,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const Kt=Et("./static/umd/b11043e6.js"),l=Et("./static/umd/e8914784.js"),Pa=Et("./static/umd/d786efbb.js");var Ra=new Function("url","return import(url)");function Oa(e){if(typeof e!="function")return!1;try{return Reflect.construct(String,[],e),!0}catch{return!1}}function Xt(e){return typeof e=="object"&&e!==null&&"type"in e&&"url"in e}function Br(e){return e.type==="umd"||e.resolve==="registry"}var Ma="If the plugin is built on globals, enable the compatibility layer: the `compatGlobals` option of the bundler plugin or `import '<package>/compat-globals'` before creating the editor.";function La(e){const t=Array.isArray(e)?e[0]:e;return Xt(t)?t.name??t.url:typeof t=="function"?t.name||"anonymous plugin":String(t)}function Na(e,t){const n=La(e),r=Xt(e)?e:void 0,s=t instanceof Error?t.message:String(t),o=r&&Br(r)&&!/compat/iu.test(s)?` ${Ma}`:"",i=new Error(`Plugin "${n}" was skipped: it failed to load. ${s}${o}`);return i.cause=t,{name:n,url:r?.url,error:i}}function xa(e){return!e.filename&&!e.error&&/^Script error\.?$/.test(e.message)}function Jv(e){return e}var ka=class{_context;_pluginRegistry;_options;_map=new Map;_optionsMap=new Map;_readyMap=new Map;_resolveMap=new Map;_initializingPlugins=new Map;_creatingPlugins=new Set;_initializedPlugins=new Set;_creationOrder=[];_lifecycleListeners=new Set;_activated=!1;constructor(e,t,n={}){this._context=e,this._pluginRegistry=t,this._options=n}activate(){return this._activated=!0,this._startPluginsBatch(Array.from(this._map.values()))}activateSync(){this._activated=!0,this._startPluginsBatch(Array.from(this._map.values()))}onLifecycle(e){return this._lifecycleListeners.add(e),{dispose:()=>this._lifecycleListeners.delete(e)}}_emitLifecycle(e){for(const t of Array.from(this._lifecycleListeners))try{t(e)}catch{}}async _resolveEntry(e){if(typeof e=="string"||typeof e=="symbol"){const t=await this._pluginRegistry.getAsync(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered.`);return{ctor:t}}if(typeof e=="function")return e.length===0?{ctor:await e()}:{ctor:e};if(Array.isArray(e)){const[t,n]=e;if(typeof t=="function")return{ctor:t,options:n};const r=await this._pluginRegistry.getAsync(t);if(!r)throw new Error(`Plugin "${String(t)}" not registered.`);return{ctor:r,options:n}}if(Xt(e))return this._resolveDescriptor(e);throw new Error(`Unknown plugin entry format: ${JSON.stringify(e)}`)}async _resolveDescriptor(e){const t=e.resolve??(e.type==="umd"?"window":"module");if(Br(e)&&await this._options.ensureHostRuntimeReady?.(e),e.type==="esm"){const n=await Ra(e.url);if(t==="module")return{ctor:n.default??n};if(t==="registry"&&e.name){const r=await this._pluginRegistry.getAsync(e.name);if(!r)throw new Error(`Plugin "${e.name}" not found in registry after ESM load`);return{ctor:r}}}if(e.type==="umd"){if(await this._loadScript(e.url),t==="window"&&e.name){const n=globalThis[e.name];if(!n)throw new Error(`Plugin "${e.name}" not found on window after script load`);return{ctor:n}}if(t==="registry"&&e.name){const n=await this._pluginRegistry.getAsync(e.name);if(!n)throw new Error(`Plugin "${e.name}" not found in registry after script load`);return{ctor:n}}}throw new Error(`Cannot resolve descriptor: type=${e.type}, resolve=${t}, name=${e.name??"none"}`)}_loadScript(e){return new Promise((t,n)=>{if(typeof document>"u"){n(new Error("Cannot load UMD script in non-browser environment"));return}const r=document.createElement("script");r.src=e,this._options.explainScriptFailure?.();let s;const o=a=>{s||(a.filename===r.src?s=this._scriptExecutionError(e,a.error??a.message):xa(a)&&(s=this._scriptExecutionError(e,this._options.explainScriptFailure?.()??a.message)))},i=()=>window.removeEventListener("error",o);window.addEventListener("error",o),r.onload=()=>{if(i(),s){n(s);return}t()},r.onerror=()=>{i(),n(new Error(`Failed to load script: ${e}`))},document.head.appendChild(r)})}_scriptExecutionError(e,t){const n=t instanceof Error?t.message:String(t),r=new Error(`Plugin script "${e}" threw while executing: ${n}`);return r.cause=t,r}initSync(e){const t=[];for(const n of e){const r=this._createOrSkip(n,void 0);r&&t.push(r)}this._activated=!0,this._startPluginsBatch(t)}async init(e){const t=[],n=new Set;for(const r of e){const s=await this._resolveOrSkip(r);if(!s)continue;const o=this._createOrSkip(s.ctor,s.options);o&&!n.has(o)&&(n.add(o),t.push(o))}this._activated=!0,await this._startPluginsBatch(t)}async setPlugins(e){const t=new Set,n=[];for(const i of e){const a=await this._resolveOrSkip(i);a&&(t.add(a.ctor),n.push(a))}const r=[];this._map.forEach((i,a)=>{t.has(a)||r.push({key:a,plugin:i})});for(let i=r.length-1;i>=0;i--){const{key:a,plugin:c}=r[i];await this._initializingPlugins.get(c),await this._disposePlugin(c,c.constructor.name),this._map.delete(a),this._optionsMap.delete(a),this._readyMap.delete(c),this._resolveMap.delete(c),this._initializingPlugins.delete(c),this._initializedPlugins.delete(c);const d=this._creationOrder.indexOf(c);d>=0&&this._creationOrder.splice(d,1)}const s=[],o=new Set;for(const{ctor:i,options:a}of n){const c=this._createOrSkip(i,a);c&&!o.has(c)&&(o.add(c),s.push(c))}this._activated&&await this._startPluginsBatch(s)}isReady(e){return this._initializedPlugins.has(e)}ready(e){return this._initializingPlugins.get(e)??this._readyMap.get(e)??Promise.resolve()}async waitFor(e,t){if(this._pluginRegistry.has(e))return this.useByKeyAsync(e);const{timeout:n}=t??{};return await new Promise((r,s)=>{let o,i=!1;const a=()=>{i||(i=!0,o&&clearTimeout(o),this._pluginRegistry.off(e,a),r())};this._pluginRegistry.on(e,a),n!==void 0&&n>0&&(o=setTimeout(()=>{i||(i=!0,this._pluginRegistry.off(e,a),s(new Error(`waitFor("${String(e)}") timed out after ${n}ms`)))},n))}),this.useByKeyAsync(e)}useByKey(e){const t=this._pluginRegistry.get(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered or not loaded yet. Use useByKeyAsync() for async plugins.`);const n=this._getOrCreate(t);return this._activated&&this._startPluginsBatch([n]),n}async useByKeyAsync(e){const t=await this._pluginRegistry.getAsync(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered.`);const n=this._getOrCreate(t);return this._activated&&await this._startPluginsBatch([n]),n}useByCtor(e,t){const n=this._getOrCreate(e,t);return this._activated&&this._startPluginsBatch([n]),n}use(e){return typeof e=="function"?this.useByCtor(e):this.useByKey(e)}async useAsync(e){const{ctor:t,options:n}=await this._resolveEntry(e),r=this._getOrCreate(t,n);return this._activated&&await this._startPluginsBatch([r]),r}_getOrCreate(e,t){const n=e;if(!this._map.has(n)){t!==void 0&&this._optionsMap.set(n,t);const r=this._optionsMap.get(n),s=this._createPluginInstance(e,r),o=s.constructor.name;this._emitLifecycle({type:"created",plugin:s,name:o}),s.required?.(),this._map.set(n,s),this._creationOrder.push(s),this._setupReadyPromise(s)}return this._map.get(n)}async _resolveOrSkip(e){try{return await this._resolveEntry(e)}catch(t){const n=Na(e,t);try{this._options.reportLoadFailure?.(n)}catch{}return}}_createOrSkip(e,t){try{return this._getOrCreate(e,t)}catch(n){const r=e.name||"anonymous plugin";this._emitLifecycle({type:"create:error",ctor:e,name:r,error:n});return}}_createPluginInstance(e,t){const n=e;if(this._creatingPlugins.has(n))throw new Error(`Cyclic dependency for plugin ${e.name}`);this._creatingPlugins.add(n);const r=this._options.openEarlyWindow?.();try{return Oa(e)?new e(this._context,t):e(this._context,t)||{}}finally{r?.(),this._creatingPlugins.delete(n)}}_setupReadyPromise(e){const t=new Promise(n=>{this._resolveMap.set(e,n)});this._readyMap.set(e,t)}async _startPluginsBatch(e){const t=Array.from(new Set(e)),n=new Set,r=[];for(const s of t){if(this._initializedPlugins.has(s))continue;const o=this._initializingPlugins.get(s);if(o){n.add(o);continue}r.push(s)}if(r.length>0){const s=this._runBatchLifecycle(r);for(const o of r)this._initializingPlugins.set(o,s);n.add(s),s.finally(()=>{for(const o of r)this._initializingPlugins.get(o)===s&&this._initializingPlugins.delete(o)})}await Promise.all(n)}async _runBatchLifecycle(e){const t=[];for(const n of e){const r=n.constructor.name;this._emitLifecycle({type:"init:start",plugin:n,name:r});const s=this._options.openEarlyWindow?.();try{await n.init?.(),this._emitLifecycle({type:"init:success",plugin:n,name:r}),t.push(n)}catch(o){this._emitLifecycle({type:"init:error",plugin:n,name:r,error:o})}finally{s?.()}}for(const n of t){const r=n.constructor.name;this._emitLifecycle({type:"afterInit:start",plugin:n,name:r});try{await n.afterInit?.(),this._emitLifecycle({type:"afterInit:success",plugin:n,name:r})}catch(s){this._emitLifecycle({type:"afterInit:error",plugin:n,name:r,error:s})}}for(const n of e)this._initializedPlugins.add(n),this._resolveMap.get(n)?.(),this._resolveMap.delete(n)}async _disposePlugin(e,t){this._emitLifecycle({type:"dispose:start",plugin:e,name:t});try{await e.dispose?.(),this._emitLifecycle({type:"dispose:success",plugin:e,name:t})}catch(n){this._emitLifecycle({type:"dispose:error",plugin:e,name:t,error:n})}}async dispose(){for(let e=this._creationOrder.length-1;e>=0;e--){const t=this._creationOrder[e];await this._initializingPlugins.get(t),await this._disposePlugin(t,t.constructor.name)}this._map.clear(),this._optionsMap.clear(),this._readyMap.clear(),this._resolveMap.clear(),this._initializingPlugins.clear(),this._initializedPlugins.clear(),this._creationOrder.length=0,this._lifecycleListeners.clear()}getStatus(){return Array.from(this._map.values()).map(e=>({name:e.constructor.name,initialized:this._initializedPlugins.has(e)}))}},Fa=class{_plugins=new Map;_listeners=new Map;_getOrCreateEntry(e){let t=this._plugins.get(e);return t||(t={overrides:[]},this._plugins.set(e,t)),t}_applyOverrides(e,t){const n=this._plugins.get(e);if(n?.overrides)for(const r of n.overrides)t=r(t)||t;return t}_notifyListeners(e,t){const n=this._listeners.get(e);if(!n||n.length===0)return;for(const s of n)try{s.callback(t)}catch{}const r=n.filter(s=>!s.once);r.length>0?this._listeners.set(e,r):this._listeners.delete(e)}get(e){const t=this._plugins.get(e);if(t?.ctor)return this._applyOverrides(e,t.ctor)}async getAsync(e){const t=this._plugins.get(e);if(t?.ctor)return this._applyOverrides(e,t.ctor);if(t?.loading){const n=await t.loading;return this._applyOverrides(e,n)}if(t?.factory){const n=Promise.resolve(t.factory()).then(s=>(t.ctor=s,t.loading=void 0,this._notifyListeners(e,s),s));t.loading=n;const r=await n;return this._applyOverrides(e,r)}return new Promise(n=>{this.on(e,r=>n(this._applyOverrides(e,r)))})}add(e,t){const n=this._getOrCreateEntry(e);n.ctor=t,this._notifyListeners(e,t)}addAll(e){for(const t of Object.keys(e)){const n=e[t];n!==void 0&&this.add(t,n)}}addAsync(e,t){const n=this._getOrCreateEntry(e);return n.factory=t,{dispose:()=>{n.ctor||(n.factory=void 0)}}}has(e){const t=this._plugins.get(e);return!!(t?.ctor||t?.factory)}isLoaded(e){return!!this._plugins.get(e)?.ctor}override(e,t){const n=this._getOrCreateEntry(e);return n.overrides.push(t),{dispose:()=>{const r=n.overrides.indexOf(t);r>=0&&n.overrides.splice(r,1)}}}on(e,t){const n=this.get(e);n&&t(n);let r=this._listeners.get(e);r||(r=[],this._listeners.set(e,r));const s={callback:t,once:!1};return r.push(s),{dispose:()=>this._removeListener(e,t)}}once(e,t){const n=this.get(e);if(n)return t(n),{dispose:()=>{}};let r=this._listeners.get(e);r||(r=[],this._listeners.set(e,r));const s={callback:t,once:!0};return r.push(s),{dispose:()=>this._removeListener(e,t)}}off(e,t){this._removeListener(e,t)}_removeListener(e,t){const n=this._listeners.get(e);if(n){const r=n.findIndex(s=>s.callback===t);r>=0&&n.splice(r,1),n.length===0&&this._listeners.delete(e)}}keys(){return Array.from(this._plugins.keys())}forContext(){const e=this;return{add(t,n){e.add(t,n)}}}},Ba=class{resolveRegistry;constructor(e){this.resolveRegistry=e}target(){return this.resolveRegistry()}get(e){return this.target().get(e)}getAsync(e){return this.target().getAsync(e)}add(e,t){return this.target().add(e,t)}addAll(e){return this.target().addAll(e)}addAsync(e,t){return this.target().addAsync(e,t)}has(e){return this.target().has(e)}isLoaded(e){return this.target().isLoaded(e)}override(e,t){return this.target().override(e,t)}on(e,t){return this.target().on(e,t)}once(e,t){return this.target().once(e,t)}off(e,t){return this.target().off(e,t)}keys(){return this.target().keys()}forContext(){return this.target().forContext()}},jr=class{capacity;items=[];constructor(e){this.capacity=e}push(e){this.items.length>=this.capacity&&this.items.shift(),this.items.push(e)}snapshot(){return this.items.slice()}size(){return this.items.length}clear(){this.items=[]}};function ja(e,t){return t+e}function Ua(){return typeof performance>"u"?Date.now():ja(performance.now(),performance.timeOrigin)}var Ha="emailmaker:diagnostics",$a="diagnostics",Va="diagnostics";function Ur(e,t){return t?`${e}${e.includes("?")?"&":"?"}${Va}=1`:e}var Jt;function Ga(){try{const e=new URLSearchParams(window.location.search).get($a);return e===null?void 0:e!=="0"}catch{return}}function Ya(){const e=window.__DIAGNOSTICS__;return typeof e=="boolean"?e:void 0}function Wa(){try{const e=window.localStorage.getItem(Ha);return e===null?void 0:e==="1"}catch{return}}function He(){return Jt===void 0&&(Jt=typeof window>"u"?!1:Ga()??Ya()??Wa()??!1),Jt}function qa(e){return`__${(e||"useblocks").toLowerCase().replaceAll("-","")}__`}var te={initStart:"loader:init:start",coreReady:"loader:core:ready",initEnd:"loader:init:end",chunksLoaded:"app:chunks:loaded",showStart:"show:start",showEnd:"show:end",canvasCreated:"canvas:created",canvasLoaded:"canvas:loaded",canvasPainted:"canvas:painted",appVisible:"app:visible",editorVisible:"editor:visible",canvasSettled:"canvas:settled"},Qv=Object.values(te),Zv=[te.canvasPainted,te.canvasSettled,te.appVisible,te.editorVisible],za=5e3,Ka=3e3,Hr="diagnosticsStore",vt,$e;function $r(){return{marks:new jr(za),resources:new jr(Ka)}}function Vr(){if($e)return $e;const e=Qt();return e?($e=e[Hr]??vt??$r(),e[Hr]=$e,vt=void 0,$e):(vt??=$r(),vt)}function W(e,t){He()&&Vr().marks.push({phase:e,at:Ua(),...t})}function Qt(){if(typeof __useblocks__<"u"&&__useblocks__)return __useblocks__;if(typeof window>"u")return;const e=window[qa()];return e!==null&&typeof e=="object"?e:void 0}function Xa(e){const t=e.length,n=Vr();return e.forEach(r=>n.marks.push(r)),e.length=0,t}function Ja(){const e=Qt();return!e||!Array.isArray(e.diagnosticsBuffer)?0:Xa(e.diagnosticsBuffer)}var Qa="Editor instance was destroyed and cannot be reused. A fresh instance will be created instead.";function me(){const e=new Error(Qa);return e.name="DestroyedInstanceError",e}function Za(e){return e instanceof Error&&e.name==="DestroyedInstanceError"}function Zt(e,t){if(e===t)return!0;if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const n=Array.isArray(e);if(n!==Array.isArray(t))return!1;if(n){const o=e,i=t;return o.length===i.length&&o.every((a,c)=>Zt(a,i[c]))}const r=Object.keys(e),s=Object.keys(t);return r.length!==s.length?!1:r.every(o=>Object.prototype.hasOwnProperty.call(t,o)&&Zt(e[o],t[o]))}function Gr(e,t){const n={watch(r){let s,o=!1;return e.watch(i=>{const a=t(i);o&&Zt(s,a)||(s=a,o=!0,r(a))})},select(r){return Gr(n,r)}};return n}function ce(...e){let t=e[0],n=e.length>0;const r=new Set,s={get(){return n?t:void 0},set(o){t=o,n=!0;for(const i of Array.from(r))i(o)},watch(o){return r.add(o),n&&o(t),{dispose:()=>r.delete(o)}},select(o){return Gr(s,o)}};return s}var el=class{http;constructor(e){this.http=e}app_init_create=(e,t={})=>this.http.request({path:"/app/v1/app_init",method:"POST",body:e,type:l.ContentType.UrlEncoded,...t})},Yr=class{http;constructor(e){this.http=e}get_translations2=({file:e,...t},n={})=>this.http.request({path:`/translations/v1/${e}`,method:"GET",...n});get_translations3=({id:e,file:t,...n},r={})=>this.http.request({path:`/translations/v1/${t}/${e}`,method:"GET",...r})};function tl(e){return String(e||"").trim()||void 0}var nl=class extends l.Disposable{deps;_app;_baseUrl;_appInit;_restBaseUrl;_prevApp;constructor(e){super(),this.deps=e,this.addDisposable(e.options.select(t=>this._slice(t)).watch(t=>this._start(t)))}get app(){return this._app}_slice(e){return Object.prototype.hasOwnProperty.call(e,"baseUrl")&&(this._baseUrl=tl(e.baseUrl)),Object.prototype.hasOwnProperty.call(e,"appInit")&&(this._appInit=e.appInit),{appInit:this._appInit,user:e.user,project:e.project,baseUrl:this._baseUrl,restBaseUrl:this.deps.resolveRestBaseUrl(this._baseUrl),standalone:this.deps.isStandalone()}}_start(e){if(this._restBaseUrl!==e.restBaseUrl&&(this._restBaseUrl=e.restBaseUrl,this.deps.setRestBaseUrl(e.restBaseUrl)),e.standalone)return;const t=e.appInit||this.deps.fallbackAppInit,n=Promise.resolve(t({baseUrl:e.baseUrl,user:e.user,project:e.project,prevApp:this._prevApp}));this._app=n,n.then(r=>{this._app===n&&(this._prevApp=r)},()=>{}),this.deps.publish(n)}},en=l.createIdentifier$1("AppInitService");function rl(e){return async()=>{const t=await e();return(await new el(t).app_init_create({})).data}}function sl(e){e.injectFactory(en,(t,n)=>{if(n)return n;const r=new nl({options:e.getInstance(l.OPTIONS_SOURCE_ID),isStandalone:()=>!!e.getInstance(l.SECURITY_MODULE_ID),resolveRestBaseUrl:s=>s?l.getActiveBaseUrl(s):l.getActiveBaseUrl()||void 0,setRestBaseUrl:s=>{e.getInstance(l.REST_CLIENT_FACTORY_ID)?.setOptions(s?{baseUrl:s}:{})},fallbackAppInit:rl(()=>e.getInstanceAsync(l.REST_TRANSPORT_ID)),publish:s=>{e.inject(l.APP_ID,s)}});return e.getInstance(l.DISPOSABLE_ID)?.addDisposable(r),r},!0)}var tn=l.createIdentifier$1("documentSession.emailDocuments");function Me(e){return e?.getInstance(tn)}var ol=l.createIdentifier$1("RevisionServiceFlag");function Wr(e){return e.getOrCreateInstance(ol,()=>{let t=!1;return{isEnabled:()=>t,set:n=>{t=n}}})}function qr(e){return Wr(e).isEnabled()}var il=l.createIdentifier$1("EmailRightsResolver");function al(e,t){const n=e.getInstance(il);return n?n(t):!0}var zr=l.createIdentifier$1("EmailHistoryAvailabilityResolver");function ll(e){return e.getInstance(zr)!==void 0}async function cl(e){const t=e.getInstance(zr);if(!t)return!0;try{return await t()}catch{return!1}}var nn={INIT_START:5e3,SET_ENTITY:12e3,PREHEADER:5e3,SUBJECT:5e3,INITED:5e3,UPDATE_ENTITY:5e3},Kr=["INIT_START","SET_ENTITY","PREHEADER","SUBJECT","INITED"],Xr=2e4,dl=Kr.reduce((e,t)=>e+nn[t],0),Jr=Xr+dl+3e3;function ul(e){return Kr.reduce((t,n)=>t+Qr(n,e),0)}function Qr(e,t){const n=t?.[e];return typeof n=="number"&&n>0?n:nn[e]}function Zr(e){const t=e?.contentReady;return typeof t=="number"&&t>0?t:Jr}function es(e){const t=e?.sandboxReady;return typeof t=="number"&&t>0?t:Xr}function rn(e=Jr){return e+3e3}var e_="[show-pipeline]";function ts(e){return e instanceof Error?`${e.name}: ${e.message}`:typeof e=="string"?e:JSON.stringify(e)??"undefined"}function t_(e,t){}var fl=()=>rn();function pl(e,t){let n;return Promise.race([e,new Promise(r=>{n=setTimeout(()=>{r()},t)})]).finally(()=>{n!==void 0&&clearTimeout(n)})}function hl(e){return t=>pl(e.getOrCreateInstance(l.events.BEFORE_SAVE_EMAIL,()=>new l.AsyncEmitter).fire(t),fl())}function ml(e){return e!=null&&e!==""}var ns;function Ve(e,t){return ns?.capture(e,t)}function gl(e,t){return ns?.captureMessage(e,t)}function El(e=""){let t=e;return{read:()=>t,write:n=>{t=n},dispose:()=>{t=""}}}function _t(e){return e.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var ae=class{oldPosition;oldText;newPosition;newText;get oldLength(){return this.oldText.length}get oldEnd(){return this.oldPosition+this.oldText.length}get newLength(){return this.newText.length}get newEnd(){return this.newPosition+this.newText.length}constructor(e,t,n,r){this.oldPosition=e,this.oldText=t,this.newPosition=n,this.newText=r}toString(){return this.oldText.length===0?`(insert@${this.oldPosition} "${_t(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${_t(this.oldText)}")`:`(replace@${this.oldPosition} "${_t(this.oldText)}" with "${_t(this.newText)}")`}};function rs(e,t){return e===null||e.length===0?t:new vl(e,t).compress()}var vl=class he{_prevEdits;_currEdits;_result;_resultLen;_prevLen;_prevDeltaOffset;_currLen;_currDeltaOffset;constructor(t,n){this._prevEdits=t,this._currEdits=n,this._result=[],this._resultLen=0,this._prevLen=this._prevEdits.length,this._prevDeltaOffset=0,this._currLen=this._currEdits.length,this._currDeltaOffset=0}compress(){let t=0,n=0,r=this._getPrev(t),s=this._getCurr(n);for(;t<this._prevLen||n<this._currLen;){if(r===null){if(s===null)break;this._acceptCurr(s),s=this._getCurr(++n);continue}if(s===null){this._acceptPrev(r),r=this._getPrev(++t);continue}if(s.oldEnd<=r.newPosition){this._acceptCurr(s),s=this._getCurr(++n);continue}if(r.newEnd<=s.oldPosition){this._acceptPrev(r),r=this._getPrev(++t);continue}if(s.oldPosition<r.newPosition){const[c,d]=he._splitCurr(s,r.newPosition-s.oldPosition);this._acceptCurr(c),s=d;continue}if(r.newPosition<s.oldPosition){const[c,d]=he._splitPrev(r,s.oldPosition-r.newPosition);this._acceptPrev(c),r=d;continue}let i,a;if(s.oldEnd===r.newEnd)i=r,a=s,r=this._getPrev(++t),s=this._getCurr(++n);else if(s.oldEnd<r.newEnd){const[c,d]=he._splitPrev(r,s.oldLength);i=c,a=s,r=d,s=this._getCurr(++n)}else{const[c,d]=he._splitCurr(s,r.newLength);i=r,a=c,r=this._getPrev(++t),s=d}this._result[this._resultLen++]=new ae(i.oldPosition,i.oldText,a.newPosition,a.newText),this._prevDeltaOffset+=i.newLength-i.oldLength,this._currDeltaOffset+=a.newLength-a.oldLength}const o=he._merge(this._result);return he._removeNoOps(o)}_acceptCurr(t){this._result[this._resultLen++]=he._rebaseCurr(this._prevDeltaOffset,t),this._currDeltaOffset+=t.newLength-t.oldLength}_getCurr(t){return t<this._currLen?this._currEdits[t]:null}_acceptPrev(t){this._result[this._resultLen++]=he._rebasePrev(this._currDeltaOffset,t),this._prevDeltaOffset+=t.newLength-t.oldLength}_getPrev(t){return t<this._prevLen?this._prevEdits[t]:null}static _rebaseCurr(t,n){return new ae(n.oldPosition-t,n.oldText,n.newPosition,n.newText)}static _rebasePrev(t,n){return new ae(n.oldPosition,n.oldText,n.newPosition+t,n.newText)}static _splitPrev(t,n){const r=t.newText.substr(0,n),s=t.newText.substr(n);return[new ae(t.oldPosition,t.oldText,t.newPosition,r),new ae(t.oldEnd,"",t.newPosition+n,s)]}static _splitCurr(t,n){const r=t.oldText.substr(0,n),s=t.oldText.substr(n);return[new ae(t.oldPosition,r,t.newPosition,t.newText),new ae(t.oldPosition+n,s,t.newEnd,"")]}static _merge(t){if(t.length===0)return t;const n=[];let r=0,s=t[0];for(let o=1;o<t.length;o++){const i=t[o];s.oldEnd===i.oldPosition?s=new ae(s.oldPosition,s.oldText+i.oldText,s.newPosition,s.newText+i.newText):(n[r++]=s,s=i)}return n[r++]=s,n}static _removeNoOps(t){if(t.length===0)return t;const n=[];let r=0;for(let s=0;s<t.length;s++){const o=t[s];o.oldText!==o.newText&&(n[r++]=o)}return n}};function _l(e){return new ae(e.newPosition,e.newText,e.oldPosition,e.oldText)}function bl(e){return e.map(_l)}function ss(e,t){return t.every(n=>e.slice(n.oldPosition,n.oldEnd)===n.oldText)}function yl(e,t){let n=e;for(let r=t.length-1;r>=0;r-=1){const s=t[r];n=n.slice(0,s.oldPosition)+s.newText+n.slice(s.oldEnd)}return n}function Sl(e,t,n){let r=0;const s=e.start===e.end;for(const o of t){const i=o.newLength-o.oldLength;if(o.oldLength===0){const a=o.oldPosition;if(s&&a===e.start)r+=n==="after"?i:0;else{if(e.start<a&&a<e.end)return null;a<=e.start&&(r+=i)}continue}if(s){if(e.start>=o.oldEnd)r+=i;else if(e.start>o.oldPosition)return null;continue}if(e.start>=o.oldEnd)r+=i;else if(e.end>o.oldPosition)return null}return{start:e.start+r,end:e.end+r}}var Ge=class extends Error{reason;constructor(e){super("Открытие документа не удалось"),this.reason=e,this.name="DocumentOpenFailedError"}},os=0,Il=Math.random().toString(36).slice(2,8);function wl(){return os+=1,`doc-${Il}-${os}`}function Tl(e){const t=e.createBuffer(),n=e.docId??wl();let r=e.serverId??null,s=0,o=null,i=e.attributes??{};const a=new Set;let c=!1,d=!1,u;const f=new Set;let g=null;const E=()=>(g?.version!==s&&(g={version:s,value:t.read()}),g.value),S=b=>Object.entries(b).some(([h,y])=>i[h]!==y);return{get:()=>({docId:n,serverId:r,version:s,savedVersion:o,attributes:i}),getContent:E,mutate(b,{source:h}){if(c)return s;const y=b.changes?.length?b.changes:void 0,w=y?yl(E(),y):b.content!==void 0?b.content:void 0,A=w!==void 0&&w!==E(),D=b.attributes!==void 0&&S(b.attributes);if(!A&&!D)return s;const N=!(s>(o??-1)),m=D?Object.keys(b.attributes).filter(C=>i[C]!==b.attributes[C]):[];A&&t.write(w),D&&(i={...i,...b.attributes}),s+=1,h!=="user"&&N&&(o=s);const _={source:h,version:s,changes:y,...A?{content:!0}:{},...m.length>0?{attributes:m}:{}};return a.forEach(C=>C(_)),s},markSaved(b,h){const y={serverId:r,savedVersion:o};h!==void 0&&(r=h),(o===null||b>o)&&(o=b),(y.serverId!==r||y.savedVersion!==o)&&a.forEach(w=>w({source:"system",version:s}))},markUnsaved(){c||o===null||o<s||(o=s-1,a.forEach(b=>b({source:"system",version:s})))},markReady(){d||u!==void 0||(d=!0,f.forEach(b=>b.resolve()),f.clear(),a.forEach(b=>b({source:"system",version:s})))},isReady:()=>d,markFailed(b){d||u!==void 0||c||(u=b,f.forEach(h=>h.reject(new Ge(b))),f.clear(),a.forEach(h=>h({source:"system",version:s})))},failure:()=>u,whenReady(){return d?Promise.resolve():u!==void 0?Promise.reject(new Ge(u)):c?Promise.reject(new Error("Документ закрыт до того, как наполнение закончилось")):new Promise((b,h)=>{f.add({resolve:b,reject:h})})},subscribe(b){return a.add(b),()=>a.delete(b)},isNew:()=>r===null,isDirty:()=>s>(o??-1),isDisposed:()=>c,dispose(){c=!0,f.forEach(b=>b.reject(new Error("Документ закрыт до того, как наполнение закончилось"))),f.clear(),a.clear(),t.dispose()}}}var Cl=500,Al=100,sn=0;function Dl(e,t={}){const n=t.groupIntervalMs??Cl,r=t.maxSteps??Al,s=t.now??(()=>0);let o=[],i=0,a=sn+=1,c=null,d=!1,u=!1,f=!1;const g=new Set,E=()=>g.forEach(m=>m()),S=(m,_)=>{if(m.length){u=!0;try{e.mutate({changes:m},{source:_})}finally{u=!1}}},b=m=>S(m,"user"),h=m=>{const _=s();d&&c!==null&&_-c<n?o[i-1]=rs(o[i-1],m):(o=o.slice(0,i),o.push(m),i=o.length,d=!0,o.length>r&&(o=o.slice(o.length-r),i=o.length,a=sn+=1)),c=_,E()},y=()=>{d=!1,c=null},w=m=>{if(!m.length)return;const _=o.length>i;_&&(o=o.slice(0,i)),i>0&&(o[i-1]=rs(o[i-1],m)),y(),_&&E()},A=e.subscribe(({source:m,changes:_})=>{if(!(f||u||!_?.length)){if(m==="remote"){D();return}if(m!=="user"){w(_);return}h(_)}}),D=()=>{o=[],i=0,y(),a=sn+=1,E()},N=()=>{if(i===0)return!1;const m=bl(o[i-1]);return ss(e.getContent(),m)?(b(m),i-=1,y(),!0):(o=o.slice(0,i-1),i=o.length,y(),E(),!1)};return{canUndo:()=>i>0,canRedo:()=>i<o.length,undo(){N()&&E()},redo(){if(!(i>=o.length)){if(!ss(e.getContent(),o[i])){o=o.slice(0,i),y(),E();return}b(o[i]),i+=1,y(),E()}},clear:D,applyWithoutHistory(m){const _=e.get().version;if(S(m,"system"),e.get().version===_){y();return}w(m)},getPast:m=>o.slice(0,i).reverse().slice(0,m),getFuture:m=>o.slice(i).reverse().slice(0,m),createSnapshot:()=>({stackId:a,index:i}),restoreSnapshot(m){if(m.stackId!==a||m.index>i)return!1;for(;i>m.index;)if(!N())return E(),!1;return E(),!0},subscribe(m){return g.add(m),()=>g.delete(m)},dispose(){f=!0,A(),g.clear(),o=[],i=0}}}var Pl=["edit","move","resize","insert"];function on(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function Rl(e){return typeof e=="string"?e:null}function Ol(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string")?null:e}function Ml(e){return Pl.includes(e)?e:null}function Ll(e){const t=typeof e=="object"&&e!==null?e:{},n={originId:Rl(t.originId),changeId:on(t.changeId),rev:on(t.rev),baseRev:on(t.baseRev),expected:Ol(t.expected),intent:Ml(t.intent)};return{...n,legacy:Object.values(n).every(r=>r===null)}}var Ye=class extends Error{reason;constructor(e){super(`[emailmaker] save refused: ${e}`),this.name="SaveRefusedError",this.reason=e}},is=class extends Error{timeoutMs;constructor(e){super(`[useblocks] handleEmailAutosave did not respond within ${e}ms — the autosave was not written`),this.timeoutMs=e,this.name="IntegratorAutosaveTimeoutError"}},an=class extends Error{timeoutMs;constructor(e){super(`[useblocks] handleSaveEmail did not respond within ${e}ms — the email was not saved`),this.timeoutMs=e,this.name="IntegratorSaveTimeoutError"}};function Nl(){return typeof navigator<"u"&&navigator.onLine===!1}function xl(e){if(e==null)return[];const t=[e];if(typeof e!="object")return t;const n=e;if(n.error!=null&&(t.push(n.error),typeof n.error=="object")){const r=n.error;r.data!=null&&t.push(r.data),r.error!=null&&t.push(r.error)}if(n.data!=null&&(t.push(n.data),typeof n.data=="object")){const r=n.data;r.error!=null&&t.push(r.error)}return n.innerException!=null&&t.push(n.innerException),t}function as(e){if(!e)return!1;if(typeof e=="string"){const n=e.toLowerCase();return n.includes("fetch")||n.includes("network")||n.includes("timeout")||n.includes("failed to fetch")||n.includes("load failed")||n.includes("networkerror")}if(e instanceof Error)return as(e.message);if(typeof e!="object")return!1;const t=e;return t.status==="FETCH_ERROR"||t.status==="TIMEOUT_ERROR"||t.status==="PARSING_ERROR"?!0:typeof t.status=="number"?t.status===0||t.status===408||t.status>=500:!1}function kl(e){return Nl()?!0:xl(e).some(as)}var ls=new WeakSet,cs=new WeakMap;function ds(e){typeof e=="object"&&e!==null&&ls.add(e)}function Fl(e,t){typeof e=="object"&&e!==null&&cs.set(e,t)}function Bl(e){return typeof e=="object"&&e!==null?cs.get(e):void 0}function jl(e){return e instanceof an||e instanceof is||typeof e=="object"&&e!==null&&ls.has(e)}function Ul(e){return e instanceof Ye||jl(e)}function Hl(e){return!Ul(e)&&kl(e)}var us="draft";function Le(e){return e==null||e===""?us:String(e)}function $l(e){return e==null||e===""?`${ln}${us}`:`${ln}${String(e)}`}var ln="block:";function de(e){return e?.startsWith(ln)===!0}function We(e){return de(e.sessionKey())?void 0:e.current()}function n_(e,t){}function qe(e,t,n){const r=typeof performance<"u"?performance.now():Date.now();return W(`show:gate:${e}`,{kind:"wait"}),t.then(s=>(W(`show:gate:${e}:end`,{kind:"wait"}),s),s=>{const o=Math.round((typeof performance<"u"?performance.now():Date.now())-r);throw l.isAbortError(s)?(`${e}`,{...n}):(`${e}`,{error:ts(s),...n},void 0),s})}var r_=5e3,Vl=/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/;function Gl(e){const t=e?.trim()??"";if(!Vl.test(t))return Date.parse(t);const n=t.replace(" ","T");return Math.max(Date.parse(n),Date.parse(`${n}Z`))}function ze(e){return e?.length?[...e].sort((t,n)=>Date.parse(n.modified)-Date.parse(t.modified))[0]:null}function cn(e,{freshSince:t}={}){return!(e?.isAutosave!==!0||!e?.html?.trim()||t!==void 0&&Date.parse(e.modified)<t-5e3)}function Yl(e,t={}){const n=ze((e??[]).filter(r=>r?.html?.trim()));return cn(n,t)?n:null}function Wl(e,t){const n=Date.parse(ze(e)?.modified??""),r=Yl(e),s=Date.parse(r?.modified??""),o=t===void 0||Number.isFinite(s)&&s>t,i=[n,t??NaN].filter(a=>Number.isFinite(a));return{autosave:o?r:null,...i.length?{latestAt:Math.max(...i)}:{}}}function fs(e,t,n){const r=ze((e??[]).filter(c=>c?.html?.trim())),s=Date.parse(r?.modified??""),o=Date.parse(ze((n??[]).filter(c=>c?.html?.trim()))?.modified??""),i=r&&Number.isFinite(s)&&(t===void 0||s>t)&&!(o>s),a=[Date.parse(ze(e??[])?.modified??""),t??NaN].filter(c=>Number.isFinite(c));return{autosave:i&&cn(r)?r:null,...a.length?{latestAt:Math.max(...a)}:{}}}function ql({hasUnsavedUserEdit:e}){return e?"skip":"apply"}var ps=e=>e.replace(/\r\n?/g,`
|
|
2103
|
-
`),hs=["recovery","plugin","rest"],zl=["subject","preheader"];function Kl(e){let t={},n;for(let s=hs.length-1;s>=0;s--){const o=e.get(hs[s]);o&&(o.attributes&&(t={...t,...o.attributes}),o.content!==void 0&&(n=o.content))}const r=e.get("plugin")?.attributes;for(const s of zl){const o=r?.[s];typeof o=="string"&&o!==""&&(t={...t,[s]:o})}return n!==void 0?{content:n,attributes:t}:{attributes:t}}function dn(e,t){if(!e||!t)return;const n=e.getContent(),r=t.content!==void 0?ps(t.content):void 0,s=r!==void 0&&r!==n;e.get().docId,Object.keys(t.attributes??{}),e.mutate({attributes:t.attributes??{},...s?{changes:[new ae(0,n,0,r)]}:{}},{source:"remote"})}var un=e=>typeof e=="string"?e.trim():"";function Xl(e,t,n,r){const{version:s,attributes:o}=e.get(),i=o,a=r==="snapshot"||r==="anchor",c=a?i.author:void 0,d=a?i.date_gmt:void 0,u=un(i.title)||un(i.subject)||un(t.fallbackTitle);return{version:s,payload:{html:e.getContent(),title:u,subject:i.subject,preheader:i.preheader,description:i.description,common_styles:i.common_styles||"",meta:i.meta,utm_parameters:i.utm_parameters,parent_email:i.parent_email,is_template:i.is_template||!1,is_inited:i.is_inited,tags:i.tags,emailtags:i.emailtags,group:i.group,renderGuid:e.get().docId,project:t.project??i.project,folder:t.folder,...n?.emailtags?{emailtags:n.emailtags}:{},...n?.group?{group:n.group}:{},source:t.source,...c!=null&&c!==""?{author:c}:{},...d?{excerpt:d}:{}}}}var Jl=["meta","title","author","project","html","excerpt","subject","preheader","common_styles","parent_email"];function Ql(e){const t={};for(const n of Jl)e[n]!==void 0&&(t[n]=e[n]);return t.excerpt||(t.excerpt=new Date().toISOString()),t}async function Zl(e,t,n,r,s){if(n==="materialize"&&r!=null)throw new Error("Письмо уже создано на сервере");if(n==="materialize"||n==="publish"&&r==null)return e.createEmail(s);if(r==null)throw new Error("Письмо ещё не создано на сервере");return n==="publish"?e.updateEmail(r,s):t.saveAutosave(r,s)}function ge(e,t=!1){const n={};for(const r of Object.keys(e)){let s=e[r];s!==void 0&&!(typeof s=="number"&&Number.isNaN(s))&&(t&&typeof s=="object"&&s!==null&&(s=ge(s)),n[r]=s)}return n}function ec(e){return typeof e=="string"&&e.includes("autosave")}var tc=new Set(["html","id","renderGuid","showToken","showId","isNew"]);function ms(e){return e?Object.fromEntries(Object.entries(e).filter(([t])=>!tc.has(t))):{}}function Ke(e,t,n={}){e&&e.mutate({attributes:nc(e.get().attributes,t)},{source:n.source??"user"})}function nc(e,t){return t.subject===void 0||t.title!==void 0?t:(e.title??"")===(e.subject??"")?{...t,title:t.subject}:t}function fn(e,t){return e===void 0&&Object.keys(t).length===0?null:{...e!==void 0?{content:e}:{},attributes:t}}function rc(e){return typeof e=="string"&&e.startsWith("{")?e:"{}"}function gs(e){if(!e)return null;const t=ms(e);return e.common_styles!==void 0&&(t.common_styles=rc(e.common_styles)),fn(e.html,t)}function Es(e){return e?fn(e.html,ge(ms(e))):null}var sc=["common_styles","subject","preheader","meta"];function vs(e){if(!e?.html?.trim())return null;const t={};for(const n of sc)oc(n,e[n])&&(t[n]=e[n]);return fn(e.html,t)}function oc(e,t){return e==="common_styles"?typeof t=="string"&&t.startsWith("{"):e==="meta"?typeof t=="object"&&t!==null&&!Array.isArray(t):typeof t=="string"}var ic=["modified","lock"];function ac(e){if(!e)return null;const t={};for(const n of ic)e[n]!==void 0&&(t[n]=e[n]);return Object.keys(t).length===0?null:{attributes:t}}var lc=10,cc=(e,t)=>e.key===t.key&&dc(e.serverId,t.serverId),dc=(e,t)=>e==null||e===t;function uc(e){return typeof e?.then=="function"}var _s=e=>{e.timer!==void 0&&(clearTimeout(e.timer),e.timer=void 0)},bs=e=>{e.request.serverId!=null&&!pn(e)&&(e.document.markSaved(e.document.get().version),e.savedContent=e.document.getContent())},fc=e=>e.document.get().serverId!=null&&!e.document.getContent().trim()&&!!(e.savedContent??e.lastMerged?.content??"").trim(),pn=e=>e.document.get().savedVersion!==null&&e.document.isDirty(),ys=(e,t)=>t?.content!==void 0&&ql({hasUnsavedUserEdit:pn(e)})==="skip",pc=e=>e.document.subscribe(t=>{t.source==="user"&&(t.content&&e.userTouched.add("content"),t.attributes?.forEach(n=>e.userTouched.add(n))),e.document.isDirty()||e.userTouched.clear()}),hc=(e,t)=>{!e.ready||t.content===void 0||e.document.get().serverId==null||(e.contentShown=!0,!(![...e.userTouched].every(n=>n==="content"||n in(t.attributes??{}))||!e.document.isDirty())&&(e.document.markSaved(e.document.get().version),e.savedContent=e.document.getContent(),e.userTouched.clear(),e.document.get().docId))},mc=(e,t)=>{if(!e)return t;const n=Object.fromEntries(Object.entries(t.attributes).filter(([s,o])=>e.attributes[s]!==o)),r=t.content!==void 0&&t.content!==e.content?t.content:void 0;return r===void 0&&Object.keys(n).length===0?null:r===void 0?{attributes:n}:{content:r,attributes:n}},gc=e=>{const t=Kl(e.reports),n=mc(e.lastMerged,t);e.lastMerged=t,n&&(dn(e.document,n),bs(e))},hn=(e,t)=>{if(!e.ready&&!pn(e)){gc(e);return}dn(e.document,t)},Ec=e=>{const{attributes:t,serverId:n,docId:r}=e.document.get();return{...t,html:e.document.getContent(),id:n??void 0,isNew:n==null,renderGuid:r}};function vc(e){const{resolveAdapters:t,timeoutMs:n,resolveWritePort:r,resolveHistoryPort:s,resolveTerms:o,canEdit:i,notifyBeforeSave:a,onAdapterError:c,onTimeout:d}=e;let u;const f=new Set,g=new Set,E=()=>f.forEach(p=>p()),S=(p,v)=>{if(!(p.closed||p.ready)){if(p.error!==void 0){p.document.markFailed(p.error),p.document.get().docId;return}bs(p),p.ready=!0,p.document.markReady(),p.document.get().docId,[...p.reports.keys()]}},b=(p,v,T)=>{c?.(v.id,T),!(!v.required||p.closed)&&(p.error=T,p.document.get().docId,v.id,E())},h=(p,v)=>{const T=new Set(v.map(I=>I.id));v.forEach(I=>{I.watch&&p.watchers.push(I.watch(P=>p.closed?!1:p.ready&&(ys(p,P)||p.contentShown===!0&&P?.content!==void 0)?(p.document.get().docId,I.id,!1):(P&&p.reports.set(I.id,P),hn(p,P),!0)))});const L=(I,P)=>{if(!p.closed){if(!I.required&&ys(p,P)){p.document.get().docId,I.id,I.loaded?.(!1);return}P&&p.reports.set(I.id,P),hn(p,P),I.loaded?.(P!==null)}},O=()=>{T.size>0||p.closed||(_s(p),S(p,[]))},F=[];if(v.forEach(I=>{let P;try{P=I.load()}catch(x){b(p,I,x),T.delete(I.id);return}if(uc(P)){F.push({id:I.id,required:I.required,load:()=>P,...I.loaded?{loaded:x=>I.loaded?.(x)}:{}});return}L(I,P),T.delete(I.id)}),F.length===0){O();return}p.timer=setTimeout(()=>{p.timer=void 0,d?.([...T]),p.document.get().docId,[...T],S(p,[...T])},n),p.timer.unref?.(),F.forEach(I=>{I.load().then(P=>L(I,P)).catch(P=>{b(p,I,P)}).finally(()=>{T.delete(I.id),O()})})},y=async(p,v,T)=>{if(T==="snapshot"||T==="anchor")return;const L=o?.();if(L)return L.resolve({project:v.project??p.project,tags:(p.tags??[]).map(O=>({name:O}))})},w=p=>{if(p.lock===!0&&i?.(p)===!1)return new Ye("locked");const v=p.tags?.length??0,T=p.emailtags?.length??0;if(Math.max(v,T)>lc)return new Ye("too-many-tags")},A=(p,v)=>{const T=p.document.get().serverId;v||T==null||(p.recoveryFacts={emailId:T,historyLoaded:!0,isRecovering:!1},de(p.request.key)||(p.request={...p.request,key:Le(T),serverId:T}))},D=(p,v,T)=>{if(p.closed||T?.id==null)return;const L=p.document.get().serverId,O=L!=null;O&&L!==String(T.id)||(p.document.markSaved(v,String(T.id)),A(p,O),p.document.get().serverId,E())},N=async(p,v,T)=>{try{await p.document.whenReady()}catch(P){return p.saveError=P,p.saveFailures+=1,p.failedIntent=v,p.saveFailures,!1}if(p.closed)return!1;const L=w(p.document.get().attributes);if(L)return p.saveError=L,p.saveFailures+=1,p.failedIntent=v,L.reason,E(),!1;if(a&&(await a(Ec(p)).catch(()=>{}),p.closed))return!1;if(fc(p))return v==="snapshot"||(p.saveError=new Ye("empty-content"),p.saveFailures+=1,p.failedIntent=v,E()),!1;let O;try{O=await y(p.document.get().attributes,T,v)}catch(P){return p.saveError=P,p.saveFailures+=1,p.failedIntent=v,p.saveFailures,E(),!1}if(p.closed)return!1;const{payload:F,version:I}=Xl(p.document,T,O,v);p.document.get().docId;try{const P=p.document.get().serverId!=null,x=await Zl(r(),s(p.request.key),v,p.document.get().serverId,F);if(p.closed)return!0;let J;if(v==="snapshot"||v==="anchor"){const z=x?.modified!=null?Date.parse(x.modified):NaN;J=Number.isFinite(z)?z:Date.now(),p.snapshotVersion=I,p.lastRevisionAt=J}else p.document.markSaved(I,x?.id!=null?String(x.id):void 0),p.savedContent=F.html;A(p,P),p.saveError=void 0,p.saveFailures=0,p.failedIntent=void 0,p.document.get().serverId,E();const re={intent:v,serverId:p.document.get().serverId,created:!P,...J!==void 0?{revisionAt:J}:{}};return g.forEach(z=>z(re)),!0}catch(P){return(v==="publish"||v==="materialize")&&Bl(P)?.then(x=>D(p,I,x)),p.saveError=P,p.saveFailures+=1,p.failedIntent=v,p.saveFailures,E(),!1}},m=()=>{u&&(u.closed=!0,u.watchers.forEach(p=>p()),u.watchers=[],_s(u),u.history.dispose(),u.document.dispose(),u=void 0)},_=(p,v,T)=>{let L=!1;v.show&&(p.show?.id!==v.show.id||p.show.token!==v.show.token)&&(p.show=v.show,L=!0,{docId:p.document.get().docId,...v.show});const O=T==="show"?Es(v.patch):null;O&&(p.reports.set("plugin",O),hn(p,O),hc(p,O)),L&&E()},C=(p,v={})=>{const T=u;return!T||T.closed||p==="materialize"&&T.document.get().serverId!=null?Promise.resolve(!1):T.saving?p==="snapshot"||p==="materialize"?Promise.resolve(!1):(T.inFlight??Promise.resolve(!1)).then(()=>C(p,v)):(T.saving=!0,E(),T.inFlight=N(T,p,v).finally(()=>{T.saving=!1,T.inFlight=void 0,u===T&&!T.closed&&E()}),T.inFlight)},M=(p,v="open")=>{if(u&&!u.closed&&v!=="new"&&cc(u.request,p))return _(u,p,v),u.document;m();const T=Tl({createBuffer:()=>El(""),serverId:p.serverId??null}),L={request:p,show:p.show,document:T,history:Dl(T,{now:Date.now}),watchers:[],userTouched:new Set,saveFailures:0,saving:!1,reports:new Map,ready:!1,closed:!1};return u=L,L.watchers.push(pc(L)),T.get().docId,p.serverId,h(L,t(p,{publishRecoveryFacts(O){L.closed||(L.recoveryFacts=O,E())},readShownContent:()=>L.closed?null:L.document.getContent()})),E(),T};return{openWith:M,open:(p,v={})=>M({key:Le(p),serverId:p,email:v.email,patch:v.patch,show:v.show},"open"),openDraft:(p,v={})=>M({key:Le(void 0),serverId:null,email:p,patch:v.patch,show:v.show},"open"),startNewDraft:(p,v={})=>M({key:Le(void 0),serverId:null,email:p,patch:v.patch,show:v.show},"new"),reload:(p,v={})=>M({key:Le(p),serverId:p,email:v.email,patch:v.patch,show:v.show},"new"),openBlock:(p,v)=>M({key:de(p)?p:$l(p),serverId:v?.id!=null?String(v.id):null,email:v},"open"),show:(p,v)=>{const T=u;if(!(!T||T.closed))return M({...T.request,patch:p,show:v},"show")},current:()=>u?.document,noteServerFacts:({serverId:p,block:v},T)=>{const L=u;!L||L.closed||L.request.serverId!==p||de(L.request.key??"")===v&&dn(L.document,ac(T))},save:C,saveState:()=>({error:u?.saveError,failures:u?.saveFailures??0,saving:u?.saving===!0,failedIntent:u?.failedIntent}),revisionFacts(){if(!u)return;const p=u.revisionFactsSnapshot;return p&&p.snapshotVersion===u.snapshotVersion&&p.lastRevisionAt===u.lastRevisionAt?p:(u.revisionFactsSnapshot={snapshotVersion:u.snapshotVersion,lastRevisionAt:u.lastRevisionAt},u.revisionFactsSnapshot)},recoveryFacts:()=>u?.recoveryFacts,history:()=>u?.history,forcedHeaders:()=>u?.forcedHeaders,beginForcedHeaders(p){u&&!u.closed&&(u.forcedHeaders=p)},endForcedHeaders(){u&&(u.forcedHeaders=void 0)},onSaved(p){return g.add(p),()=>g.delete(p)},showFacts:()=>u?.show,sessionKey:()=>u?.request.key,openError:()=>u?.error,subscribe(p){return f.add(p),()=>f.delete(p)},close(){u&&(m(),E())}}}var mn=class extends Error{reason;constructor(e,t){super(`письмо не открылось: ${e}`),this.name="EmailOpenFailedError",this.reason=e,this.cause=t}};function gn(e){if(e instanceof mn)return e.reason;if(e instanceof Ge)return gn(e.reason)}function _c(e){const t=e instanceof Ge?e.reason:e;return t instanceof mn&&t.reason==="unavailable"&&t.cause instanceof TypeError}function bc(e){const t=gn(e);return t==="forbidden"||t==="not-found"}function yc(e,t){return{id:"rest",required:!0,load:async()=>{const n=await e.readEmail(t);if(!n)throw new mn("not-found");return gs(n)}}}var Ss=l.createIdentifier$1("EmailPort");function Sc(e){return e.getInstance(Ss)}function Ic(e,t){e.inject(Ss,t)}var Is=l.createIdentifier$1("documentSession.restEmailPortFactories");function ws(e){return e.getInstance(Is)!==void 0}function Se(e){const t=e.getInstance(Is);if(!t)throw new Error("[documentSession] порты поверх REST ещё не загружены — работа с сервером начинается с init()");return t}var wc=l.createIdentifier$1("EmailTermsResolver");function Tc(e){return e.getInstance(wc)}var Ts=l.createIdentifier$1("EmailHistoryPort"),Cc=l.createIdentifier$1("BlockHistoryPort");function Cs(e){return e.getInstance(Cc)}function As(e){return e.getInstance(Ts)}function Ac(e,t){e.inject(Ts,t)}var Dc="em_autosave_pending",s_=6e4;function bt(e){return`${Dc}_${e}`}function Pc(e,t){try{sessionStorage.setItem(bt(e),JSON.stringify(t))}catch{}}function Ds(e){try{const t=sessionStorage.getItem(bt(e));if(!t)return null;const n=JSON.parse(t);return Date.now()-n.sentAt>6e4?(sessionStorage.removeItem(bt(e)),null):n}catch{return null}}function Xe(e){try{sessionStorage.removeItem(bt(e))}catch{}}var Rc=2e3,Oc=5e3,Mc=5,Lc=5e3,Nc=4;function xc(){return typeof performance<"u"&&typeof performance.timeOrigin=="number"?performance.timeOrigin:Date.now()}function kc(e,t){return e==null||t==null?!1:e.replaceAll(`\r
|
|
2102
|
+
__useblocks__.define("useblocks.js",["require","exports","module","static/umd/b11043e6.js","static/umd/e8914784.js","static/umd/d786efbb.js"],function(Et,ne,Qv){Object.defineProperties(ne,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const Kt=Et("./static/umd/b11043e6.js"),l=Et("./static/umd/e8914784.js"),Ra=Et("./static/umd/d786efbb.js");var Oa=new Function("url","return import(url)");function Ma(e){if(typeof e!="function")return!1;try{return Reflect.construct(String,[],e),!0}catch{return!1}}function Xt(e){return typeof e=="object"&&e!==null&&"type"in e&&"url"in e}function Br(e){return e.type==="umd"||e.resolve==="registry"}var La="If the plugin is built on globals, enable the compatibility layer: the `compatGlobals` option of the bundler plugin or `import '<package>/compat-globals'` before creating the editor.";function Na(e){const t=Array.isArray(e)?e[0]:e;return Xt(t)?t.name??t.url:typeof t=="function"?t.name||"anonymous plugin":String(t)}function xa(e,t){const n=Na(e),r=Xt(e)?e:void 0,s=t instanceof Error?t.message:String(t),o=r&&Br(r)&&!/compat/iu.test(s)?` ${La}`:"",i=new Error(`Plugin "${n}" was skipped: it failed to load. ${s}${o}`);return i.cause=t,{name:n,url:r?.url,error:i}}function ka(e){return!e.filename&&!e.error&&/^Script error\.?$/.test(e.message)}function Zv(e){return e}var Fa=class{_context;_pluginRegistry;_options;_map=new Map;_optionsMap=new Map;_readyMap=new Map;_resolveMap=new Map;_initializingPlugins=new Map;_creatingPlugins=new Set;_initializedPlugins=new Set;_creationOrder=[];_lifecycleListeners=new Set;_activated=!1;constructor(e,t,n={}){this._context=e,this._pluginRegistry=t,this._options=n}activate(){return this._activated=!0,this._startPluginsBatch(Array.from(this._map.values()))}activateSync(){this._activated=!0,this._startPluginsBatch(Array.from(this._map.values()))}onLifecycle(e){return this._lifecycleListeners.add(e),{dispose:()=>this._lifecycleListeners.delete(e)}}_emitLifecycle(e){for(const t of Array.from(this._lifecycleListeners))try{t(e)}catch{}}async _resolveEntry(e){if(typeof e=="string"||typeof e=="symbol"){const t=await this._pluginRegistry.getAsync(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered.`);return{ctor:t}}if(typeof e=="function")return e.length===0?{ctor:await e()}:{ctor:e};if(Array.isArray(e)){const[t,n]=e;if(typeof t=="function")return{ctor:t,options:n};const r=await this._pluginRegistry.getAsync(t);if(!r)throw new Error(`Plugin "${String(t)}" not registered.`);return{ctor:r,options:n}}if(Xt(e))return this._resolveDescriptor(e);throw new Error(`Unknown plugin entry format: ${JSON.stringify(e)}`)}async _resolveDescriptor(e){const t=e.resolve??(e.type==="umd"?"window":"module");if(Br(e)&&await this._options.ensureHostRuntimeReady?.(e),e.type==="esm"){const n=await Oa(e.url);if(t==="module")return{ctor:n.default??n};if(t==="registry"&&e.name){const r=await this._pluginRegistry.getAsync(e.name);if(!r)throw new Error(`Plugin "${e.name}" not found in registry after ESM load`);return{ctor:r}}}if(e.type==="umd"){if(await this._loadScript(e.url),t==="window"&&e.name){const n=globalThis[e.name];if(!n)throw new Error(`Plugin "${e.name}" not found on window after script load`);return{ctor:n}}if(t==="registry"&&e.name){const n=await this._pluginRegistry.getAsync(e.name);if(!n)throw new Error(`Plugin "${e.name}" not found in registry after script load`);return{ctor:n}}}throw new Error(`Cannot resolve descriptor: type=${e.type}, resolve=${t}, name=${e.name??"none"}`)}_loadScript(e){return new Promise((t,n)=>{if(typeof document>"u"){n(new Error("Cannot load UMD script in non-browser environment"));return}const r=document.createElement("script");r.src=e,this._options.explainScriptFailure?.();let s;const o=a=>{s||(a.filename===r.src?s=this._scriptExecutionError(e,a.error??a.message):ka(a)&&(s=this._scriptExecutionError(e,this._options.explainScriptFailure?.()??a.message)))},i=()=>window.removeEventListener("error",o);window.addEventListener("error",o),r.onload=()=>{if(i(),s){n(s);return}t()},r.onerror=()=>{i(),n(new Error(`Failed to load script: ${e}`))},document.head.appendChild(r)})}_scriptExecutionError(e,t){const n=t instanceof Error?t.message:String(t),r=new Error(`Plugin script "${e}" threw while executing: ${n}`);return r.cause=t,r}initSync(e){const t=[];for(const n of e){const r=this._createOrSkip(n,void 0);r&&t.push(r)}this._activated=!0,this._startPluginsBatch(t)}async init(e){const t=[],n=new Set;for(const r of e){const s=await this._resolveOrSkip(r);if(!s)continue;const o=this._createOrSkip(s.ctor,s.options);o&&!n.has(o)&&(n.add(o),t.push(o))}this._activated=!0,await this._startPluginsBatch(t)}async setPlugins(e){const t=new Set,n=[];for(const i of e){const a=await this._resolveOrSkip(i);a&&(t.add(a.ctor),n.push(a))}const r=[];this._map.forEach((i,a)=>{t.has(a)||r.push({key:a,plugin:i})});for(let i=r.length-1;i>=0;i--){const{key:a,plugin:c}=r[i];await this._initializingPlugins.get(c),await this._disposePlugin(c,c.constructor.name),this._map.delete(a),this._optionsMap.delete(a),this._readyMap.delete(c),this._resolveMap.delete(c),this._initializingPlugins.delete(c),this._initializedPlugins.delete(c);const d=this._creationOrder.indexOf(c);d>=0&&this._creationOrder.splice(d,1)}const s=[],o=new Set;for(const{ctor:i,options:a}of n){const c=this._createOrSkip(i,a);c&&!o.has(c)&&(o.add(c),s.push(c))}this._activated&&await this._startPluginsBatch(s)}isReady(e){return this._initializedPlugins.has(e)}ready(e){return this._initializingPlugins.get(e)??this._readyMap.get(e)??Promise.resolve()}async waitFor(e,t){if(this._pluginRegistry.has(e))return this.useByKeyAsync(e);const{timeout:n}=t??{};return await new Promise((r,s)=>{let o,i=!1;const a=()=>{i||(i=!0,o&&clearTimeout(o),this._pluginRegistry.off(e,a),r())};this._pluginRegistry.on(e,a),n!==void 0&&n>0&&(o=setTimeout(()=>{i||(i=!0,this._pluginRegistry.off(e,a),s(new Error(`waitFor("${String(e)}") timed out after ${n}ms`)))},n))}),this.useByKeyAsync(e)}useByKey(e){const t=this._pluginRegistry.get(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered or not loaded yet. Use useByKeyAsync() for async plugins.`);const n=this._getOrCreate(t);return this._activated&&this._startPluginsBatch([n]),n}async useByKeyAsync(e){const t=await this._pluginRegistry.getAsync(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered.`);const n=this._getOrCreate(t);return this._activated&&await this._startPluginsBatch([n]),n}useByCtor(e,t){const n=this._getOrCreate(e,t);return this._activated&&this._startPluginsBatch([n]),n}use(e){return typeof e=="function"?this.useByCtor(e):this.useByKey(e)}async useAsync(e){const{ctor:t,options:n}=await this._resolveEntry(e),r=this._getOrCreate(t,n);return this._activated&&await this._startPluginsBatch([r]),r}_getOrCreate(e,t){const n=e;if(!this._map.has(n)){t!==void 0&&this._optionsMap.set(n,t);const r=this._optionsMap.get(n),s=this._createPluginInstance(e,r),o=s.constructor.name;this._emitLifecycle({type:"created",plugin:s,name:o}),s.required?.(),this._map.set(n,s),this._creationOrder.push(s),this._setupReadyPromise(s)}return this._map.get(n)}async _resolveOrSkip(e){try{return await this._resolveEntry(e)}catch(t){const n=xa(e,t);try{this._options.reportLoadFailure?.(n)}catch{}return}}_createOrSkip(e,t){try{return this._getOrCreate(e,t)}catch(n){const r=e.name||"anonymous plugin";this._emitLifecycle({type:"create:error",ctor:e,name:r,error:n});return}}_createPluginInstance(e,t){const n=e;if(this._creatingPlugins.has(n))throw new Error(`Cyclic dependency for plugin ${e.name}`);this._creatingPlugins.add(n);const r=this._options.openEarlyWindow?.();try{return Ma(e)?new e(this._context,t):e(this._context,t)||{}}finally{r?.(),this._creatingPlugins.delete(n)}}_setupReadyPromise(e){const t=new Promise(n=>{this._resolveMap.set(e,n)});this._readyMap.set(e,t)}async _startPluginsBatch(e){const t=Array.from(new Set(e)),n=new Set,r=[];for(const s of t){if(this._initializedPlugins.has(s))continue;const o=this._initializingPlugins.get(s);if(o){n.add(o);continue}r.push(s)}if(r.length>0){const s=this._runBatchLifecycle(r);for(const o of r)this._initializingPlugins.set(o,s);n.add(s),s.finally(()=>{for(const o of r)this._initializingPlugins.get(o)===s&&this._initializingPlugins.delete(o)})}await Promise.all(n)}async _runBatchLifecycle(e){const t=[];for(const n of e){const r=n.constructor.name;this._emitLifecycle({type:"init:start",plugin:n,name:r});const s=this._options.openEarlyWindow?.();try{await n.init?.(),this._emitLifecycle({type:"init:success",plugin:n,name:r}),t.push(n)}catch(o){this._emitLifecycle({type:"init:error",plugin:n,name:r,error:o})}finally{s?.()}}for(const n of t){const r=n.constructor.name;this._emitLifecycle({type:"afterInit:start",plugin:n,name:r});try{await n.afterInit?.(),this._emitLifecycle({type:"afterInit:success",plugin:n,name:r})}catch(s){this._emitLifecycle({type:"afterInit:error",plugin:n,name:r,error:s})}}for(const n of e)this._initializedPlugins.add(n),this._resolveMap.get(n)?.(),this._resolveMap.delete(n)}async _disposePlugin(e,t){this._emitLifecycle({type:"dispose:start",plugin:e,name:t});try{await e.dispose?.(),this._emitLifecycle({type:"dispose:success",plugin:e,name:t})}catch(n){this._emitLifecycle({type:"dispose:error",plugin:e,name:t,error:n})}}async dispose(){for(let e=this._creationOrder.length-1;e>=0;e--){const t=this._creationOrder[e];await this._initializingPlugins.get(t),await this._disposePlugin(t,t.constructor.name)}this._map.clear(),this._optionsMap.clear(),this._readyMap.clear(),this._resolveMap.clear(),this._initializingPlugins.clear(),this._initializedPlugins.clear(),this._creationOrder.length=0,this._lifecycleListeners.clear()}getStatus(){return Array.from(this._map.values()).map(e=>({name:e.constructor.name,initialized:this._initializedPlugins.has(e)}))}},Ba=class{_plugins=new Map;_listeners=new Map;_getOrCreateEntry(e){let t=this._plugins.get(e);return t||(t={overrides:[]},this._plugins.set(e,t)),t}_applyOverrides(e,t){const n=this._plugins.get(e);if(n?.overrides)for(const r of n.overrides)t=r(t)||t;return t}_notifyListeners(e,t){const n=this._listeners.get(e);if(!n||n.length===0)return;for(const s of n)try{s.callback(t)}catch{}const r=n.filter(s=>!s.once);r.length>0?this._listeners.set(e,r):this._listeners.delete(e)}get(e){const t=this._plugins.get(e);if(t?.ctor)return this._applyOverrides(e,t.ctor)}async getAsync(e){const t=this._plugins.get(e);if(t?.ctor)return this._applyOverrides(e,t.ctor);if(t?.loading){const n=await t.loading;return this._applyOverrides(e,n)}if(t?.factory){const n=Promise.resolve(t.factory()).then(s=>(t.ctor=s,t.loading=void 0,this._notifyListeners(e,s),s));t.loading=n;const r=await n;return this._applyOverrides(e,r)}return new Promise(n=>{this.on(e,r=>n(this._applyOverrides(e,r)))})}add(e,t){const n=this._getOrCreateEntry(e);n.ctor=t,this._notifyListeners(e,t)}addAll(e){for(const t of Object.keys(e)){const n=e[t];n!==void 0&&this.add(t,n)}}addAsync(e,t){const n=this._getOrCreateEntry(e);return n.factory=t,{dispose:()=>{n.ctor||(n.factory=void 0)}}}has(e){const t=this._plugins.get(e);return!!(t?.ctor||t?.factory)}isLoaded(e){return!!this._plugins.get(e)?.ctor}override(e,t){const n=this._getOrCreateEntry(e);return n.overrides.push(t),{dispose:()=>{const r=n.overrides.indexOf(t);r>=0&&n.overrides.splice(r,1)}}}on(e,t){const n=this.get(e);n&&t(n);let r=this._listeners.get(e);r||(r=[],this._listeners.set(e,r));const s={callback:t,once:!1};return r.push(s),{dispose:()=>this._removeListener(e,t)}}once(e,t){const n=this.get(e);if(n)return t(n),{dispose:()=>{}};let r=this._listeners.get(e);r||(r=[],this._listeners.set(e,r));const s={callback:t,once:!0};return r.push(s),{dispose:()=>this._removeListener(e,t)}}off(e,t){this._removeListener(e,t)}_removeListener(e,t){const n=this._listeners.get(e);if(n){const r=n.findIndex(s=>s.callback===t);r>=0&&n.splice(r,1),n.length===0&&this._listeners.delete(e)}}keys(){return Array.from(this._plugins.keys())}forContext(){const e=this;return{add(t,n){e.add(t,n)}}}},ja=class{resolveRegistry;constructor(e){this.resolveRegistry=e}target(){return this.resolveRegistry()}get(e){return this.target().get(e)}getAsync(e){return this.target().getAsync(e)}add(e,t){return this.target().add(e,t)}addAll(e){return this.target().addAll(e)}addAsync(e,t){return this.target().addAsync(e,t)}has(e){return this.target().has(e)}isLoaded(e){return this.target().isLoaded(e)}override(e,t){return this.target().override(e,t)}on(e,t){return this.target().on(e,t)}once(e,t){return this.target().once(e,t)}off(e,t){return this.target().off(e,t)}keys(){return this.target().keys()}forContext(){return this.target().forContext()}},jr=class{capacity;items=[];constructor(e){this.capacity=e}push(e){this.items.length>=this.capacity&&this.items.shift(),this.items.push(e)}snapshot(){return this.items.slice()}size(){return this.items.length}clear(){this.items=[]}};function Ua(e,t){return t+e}function Ha(){return typeof performance>"u"?Date.now():Ua(performance.now(),performance.timeOrigin)}var $a="emailmaker:diagnostics",Va="diagnostics",Ga="diagnostics";function Ur(e,t){return t?`${e}${e.includes("?")?"&":"?"}${Ga}=1`:e}var Jt;function Ya(){try{const e=new URLSearchParams(window.location.search).get(Va);return e===null?void 0:e!=="0"}catch{return}}function Wa(){const e=window.__DIAGNOSTICS__;return typeof e=="boolean"?e:void 0}function qa(){try{const e=window.localStorage.getItem($a);return e===null?void 0:e==="1"}catch{return}}function He(){return Jt===void 0&&(Jt=typeof window>"u"?!1:Ya()??Wa()??qa()??!1),Jt}function za(e){return`__${(e||"useblocks").toLowerCase().replaceAll("-","")}__`}var te={initStart:"loader:init:start",coreReady:"loader:core:ready",initEnd:"loader:init:end",chunksLoaded:"app:chunks:loaded",showStart:"show:start",showEnd:"show:end",canvasCreated:"canvas:created",canvasLoaded:"canvas:loaded",canvasPainted:"canvas:painted",appVisible:"app:visible",editorVisible:"editor:visible",canvasSettled:"canvas:settled"},e_=Object.values(te),t_=[te.canvasPainted,te.canvasSettled,te.appVisible,te.editorVisible],Ka=5e3,Xa=3e3,Hr="diagnosticsStore",vt,$e;function $r(){return{marks:new jr(Ka),resources:new jr(Xa)}}function Vr(){if($e)return $e;const e=Qt();return e?($e=e[Hr]??vt??$r(),e[Hr]=$e,vt=void 0,$e):(vt??=$r(),vt)}function W(e,t){He()&&Vr().marks.push({phase:e,at:Ha(),...t})}function Qt(){if(typeof __useblocks__<"u"&&__useblocks__)return __useblocks__;if(typeof window>"u")return;const e=window[za()];return e!==null&&typeof e=="object"?e:void 0}function Ja(e){const t=e.length,n=Vr();return e.forEach(r=>n.marks.push(r)),e.length=0,t}function Qa(){const e=Qt();return!e||!Array.isArray(e.diagnosticsBuffer)?0:Ja(e.diagnosticsBuffer)}var Za="Editor instance was destroyed and cannot be reused. A fresh instance will be created instead.";function ge(){const e=new Error(Za);return e.name="DestroyedInstanceError",e}function el(e){return e instanceof Error&&e.name==="DestroyedInstanceError"}function Zt(e,t){if(e===t)return!0;if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const n=Array.isArray(e);if(n!==Array.isArray(t))return!1;if(n){const o=e,i=t;return o.length===i.length&&o.every((a,c)=>Zt(a,i[c]))}const r=Object.keys(e),s=Object.keys(t);return r.length!==s.length?!1:r.every(o=>Object.prototype.hasOwnProperty.call(t,o)&&Zt(e[o],t[o]))}function Gr(e,t){const n={watch(r){let s,o=!1;return e.watch(i=>{const a=t(i);o&&Zt(s,a)||(s=a,o=!0,r(a))})},select(r){return Gr(n,r)}};return n}function de(...e){let t=e[0],n=e.length>0;const r=new Set,s={get(){return n?t:void 0},set(o){t=o,n=!0;for(const i of Array.from(r))i(o)},watch(o){return r.add(o),n&&o(t),{dispose:()=>r.delete(o)}},select(o){return Gr(s,o)}};return s}var tl=class{http;constructor(e){this.http=e}app_init_create=(e,t={})=>this.http.request({path:"/app/v1/app_init",method:"POST",body:e,type:l.ContentType.UrlEncoded,...t})},Yr=class{http;constructor(e){this.http=e}get_translations2=({file:e,...t},n={})=>this.http.request({path:`/translations/v1/${e}`,method:"GET",...n});get_translations3=({id:e,file:t,...n},r={})=>this.http.request({path:`/translations/v1/${t}/${e}`,method:"GET",...r})};function nl(e){return String(e||"").trim()||void 0}var rl=class extends l.Disposable{deps;_app;_baseUrl;_appInit;_restBaseUrl;_prevApp;constructor(e){super(),this.deps=e,this.addDisposable(e.options.select(t=>this._slice(t)).watch(t=>this._start(t)))}get app(){return this._app}_slice(e){return Object.prototype.hasOwnProperty.call(e,"baseUrl")&&(this._baseUrl=nl(e.baseUrl)),Object.prototype.hasOwnProperty.call(e,"appInit")&&(this._appInit=e.appInit),{appInit:this._appInit,user:e.user,project:e.project,baseUrl:this._baseUrl,restBaseUrl:this.deps.resolveRestBaseUrl(this._baseUrl),standalone:this.deps.isStandalone()}}_start(e){if(this._restBaseUrl!==e.restBaseUrl&&(this._restBaseUrl=e.restBaseUrl,this.deps.setRestBaseUrl(e.restBaseUrl)),e.standalone)return;const t=e.appInit||this.deps.fallbackAppInit,n=Promise.resolve(t({baseUrl:e.baseUrl,user:e.user,project:e.project,prevApp:this._prevApp}));this._app=n,n.then(r=>{this._app===n&&(this._prevApp=r)},()=>{}),this.deps.publish(n)}},en=l.createIdentifier$1("AppInitService");function sl(e){return async()=>{const t=await e();return(await new tl(t).app_init_create({})).data}}function ol(e){e.injectFactory(en,(t,n)=>{if(n)return n;const r=new rl({options:e.getInstance(l.OPTIONS_SOURCE_ID),isStandalone:()=>!!e.getInstance(l.SECURITY_MODULE_ID),resolveRestBaseUrl:s=>s?l.getActiveBaseUrl(s):l.getActiveBaseUrl()||void 0,setRestBaseUrl:s=>{e.getInstance(l.REST_CLIENT_FACTORY_ID)?.setOptions(s?{baseUrl:s}:{})},fallbackAppInit:sl(()=>e.getInstanceAsync(l.REST_TRANSPORT_ID)),publish:s=>{e.inject(l.APP_ID,s)}});return e.getInstance(l.DISPOSABLE_ID)?.addDisposable(r),r},!0)}var tn=l.createIdentifier$1("documentSession.emailDocuments");function Me(e){return e?.getInstance(tn)}var il=l.createIdentifier$1("RevisionServiceFlag");function Wr(e){return e.getOrCreateInstance(il,()=>{let t=!1;return{isEnabled:()=>t,set:n=>{t=n}}})}function qr(e){return Wr(e).isEnabled()}var al=l.createIdentifier$1("EmailRightsResolver");function ll(e,t){const n=e.getInstance(al);return n?n(t):!0}var zr=l.createIdentifier$1("EmailHistoryAvailabilityResolver");function cl(e){return e.getInstance(zr)!==void 0}async function dl(e){const t=e.getInstance(zr);if(!t)return!0;try{return await t()}catch{return!1}}var nn={INIT_START:5e3,SET_ENTITY:12e3,PREHEADER:5e3,SUBJECT:5e3,INITED:5e3,UPDATE_ENTITY:5e3},Kr=["INIT_START","SET_ENTITY","PREHEADER","SUBJECT","INITED"],Xr=2e4,ul=Kr.reduce((e,t)=>e+nn[t],0),Jr=Xr+ul+3e3;function fl(e){return Kr.reduce((t,n)=>t+Qr(n,e),0)}function Qr(e,t){const n=t?.[e];return typeof n=="number"&&n>0?n:nn[e]}function Zr(e){const t=e?.contentReady;return typeof t=="number"&&t>0?t:Jr}function es(e){const t=e?.sandboxReady;return typeof t=="number"&&t>0?t:Xr}function rn(e=Jr){return e+3e3}var n_="[show-pipeline]";function ts(e){return e instanceof Error?`${e.name}: ${e.message}`:typeof e=="string"?e:JSON.stringify(e)??"undefined"}function r_(e,t){}var pl=()=>rn();function hl(e,t){let n;return Promise.race([e,new Promise(r=>{n=setTimeout(()=>{r()},t)})]).finally(()=>{n!==void 0&&clearTimeout(n)})}function ml(e){return t=>hl(e.getOrCreateInstance(l.events.BEFORE_SAVE_EMAIL,()=>new l.AsyncEmitter).fire(t),pl())}function gl(e){return e!=null&&e!==""}var ns;function Ve(e,t){return ns?.capture(e,t)}function El(e,t){return ns?.captureMessage(e,t)}function vl(e=""){let t=e;return{read:()=>t,write:n=>{t=n},dispose:()=>{t=""}}}function _t(e){return e.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var ae=class{oldPosition;oldText;newPosition;newText;get oldLength(){return this.oldText.length}get oldEnd(){return this.oldPosition+this.oldText.length}get newLength(){return this.newText.length}get newEnd(){return this.newPosition+this.newText.length}constructor(e,t,n,r){this.oldPosition=e,this.oldText=t,this.newPosition=n,this.newText=r}toString(){return this.oldText.length===0?`(insert@${this.oldPosition} "${_t(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${_t(this.oldText)}")`:`(replace@${this.oldPosition} "${_t(this.oldText)}" with "${_t(this.newText)}")`}};function rs(e,t){return e===null||e.length===0?t:new _l(e,t).compress()}var _l=class me{_prevEdits;_currEdits;_result;_resultLen;_prevLen;_prevDeltaOffset;_currLen;_currDeltaOffset;constructor(t,n){this._prevEdits=t,this._currEdits=n,this._result=[],this._resultLen=0,this._prevLen=this._prevEdits.length,this._prevDeltaOffset=0,this._currLen=this._currEdits.length,this._currDeltaOffset=0}compress(){let t=0,n=0,r=this._getPrev(t),s=this._getCurr(n);for(;t<this._prevLen||n<this._currLen;){if(r===null){if(s===null)break;this._acceptCurr(s),s=this._getCurr(++n);continue}if(s===null){this._acceptPrev(r),r=this._getPrev(++t);continue}if(s.oldEnd<=r.newPosition){this._acceptCurr(s),s=this._getCurr(++n);continue}if(r.newEnd<=s.oldPosition){this._acceptPrev(r),r=this._getPrev(++t);continue}if(s.oldPosition<r.newPosition){const[c,d]=me._splitCurr(s,r.newPosition-s.oldPosition);this._acceptCurr(c),s=d;continue}if(r.newPosition<s.oldPosition){const[c,d]=me._splitPrev(r,s.oldPosition-r.newPosition);this._acceptPrev(c),r=d;continue}let i,a;if(s.oldEnd===r.newEnd)i=r,a=s,r=this._getPrev(++t),s=this._getCurr(++n);else if(s.oldEnd<r.newEnd){const[c,d]=me._splitPrev(r,s.oldLength);i=c,a=s,r=d,s=this._getCurr(++n)}else{const[c,d]=me._splitCurr(s,r.newLength);i=r,a=c,r=this._getPrev(++t),s=d}this._result[this._resultLen++]=new ae(i.oldPosition,i.oldText,a.newPosition,a.newText),this._prevDeltaOffset+=i.newLength-i.oldLength,this._currDeltaOffset+=a.newLength-a.oldLength}const o=me._merge(this._result);return me._removeNoOps(o)}_acceptCurr(t){this._result[this._resultLen++]=me._rebaseCurr(this._prevDeltaOffset,t),this._currDeltaOffset+=t.newLength-t.oldLength}_getCurr(t){return t<this._currLen?this._currEdits[t]:null}_acceptPrev(t){this._result[this._resultLen++]=me._rebasePrev(this._currDeltaOffset,t),this._prevDeltaOffset+=t.newLength-t.oldLength}_getPrev(t){return t<this._prevLen?this._prevEdits[t]:null}static _rebaseCurr(t,n){return new ae(n.oldPosition-t,n.oldText,n.newPosition,n.newText)}static _rebasePrev(t,n){return new ae(n.oldPosition,n.oldText,n.newPosition+t,n.newText)}static _splitPrev(t,n){const r=t.newText.substr(0,n),s=t.newText.substr(n);return[new ae(t.oldPosition,t.oldText,t.newPosition,r),new ae(t.oldEnd,"",t.newPosition+n,s)]}static _splitCurr(t,n){const r=t.oldText.substr(0,n),s=t.oldText.substr(n);return[new ae(t.oldPosition,r,t.newPosition,t.newText),new ae(t.oldPosition+n,s,t.newEnd,"")]}static _merge(t){if(t.length===0)return t;const n=[];let r=0,s=t[0];for(let o=1;o<t.length;o++){const i=t[o];s.oldEnd===i.oldPosition?s=new ae(s.oldPosition,s.oldText+i.oldText,s.newPosition,s.newText+i.newText):(n[r++]=s,s=i)}return n[r++]=s,n}static _removeNoOps(t){if(t.length===0)return t;const n=[];let r=0;for(let s=0;s<t.length;s++){const o=t[s];o.oldText!==o.newText&&(n[r++]=o)}return n}};function bl(e){return new ae(e.newPosition,e.newText,e.oldPosition,e.oldText)}function yl(e){return e.map(bl)}function ss(e,t){return t.every(n=>e.slice(n.oldPosition,n.oldEnd)===n.oldText)}function Sl(e,t){let n=e;for(let r=t.length-1;r>=0;r-=1){const s=t[r];n=n.slice(0,s.oldPosition)+s.newText+n.slice(s.oldEnd)}return n}function wl(e,t,n){let r=0;const s=e.start===e.end;for(const o of t){const i=o.newLength-o.oldLength;if(o.oldLength===0){const a=o.oldPosition;if(s&&a===e.start)r+=n==="after"?i:0;else{if(e.start<a&&a<e.end)return null;a<=e.start&&(r+=i)}continue}if(s){if(e.start>=o.oldEnd)r+=i;else if(e.start>o.oldPosition)return null;continue}if(e.start>=o.oldEnd)r+=i;else if(e.end>o.oldPosition)return null}return{start:e.start+r,end:e.end+r}}var Ge=class extends Error{reason;constructor(e){super("Открытие документа не удалось"),this.reason=e,this.name="DocumentOpenFailedError"}},os=0,Il=Math.random().toString(36).slice(2,8);function Tl(){return os+=1,`doc-${Il}-${os}`}function Cl(e){const t=e.createBuffer(),n=e.docId??Tl();let r=e.serverId??null,s=0,o=null,i=e.attributes??{};const a=new Set;let c=!1,d=!1,u;const f=new Set;let g=null;const E=()=>(g?.version!==s&&(g={version:s,value:t.read()}),g.value),S=b=>Object.entries(b).some(([h,y])=>i[h]!==y);return{get:()=>({docId:n,serverId:r,version:s,savedVersion:o,attributes:i}),getContent:E,mutate(b,{source:h}){if(c)return s;const y=b.changes?.length?b.changes:void 0,I=y?Sl(E(),y):b.content!==void 0?b.content:void 0,A=I!==void 0&&I!==E(),D=b.attributes!==void 0&&S(b.attributes);if(!A&&!D)return s;const N=!(s>(o??-1)),m=D?Object.keys(b.attributes).filter(C=>i[C]!==b.attributes[C]):[];A&&t.write(I),D&&(i={...i,...b.attributes}),s+=1,h!=="user"&&N&&(o=s);const _={source:h,version:s,changes:y,...A?{content:!0}:{},...m.length>0?{attributes:m}:{}};return a.forEach(C=>C(_)),s},markSaved(b,h){const y={serverId:r,savedVersion:o};h!==void 0&&(r=h),(o===null||b>o)&&(o=b),(y.serverId!==r||y.savedVersion!==o)&&a.forEach(I=>I({source:"system",version:s}))},markUnsaved(){c||o===null||o<s||(o=s-1,a.forEach(b=>b({source:"system",version:s})))},markReady(){d||u!==void 0||(d=!0,f.forEach(b=>b.resolve()),f.clear(),a.forEach(b=>b({source:"system",version:s})))},isReady:()=>d,markFailed(b){d||u!==void 0||c||(u=b,f.forEach(h=>h.reject(new Ge(b))),f.clear(),a.forEach(h=>h({source:"system",version:s})))},failure:()=>u,whenReady(){return d?Promise.resolve():u!==void 0?Promise.reject(new Ge(u)):c?Promise.reject(new Error("Документ закрыт до того, как наполнение закончилось")):new Promise((b,h)=>{f.add({resolve:b,reject:h})})},subscribe(b){return a.add(b),()=>a.delete(b)},isNew:()=>r===null,isDirty:()=>s>(o??-1),isDisposed:()=>c,dispose(){c=!0,f.forEach(b=>b.reject(new Error("Документ закрыт до того, как наполнение закончилось"))),f.clear(),a.clear(),t.dispose()}}}var Al=500,Dl=100,sn=0;function Pl(e,t={}){const n=t.groupIntervalMs??Al,r=t.maxSteps??Dl,s=t.now??(()=>0);let o=[],i=0,a=sn+=1,c=null,d=!1,u=!1,f=!1;const g=new Set,E=()=>g.forEach(m=>m()),S=(m,_)=>{if(m.length){u=!0;try{e.mutate({changes:m},{source:_})}finally{u=!1}}},b=m=>S(m,"user"),h=m=>{const _=s();d&&c!==null&&_-c<n?o[i-1]=rs(o[i-1],m):(o=o.slice(0,i),o.push(m),i=o.length,d=!0,o.length>r&&(o=o.slice(o.length-r),i=o.length,a=sn+=1)),c=_,E()},y=()=>{d=!1,c=null},I=m=>{if(!m.length)return;const _=o.length>i;_&&(o=o.slice(0,i)),i>0&&(o[i-1]=rs(o[i-1],m)),y(),_&&E()},A=e.subscribe(({source:m,changes:_})=>{if(!(f||u||!_?.length)){if(m==="remote"){D();return}if(m!=="user"){I(_);return}h(_)}}),D=()=>{o=[],i=0,y(),a=sn+=1,E()},N=()=>{if(i===0)return!1;const m=yl(o[i-1]);return ss(e.getContent(),m)?(b(m),i-=1,y(),!0):(o=o.slice(0,i-1),i=o.length,y(),E(),!1)};return{canUndo:()=>i>0,canRedo:()=>i<o.length,undo(){N()&&E()},redo(){if(!(i>=o.length)){if(!ss(e.getContent(),o[i])){o=o.slice(0,i),y(),E();return}b(o[i]),i+=1,y(),E()}},clear:D,applyWithoutHistory(m){const _=e.get().version;if(S(m,"system"),e.get().version===_){y();return}I(m)},getPast:m=>o.slice(0,i).reverse().slice(0,m),getFuture:m=>o.slice(i).reverse().slice(0,m),createSnapshot:()=>({stackId:a,index:i}),restoreSnapshot(m){if(m.stackId!==a||m.index>i)return!1;for(;i>m.index;)if(!N())return E(),!1;return E(),!0},subscribe(m){return g.add(m),()=>g.delete(m)},dispose(){f=!0,A(),g.clear(),o=[],i=0}}}var Rl=["edit","move","resize","insert"];function on(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function Ol(e){return typeof e=="string"?e:null}function Ml(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string")?null:e}function Ll(e){return Rl.includes(e)?e:null}function Nl(e){const t=typeof e=="object"&&e!==null?e:{},n={originId:Ol(t.originId),changeId:on(t.changeId),rev:on(t.rev),baseRev:on(t.baseRev),expected:Ml(t.expected),intent:Ll(t.intent)};return{...n,legacy:Object.values(n).every(r=>r===null)}}var Ye=class extends Error{reason;constructor(e){super(`[emailmaker] save refused: ${e}`),this.name="SaveRefusedError",this.reason=e}},is=class extends Error{timeoutMs;constructor(e){super(`[useblocks] handleEmailAutosave did not respond within ${e}ms — the autosave was not written`),this.timeoutMs=e,this.name="IntegratorAutosaveTimeoutError"}},an=class extends Error{timeoutMs;constructor(e){super(`[useblocks] handleSaveEmail did not respond within ${e}ms — the email was not saved`),this.timeoutMs=e,this.name="IntegratorSaveTimeoutError"}};function xl(){return typeof navigator<"u"&&navigator.onLine===!1}function kl(e){if(e==null)return[];const t=[e];if(typeof e!="object")return t;const n=e;if(n.error!=null&&(t.push(n.error),typeof n.error=="object")){const r=n.error;r.data!=null&&t.push(r.data),r.error!=null&&t.push(r.error)}if(n.data!=null&&(t.push(n.data),typeof n.data=="object")){const r=n.data;r.error!=null&&t.push(r.error)}return n.innerException!=null&&t.push(n.innerException),t}function as(e){if(!e)return!1;if(typeof e=="string"){const n=e.toLowerCase();return n.includes("fetch")||n.includes("network")||n.includes("timeout")||n.includes("failed to fetch")||n.includes("load failed")||n.includes("networkerror")}if(e instanceof Error)return as(e.message);if(typeof e!="object")return!1;const t=e;return t.status==="FETCH_ERROR"||t.status==="TIMEOUT_ERROR"||t.status==="PARSING_ERROR"?!0:typeof t.status=="number"?t.status===0||t.status===408||t.status>=500:!1}function Fl(e){return xl()?!0:kl(e).some(as)}var ls=new WeakSet,cs=new WeakMap;function ds(e){typeof e=="object"&&e!==null&&ls.add(e)}function Bl(e,t){typeof e=="object"&&e!==null&&cs.set(e,t)}function jl(e){return typeof e=="object"&&e!==null?cs.get(e):void 0}function Ul(e){return e instanceof an||e instanceof is||typeof e=="object"&&e!==null&&ls.has(e)}function Hl(e){return e instanceof Ye||Ul(e)}function $l(e){return!Hl(e)&&Fl(e)}var us="draft";function Le(e){return e==null||e===""?us:String(e)}function Vl(e){return e==null||e===""?`${ln}${us}`:`${ln}${String(e)}`}var ln="block:";function ue(e){return e?.startsWith(ln)===!0}function We(e){return ue(e.sessionKey())?void 0:e.current()}function s_(e,t){}function qe(e,t,n){const r=typeof performance<"u"?performance.now():Date.now();return W(`show:gate:${e}`,{kind:"wait"}),t.then(s=>(W(`show:gate:${e}:end`,{kind:"wait"}),s),s=>{const o=Math.round((typeof performance<"u"?performance.now():Date.now())-r);throw l.isAbortError(s)?(`${e}`,{...n}):(`${e}`,{error:ts(s),...n},void 0),s})}var o_=5e3,Gl=/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/;function Yl(e){const t=e?.trim()??"";if(!Gl.test(t))return Date.parse(t);const n=t.replace(" ","T");return Math.max(Date.parse(n),Date.parse(`${n}Z`))}function ze(e){return e?.length?[...e].sort((t,n)=>Date.parse(n.modified)-Date.parse(t.modified))[0]:null}function cn(e,{freshSince:t}={}){return!(e?.isAutosave!==!0||!e?.html?.trim()||t!==void 0&&Date.parse(e.modified)<t-5e3)}function Wl(e,t={}){const n=ze((e??[]).filter(r=>r?.html?.trim()));return cn(n,t)?n:null}function ql(e,t){const n=Date.parse(ze(e)?.modified??""),r=Wl(e),s=Date.parse(r?.modified??""),o=t===void 0||Number.isFinite(s)&&s>t,i=[n,t??NaN].filter(a=>Number.isFinite(a));return{autosave:o?r:null,...i.length?{latestAt:Math.max(...i)}:{}}}function fs(e,t,n){const r=ze((e??[]).filter(c=>c?.html?.trim())),s=Date.parse(r?.modified??""),o=Date.parse(ze((n??[]).filter(c=>c?.html?.trim()))?.modified??""),i=r&&Number.isFinite(s)&&(t===void 0||s>t)&&!(o>s),a=[Date.parse(ze(e??[])?.modified??""),t??NaN].filter(c=>Number.isFinite(c));return{autosave:i&&cn(r)?r:null,...a.length?{latestAt:Math.max(...a)}:{}}}function zl({hasUnsavedUserEdit:e}){return e?"skip":"apply"}var ps=e=>e.replace(/\r\n?/g,`
|
|
2103
|
+
`),hs=["recovery","plugin","rest"],Kl=["subject","preheader"];function Xl(e){let t={},n;for(let s=hs.length-1;s>=0;s--){const o=e.get(hs[s]);o&&(o.attributes&&(t={...t,...o.attributes}),o.content!==void 0&&(n=o.content))}const r=e.get("plugin")?.attributes;for(const s of Kl){const o=r?.[s];typeof o=="string"&&o!==""&&(t={...t,[s]:o})}return n!==void 0?{content:n,attributes:t}:{attributes:t}}function dn(e,t){if(!e||!t)return;const n=e.getContent(),r=t.content!==void 0?ps(t.content):void 0,s=r!==void 0&&r!==n;e.get().docId,Object.keys(t.attributes??{}),e.mutate({attributes:t.attributes??{},...s?{changes:[new ae(0,n,0,r)]}:{}},{source:"remote"})}var un=e=>typeof e=="string"?e.trim():"";function Jl(e,t,n,r){const{version:s,attributes:o}=e.get(),i=o,a=r==="snapshot"||r==="anchor",c=a?i.author:void 0,d=a?i.date_gmt:void 0,u=un(i.title)||un(i.subject)||un(t.fallbackTitle);return{version:s,payload:{html:e.getContent(),title:u,subject:i.subject,preheader:i.preheader,description:i.description,common_styles:i.common_styles||"",meta:i.meta,utm_parameters:i.utm_parameters,parent_email:i.parent_email,is_template:i.is_template||!1,is_inited:i.is_inited,tags:i.tags,emailtags:i.emailtags,group:i.group,renderGuid:e.get().docId,project:t.project??i.project,folder:t.folder,...n?.emailtags?{emailtags:n.emailtags}:{},...n?.group?{group:n.group}:{},source:t.source,...c!=null&&c!==""?{author:c}:{},...d?{excerpt:d}:{}}}}var Ql=["meta","title","author","project","html","excerpt","subject","preheader","common_styles","parent_email"];function Zl(e){const t={};for(const n of Ql)e[n]!==void 0&&(t[n]=e[n]);return t.excerpt||(t.excerpt=new Date().toISOString()),t}async function ec(e,t,n,r,s){if(n==="materialize"&&r!=null)throw new Error("Письмо уже создано на сервере");if(n==="materialize"||n==="publish"&&r==null)return e.createEmail(s);if(r==null)throw new Error("Письмо ещё не создано на сервере");return n==="publish"?e.updateEmail(r,s):t.saveAutosave(r,s)}function Ee(e,t=!1){const n={};for(const r of Object.keys(e)){let s=e[r];s!==void 0&&!(typeof s=="number"&&Number.isNaN(s))&&(t&&typeof s=="object"&&s!==null&&(s=Ee(s)),n[r]=s)}return n}function tc(e){return typeof e=="string"&&e.includes("autosave")}var nc=new Set(["html","id","renderGuid","showToken","showId","isNew"]);function ms(e){return e?Object.fromEntries(Object.entries(e).filter(([t])=>!nc.has(t))):{}}function Ke(e,t,n={}){e&&e.mutate({attributes:rc(e.get().attributes,t)},{source:n.source??"user"})}function rc(e,t){return t.subject===void 0||t.title!==void 0?t:(e.title??"")===(e.subject??"")?{...t,title:t.subject}:t}function fn(e,t){return e===void 0&&Object.keys(t).length===0?null:{...e!==void 0?{content:e}:{},attributes:t}}function sc(e){return typeof e=="string"&&e.startsWith("{")?e:"{}"}function gs(e){if(!e)return null;const t=ms(e);return e.common_styles!==void 0&&(t.common_styles=sc(e.common_styles)),fn(e.html,t)}function Es(e){return e?fn(e.html,Ee(ms(e))):null}var oc=["common_styles","subject","preheader","meta"];function vs(e){if(!e?.html?.trim())return null;const t={};for(const n of oc)ic(n,e[n])&&(t[n]=e[n]);return fn(e.html,t)}function ic(e,t){return e==="common_styles"?typeof t=="string"&&t.startsWith("{"):e==="meta"?typeof t=="object"&&t!==null&&!Array.isArray(t):typeof t=="string"}var ac=["modified","lock"];function lc(e){if(!e)return null;const t={};for(const n of ac)e[n]!==void 0&&(t[n]=e[n]);return Object.keys(t).length===0?null:{attributes:t}}var cc=10,dc=(e,t)=>e.key===t.key&&uc(e.serverId,t.serverId),uc=(e,t)=>e==null||e===t;function fc(e){return typeof e?.then=="function"}var _s=e=>{e.timer!==void 0&&(clearTimeout(e.timer),e.timer=void 0)},bs=e=>{e.request.serverId!=null&&!pn(e)&&(e.document.markSaved(e.document.get().version),e.savedContent=e.document.getContent())},pc=e=>e.document.get().serverId!=null&&!e.document.getContent().trim()&&!!(e.savedContent??e.lastMerged?.content??"").trim(),pn=e=>e.document.get().savedVersion!==null&&e.document.isDirty(),ys=(e,t)=>t?.content!==void 0&&zl({hasUnsavedUserEdit:pn(e)})==="skip",hc=e=>e.document.subscribe(t=>{t.source==="user"&&(t.content&&e.userTouched.add("content"),t.attributes?.forEach(n=>e.userTouched.add(n))),e.document.isDirty()||e.userTouched.clear()}),mc=(e,t)=>{!e.ready||t.content===void 0||e.document.get().serverId==null||(e.contentShown=!0,!(![...e.userTouched].every(n=>n==="content"||n in(t.attributes??{}))||!e.document.isDirty())&&(e.document.markSaved(e.document.get().version),e.savedContent=e.document.getContent(),e.userTouched.clear(),e.document.get().docId))},gc=(e,t)=>{if(!e)return t;const n=Object.fromEntries(Object.entries(t.attributes).filter(([s,o])=>e.attributes[s]!==o)),r=t.content!==void 0&&t.content!==e.content?t.content:void 0;return r===void 0&&Object.keys(n).length===0?null:r===void 0?{attributes:n}:{content:r,attributes:n}},Ec=e=>{const t=Xl(e.reports),n=gc(e.lastMerged,t);e.lastMerged=t,n&&(dn(e.document,n),bs(e))},hn=(e,t)=>{if(!e.ready&&!pn(e)){Ec(e);return}dn(e.document,t)},vc=e=>{const{attributes:t,serverId:n,docId:r}=e.document.get();return{...t,html:e.document.getContent(),id:n??void 0,isNew:n==null,renderGuid:r}};function _c(e){const{resolveAdapters:t,timeoutMs:n,resolveWritePort:r,resolveHistoryPort:s,resolveTerms:o,canEdit:i,notifyBeforeSave:a,onAdapterError:c,onTimeout:d}=e;let u;const f=new Set,g=new Set,E=()=>f.forEach(p=>p()),S=(p,v)=>{if(!(p.closed||p.ready)){if(p.error!==void 0){p.document.markFailed(p.error),p.document.get().docId;return}bs(p),p.ready=!0,p.document.markReady(),p.document.get().docId,[...p.reports.keys()]}},b=(p,v,T)=>{c?.(v.id,T),!(!v.required||p.closed)&&(p.error=T,p.document.get().docId,v.id,E())},h=(p,v)=>{const T=new Set(v.map(w=>w.id));v.forEach(w=>{w.watch&&p.watchers.push(w.watch(P=>p.closed?!1:p.ready&&(ys(p,P)||p.contentShown===!0&&P?.content!==void 0)?(p.document.get().docId,w.id,!1):(P&&p.reports.set(w.id,P),hn(p,P),!0)))});const L=(w,P)=>{if(!p.closed){if(!w.required&&ys(p,P)){p.document.get().docId,w.id,w.loaded?.(!1);return}P&&p.reports.set(w.id,P),hn(p,P),w.loaded?.(P!==null)}},O=()=>{T.size>0||p.closed||(_s(p),S(p,[]))},F=[];if(v.forEach(w=>{let P;try{P=w.load()}catch(k){b(p,w,k),T.delete(w.id);return}if(fc(P)){F.push({id:w.id,required:w.required,load:()=>P,...w.loaded?{loaded:k=>w.loaded?.(k)}:{}});return}L(w,P),T.delete(w.id)}),F.length===0){O();return}p.timer=setTimeout(()=>{p.timer=void 0,d?.([...T]),p.document.get().docId,[...T],S(p,[...T])},n),p.timer.unref?.(),F.forEach(w=>{w.load().then(P=>L(w,P)).catch(P=>{b(p,w,P)}).finally(()=>{T.delete(w.id),O()})})},y=async(p,v,T)=>{if(T==="snapshot"||T==="anchor")return;const L=o?.();if(L)return L.resolve({project:v.project??p.project,tags:(p.tags??[]).map(O=>({name:O}))})},I=p=>{if(p.lock===!0&&i?.(p)===!1)return new Ye("locked");const v=p.tags?.length??0,T=p.emailtags?.length??0;if(Math.max(v,T)>cc)return new Ye("too-many-tags")},A=(p,v)=>{const T=p.document.get().serverId;v||T==null||(p.recoveryFacts={emailId:T,historyLoaded:!0,isRecovering:!1},ue(p.request.key)||(p.request={...p.request,key:Le(T),serverId:T}))},D=(p,v,T)=>{if(p.closed||T?.id==null)return;const L=p.document.get().serverId,O=L!=null;O&&L!==String(T.id)||(p.document.markSaved(v,String(T.id)),A(p,O),p.document.get().serverId,E())},N=async(p,v,T)=>{try{await p.document.whenReady()}catch(P){return p.saveError=P,p.saveFailures+=1,p.failedIntent=v,p.saveFailures,!1}if(p.closed)return!1;const L=I(p.document.get().attributes);if(L)return p.saveError=L,p.saveFailures+=1,p.failedIntent=v,L.reason,E(),!1;if(a&&(await a(vc(p)).catch(()=>{}),p.closed))return!1;if(pc(p))return v==="snapshot"||(p.saveError=new Ye("empty-content"),p.saveFailures+=1,p.failedIntent=v,E()),!1;let O;try{O=await y(p.document.get().attributes,T,v)}catch(P){return p.saveError=P,p.saveFailures+=1,p.failedIntent=v,p.saveFailures,E(),!1}if(p.closed)return!1;const{payload:F,version:w}=Jl(p.document,T,O,v);p.document.get().docId;try{const P=p.document.get().serverId!=null,k=await ec(r(),s(p.request.key),v,p.document.get().serverId,F);if(p.closed)return!0;let K;if(v==="snapshot"||v==="anchor"){const J=k?.modified!=null?Date.parse(k.modified):NaN;K=Number.isFinite(J)?J:Date.now(),p.snapshotVersion=w,p.lastRevisionAt=K}else p.document.markSaved(w,k?.id!=null?String(k.id):void 0),p.savedContent=F.html;A(p,P),p.saveError=void 0,p.saveFailures=0,p.failedIntent=void 0,p.document.get().serverId,E();const re={intent:v,serverId:p.document.get().serverId,created:!P,...K!==void 0?{revisionAt:K}:{}};return g.forEach(J=>J(re)),!0}catch(P){return(v==="publish"||v==="materialize")&&jl(P)?.then(k=>D(p,w,k)),p.saveError=P,p.saveFailures+=1,p.failedIntent=v,p.saveFailures,E(),!1}},m=()=>{u&&(u.closed=!0,u.watchers.forEach(p=>p()),u.watchers=[],_s(u),u.history.dispose(),u.document.dispose(),u=void 0)},_=(p,v,T)=>{let L=!1;v.show&&(p.show?.id!==v.show.id||p.show.token!==v.show.token)&&(p.show=v.show,L=!0,{docId:p.document.get().docId,...v.show});const O=T==="show"?Es(v.patch):null;O&&(p.reports.set("plugin",O),hn(p,O),mc(p,O)),L&&E()},C=(p,v={})=>{const T=u;return!T||T.closed||p==="materialize"&&T.document.get().serverId!=null?Promise.resolve(!1):T.saving?p==="snapshot"||p==="materialize"?Promise.resolve(!1):(T.inFlight??Promise.resolve(!1)).then(()=>C(p,v)):(T.saving=!0,E(),T.inFlight=N(T,p,v).finally(()=>{T.saving=!1,T.inFlight=void 0,u===T&&!T.closed&&E()}),T.inFlight)},M=(p,v="open")=>{if(u&&!u.closed&&v!=="new"&&dc(u.request,p))return _(u,p,v),u.document;m();const T=Cl({createBuffer:()=>vl(""),serverId:p.serverId??null}),L={request:p,show:p.show,document:T,history:Pl(T,{now:Date.now}),watchers:[],userTouched:new Set,saveFailures:0,saving:!1,reports:new Map,ready:!1,closed:!1};return u=L,L.watchers.push(hc(L)),T.get().docId,p.serverId,h(L,t(p,{publishRecoveryFacts(O){L.closed||(L.recoveryFacts=O,E())},readShownContent:()=>L.closed?null:L.document.getContent()})),E(),T};return{openWith:M,open:(p,v={})=>M({key:Le(p),serverId:p,email:v.email,patch:v.patch,show:v.show},"open"),openDraft:(p,v={})=>M({key:Le(void 0),serverId:null,email:p,patch:v.patch,show:v.show},"open"),startNewDraft:(p,v={})=>M({key:Le(void 0),serverId:null,email:p,patch:v.patch,show:v.show},"new"),reload:(p,v={})=>M({key:Le(p),serverId:p,email:v.email,patch:v.patch,show:v.show},"new"),openBlock:(p,v)=>M({key:ue(p)?p:Vl(p),serverId:v?.id!=null?String(v.id):null,email:v},"open"),show:(p,v)=>{const T=u;if(!(!T||T.closed))return M({...T.request,patch:p,show:v},"show")},current:()=>u?.document,noteServerFacts:({serverId:p,block:v},T)=>{const L=u;!L||L.closed||L.request.serverId!==p||ue(L.request.key??"")===v&&dn(L.document,lc(T))},save:C,saveState:()=>({error:u?.saveError,failures:u?.saveFailures??0,saving:u?.saving===!0,failedIntent:u?.failedIntent}),revisionFacts(){if(!u)return;const p=u.revisionFactsSnapshot;return p&&p.snapshotVersion===u.snapshotVersion&&p.lastRevisionAt===u.lastRevisionAt?p:(u.revisionFactsSnapshot={snapshotVersion:u.snapshotVersion,lastRevisionAt:u.lastRevisionAt},u.revisionFactsSnapshot)},recoveryFacts:()=>u?.recoveryFacts,history:()=>u?.history,forcedHeaders:()=>u?.forcedHeaders,beginForcedHeaders(p){u&&!u.closed&&(u.forcedHeaders=p)},endForcedHeaders(){u&&(u.forcedHeaders=void 0)},onSaved(p){return g.add(p),()=>g.delete(p)},showFacts:()=>u?.show,sessionKey:()=>u?.request.key,openError:()=>u?.error,subscribe(p){return f.add(p),()=>f.delete(p)},close(){u&&(m(),E())}}}var mn=class extends Error{reason;constructor(e,t){super(`письмо не открылось: ${e}`),this.name="EmailOpenFailedError",this.reason=e,this.cause=t}};function gn(e){if(e instanceof mn)return e.reason;if(e instanceof Ge)return gn(e.reason)}function bc(e){const t=e instanceof Ge?e.reason:e;return t instanceof mn&&t.reason==="unavailable"&&t.cause instanceof TypeError}function yc(e){const t=gn(e);return t==="forbidden"||t==="not-found"}function Sc(e,t){return{id:"rest",required:!0,load:async()=>{const n=await e.readEmail(t);if(!n)throw new mn("not-found");return gs(n)}}}var Ss=l.createIdentifier$1("EmailPort");function wc(e){return e.getInstance(Ss)}function Ic(e,t){e.inject(Ss,t)}var ws=l.createIdentifier$1("documentSession.restEmailPortFactories");function Is(e){return e.getInstance(ws)!==void 0}function Se(e){const t=e.getInstance(ws);if(!t)throw new Error("[documentSession] порты поверх REST ещё не загружены — работа с сервером начинается с init()");return t}var Tc=l.createIdentifier$1("EmailTermsResolver");function Cc(e){return e.getInstance(Tc)}var Ts=l.createIdentifier$1("EmailHistoryPort"),Ac=l.createIdentifier$1("BlockHistoryPort");function Cs(e){return e.getInstance(Ac)}function As(e){return e.getInstance(Ts)}function Dc(e,t){e.inject(Ts,t)}var Pc="em_autosave_pending",i_=6e4;function bt(e){return`${Pc}_${e}`}function Rc(e,t){try{sessionStorage.setItem(bt(e),JSON.stringify(t))}catch{}}function Ds(e){try{const t=sessionStorage.getItem(bt(e));if(!t)return null;const n=JSON.parse(t);return Date.now()-n.sentAt>6e4?(sessionStorage.removeItem(bt(e)),null):n}catch{return null}}function Xe(e){try{sessionStorage.removeItem(bt(e))}catch{}}var Oc=2e3,Mc=5e3,Lc=5,Nc=5e3,xc=4;function kc(){return typeof performance<"u"&&typeof performance.timeOrigin=="number"?performance.timeOrigin:Date.now()}function Fc(e,t){return e==null||t==null?!1:e.replaceAll(`\r
|
|
2104
2104
|
`,`
|
|
2105
2105
|
`)===t.replaceAll(`\r
|
|
2106
2106
|
`,`
|
|
2107
|
-
`)}function En(e,t){return cn(e.autosave,t===void 0?{}:{freshSince:t})?e.autosave:null}function Fc({emailId:e,readAutosave:t,revisionServiceEnabled:n,isHistoryAvailable:r,readShownContent:s,onFacts:o,onLate:i,onError:a,pageLoadTs:c=xc()}){let d=null,u=!1,f=!1,g=0,E={emailId:e,historyLoaded:!1,isRecovering:!1},S=null;const b=new Promise(O=>{S=O}),h=O=>{E={...E,...O},o(E)};let y;const w=O=>{g+=1,h({applied:{phase:O,seq:g}})},A=()=>{d?.timer&&clearTimeout(d.timer),d=null},D=O=>{if(!f){if(S){const F=S;S=null,F(O),y=O.revision?O.phase:void 0;return}i(O)&&O.revision&&w(O.phase)}},N=()=>{if(!d||f)return;const O=d.phase==="fast",F=O?Rc:Lc,I=O?Mc:Nc;d.timer=setTimeout(()=>{const P=d;if(!(!P||f)){if(P.attempts+=1,M(),O&&P.attempts>=I){const{pending:x}=P;Xe(e),h({isRecovering:!1}),D({revision:{html:x.html,common_styles:x.common_styles,subject:x.subject,preheader:x.preheader},phase:"timeout"}),u=!0,P.phase="bg",P.attempts=0,N();return}if(!O&&P.attempts>=I){Xe(e),A(),h({isRecovering:!1}),u=!0;return}N()}},F),d.timer.unref?.()},m=O=>{d={phase:"fast",attempts:0,pending:O,timer:null},h({isRecovering:!0}),N()},_=O=>{if(f)return;if(h({historyLoaded:!0,latestRevisionAt:O.latestAt!==void 0&&Number.isFinite(O.latestAt)?O.latestAt:void 0}),n&&d){const P=En(O,d.pending.sentAt);if(!P)return;const x=d.phase==="fast"?"found":"bg";Xe(e),A(),h({isRecovering:!1}),u=!0,D({revision:P,phase:x});return}if(u)return;const F=n?Ds(e):null,I=F&&(F.sentAt<c||!kc(F.html,s()))?F:null;if(I){const P=En(O,I.sentAt);if(P){Xe(e),u=!0,D({revision:P,phase:"found"});return}m(I);return}u=!0,D({revision:En(O),phase:"normal"})},C=O=>{f||(a?.(O),E.historyLoaded||(h({historyLoaded:!1,latestRevisionAt:void 0}),T()),!d&&D({revision:null,phase:"normal"}))},M=()=>t(e).then(_).catch(C);let p,v=!1;const T=()=>{v||d||f||(v=!0,p=setTimeout(()=>{p=void 0,!f&&!E.historyLoaded&&M()},Oc))},L=()=>{f||(h({historyLoaded:!1,latestRevisionAt:void 0}),D({revision:null,phase:"normal"}))};return r?r().then(O=>O?M():L()):M(),{verdict:()=>b,confirmVerdict(O){const F=y;y=void 0,O&&F!==void 0&&!f&&w(F)},dispose(){f=!0,p!==void 0&&(clearTimeout(p),p=void 0),A()}}}function Bc({port:e,revisionServiceEnabled:t,isHistoryAvailable:n,emailId:r,readShownContent:s,onFacts:o}){let i=null;const a=Fc({emailId:r,readAutosave:c=>e.readAutosave(c),revisionServiceEnabled:t,...n?{isHistoryAvailable:n}:{},readShownContent:s,onFacts:o,onLate:({revision:c,phase:d})=>{const u=vs(c);return i?.(u)??!1},onError:c=>{c instanceof Error&&c.message}});return{id:"recovery",load:()=>a.verdict().then(({revision:c})=>vs(c)),loaded(c){a.confirmVerdict(c)},watch(c){return i=c,()=>{i=null,a.dispose()}}}}function Ps(e,t){return{readRevisions:(n,r)=>t.readRevisions(n,r),readAutosave:n=>t.readAutosave(n),async saveAutosave(n,r){Pc(n,{sentAt:Date.now(),html:r.html??"",common_styles:r.common_styles??"",subject:r.subject,preheader:r.preheader});const s=await t.saveAutosave(n,r);return await e.saveAutosave(n,r),s}}}function jc(e,t){return{readEmail:n=>e.readEmail(n),createEmail:n=>e.createEmail(n),async updateEmail(n,r){const s=Date.now(),o=await t.updateEmail(n,r);return await e.updateEmail(n,r),(Ds(n)?.sentAt??Number.POSITIVE_INFINITY)<=s&&Xe(n),o}}}var Rs=l.createIdentifier$1("CurrentUser"),Os={};function vn(e){return e.getOrCreateInstance(Rs,()=>ce(Os))}function Ms(e){return e?.getInstance(Rs)?.get()??Os}var Ls=l.createIdentifier$1("HeadlessMode");function Ns(e){return e.getOrCreateInstance(Ls,()=>ce(!1))}function Uc(e){return e?.getInstance(Ls)?.get()??!1}var Hc=l.createIdentifier$1("HiddenMount");function $c(e){return e.getOrCreateInstance(Hc,()=>ce(!1))}function Vc(e){if(!e)return!1;try{return!!l.decodeJwt(e).data?.act_as}catch{return!1}}function Gc(e){return Vc(e?.getInstance(l.COOKIE_MANAGER_ID)?.get(l.APP_COOKIES.em_token))}function xs(e){return e?.getInstance(l.CONFIG_SOURCE_ID)?.get()??{}}function yt(e,t){return e.user.mode||e.serverSide.mode||t||"pro"}function Yc(e,t){return t.modeDefaults(yt(e,t.fallbackMode))}function ks(e,t){const n=yt(e,t);return e.serverSide.advancedConfigs?.[n]||{}}function Fs(e,t){const n=yt(e,t),r=e.user?.advancedConfigs?.[n],s=r!==void 0?r:e.user?.advancedConfigs?.pro;return{...e.advancedConfigs?.[n],...s}}function Wc(e){let t;for(const n of e)n?.fileManager&&(t={...t,...n.fileManager});return t}function qc(e){return l.mergeResourceProxyLayers(e.map(t=>t?.resourceProxy))}function zc(e){return l.mergeResourceProxyPolicyLayers(e.map(t=>t?.resourceProxyPolicy))}function Kc(e){return l.mergeBackendProxyLayers(e.map(t=>t?.backendProxy))}function Xc(e){return l.mergeShallowConfigLayers(e.map(t=>t?.backendProxyPolicy||{}).filter(Boolean))}function Jc(e,t){return[e.base,Yc(e,t),e.profile,e.serverSide,ks(e,t.fallbackMode),e.local,e.user,Fs(e,t.fallbackMode)]}function _n(e,t){const n=Jc(e,t),r=l.mergeShallowConfigLayers(n),s=Wc(n);s!==void 0&&(r.fileManager=s);const o=qc(n);o!==void 0&&(r.resourceProxy=o);const i=zc(n);i&&Object.keys(i).length>0&&(r.resourceProxyPolicy=i);const a=Kc(n);a!==void 0&&(r.backendProxy=a);const c=Xc(n);return c&&Object.keys(c).length>0&&(r.backendProxyPolicy=c),r}function Qc(e,t,n){const r=ks(e,n),s=Fs(e,n);return l.pickKey([s,e.user,r,e.serverSide],t)}var Zc=1.5;function ed(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<=Zc*e.autosaveTimeoutMs?"none":"revision"}var o_=5,i_=3;function td(e){const{readDocument:t,readEnvironment:n,onCreate:r,onRevision:s}=e,o=e.readFailures??(()=>0),i=e.readFailureRetryable??(()=>!0);let a;const c=_=>a!==void 0&&a.version===_.get().version?o()-a.failuresAtStart:0,d=_=>{const C=c(_);if(C<=0)return!1;const M=n().retryMaxAttempts??5;return!i()||C>M},u=()=>{const{autosaveTimeoutMs:_,retryIntervalMs:C}=n(),M=t();return M!==void 0&&c(M)>0&&C!==void 0&&C>0?C:_},f=_=>_.isNew()&&o()>=3,g=()=>{const _=t();if(!_||_.isDisposed()||d(_))return"none";const{latestRevisionAt:C,snapshotVersion:M,...p}=n(),v=Date.now(),T=ed({...p,isDirty:_.isDirty(),isNew:_.isNew(),isReady:_.isReady(),latestRevisionAgeMs:C!=null&&C<=v?v-C:void 0,isSnapshotSent:M!=null&&M===_.get().version});return T==="create"&&f(_)?"none":T},E=()=>{const _=t();if(!_||_.isDisposed()||f(_)||d(_)||n().isHeadless)return!1;if(!_.isDirty())return _.isNew();const{snapshotVersion:C}=n();return!(C!=null&&C===_.get().version)};let S,b,h,y,w=!1;const A=()=>{b=void 0;const _=t();if(!_||_.isDisposed())return;if(_.get().docId!==S){D();return}const C=g();C!=="none"&&a?.version!==_.get().version&&(a={version:_.get().version,failuresAtStart:o()}),C==="create"?r():C==="revision"?s():E()&&(S=_.get().docId,b=setTimeout(A,u()))},D=()=>{const _=t();w||!_||b!==void 0||g()==="none"&&!E()||(S=_.get().docId,b=setTimeout(A,u()))},N=_=>{_.source==="user"&&b!==void 0&&(clearTimeout(b),b=void 0),D()},m=()=>{const _=t();_!==h&&(y?.(),h=_,a=void 0,y=_?.subscribe(N),b!==void 0&&(clearTimeout(b),b=void 0))};return m(),D(),{refresh:()=>{w||(m(),D())},stop:()=>{w=!0,y?.(),y=void 0,h=void 0,b!==void 0&&(clearTimeout(b),b=void 0)}}}var Bs=l.createIdentifier$1("documentSession.autosaveUiFacts"),js={isUserBusy:!1,saveContext:{}};function nd(e){return e.getOrCreateInstance(Bs,()=>ce(js))}function bn(e){return e?.getInstance(Bs)?.get()??js}function Us(e){return bn(e).saveContext.fallbackTitle||"Untitled email."}var rd=1e4,sd=3e4;function od(e,t){const n=u=>{const f=e.getInstance(l.CONFIG_SOURCE_ID)?.layers?.(),g=f?Qc(f,u):void 0;return typeof g=="number"&&g>=0?g:void 0},r=()=>{const u=t.current(),f=u?.get().serverId??void 0,g=de(t.sessionKey()),E=t.recoveryFacts(),S=E?.emailId===f?E:void 0,b=t.revisionFacts(),h=S?.latestRevisionAt,y=b?.lastRevisionAt,w=Ms(e).profile;return{isInited:g||u?.get().attributes.is_inited===!0,isEnabled:!!w?.autosaves&&!Gc(e),isHistoryLoaded:S?.historyLoaded===!0,isUserBusy:bn(e).isUserBusy,isHeadless:Uc(e),autosaveTimeoutMs:xs(e).autosaveTimeout||rd,latestRevisionAt:h!==void 0||y!==void 0?Math.max(h??0,y??0):void 0,snapshotVersion:b?.snapshotVersion,retryIntervalMs:n("autosaveRetryIntervalMs")??sd,retryMaxAttempts:n("autosaveRetryMaxAttempts")}},s=()=>{const u=bn(e).saveContext;return{...u,project:u.project??t.current()?.get().attributes.project,fallbackTitle:Us(e)}},o=td({readDocument:()=>t.current(),readEnvironment:r,readFailures:()=>t.saveState().failures,readFailureRetryable:()=>Hl(t.saveState().error),onCreate:()=>{de(t.sessionKey())||t.save("materialize",s())},onRevision:()=>{t.save("snapshot",{project:s().project})}}),i=t.subscribe(o.refresh),a=vn(e).watch(()=>o.refresh()),c=nd(e).watch(()=>o.refresh()),d=Ns(e).watch(()=>o.refresh());return()=>{i(),a.dispose(),c.dispose(),d.dispose(),o.stop()}}var Hs=12e3;function Ee(e){return e.getOrCreateInstance(tn,()=>{const t=vc({resolveAdapters:(r,s)=>ld(r,e,s),resolveWritePort:()=>$s(e),resolveHistoryPort:r=>de(r)?Gs(e):Vs(e),resolveTerms:()=>Tc(e),canEdit:r=>al(e,r),notifyBeforeSave:hl(e),timeoutMs:Hs,onAdapterError:(r,s)=>{s instanceof Error&&s.message;const o=bc(s),i=_c(s);Ve(s,{origin:"email-source-adapter",tags:{source:r,expected_refusal:String(o),network_failure:String(i)},level:o||i?"warning":"error"})},onTimeout:r=>{}}),n=od(e,t);return e.getInstance(l.DISPOSABLE_ID)?.addDispose(n),t})}function yn(e){return e?.getInstance(tn)}function $s(e){const t=Sc(e);return t?Sn(e)?jc(t,Se(e).email(e)):t:Se(e).email(e)}function id(e){return As(e)!==void 0||ws(e)}function Vs(e){const t=As(e);return t?Sn(e)?(W("port:history:server-backed"),Ps(t,Se(e).history(e))):(W("port:history:integrator"),t):(W("port:history:rest (порт не зарегистрирован)"),Se(e).history(e))}function Gs(e){const t=Cs(e);return t?Sn(e)?(W("port:block-history:server-backed"),Ps(t,Se(e).blockHistory(e))):(W("port:block-history:integrator"),t):(W("port:block-history:rest (порт не зарегистрирован)"),Se(e).blockHistory(e))}function ad(e){return Cs(e)!==void 0||ws(e)}function Sn(e){return qr(e)}function ld({email:e,patch:t,serverId:n,key:r},s,o){const i=[];e?i.push({id:"rest",load:()=>gs(e),required:!0}):n&&i.push(yc($s(s),n)),t&&i.push({id:"plugin",load:()=>Es(t)});const a=de(r);return ml(n)&&(a?ad(s):id(s))&&i.push(Bc({port:a?Gs(s):Vs(s),revisionServiceEnabled:qr(s),...!a&&ll(s)?{isHistoryAvailable:()=>cl(s)}:{},emailId:n,readShownContent:()=>o.readShownContent(),onFacts:c=>o.publishRecoveryFacts(c)})),i}function Z(e){return e.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService)}var Ys=new WeakMap,In=new WeakMap;function ue(e){return Ys.get(e)??0}function wn(e,t){let n=In.get(e);return n||(n=new Set,In.set(e,n)),n.add(t),()=>{n?.delete(t)}}function cd(e){Ys.set(e,ue(e)+1),In.get(e)?.forEach(t=>t())}function dd(e){const t=Ee(e),n=Z(e).addListener(l.EVENT_TYPES.APPLICATION_HAS_AMP,r=>{We(t)?.mutate({attributes:{isAmp:r}},{source:"remote"})});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>n.dispose())}function ud(e){return e.size>0&&(e.type===""||e.type.startsWith("image/"))}function fd(e){const t=e.fetchImpl??((o,i)=>fetch(o,i)),n=e.pageHost??(()=>window.location.hostname),r=new Set,s=o=>{try{const i=new URL(o,window.location.href);return i.protocol!=="https:"&&i.protocol!=="http:"?!1:i.hostname===n()||e.sourceHosts().includes(i.hostname)}catch{return!1}};return{accepts:s,async load(o){if(!s(o))return;const i=!r.has(o);r.add(o);try{const a=await t(o,{mode:"cors",credentials:"omit",cache:i?"no-cache":"default"});if(!a.ok)return;const c=await a.blob();return ud(c)?c:void 0}catch{return}}}}var Ie={maxBytes:67108864,maxImageBytes:4194304,ttlMs:18e5};function pd(e){const t={maxBytes:e.maxBytes??Ie.maxBytes,maxImageBytes:e.maxImageBytes??Ie.maxImageBytes,ttlMs:e.ttlMs??Ie.ttlMs},n=e.now??(()=>Date.now()),r=new Map,s=new Map,o={hits:0,loads:0,failures:0};let i=0;const a=f=>{const g=r.get(f);g&&(i-=g.bytes,r.delete(f))},c=f=>t.ttlMs<=0||n()-f.storedAt<t.ttlMs,d=()=>{if(i<=t.maxBytes)return;const f=[...r.entries()].sort((g,E)=>g[1].usedAt-E[1].usedAt);for(const[g]of f){if(i<=t.maxBytes)return;a(g)}},u=(f,g)=>{g.size>t.maxImageBytes||(r.set(f,{blob:g,bytes:g.size,storedAt:n(),usedAt:n()}),i+=g.size,d())};return{async get(f){const g=r.get(f);if(g&&c(g))return g.usedAt=n(),o.hits+=1,g.blob;g&&a(f);const E=s.get(f);if(E!==void 0)return E;o.loads+=1;const S=(async()=>{try{const b=await e.load(f);return b?u(f,b):o.failures+=1,b}catch{o.failures+=1;return}finally{s.delete(f)}})();return s.set(f,S),S},forget(f){a(f),s.delete(f)},configure(f){Object.assign(t,{maxBytes:f.maxBytes??t.maxBytes,maxImageBytes:f.maxImageBytes??t.maxImageBytes,ttlMs:f.ttlMs??t.ttlMs});for(const[g,E]of r)E.bytes>t.maxImageBytes&&a(g);d()},clear(){r.clear(),s.clear(),i=0},stats(){return{entries:r.size,bytes:i,...o}}}}var hd=["emcdn.ru","scr.emcdn.ru"];function md(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 gd(e,t){const n=(r,s)=>{const o=new Set(s?t:[]);for(const i of r){const a=md(i);a&&o.add(a)}return[...o]};return e?Array.isArray(e)?n(e,!0):n(e.value??[],e.replace!==!0):[...t]}function Ed(e){const t=e??{},n=t.isPlugin!==!0?hd:[],r=t.canvasImageCache;if(r===!1)return{enabled:!1,sourceHosts:[],...Ie};const s=r===!0||r===void 0?{}:r;return{enabled:s.enabled!==!1,sourceHosts:gd(s.sourceHosts,n),maxBytes:s.maxBytes??Ie.maxBytes,maxImageBytes:s.maxImageBytes??Ie.maxImageBytes,ttlMs:s.ttlMs??Ie.ttlMs}}function vd(e){const t=Z(e),n=e.getInstance(l.CONFIG_SOURCE_ID),r=()=>Ed({...n?.get(),isPlugin:!0});let s=r();const o=fd({sourceHosts:()=>s.sourceHosts}),i=pd({load:b=>o.load(b),maxBytes:s.maxBytes,maxImageBytes:s.maxImageBytes,ttlMs:s.ttlMs}),a=()=>{t.send(l.EVENT_TYPES.SANDBOX_CANVAS_IMAGE_CACHE_SETUP,{enabled:s.enabled,sourceHosts:[...s.sourceHosts]})},c=t.onInit(()=>a()),d=n?.watch(()=>{const b=r(),h=JSON.stringify(b)!==JSON.stringify(s);s=b,i.configure(b),b.enabled||i.clear(),h&&t.isInited()&&a()}),u={asked:0,served:0,refused:0},f=[],g=(b,h)=>(u.refused+=1,f.push({url:b,reason:h}),f.length>20&&f.shift(),{refused:!0}),E=Object.assign(globalThis,{__emmCanvasImages__:()=>({settings:s,counters:{...u},refusals:[...f],store:i.stats()})}),S=t.addListenerAsync(l.EVENT_TYPES.APPLICATION_CANVAS_IMAGE_GET,async b=>{const h=b?.url??"";if(u.asked+=1,!s.enabled||!h)return g(h,"disabled");if(!o.accepts(h))return g(h,"host");b.fresh&&i.forget(h);const y=await i.get(h);return y?(u.served+=1,{blob:y}):g(h,"load-failed")});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{c.dispose(),d?.dispose(),S.dispose(),i.clear(),delete E.__emmCanvasImages__})}var _d=2e3;function bd(e){const t=Z(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=g=>{g.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 f=setTimeout(()=>{n.get(i)===f&&n.delete(i),!(c||!t.hasPort(i,a.port1))&&(Ve(new Error("canvas port did not come up, staying on window messaging"),{origin:"canvas-channel"}),d=!0,t.holdPort(i))},_d);n.set(i,f)},s=Object.assign(globalThis,{__emmCanvasPort__:()=>{const i=t.getTarget();return{usesPort:t.usesPort,windowDrained:i?t.isWindowDrained(i):!1}}}),o=t.onInit(()=>r());e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{for(const i of n.values())clearTimeout(i);o.dispose(),delete s.__emmCanvasPort__})}var yd=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function Sd(e){return yd.test(e)||e.indexOf("//")===0}function St(e){return e&&(e.endsWith("/")?e:`${e}/`)}function Id(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:""}function Ws(e,t){const n=e==null||e===""?"./":String(e);if(Sd(n))return St(n);const r=t??Id();if(!r)return St(n);try{return St(new URL(n,r).href)}catch{return St(n)}}function wd(){return typeof __useblocks__<"u"&&__useblocks__?.publicPath?Ws(__useblocks__.publicPath):Ws("/")}var Td=()=>"",Cd=()=>"1c4e77a0";function qs(e){const t=e?"iframe-eblock":"iframe",n=Td();if(n){const o=n.replace(/\/?$/,"/");return Ur(`${o}${t}.html`,He())}const r=Cd(),s=`${wd().replace(/\/?$/,"/")}iframe/`;return Ur(`${s}${t}${r?`.${r}`:""}.html`,He())}var zs="allow-top-navigation allow-scripts allow-popups allow-popups-to-escape-sandbox";function Tn(e){return/^file:/i.test(String(e||"").trim())}function Ad(e){return Tn(e)?`${zs} allow-same-origin`:zs}var a_="em:module-body",Dd="em:module-body-ack";function Pd(e,t,n){try{const r=new URL("./",new URL(t,n)).href,s=new URL(e,r).href;return s.startsWith(r)?s:void 0}catch{return}}function Cn(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 Rd(e){const t=Cn(e);if(t)return t.hash?`js/${t.name}.body.${t.hash}.js`:`js/${t.name}.body.js`}function Od(e,t){const n=Cn(t)?.name,r=n?e[`${n}.html`]:void 0;return r?(r.imports??[]).map(s=>e[s]?.file).filter(s=>!!s):[]}function Md(e,t){const n=Cn(t)?.name,r=n?`js/${n}.js`:void 0;if(!r||!(r in e))return[];const s=new Set([r]),o=[r],i=[];for(;o.length>0;)for(const a of e[o.shift()]??[])s.has(a)||(s.add(a),i.push(a),o.push(a));return i}var Ld=/^(?=[\w-]{8}$)(?:.*\d|(?=.*[a-z]).*[A-Z])/;function Nd(e){const t=(e.split(/[?#]/)[0].split("/").pop()??"").split(".");return t.length>=3&&Ld.test(t[t.length-2])}async function xd(e,t){const n=Nd(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 kd(e){const t=new Map,n=(r,s)=>{const o=Pd(r,e.canvasSrc,e.origin);if(!o)return;const i=t.get(o);if(i!==void 0)return i;const a=e.fetchBody(o,s);return t.set(o,a),a};return{take(r){return n(r)??Promise.resolve(void 0)},warm(r,s){for(const o of r)n(o,s)},reset(){t.clear()},get size(){return t.size}}}var fe;function Fd(e){try{return Tn(new URL(e,window.location.href).href)}catch{return Tn(window.location.href)}}function Ks(e){try{if(new URL(e,window.location.href).origin===window.location.origin)return!0}catch{return!1}return typeof __useblocks__<"u"&&__useblocks__?.preload?.canvasCrossOrigin===!0}var Bd=()=>Promise.resolve(void 0);function Xs(){const e=qs(!1);if(!Fd(e)){if(!fe||fe.canvasSrc!==e){const t=Ks(e)?xd:Bd;fe={canvasSrc:e,store:kd({canvasSrc:e,origin:window.location.href,fetchBody:t}),warmed:!1}}return fe.store}}async function jd(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 s=await r.json();t(Od(s,e))}catch{}}function An(e){const t=Xs();if(!t||!fe||fe.warmed||!Ks(fe.canvasSrc))return;fe.warmed=!0;const{canvasSrc:n}=fe,r=Rd(n);r&&t.warm([r],e);const s={"js/iframe-eblock.js":["js/discussHandlers.Xh4-JUcT.js","js/typograf.all.BbXdyfMT.js"],"js/iframe.js":["js/rolldown-runtime.BRlIiq3h.js","js/discussHandlers.Xh4-JUcT.js"],"js/darkreader.CyLMh7_H.js":[],"js/discussHandlers.Xh4-JUcT.js":["js/rolldown-runtime.BRlIiq3h.js"],"js/rolldown-runtime.BRlIiq3h.js":[],"js/rules.CL_BitCE.js":[],"js/typograf.all.BbXdyfMT.js":["js/rolldown-runtime.BRlIiq3h.js"]};s?t.warm(Md(s,n),e):jd(n,o=>t.warm(o,e))}function Ud(e){const t=Xs();if(!t)return;An();const n=r=>{const s=r.data;if(!s||s.operationId!=="em:module-body"||!s.result)return;const o=r.source;o&&(o.postMessage({operationId:Dd,for:s.result},"*"),t.take(s.data?.url??"").then(i=>{o.postMessage({operationId:s.result,data:i??null},"*")}))};window.addEventListener("message",n),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{window.removeEventListener("message",n)})}var Ne=/<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,Hd=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,xe=/<style\b[^>]*>[\s\S]*?<\/style>/gi,Js=/display:\s*none\s*!important/gi,$d=/((?:html\s*,\s*body|body\s*,\s*html)\s*\{)([^}]*)(\})/gi,Vd=/\s*height\s*:\s*100%\s*!important\s*;?/gi,Gd=/height\s*:\s*100%\s*!important/i,Yd=[".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 Wd(e){return Js.lastIndex=0,(e.match(Js)||[]).length}function Qs(e){const t=e.trim(),n=Wd(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=Yd.filter(s=>t.includes(s)).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 qd(e){xe.lastIndex=0;for(const t of e.matchAll(xe))if(Qs(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function zd(e){let t=!1;return xe.lastIndex=0,{html:e.replace(xe,n=>Qs(n.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):n),found:t}}function Kd(e){return Ne.lastIndex=0,Ne.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||qd(e)}function Xd(e){if(!Kd(e))return{html:e,found:!1};let t=!1,n=e;Ne.lastIndex=0,Ne.test(n)&&(Ne.lastIndex=0,n=n.replace(Ne,""),t=!0),(/\sbis_[a-z0-9_-]+\s*=/.test(n)||/\sdata-bis-config\s*=/.test(n))&&(n=n.replace(Hd,""),t=!0);const r=zd(n);return n=r.html,t=t||r.found,{html:n,found:t}}function Jd(e){return!e||!Gd.test(e)?e:(xe.lastIndex=0,e.replace(xe,t=>t.replace($d,(n,r,s,o)=>`${r}${s.replace(Vd,"")}${o}`)))}function Zs(e){const t=Xd(e.replaceAll(`\r
|
|
2107
|
+
`)}function En(e,t){return cn(e.autosave,t===void 0?{}:{freshSince:t})?e.autosave:null}function Bc({emailId:e,readAutosave:t,revisionServiceEnabled:n,isHistoryAvailable:r,readShownContent:s,onFacts:o,onLate:i,onError:a,pageLoadTs:c=kc()}){let d=null,u=!1,f=!1,g=0,E={emailId:e,historyLoaded:!1,isRecovering:!1},S=null;const b=new Promise(O=>{S=O}),h=O=>{E={...E,...O},o(E)};let y;const I=O=>{g+=1,h({applied:{phase:O,seq:g}})},A=()=>{d?.timer&&clearTimeout(d.timer),d=null},D=O=>{if(!f){if(S){const F=S;S=null,F(O),y=O.revision?O.phase:void 0;return}i(O)&&O.revision&&I(O.phase)}},N=()=>{if(!d||f)return;const O=d.phase==="fast",F=O?Oc:Nc,w=O?Lc:xc;d.timer=setTimeout(()=>{const P=d;if(!(!P||f)){if(P.attempts+=1,M(),O&&P.attempts>=w){const{pending:k}=P;Xe(e),h({isRecovering:!1}),D({revision:{html:k.html,common_styles:k.common_styles,subject:k.subject,preheader:k.preheader},phase:"timeout"}),u=!0,P.phase="bg",P.attempts=0,N();return}if(!O&&P.attempts>=w){Xe(e),A(),h({isRecovering:!1}),u=!0;return}N()}},F),d.timer.unref?.()},m=O=>{d={phase:"fast",attempts:0,pending:O,timer:null},h({isRecovering:!0}),N()},_=O=>{if(f)return;if(h({historyLoaded:!0,latestRevisionAt:O.latestAt!==void 0&&Number.isFinite(O.latestAt)?O.latestAt:void 0}),n&&d){const P=En(O,d.pending.sentAt);if(!P)return;const k=d.phase==="fast"?"found":"bg";Xe(e),A(),h({isRecovering:!1}),u=!0,D({revision:P,phase:k});return}if(u)return;const F=n?Ds(e):null,w=F&&(F.sentAt<c||!Fc(F.html,s()))?F:null;if(w){const P=En(O,w.sentAt);if(P){Xe(e),u=!0,D({revision:P,phase:"found"});return}m(w);return}u=!0,D({revision:En(O),phase:"normal"})},C=O=>{f||(a?.(O),E.historyLoaded||(h({historyLoaded:!1,latestRevisionAt:void 0}),T()),!d&&D({revision:null,phase:"normal"}))},M=()=>t(e).then(_).catch(C);let p,v=!1;const T=()=>{v||d||f||(v=!0,p=setTimeout(()=>{p=void 0,!f&&!E.historyLoaded&&M()},Mc))},L=()=>{f||(h({historyLoaded:!1,latestRevisionAt:void 0}),D({revision:null,phase:"normal"}))};return r?r().then(O=>O?M():L()):M(),{verdict:()=>b,confirmVerdict(O){const F=y;y=void 0,O&&F!==void 0&&!f&&I(F)},dispose(){f=!0,p!==void 0&&(clearTimeout(p),p=void 0),A()}}}function jc({port:e,revisionServiceEnabled:t,isHistoryAvailable:n,emailId:r,readShownContent:s,onFacts:o}){let i=null;const a=Bc({emailId:r,readAutosave:c=>e.readAutosave(c),revisionServiceEnabled:t,...n?{isHistoryAvailable:n}:{},readShownContent:s,onFacts:o,onLate:({revision:c,phase:d})=>{const u=vs(c);return i?.(u)??!1},onError:c=>{c instanceof Error&&c.message}});return{id:"recovery",load:()=>a.verdict().then(({revision:c})=>vs(c)),loaded(c){a.confirmVerdict(c)},watch(c){return i=c,()=>{i=null,a.dispose()}}}}function Ps(e,t){return{readRevisions:(n,r)=>t.readRevisions(n,r),readAutosave:n=>t.readAutosave(n),async saveAutosave(n,r){Rc(n,{sentAt:Date.now(),html:r.html??"",common_styles:r.common_styles??"",subject:r.subject,preheader:r.preheader});const s=await t.saveAutosave(n,r);return await e.saveAutosave(n,r),s}}}function Uc(e,t){return{readEmail:n=>e.readEmail(n),createEmail:n=>e.createEmail(n),async updateEmail(n,r){const s=Date.now(),o=await t.updateEmail(n,r);return await e.updateEmail(n,r),(Ds(n)?.sentAt??Number.POSITIVE_INFINITY)<=s&&Xe(n),o}}}var Rs=l.createIdentifier$1("CurrentUser"),Os={};function vn(e){return e.getOrCreateInstance(Rs,()=>de(Os))}function Ms(e){return e?.getInstance(Rs)?.get()??Os}var Ls=l.createIdentifier$1("HeadlessMode");function Ns(e){return e.getOrCreateInstance(Ls,()=>de(!1))}function Hc(e){return e?.getInstance(Ls)?.get()??!1}var $c=l.createIdentifier$1("HiddenMount");function Vc(e){return e.getOrCreateInstance($c,()=>de(!1))}function Gc(e){if(!e)return!1;try{return!!l.decodeJwt(e).data?.act_as}catch{return!1}}function Yc(e){return Gc(e?.getInstance(l.COOKIE_MANAGER_ID)?.get(l.APP_COOKIES.em_token))}function xs(e){return e?.getInstance(l.CONFIG_SOURCE_ID)?.get()??{}}function yt(e,t){return e.user.mode||e.serverSide.mode||t||"pro"}function Wc(e,t){return t.modeDefaults(yt(e,t.fallbackMode))}function ks(e,t){const n=yt(e,t);return e.serverSide.advancedConfigs?.[n]||{}}function Fs(e,t){const n=yt(e,t),r=e.user?.advancedConfigs?.[n],s=r!==void 0?r:e.user?.advancedConfigs?.pro;return{...e.advancedConfigs?.[n],...s}}function qc(e){let t;for(const n of e)n?.fileManager&&(t={...t,...n.fileManager});return t}function zc(e){return l.mergeResourceProxyLayers(e.map(t=>t?.resourceProxy))}function Kc(e){return l.mergeResourceProxyPolicyLayers(e.map(t=>t?.resourceProxyPolicy))}function Xc(e){return l.mergeBackendProxyLayers(e.map(t=>t?.backendProxy))}function Jc(e){return l.mergeShallowConfigLayers(e.map(t=>t?.backendProxyPolicy||{}).filter(Boolean))}function Qc(e,t){return[e.base,Wc(e,t),e.profile,e.serverSide,ks(e,t.fallbackMode),e.local,e.user,Fs(e,t.fallbackMode)]}function _n(e,t){const n=Qc(e,t),r=l.mergeShallowConfigLayers(n),s=qc(n);s!==void 0&&(r.fileManager=s);const o=zc(n);o!==void 0&&(r.resourceProxy=o);const i=Kc(n);i&&Object.keys(i).length>0&&(r.resourceProxyPolicy=i);const a=Xc(n);a!==void 0&&(r.backendProxy=a);const c=Jc(n);return c&&Object.keys(c).length>0&&(r.backendProxyPolicy=c),r}function Zc(e,t,n){const r=ks(e,n),s=Fs(e,n);return l.pickKey([s,e.user,r,e.serverSide],t)}var ed=1.5;function td(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<=ed*e.autosaveTimeoutMs?"none":"revision"}var a_=5,l_=3;function nd(e){const{readDocument:t,readEnvironment:n,onCreate:r,onRevision:s}=e,o=e.readFailures??(()=>0),i=e.readFailureRetryable??(()=>!0);let a;const c=_=>a!==void 0&&a.version===_.get().version?o()-a.failuresAtStart:0,d=_=>{const C=c(_);if(C<=0)return!1;const M=n().retryMaxAttempts??5;return!i()||C>M},u=()=>{const{autosaveTimeoutMs:_,retryIntervalMs:C}=n(),M=t();return M!==void 0&&c(M)>0&&C!==void 0&&C>0?C:_},f=_=>_.isNew()&&o()>=3,g=()=>{const _=t();if(!_||_.isDisposed()||d(_))return"none";const{latestRevisionAt:C,snapshotVersion:M,...p}=n(),v=Date.now(),T=td({...p,isDirty:_.isDirty(),isNew:_.isNew(),isReady:_.isReady(),latestRevisionAgeMs:C!=null&&C<=v?v-C:void 0,isSnapshotSent:M!=null&&M===_.get().version});return T==="create"&&f(_)?"none":T},E=()=>{const _=t();if(!_||_.isDisposed()||f(_)||d(_)||n().isHeadless)return!1;if(!_.isDirty())return _.isNew();const{snapshotVersion:C}=n();return!(C!=null&&C===_.get().version)};let S,b,h,y,I=!1;const A=()=>{b=void 0;const _=t();if(!_||_.isDisposed())return;if(_.get().docId!==S){D();return}const C=g();C!=="none"&&a?.version!==_.get().version&&(a={version:_.get().version,failuresAtStart:o()}),C==="create"?r():C==="revision"?s():E()&&(S=_.get().docId,b=setTimeout(A,u()))},D=()=>{const _=t();I||!_||b!==void 0||g()==="none"&&!E()||(S=_.get().docId,b=setTimeout(A,u()))},N=_=>{_.source==="user"&&b!==void 0&&(clearTimeout(b),b=void 0),D()},m=()=>{const _=t();_!==h&&(y?.(),h=_,a=void 0,y=_?.subscribe(N),b!==void 0&&(clearTimeout(b),b=void 0))};return m(),D(),{refresh:()=>{I||(m(),D())},stop:()=>{I=!0,y?.(),y=void 0,h=void 0,b!==void 0&&(clearTimeout(b),b=void 0)}}}var Bs=l.createIdentifier$1("documentSession.autosaveUiFacts"),js={isUserBusy:!1,saveContext:{}};function rd(e){return e.getOrCreateInstance(Bs,()=>de(js))}function bn(e){return e?.getInstance(Bs)?.get()??js}function Us(e){return bn(e).saveContext.fallbackTitle||"Untitled email."}var sd=1e4,od=3e4;function id(e,t){const n=u=>{const f=e.getInstance(l.CONFIG_SOURCE_ID)?.layers?.(),g=f?Zc(f,u):void 0;return typeof g=="number"&&g>=0?g:void 0},r=()=>{const u=t.current(),f=u?.get().serverId??void 0,g=ue(t.sessionKey()),E=t.recoveryFacts(),S=E?.emailId===f?E:void 0,b=t.revisionFacts(),h=S?.latestRevisionAt,y=b?.lastRevisionAt,I=Ms(e).profile;return{isInited:g||u?.get().attributes.is_inited===!0,isEnabled:!!I?.autosaves&&!Yc(e),isHistoryLoaded:S?.historyLoaded===!0,isUserBusy:bn(e).isUserBusy,isHeadless:Hc(e),autosaveTimeoutMs:xs(e).autosaveTimeout||sd,latestRevisionAt:h!==void 0||y!==void 0?Math.max(h??0,y??0):void 0,snapshotVersion:b?.snapshotVersion,retryIntervalMs:n("autosaveRetryIntervalMs")??od,retryMaxAttempts:n("autosaveRetryMaxAttempts")}},s=()=>{const u=bn(e).saveContext;return{...u,project:u.project??t.current()?.get().attributes.project,fallbackTitle:Us(e)}},o=nd({readDocument:()=>t.current(),readEnvironment:r,readFailures:()=>t.saveState().failures,readFailureRetryable:()=>$l(t.saveState().error),onCreate:()=>{ue(t.sessionKey())||t.save("materialize",s())},onRevision:()=>{t.save("snapshot",{project:s().project})}}),i=t.subscribe(o.refresh),a=vn(e).watch(()=>o.refresh()),c=rd(e).watch(()=>o.refresh()),d=Ns(e).watch(()=>o.refresh());return()=>{i(),a.dispose(),c.dispose(),d.dispose(),o.stop()}}var Hs=12e3;function ve(e){return e.getOrCreateInstance(tn,()=>{const t=_c({resolveAdapters:(r,s)=>cd(r,e,s),resolveWritePort:()=>$s(e),resolveHistoryPort:r=>ue(r)?Gs(e):Vs(e),resolveTerms:()=>Cc(e),canEdit:r=>ll(e,r),notifyBeforeSave:ml(e),timeoutMs:Hs,onAdapterError:(r,s)=>{s instanceof Error&&s.message;const o=yc(s),i=bc(s);Ve(s,{origin:"email-source-adapter",tags:{source:r,expected_refusal:String(o),network_failure:String(i)},level:o||i?"warning":"error"})},onTimeout:r=>{}}),n=id(e,t);return e.getInstance(l.DISPOSABLE_ID)?.addDispose(n),t})}function yn(e){return e?.getInstance(tn)}function $s(e){const t=wc(e);return t?Sn(e)?Uc(t,Se(e).email(e)):t:Se(e).email(e)}function ad(e){return As(e)!==void 0||Is(e)}function Vs(e){const t=As(e);return t?Sn(e)?(W("port:history:server-backed"),Ps(t,Se(e).history(e))):(W("port:history:integrator"),t):(W("port:history:rest (порт не зарегистрирован)"),Se(e).history(e))}function Gs(e){const t=Cs(e);return t?Sn(e)?(W("port:block-history:server-backed"),Ps(t,Se(e).blockHistory(e))):(W("port:block-history:integrator"),t):(W("port:block-history:rest (порт не зарегистрирован)"),Se(e).blockHistory(e))}function ld(e){return Cs(e)!==void 0||Is(e)}function Sn(e){return qr(e)}function cd({email:e,patch:t,serverId:n,key:r},s,o){const i=[];e?i.push({id:"rest",load:()=>gs(e),required:!0}):n&&i.push(Sc($s(s),n)),t&&i.push({id:"plugin",load:()=>Es(t)});const a=ue(r);return gl(n)&&(a?ld(s):ad(s))&&i.push(jc({port:a?Gs(s):Vs(s),revisionServiceEnabled:qr(s),...!a&&cl(s)?{isHistoryAvailable:()=>dl(s)}:{},emailId:n,readShownContent:()=>o.readShownContent(),onFacts:c=>o.publishRecoveryFacts(c)})),i}function Q(e){return e.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService)}var Ys=new WeakMap,wn=new WeakMap;function fe(e){return Ys.get(e)??0}function In(e,t){let n=wn.get(e);return n||(n=new Set,wn.set(e,n)),n.add(t),()=>{n?.delete(t)}}function dd(e){Ys.set(e,fe(e)+1),wn.get(e)?.forEach(t=>t())}function ud(e){const t=ve(e),n=Q(e).addListener(l.EVENT_TYPES.APPLICATION_HAS_AMP,r=>{We(t)?.mutate({attributes:{isAmp:r}},{source:"remote"})});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>n.dispose())}function fd(e){return e.size>0&&(e.type===""||e.type.startsWith("image/"))}function pd(e){const t=e.fetchImpl??((o,i)=>fetch(o,i)),n=e.pageHost??(()=>window.location.hostname),r=new Set,s=o=>{try{const i=new URL(o,window.location.href);return i.protocol!=="https:"&&i.protocol!=="http:"?!1:i.hostname===n()||e.sourceHosts().includes(i.hostname)}catch{return!1}};return{accepts:s,async load(o){if(!s(o))return;const i=!r.has(o);r.add(o);try{const a=await t(o,{mode:"cors",credentials:"omit",cache:i?"no-cache":"default"});if(!a.ok)return;const c=await a.blob();return fd(c)?c:void 0}catch{return}}}}var we={maxBytes:67108864,maxImageBytes:4194304,ttlMs:18e5};function hd(e){const t={maxBytes:e.maxBytes??we.maxBytes,maxImageBytes:e.maxImageBytes??we.maxImageBytes,ttlMs:e.ttlMs??we.ttlMs},n=e.now??(()=>Date.now()),r=new Map,s=new Map,o={hits:0,loads:0,failures:0};let i=0;const a=f=>{const g=r.get(f);g&&(i-=g.bytes,r.delete(f))},c=f=>t.ttlMs<=0||n()-f.storedAt<t.ttlMs,d=()=>{if(i<=t.maxBytes)return;const f=[...r.entries()].sort((g,E)=>g[1].usedAt-E[1].usedAt);for(const[g]of f){if(i<=t.maxBytes)return;a(g)}},u=(f,g)=>{g.size>t.maxImageBytes||(r.set(f,{blob:g,bytes:g.size,storedAt:n(),usedAt:n()}),i+=g.size,d())};return{async get(f){const g=r.get(f);if(g&&c(g))return g.usedAt=n(),o.hits+=1,g.blob;g&&a(f);const E=s.get(f);if(E!==void 0)return E;o.loads+=1;const S=(async()=>{try{const b=await e.load(f);return b?u(f,b):o.failures+=1,b}catch{o.failures+=1;return}finally{s.delete(f)}})();return s.set(f,S),S},forget(f){a(f),s.delete(f)},configure(f){Object.assign(t,{maxBytes:f.maxBytes??t.maxBytes,maxImageBytes:f.maxImageBytes??t.maxImageBytes,ttlMs:f.ttlMs??t.ttlMs});for(const[g,E]of r)E.bytes>t.maxImageBytes&&a(g);d()},clear(){r.clear(),s.clear(),i=0},stats(){return{entries:r.size,bytes:i,...o}}}}var md=["emcdn.ru","scr.emcdn.ru"];function gd(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 Ed(e,t){const n=(r,s)=>{const o=new Set(s?t:[]);for(const i of r){const a=gd(i);a&&o.add(a)}return[...o]};return e?Array.isArray(e)?n(e,!0):n(e.value??[],e.replace!==!0):[...t]}function vd(e){const t=e??{},n=t.isPlugin!==!0?md:[],r=t.canvasImageCache;if(r===!1)return{enabled:!1,sourceHosts:[],...we};const s=r===!0||r===void 0?{}:r;return{enabled:s.enabled!==!1,sourceHosts:Ed(s.sourceHosts,n),maxBytes:s.maxBytes??we.maxBytes,maxImageBytes:s.maxImageBytes??we.maxImageBytes,ttlMs:s.ttlMs??we.ttlMs}}function _d(e){const t=Q(e),n=e.getInstance(l.CONFIG_SOURCE_ID),r=()=>vd({...n?.get(),isPlugin:!0});let s=r();const o=pd({sourceHosts:()=>s.sourceHosts}),i=hd({load:b=>o.load(b),maxBytes:s.maxBytes,maxImageBytes:s.maxImageBytes,ttlMs:s.ttlMs}),a=()=>{t.send(l.EVENT_TYPES.SANDBOX_CANVAS_IMAGE_CACHE_SETUP,{enabled:s.enabled,sourceHosts:[...s.sourceHosts]})},c=t.onInit(()=>a()),d=n?.watch(()=>{const b=r(),h=JSON.stringify(b)!==JSON.stringify(s);s=b,i.configure(b),b.enabled||i.clear(),h&&t.isInited()&&a()}),u={asked:0,served:0,refused:0},f=[],g=(b,h)=>(u.refused+=1,f.push({url:b,reason:h}),f.length>20&&f.shift(),{refused:!0}),E=Object.assign(globalThis,{__emmCanvasImages__:()=>({settings:s,counters:{...u},refusals:[...f],store:i.stats()})}),S=t.addListenerAsync(l.EVENT_TYPES.APPLICATION_CANVAS_IMAGE_GET,async b=>{const h=b?.url??"";if(u.asked+=1,!s.enabled||!h)return g(h,"disabled");if(!o.accepts(h))return g(h,"host");b.fresh&&i.forget(h);const y=await i.get(h);return y?(u.served+=1,{blob:y}):g(h,"load-failed")});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{c.dispose(),d?.dispose(),S.dispose(),i.clear(),delete E.__emmCanvasImages__})}var bd=2e3;function yd(e){const t=Q(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=g=>{g.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 f=setTimeout(()=>{n.get(i)===f&&n.delete(i),!(c||!t.hasPort(i,a.port1))&&(Ve(new Error("canvas port did not come up, staying on window messaging"),{origin:"canvas-channel"}),d=!0,t.holdPort(i))},bd);n.set(i,f)},s=Object.assign(globalThis,{__emmCanvasPort__:()=>{const i=t.getTarget();return{usesPort:t.usesPort,windowDrained:i?t.isWindowDrained(i):!1}}}),o=t.onInit(()=>r());e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{for(const i of n.values())clearTimeout(i);o.dispose(),delete s.__emmCanvasPort__})}var Sd=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function wd(e){return Sd.test(e)||e.indexOf("//")===0}function St(e){return e&&(e.endsWith("/")?e:`${e}/`)}function Id(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:""}function Ws(e,t){const n=e==null||e===""?"./":String(e);if(wd(n))return St(n);const r=t??Id();if(!r)return St(n);try{return St(new URL(n,r).href)}catch{return St(n)}}function Td(){return typeof __useblocks__<"u"&&__useblocks__?.publicPath?Ws(__useblocks__.publicPath):Ws("/")}var Cd=()=>"",Ad=()=>"a1be77d6";function Dd(e,t){const n=new URL(e);return n.hostname!=="localhost"||t.hostname==="localhost"?e:(n.hostname=t.hostname,n.toString())}function qs(e){const t=e?"iframe-eblock":"iframe",n=Cd();if(n){const o=Dd(n,window.location).replace(/\/?$/,"/");return Ur(`${o}${t}.html`,He())}const r=Ad(),s=`${Td().replace(/\/?$/,"/")}iframe/`;return Ur(`${s}${t}${r?`.${r}`:""}.html`,He())}var zs="allow-top-navigation allow-scripts allow-popups allow-popups-to-escape-sandbox";function Tn(e){return/^file:/i.test(String(e||"").trim())}function Pd(e){return Tn(e)?`${zs} allow-same-origin`:zs}var c_="em:module-body",Rd="em:module-body-ack";function Od(e,t,n){try{const r=new URL("./",new URL(t,n)).href,s=new URL(e,r).href;return s.startsWith(r)?s:void 0}catch{return}}function Cn(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 Md(e){const t=Cn(e);if(t)return t.hash?`js/${t.name}.body.${t.hash}.js`:`js/${t.name}.body.js`}function Ld(e,t){const n=Cn(t)?.name,r=n?e[`${n}.html`]:void 0;return r?(r.imports??[]).map(s=>e[s]?.file).filter(s=>!!s):[]}function Nd(e,t){const n=Cn(t)?.name,r=n?`js/${n}.js`:void 0;if(!r||!(r in e))return[];const s=new Set([r]),o=[r],i=[];for(;o.length>0;)for(const a of e[o.shift()]??[])s.has(a)||(s.add(a),i.push(a),o.push(a));return i}var xd=/^(?=[\w-]{8}$)(?:.*\d|(?=.*[a-z]).*[A-Z])/;function kd(e){const t=(e.split(/[?#]/)[0].split("/").pop()??"").split(".");return t.length>=3&&xd.test(t[t.length-2])}async function Fd(e,t){const n=kd(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 Bd(e){const t=new Map,n=(r,s)=>{const o=Od(r,e.canvasSrc,e.origin);if(!o)return;const i=t.get(o);if(i!==void 0)return i;const a=e.fetchBody(o,s);return t.set(o,a),a};return{take(r){return n(r)??Promise.resolve(void 0)},warm(r,s){for(const o of r)n(o,s)},reset(){t.clear()},get size(){return t.size}}}var pe;function jd(e){try{return Tn(new URL(e,window.location.href).href)}catch{return Tn(window.location.href)}}function Ks(e){try{if(new URL(e,window.location.href).origin===window.location.origin)return!0}catch{return!1}return typeof __useblocks__<"u"&&__useblocks__?.preload?.canvasCrossOrigin===!0}var Ud=()=>Promise.resolve(void 0);function Xs(){const e=qs(!1);if(!jd(e)){if(!pe||pe.canvasSrc!==e){const t=Ks(e)?Fd:Ud;pe={canvasSrc:e,store:Bd({canvasSrc:e,origin:window.location.href,fetchBody:t}),warmed:!1}}return pe.store}}async function Hd(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 s=await r.json();t(Ld(s,e))}catch{}}function An(e){const t=Xs();if(!t||!pe||pe.warmed||!Ks(pe.canvasSrc))return;pe.warmed=!0;const{canvasSrc:n}=pe,r=Md(n);r&&t.warm([r],e);const s={"js/iframe-eblock.js":["js/discussHandlers.CcQmhTtJ.js","js/typograf.all.BbXdyfMT.js"],"js/iframe.js":["js/rolldown-runtime.BRlIiq3h.js","js/discussHandlers.CcQmhTtJ.js"],"js/darkreader.CyLMh7_H.js":[],"js/discussHandlers.CcQmhTtJ.js":["js/rolldown-runtime.BRlIiq3h.js"],"js/rolldown-runtime.BRlIiq3h.js":[],"js/rules.CL_BitCE.js":[],"js/typograf.all.BbXdyfMT.js":["js/rolldown-runtime.BRlIiq3h.js"]};s?t.warm(Nd(s,n),e):Hd(n,o=>t.warm(o,e))}function $d(e){const t=Xs();if(!t)return;An();const n=r=>{const s=r.data;if(!s||s.operationId!=="em:module-body"||!s.result)return;const o=r.source;o&&(o.postMessage({operationId:Rd,for:s.result},"*"),t.take(s.data?.url??"").then(i=>{o.postMessage({operationId:s.result,data:i??null},"*")}))};window.addEventListener("message",n),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{window.removeEventListener("message",n)})}var Ne=/<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,Vd=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,xe=/<style\b[^>]*>[\s\S]*?<\/style>/gi,Js=/display:\s*none\s*!important/gi,Gd=/((?:html\s*,\s*body|body\s*,\s*html)\s*\{)([^}]*)(\})/gi,Yd=/\s*height\s*:\s*100%\s*!important\s*;?/gi,Wd=/height\s*:\s*100%\s*!important/i,qd=[".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 zd(e){return Js.lastIndex=0,(e.match(Js)||[]).length}function Qs(e){const t=e.trim(),n=zd(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=qd.filter(s=>t.includes(s)).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 Kd(e){xe.lastIndex=0;for(const t of e.matchAll(xe))if(Qs(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function Xd(e){let t=!1;return xe.lastIndex=0,{html:e.replace(xe,n=>Qs(n.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):n),found:t}}function Jd(e){return Ne.lastIndex=0,Ne.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||Kd(e)}function Qd(e){if(!Jd(e))return{html:e,found:!1};let t=!1,n=e;Ne.lastIndex=0,Ne.test(n)&&(Ne.lastIndex=0,n=n.replace(Ne,""),t=!0),(/\sbis_[a-z0-9_-]+\s*=/.test(n)||/\sdata-bis-config\s*=/.test(n))&&(n=n.replace(Vd,""),t=!0);const r=Xd(n);return n=r.html,t=t||r.found,{html:n,found:t}}function Zd(e){return!e||!Wd.test(e)?e:(xe.lastIndex=0,e.replace(xe,t=>t.replace(Gd,(n,r,s,o)=>`${r}${s.replace(Yd,"")}${o}`)))}function Zs(e){const t=Qd(e.replaceAll(`\r
|
|
2108
2108
|
`,`
|
|
2109
|
-
`));return{html:Jd(t.html),hasBrowserExtensionArtifacts:t.found}}function It(e){return e?.getContent()??""}function eo(e,t){e?.mutate({content:ps(t)},{source:"remote"})}function Dn(e){return l.createIdentifier$1(e)}function se(e,t){return e.getOrCreateInstance(t,()=>new l.AsyncEmitter)}function X(e,t){return e.getOrCreateInstance(t,()=>new l.AsyncEmitter).event}function wt(e,t,n,r){return{html:e,guid:t,...Object.keys(n).length>0?{templateDirectivesPolicy:n}:{},...r!==void 0?{rev:r}:{}}}var Qd=class extends Error{showId;constructor(e,t){super(`[useblocks] 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}},Zd=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,s)=>{const o=setTimeout(()=>{this._settle(e.showId,()=>{s(new Qd(e.showId,t))})},t);o.unref?.();const i=()=>{this._settle(e.showId,()=>{s(l.createAbortError(n.reason))})};n.addEventListener("abort",i,{once:!0});const a=()=>{clearTimeout(o),n.removeEventListener("abort",i)};this._pending.set(e.showId,{request:e,resolve:r,reject:s,timeoutId:o,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 eu(e,t){return{contentReady:t.contentReady??e?.contentReady,sandboxReady:t.sandboxReady??e?.sandboxReady,sandbox:t.sandbox?{...e?.sandbox,...t.sandbox}:e?.sandbox}}function tu(e){if(!e||!(e.contentReady!==void 0||e.sandboxReady!==void 0||e.sandbox!==void 0))return;const t=Zr(e),n=es(e),r=ul(e.sandbox);t<n+r}var to=class{_controller=new AbortController;_externalSignalDisposable=new l.Disposable;_sessionChangeListeners=new Set;_showRegistry=new Zd;_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 Zr(this._timeouts)}getSandboxTimeoutMs(e){return Qr(e,this._timeouts?.sandbox)}getSandboxReadyTimeoutMs(){return es(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=eu(this._timeouts,e.timeouts),tu(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)})}},Pn=(()=>{const e=new to;return e.configure({}),e})(),nu=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 ru(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 su(e,t,n){return e.isInited()&&e.getTarget()?Promise.resolve():(l.throwIfAborted(n),new Promise((r,s)=>{let o=!1,i,a;const c=u=>{o||(o=!0,i!==void 0&&(clearTimeout(i),i=void 0),a?.dispose(),n?.removeEventListener("abort",d),u())},d=()=>{c(()=>s(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(()=>s(new nu(t)))},t)),n?.addEventListener("abort",d)}))}var ou=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 iu(e,t,n){return t<=0?e:new Promise((r,s)=>{let o=!1,i;const a=c=>{o||(o=!0,i!==void 0&&(clearTimeout(i),i=void 0),c())};i=setTimeout(()=>{a(()=>s(new ou(n,t)))},t),e.then(c=>{a(()=>r(c))},c=>{a(()=>s(c))})})}var au=2,Je=Symbol("sandbox:frame-replaced");function no(e){return e===Je}function pe(e,t,n,r,s,o,i){const a=`sandbox:${t}`,c=o?.getSandboxTimeoutMs(t)??nn[t],d=()=>{let S=iu(e.sendAsync(n,r),c,a);return S=l.raceWithAbortSignal(S,o?.signal),qe(a,S,s)};if(t==="INIT_START"&&ru(e)){const S=o?.getSandboxReadyTimeoutMs()??2e4,b=e,h=y=>{const w=su(b,S,o?.signal);return qe("sandbox:INIT_START:ready-wait",w,s).then(()=>{if(!i||y<=0)return d();const A=i.getGeneration();let D;const N=new Promise((_,C)=>{D=i.onChange(()=>{i.getGeneration()!==A&&C(Je)})}),m=d();return m.catch(()=>{}),Promise.race([m,N]).finally(()=>D?.()).catch(_=>{if(_!==Je)throw _;return{...s},h(y-1)})})};return h(au)}if(!i)return d();const u=i.getGeneration();let f;const g=new Promise((S,b)=>{f=i.onChange(()=>{i.getGeneration()!==u&&b(Je)})}),E=d();return E.catch(()=>{}),Promise.race([E,g]).finally(()=>f?.()).catch(S=>{throw S===Je&&{...s},S})}var lu=[["brace-percent",/<!--\{%/],["brace-hash",/<!--\{#/],["proscript",/<!--\[%/],["getresponse",/<!--\[\[(?:if|else\]\]|endif\]\])/i],["mailchimp",/<!--\*\|/],["expert-sender",/<!--<\/?(?:if|else|var)/i]],cu=200;function ro(e=new Set){const t=new Set;return(n,r)=>{if(!lu.some(([o,i])=>!e.has(o)&&i.test(n)))return;const s=r??`new:${n.length}:${n.slice(0,200)}`;t.has(s)||(t.size>=cu&&t.clear(),t.add(s))}}function so(){return{isConfigured:()=>!1,toEditorForm:e=>e,toOutputForm:e=>e,keepWrappedOnOutput:new Set,editorPolicy:{},warnAboutUnconfiguredInput:ro()}}var du=so();function we(e){return e?.getInstance(l.TEMPLATE_DIRECTIVES_ID)??du}function uu(e){const t=Ee(e),n=Z(e),r=()=>e.getInstance(l.INIT_PIPELINE_ID)??Pn;let s,o,i=!1,a=!1;const c=async(w,A,D)=>{const N=D.generation,m=()=>D.generation!==N||D.signal.aborted||t.current()!==w||a,_=ue(n);i=!0;try{if(await pe(n,"INIT_START",l.EVENT_TYPES.SANDBOX_INIT_START,{guid:A},void 0,D),m())return;const{html:C,hasBrowserExtensionArtifacts:M}=Zs(It(w));if(M&&se(e,l.events.ON_BROWSER_EXTENSION_DETECTED_ID).fire(),eo(w,C),await pe(n,"SET_ENTITY",l.EVENT_TYPES.SANDBOX_SET_ENTITY,wt(It(w),A,we(e).editorPolicy,w.get().version),void 0,D),m())return;await pe(n,"INITED",l.EVENT_TYPES.SANDBOX_INITED,{guid:A},void 0,D),s=A,o=_}finally{i=!1}},d=()=>de(t.sessionKey())?t.current():void 0,u=()=>{if(a||i)return;const w=d(),A=w?.get().docId;if(!w||!A||s===A&&o===ue(n)||!w.isReady())return;const D=r();D.signal.aborted||c(w,A,D).catch(()=>{})};let f=!1;const g=()=>{f||a||(f=!0,queueMicrotask(()=>{f=!1,u()}))};let E,S;const b=()=>{const w=d(),A=w?.get().docId;A!==S&&(E?.(),S=A,E=w?.subscribe(g)),g()},h=t.subscribe(b),y=wn(n,g);b(),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{a=!0,y(),E?.(),h()})}var fu=200;function pu({startVersion:e,limit:t=fu}){let n=[],r=e;const s=o=>{n=n.filter(i=>i.version>o),r=Math.max(r,o)};return{record(o){!o.changes?.length&&!o.contentReplaced||(n.push(o),n.length>t&&s(n[n.length-t-1].version))},rebase(o,i){if(i<r)return null;const a=n.filter(d=>d.version>i);s(i);let c=o;for(const d of a){if(d.contentReplaced||!d.changes)return null;const u=d.changes,f=[];for(const g of c){if(d.fromCanvas&&u.some(S=>g.range.start<=S.oldEnd&&g.range.end>=S.oldPosition))return null;const E=Sl(g.range,u,"after");if(!E)return null;f.push({range:E,text:g.text})}c=f}return c}}}function hu(e,t){let n=0;return e.map(({start:r,end:s,text:o})=>{const i=new ae(r,t.slice(r,s),r+n,o);return n+=o.length-(s-r),i})}function mu(e,t){const n=[...e].sort((r,s)=>r.range.start-s.range.start);return hu(n.map(({range:r,text:s})=>({start:r.start,end:r.end,text:s})),t)}function gu(e){return[...e].sort((t,n)=>n.oldPosition-t.oldPosition).map(t=>({range:{start:t.oldPosition,end:t.oldEnd},text:t.newText}))}var Rn=l.createIdentifier$1("canvas.sandboxFill");function oo(e){return e.getInstance(Rn)?.pipeline.isEventsLocked()===!0}function Tt(e){Ve(e,{origin:"canvas-channel"})}function Eu(e){const t=Ee(e),n=Z(e);let r;const s=(c,d)=>{const u=c.get().docId;let f=!1,g=null,E=null;const S=pu({startVersion:c.get().version});let b=c.getContent(),h=!0;const y=(_,C)=>{!h||t.current()!==c||(Ve(C,{origin:"canvas-channel"}),n.sendAsync(l.EVENT_TYPES.SANDBOX_SET_ENTITY,wt(It(c),u,we(e).editorPolicy,c.get().version)).catch(Tt))},w=async(_,C)=>{if(E){E.push({edits:_,rev:C});return}E=[{edits:_,rev:C}];try{do{const M=E.splice(0,E.length);await n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,{edits:M.map(p=>p.edits),guid:u,rev:M[M.length-1].rev})}while(E.length)}catch(M){y("app edits failed to reach the canvas",M)}finally{E=null}},A=(_,C)=>{const M=E?.splice(0,E.length)??[];M.length&&n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,{edits:M.map(p=>p.edits),guid:u,rev:M[M.length-1].rev}).catch(Tt),n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,{edits:[_],guid:u,rev:c.get().version,...C!==null?{changeId:C}:{}}).catch(Tt)},D=_=>{const{guid:C,pushUndoStop:M}=_;if(C!==u)return;const p=Ll(_);let{edits:v}=_;if(p.baseRev!==null){const L=S.rebase(v,p.baseRev);if(!L){Ve(new Error("canvas batch conflicts with newer document changes"),{origin:"canvas-channel"}),A([],p.changeId);return}v=L}const T=c.get().version;try{f=!0,g=p.changeId;const L=mu(v,c.getContent());M===!1?d.applyWithoutHistory(L):c.mutate({changes:L},{source:oo(e)?"system":"user"})}catch(L){y("canvas batch failed to apply",L);return}finally{f=!1,g=null}c.get().version===T&&p.baseRev!==null&&A([],p.changeId)},N=c.subscribe(({changes:_,version:C})=>{const M=c.getContent(),p=!_?.length&&M!==b;if(b=M,S.record({version:C,changes:_,contentReplaced:p,fromCanvas:f}),!_?.length)return;const v=gu(_);f?A(v,g):w(v,C).catch(Tt)}),m=n.addListener(l.EVENT_TYPES.APPLICATION_UPDATE_ENTITY,D);return()=>{h=!1,N(),m.dispose()}};let o;const i=()=>{const c=t.current(),d=t.history(),u=c?.get().docId;u!==o&&(r?.(),r=void 0,o=u,c&&d&&(r=s(c,d)))},a=t.subscribe(i);i(),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r?.(),a()})}var vu=/^(?:ant|vscode|monaco|docs)-/;function _u(e){return vu.test(e)}function bu(){const e="ub".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 yu=new Set(["animation-opacity","inline-edit-border-radius","separator-border","text-link-decoration"]);function Su(){return yu}var Iu=new Set;function wu(e,t,n=Iu){return e.startsWith(`${t}-`)?!1:!_u(e)&&!n.has(e)}function Tu(e,t){return`--${t}-${e}`}function io(e){const t=bu();return wu(e,t,Su())?Tu(e,t):`--${e}`}function Cu(e,t){const n=io(e);return t!==void 0?`var(${n}, ${t})`:`var(${n})`}function Au(e,t){return Cu(e,t)}function Te(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 Ce(e){return!e||e==="none"}function Du(e){const t=e.contain??"",n=e.willChange??"";return!Ce(e.transform)||!Ce(e.perspective)||!Ce(e.filter)||!Ce(e.backdropFilter)||!Ce(e.translate)||!Ce(e.rotate)||!Ce(e.scale)||/transform|perspective|filter/.test(n)||/paint|layout|strict|content/.test(t)||!!e.containerType&&e.containerType!=="normal"}function ao(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 Pu(e){const t=[],n=document.documentElement,r=ao(getComputedStyle(n)),s=r.x||r.y;let o="none";const i=getComputedStyle(e).position;(i==="absolute"||i==="fixed")&&(o=i);for(let a=Te(e);a&&a!==n;a=Te(a)){const c=getComputedStyle(a),d=o==="none"||Du(c)||o==="absolute"&&!!c.position&&c.position!=="static",u=a===document.body&&!s;if(d){o="none";const f=u?{x:!1,y:!1}:ao(c);(f.x||f.y)&&t.push({node:a,...f})}(c.position==="absolute"||c.position==="fixed")&&(o==="none"||c.position==="fixed")&&(o=c.position==="fixed"?"fixed":"absolute")}return t}function lo(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 Ct(e){return Number.parseFloat(e)||0}function On(e){const t=e.getBoundingClientRect(),n=getComputedStyle(e),r=lo(e),s=Ct(n.borderLeftWidth),o=Ct(n.borderTopWidth),i=Ct(n.borderRightWidth),a=Ct(n.borderBottomWidth),c=e.offsetWidth>0?Math.max(0,e.offsetWidth-e.clientWidth-s-i):0,d=e.offsetHeight>0?Math.max(0,e.offsetHeight-e.clientHeight-o-a):0;return{left:t.left+s*r.x,top:t.top+o*r.y,right:t.right-(i+c)*r.x,bottom:t.bottom-(a+d)*r.y}}function Ru(e,t,n){const r={left:e.left,top:e.top,right:e.right,bottom:e.bottom},s=(o,i,a)=>{i&&(r.left=Math.max(r.left,o.left),r.right=Math.min(r.right,o.right)),a&&(r.top=Math.max(r.top,o.top),r.bottom=Math.min(r.bottom,o.bottom))};return t.forEach(o=>s(On(o.node),o.x,o.y)),n&&s(On(n),!0,!0),r}var Mn={originX:0,originY:0,scaleX:1,scaleY:1};function At(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 co(e,t,n){const r=t.width>0&&e.width>0?e.width/t.width:n.scaleX,s=t.height>0&&e.height>0?e.height/t.height:r;return{originX:e.left-t.left*r,originY:e.top-t.top*s,scaleX:r,scaleY:s}}function uo(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 Ou=1e3;function Mu(e){const{slot:t,own:n}=e;let r,s=0,o=!1;const i=()=>{if(r=void 0,!o){if(!t.isConnected||!n.isConnected){e.onDetached();return}(e.measure()||performance.now()<s)&&(r=window.requestAnimationFrame(i))}},a=()=>{!o&&r===void 0&&(r=window.requestAnimationFrame(i))},c=()=>{s=performance.now()+Ou,a()},d=[window],u=[document.documentElement];for(let h=t;h;h=Te(h)){const y=h.getRootNode();y instanceof ShadowRoot&&!d.includes(y)&&(d.push(y),u.push(y))}const f=[["scroll",a],["load",a],["transitionrun",c],["transitionend",a],["transitioncancel",a],["animationstart",c],["animationend",a],["animationcancel",a]];d.forEach(h=>f.forEach(([y,w])=>h.addEventListener(y,w,{capture:!0,passive:!0}))),window.addEventListener("resize",a),document.fonts?.addEventListener?.("loadingdone",a);const g=typeof MutationObserver=="function"?new MutationObserver(h=>{h.some(y=>!n.contains(y.target))&&a()}):void 0;u.forEach(h=>g?.observe(h,{attributes:!0,childList:!0,subtree:!0,characterData:!0}));let E;try{if(typeof ResizeObserver=="function"){const h=new ResizeObserver(a);typeof h.observe=="function"&&(E=h)}}catch{E=void 0}let S=[];return{schedule:a,observe:h=>{!E||h.length===S.length&&h.every((y,w)=>y===S[w])||(E.disconnect(),S=h,h.forEach(y=>E?.observe(y)))},dispose(){o=!0,r!==void 0&&(window.cancelAnimationFrame(r),r=void 0),d.forEach(h=>f.forEach(([y,w])=>h.removeEventListener(y,w,{capture:!0}))),window.removeEventListener("resize",a),document.fonts?.removeEventListener?.("loadingdone",a),g?.disconnect(),E?.disconnect()}}}var fo=300,po=15e3,Lu=5e3,ho="em-canvas-busy-style";function Nu(){if(document.getElementById(ho))return;const e=document.createElement("style");e.id=ho,e.textContent="@keyframes em-canvas-busy-spin{to{transform:rotate(360deg)}}",document.head.appendChild(e)}var xu="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 ku(e){const t=Au("colorPrimary","#1677ff");return e&&getComputedStyle(e).getPropertyValue(io("colorPrimary")).trim()||t}function mo(e){Nu();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",xu),n.appendChild(r);const s=document.createElement("span");return s.setAttribute("role","img"),s.setAttribute("aria-label","loading"),s.setAttribute("style",`display:inline-flex;color:${ku(e)};animation:em-canvas-busy-spin 1s linear infinite`),s.appendChild(n),s}function Fu(e,t,n){const r=t??e,s=Math.max(r.left,e.left,0),o=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 o<=s||a<=i?{x:(e.left+e.right)/2-e.left,y:(e.top+e.bottom)/2-e.top}:{x:(s+o)/2-e.left,y:(i+a)/2-e.top}}function Bu(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 s={left:n.left,top:n.top,right:n.right,bottom:n.bottom},o=r.getBoundingClientRect();if(o.width>0&&!uo({left:o.left,top:o.top,width:o.width,height:o.height},s)){const i=At(s,co(o,At(s,Mn),Mn));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=Fu(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(mo(e.querySelector(".ant-app")??e)),r.appendChild(a)},remove:()=>r.remove()}}function Ln(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(mo(e))},fo);return{remove(){clearTimeout(r),t.remove(),n||(e.style.position="")}}}var ju=8e3;function Uu(){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:()=>{},dispose:()=>{}}}function Hu(e,t){for(let n=Te(e);n;n=Te(n)){const r=getComputedStyle(n),s=r.overflowX!=="visible"||r.overflowY!=="visible",o=[r.borderTopLeftRadius,r.borderTopRightRadius,r.borderBottomRightRadius,r.borderBottomLeftRadius].some(i=>ke(i)>0);if(s&&o)return n;if(n===t)return null}return null}function ke(e){return Number.parseFloat(e)||0}function Dt(e,t){return Math.abs(e-t)<=1}function $u(e){const t=getComputedStyle(e),n=ke(t.borderTopWidth),r=ke(t.borderRightWidth),s=ke(t.borderBottomWidth),o=ke(t.borderLeftWidth),i=(a,c,d)=>Math.max(0,ke(a)-Math.max(c,d));return{...On(e),radii:[i(t.borderTopLeftRadius,n,o),i(t.borderTopRightRadius,n,r),i(t.borderBottomRightRadius,s,r),i(t.borderBottomLeftRadius,s,o)]}}function Vu(e,t){const n=Dt(t.top,e.top),r=Dt(t.bottom,e.bottom),s=Dt(t.left,e.left),o=Dt(t.right,e.right),i=[n&&s?e.radii[0]:0,n&&o?e.radii[1]:0,r&&o?e.radii[2]:0,r&&s?e.radii[3]:0];return i.every(a=>a===0)?"":i.map(a=>`${a}px`).join(" ")}function Gu(e,t,n,r,s,o){const i=n.readyTimeoutMs??ju,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";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"),s||n.onCreated?.(d);const u=new l.Disposable;let f=!1,g,E=!1,S,b,h,y;const w=()=>{clearTimeout(y),y=setTimeout(()=>{E||(E=!0,b?.(new Error(`[canvas] ${e}: документ не загрузился за ${i} мс`)))},i)},A=()=>f?(h=Promise.resolve(),E=!0,h):(E=!1,h=new Promise((k,j)=>{S=k,b=j}),w(),h),D=()=>{if(clearTimeout(y),f=!0,E){h=Promise.resolve();return}E=!0,n.mark?.("loaded"),S?.()};d.addEventListener("load",D),u.addDispose(()=>{clearTimeout(y),d.removeEventListener("load",D)});let N;const m=()=>{N??=n.bindResizer?.(d)},_=()=>{N?.dispose(),N=void 0};let C=null,M=null,p,v=Mn,T="",L="",O=0;const F=k=>{const j=JSON.stringify(k);return j===T?!1:(T=j,a.style.visibility=k.visibility,a.style.left=`${k.css.left}px`,a.style.top=`${k.css.top}px`,a.style.width=`${k.css.width}px`,a.style.height=`${k.css.height}px`,a.style.borderRadius=k.radius,d.style.width=k.elementWidth>0?`${k.elementWidth}px`:"100%",d.style.transform=k.shiftX!==0?`translate(${k.shiftX}px, ${k.shiftY}px)`:`translateY(${k.shiftY}px)`,!0)},I=()=>{if(!C)return T="",a.style.visibility="hidden",d.removeAttribute("id"),!1;n.elementId&&(d.id=n.elementId);const k=C.getBoundingClientRect(),j=Pu(C),G=M?.isConnected?M:null;p?.observe([C,d,...j.map($=>$.node),...G?[G]:[]]);const V=Ru(k,j,G),Q=Math.max(0,V.right-V.left),_e=Math.max(0,V.bottom-V.top),gt=getComputedStyle(C).visibility==="visible",Pe=Q<=0||_e<=0,be=Pe?{left:V.left,top:V.top,right:V.left,bottom:V.top}:V,zt=Pe?null:Hu(C,G??j[0]?.node??null),R=zt?Vu($u(zt),be):"",H=$=>F({visibility:gt?"":"hidden",css:At(be,$),elementWidth:k.width/$.scaleX,shiftX:(k.left-be.left)/$.scaleX,shiftY:(k.top-be.top)/$.scaleY,radius:R});let U=H(v);if(!Pe){const $=a.getBoundingClientRect();$.width>0&&!uo({left:$.left,top:$.top,width:$.width,height:$.height},be)&&(v=co($,At(be,v),v),U=H(v)||U)}return U},P=()=>{if(!C)return!1;let k=I();const j=d.getBoundingClientRect().height;j>0&&j!==O&&(O=j,C.style.height=`${j/lo(C).y}px`,k=!0);const G=getComputedStyle(C).pointerEvents;return G!==L&&(L=G,a.style.pointerEvents=G),k},x=()=>{p?.dispose(),p=void 0},J=k=>{p=Mu({slot:k,own:a,measure:P,onDetached:x})};let re=[];const z=(k,j)=>{if(M=j,k&&re.length>0){const G=re;re=[],G.forEach(V=>V())}if(k===C){k&&!p&&J(k),P();return}if(x(),C&&C.style.removeProperty("height"),T="",O=0,L="",C=k,!k){I(),_();return}n.onShown?.(d),J(k),P(),m()};u.addDispose(x);const K=k=>{f=!1,g=void 0,o?.(),k&&n.onReload?.(d);let j;E||h===void 0?j=A():(w(),j=h);try{d.contentWindow?.location.reload()}catch{d.src=c}return j};return{element:d,ready(){return h??A()},reload:()=>K(!0),reloadQuietly:()=>K(!1),followReload:()=>{g=void 0,o?.(),n.onReload?.(d)},moveTo(k){if(a.parentNode===k)return h??A();f=!1,g=void 0,o?.();let j;return E||h===void 0?j=A():(w(),j=h),k.appendChild(a),n.onReload?.(d),T="",p?.schedule(),j},get shown(){return C!==null},get slot(){return C},whenShown(){return C!==null?Promise.resolve():new Promise(k=>{re.push(k)})},get filled(){return g},noteFilled(k){g=k},alignTo(k,j){z(k,j??null)},scrollBy(k,j){let G=k,V=j;for(let Q=C?Te(C):null;Q;Q=Te(Q)){if(Math.abs(G)<1&&Math.abs(V)<1)return;const _e=getComputedStyle(Q);if((_e.overflowY==="auto"||_e.overflowY==="scroll")&&Q.scrollHeight>Q.clientHeight){const gt=Q.scrollTop,Pe=Q.scrollLeft;Q.scrollBy({left:G,top:V,behavior:"instant"}),G-=Q.scrollLeft-Pe,V-=Q.scrollTop-gt}}(Math.abs(G)>=1||Math.abs(V)>=1)&&window.scrollBy({left:G,top:V,behavior:"instant"})},resize(){N?.resize()},dispose(){z(null,null),_(),u.dispose(),a.remove()}}}function Yu(e){const t=new Map;let n="a";const r=()=>n==="a"?"b":"a",s=(v,T)=>v==="email"?`email:${T??n}`:v,o=new Map;let i,a=[],c=!1,d,u,f=!1,g,E,S="shown",b=0,h,y,w;const A=v=>u!==void 0&&v.filled!==void 0&&v.filled!==u,D=()=>{h=void 0;const v=g;!f||!v||u===void 0||y===u||!A(v)||(y=u,e.onForeignDocument?.({wanted:u,filled:v.filled,role:S,heldMs:Date.now()-b}))},N=()=>{f=!1,g=void 0,E=void 0,clearTimeout(h),h=void 0},m=(v,T)=>{const L=o.get("email"),O=L?.slot??null;return v&&O&&A(v)?(v.alignTo(null),f||(f=!0,b=Date.now(),h=setTimeout(D,Lu)),S=T,g=v,!(i!==void 0||c)&&E!==v&&(E=v,e.onShown?.(v.element)),!d&&!i&&(d=Ln(O)),!1):(f&&(N(),d?.remove(),d=void 0),v?.alignTo(O,L?.clip??null),!0)},_=()=>{f&&!c&&m(t.get(s("email")),"shown")},C=()=>{a.forEach(v=>clearTimeout(v)),a=[],i?.remove(),i=void 0,d?.remove(),d=void 0,(c||f)&&(c=!1,m(t.get(s("email")),"shown"))},M=(v,T,L)=>{const O=s(v,T),F=t.get(O);if(F)return F;const I=e.resolveMount();if(!I)return Uu();const P=Gu(v,I,e,v==="email"?T??n:void 0,L,v==="email"?()=>_():void 0);return t.set(O,P),P},p={get:v=>M(v),current:v=>M(v),peek:v=>t.get(s(v)),spare:()=>t.get(s("email",r())),ensureSpare:()=>M("email",r(),!0),promote(){const v=t.get(s("email",r()));if(!v)return;const T=t.get(s("email"));n=r(),w=void 0,m(v,"spare"),T?.alignTo(null)},alignSurface(v,T,L){const O=o.get(v);if(o.set(v,{slot:T,clip:L??null}),v==="email"&&c){d?.remove(),d=T?Ln(T):void 0;return}const F=T?M(v):t.get(s(v));if(v!=="email"){F?.alignTo(T,L??null);return}if(!T){w=O?.slot&&F?.shown?{slot:O.slot,handle:F}:void 0,f&&(N(),d?.remove(),d=void 0),F?.alignTo(null);return}const I=w?.slot===T&&w.handle===F;if(w=void 0,O?.slot===T&&F?.shown||I){F?.alignTo(T,L??null);return}m(F,"shown")},want(v){u=v,v!==void 0&&_()},noteFilled(v,T){const L=p.byWindow(v);L&&(L.noteFilled(T),L===t.get(s("email"))&&_())},visible(){for(const v of t.values())if(v.shown)return v},byWindow(v){if(v){for(const T of t.values())if(T.element.contentWindow===v)return T}},busy(v){if(C(),!v)return;if(!p.visible()){c=!0,d?.remove(),d=void 0;const O=o.get("email");O?.slot&&(d=Ln(O.slot)),a=[setTimeout(C,po)];return}const T=e.resolveMount();if(!T)return;const L=Bu(T,()=>p.visible()?.element.parentElement?.getBoundingClientRect()??null);i=L,a=[setTimeout(()=>L.showSpinner(),fo),setTimeout(C,po)]},remount(v){C();const T=s("email");t.forEach((L,O)=>{if(O===T){L.moveTo(v).catch(()=>{});return}L.dispose(),t.delete(O)})},dispose(){u=void 0,c=!1,N(),w=void 0,C(),t.forEach(v=>v.dispose()),t.clear(),o.clear(),n="a",u=void 0,y=void 0}};return p}var Wu=l.createIdentifier$1("canvas.resizerBinder"),Nn=l.createIdentifier$1("canvas.service"),qu={created:te.canvasCreated,loaded:te.canvasLoaded},go=new WeakMap;function xn(e){return go.get(e)??0}function zu(e,t){if(e.getInstance(Nn))return;const n=Yu({resolveMount:()=>t.resolveMount(),resolveSrc:s=>t.resolveSrc(s),resolveSandbox:Ad,elementId:t.elementId,bindResizer:s=>e.getInstance(Wu)?.(s),onCreated:s=>Pt(e,s,"fresh"),onReload:s=>{go.set(s,xn(s)+1),Pt(e,s,"fresh")},onShown:s=>Pt(e,s,"switch"),mark:s=>t.mark?.(qu[s]),onForeignDocument:s=>{({...s},gl("canvas identity: place held, frame has another document",{origin:"canvas-identity",level:"warning",tags:{role:s.role},contexts:{canvasIdentity:{...s,path:window.location.pathname}}}))}}),r=Z(e).addListener(l.EVENT_TYPES.SANDBOX_WHEEL,s=>{n.visible()?.scrollBy(s?.deltaX??0,s?.deltaY??0)});e.inject(Nn,n),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r.dispose(),n.dispose()})}function Pt(e,t,n){const r=Z(e),s=t.contentWindow;if(!s)return;const o=r.getTarget()===s;o&&n==="switch"||(n==="fresh"&&(r.forget(s),o&&r.setTarget(void 0)),r.setTarget(s),cd(r))}function Ku(e,t){Pt(e,t,"promote")}function Xu(e,t){const n=t.contentWindow;n&&Z(e).greet(n)}function Eo(e,t){const n=t.contentWindow;n&&Z(e).forget(n)}function Ju(e,t){const n=ee(e)?.byWindow(t)?.element;if(!n)return;const r=xn(n);return()=>xn(n)!==r}function ee(e){return e.getInstance(Nn)}function Qu(e){const t=Z(e),n=()=>ee(e)?.byWindow(t.getTarget()),r=t.addListenerAsync(l.EVENT_TYPES.RELOAD,()=>{n()?.followReload()}),s=t.addOffTargetListener(l.EVENT_TYPES.RELOAD,a=>{const c=ee(e)?.byWindow(a);c&&Eo(e,c.element)}),o=t.addListener(a=>{a.data?.operation===l.EVENT_TYPES.SANDBOX_RESIZED&&n()?.resize()}),i=X(e,l.events.ON_EMAIL_INIT_ID)(()=>{n()?.resize()});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r.dispose(),s.dispose(),o.dispose(),i.dispose()})}function vo(){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 Zu(e){const t=e.getInstance(l.OPTIONS_SOURCE_ID);let n,r;e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r?.remove(),r=void 0}),zu(e,{resolveMount:()=>n,resolveSrc:o=>qs(o==="block"),elementId:"email_iframe",mark:o=>W(o)}),t?.watch(o=>{const i=o?.element;if(n&&i instanceof HTMLElement&&i!==n){n=i,ee(e)?.remount(i),r?.remove(),r=void 0;return}if(!n){if(i instanceof HTMLElement)n=i;else if(o!==void 0){n=r??=vo(),ee(e)?.alignSurface("email",r,r);return}else return;ee(e)?.get("email")}});let s;e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{s?.remove(),s=void 0}),$c(e).watch(o=>{const i=ee(e);if(i){if(o){s??=vo(),i.alignSurface("email",s,s);return}s&&(i.alignSurface("email",null),s.remove(),s=void 0)}})}var _o=l.createIdentifier$1("canvas.headerFlow"),bo=["subject","preheader"],ef=3e3,tf={subject:l.EVENT_TYPES.SANDBOX_SUBJECT_UPDATE,preheader:l.EVENT_TYPES.SANDBOX_PREHEADER_UPDATE};function nf(e){const t=Ee(e),n=Z(e),r=h=>h?"remote":oo(e)?"system":"user",s=(h,{guid:y,value:w,forced:A})=>{const D=We(t);if(!D||typeof w!="string"||y&&y!==D.get().docId)return;const N=t.forcedHeaders();if(N?.[h]&&!A&&w!==N[h])return;A&&(f.delete(h),f.size===0&&t.endForcedHeaders());const m=D.get().attributes[h]??"";a=!0;try{Ke(D,{[h]:w},{source:r(A)})}finally{a=!1}o[h]=w,se(e,l.events.ON_HEADER_APPLIED_ID).fire({field:h,value:w,forced:!!A,isGenerated:w!==m&&!!w})};let o={},i,a=!1,c=Promise.resolve();const d=(h,y,w,A=!1)=>{c=n.sendAsync(tf[h],{value:y,guid:We(t)?.get().docId,...w?{force:!0,echo:!0}:{},...A?{undoStep:!0}:{}}).catch(D=>{})};let u;const f=new Set;e.inject(_o,{whenDelivered:async()=>{await c},reassert:h=>{const y=We(t),w=bo.filter(A=>h[A]);if(!(!y||w.length===0)){a=!0;try{Ke(y,Object.fromEntries(w.map(A=>[A,h[A]])),{source:"system"})}finally{a=!1}t.beginForcedHeaders({subject:h.subject??"",preheader:h.preheader??""}),clearTimeout(u),u=setTimeout(()=>{f.clear(),t.endForcedHeaders()},ef),f.clear();for(const A of w)f.add(A);for(const A of w)o[A]=h[A],d(A,h[A],!0)}}});const g=()=>{i?.(),i=void 0;const h=We(t);if(!h){o={};return}const y=h.get().attributes;o={subject:y.subject,preheader:y.preheader},i=h.subscribe(({source:w})=>{if(a)return;const A=h.get().attributes,D=t.forcedHeaders();for(const N of bo){const m=A[N];m!==o[N]&&(o[N]=m,d(N,m??"",w==="system"&&D?.[N]!==void 0,w==="user"))}})};g();const E=t.subscribe(g),S=n.addListenerAsync(l.EVENT_TYPES.APPLICATION_SUBJECT_UPDATE,h=>s("subject",h)),b=n.addListenerAsync(l.EVENT_TYPES.APPLICATION_PREHEADER_UPDATE,h=>s("preheader",h));e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{S.dispose(),b.dispose(),E(),i?.(),clearTimeout(u)})}function yo(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function kn(e,t){const n={...e};for(const r of Object.keys(t)){const s=t[r],o=e[r];yo(s)&&yo(o)?n[r]=kn(o,s):s!==void 0&&(n[r]=s)}return n}function rf(e,t){const n=l.COMMON_STYLES;if(typeof e=="string"){const r=e.trim();if(r.startsWith("{"))try{const s=JSON.parse(r);if(s&&typeof s=="object"&&!Array.isArray(s)&&Object.keys(s).length>0)return kn(n,s)}catch{}}return t&&typeof t=="object"&&!Array.isArray(t)?kn(n,t):n}function sf(){const e=window.localStorage.getItem(l.LOCAL_STORAGE_ITEMS.em_color_scheme),t=matchMedia("(prefers-color-scheme: dark)").matches?l.DARK:l.LIGHT;return e&&e!=="system"?e:t}function of(){const e=window.localStorage.getItem(l.LOCAL_STORAGE_ITEMS.em_code_mode_settings);if(!e)return!1;try{const t=JSON.parse(e);return!!(t?.isCodeMode&&(t.codeModeDirection==="left"||t.codeModeDirection==="right"))}catch{return!1}}function af(e){const{config:t}=e;return{operation:l.EVENT_TYPES.UPDATE_PREVIEW,theme:e.theme,commonStyles:rf(e.emailCommonStyles,e.defaultCommonStyles),pathEnabled:t.pathEnabled,copyPasteEnabled:t.copyPasteEnabled,saveBlockEnabled:t.saveBlockEnabled,editImageControlEnabled:t.editImageControlEnabled,codeMode:e.codeMode,elementAIimageEnabled:t.elementAIimageEnabled,imageCenterStockEnabled:t.imageCenterStockEnabled,imageCenterGifEnabled:t.imageCenterGifEnabled,imageCenterEditorEnabled:t.imageCenterEditorEnabled,blocksAddPanelEnabled:t.blocksAddPanelEnabled!==!1&&t.blocksSectionsShow!==!1,lockEditor:t.lockEditor,appName:e.appName}}var lf=l.createIdentifier$1("DefaultCommonStyles");function So(e){return e.getOrCreateInstance(lf,()=>ce(void 0))}function cf(e,t){So(e).set(t)}function df(e){const t=Z(e),n=e.getInstance(l.CONFIG_SOURCE_ID),r=e.getInstance(l.OPTIONS_SOURCE_ID),s=Ee(e);let o,i="";const a=()=>{const w=n?.get()??{},A=af({config:w,emailCommonStyles:s.current()?.get().attributes?.common_styles,defaultCommonStyles:o,theme:sf(),codeMode:of(),appName:"useblocks"}),D=JSON.stringify(A);D!==i&&(i=D,t.send(A))},c=t.onInit(()=>{i="",a()}),d=()=>{t.isInited()&&a()},u=n?.watch(d),f=So(e).watch(w=>{o=w,d()}),g=r?.watch(w=>{w&&"commonStyles"in w&&(o=w.commonStyles),d()});let E;const S=()=>{E?.(),E=s.current()?.subscribe(d),d()};S();const b=s.subscribe(S),h=matchMedia(l.PREFERS_COLOR_SCHEME_DARK),y=()=>d();h.addEventListener("change",y),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{c.dispose(),u?.dispose(),f.dispose(),g?.dispose(),E?.(),b(),h.removeEventListener("change",y)})}var Fn;(function(e){function t(s,o,i=(a,c)=>a===c){if(s===o)return!0;if(s.length!==o.length)return!1;for(let a=0;a<s.length;a++)if(!i(s[a],o[a]))return!1;return!0}e.isEqual=t;function n(s,o=i=>i){const i=new Set;return s.filter(a=>{const c=o(a);return i.has(c)?!1:(i.add(c),!0)})}e.unique=n;function r(s=[],o=[],i=(a,c)=>a===c){const a=[],c=[],d=[];for(const u of s){const f=o.find(g=>i(u,g));f?d.push({prev:u,next:f}):c.push(u)}for(const u of o)s.find(f=>i(u,f))||a.push(u);return{added:a,removed:c,exists:d}}e.diff=r})(Fn||(Fn={}));function uf(e,t){return e.type===t.type&&e.key===t.key}function ff(e){const t=Z(e),n=()=>e.getServices(l.SANDBOX_EXTENSIONS_ID)??[];let r=[];const s=t.onInit(()=>{r=n(),t.send(l.EVENT_TYPES.SANDBOX_ADD_EXTENSIONS,r)}),o=l.getServiceContainerId(l.SANDBOX_EXTENSIONS_ID),i=e.onInject(a=>{if(a!==o)return;const c=n();if(!t.isInited()){r=c;return}const{added:d,removed:u}=Fn.diff(r,c,uf);if(r=c,u.length){if(u.some(f=>f.type==="script")){t.send(l.EVENT_TYPES.RELOAD);return}t.send(l.EVENT_TYPES.SANDBOX_REMOVE_EXTENSIONS,u.map(f=>f.key))}d.length&&t.send(l.EVENT_TYPES.SANDBOX_ADD_EXTENSIONS,d)});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{s.dispose(),i?.dispose()})}var pf=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 hf(e){return e.length>0&&!e.startsWith("em:")&&!pf.has(e)}function mf(e){const t=Z(e),n=new Map;let r=!1,s=-1,o=new Set;const i=d=>(d!==s&&(s=d,o=new Set),o),a=t.observeOutgoing((d,u)=>{if(!r||!hf(d))return;const f=ue(t);n.set(d,{data:u,generation:f,scripts:new Set(i(f))})}),c=t.addListener(l.SANDBOX_EXTENSION_SCRIPT_STATUS_ID,d=>{if(d.phase!=="ready"||d.status!=="success")return;r=!0;const u=ue(t),f=i(u);f.add(d.key);for(const[g,E]of n)E.generation===u||![...E.scripts].every(S=>f.has(S))||(E.generation=u,t.send(l.createIdentifier(g),E.data))});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{a.dispose(),c.dispose()})}var gf=l.createIdentifier$1("prewarm.editorVisible");function Ef(e){if(typeof requestAnimationFrame!="function"){setTimeout(e,0);return}requestAnimationFrame(()=>requestAnimationFrame(e))}function vf(e={}){const t=e.paint??Ef;let n=!1,r=!1,s=!1,o=!1,i=!1;const a=[],c=()=>{i||o||!n||!r||!s||(o=!0,t(()=>{i=!0,W(te.editorVisible);for(const d of a.splice(0))d()}))};return{noteShellVisible(){n=!0,c()},notePagePainted(){r=!0,c()},noteContentShown(){s=!0,c()},whenVisible(d){if(i){d();return}a.push(d)},contentShown:()=>s}}function _f(e){return e.getOrCreateInstance(gf,()=>vf())}var bf=500,yf=500,Sf=5e3;function If(e){const t=e.quietMs??bf,n=e.floorMs??yf,r=e.ceilingMs??Sf;let s,o,i=0;const a=()=>{clearTimeout(s),clearTimeout(o),s=void 0,o=void 0},c=()=>{a(),e.run()},d=()=>{clearTimeout(s);const u=n-(Date.now()-i);s=setTimeout(c,Math.max(t,u))};return{start(){a(),i=Date.now(),o=setTimeout(c,r),d()},notify(){s!==void 0&&d()},cancel:a}}function wf({attributes:e,readContent:t,docId:n,hasSession:r,serverId:s,show:o}){if(!r)return;const i={id:s??void 0,renderGuid:n,showId:o?.id,isNew:s==null,showToken:o?.token},a={...e,...i};return Object.defineProperty(a,"html",{get:()=>t()??"",enumerable:!0,configurable:!0}),a}var Io="self-init:";function Tf(e){return e.startsWith(Io)}function wo(e,t){const n=e.getActiveShowRequest();return Tf(t)?n===null:n?.showId===t&&e.hasPendingShow(t)}function Cf(e){const t=()=>e.initPipeline(),n=e.messageService,r=()=>e.waitScope?.()??t(),s=()=>e.frameWatch?.();let o="",i;const a=S=>{i={target:e.readTarget?.(),docId:S}},c=()=>e.readDocument()?It(e.readDocument()):o,d=()=>we(e.container).editorPolicy,u=()=>e.readEmail(),f=()=>{const S=u();return{...S,id:e.isTemplate()||S.isNew?void 0:S.id,html:c()}};let g=!1;const E={readContent:c,publicEmail:f,sendInitStart:()=>pe(n,"INIT_START",l.EVENT_TYPES.SANDBOX_INIT_START,{guid:u().renderGuid},void 0,r()),sendInited:()=>pe(n,"INITED",l.EVENT_TYPES.SANDBOX_INITED,{guid:u().renderGuid},void 0,r(),s()),async sendContent(){const S=u(),{html:b,hasBrowserExtensionArtifacts:h}=Zs(S?.html||"");h&&e.events.browserExtensionDetected(),eo(e.readDocument(),b),o=b,a(S.renderGuid),await pe(n,"SET_ENTITY",l.EVENT_TYPES.SANDBOX_SET_ENTITY,wt(c(),S.renderGuid,d(),e.readDocument()?.get().version),{guid:S.renderGuid,emailId:S.id??null},r(),s())},refreshContent:()=>(a(u().renderGuid),pe(n,"SET_ENTITY",l.EVENT_TYPES.SANDBOX_SET_ENTITY,wt(c(),u().renderGuid,d(),e.readDocument()?.get().version),void 0,r(),s())),sendPreheader:async()=>{const S=u();if(S.preheader!==void 0)return pe(n,"PREHEADER",l.EVENT_TYPES.SANDBOX_PREHEADER_UPDATE,{value:S.preheader,guid:S.renderGuid,force:!0},void 0,r(),s())},sendSubject:async()=>{const S=u();if(S.subject!==void 0)return pe(n,"SUBJECT",l.EVENT_TYPES.SANDBOX_SUBJECT_UPDATE,{value:S.subject,guid:S.renderGuid,force:!0},void 0,r(),s())},revealFilled:()=>e.revealFilled?.()??Promise.resolve(),showFilled:S=>e.showFilled?.(S),noteFilled:(S,b)=>e.noteFilled?.(S,b),contentSent:()=>i,readTarget:()=>e.readTarget?.(),fireWillInit:()=>e.events.willInit(f()),fireInit(S,b){if(!wo(t(),S)){t().getActiveShowRequest()?.showId;return}const h=u();h.id,h.renderGuid,t().completeShow(S);const y=e.readDocument();Ke(y,{is_inited:!0},{source:"system"});const w=()=>{const D=f();b&&(D.reset=!0);const N=e.events.inited(D);return b||(g&&E.fireEmailChanged(),g=!0),N};if(!y||y.isReady())return w();const{docId:A}=y.get();return y.whenReady().then(()=>e.readDocument()?.get().docId===A?w():void 0,()=>{})},fireEmailChanged(){e.events.emailChanged(f())},fireContentChanged(){e.events.contentChanged(c())}};return E}var Af=2;function To(){return new Error("[sandbox] document reloaded during fill")}function Df(e,t,n){return{showId:e,reset:t,emailId:n?.id,renderGuid:n?.renderGuid}}function Bn(e){try{e()}catch{}}function Pf(e){let t;return Bn(()=>{t=e()}),{stage:n=>Bn(()=>t?.stage(n)),end:(n,r)=>Bn(()=>t?.end(n,r))}}function Rf(e){const t=()=>e.initPipeline();let n=!1,r,s,o,i=0,a,c;const d=()=>{const m=e.readTarget?.(),_=e.readSandboxGeneration?.();return m===void 0||_===void 0?void 0:{target:m,generation:_}},u=()=>{const m=d();return m&&{...m,canvasReplaced:e.trackDocument?.(m.target)}},f=m=>{if(m?.canvasReplaced?.())return!0;const _=d();return m!==void 0&&_?.target===m.target&&_.generation!==m.generation},E=Cf({...e,waitScope:()=>({getSandboxTimeoutMs:m=>t().getSandboxTimeoutMs(m),getSandboxReadyTimeoutMs:()=>t().getSandboxReadyTimeoutMs(),signal:a?.signal??t().signal}),frameWatch:()=>{const m=c;if(!(!m||!e.onSandboxGenerationChange))return{getGeneration:()=>d()?.generation??m.generation,onChange:_=>e.onSandboxGenerationChange?.(()=>{(e.readTarget?.()===m.target||m.canvasReplaced?.())&&_()})??(()=>{})}}});let S;const b=(m,_)=>{if(S===m)return;S=m;const C=i;setTimeout(()=>{i!==C||t().signal.aborted||A(m,_).catch(()=>{})},0)},h=()=>{a?.abort(),a=void 0};let y;const w=()=>{const m=t().signal;m!==y&&(y?.removeEventListener("abort",h),y=m,m.addEventListener("abort",h))};async function A(m,_,C=0){const M=++i;h(),a=new AbortController,c=void 0,w();const p=()=>i!==M,v=E.readTarget(),T=t().generation,L=()=>T===t().generation&&!t().signal.aborted,O=_?"init:reset-":"init:",F=Pf(()=>e.observeShow?.(Df(m,_,e.readEmail())));if(!_){const z=E.publicEmail();z?.id,z?.renderGuid,z?.preheader}let I=!1,P=!1,x,J=!1;const re=()=>{if(f(x))throw To()};try{n=!0,await E.sendInitStart(),p()||(x=u(),c=x),C===0&&E.fireWillInit(),await(_||C>0?E.refreshContent():E.sendContent()),I=!0,re();const z=E.contentSent();E.noteFilled(z?.target,z?.docId),F.stage("content"),_||E.publicEmail()?.id;try{await E.sendPreheader()}catch(K){if(no(K))throw K;`${O}`,String(K)}try{await E.sendSubject()}catch(K){if(no(K))throw K;`${O}`,String(K)}if(re(),p()||E.showFilled(v),await E.sendInited(),re(),P=!0,s===m){const K=e.readSandboxGeneration?.()??o;K!==void 0&&(r=K)}F.stage("reveal"),await E.revealFilled(),re(),F.end("revealed")}catch(z){const K=!p()&&L()&&f(x),k=K?To():void 0,j=k??z,G=K&&C<Af?N(m,_,C+1):void 0;J=K&&G===void 0;const V=p()?void 0:{showId:m,contentApplied:I,sandboxInitedAcked:P,superseded:!1,...e.describeSurface?.(),error:String(k??z)};V&&(`${O}`,void 0);const Q=!p()&&e.recoverFailedFill?.(v)===!0;if(F.end(p()?"superseded":Q?"recovered":l.isAbortError(j)||!L()?"aborted":"failed",V),!Q&&!p()&&wo(t(),m)&&t().failShow(m,j),G!==void 0)return G;throw j}finally{D(m,_,O,{superseded:p(),sessionGeneration:T,contentApplied:I,sandboxInitedAcked:P&&!J,retry:!J,commit:L()})}}function D(m,_,C,M){const{superseded:p,contentApplied:v,sandboxInitedAcked:T}=M;if(p){`${C}`;return}T&&M.commit?E.fireInit(m,_||void 0):T?(`${C}`,M.sessionGeneration,t().generation,t().signal.aborted,void 0):v?(`${C}`,void 0):(`${C}`,void 0),n=!1,a=void 0,!T&&s===m&&(s=void 0,r===o&&(r=void 0)),!T&&v&&M.retry&&b(m,_)}function N(m,_,C){return A(m,_,C)}return{channel:E,isEventsLocked:()=>n,filledGeneration:()=>r,markFilled:m=>{r=m},lastCorrelation:()=>s,markCorrelation:m=>{s=m},bumpRunSeq:()=>{i+=1},noteSandboxGeneration:m=>{o=m},fill:m=>A(m,!1),refill:m=>A(m,!0),stop:()=>{i+=1,h(),n=!1,y?.removeEventListener("abort",h),y=void 0}}}function Of(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:Co(e,n)}function Co(e,t){return t?e?.id==null?!1:String(e.id)===String(t):!0}function Mf(e){const{pipeline:t,readEmail:n,readDocument:r,readRouteEmailId:s,readSandboxGeneration:o}=e,i=u=>{const f=n(),g=s();if(!Of(f,u,g)){u.showId,u.navId,u.emailId,f?.id,f?.showId,f?.renderGuid;return}u.showId,f?.id,f?.renderGuid,t.markFilled(o()),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=o();if(t.filledGeneration()===u)return;const f=n(),g=s();if(!f?.renderGuid||!Co(f,g))return;const E=`${Io}${f.renderGuid}`;t.markFilled(u),t.markCorrelation(E);const S=r()?.isReady()===!0;f.id,f.renderGuid,(S?b=>t.refill(b):b=>t.fill(b))(E).catch(()=>{t.lastCorrelation()===E&&t.markFilled(void 0)})},saasChanged:()=>{const u=n();u?.renderGuid,u?.showToken,u?.id,r()}}}var Lf=l.createIdentifier$1("canvas.health");function Nf(e){return e??""}function xf(e,t,n,r){return[e??"",t??"",n==null?"":String(n),r??""].join("|")}function Ao(e){return e.length>0}function kf(e){const t=Ee(e),n=Z(e),r=()=>de(t.sessionKey())?void 0:t.current(),s=()=>{const R=r();return wf({attributes:R?.get().attributes??{},readContent:()=>R?.getContent(),docId:R?.get().docId,hasSession:!!R,serverId:R?.get().serverId,show:t.showFacts()})},o=()=>e.getInstance(l.INIT_PIPELINE_ID)??Pn;let i={},a=!1;const c=e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(R=>{a=!!R?.element});let d=!1,u=!1,f=!1,g=0;const E=()=>{const R=ee(e);if(!R)return;const H=++g,U=R.spare();return U&&Eo(e,U.element),(U?U.reloadQuietly():R.ensureSpare()?.ready())?.then(()=>{if(H!==g)return;d=!0;const $=R.spare();$&&Xu(e,$.element),f&&(f=!1,T(),k())})},S=If({run:()=>{f||E()?.catch(()=>{})}}),b=()=>{_f(e).noteContentShown(),!d&&!f&&S.start()};let h=!1;const y=R=>{const H=ee(e),U=H?.spare()?.element.contentWindow;u&&H&&U&&R===U&&(u=!1,H.promote(),H.busy(!1),h=!0)};let w=!1;const N=Rf({container:e,messageService:n,initPipeline:o,readDocument:r,readEmail:s,revealFilled:()=>{const R=ee(e);return h&&R&&(h=!1,S.start()),a?R?.current("email").whenShown()??Promise.resolve():Promise.resolve()},showFilled:y,noteFilled:(R,H)=>ee(e)?.noteFilled(R,H),recoverFailedFill:R=>{const H=ee(e),U=H?.spare()?.element.contentWindow;return!u||!H||!U||R!==U?!1:(u=!1,d=!1,p="reload",H.busy(!1),H.peek("email")?.reload(),w=!0,k(),!0)},readTarget:()=>n.getTarget(),isTemplate:()=>!!i.isTemplate,readSandboxGeneration:()=>ue(n),onSandboxGenerationChange:R=>wn(n,R),trackDocument:R=>Ju(e,R),observeShow:R=>e.getInstance(Lf)?.begin(R),describeSurface:()=>({canvasPath:p,promoted:u,spareClean:d,handshake:n.isInited(),generation:ue(n)}),events:{willInit:R=>{se(e,l.events.WILL_EMAIL_INIT_ID).fire(R)},inited:R=>{b(),se(e,l.events.ON_EMAIL_INIT_ID).fire(R)},contentChanged:R=>{se(e,l.events.ON_CONTENT_CHANGED_ID).fire(R)},emailChanged:R=>{se(e,l.events.ON_EMAIL_CHANGED_ID).fire(R)},browserExtensionDetected:()=>{se(e,l.events.ON_BROWSER_EXTENSION_DETECTED_ID).fire()}}}),m=Mf({pipeline:N,initPipeline:o,readEmail:s,readDocument:r,readRouteEmailId:()=>i.emailId,readSandboxGeneration:()=>ue(n)});let _="",C="",M="",p="none";const v=()=>{const R=ee(e)?.spare()?.element.contentWindow;R&&n.getTarget()===R||n.sendNow({operation:l.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!0})},T=()=>{const R=ee(e)?.spare();R&&(v(),d=!1,u=!0,Ku(e,R.element))},L=(R,H)=>{const U=ee(e);if(!U)return!0;const $=U.spare(),Re=$&&d?"spare":"prepare";if(p=Re,U.busy(!0),$&&d)return T(),!0;S.cancel(),v();const Oe=E();if(Oe===void 0)return p="reload",U.busy(!1),U.peek("email")?.reload(),!0;f=!0;const ye=g;return Oe.catch(()=>{!f||ye!==g||(f=!1,p="reload",U.busy(!1),U.peek("email")?.reload())}),!1},O=()=>{gt(),N.noteSandboxGeneration(ue(n));const R=s(),H=xf(R?.renderGuid,R?.showId,R?.id,i.emailId),U=Nf(R?.renderGuid);if(U!==C){const Oe=C;C=U;const ye=ee(e)?.peek("email")?.filled,Kv=ye!==void 0&&ye!==U;Ao(U)&&(Ao(Oe)||Kv)&&L(Oe||(ye??""),U)}if(f)return;(H!==_||w)&&(w=!1,_=H,m.showRequestIdentityChanged());const $=r(),Re=`${H}|${$?.get().docId??""}|${ue(n)}`;Re!==M&&$?.isReady()===!0&&(M=Re,m.selfInitChanged()),m.saasChanged(),z()};let F=!1,I="",P="",x=!1,J=!1;const re=R=>{R.source==="user"?J=!0:(r()?.isReady()===!1||t.forcedHeaders()!==void 0)&&(x=!0),k()},z=()=>{const R=s();if(!R?.renderGuid)return;const H=N.channel.readContent(),U=JSON.stringify([R.preheader,R.common_styles,R.meta,R.subject,R.utm_parameters?.utm_campaign??"",R.utm_parameters?.utm_content??"",R.utm_parameters?.utm_medium??"",R.utm_parameters?.utm_source??"",R.utm_parameters?.utm_term??""]),$=F&&H!==P,Re=F&&U!==I;F=!0,P=H,I=U;const Oe=x&&!J;if(x=!1,J=!1,N.isEventsLocked()||Oe)return;const ye={...R,id:i.isTemplate||R.isNew?void 0:R.id,html:H};if($){se(e,l.events.ON_CONTENT_CHANGED_ID).fire(H),se(e,l.events.ON_EMAIL_CHANGED_ID).fire(ye);return}Re&&R.is_inited&&se(e,l.events.ON_EMAIL_CHANGED_ID).fire(ye)};let K=!1;const k=()=>{K||(K=!0,queueMicrotask(()=>{K=!1,O()}))};e.inject(Rn,{pipeline:N,setRoute:R=>{R.emailId===i.emailId&&!!R.isTemplate==!!i.isTemplate||(i=R,k())}});let j,G;const V=()=>{const R=r()?.get().docId;R!==G&&(j?.(),G=R,j=r()?.subscribe(re)),k()};let Q,_e;const gt=()=>{const R=e.getInstance(l.INIT_PIPELINE_ID);!R||R===Q||(_e?.(),Q=R,_e=R.onShowRequested(H=>m.showRequested(H)))},Pe=n.addListener(R=>{R.data?.operation===l.EVENT_TYPES.SANDBOX_RESIZED&&S.notify()}),be=t.subscribe(V),zt=wn(n,k);V(),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{c?.dispose(),_e?.(),zt(),be(),j?.(),Pe.dispose(),S.cancel(),N.stop()})}function Ff(){return l.USEBLOCKS!=="useblocks"}var Do={config:{mode:"freeUserBlocks",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!0,styles:"",revisionService:!1,headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!0,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!0,webversionEnabled:!0,commonStylesEnabled:!0,emailResponsiveControlEnabled:!0,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!1,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!0,emailDropdownMenuClone:!0,emailDropdownMenuImport:!0,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportZipEnabled:!0,exportTextEnabled:!0,exportMarkdownEnabled:!0,exportClipboardEnabled:!0,exportWebHookEnabled:!0,exportOutlookEnabled:!0,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!0,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!0,aiAssistentEnabled:!0,optimizeEnabled:!0,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!0,annotationsEnabled:!1,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!0,tagsEnabled:!0,isTemplateEnabled:!0,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!0,deleteButtonEnabled:!0,toggleSidePanel:!0,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!0,formFieldImageTitleEnabled:!0,formFieldBorderEnabled:!0,formFieldBorderRadiusEnabled:!0,formFieldBoxShadowEnabled:!0,formFieldVisibilityEnabled:!0,formFieldExportAsPictureEnabled:!0,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!0,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!0,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!0,formCellFieldVerticalAlignEnabled:!0,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!0,formButtonFieldReplacerEnabled:!0,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!0,formImageFieldReplacerEnabled:!0,formImageFieldHeightEnabled:!0,formTextFieldTypografEnabled:!0,formTextFieldReplacerEnabled:!0,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!1,elementCountdownEnabled:!0,elementVideoEnabled:!0,elementAIimageEnabled:!0,elementAItextEnabled:!0,elementCarouselEnabled:!0,elementAccordionEnabled:!0,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!1,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!0,formFieldAmpVisibilityEnabled:!0,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4},project:void 0},Bf={config:{mode:"pro",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!0,styles:"",revisionService:!1,headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!0,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!0,webversionEnabled:!0,commonStylesEnabled:!0,emailResponsiveControlEnabled:!0,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!0,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!0,emailDropdownMenuClone:!0,emailDropdownMenuImport:!0,emailDropdownMenuImportButton:!1,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportZipEnabled:!0,exportTextEnabled:!0,exportMarkdownEnabled:!0,exportClipboardEnabled:!0,exportWebHookEnabled:!0,exportOutlookEnabled:!0,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!0,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!0,aiAssistentEnabled:!0,optimizeEnabled:!0,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!0,annotationsEnabled:!0,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!0,tagsEnabled:!0,isTemplateEnabled:!0,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!0,deleteButtonEnabled:!0,toggleSidePanel:!0,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!0,formFieldImageTitleEnabled:!0,formFieldBorderEnabled:!0,formFieldBorderRadiusEnabled:!0,formFieldBoxShadowEnabled:!0,formFieldVisibilityEnabled:!0,formFieldExportAsPictureEnabled:!0,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!0,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!0,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!0,formButtonFieldReplacerEnabled:!0,formCellFieldVerticalAlignEnabled:!0,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!0,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!0,formImageFieldReplacerEnabled:!0,formImageFieldHeightEnabled:!0,formTextFieldTypografEnabled:!0,formTextFieldReplacerEnabled:!0,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!0,elementCountdownEnabled:!0,elementVideoEnabled:!0,elementAIimageEnabled:!0,elementAItextEnabled:!0,elementCarouselEnabled:!0,elementAccordionEnabled:!0,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!0,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!0,formFieldAmpVisibilityEnabled:!0,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4,fileManager:{defaultFolderName:"",enableMoveFolder:!0,enableEdit:!0,enableTrash:!0,enableCopyFile:!0}},project:void 0,page:{isNew:!0,type:"email",project:0,id:"",showToken:0}},Po=Do,jf=["freeUserBlocks","blocks"],jn={};function Uf(e){jn=e}var Ro=e=>jf.includes(e)?Po:jn[e]??jn.editor??Po,Un={config:{mode:"simple",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!1,styles:"",headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!0,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!0,webversionEnabled:!1,commonStylesEnabled:!1,emailResponsiveControlEnabled:!1,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!1,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!0,emailDropdownMenuClone:!0,emailDropdownMenuImport:!0,emailDropdownMenuImportButton:!1,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportZipEnabled:!0,exportTextEnabled:!0,exportMarkdownEnabled:!0,exportClipboardEnabled:!0,exportWebHookEnabled:!0,exportOutlookEnabled:!1,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!0,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!0,aiAssistentEnabled:!0,optimizeEnabled:!0,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!1,annotationsEnabled:!1,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!0,tagsEnabled:!0,isTemplateEnabled:!0,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!0,deleteButtonEnabled:!0,toggleSidePanel:!0,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!0,formFieldImageTitleEnabled:!0,formFieldBorderEnabled:!1,formFieldBorderRadiusEnabled:!1,formFieldBoxShadowEnabled:!1,formFieldVisibilityEnabled:!1,formFieldExportAsPictureEnabled:!1,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!0,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!0,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!0,formButtonFieldReplacerEnabled:!1,formCellFieldVerticalAlignEnabled:!0,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!1,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!1,formImageFieldReplacerEnabled:!1,formImageFieldHeightEnabled:!1,formTextFieldTypografEnabled:!1,formTextFieldReplacerEnabled:!1,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!1,elementCountdownEnabled:!1,elementVideoEnabled:!1,elementAIimageEnabled:!0,elementAItextEnabled:!1,elementCarouselEnabled:!1,elementAccordionEnabled:!1,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!0,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!1,formFieldAmpVisibilityEnabled:!1,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4,fileManager:{defaultFolderName:"",enableMoveFolder:!0,enableEdit:!0,enableTrash:!0}},project:void 0},Hf={config:{mode:"editor",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!1,styles:"",headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!1,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!1,webversionEnabled:!1,commonStylesEnabled:!1,emailResponsiveControlEnabled:!1,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!0,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!1,emailDropdownMenuClone:!0,emailDropdownMenuImport:!1,emailDropdownMenuImportButton:!1,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportTextEnabled:!1,exportMarkdownEnabled:!1,exportZipEnabled:!0,exportClipboardEnabled:!1,exportWebHookEnabled:!1,exportOutlookEnabled:!0,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!1,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!1,aiAssistentEnabled:!1,optimizeEnabled:!1,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!1,annotationsEnabled:!1,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!1,tagsEnabled:!0,isTemplateEnabled:!1,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!1,deleteButtonEnabled:!0,toggleSidePanel:!1,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!1,formFieldImageTitleEnabled:!1,formFieldBorderEnabled:!1,formFieldBorderRadiusEnabled:!1,formFieldBoxShadowEnabled:!1,formFieldVisibilityEnabled:!1,formFieldExportAsPictureEnabled:!1,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!1,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!1,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!1,formButtonFieldReplacerEnabled:!1,formCellFieldVerticalAlignEnabled:!1,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!1,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!1,formImageFieldReplacerEnabled:!1,formImageFieldHeightEnabled:!1,formTextFieldTypografEnabled:!1,formTextFieldReplacerEnabled:!1,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!0,elementCountdownEnabled:!0,elementVideoEnabled:!1,elementAIimageEnabled:!0,elementAItextEnabled:!1,elementCarouselEnabled:!1,elementAccordionEnabled:!1,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!0,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!1,formFieldAmpVisibilityEnabled:!1,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4},project:void 0},$f={...Un,config:{...Un.config,imageCenterFileManagerView:!1}};Uf({pro:Bf,editor:Hf,simple:Ff()?Un:$f,blocks:Do});var Oo=l.createIdentifier$1("CodeMode");function Mo(){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 Vf(e){try{window.localStorage?.setItem(l.LOCAL_STORAGE_ITEMS.em_code_mode_settings,JSON.stringify({isCodeMode:e.isCodeMode,codeModeDirection:e.direction}))}catch{}}function Lo(e){return e.getOrCreateInstance(Oo,()=>{const t=ce(Mo());return t.watch(Vf),t})}function No(e){return e?.getInstance(Oo)?.get()??Mo()}function Hn(e,t){const n=Lo(e);n.get().isCodeMode!==t&&n.set({...n.get(),isCodeMode:t})}function Gf(e,t){const n=Lo(e);n.set({...n.get(),direction:t})}function Yf(e,t,n=e.getInstance(l.CONFIG_SOURCE_ID)){n?.setMode(t),n?.get()?.codeEnabled===!1&&No(e).isCodeMode&&Hn(e,!1)}function Wf(e){e.getInstance(l.STANDALONE_ACTIVATED_ID)||e.inject(l.SECURITY_MODULE_ID,void 0)}function Rt(e){return String(e.standaloneKey||"").trim()||void 0}function qf(e){return e.standaloneOnAuthFailure===!0?!0:e.config?.standaloneOnAuthFailure===!0}function $n(e){return qf(e)?!!Rt(e):!1}function Qe(e){return!!Rt(e)&&!$n(e)}var zf=["backendProxy","backendProxyPolicy","resourceProxy","resourceProxyPolicy"];function xo(e){return e==="server"?"serverSide":e}function Kf({env:e,base:t={},budgetMs:n}){const r={base:t,profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}},s=ce();let o={kind:"pending"},i;const a=new Promise(g=>{i=g}),c=n===void 0?void 0:setTimeout(()=>{u({kind:"absent",reason:`серверный слой не пришёл за ${n} мс`})},n);function d(){o.kind!=="pending"&&s.set(_n(r,e))}function u(g){if(o.kind!=="pending")return;clearTimeout(c),o=g;const E=_n(r,e);s.set(E),i(E)}function f(g,E){r[xo(g)]=E,g==="server"&&o.kind==="pending"?u({kind:"applied"}):d()}return{watch:g=>s.watch(g),select:g=>s.select(g),get:()=>s.get(),ready:()=>a,state:()=>o,layers:()=>({...r}),bootstrap(){const g=_n(r,e);return Object.fromEntries(zf.map(E=>[E,g[E]]))},merge(g,E){f(E,{...r[xo(E)],...g})},replace(g,E){f(E,g)},setMode(g){r.user={...r.user,mode:g},d()},setAdvancedConfigs(g){r.advancedConfigs=g,d()},serverAbsent(g){u({kind:"absent",reason:g})},applyServerResponse(g){o.kind==="pending"&&f("server",{...r.serverSide,...g})},dispose(){clearTimeout(c)}}}var Xf=5e3,Jf="blocks";function Qf(){return{...Ro(Jf)?.config,mergeTags:void 0}}function Zf(e,t){e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(n=>{t.setAdvancedConfigs({...n.advancedConfigs,...n.config?.advancedConfigs}),t.replace(n.config??{},"user")})}function ep(e,t){let n;vn(e).watch(({profile:r})=>{const s=`${r?.theme??""}|${r?.locale??""}`;if(s===n)return;n=s;const o={};r?.theme&&(o.theme=r.theme),r?.locale&&(o.locale=r.locale),t.replace(o,"profile")})}function tp(e){if(!(!e||typeof e!="string"))return e==="simple"?"pro":e}function np(e,t){let n,r=!1,s;const o=a=>{s??=yt(t.layers(),localStorage.getItem("configSwither")||void 0),t.get()?.mode!==a&&Yf(e,a,t)},i=vn(e).watch(({profile:a})=>{const c=a?.email_builder_config,d=tp(c);if(d===void 0||c===n)return;const u=n===void 0;n=c,!(u&&r)&&o(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:s)||"editor";localStorage.setItem("configSwither",c),r=n===void 0,o(c)})}var ko="замкнутый контур: app_init не выполняется";function rp(e,t){if(e.getInstance(l.SECURITY_MODULE_ID)){t.serverAbsent(ko);return}const n=e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(r=>{Qe(r)&&t.serverAbsent(ko)});n&&e.getInstance(l.DISPOSABLE_ID)?.addDisposable(n)}async function sp(e,t){if(e.getInstance(en)===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 op(e){e.injectFactory(l.CONFIG_SOURCE_ID,(t,n)=>{if(n)return n;const r=Kf({base:Qf(),env:{modeDefaults:s=>Ro(s)?.config||{},fallbackMode:localStorage.getItem("configSwither")||void 0},budgetMs:Xf});return Zf(e,r),ep(e,r),np(e,r),rp(e,r),sp(e,r),e.getInstance(l.DISPOSABLE_ID)?.addDisposable(r),r},!0)}var Fe=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 B(e,t,n){const r=l.snapshot(e);return(s,o,i)=>{const a=r(async c=>{const d=t?t(c):c;i&&s.bind(i);const u=await s(d);return n?n(u):u},o,i);return()=>a.dispose()}}var ip=class{deps;handleDestroy;constructor(e){this.deps=e;const t=new l.Emitter;this.handleDestroy=B(t.event),e.lifetime.addDispose(()=>t.fire(e.getInstance()));const n=e.lifetime.addDisposable(new Fe(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{}}},Vn=l.createIdentifier$1("DestroyableService");function ap(e){e.injectFactory(Vn,(t,n)=>{if(n)return n;const r=e.getInstance(l.DISPOSABLE_ID);if(!r)throw new Error("[plugin] время жизни экземпляра не зарегистрировано");return new ip({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 lp(e){const t=e.getInstance(Vn);if(!t)throw new Error("[plugin] provideDestroyable не выполнен до сборки поверхности");return{handleDestroy:t.handleDestroy,destroy:()=>t.destroy()}}var cp=1e3;function Fo(e,t,n=cp,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 s=Object.keys(e),o=Object.keys(t);if(s.length!==o.length)return!1;for(const i of s)if(!Fo(e[i],t[i],n,r+1))return!1;return!0}return!1}function Ze(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 s=t[r],o=e[r];Fo(s,o)||(n[r]=s)}return n}var dp=({source:e,emailtags:t,group:n,tags:r,...s})=>s;async function up(e,t){try{return{id:(await t(await e)).id}}catch{return}}async function fp({emails:e,saveTimeoutMs:t},n,r){const s=t?.()??rn();let o;try{const i=e.notifySave(n);return await Promise.race([i,new Promise((a,c)=>{o=setTimeout(()=>{const d=new an(s);n.value.id,Fl(d,up(i,r)),c(d)},s)})])}catch(i){throw ds(i),i}finally{o!==void 0&&clearTimeout(o)}}function pp(e){const{emails:t}=e,n=async(r,s)=>{const o=dp(s),i=r===void 0?void 0:await t.cache.getIfPresent(r),a=i?{...i,...o}:o,c=i?Ze(i,o):o,d=u=>{const f=String(u.id??r??l.generateUUID()),g=u.id===void 0?{...u,id:f}:u;return t.cache.addOrUpdate(f,()=>g)};return await d(await fp(e,{prev:i,patch:c,value:a,source:s.source??""},d))};return{async readEmail(r){return await t.get(r)??null},async createEmail(r){const s=await n(void 0,r);return s?.renderGuid?s:{...s,renderGuid:l.generateUUID()}},async updateEmail(r,s){return await n(r,s)}}}var Gn=20;function hp(e){const t=mp(e);return e.saveTimeoutMs?gp(t,e.saveTimeoutMs):t}function mp({revisions:e,revisionsByEmail:t,readAutosave:n,savedAt:r,emailAuthor:s,integratorProject:o}){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(Gn*(c-1),Gn*c),page:c,hasMore:d.length>Gn*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 Wl(await i(a,1),d);if(!u.revision)return fs([],d);const f={...u.revision,parent:a,isAutosave:!0};return fs([f],d,await i(a,1))},async saveAutosave(a,c){const d=await s?.(a),u=o?.();return await e.create({...Ql(c),...d!==void 0?{author:d}:{},...u!==void 0?{project:u}:{},parent:a,isAutosave:!0,modified:new Date().toString()})}}}function gp(e,t){return{...e,async saveAutosave(n,r){const s=t();let o;try{return await Promise.race([e.saveAutosave(n,r),new Promise((i,a)=>{o=setTimeout(()=>a(new is(s)),s)})])}catch(i){throw ds(i),i}finally{o!==void 0&&clearTimeout(o)}}}}var Ep=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}},vp=class extends l.AsyncEmitter{};function l_(e){return e}var Bo=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 s=await t(n);return l.deepEqual(n,s)||this._onChangeEmitter.fire(),s}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(([s,o])=>s)),r=(await this.entries()).filter(([s,o])=>!n.has(s));for(const[s,o]of e)t.push(this.addOrUpdate(s,()=>o)),n.add(s);for(const[s]of r)t.push(this.remove(s));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 _p(e,{filter:t,order:n="asc",orderBy:r,page:s,pageSize:o=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 f=d[u],g=t[u];return u==="id"||typeof f!="string"?f===g:typeof g=="string"&&f.startsWith(g)}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))),s!==void 0&&(e=e.slice(o*(s-1),o*s)),{data:e,filteredTotal:a,total:i,totalPages:Math.ceil(a/o)}}function bp(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 s=t.get(r.id)||{};t.set(r.id,{...s,...r})}return[...t].map(([n,r])=>r)}function yp(e,t){return jo(e)&&jo(t)?String(e)===String(t):e===t}function jo(e){return typeof e=="string"||typeof e=="number"}var Sp=class extends l.Disposable{_cache=new Bo;_readEmitter=new l.AsyncEmitter;_saveEmitter=this.addDisposable(new Ep);_removeEmitter=this.addDisposable(new vp);_foreignCache=Object.create(null);async get(e){return this._cache.getOrCreate(e,async t=>Object.assign({id:e},...(await this._readEmitter.fire(e)).filter(n=>!!n)))}get cache(){return this._cache}byForeignKey(e){let t=this._foreignCache[e];if(!t){const n=this.addDisposable(new l.Disposable);n.addDispose(()=>delete this._foreignCache[e]);const r=n.addDisposable(new Bo),s=n.addDisposable(new l.AsyncEmitter);t=this._foreignCache[e]={get:async(o,i={})=>{await r.getOrCreate(o,async()=>{try{const c=bp(await s.fire(o))||[];for(const d of c)d[e]=o,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||yp(d,o)});return _p(a,i)},first(o,i={}){return t.get(o,{...i,page:1,pageSize:1}).then(({data:a})=>a[0])},handleRead:s.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 s=>{const o=s?{...s,...t}:t;if(!r)return t=s?Ze(s,t):t,await this._saveEmitter.fire({prev:s,patch:t,value:o,source:n})})}async remove(e,{source:t="",silent:n}={}){const r=await this._cache.remove(e);return n||await this._removeEmitter.fire({value:r,source:t}),r}refresh(){this._cache.clear();for(const e of Object.values(this._foreignCache))e.clear()}suspendChange(){this._cache.suspendChange()}resumeChange(){this._cache.resumeChange()}handlerRead=this._readEmitter.event;onSave=this._saveEmitter.event;onRemove=this._removeEmitter.event;onChange=this._cache.onChange};function et(e){const t=l.createIdentifier$1(e);return n=>n.getOrCreateInstance(t,()=>new Sp)}function Uo(e){const t=e.getInstance(l.DISPOSABLE_ID);if(!t)throw new Error("Failed");return t}function Ho(e){return Object.prototype.hasOwnProperty.call(e,"meta")}function Yn(e,t){const n={...e};return t===void 0?(delete n.meta,n):(n.meta={...e.meta??{},...t},n)}function Ip(e,t,n){return e&&!Ho(t)&&Ho(e)?{...n,meta:e.meta}:n}var wp=l.createIdentifier$1("CurrentProject"),Tp={};function tt(e){return e?.getInstance(wp)?.get()??Tp}function Wn(e){const t=tt(e).card?.id,n=Number(t);return t!=null&&t!==""&&Number.isFinite(n)?n:void 0}var $o=et("plugin.dataSource.emails"),Vo=et("plugin.dataSource.emailRevisions"),Go=Dn("plugin.readEmailAutosave"),Yo=l.createIdentifier$1("emailDocuments.provided");function Cp(e){const t=$o(e),n=Vo(e),r=n.byForeignKey("parent");if(e.getInstance(Yo))return{emails:t,emailRevisions:n};e.inject(Yo,!0);const s=()=>rn(e.getInstance(l.INIT_PIPELINE_ID)?.contentReadyTimeoutMs),o=pp({emails:t,saveTimeoutMs:s}),i=new Map,a=(c,d)=>u=>{const f=u?.id??d;return(typeof f=="string"||typeof f=="number")&&i.set(String(f),c),u};return Ic(e,{...o,createEmail:c=>o.createEmail(c).then(a(Date.now())),updateEmail:(c,d)=>o.updateEmail(c,d).then(a(Date.now(),c))}),Ac(e,hp({revisions:n,revisionsByEmail:r,readAutosave:async c=>{const d=await se(e,Go).fire(c);return d.length===0?{asked:!1}:{asked:!0,revision:d[0]??null}},savedAt:async c=>{const d=Gl((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:s,integratorProject:()=>tt(e).requested})),Uo(e).addDisposable(t.onSave(({prev:c,patch:d,value:u})=>Ip(c,d,u),Number.MIN_VALUE)),{emails:t,emailRevisions:n}}function Wo(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 Ap(e){try{return localStorage.getItem(e)===null?!1:(localStorage.removeItem(e),!0)}catch{return!1}}var Dp="po",Ot=null;function Pp(){const e=typeof __useblocks__<"u"?__useblocks__?.require:void 0;return typeof e!="function"?Promise.reject(new Error("[loadPoParser] AMD loader is unavailable")):new Promise((t,n)=>{e([Dp],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadPoParser] Failed to require po module")))})}function Rp(){return Ot===null&&(Ot=Pp().catch(e=>{throw Ot=null,e})),Ot}async function qo(e){if(typeof e=="object")return qn(e);if(typeof e!="string")return;const t=e.trim();if(t)return t.startsWith("{")||t.startsWith("[")?Op(t):Mp(t)}function qn(e){if(!(e==null||typeof e!="object"||Array.isArray(e)))return e}function Op(e){try{return qn(JSON.parse(e))}catch{return}}var zo=!1;async function Mp(e){try{return qn((await Rp()).parsePoCatalog(e))}catch{zo||(zo=!0);return}}var Lp="em_locale",Np="em_ant_locale",xp="locale",kp="ant_locale";function zn(e){try{return JSON.parse(localStorage.getItem(e)||"")}catch{return null}}function Ko(e,t){const n=zn(e);if(!n)return null;try{localStorage.removeItem(e),localStorage.setItem(t,JSON.stringify(n))}catch{}return n}function Fp(){return zn("em_locale")??Ko(xp,"em_locale")}function Xo(e){try{localStorage.setItem(Lp,JSON.stringify(e))}catch{}}function Bp(){return zn("em_ant_locale")??Ko(kp,"em_ant_locale")}function jp(e,t){try{localStorage.setItem(Np,JSON.stringify({id:e,data:t}))}catch{}}var c_="en_US",Up=8e3;function Hp(e,t){const n=e,r=t,s=Object.keys(n).filter(o=>o!=="");return s.length!==Object.keys(r).filter(o=>o!=="").length?!1:s.every(o=>JSON.stringify(n[o])===JSON.stringify(r[o]))}function $p(e){const t=Fp(),n=Bp();let r={ready:!1},s;const o=ce(r);let i=0;const a=h=>{r={...r,...h},o.set(r)},c=()=>{r.ready||a({ready:!0})},d=setTimeout(c,e.unlockAfterMs??Up),u=h=>h!==i;let f;async function g(h,y){if(n?.id===h&&n.data&&a({antd:n.data}),!f)return;const w=await f(h).catch(()=>{});!w||u(y)||(a({antd:w}),jp(h,w))}async function E(h,y){const w=await e.askHost(h).catch(()=>null);if(u(y))return!0;if(w==null)return!1;const A=await qo(w);return u(y)||(A&&a({catalog:A}),c()),!0}async function S(h,y){const w=await e.readList();if(u(y))return;if("error"in w){a({failure:{kind:"GET_LOCALES_ERROR",error:w.error}}),c();return}const A=w.data.find(N=>N.locale===h);if(!A){Ap("em_locale")&&a({catalog:void 0}),c();return}if(Wo(t,A)&&(!s||s.catalog===t?.data)){c();return}if(s?.entry&&r.catalog===s.catalog&&Wo(s.entry,A)){Xo(s.entry),c();return}const D=await e.readCatalog(h);if(!u(y)){if("error"in D){a({failure:{kind:"GET_LOCALE_ERROR",error:D.error}}),c();return}D.data&&(s?.id===h&&r.catalog===s.catalog&&Hp(s.catalog,D.data)||a({catalog:D.data}),Xo({id:h,time:A.updatedAt||Math.floor(Date.now()/1e3),hash:A.contentHash,data:D.data})),c()}}async function b(h,y){if(!await E(h,y)){if(!u(y)&&(s?.id===h&&r.catalog===s.catalog||h==="en_US")&&c(),e.canUseNetwork&&!e.canUseNetwork()){c();return}await S(h,y)}}return{set(h){if(!h||h===r.id)return;const y=i+=1;a({id:h,failure:void 0});const w=s?.id===h&&r.catalog===s.catalog;(s&&!w&&r.catalog===s.catalog||h==="en_US"&&r.catalog)&&a({catalog:void 0}),t?.id===h&&t.data&&(a({catalog:t.data}),c()),g(h,y),b(h,y)},prime(h,y,w){r.id&&r.id!==h||r.catalog||!y||(s=t?.id===h&&t.data&&(!w||t.time>=w.time)?{id:h,catalog:t.data}:{id:h,catalog:y,entry:w?{id:h,time:w.time,hash:w.hash,data:y}:void 0},a({catalog:s.catalog}))},useAntdLoader(h){f=h,r.id&&g(r.id,i)},state:o,snapshot:()=>r,dispose:()=>clearTimeout(d)}}var Vp=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})},Gp=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:s,format:o,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),f=s&&this.toQueryString(s),g=this.contentFormatters[r||"application/json"],E=o||u.format;return this.customFetch(`${i||this.baseUrl||""}${n}${f?`?${f}`:""}`,{...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:g(e)}).then(async S=>{const b=S;b.data=null,b.error=null;const h=E?S.clone():S,y=E?await h[E]().then(w=>(b.ok?b.data=w:b.error=w,b)).catch(w=>(b.error=w,b)):b;return a&&this.abortControllers.delete(a),y})}},Yp=l.createIdentifier$1("rest.v2.transport"),Jo=Symbol("rest.v2.secureRequest");function Wp(e){return e.getOrCreateInstance(Yp,()=>{const t=e.getInstance(l.CUSTOM_FETCH_ID)?.execute||fetch;return new Gp({baseUrl:"https://app.useblocks.io/api/v2",securityWorker:()=>({[Jo]:!0}),customFetch:(n,r={})=>{const{[Jo]:s,...o}=r;return t(n,{...o,[l.PUBLIC_REQUEST]:s!==!0})}})})}function qp(e,t){const n=Wp(e);return Object.assign({},...t.map(r=>new r(n)))}function Qo(e,t){if(e!=null&&typeof e=="object"){const n=e[t];if(typeof n=="string"&&n!=="")return n}}function Zo(e){const t=e.error,n=t?.error;return n&&typeof n=="object"?{status:e.status,data:{code:Qo(n.details,"wp_code")??n.code,message:Qo(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 ei(e){return!e.ok||!!e.error}function zp(e){try{const t=localStorage.getItem(e);if(t==="true")return!0;if(t==="false")return!1}catch{}}function ti(){return zp(l.LOCAL_STORAGE_ITEMS.em_translations_v2)??!0}function Kp(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function Xp(e){const t=e?Date.parse(e):NaN;return Number.isNaN(t)?0:Math.floor(t/1e3)}function Jp(e){return Array.isArray(e)?e.reduce((t,n)=>{const r=Array.isArray(n)?n:[],s=r[0];return typeof s=="string"&&s!==""&&t.push({locale:s,updatedAt:Kp(r[1])}),t},[]):[]}function Qp(e){return(e?.items??[]).reduce((t,n)=>(n.locale&&t.push({locale:n.locale,updatedAt:Xp(n.updated_at),contentHash:n.content_hash}),t),[])}function ni(e){return qp(e,[Vp])}function Mt(e){return{error:{status:"FETCH_ERROR",error:e instanceof Error?e.message:"locale request failed"}}}function Kn(e){return!e.ok||e.error!=null}function Xn(e){const t=e.error;return{error:{status:e.status,data:t?.data??e.error}}}async function Jn(e){return{data:await qo(e)??null}}async function Zp(e){if(ti())try{const n=await ni(e).localesList();return ei(n)?{error:Zo(n)}:{data:Qp(n.data)}}catch(n){return Mt(n)}const t=l.getApi(e,[Yr]);try{const n=await t.get_translations2({file:"react_app"});return Kn(n)?Xn(n):{data:Jp(n.data)}}catch(n){return Mt(n)}}async function eh(e,t){if(ti())try{const r=await ni(e).jsonList({locale:t});return ei(r)?{error:Zo(r)}:Jn(r.data)}catch(r){return Mt(r)}const n=l.getApi(e,[Yr]);try{const r=await n.get_translations3({id:t,file:"react_app"});return Kn(r)?Xn(r):Jn(r.data)}catch{try{const r=await n.get_translations3({id:"en_US",file:"react_app"});return Kn(r)?Xn(r):Jn(r.data)}catch(r){return Mt(r)}}}var Lt=new WeakMap;function th(e){const t=Lt.get(e);if(t!==void 0)return t;const n=Zp(e).then(r=>("error"in r&&Lt.delete(e),r),r=>{throw Lt.delete(e),r});return Lt.set(e,n),n}var nt=l.createIdentifier$1("locale.service");function nh(e){if(e.getInstance(nt))return;const t=$p({readList:()=>th(e),readCatalog:n=>eh(e,n),askHost:async n=>(await se(e,l.events.READ_LOCALE).fire(n))[0],canUseNetwork:()=>!e.getInstance(l.SECURITY_MODULE_ID)});e.inject(nt,t),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>t.dispose())}function rh(e){const t=e.getInstance(l.CONFIG_SOURCE_ID);if(!t)return;const n=e.getInstance(nt);if(!n)return;const r=t.select(s=>s.locale).watch(s=>n.set(s||"en_US"));e.getInstance(l.DISPOSABLE_ID)?.addDisposable(r)}var sh="user_id",oh="project_id",ri=l.createIdentifier$1("rest.identityHeadersProvided");function ih(e){if(e.getInstance(ri))return;e.inject(ri,!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 s=t?.user?.id??Ms(e).profile?.id;s!=null&&s!==""&&n.headers.set(sh,String(s));const o=t?.project;o!=null&&o!==""&&n.headers.set(oh,String(o))}})}function ah(e){if(!e)return!1;try{return e.getInstance(l.SECURITY_MODULE_ID)!==void 0}catch{return!1}}var lh="Invalid standaloneKey.",d_=l.createIdentifier$1("StandaloneMockGuard");function ch(){const e=new Error(lh);return e.name="InvalidStandaloneKeyError",e}function dh(e){e.addService(l.REQUEST_HANDLER_ID,{execute:()=>{if(ah(e))throw ch()}})}function uh(e){l.registerRestTransport(e),dh(e)}function fh(e){const t=new to;e.inject(l.INIT_PIPELINE_ID,t);const n=e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(s=>{if(!s)return;const o=s.signal??t.externalSignal;t.configure({replaceSession:!0,...s.timeouts!==void 0?{timeouts:s.timeouts}:{},...o!==void 0?{signal:o}:{}})}),r=e.getInstance(l.DISPOSABLE_ID);n&&r?.addDisposable(n),r?.addDispose(()=>{t.abort()})}var ph=et("plugin.dataSource.blocks"),hh=et("plugin.dataSource.blockRevisions"),mh=et("plugin.dataSource.comments"),gh=Dn(),Eh=Dn(),si=`<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
2109
|
+
`));return{html:Zd(t.html),hasBrowserExtensionArtifacts:t.found}}function wt(e){return e?.getContent()??""}function eo(e,t){e?.mutate({content:ps(t)},{source:"remote"})}function Dn(e){return l.createIdentifier$1(e)}function se(e,t){return e.getOrCreateInstance(t,()=>new l.AsyncEmitter)}function z(e,t){return e.getOrCreateInstance(t,()=>new l.AsyncEmitter).event}function It(e,t,n,r){return{html:e,guid:t,...Object.keys(n).length>0?{templateDirectivesPolicy:n}:{},...r!==void 0?{rev:r}:{}}}var eu=class extends Error{showId;constructor(e,t){super(`[useblocks] 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}},tu=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,s)=>{const o=setTimeout(()=>{this._settle(e.showId,()=>{s(new eu(e.showId,t))})},t);o.unref?.();const i=()=>{this._settle(e.showId,()=>{s(l.createAbortError(n.reason))})};n.addEventListener("abort",i,{once:!0});const a=()=>{clearTimeout(o),n.removeEventListener("abort",i)};this._pending.set(e.showId,{request:e,resolve:r,reject:s,timeoutId:o,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 nu(e,t){return{contentReady:t.contentReady??e?.contentReady,sandboxReady:t.sandboxReady??e?.sandboxReady,sandbox:t.sandbox?{...e?.sandbox,...t.sandbox}:e?.sandbox}}function ru(e){if(!e||!(e.contentReady!==void 0||e.sandboxReady!==void 0||e.sandbox!==void 0))return;const t=Zr(e),n=es(e),r=fl(e.sandbox);t<n+r}var to=class{_controller=new AbortController;_externalSignalDisposable=new l.Disposable;_sessionChangeListeners=new Set;_showRegistry=new tu;_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 Zr(this._timeouts)}getSandboxTimeoutMs(e){return Qr(e,this._timeouts?.sandbox)}getSandboxReadyTimeoutMs(){return es(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=nu(this._timeouts,e.timeouts),ru(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)})}},Pn=(()=>{const e=new to;return e.configure({}),e})(),su=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 ou(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 iu(e,t,n){return e.isInited()&&e.getTarget()?Promise.resolve():(l.throwIfAborted(n),new Promise((r,s)=>{let o=!1,i,a;const c=u=>{o||(o=!0,i!==void 0&&(clearTimeout(i),i=void 0),a?.dispose(),n?.removeEventListener("abort",d),u())},d=()=>{c(()=>s(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(()=>s(new su(t)))},t)),n?.addEventListener("abort",d)}))}var au=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 lu(e,t,n){return t<=0?e:new Promise((r,s)=>{let o=!1,i;const a=c=>{o||(o=!0,i!==void 0&&(clearTimeout(i),i=void 0),c())};i=setTimeout(()=>{a(()=>s(new au(n,t)))},t),e.then(c=>{a(()=>r(c))},c=>{a(()=>s(c))})})}var cu=2,Je=Symbol("sandbox:frame-replaced");function no(e){return e===Je}function he(e,t,n,r,s,o,i){const a=`sandbox:${t}`,c=o?.getSandboxTimeoutMs(t)??nn[t],d=()=>{let S=lu(e.sendAsync(n,r),c,a);return S=l.raceWithAbortSignal(S,o?.signal),qe(a,S,s)};if(t==="INIT_START"&&ou(e)){const S=o?.getSandboxReadyTimeoutMs()??2e4,b=e,h=y=>{const I=iu(b,S,o?.signal);return qe("sandbox:INIT_START:ready-wait",I,s).then(()=>{if(!i||y<=0)return d();const A=i.getGeneration();let D;const N=new Promise((_,C)=>{D=i.onChange(()=>{i.getGeneration()!==A&&C(Je)})}),m=d();return m.catch(()=>{}),Promise.race([m,N]).finally(()=>D?.()).catch(_=>{if(_!==Je)throw _;return{...s},h(y-1)})})};return h(cu)}if(!i)return d();const u=i.getGeneration();let f;const g=new Promise((S,b)=>{f=i.onChange(()=>{i.getGeneration()!==u&&b(Je)})}),E=d();return E.catch(()=>{}),Promise.race([E,g]).finally(()=>f?.()).catch(S=>{throw S===Je&&{...s},S})}var du=[["brace-percent",/<!--\{%/],["brace-hash",/<!--\{#/],["proscript",/<!--\[%/],["getresponse",/<!--\[\[(?:if|else\]\]|endif\]\])/i],["mailchimp",/<!--\*\|/],["expert-sender",/<!--<\/?(?:if|else|var)/i]],uu=200;function ro(e=new Set){const t=new Set;return(n,r)=>{if(!du.some(([o,i])=>!e.has(o)&&i.test(n)))return;const s=r??`new:${n.length}:${n.slice(0,200)}`;t.has(s)||(t.size>=uu&&t.clear(),t.add(s))}}function so(){return{isConfigured:()=>!1,toEditorForm:e=>e,toOutputForm:e=>e,keepWrappedOnOutput:new Set,editorPolicy:{},warnAboutUnconfiguredInput:ro()}}var fu=so();function Ie(e){return e?.getInstance(l.TEMPLATE_DIRECTIVES_ID)??fu}function pu(e){const t=ve(e),n=Q(e),r=()=>e.getInstance(l.INIT_PIPELINE_ID)??Pn;let s,o,i=!1,a=!1;const c=async(I,A,D)=>{const N=D.generation,m=()=>D.generation!==N||D.signal.aborted||t.current()!==I||a,_=fe(n);i=!0;try{if(await he(n,"INIT_START",l.EVENT_TYPES.SANDBOX_INIT_START,{guid:A},void 0,D),m())return;const{html:C,hasBrowserExtensionArtifacts:M}=Zs(wt(I));if(M&&se(e,l.events.ON_BROWSER_EXTENSION_DETECTED_ID).fire(),eo(I,C),await he(n,"SET_ENTITY",l.EVENT_TYPES.SANDBOX_SET_ENTITY,It(wt(I),A,Ie(e).editorPolicy,I.get().version),void 0,D),m())return;await he(n,"INITED",l.EVENT_TYPES.SANDBOX_INITED,{guid:A},void 0,D),s=A,o=_}finally{i=!1}},d=()=>ue(t.sessionKey())?t.current():void 0,u=()=>{if(a||i)return;const I=d(),A=I?.get().docId;if(!I||!A||s===A&&o===fe(n)||!I.isReady())return;const D=r();D.signal.aborted||c(I,A,D).catch(()=>{})};let f=!1;const g=()=>{f||a||(f=!0,queueMicrotask(()=>{f=!1,u()}))};let E,S;const b=()=>{const I=d(),A=I?.get().docId;A!==S&&(E?.(),S=A,E=I?.subscribe(g)),g()},h=t.subscribe(b),y=In(n,g);b(),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{a=!0,y(),E?.(),h()})}var hu=200;function mu({startVersion:e,limit:t=hu}){let n=[],r=e;const s=o=>{n=n.filter(i=>i.version>o),r=Math.max(r,o)};return{record(o){!o.changes?.length&&!o.contentReplaced||(n.push(o),n.length>t&&s(n[n.length-t-1].version))},rebase(o,i){if(i<r)return null;const a=n.filter(d=>d.version>i);s(i);let c=o;for(const d of a){if(d.contentReplaced||!d.changes)return null;const u=d.changes,f=[];for(const g of c){if(d.fromCanvas&&u.some(S=>g.range.start<=S.oldEnd&&g.range.end>=S.oldPosition))return null;const E=wl(g.range,u,"after");if(!E)return null;f.push({range:E,text:g.text})}c=f}return c}}}function gu(e,t){let n=0;return e.map(({start:r,end:s,text:o})=>{const i=new ae(r,t.slice(r,s),r+n,o);return n+=o.length-(s-r),i})}function Eu(e,t){const n=[...e].sort((r,s)=>r.range.start-s.range.start);return gu(n.map(({range:r,text:s})=>({start:r.start,end:r.end,text:s})),t)}function vu(e){return[...e].sort((t,n)=>n.oldPosition-t.oldPosition).map(t=>({range:{start:t.oldPosition,end:t.oldEnd},text:t.newText}))}var Rn=l.createIdentifier$1("canvas.sandboxFill");function oo(e){return e.getInstance(Rn)?.pipeline.isEventsLocked()===!0}function Tt(e){Ve(e,{origin:"canvas-channel"})}function _u(e){const t=ve(e),n=Q(e);let r;const s=(c,d)=>{const u=c.get().docId;let f=!1,g=null,E=null;const S=mu({startVersion:c.get().version});let b=c.getContent(),h=!0;const y=(_,C)=>{!h||t.current()!==c||(Ve(C,{origin:"canvas-channel"}),n.sendAsync(l.EVENT_TYPES.SANDBOX_SET_ENTITY,It(wt(c),u,Ie(e).editorPolicy,c.get().version)).catch(Tt))},I=async(_,C)=>{if(E){E.push({edits:_,rev:C});return}E=[{edits:_,rev:C}];try{do{const M=E.splice(0,E.length);await n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,{edits:M.map(p=>p.edits),guid:u,rev:M[M.length-1].rev})}while(E.length)}catch(M){y("app edits failed to reach the canvas",M)}finally{E=null}},A=(_,C)=>{const M=E?.splice(0,E.length)??[];M.length&&n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,{edits:M.map(p=>p.edits),guid:u,rev:M[M.length-1].rev}).catch(Tt),n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,{edits:[_],guid:u,rev:c.get().version,...C!==null?{changeId:C}:{}}).catch(Tt)},D=_=>{const{guid:C,pushUndoStop:M}=_;if(C!==u)return;const p=Nl(_);let{edits:v}=_;if(p.baseRev!==null){const L=S.rebase(v,p.baseRev);if(!L){Ve(new Error("canvas batch conflicts with newer document changes"),{origin:"canvas-channel"}),A([],p.changeId);return}v=L}const T=c.get().version;try{f=!0,g=p.changeId;const L=Eu(v,c.getContent());M===!1?d.applyWithoutHistory(L):c.mutate({changes:L},{source:oo(e)?"system":"user"})}catch(L){y("canvas batch failed to apply",L);return}finally{f=!1,g=null}c.get().version===T&&p.baseRev!==null&&A([],p.changeId)},N=c.subscribe(({changes:_,version:C})=>{const M=c.getContent(),p=!_?.length&&M!==b;if(b=M,S.record({version:C,changes:_,contentReplaced:p,fromCanvas:f}),!_?.length)return;const v=vu(_);f?A(v,g):I(v,C).catch(Tt)}),m=n.addListener(l.EVENT_TYPES.APPLICATION_UPDATE_ENTITY,D);return()=>{h=!1,N(),m.dispose()}};let o;const i=()=>{const c=t.current(),d=t.history(),u=c?.get().docId;u!==o&&(r?.(),r=void 0,o=u,c&&d&&(r=s(c,d)))},a=t.subscribe(i);i(),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r?.(),a()})}function Te(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 Ce(e){return!e||e==="none"}function bu(e){const t=e.contain??"",n=e.willChange??"";return!Ce(e.transform)||!Ce(e.perspective)||!Ce(e.filter)||!Ce(e.backdropFilter)||!Ce(e.translate)||!Ce(e.rotate)||!Ce(e.scale)||/transform|perspective|filter/.test(n)||/paint|layout|strict|content/.test(t)||!!e.containerType&&e.containerType!=="normal"}function io(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 yu(e){const t=[],n=document.documentElement,r=io(getComputedStyle(n)),s=r.x||r.y;let o="none";const i=getComputedStyle(e).position;(i==="absolute"||i==="fixed")&&(o=i);for(let a=Te(e);a&&a!==n;a=Te(a)){const c=getComputedStyle(a),d=o==="none"||bu(c)||o==="absolute"&&!!c.position&&c.position!=="static",u=a===document.body&&!s;if(d){o="none";const f=u?{x:!1,y:!1}:io(c);(f.x||f.y)&&t.push({node:a,...f})}(c.position==="absolute"||c.position==="fixed")&&(o==="none"||c.position==="fixed")&&(o=c.position==="fixed"?"fixed":"absolute")}return t}function ao(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 Ct(e){return Number.parseFloat(e)||0}function On(e){const t=e.getBoundingClientRect(),n=getComputedStyle(e),r=ao(e),s=Ct(n.borderLeftWidth),o=Ct(n.borderTopWidth),i=Ct(n.borderRightWidth),a=Ct(n.borderBottomWidth),c=e.offsetWidth>0?Math.max(0,e.offsetWidth-e.clientWidth-s-i):0,d=e.offsetHeight>0?Math.max(0,e.offsetHeight-e.clientHeight-o-a):0;return{left:t.left+s*r.x,top:t.top+o*r.y,right:t.right-(i+c)*r.x,bottom:t.bottom-(a+d)*r.y}}function Su(e,t,n){const r={left:e.left,top:e.top,right:e.right,bottom:e.bottom},s=(o,i,a)=>{i&&(r.left=Math.max(r.left,o.left),r.right=Math.min(r.right,o.right)),a&&(r.top=Math.max(r.top,o.top),r.bottom=Math.min(r.bottom,o.bottom))};return t.forEach(o=>s(On(o.node),o.x,o.y)),n&&s(On(n),!0,!0),r}var Mn={originX:0,originY:0,scaleX:1,scaleY:1};function At(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 lo(e,t,n){const r=t.width>0&&e.width>0?e.width/t.width:n.scaleX,s=t.height>0&&e.height>0?e.height/t.height:r;return{originX:e.left-t.left*r,originY:e.top-t.top*s,scaleX:r,scaleY:s}}function co(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 wu=1e3;function Iu(e){const{slot:t,own:n}=e;let r,s=0,o=!1;const i=()=>{if(r=void 0,!o){if(!t.isConnected||!n.isConnected){e.onDetached();return}(e.measure()||performance.now()<s)&&(r=window.requestAnimationFrame(i))}},a=()=>{!o&&r===void 0&&(r=window.requestAnimationFrame(i))},c=()=>{s=performance.now()+wu,a()},d=[window],u=[document.documentElement];for(let h=t;h;h=Te(h)){const y=h.getRootNode();y instanceof ShadowRoot&&!d.includes(y)&&(d.push(y),u.push(y))}const f=[["scroll",a],["load",a],["transitionrun",c],["transitionend",a],["transitioncancel",a],["animationstart",c],["animationend",a],["animationcancel",a]];d.forEach(h=>f.forEach(([y,I])=>h.addEventListener(y,I,{capture:!0,passive:!0}))),window.addEventListener("resize",a),document.fonts?.addEventListener?.("loadingdone",a);const g=typeof MutationObserver=="function"?new MutationObserver(h=>{h.some(y=>!n.contains(y.target))&&a()}):void 0;u.forEach(h=>g?.observe(h,{attributes:!0,childList:!0,subtree:!0,characterData:!0}));let E;try{if(typeof ResizeObserver=="function"){const h=new ResizeObserver(a);typeof h.observe=="function"&&(E=h)}}catch{E=void 0}let S=[];return{schedule:a,observe:h=>{!E||h.length===S.length&&h.every((y,I)=>y===S[I])||(E.disconnect(),S=h,h.forEach(y=>E?.observe(y)))},dispose(){o=!0,r!==void 0&&(window.cancelAnimationFrame(r),r=void 0),d.forEach(h=>f.forEach(([y,I])=>h.removeEventListener(y,I,{capture:!0}))),window.removeEventListener("resize",a),document.fonts?.removeEventListener?.("loadingdone",a),g?.disconnect(),E?.disconnect()}}}var Tu="pluginZoom",Cu=/^(?:ant|vscode|monaco|docs)-/;function Au(e){return Cu.test(e)}function Du(){const e="ub".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 Pu=new Set(["animation-opacity","inline-edit-border-radius","separator-border","text-link-decoration"]);function Ru(){return Pu}var Ou=new Set;function Mu(e,t,n=Ou){return e.startsWith(`${t}-`)?!1:!Au(e)&&!n.has(e)}function Lu(e,t){return`--${t}-${e}`}function uo(e){const t=Du();return Mu(e,t,Ru())?Lu(e,t):`--${e}`}function Nu(e,t){const n=uo(e);return t!==void 0?`var(${n}, ${t})`:`var(${n})`}function fo(e,t){return Nu(e,t)}var po=300,ho=15e3,xu=5e3,mo="em-canvas-busy-style";function ku(){if(document.getElementById(mo))return;const e=document.createElement("style");e.id=mo,e.textContent="@keyframes em-canvas-busy-spin{to{transform:rotate(360deg)}}",document.head.appendChild(e)}var Fu="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 Bu(e){const t=fo("colorPrimary","#1677ff");return e&&getComputedStyle(e).getPropertyValue(uo("colorPrimary")).trim()||t}function go(e){ku();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",Fu),n.appendChild(r);const s=document.createElement("span");return s.setAttribute("role","img"),s.setAttribute("aria-label","loading"),s.setAttribute("style",`display:inline-flex;color:${Bu(e)};animation:em-canvas-busy-spin 1s linear infinite`),s.appendChild(n),s}function ju(e,t,n){const r=t??e,s=Math.max(r.left,e.left,0),o=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 o<=s||a<=i?{x:(e.left+e.right)/2-e.left,y:(e.top+e.bottom)/2-e.top}:{x:(s+o)/2-e.left,y:(i+a)/2-e.top}}function Uu(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 s={left:n.left,top:n.top,right:n.right,bottom:n.bottom},o=r.getBoundingClientRect();if(o.width>0&&!co({left:o.left,top:o.top,width:o.width,height:o.height},s)){const i=At(s,lo(o,At(s,Mn),Mn));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=ju(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(go(e.querySelector(".ant-app")??e)),r.appendChild(a)},remove:()=>r.remove()}}function Ln(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(go(e))},po);return{remove(){clearTimeout(r),t.remove(),n||(e.style.position="")}}}var Hu=8e3;function $u(){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:()=>{},dispose:()=>{}}}function Vu(e,t){for(let n=Te(e);n;n=Te(n)){const r=getComputedStyle(n),s=r.overflowX!=="visible"||r.overflowY!=="visible",o=[r.borderTopLeftRadius,r.borderTopRightRadius,r.borderBottomRightRadius,r.borderBottomLeftRadius].some(i=>ke(i)>0);if(s&&o)return n;if(n===t)return null}return null}function ke(e){return Number.parseFloat(e)||0}function Dt(e,t){return Math.abs(e-t)<=1}function Gu(e){const t=getComputedStyle(e),n=ke(t.borderTopWidth),r=ke(t.borderRightWidth),s=ke(t.borderBottomWidth),o=ke(t.borderLeftWidth),i=(a,c,d)=>Math.max(0,ke(a)-Math.max(c,d));return{...On(e),radii:[i(t.borderTopLeftRadius,n,o),i(t.borderTopRightRadius,n,r),i(t.borderBottomRightRadius,s,r),i(t.borderBottomLeftRadius,s,o)]}}function Yu(e,t){const n=Dt(t.top,e.top),r=Dt(t.bottom,e.bottom),s=Dt(t.left,e.left),o=Dt(t.right,e.right),i=[n&&s?e.radii[0]:0,n&&o?e.radii[1]:0,r&&o?e.radii[2]:0,r&&s?e.radii[3]:0];return i.every(a=>a===0)?"":i.map(a=>`${a}px`).join(" ")}function Wu(e,t,n,r,s,o){const i=n.readyTimeoutMs??Hu,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",fo(Tu,"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"),s||n.onCreated?.(d);const u=new l.Disposable;let f=!1,g,E=!1,S,b,h,y;const I=()=>{clearTimeout(y),y=setTimeout(()=>{E||(E=!0,b?.(new Error(`[canvas] ${e}: документ не загрузился за ${i} мс`)))},i)},A=()=>f?(h=Promise.resolve(),E=!0,h):(E=!1,h=new Promise((x,j)=>{S=x,b=j}),I(),h),D=()=>{if(clearTimeout(y),f=!0,E){h=Promise.resolve();return}E=!0,n.mark?.("loaded"),S?.()};d.addEventListener("load",D),u.addDispose(()=>{clearTimeout(y),d.removeEventListener("load",D)});let N;const m=()=>{N??=n.bindResizer?.(d)},_=()=>{N?.dispose(),N=void 0};let C=null,M=null,p,v=Mn,T="",L="",O=0;const F=x=>{const j=JSON.stringify(x);return j===T?!1:(T=j,a.style.visibility=x.visibility,a.style.left=`${x.css.left}px`,a.style.top=`${x.css.top}px`,a.style.width=`${x.css.width}px`,a.style.height=`${x.css.height}px`,a.style.borderRadius=x.radius,d.style.width=x.elementWidth>0?`${x.elementWidth}px`:"100%",d.style.transform=x.shiftX!==0?`translate(${x.shiftX}px, ${x.shiftY}px)`:`translateY(${x.shiftY}px)`,!0)},w=()=>{if(!C)return T="",a.style.visibility="hidden",d.removeAttribute("id"),!1;n.elementId&&(d.id=n.elementId);const x=C.getBoundingClientRect(),j=yu(C),G=M?.isConnected?M:null;p?.observe([C,d,...j.map($=>$.node),...G?[G]:[]]);const V=Su(x,j,G),X=Math.max(0,V.right-V.left),ce=Math.max(0,V.bottom-V.top),gt=getComputedStyle(C).visibility==="visible",Pe=X<=0||ce<=0,be=Pe?{left:V.left,top:V.top,right:V.left,bottom:V.top}:V,zt=Pe?null:Vu(C,G??j[0]?.node??null),R=zt?Yu(Gu(zt),be):"",H=$=>F({visibility:gt?"":"hidden",css:At(be,$),elementWidth:x.width/$.scaleX,shiftX:(x.left-be.left)/$.scaleX,shiftY:(x.top-be.top)/$.scaleY,radius:R});let U=H(v);if(!Pe){const $=a.getBoundingClientRect();$.width>0&&!co({left:$.left,top:$.top,width:$.width,height:$.height},be)&&(v=lo($,At(be,v),v),U=H(v)||U)}return U},P=()=>{if(!C)return!1;let x=w();const j=d.getBoundingClientRect().height;j>0&&j!==O&&(O=j,C.style.height=`${j/ao(C).y}px`,x=!0);const G=getComputedStyle(C).pointerEvents;return G!==L&&(L=G,a.style.pointerEvents=G),x},k=()=>{p?.dispose(),p=void 0},K=x=>{p=Iu({slot:x,own:a,measure:P,onDetached:k})};let re=[];const J=(x,j)=>{if(M=j,x&&re.length>0){const G=re;re=[],G.forEach(V=>V())}if(x===C){x&&!p&&K(x),P();return}if(k(),C&&C.style.removeProperty("height"),T="",O=0,L="",C=x,!x){w(),_();return}n.onShown?.(d),K(x),P(),m()};u.addDispose(k);const ee=x=>{f=!1,g=void 0,o?.(),x&&n.onReload?.(d);let j;E||h===void 0?j=A():(I(),j=h);try{d.contentWindow?.location.reload()}catch{d.src=c}return j};return{element:d,ready(){return h??A()},reload:()=>ee(!0),reloadQuietly:()=>ee(!1),followReload:()=>{g=void 0,o?.(),n.onReload?.(d)},moveTo(x){if(a.parentNode===x)return h??A();f=!1,g=void 0,o?.();let j;return E||h===void 0?j=A():(I(),j=h),x.appendChild(a),n.onReload?.(d),T="",p?.schedule(),j},get shown(){return C!==null},get slot(){return C},whenShown(){return C!==null?Promise.resolve():new Promise(x=>{re.push(x)})},get filled(){return g},noteFilled(x){g=x},alignTo(x,j){J(x,j??null)},scrollBy(x,j){let G=x,V=j;for(let X=C?Te(C):null;X;X=Te(X)){if(Math.abs(G)<1&&Math.abs(V)<1)return;const ce=getComputedStyle(X);if((ce.overflowY==="auto"||ce.overflowY==="scroll")&&X.scrollHeight>X.clientHeight){const gt=X.scrollTop,Pe=X.scrollLeft;X.scrollBy({left:G,top:V,behavior:"instant"}),G-=X.scrollLeft-Pe,V-=X.scrollTop-gt}}(Math.abs(G)>=1||Math.abs(V)>=1)&&window.scrollBy({left:G,top:V,behavior:"instant"})},resize(){N?.resize()},dispose(){J(null,null),_(),u.dispose(),a.remove()}}}function qu(e){const t=new Map;let n="a";const r=()=>n==="a"?"b":"a",s=(v,T)=>v==="email"?`email:${T??n}`:v,o=new Map;let i,a=[],c=!1,d,u,f=!1,g,E,S="shown",b=0,h,y,I;const A=v=>u!==void 0&&v.filled!==void 0&&v.filled!==u,D=()=>{h=void 0;const v=g;!f||!v||u===void 0||y===u||!A(v)||(y=u,e.onForeignDocument?.({wanted:u,filled:v.filled,role:S,heldMs:Date.now()-b}))},N=()=>{f=!1,g=void 0,E=void 0,clearTimeout(h),h=void 0},m=(v,T)=>{const L=o.get("email"),O=L?.slot??null;return v&&O&&A(v)?(v.alignTo(null),f||(f=!0,b=Date.now(),h=setTimeout(D,xu)),S=T,g=v,!(i!==void 0||c)&&E!==v&&(E=v,e.onShown?.(v.element)),!d&&!i&&(d=Ln(O)),!1):(f&&(N(),d?.remove(),d=void 0),v?.alignTo(O,L?.clip??null),!0)},_=()=>{f&&!c&&m(t.get(s("email")),"shown")},C=()=>{a.forEach(v=>clearTimeout(v)),a=[],i?.remove(),i=void 0,d?.remove(),d=void 0,(c||f)&&(c=!1,m(t.get(s("email")),"shown"))},M=(v,T,L)=>{const O=s(v,T),F=t.get(O);if(F)return F;const w=e.resolveMount();if(!w)return $u();const P=Wu(v,w,e,v==="email"?T??n:void 0,L,v==="email"?()=>_():void 0);return t.set(O,P),P},p={get:v=>M(v),current:v=>M(v),peek:v=>t.get(s(v)),spare:()=>t.get(s("email",r())),ensureSpare:()=>M("email",r(),!0),promote(){const v=t.get(s("email",r()));if(!v)return;const T=t.get(s("email"));n=r(),I=void 0,m(v,"spare"),T?.alignTo(null)},alignSurface(v,T,L){const O=o.get(v);if(o.set(v,{slot:T,clip:L??null}),v==="email"&&c){d?.remove(),d=T?Ln(T):void 0;return}const F=T?M(v):t.get(s(v));if(v!=="email"){F?.alignTo(T,L??null);return}if(!T){I=O?.slot&&F?.shown?{slot:O.slot,handle:F}:void 0,f&&(N(),d?.remove(),d=void 0),F?.alignTo(null);return}const w=I?.slot===T&&I.handle===F;if(I=void 0,O?.slot===T&&F?.shown||w){F?.alignTo(T,L??null);return}m(F,"shown")},want(v){u=v,v!==void 0&&_()},noteFilled(v,T){const L=p.byWindow(v);L&&(L.noteFilled(T),L===t.get(s("email"))&&_())},visible(){for(const v of t.values())if(v.shown)return v},byWindow(v){if(v){for(const T of t.values())if(T.element.contentWindow===v)return T}},busy(v){if(C(),!v)return;if(!p.visible()){c=!0,d?.remove(),d=void 0;const O=o.get("email");O?.slot&&(d=Ln(O.slot)),a=[setTimeout(C,ho)];return}const T=e.resolveMount();if(!T)return;const L=Uu(T,()=>p.visible()?.element.parentElement?.getBoundingClientRect()??null);i=L,a=[setTimeout(()=>L.showSpinner(),po),setTimeout(C,ho)]},remount(v){C();const T=s("email");t.forEach((L,O)=>{if(O===T){L.moveTo(v).catch(()=>{});return}L.dispose(),t.delete(O)})},dispose(){u=void 0,c=!1,N(),I=void 0,C(),t.forEach(v=>v.dispose()),t.clear(),o.clear(),n="a",u=void 0,y=void 0}};return p}var zu=l.createIdentifier$1("canvas.resizerBinder"),Nn=l.createIdentifier$1("canvas.service"),Ku={created:te.canvasCreated,loaded:te.canvasLoaded},Eo=new WeakMap;function xn(e){return Eo.get(e)??0}function Xu(e,t){if(e.getInstance(Nn))return;const n=qu({resolveMount:()=>t.resolveMount(),resolveSrc:s=>t.resolveSrc(s),resolveSandbox:Pd,elementId:t.elementId,bindResizer:s=>e.getInstance(zu)?.(s),onCreated:s=>Pt(e,s,"fresh"),onReload:s=>{Eo.set(s,xn(s)+1),Pt(e,s,"fresh")},onShown:s=>Pt(e,s,"switch"),mark:s=>t.mark?.(Ku[s]),onForeignDocument:s=>{({...s},El("canvas identity: place held, frame has another document",{origin:"canvas-identity",level:"warning",tags:{role:s.role},contexts:{canvasIdentity:{...s,path:window.location.pathname}}}))}}),r=Q(e).addListener(l.EVENT_TYPES.SANDBOX_WHEEL,s=>{n.visible()?.scrollBy(s?.deltaX??0,s?.deltaY??0)});e.inject(Nn,n),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r.dispose(),n.dispose()})}function Pt(e,t,n){const r=Q(e),s=t.contentWindow;if(!s)return;const o=r.getTarget()===s;o&&n==="switch"||(n==="fresh"&&(r.forget(s),o&&r.setTarget(void 0)),r.setTarget(s),dd(r))}function Ju(e,t){Pt(e,t,"promote")}function Qu(e,t){const n=t.contentWindow;n&&Q(e).greet(n)}function vo(e,t){const n=t.contentWindow;n&&Q(e).forget(n)}function Zu(e,t){const n=Z(e)?.byWindow(t)?.element;if(!n)return;const r=xn(n);return()=>xn(n)!==r}function Z(e){return e.getInstance(Nn)}function ef(e){const t=Q(e),n=()=>Z(e)?.byWindow(t.getTarget()),r=t.addListenerAsync(l.EVENT_TYPES.RELOAD,()=>{n()?.followReload()}),s=t.addOffTargetListener(l.EVENT_TYPES.RELOAD,a=>{const c=Z(e)?.byWindow(a);c&&vo(e,c.element)}),o=t.addListener(a=>{a.data?.operation===l.EVENT_TYPES.SANDBOX_RESIZED&&n()?.resize()}),i=z(e,l.events.ON_EMAIL_INIT_ID)(()=>{n()?.resize()});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r.dispose(),s.dispose(),o.dispose(),i.dispose()})}function _o(){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 tf(e){const t=e.getInstance(l.OPTIONS_SOURCE_ID);let n,r;e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r?.remove(),r=void 0}),Xu(e,{resolveMount:()=>n,resolveSrc:o=>qs(o==="block"),elementId:"email_iframe",mark:o=>W(o)}),t?.watch(o=>{const i=o?.element;if(n&&i instanceof HTMLElement&&i!==n){n=i,Z(e)?.remount(i),r?.remove(),r=void 0;return}if(!n){if(i instanceof HTMLElement)n=i;else if(o!==void 0){n=r??=_o(),Z(e)?.alignSurface("email",r,r);return}else return;Z(e)?.get("email")}});let s;e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{s?.remove(),s=void 0}),Vc(e).watch(o=>{const i=Z(e);if(i){if(o){s??=_o(),i.alignSurface("email",s,s);return}s&&(i.alignSurface("email",null),s.remove(),s=void 0)}})}var bo=l.createIdentifier$1("canvas.headerFlow"),yo=["subject","preheader"],nf=3e3,rf={subject:l.EVENT_TYPES.SANDBOX_SUBJECT_UPDATE,preheader:l.EVENT_TYPES.SANDBOX_PREHEADER_UPDATE};function sf(e){const t=ve(e),n=Q(e),r=h=>h?"remote":oo(e)?"system":"user",s=(h,{guid:y,value:I,forced:A})=>{const D=We(t);if(!D||typeof I!="string"||y&&y!==D.get().docId)return;const N=t.forcedHeaders();if(N?.[h]&&!A&&I!==N[h])return;A&&(f.delete(h),f.size===0&&t.endForcedHeaders());const m=D.get().attributes[h]??"";a=!0;try{Ke(D,{[h]:I},{source:r(A)})}finally{a=!1}o[h]=I,se(e,l.events.ON_HEADER_APPLIED_ID).fire({field:h,value:I,forced:!!A,isGenerated:I!==m&&!!I})};let o={},i,a=!1,c=Promise.resolve();const d=(h,y,I,A=!1)=>{c=n.sendAsync(rf[h],{value:y,guid:We(t)?.get().docId,...I?{force:!0,echo:!0}:{},...A?{undoStep:!0}:{}}).catch(D=>{})};let u;const f=new Set;e.inject(bo,{whenDelivered:async()=>{await c},reassert:h=>{const y=We(t),I=yo.filter(A=>h[A]);if(!(!y||I.length===0)){a=!0;try{Ke(y,Object.fromEntries(I.map(A=>[A,h[A]])),{source:"system"})}finally{a=!1}t.beginForcedHeaders({subject:h.subject??"",preheader:h.preheader??""}),clearTimeout(u),u=setTimeout(()=>{f.clear(),t.endForcedHeaders()},nf),f.clear();for(const A of I)f.add(A);for(const A of I)o[A]=h[A],d(A,h[A],!0)}}});const g=()=>{i?.(),i=void 0;const h=We(t);if(!h){o={};return}const y=h.get().attributes;o={subject:y.subject,preheader:y.preheader},i=h.subscribe(({source:I})=>{if(a)return;const A=h.get().attributes,D=t.forcedHeaders();for(const N of yo){const m=A[N];m!==o[N]&&(o[N]=m,d(N,m??"",I==="system"&&D?.[N]!==void 0,I==="user"))}})};g();const E=t.subscribe(g),S=n.addListenerAsync(l.EVENT_TYPES.APPLICATION_SUBJECT_UPDATE,h=>s("subject",h)),b=n.addListenerAsync(l.EVENT_TYPES.APPLICATION_PREHEADER_UPDATE,h=>s("preheader",h));e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{S.dispose(),b.dispose(),E(),i?.(),clearTimeout(u)})}function So(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function kn(e,t){const n={...e};for(const r of Object.keys(t)){const s=t[r],o=e[r];So(s)&&So(o)?n[r]=kn(o,s):s!==void 0&&(n[r]=s)}return n}function of(e,t){const n=l.COMMON_STYLES;if(typeof e=="string"){const r=e.trim();if(r.startsWith("{"))try{const s=JSON.parse(r);if(s&&typeof s=="object"&&!Array.isArray(s)&&Object.keys(s).length>0)return kn(n,s)}catch{}}return t&&typeof t=="object"&&!Array.isArray(t)?kn(n,t):n}function af(){const e=window.localStorage.getItem(l.LOCAL_STORAGE_ITEMS.em_color_scheme),t=matchMedia("(prefers-color-scheme: dark)").matches?l.DARK:l.LIGHT;return e&&e!=="system"?e:t}function lf(){const e=window.localStorage.getItem(l.LOCAL_STORAGE_ITEMS.em_code_mode_settings);if(!e)return!1;try{const t=JSON.parse(e);return!!(t?.isCodeMode&&(t.codeModeDirection==="left"||t.codeModeDirection==="right"))}catch{return!1}}function cf(e){const{config:t}=e;return{operation:l.EVENT_TYPES.UPDATE_PREVIEW,theme:e.theme,commonStyles:of(e.emailCommonStyles,e.defaultCommonStyles),pathEnabled:t.pathEnabled,copyPasteEnabled:t.copyPasteEnabled,saveBlockEnabled:t.saveBlockEnabled,editImageControlEnabled:t.editImageControlEnabled,codeMode:e.codeMode,elementAIimageEnabled:t.elementAIimageEnabled,imageCenterStockEnabled:t.imageCenterStockEnabled,imageCenterGifEnabled:t.imageCenterGifEnabled,imageCenterEditorEnabled:t.imageCenterEditorEnabled,blocksAddPanelEnabled:t.blocksAddPanelEnabled!==!1&&t.blocksSectionsShow!==!1,lockEditor:t.lockEditor,appName:e.appName}}var df=l.createIdentifier$1("DefaultCommonStyles");function wo(e){return e.getOrCreateInstance(df,()=>de(void 0))}function uf(e,t){wo(e).set(t)}function ff(e){const t=Q(e),n=e.getInstance(l.CONFIG_SOURCE_ID),r=e.getInstance(l.OPTIONS_SOURCE_ID),s=ve(e);let o,i="";const a=()=>{const I=n?.get()??{},A=cf({config:I,emailCommonStyles:s.current()?.get().attributes?.common_styles,defaultCommonStyles:o,theme:af(),codeMode:lf(),appName:"useblocks"}),D=JSON.stringify(A);D!==i&&(i=D,t.send(A))},c=t.onInit(()=>{i="",a()}),d=()=>{t.isInited()&&a()},u=n?.watch(d),f=wo(e).watch(I=>{o=I,d()}),g=r?.watch(I=>{I&&"commonStyles"in I&&(o=I.commonStyles),d()});let E;const S=()=>{E?.(),E=s.current()?.subscribe(d),d()};S();const b=s.subscribe(S),h=matchMedia(l.PREFERS_COLOR_SCHEME_DARK),y=()=>d();h.addEventListener("change",y),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{c.dispose(),u?.dispose(),f.dispose(),g?.dispose(),E?.(),b(),h.removeEventListener("change",y)})}var Fn;(function(e){function t(s,o,i=(a,c)=>a===c){if(s===o)return!0;if(s.length!==o.length)return!1;for(let a=0;a<s.length;a++)if(!i(s[a],o[a]))return!1;return!0}e.isEqual=t;function n(s,o=i=>i){const i=new Set;return s.filter(a=>{const c=o(a);return i.has(c)?!1:(i.add(c),!0)})}e.unique=n;function r(s=[],o=[],i=(a,c)=>a===c){const a=[],c=[],d=[];for(const u of s){const f=o.find(g=>i(u,g));f?d.push({prev:u,next:f}):c.push(u)}for(const u of o)s.find(f=>i(u,f))||a.push(u);return{added:a,removed:c,exists:d}}e.diff=r})(Fn||(Fn={}));function pf(e,t){return e.type===t.type&&e.key===t.key}function hf(e){const t=Q(e),n=()=>e.getServices(l.SANDBOX_EXTENSIONS_ID)??[];let r=[];const s=t.onInit(()=>{r=n(),t.send(l.EVENT_TYPES.SANDBOX_ADD_EXTENSIONS,r)}),o=l.getServiceContainerId(l.SANDBOX_EXTENSIONS_ID),i=e.onInject(a=>{if(a!==o)return;const c=n();if(!t.isInited()){r=c;return}const{added:d,removed:u}=Fn.diff(r,c,pf);if(r=c,u.length){if(u.some(f=>f.type==="script")){t.send(l.EVENT_TYPES.RELOAD);return}t.send(l.EVENT_TYPES.SANDBOX_REMOVE_EXTENSIONS,u.map(f=>f.key))}d.length&&t.send(l.EVENT_TYPES.SANDBOX_ADD_EXTENSIONS,d)});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{s.dispose(),i?.dispose()})}var mf=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 gf(e){return e.length>0&&!e.startsWith("em:")&&!mf.has(e)}function Ef(e){const t=Q(e),n=new Map;let r=!1,s=-1,o=new Set;const i=d=>(d!==s&&(s=d,o=new Set),o),a=t.observeOutgoing((d,u)=>{if(!r||!gf(d))return;const f=fe(t);n.set(d,{data:u,generation:f,scripts:new Set(i(f))})}),c=t.addListener(l.SANDBOX_EXTENSION_SCRIPT_STATUS_ID,d=>{if(d.phase!=="ready"||d.status!=="success")return;r=!0;const u=fe(t),f=i(u);f.add(d.key);for(const[g,E]of n)E.generation===u||![...E.scripts].every(S=>f.has(S))||(E.generation=u,t.send(l.createIdentifier(g),E.data))});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{a.dispose(),c.dispose()})}var vf=l.createIdentifier$1("prewarm.editorVisible");function _f(e){if(typeof requestAnimationFrame!="function"){setTimeout(e,0);return}requestAnimationFrame(()=>requestAnimationFrame(e))}function bf(e={}){const t=e.paint??_f;let n=!1,r=!1,s=!1,o=!1,i=!1;const a=[],c=()=>{i||o||!n||!r||!s||(o=!0,t(()=>{i=!0,W(te.editorVisible);for(const d of a.splice(0))d()}))};return{noteShellVisible(){n=!0,c()},notePagePainted(){r=!0,c()},noteContentShown(){s=!0,c()},whenVisible(d){if(i){d();return}a.push(d)},contentShown:()=>s}}function yf(e){return e.getOrCreateInstance(vf,()=>bf())}var Sf=500,wf=500,If=5e3;function Tf(e){const t=e.quietMs??Sf,n=e.floorMs??wf,r=e.ceilingMs??If;let s,o,i=0;const a=()=>{clearTimeout(s),clearTimeout(o),s=void 0,o=void 0},c=()=>{a(),e.run()},d=()=>{clearTimeout(s);const u=n-(Date.now()-i);s=setTimeout(c,Math.max(t,u))};return{start(){a(),i=Date.now(),o=setTimeout(c,r),d()},notify(){s!==void 0&&d()},cancel:a}}function Cf({attributes:e,readContent:t,docId:n,hasSession:r,serverId:s,show:o}){if(!r)return;const i={id:s??void 0,renderGuid:n,showId:o?.id,isNew:s==null,showToken:o?.token},a={...e,...i};return Object.defineProperty(a,"html",{get:()=>t()??"",enumerable:!0,configurable:!0}),a}var Io="self-init:";function Af(e){return e.startsWith(Io)}function To(e,t){const n=e.getActiveShowRequest();return Af(t)?n===null:n?.showId===t&&e.hasPendingShow(t)}function Df(e){const t=()=>e.initPipeline(),n=e.messageService,r=()=>e.waitScope?.()??t(),s=()=>e.frameWatch?.();let o="",i;const a=S=>{i={target:e.readTarget?.(),docId:S}},c=()=>e.readDocument()?wt(e.readDocument()):o,d=()=>Ie(e.container).editorPolicy,u=()=>e.readEmail(),f=()=>{const S=u();return{...S,id:e.isTemplate()||S.isNew?void 0:S.id,html:c()}};let g=!1;const E={readContent:c,publicEmail:f,sendInitStart:()=>he(n,"INIT_START",l.EVENT_TYPES.SANDBOX_INIT_START,{guid:u().renderGuid},void 0,r()),sendInited:()=>he(n,"INITED",l.EVENT_TYPES.SANDBOX_INITED,{guid:u().renderGuid},void 0,r(),s()),async sendContent(){const S=u(),{html:b,hasBrowserExtensionArtifacts:h}=Zs(S?.html||"");h&&e.events.browserExtensionDetected(),eo(e.readDocument(),b),o=b,a(S.renderGuid),await he(n,"SET_ENTITY",l.EVENT_TYPES.SANDBOX_SET_ENTITY,It(c(),S.renderGuid,d(),e.readDocument()?.get().version),{guid:S.renderGuid,emailId:S.id??null},r(),s())},refreshContent:()=>(a(u().renderGuid),he(n,"SET_ENTITY",l.EVENT_TYPES.SANDBOX_SET_ENTITY,It(c(),u().renderGuid,d(),e.readDocument()?.get().version),void 0,r(),s())),sendPreheader:async()=>{const S=u();if(S.preheader!==void 0)return he(n,"PREHEADER",l.EVENT_TYPES.SANDBOX_PREHEADER_UPDATE,{value:S.preheader,guid:S.renderGuid,force:!0},void 0,r(),s())},sendSubject:async()=>{const S=u();if(S.subject!==void 0)return he(n,"SUBJECT",l.EVENT_TYPES.SANDBOX_SUBJECT_UPDATE,{value:S.subject,guid:S.renderGuid,force:!0},void 0,r(),s())},revealFilled:()=>e.revealFilled?.()??Promise.resolve(),showFilled:S=>e.showFilled?.(S),noteFilled:(S,b)=>e.noteFilled?.(S,b),contentSent:()=>i,readTarget:()=>e.readTarget?.(),fireWillInit:()=>e.events.willInit(f()),fireInit(S,b){if(!To(t(),S)){t().getActiveShowRequest()?.showId;return}const h=u();h.id,h.renderGuid,t().completeShow(S);const y=e.readDocument();Ke(y,{is_inited:!0},{source:"system"});const I=()=>{const D=f();b&&(D.reset=!0);const N=e.events.inited(D);return b||(g&&E.fireEmailChanged(),g=!0),N};if(!y||y.isReady())return I();const{docId:A}=y.get();return y.whenReady().then(()=>e.readDocument()?.get().docId===A?I():void 0,()=>{})},fireEmailChanged(){e.events.emailChanged(f())},fireContentChanged(){e.events.contentChanged(c())}};return E}var Pf=2;function Co(){return new Error("[sandbox] document reloaded during fill")}function Rf(e,t,n){return{showId:e,reset:t,emailId:n?.id,renderGuid:n?.renderGuid}}function Bn(e){try{e()}catch{}}function Of(e){let t;return Bn(()=>{t=e()}),{stage:n=>Bn(()=>t?.stage(n)),end:(n,r)=>Bn(()=>t?.end(n,r))}}function Mf(e){const t=()=>e.initPipeline();let n=!1,r,s,o,i=0,a,c;const d=()=>{const m=e.readTarget?.(),_=e.readSandboxGeneration?.();return m===void 0||_===void 0?void 0:{target:m,generation:_}},u=()=>{const m=d();return m&&{...m,canvasReplaced:e.trackDocument?.(m.target)}},f=m=>{if(m?.canvasReplaced?.())return!0;const _=d();return m!==void 0&&_?.target===m.target&&_.generation!==m.generation},E=Df({...e,waitScope:()=>({getSandboxTimeoutMs:m=>t().getSandboxTimeoutMs(m),getSandboxReadyTimeoutMs:()=>t().getSandboxReadyTimeoutMs(),signal:a?.signal??t().signal}),frameWatch:()=>{const m=c;if(!(!m||!e.onSandboxGenerationChange))return{getGeneration:()=>d()?.generation??m.generation,onChange:_=>e.onSandboxGenerationChange?.(()=>{(e.readTarget?.()===m.target||m.canvasReplaced?.())&&_()})??(()=>{})}}});let S;const b=(m,_)=>{if(S===m)return;S=m;const C=i;setTimeout(()=>{i!==C||t().signal.aborted||A(m,_).catch(()=>{})},0)},h=()=>{a?.abort(),a=void 0};let y;const I=()=>{const m=t().signal;m!==y&&(y?.removeEventListener("abort",h),y=m,m.addEventListener("abort",h))};async function A(m,_,C=0){const M=++i;h(),a=new AbortController,c=void 0,I();const p=()=>i!==M,v=E.readTarget(),T=t().generation,L=()=>T===t().generation&&!t().signal.aborted,O=_?"init:reset-":"init:",F=Of(()=>e.observeShow?.(Rf(m,_,e.readEmail())));if(!_){const ee=E.publicEmail();ee?.id,ee?.renderGuid,ee?.preheader}let w=!1,P=!1,k,K=!1;const re=()=>{if(f(k))throw Co()},J=()=>{if(p())throw l.createAbortError("Fill superseded")};try{n=!0,await E.sendInitStart(),J(),k=u(),c=k,C===0&&E.fireWillInit(),await(_||C>0?E.refreshContent():E.sendContent()),w=!0,J(),re();const ee=E.contentSent();E.noteFilled(ee?.target,ee?.docId),F.stage("content"),_||E.publicEmail()?.id;try{await E.sendPreheader()}catch(x){if(no(x)||p())throw x;`${O}`,String(x)}J();try{await E.sendSubject()}catch(x){if(no(x)||p())throw x;`${O}`,String(x)}if(J(),re(),E.showFilled(v),await E.sendInited(),J(),re(),P=!0,s===m){const x=e.readSandboxGeneration?.()??o;x!==void 0&&(r=x)}F.stage("reveal"),await E.revealFilled(),re(),F.end("revealed")}catch(ee){const x=!p()&&L()&&f(k),j=x?Co():void 0,G=j??ee,V=x&&C<Pf?N(m,_,C+1):void 0;K=x&&V===void 0;const X=p()?void 0:{showId:m,contentApplied:w,sandboxInitedAcked:P,superseded:!1,...e.describeSurface?.(),error:String(j??ee)};X&&(`${O}`,void 0);const ce=!p()&&e.recoverFailedFill?.(v)===!0;if(F.end(p()?"superseded":ce?"recovered":l.isAbortError(G)||!L()?"aborted":"failed",X),!ce&&!p()&&To(t(),m)&&t().failShow(m,G),V!==void 0)return V;throw G}finally{D(m,_,O,{superseded:p(),sessionGeneration:T,contentApplied:w,sandboxInitedAcked:P&&!K,retry:!K,commit:L()})}}function D(m,_,C,M){const{superseded:p,contentApplied:v,sandboxInitedAcked:T}=M;if(p){`${C}`;return}T&&M.commit?E.fireInit(m,_||void 0):T?(`${C}`,M.sessionGeneration,t().generation,t().signal.aborted,void 0):v?(`${C}`,void 0):(`${C}`,void 0),n=!1,a=void 0,!T&&s===m&&(s=void 0,r===o&&(r=void 0)),!T&&v&&M.retry&&b(m,_)}function N(m,_,C){return A(m,_,C)}return{channel:E,isEventsLocked:()=>n,filledGeneration:()=>r,markFilled:m=>{r=m},lastCorrelation:()=>s,markCorrelation:m=>{s=m},bumpRunSeq:()=>{i+=1},noteSandboxGeneration:m=>{o=m},fill:m=>A(m,!1),refill:m=>A(m,!0),stop:()=>{i+=1,h(),n=!1,y?.removeEventListener("abort",h),y=void 0}}}function Lf(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:Ao(e,n)}function Ao(e,t){return t?e?.id==null?!1:String(e.id)===String(t):!0}function Nf(e){const{pipeline:t,readEmail:n,readDocument:r,readRouteEmailId:s,readSandboxGeneration:o}=e,i=u=>{const f=n(),g=s();if(!Lf(f,u,g)){u.showId,u.navId,u.emailId,f?.id,f?.showId,f?.renderGuid;return}u.showId,f?.id,f?.renderGuid,t.markFilled(o()),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=o();if(t.filledGeneration()===u)return;const f=n(),g=s();if(!f?.renderGuid||!Ao(f,g))return;const E=`${Io}${f.renderGuid}`;t.markFilled(u),t.markCorrelation(E);const S=r()?.isReady()===!0;f.id,f.renderGuid,(S?b=>t.refill(b):b=>t.fill(b))(E).catch(()=>{t.lastCorrelation()===E&&t.markFilled(void 0)})},saasChanged:()=>{const u=n();u?.renderGuid,u?.showToken,u?.id,r()}}}var xf=l.createIdentifier$1("canvas.health");function kf(e){return e??""}function Ff(e,t,n,r){return[e??"",t??"",n==null?"":String(n),r??""].join("|")}function Do(e){return e.length>0}function Bf(e){const t=ve(e),n=Q(e),r=()=>ue(t.sessionKey())?void 0:t.current(),s=()=>{const R=r();return Cf({attributes:R?.get().attributes??{},readContent:()=>R?.getContent(),docId:R?.get().docId,hasSession:!!R,serverId:R?.get().serverId,show:t.showFacts()})},o=()=>e.getInstance(l.INIT_PIPELINE_ID)??Pn;let i={},a=!1;const c=e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(R=>{a=!!R?.element});let d=!1,u=!1,f=!1,g=0;const E=()=>{const R=Z(e);if(!R)return;const H=++g,U=R.spare();return U&&vo(e,U.element),(U?U.reloadQuietly():R.ensureSpare()?.ready())?.then(()=>{if(H!==g)return;d=!0;const $=R.spare();$&&Qu(e,$.element),f&&(f=!1,T(),x())})},S=Tf({run:()=>{f||E()?.catch(()=>{})}}),b=()=>{yf(e).noteContentShown(),!d&&!f&&S.start()};let h=!1;const y=R=>{const H=Z(e),U=H?.spare()?.element.contentWindow;u&&H&&U&&R===U&&(u=!1,H.promote(),H.busy(!1),h=!0)};let I=!1;const N=Mf({container:e,messageService:n,initPipeline:o,readDocument:r,readEmail:s,revealFilled:()=>{const R=Z(e);return h&&R&&(h=!1,S.start()),a?R?.current("email").whenShown()??Promise.resolve():Promise.resolve()},showFilled:y,noteFilled:(R,H)=>Z(e)?.noteFilled(R,H),recoverFailedFill:R=>{const H=Z(e),U=H?.spare()?.element.contentWindow;return!u||!H||!U||R!==U?!1:(u=!1,d=!1,p="reload",H.busy(!1),H.peek("email")?.reload(),I=!0,x(),!0)},readTarget:()=>n.getTarget(),isTemplate:()=>!!i.isTemplate,readSandboxGeneration:()=>fe(n),onSandboxGenerationChange:R=>In(n,R),trackDocument:R=>Zu(e,R),observeShow:R=>e.getInstance(xf)?.begin(R),describeSurface:()=>({canvasPath:p,promoted:u,spareClean:d,handshake:n.isInited(),generation:fe(n)}),events:{willInit:R=>{se(e,l.events.WILL_EMAIL_INIT_ID).fire(R)},inited:R=>{b(),se(e,l.events.ON_EMAIL_INIT_ID).fire(R)},contentChanged:R=>{se(e,l.events.ON_CONTENT_CHANGED_ID).fire(R)},emailChanged:R=>{se(e,l.events.ON_EMAIL_CHANGED_ID).fire(R)},browserExtensionDetected:()=>{se(e,l.events.ON_BROWSER_EXTENSION_DETECTED_ID).fire()}}}),m=Nf({pipeline:N,initPipeline:o,readEmail:s,readDocument:r,readRouteEmailId:()=>i.emailId,readSandboxGeneration:()=>fe(n)});let _="",C="",M="",p="none";const v=()=>{const R=Z(e)?.spare()?.element.contentWindow;R&&n.getTarget()===R||n.sendNow({operation:l.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!0})},T=()=>{const R=Z(e)?.spare();R&&(v(),d=!1,u=!0,Ju(e,R.element))},L=(R,H)=>{const U=Z(e);if(!U)return!0;const $=U.spare(),Re=$&&d?"spare":"prepare";if(p=Re,U.busy(!0),$&&d)return T(),!0;S.cancel(),v();const Oe=E();if(Oe===void 0)return p="reload",U.busy(!1),U.peek("email")?.reload(),!0;f=!0;const ye=g;return Oe.catch(()=>{!f||ye!==g||(f=!1,p="reload",U.busy(!1),U.peek("email")?.reload())}),!1},O=()=>{gt(),N.noteSandboxGeneration(fe(n));const R=s(),H=Ff(R?.renderGuid,R?.showId,R?.id,i.emailId),U=kf(R?.renderGuid);if(U!==C){const Oe=C;C=U;const ye=Z(e)?.peek("email")?.filled,Jv=ye!==void 0&&ye!==U;Do(U)&&(Do(Oe)||Jv)&&L(Oe||(ye??""),U)}if(f)return;(H!==_||I)&&(I=!1,_=H,m.showRequestIdentityChanged());const $=r(),Re=`${H}|${$?.get().docId??""}|${fe(n)}`;Re!==M&&$?.isReady()===!0&&(M=Re,m.selfInitChanged()),m.saasChanged(),J()};let F=!1,w="",P="",k=!1,K=!1;const re=R=>{R.source==="user"?K=!0:(r()?.isReady()===!1||t.forcedHeaders()!==void 0)&&(k=!0),x()},J=()=>{const R=s();if(!R?.renderGuid)return;const H=N.channel.readContent(),U=JSON.stringify([R.preheader,R.common_styles,R.meta,R.subject,R.utm_parameters?.utm_campaign??"",R.utm_parameters?.utm_content??"",R.utm_parameters?.utm_medium??"",R.utm_parameters?.utm_source??"",R.utm_parameters?.utm_term??""]),$=F&&H!==P,Re=F&&U!==w;F=!0,P=H,w=U;const Oe=k&&!K;if(k=!1,K=!1,N.isEventsLocked()||Oe)return;const ye={...R,id:i.isTemplate||R.isNew?void 0:R.id,html:H};if($){se(e,l.events.ON_CONTENT_CHANGED_ID).fire(H),se(e,l.events.ON_EMAIL_CHANGED_ID).fire(ye);return}Re&&R.is_inited&&se(e,l.events.ON_EMAIL_CHANGED_ID).fire(ye)};let ee=!1;const x=()=>{ee||(ee=!0,queueMicrotask(()=>{ee=!1,O()}))};e.inject(Rn,{pipeline:N,setRoute:R=>{R.emailId===i.emailId&&!!R.isTemplate==!!i.isTemplate||(i=R,x())}});let j,G;const V=()=>{const R=r()?.get().docId;R!==G&&(j?.(),G=R,j=r()?.subscribe(re)),x()};let X,ce;const gt=()=>{const R=e.getInstance(l.INIT_PIPELINE_ID);!R||R===X||(ce?.(),X=R,ce=R.onShowRequested(H=>m.showRequested(H)))},Pe=n.addListener(R=>{R.data?.operation===l.EVENT_TYPES.SANDBOX_RESIZED&&S.notify()}),be=t.subscribe(V),zt=In(n,x);V(),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{c?.dispose(),ce?.(),zt(),be(),j?.(),Pe.dispose(),S.cancel(),N.stop()})}function jf(){return l.USEBLOCKS!=="useblocks"}var Po={config:{mode:"freeUserBlocks",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!0,styles:"",revisionService:!1,headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!0,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!0,webversionEnabled:!0,commonStylesEnabled:!0,emailResponsiveControlEnabled:!0,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!1,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!0,emailDropdownMenuClone:!0,emailDropdownMenuImport:!0,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportZipEnabled:!0,exportTextEnabled:!0,exportMarkdownEnabled:!0,exportClipboardEnabled:!0,exportWebHookEnabled:!0,exportOutlookEnabled:!0,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!0,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!0,aiAssistentEnabled:!0,optimizeEnabled:!0,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!0,annotationsEnabled:!1,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!0,tagsEnabled:!0,isTemplateEnabled:!0,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!0,deleteButtonEnabled:!0,toggleSidePanel:!0,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!0,formFieldImageTitleEnabled:!0,formFieldBorderEnabled:!0,formFieldBorderRadiusEnabled:!0,formFieldBoxShadowEnabled:!0,formFieldVisibilityEnabled:!0,formFieldExportAsPictureEnabled:!0,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!0,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!0,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!0,formCellFieldVerticalAlignEnabled:!0,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!0,formButtonFieldReplacerEnabled:!0,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!0,formImageFieldReplacerEnabled:!0,formImageFieldHeightEnabled:!0,formTextFieldTypografEnabled:!0,formTextFieldReplacerEnabled:!0,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!1,elementCountdownEnabled:!0,elementVideoEnabled:!0,elementAIimageEnabled:!0,elementAItextEnabled:!0,elementCarouselEnabled:!0,elementAccordionEnabled:!0,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!1,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!0,formFieldAmpVisibilityEnabled:!0,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4},project:void 0},Uf={config:{mode:"pro",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!0,styles:"",revisionService:!1,headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!0,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!0,webversionEnabled:!0,commonStylesEnabled:!0,emailResponsiveControlEnabled:!0,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!0,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!0,emailDropdownMenuClone:!0,emailDropdownMenuImport:!0,emailDropdownMenuImportButton:!1,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportZipEnabled:!0,exportTextEnabled:!0,exportMarkdownEnabled:!0,exportClipboardEnabled:!0,exportWebHookEnabled:!0,exportOutlookEnabled:!0,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!0,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!0,aiAssistentEnabled:!0,optimizeEnabled:!0,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!0,annotationsEnabled:!0,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!0,tagsEnabled:!0,isTemplateEnabled:!0,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!0,deleteButtonEnabled:!0,toggleSidePanel:!0,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!0,formFieldImageTitleEnabled:!0,formFieldBorderEnabled:!0,formFieldBorderRadiusEnabled:!0,formFieldBoxShadowEnabled:!0,formFieldVisibilityEnabled:!0,formFieldExportAsPictureEnabled:!0,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!0,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!0,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!0,formButtonFieldReplacerEnabled:!0,formCellFieldVerticalAlignEnabled:!0,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!0,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!0,formImageFieldReplacerEnabled:!0,formImageFieldHeightEnabled:!0,formTextFieldTypografEnabled:!0,formTextFieldReplacerEnabled:!0,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!0,elementCountdownEnabled:!0,elementVideoEnabled:!0,elementAIimageEnabled:!0,elementAItextEnabled:!0,elementCarouselEnabled:!0,elementAccordionEnabled:!0,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!0,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!0,formFieldAmpVisibilityEnabled:!0,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4,fileManager:{defaultFolderName:"",enableMoveFolder:!0,enableEdit:!0,enableTrash:!0,enableCopyFile:!0}},project:void 0,page:{isNew:!0,type:"email",project:0,id:"",showToken:0}},Ro=Po,Hf=["freeUserBlocks","blocks"],jn={};function $f(e){jn=e}var Oo=e=>Hf.includes(e)?Ro:jn[e]??jn.editor??Ro,Un={config:{mode:"simple",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!1,styles:"",headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!0,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!0,webversionEnabled:!1,commonStylesEnabled:!1,emailResponsiveControlEnabled:!1,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!1,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!0,emailDropdownMenuClone:!0,emailDropdownMenuImport:!0,emailDropdownMenuImportButton:!1,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportZipEnabled:!0,exportTextEnabled:!0,exportMarkdownEnabled:!0,exportClipboardEnabled:!0,exportWebHookEnabled:!0,exportOutlookEnabled:!1,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!0,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!0,aiAssistentEnabled:!0,optimizeEnabled:!0,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!1,annotationsEnabled:!1,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!0,tagsEnabled:!0,isTemplateEnabled:!0,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!0,deleteButtonEnabled:!0,toggleSidePanel:!0,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!0,formFieldImageTitleEnabled:!0,formFieldBorderEnabled:!1,formFieldBorderRadiusEnabled:!1,formFieldBoxShadowEnabled:!1,formFieldVisibilityEnabled:!1,formFieldExportAsPictureEnabled:!1,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!0,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!0,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!0,formButtonFieldReplacerEnabled:!1,formCellFieldVerticalAlignEnabled:!0,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!1,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!1,formImageFieldReplacerEnabled:!1,formImageFieldHeightEnabled:!1,formTextFieldTypografEnabled:!1,formTextFieldReplacerEnabled:!1,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!1,elementCountdownEnabled:!1,elementVideoEnabled:!1,elementAIimageEnabled:!0,elementAItextEnabled:!1,elementCarouselEnabled:!1,elementAccordionEnabled:!1,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!0,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!1,formFieldAmpVisibilityEnabled:!1,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4,fileManager:{defaultFolderName:"",enableMoveFolder:!0,enableEdit:!0,enableTrash:!0}},project:void 0},Vf={config:{mode:"editor",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!1,styles:"",headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!1,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!1,webversionEnabled:!1,commonStylesEnabled:!1,emailResponsiveControlEnabled:!1,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!0,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!1,emailDropdownMenuClone:!0,emailDropdownMenuImport:!1,emailDropdownMenuImportButton:!1,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportTextEnabled:!1,exportMarkdownEnabled:!1,exportZipEnabled:!0,exportClipboardEnabled:!1,exportWebHookEnabled:!1,exportOutlookEnabled:!0,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!1,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!1,aiAssistentEnabled:!1,optimizeEnabled:!1,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!1,annotationsEnabled:!1,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!1,tagsEnabled:!0,isTemplateEnabled:!1,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!1,deleteButtonEnabled:!0,toggleSidePanel:!1,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!1,formFieldImageTitleEnabled:!1,formFieldBorderEnabled:!1,formFieldBorderRadiusEnabled:!1,formFieldBoxShadowEnabled:!1,formFieldVisibilityEnabled:!1,formFieldExportAsPictureEnabled:!1,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!1,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!1,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!1,formButtonFieldReplacerEnabled:!1,formCellFieldVerticalAlignEnabled:!1,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!1,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!1,formImageFieldReplacerEnabled:!1,formImageFieldHeightEnabled:!1,formTextFieldTypografEnabled:!1,formTextFieldReplacerEnabled:!1,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!0,elementCountdownEnabled:!0,elementVideoEnabled:!1,elementAIimageEnabled:!0,elementAItextEnabled:!1,elementCarouselEnabled:!1,elementAccordionEnabled:!1,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!0,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!1,formFieldAmpVisibilityEnabled:!1,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4},project:void 0},Gf={...Un,config:{...Un.config,imageCenterFileManagerView:!1}};$f({pro:Uf,editor:Vf,simple:jf()?Un:Gf,blocks:Po});var Mo=l.createIdentifier$1("CodeMode");function Lo(){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 Yf(e){try{window.localStorage?.setItem(l.LOCAL_STORAGE_ITEMS.em_code_mode_settings,JSON.stringify({isCodeMode:e.isCodeMode,codeModeDirection:e.direction}))}catch{}}function No(e){return e.getOrCreateInstance(Mo,()=>{const t=de(Lo());return t.watch(Yf),t})}function xo(e){return e?.getInstance(Mo)?.get()??Lo()}function Hn(e,t){const n=No(e);n.get().isCodeMode!==t&&n.set({...n.get(),isCodeMode:t})}function Wf(e,t){const n=No(e);n.set({...n.get(),direction:t})}function qf(e,t,n=e.getInstance(l.CONFIG_SOURCE_ID)){n?.setMode(t),n?.get()?.codeEnabled===!1&&xo(e).isCodeMode&&Hn(e,!1)}function zf(e){e.getInstance(l.STANDALONE_ACTIVATED_ID)||e.inject(l.SECURITY_MODULE_ID,void 0)}function Rt(e){return String(e.standaloneKey||"").trim()||void 0}function Kf(e){return e.standaloneOnAuthFailure===!0?!0:e.config?.standaloneOnAuthFailure===!0}function $n(e){return Kf(e)?!!Rt(e):!1}function Qe(e){return!!Rt(e)&&!$n(e)}var Xf=["backendProxy","backendProxyPolicy","resourceProxy","resourceProxyPolicy"];function ko(e){return e==="server"?"serverSide":e}function Jf({env:e,base:t={},budgetMs:n}){const r={base:t,profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}},s=de();let o={kind:"pending"},i;const a=new Promise(g=>{i=g}),c=n===void 0?void 0:setTimeout(()=>{u({kind:"absent",reason:`серверный слой не пришёл за ${n} мс`})},n);function d(){o.kind!=="pending"&&s.set(_n(r,e))}function u(g){if(o.kind!=="pending")return;clearTimeout(c),o=g;const E=_n(r,e);s.set(E),i(E)}function f(g,E){r[ko(g)]=E,g==="server"&&o.kind==="pending"?u({kind:"applied"}):d()}return{watch:g=>s.watch(g),select:g=>s.select(g),get:()=>s.get(),ready:()=>a,state:()=>o,layers:()=>({...r}),bootstrap(){const g=_n(r,e);return Object.fromEntries(Xf.map(E=>[E,g[E]]))},merge(g,E){f(E,{...r[ko(E)],...g})},replace(g,E){f(E,g)},setMode(g){r.user={...r.user,mode:g},d()},setAdvancedConfigs(g){r.advancedConfigs=g,d()},serverAbsent(g){u({kind:"absent",reason:g})},applyServerResponse(g){o.kind==="pending"&&f("server",{...r.serverSide,...g})},dispose(){clearTimeout(c)}}}var Qf=5e3,Zf="blocks";function ep(){return{...Oo(Zf)?.config,mergeTags:void 0}}function tp(e,t){e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(n=>{t.setAdvancedConfigs({...n.advancedConfigs,...n.config?.advancedConfigs}),t.replace(n.config??{},"user")})}function np(e,t){let n;vn(e).watch(({profile:r})=>{const s=`${r?.theme??""}|${r?.locale??""}`;if(s===n)return;n=s;const o={};r?.theme&&(o.theme=r.theme),r?.locale&&(o.locale=r.locale),t.replace(o,"profile")})}function rp(e){if(!(!e||typeof e!="string"))return e==="simple"?"pro":e}function sp(e,t){let n,r=!1,s;const o=a=>{s??=yt(t.layers(),localStorage.getItem("configSwither")||void 0),t.get()?.mode!==a&&qf(e,a,t)},i=vn(e).watch(({profile:a})=>{const c=a?.email_builder_config,d=rp(c);if(d===void 0||c===n)return;const u=n===void 0;n=c,!(u&&r)&&o(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:s)||"editor";localStorage.setItem("configSwither",c),r=n===void 0,o(c)})}var Fo="замкнутый контур: app_init не выполняется";function op(e,t){if(e.getInstance(l.SECURITY_MODULE_ID)){t.serverAbsent(Fo);return}const n=e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(r=>{Qe(r)&&t.serverAbsent(Fo)});n&&e.getInstance(l.DISPOSABLE_ID)?.addDisposable(n)}async function ip(e,t){if(e.getInstance(en)===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 ap(e){e.injectFactory(l.CONFIG_SOURCE_ID,(t,n)=>{if(n)return n;const r=Jf({base:ep(),env:{modeDefaults:s=>Oo(s)?.config||{},fallbackMode:localStorage.getItem("configSwither")||void 0},budgetMs:Qf});return tp(e,r),np(e,r),sp(e,r),op(e,r),ip(e,r),e.getInstance(l.DISPOSABLE_ID)?.addDisposable(r),r},!0)}var Fe=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 B(e,t,n){const r=l.snapshot(e);return(s,o,i)=>{const a=r(async c=>{const d=t?t(c):c;i&&s.bind(i);const u=await s(d);return n?n(u):u},o,i);return()=>a.dispose()}}var lp=class{deps;handleDestroy;constructor(e){this.deps=e;const t=new l.Emitter;this.handleDestroy=B(t.event),e.lifetime.addDispose(()=>t.fire(e.getInstance()));const n=e.lifetime.addDisposable(new Fe(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{}}},Vn=l.createIdentifier$1("DestroyableService");function cp(e){e.injectFactory(Vn,(t,n)=>{if(n)return n;const r=e.getInstance(l.DISPOSABLE_ID);if(!r)throw new Error("[plugin] время жизни экземпляра не зарегистрировано");return new lp({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 dp(e){const t=e.getInstance(Vn);if(!t)throw new Error("[plugin] provideDestroyable не выполнен до сборки поверхности");return{handleDestroy:t.handleDestroy,destroy:()=>t.destroy()}}var up=1e3;function Bo(e,t,n=up,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 s=Object.keys(e),o=Object.keys(t);if(s.length!==o.length)return!1;for(const i of s)if(!Bo(e[i],t[i],n,r+1))return!1;return!0}return!1}function Ze(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 s=t[r],o=e[r];Bo(s,o)||(n[r]=s)}return n}var fp=({source:e,emailtags:t,group:n,tags:r,...s})=>s;async function pp(e,t){try{return{id:(await t(await e)).id}}catch{return}}async function hp({emails:e,saveTimeoutMs:t},n,r){const s=t?.()??rn();let o;try{const i=e.notifySave(n);return await Promise.race([i,new Promise((a,c)=>{o=setTimeout(()=>{const d=new an(s);n.value.id,Bl(d,pp(i,r)),c(d)},s)})])}catch(i){throw ds(i),i}finally{o!==void 0&&clearTimeout(o)}}function mp(e){const{emails:t}=e,n=async(r,s)=>{const o=fp(s),i=r===void 0?void 0:await t.cache.getIfPresent(r),a=i?{...i,...o}:o,c=i?Ze(i,o):o,d=u=>{const f=String(u.id??r??l.generateUUID()),g=u.id===void 0?{...u,id:f}:u;return t.cache.addOrUpdate(f,()=>g)};return await d(await hp(e,{prev:i,patch:c,value:a,source:s.source??""},d))};return{async readEmail(r){return await t.get(r)??null},async createEmail(r){const s=await n(void 0,r);return s?.renderGuid?s:{...s,renderGuid:l.generateUUID()}},async updateEmail(r,s){return await n(r,s)}}}var Gn=20;function gp(e){const t=Ep(e);return e.saveTimeoutMs?vp(t,e.saveTimeoutMs):t}function Ep({revisions:e,revisionsByEmail:t,readAutosave:n,savedAt:r,emailAuthor:s,integratorProject:o}){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(Gn*(c-1),Gn*c),page:c,hasMore:d.length>Gn*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 ql(await i(a,1),d);if(!u.revision)return fs([],d);const f={...u.revision,parent:a,isAutosave:!0};return fs([f],d,await i(a,1))},async saveAutosave(a,c){const d=await s?.(a),u=o?.();return await e.create({...Zl(c),...d!==void 0?{author:d}:{},...u!==void 0?{project:u}:{},parent:a,isAutosave:!0,modified:new Date().toString()})}}}function vp(e,t){return{...e,async saveAutosave(n,r){const s=t();let o;try{return await Promise.race([e.saveAutosave(n,r),new Promise((i,a)=>{o=setTimeout(()=>a(new is(s)),s)})])}catch(i){throw ds(i),i}finally{o!==void 0&&clearTimeout(o)}}}}var _p=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}},bp=class extends l.AsyncEmitter{};function d_(e){return e}var jo=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 s=await t(n);return l.deepEqual(n,s)||this._onChangeEmitter.fire(),s}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(([s,o])=>s)),r=(await this.entries()).filter(([s,o])=>!n.has(s));for(const[s,o]of e)t.push(this.addOrUpdate(s,()=>o)),n.add(s);for(const[s]of r)t.push(this.remove(s));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 yp(e,{filter:t,order:n="asc",orderBy:r,page:s,pageSize:o=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 f=d[u],g=t[u];return u==="id"||typeof f!="string"?f===g:typeof g=="string"&&f.startsWith(g)}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))),s!==void 0&&(e=e.slice(o*(s-1),o*s)),{data:e,filteredTotal:a,total:i,totalPages:Math.ceil(a/o)}}function Sp(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 s=t.get(r.id)||{};t.set(r.id,{...s,...r})}return[...t].map(([n,r])=>r)}function wp(e,t){return Uo(e)&&Uo(t)?String(e)===String(t):e===t}function Uo(e){return typeof e=="string"||typeof e=="number"}var Ip=class extends l.Disposable{_cache=new jo;_readEmitter=new l.AsyncEmitter;_saveEmitter=this.addDisposable(new _p);_removeEmitter=this.addDisposable(new bp);_foreignCache=Object.create(null);async get(e){return this._cache.getOrCreate(e,async t=>Object.assign({id:e},...(await this._readEmitter.fire(e)).filter(n=>!!n)))}get cache(){return this._cache}byForeignKey(e){let t=this._foreignCache[e];if(!t){const n=this.addDisposable(new l.Disposable);n.addDispose(()=>delete this._foreignCache[e]);const r=n.addDisposable(new jo),s=n.addDisposable(new l.AsyncEmitter);t=this._foreignCache[e]={get:async(o,i={})=>{await r.getOrCreate(o,async()=>{try{const c=Sp(await s.fire(o))||[];for(const d of c)d[e]=o,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||wp(d,o)});return yp(a,i)},first(o,i={}){return t.get(o,{...i,page:1,pageSize:1}).then(({data:a})=>a[0])},handleRead:s.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 s=>{const o=s?{...s,...t}:t;if(!r)return t=s?Ze(s,t):t,await this._saveEmitter.fire({prev:s,patch:t,value:o,source:n})})}async remove(e,{source:t="",silent:n}={}){const r=await this._cache.remove(e);return n||await this._removeEmitter.fire({value:r,source:t}),r}refresh(){this._cache.clear();for(const e of Object.values(this._foreignCache))e.clear()}suspendChange(){this._cache.suspendChange()}resumeChange(){this._cache.resumeChange()}handlerRead=this._readEmitter.event;onSave=this._saveEmitter.event;onRemove=this._removeEmitter.event;onChange=this._cache.onChange};function et(e){const t=l.createIdentifier$1(e);return n=>n.getOrCreateInstance(t,()=>new Ip)}function Ho(e){const t=e.getInstance(l.DISPOSABLE_ID);if(!t)throw new Error("Failed");return t}function $o(e){return Object.prototype.hasOwnProperty.call(e,"meta")}function Yn(e,t){const n={...e};return t===void 0?(delete n.meta,n):(n.meta={...e.meta??{},...t},n)}function Tp(e,t,n){return e&&!$o(t)&&$o(e)?{...n,meta:e.meta}:n}var Cp=l.createIdentifier$1("CurrentProject"),Ap={};function tt(e){return e?.getInstance(Cp)?.get()??Ap}function Wn(e){const t=tt(e).card?.id,n=Number(t);return t!=null&&t!==""&&Number.isFinite(n)?n:void 0}var Vo=et("plugin.dataSource.emails"),Go=et("plugin.dataSource.emailRevisions"),Yo=Dn("plugin.readEmailAutosave"),Wo=l.createIdentifier$1("emailDocuments.provided");function Dp(e){const t=Vo(e),n=Go(e),r=n.byForeignKey("parent");if(e.getInstance(Wo))return{emails:t,emailRevisions:n};e.inject(Wo,!0);const s=()=>rn(e.getInstance(l.INIT_PIPELINE_ID)?.contentReadyTimeoutMs),o=mp({emails:t,saveTimeoutMs:s}),i=new Map,a=(c,d)=>u=>{const f=u?.id??d;return(typeof f=="string"||typeof f=="number")&&i.set(String(f),c),u};return Ic(e,{...o,createEmail:c=>o.createEmail(c).then(a(Date.now())),updateEmail:(c,d)=>o.updateEmail(c,d).then(a(Date.now(),c))}),Dc(e,gp({revisions:n,revisionsByEmail:r,readAutosave:async c=>{const d=await se(e,Yo).fire(c);return d.length===0?{asked:!1}:{asked:!0,revision:d[0]??null}},savedAt:async c=>{const d=Yl((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:s,integratorProject:()=>tt(e).requested})),Ho(e).addDisposable(t.onSave(({prev:c,patch:d,value:u})=>Tp(c,d,u),Number.MIN_VALUE)),{emails:t,emailRevisions:n}}function qo(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 Pp(e){try{return localStorage.getItem(e)===null?!1:(localStorage.removeItem(e),!0)}catch{return!1}}var Rp="po",Ot=null;function Op(){const e=typeof __useblocks__<"u"?__useblocks__?.require:void 0;return typeof e!="function"?Promise.reject(new Error("[loadPoParser] AMD loader is unavailable")):new Promise((t,n)=>{e([Rp],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadPoParser] Failed to require po module")))})}function Mp(){return Ot===null&&(Ot=Op().catch(e=>{throw Ot=null,e})),Ot}async function zo(e){if(typeof e=="object")return qn(e);if(typeof e!="string")return;const t=e.trim();if(t)return t.startsWith("{")||t.startsWith("[")?Lp(t):Np(t)}function qn(e){if(!(e==null||typeof e!="object"||Array.isArray(e)))return e}function Lp(e){try{return qn(JSON.parse(e))}catch{return}}var Ko=!1;async function Np(e){try{return qn((await Mp()).parsePoCatalog(e))}catch{Ko||(Ko=!0);return}}var xp="em_locale",kp="em_ant_locale",Fp="locale",Bp="ant_locale";function zn(e){try{return JSON.parse(localStorage.getItem(e)||"")}catch{return null}}function Xo(e,t){const n=zn(e);if(!n)return null;try{localStorage.removeItem(e),localStorage.setItem(t,JSON.stringify(n))}catch{}return n}function jp(){return zn("em_locale")??Xo(Fp,"em_locale")}function Jo(e){try{localStorage.setItem(xp,JSON.stringify(e))}catch{}}function Up(){return zn("em_ant_locale")??Xo(Bp,"em_ant_locale")}function Hp(e,t){try{localStorage.setItem(kp,JSON.stringify({id:e,data:t}))}catch{}}var u_="en_US",$p=8e3;function Vp(e,t){const n=e,r=t,s=Object.keys(n).filter(o=>o!=="");return s.length!==Object.keys(r).filter(o=>o!=="").length?!1:s.every(o=>JSON.stringify(n[o])===JSON.stringify(r[o]))}function Gp(e){const t=jp(),n=Up();let r={ready:!1},s;const o=de(r);let i=0;const a=h=>{r={...r,...h},o.set(r)},c=()=>{r.ready||a({ready:!0})},d=setTimeout(c,e.unlockAfterMs??$p),u=h=>h!==i;let f;async function g(h,y){if(n?.id===h&&n.data&&a({antd:n.data}),!f)return;const I=await f(h).catch(()=>{});!I||u(y)||(a({antd:I}),Hp(h,I))}async function E(h,y){const I=await e.askHost(h).catch(()=>null);if(u(y))return!0;if(I==null)return!1;const A=await zo(I);return u(y)||(A&&a({catalog:A}),c()),!0}async function S(h,y){const I=await e.readList();if(u(y))return;if("error"in I){a({failure:{kind:"GET_LOCALES_ERROR",error:I.error}}),c();return}const A=I.data.find(N=>N.locale===h);if(!A){Pp("em_locale")&&a({catalog:void 0}),c();return}if(qo(t,A)&&(!s||s.catalog===t?.data)){c();return}if(s?.entry&&r.catalog===s.catalog&&qo(s.entry,A)){Jo(s.entry),c();return}const D=await e.readCatalog(h);if(!u(y)){if("error"in D){a({failure:{kind:"GET_LOCALE_ERROR",error:D.error}}),c();return}D.data&&(s?.id===h&&r.catalog===s.catalog&&Vp(s.catalog,D.data)||a({catalog:D.data}),Jo({id:h,time:A.updatedAt||Math.floor(Date.now()/1e3),hash:A.contentHash,data:D.data})),c()}}async function b(h,y){if(!await E(h,y)){if(!u(y)&&(s?.id===h&&r.catalog===s.catalog||h==="en_US")&&c(),e.canUseNetwork&&!e.canUseNetwork()){c();return}await S(h,y)}}return{set(h){if(!h||h===r.id)return;const y=i+=1;a({id:h,failure:void 0});const I=s?.id===h&&r.catalog===s.catalog;(s&&!I&&r.catalog===s.catalog||h==="en_US"&&r.catalog)&&a({catalog:void 0}),t?.id===h&&t.data&&(a({catalog:t.data}),c()),g(h,y),b(h,y)},prime(h,y,I){r.id&&r.id!==h||r.catalog||!y||(s=t?.id===h&&t.data&&(!I||t.time>=I.time)?{id:h,catalog:t.data}:{id:h,catalog:y,entry:I?{id:h,time:I.time,hash:I.hash,data:y}:void 0},a({catalog:s.catalog}))},useAntdLoader(h){f=h,r.id&&g(r.id,i)},state:o,snapshot:()=>r,dispose:()=>clearTimeout(d)}}var Yp=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})},Wp=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:s,format:o,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),f=s&&this.toQueryString(s),g=this.contentFormatters[r||"application/json"],E=o||u.format;return this.customFetch(`${i||this.baseUrl||""}${n}${f?`?${f}`:""}`,{...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:g(e)}).then(async S=>{const b=S;b.data=null,b.error=null;const h=E?S.clone():S,y=E?await h[E]().then(I=>(b.ok?b.data=I:b.error=I,b)).catch(I=>(b.error=I,b)):b;return a&&this.abortControllers.delete(a),y})}},qp=l.createIdentifier$1("rest.v2.transport"),Qo=Symbol("rest.v2.secureRequest");function zp(e){return e.getOrCreateInstance(qp,()=>{const t=e.getInstance(l.CUSTOM_FETCH_ID)?.execute||fetch;return new Wp({baseUrl:"https://app.useblocks.io/api/v2",securityWorker:()=>({[Qo]:!0}),customFetch:(n,r={})=>{const{[Qo]:s,...o}=r;return t(n,{...o,[l.PUBLIC_REQUEST]:s!==!0})}})})}function Kp(e,t){const n=zp(e);return Object.assign({},...t.map(r=>new r(n)))}function Zo(e,t){if(e!=null&&typeof e=="object"){const n=e[t];if(typeof n=="string"&&n!=="")return n}}function ei(e){const t=e.error,n=t?.error;return n&&typeof n=="object"?{status:e.status,data:{code:Zo(n.details,"wp_code")??n.code,message:Zo(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 ti(e){return!e.ok||!!e.error}function Xp(e){try{const t=localStorage.getItem(e);if(t==="true")return!0;if(t==="false")return!1}catch{}}function ni(){return Xp(l.LOCAL_STORAGE_ITEMS.em_translations_v2)??!0}function Jp(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function Qp(e){const t=e?Date.parse(e):NaN;return Number.isNaN(t)?0:Math.floor(t/1e3)}function Zp(e){return Array.isArray(e)?e.reduce((t,n)=>{const r=Array.isArray(n)?n:[],s=r[0];return typeof s=="string"&&s!==""&&t.push({locale:s,updatedAt:Jp(r[1])}),t},[]):[]}function eh(e){return(e?.items??[]).reduce((t,n)=>(n.locale&&t.push({locale:n.locale,updatedAt:Qp(n.updated_at),contentHash:n.content_hash}),t),[])}function ri(e){return Kp(e,[Yp])}function Mt(e){return{error:{status:"FETCH_ERROR",error:e instanceof Error?e.message:"locale request failed"}}}function Kn(e){return!e.ok||e.error!=null}function Xn(e){const t=e.error;return{error:{status:e.status,data:t?.data??e.error}}}async function Jn(e){return{data:await zo(e)??null}}async function th(e){if(ni())try{const n=await ri(e).localesList();return ti(n)?{error:ei(n)}:{data:eh(n.data)}}catch(n){return Mt(n)}const t=l.getApi(e,[Yr]);try{const n=await t.get_translations2({file:"react_app"});return Kn(n)?Xn(n):{data:Zp(n.data)}}catch(n){return Mt(n)}}async function nh(e,t){if(ni())try{const r=await ri(e).jsonList({locale:t});return ti(r)?{error:ei(r)}:Jn(r.data)}catch(r){return Mt(r)}const n=l.getApi(e,[Yr]);try{const r=await n.get_translations3({id:t,file:"react_app"});return Kn(r)?Xn(r):Jn(r.data)}catch{try{const r=await n.get_translations3({id:"en_US",file:"react_app"});return Kn(r)?Xn(r):Jn(r.data)}catch(r){return Mt(r)}}}var Lt=new WeakMap;function rh(e){const t=Lt.get(e);if(t!==void 0)return t;const n=th(e).then(r=>("error"in r&&Lt.delete(e),r),r=>{throw Lt.delete(e),r});return Lt.set(e,n),n}var nt=l.createIdentifier$1("locale.service");function sh(e){if(e.getInstance(nt))return;const t=Gp({readList:()=>rh(e),readCatalog:n=>nh(e,n),askHost:async n=>(await se(e,l.events.READ_LOCALE).fire(n))[0],canUseNetwork:()=>!e.getInstance(l.SECURITY_MODULE_ID)});e.inject(nt,t),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>t.dispose())}function oh(e){const t=e.getInstance(l.CONFIG_SOURCE_ID);if(!t)return;const n=e.getInstance(nt);if(!n)return;const r=t.select(s=>s.locale).watch(s=>n.set(s||"en_US"));e.getInstance(l.DISPOSABLE_ID)?.addDisposable(r)}var ih="user_id",ah="project_id",si=l.createIdentifier$1("rest.identityHeadersProvided");function lh(e){if(e.getInstance(si))return;e.inject(si,!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 s=t?.user?.id??Ms(e).profile?.id;s!=null&&s!==""&&n.headers.set(ih,String(s));const o=t?.project;o!=null&&o!==""&&n.headers.set(ah,String(o))}})}function ch(e){if(!e)return!1;try{return e.getInstance(l.SECURITY_MODULE_ID)!==void 0}catch{return!1}}var dh="Invalid standaloneKey.",f_=l.createIdentifier$1("StandaloneMockGuard");function uh(){const e=new Error(dh);return e.name="InvalidStandaloneKeyError",e}function fh(e){e.addService(l.REQUEST_HANDLER_ID,{execute:()=>{if(ch(e))throw uh()}})}function ph(e){l.registerRestTransport(e),fh(e)}function hh(e){const t=new to;e.inject(l.INIT_PIPELINE_ID,t);const n=e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(s=>{if(!s)return;const o=s.signal??t.externalSignal;t.configure({replaceSession:!0,...s.timeouts!==void 0?{timeouts:s.timeouts}:{},...o!==void 0?{signal:o}:{}})}),r=e.getInstance(l.DISPOSABLE_ID);n&&r?.addDisposable(n),r?.addDispose(()=>{t.abort()})}var mh=et("plugin.dataSource.blocks"),gh=et("plugin.dataSource.blockRevisions"),Eh=et("plugin.dataSource.comments"),vh=Dn(),_h=Dn(),oi=`<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
2110
2110
|
<html>
|
|
2111
2111
|
<head>
|
|
2112
2112
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
@@ -2147,10 +2147,10 @@ __useblocks__.define("useblocks.js",["require","exports","module","static/umd/b1
|
|
|
2147
2147
|
</tr>
|
|
2148
2148
|
</table>
|
|
2149
2149
|
</body>
|
|
2150
|
-
</html>`;function
|
|
2150
|
+
</html>`;function bh(e){return{isNew:!0,is_inited:!1,subject:void 0,preheader:void 0,description:"",html:oi,project:e?.id,project_title:e?.title??"",tags:[],utm_parameters:{utm_source:"",utm_medium:"",utm_campaign:"",utm_term:"",utm_content:""},parent_email:null,common_styles:"{}",title:"",emailtags:[],isAmp:!1}}var ii=new Set(["email","block","blocks","autosaves","revisions","comments","templateId","reload"]);function yh(e){return!Object.keys(e).some(t=>ii.has(t))}function Sh(e){const t={},n={};for(const[r,s]of Object.entries(e))ii.has(r)?t[r]=s:n[r]=s;return{showOptions:t,misplacedEmailFields:n}}function ai(e){const t=e.id;if(!(t===null||typeof t=="string"&&t.trim()===""))return e;const n={...e};return delete n.id,n}function p_(e){}function rt(e){return{emails:Vo(e),blocks:mh(e),emailRevisions:Go(e),blocksRevision:gh(e),comments:Eh(e)}}function wh(e){const t=Object.values(rt(e));return{suspendChange(){t.forEach(n=>n.suspendChange())},resumeChange(){t.forEach(n=>n.resumeChange())}}}function Nt(e,t=!0){if(typeof e=="string")return{email:{code:e}};if(yh(e))return{email:ai(e)};{const{showOptions:n,misplacedEmailFields:r}=Sh(e),s=Object.keys(r);t&&s.length>0&&void 0;const o=typeof e.email=="string"?{code:e.email}:e.email;return{...n,email:ai({...r,...o})}}}function Qn(e){return yn(e)?.current()}function xt(e){return Qn(e)?.getContent()}function li(e,t){const n=t??bh(),r=Qn(e)?.get();return r?{...n,...r.attributes,id:r.serverId??void 0,isNew:r.serverId===null,html:xt(e)??n.html}:n}async function kt(e){return(await e.getInstanceAsync(l.APP_ID))?.project}async function Ih(e){return Wn(e)??await kt(e)}function ci(e){if(!e)return;const t=Nt(e,!1).email.id;return t==null?void 0:String(t)}function Th(e,t){return e.ticket===t.ticket?!1:e.emailId===void 0||e.emailId!==t.emailId}function Ch(e){return typeof e=="object"&&e!==null&&"reload"in e&&e.reload===!0}function Be({code:e,project:t,...n},r){const s=Ee(n),o=Wn(r),i=Ie(r);return e&&i.warnAboutUnconfiguredInput(e,n.id),{...s,...e?{html:i.toEditorForm(e)}:{},...o===void 0?{}:{project:o},..."utm_parameters"in s?{utm_parameters:s.utm_parameters||{}}:{},_embedded:void 0}}function oe({html:e,renderGuid:t,showToken:n,showId:r,...s},o){const{requested:i}=tt(o),a=xs(o);return Ee({...s,code:Ie(o).toOutputForm(e),project:i===void 0?s.project:i,utm_parameters:a.UTMEnabled?s.utm_parameters:void 0,tags:void 0,template:void 0,guid:void 0,emailtags:void 0,project_title:void 0,project_author:void 0,is_template:void 0,is_inited:void 0})}function Zn(e){return e==null?"":e.replaceAll(`\r
|
|
2151
2151
|
`,`
|
|
2152
|
-
`)}function ci(e){return e.replace(/<title[^>]*>[\s\S]*?<\/title>/gi,"")}function Th(e,t,n,r){const s=Ch(e,t,n,r);return s===void 0}function Ch(e,t,n,r){const{email:s}=Nt(t,!1),o=Be(s,e),i=o.id;if(i===void 0)return"no-id";if(r!==void 0&&r!==i)return"other-id-shown";const a=yn(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=ci(Zn(n??a.getContent()));if(o.html!==void 0&&ci(Zn(o.html))!==u)return"html";if(o.subject!==void 0&&o.subject!==d.subject)return"subject";if(o.preheader!==void 0&&o.preheader!==d.preheader)return"preheader";if(o.common_styles!==void 0&&o.common_styles!==d.common_styles)return"common_styles"}function di(e,t){const{email:n}=Nt(t,!1),r=Be(n,e);if(r.id!==void 0)return JSON.stringify([r.id,r.html===void 0?null:Zn(r.html),r.subject??null,r.preheader??null,r.common_styles??null])}function Ah(e,t){const n={...e};return delete n.id,{...n,...t}}function Dh(e){return e.html?e:{...e,html:si}}function st({code:e,project:t,...n},r,s){const o=s??Wn(r);return{...n,...e?{html:we(r).toEditorForm(e)}:{},renderGuid:l.generateUUID(),...o===void 0?{}:{project:o}}}function ot({html:e,renderGuid:t,...n},r){const{requested:s}=tt(r);return ge({...n,code:we(r).toOutputForm(e),project:s===void 0?n.project:s,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 ui(e){return yn(e)?.current()?.get().serverId??void 0}function er(e,t,n){return n===void 0&&(n=e.post===void 0?ui(t):e.post),{...e,content:e.content?`<p>${e.content}</p>`:"",post:n}}function it(e,t){return ge({...e,link:void 0,comment_status:void 0})}function Ft({code:e,autosave:t,...n},r,s){return s===void 0&&(s=n.parent===void 0?ui(r):n.parent),{...n,...e?{html:e}:{},isAutosave:t===!0||ec(n.slug),parent:s}}function tr({html:e,isAutosave:t,...n},r){return ge({...n,autosave:t?!0:void 0,code:e,guid:void 0,compiled:ge({html:e,ampHtml:e&&""})})}var je=l.createIdentifier$1("NotificationService"),Ph=l.createIdentifier$1("emailTemplate.reads");async function Rh(e,t){try{return await Se(e).email(e).readEmail(t)??void 0}catch(n){n instanceof Error&&n.message,Mh(e,t,n);return}}var Oh=l.createIdentifier$1("emailTemplate.notifiedFailures");function Mh(e,t,n){if(n instanceof DOMException&&n.name==="AbortError")return;const r=e.getOrCreateInstance(Oh,()=>new Set);r.has(t)||(r.add(t),e.getInstanceAsync(je).then(()=>{l.getEmitter(e,l.events.ON_NOTIFICATION).fire({type:"warning",id:"TEMPLATE_READ_ERROR",data:{templateId:t},innerException:n})},()=>{}))}function Lh(e,t){const n=e.getOrCreateInstance(Ph,()=>new Map),r=n.get(t);if(r!==void 0)return r;const s=Rh(e,t).then(o=>(o===void 0&&n.delete(t),o));return n.set(t,s),s}var Nh="EXTERNAL",fi=Symbol("supersededShow");function xh(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"[emailmaker] save failed")}var kh="email_id",Fh=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=rt(t),this._eventLock=yh(t);const n=X(e,l.events.ON_EMAIL_CHANGED_ID);this.addDisposable(n(r=>{this._currentEmail=r})),this.addDisposable(e.addService(l.REQUEST_HANDLER_ID,{execute:(r,s)=>{!s?.public&&this._currentEmail?.id&&!this._currentEmail.isNew&&r.headers.append(kh,this._currentEmail.id)}}))}_getInitPipeline(){return this._container?.getInstance(l.INIT_PIPELINE_ID)??Pn}_throwIfDestroyed(){if(this.isDisposed())throw me()}async getTemplateEmail(e){const t=await Lh(this._container,String(e));if(!t)return;const n={...t,lock:!1,parent_email:String(e)};return delete n.id,n}async setBlocks(e=[]){const{cache:t}=this._dataSources.blocks,n=await kt(this._container);await t.setAll(e.filter(r=>r.id!==void 0).map(r=>[r.id,st(r,this._container,n)]))}async setEmailRevisions(e,t){if(e===void 0)return;const{cache:n}=this._dataSources.emailRevisions,r=e.filter(s=>s.id!==void 0).map(s=>[s.id,Ft(s,this._container,t)]);await n.setAll(r)}async setComments(e=[],t){const{cache:n}=this._dataSources.comments,r=e.filter(s=>s.id!==void 0).map(s=>[s.id,er(s,this._container,t)]);await n.setAll(r)}async setEmail(e,t,n,r,s){const o=this._dataSources.emails,i=o.cache,a=await kt(this._container),c=r??this._showToken;e=typeof e=="string"?{code:e}:{...e};let d=Be(e,this._container);const u=d.id;let f=u;if(u!==void 0){const g=await o.get(u);d={...g??{},...d,utm_parameters:d.utm_parameters??g?.utm_parameters??{},renderGuid:g?.renderGuid??l.generateUUID(),...c>0?{showToken:c}:{},...s?{showId:s}:{},project:a}}else{f=n??l.generateUUID();const g=await o.get(f);d={...d,utm_parameters:d.utm_parameters??{},renderGuid:g?.renderGuid??l.generateUUID(),...c>0?{showToken:c}:{},...s?{showId:s}:{},project:a},delete d.project}if(t){const g=await this.getTemplateEmail(String(t));g&&(d=Ah(g,d))}return u===void 0&&(d=Dh(d)),await i.setAll([[f,d]]),d}_rememberShow(e){this._prevCommand=e}_isRepeatOfLastShow(e){const t=this._lastShow;if(!t||t.signature!==di(this._container,e))return!1;const n=xt(this._container);return n===void 0||n===t.html}_rememberShownContent(e){const t=di(this._container,e);this._lastShow=t===void 0?void 0:{signature:t,html:xt(this._container)??""}}async _show(e,t){if(this._throwIfDestroyed(),t!==void 0&&Ih({ticket:t,emailId:li(e)},{ticket:this._showRequests,emailId:this._latestShowEmailId}))return this._showRequests,fi;if(!e)return;const n=this._getInitPipeline();l.throwIfAborted(n.signal);const r=wh(e);if(!r&&Th(this._container,e,xt(this._container),this._prevCommand?.id)||!r&&this._isRepeatOfLastShow(e))return;const s=Nt(e);s.email.id,this._prevCommand?.id;let o,i="",a=0,c=!1,d,u=Promise.resolve(),f,g=!1;try{this._eventLock.suspendChange();const{email:E,blocks:S,autosaves:b,comments:h,templateId:y,reload:w}=s;o=E.id;const A=Be(E,this._container),D=A.id,N=D??l.generateUUID(),m=await qe("getProject",kt(this._container));l.throwIfAborted(n.signal),i=l.generateUUID();const _={isNew:D===void 0,id:String(N),project:m},C=w===!0&&D!==void 0;C&&(await this._dataSources.emails.remove(String(D),{silent:!0}),String(D)),a=++this._showToken,String(N);const M=[];M.push(this.setBlocks(S)),E.id!==void 0&&(M.push(this.setComments(h)),M.push(this.setEmailRevisions(b,String(E.id)))),M.push(this.setEmail(E,Number(y),D===void 0?String(N):void 0,a,i)),await qe("setEmail+blocks+revisions",Promise.all(M),{emailId:D??String(N),showId:i,targetShowToken:a}),l.throwIfAborted(n.signal);const p=await this._dataSources.emails.get(String(N)),v=Ee(this._container),T={id:i,token:a};D===void 0?f=v.startNewDraft(p??A,{patch:A,show:T}):C?f=v.reload(D,{email:p??A,patch:A,show:T}):v.sessionKey()===Le(D)?f=v.show(A,T):f=v.open(D,{email:p??A,patch:A,show:T});const L=!!this._prevCommand&&l.deepEqual(this._prevCommand,_);_.id,!this._prevCommand||l.deepEqual(this._prevCommand,_),this._prevCommand?.id,this._rememberShow(_),u=n.requestShow({showId:i,navId:String(N),emailId:D,isNew:D===void 0}),g=!0,String(N),c=!0}catch(E){d=E,g&&i&&n.failShow(i,E),l.isAbortError(E)||(ts(E),void 0)}finally{this._eventLock.resumeChange()}if(!c)throw d instanceof Error?d:new Error(`[useblocks] show() setup failed: ${String(d??"unknown error")}`);return qe("show-init-deferred",Promise.all([u,f?.whenReady().catch(E=>{if(E instanceof Ge){const S=gn(E);throw S?new Error(`[useblocks] show(): email open failed (${S})`,{cause:E}):E}})??Promise.resolve()]).then(()=>{}),{showId:i,emailId:o??null}).then(()=>{this._rememberShownContent(e)})}async _save(){this._throwIfDestroyed();const e=this._getInitPipeline();l.throwIfAborted(e.signal);const t=Ee(this._container),n=await t.save("publish",{source:Nh,fallbackTitle:Us(this._container)});if(l.throwIfAborted(e.signal),!n)throw xh(t.saveState().error);return oe(ai(this._container,this._currentEmail),this._container)}_queuedShow=this._queue.decorate((e,t)=>this._show(e,t),this);show=e=>{const t=this._showRequests+=1;this._latestShowEmailId=li(e);const n=this._queuedShow(e,t).then(r=>r===fi?this._latestShow.catch(()=>{}):void 0);return this._latestShow=n,n};save=this._queue.decorate(this._save,this)};function Bh(e){return String(e).replace(/"/g,""")}function jh(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 Uh(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 pi(e,t,n){const r=new RegExp(`\\b${t}\\s*=\\s*["'][^"']*["']`,"i"),s=Bh(n);return r.test(e)?e.replace(r,`${t}="${s}"`):e.replace(/>$/,` ${t}="${s}">`)}function Hh(e,t,n){if(!e?.trim()||!t)return e;const r=Uh(e);if(!r)return e;const s=String(t),o=jh(n??new Date);let{full:i,index:a}=r;const c=i.length;return/\bem-block-id\s*=/.test(i)||(i=pi(i,"em-block-id",s)),i=pi(i,"em-block-version",o),e.slice(0,a)+i+e.slice(a+c)}function $h(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 Vh(e,t){const n=e.insertFrom??t?.type,r=t?.blockId??(e.id!=null&&e.id!==""?String(e.id):void 0),s=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:s,fragmentRole:e.fragmentRole,id:r,title:e.title??void 0,blockType:e.type,meta:$h(e)}}function nr(e,t){return t?Vh(t,e):{type:e.type,name:e.name,blockId:e.blockId,project:e.project,insertFrom:e.type}}var hi=["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"],Gh=[...hi,"html","id","project","password"],f_=new Set(["html",...hi,"global_block","project"]);function Yh(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(Gh),r={};for(const s of Object.keys(e))n.has(s)||(r[s]=e[s]);return Object.keys(r).length>0&&(t.catalogExtra=r),t}function Wh(e,t={}){return!e||typeof e!="object"?{html:"",insertFrom:t.type,name:t.name,project:t.project,id:t.blockId}:{...Yh(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 rr=new WeakMap;function qh(e){let t=rr.get(e);return t||(t={byId:new Map,fallback:[]},rr.set(e,t)),t}function zh(e){rr.delete(e)}function Kh(e,t){const{byId:n,fallback:r}=qh(t);if(e.blockId){const s=n.get(e.blockId);if(s){n.delete(e.blockId);const o=r.indexOf(s);return o>=0&&r.splice(o,1),s}return}for(let s=r.length-1;s>=0;s--){const o=r[s],i=e.name!=null&&e.name!==""&&o.name!=null&&o.name!==""&&o.name===e.name,a=e.type!=null&&e.type!==""&&o.insertFrom===e.type;if(i&&a)return r.splice(s,1),o.id!=null&&o.id!==""&&n.delete(String(o.id)),o}}async function Xh(e,t){const{blocks:n}=rt(e);return await n.cache.getIfPresent(t)??void 0}async function Jh(e,t){if(!t.blockId)return;const n=await Xh(e,t.blockId);if(n)return Wh(n,t)}async function Qh(e,t){const n=Kh(e,t);if(n)return nr(e,n);const r=await Jh(t,e);return r?nr(e,r):nr(e,void 0)}var Zh=l.createIdentifier("application_block_inserted"),em=-1e3,mi=new WeakSet;function tm(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 nm(e){if(!e||mi.has(e))return;mi.add(e);const t=new l.Disposable,n=Z(e);return t.addDisposable(n.addListenerAsyncPipe(Zh,async(r,s)=>{const o=tm(r)?await Qh(r,e):r;return s?s(o):o},em)),t.addDisposable({dispose:()=>{zh(e)}}),t}var gi=l.createIdentifier$1("plugin.earlyWindow");function rm(e){return e.getOrCreateInstance(gi,()=>({depth:0}))}function sm(e){const t=rm(e);t.depth+=1;let n=!1;return()=>{n||(n=!0,t.depth-=1)}}function Ei(e){return(e?.getInstance(gi)?.depth??0)>0}function vi(e,t){let n,r=!1;return e(s=>{n=s,r=!0}),(s,o,i)=>{const a=e(s,o,i);if(r&&Ei(t)){const c=n;queueMicrotask(()=>{s.call(i,c)})}return a}}var _i=100,om=class extends l.Disposable{_container;_events;constructor(e){super(),this._container=e;const t=nm(e);t&&this.addDisposable(t)}_get(){const e=this._container,{blocks:t,emails:n,comments:r,emailRevisions:s}=rt(e),o=X(e,l.events.ON_SHARE_ID),i=X(e,l.events.ON_SHOW_PREVIEW_ID),a=X(e,l.events.ON_EMAIL_CLONE_ID),c=X(e,l.events.ON_CODE_VALIDATE_ID),d=X(e,l.events.ON_SUBJECT_CHANGED_ID),u=X(e,l.events.ON_EMAIL_CHANGED_ID),f=X(e,l.events.ON_PREHEADER_CHANGED_ID),g=X(e,l.events.ON_SAVEBUTTON_CLICK_ID),E=X(e,l.events.ON_NEXTBUTTON_CLICK_ID),S=X(e,l.events.ON_SEND_LIVEPREVIEW_ID),b=X(e,l.events.ON_SEND_TESTEMAIL_ID),h=X(e,Eh),y=X(e,l.events.ON_CONTENT_CHANGED_ID),w=X(e,gh),A=X(e,l.events.ON_PREVIOUSBUTTON_CLICK_ID),D=X(e,l.events.ON_SEND_EMAIL_MODAL_ID),N=l.filter(X(e,l.events.ON_EMAIL_INIT_ID),m=>!m.reset);return{handlePreheaderChanged:B(f),handleSubjectChanged:B(d),handleValidate:B(c),handleReadEmail:B(n.handlerRead,m=>m,m=>m&&Be(m,e)),handleSaveEmail:B(n.onSave,function({prev:m,patch:_,value:C,source:M}){const p=m?oe(m,e):void 0;return{prev:p,patch:Ze(p,oe(_,e)),value:oe(C,e),source:M}},m=>m?Be(m,e):void 0),handleRemoveEmail:B(n.onRemove,({value:m,source:_})=>({value:oe(m,e),source:_}),()=>{}),handleReadCommonBlocks:B(h,m=>m.project,m=>m?.map(_=>st(_,e))),handleReadTemplateBlocks:B(w,m=>m,m=>m?.map(_=>st(_,e))),handleReadBlocks:B(t.byForeignKey("project").handleRead,m=>tt(e).requested||String(m),m=>m?.map(_=>st(_,e))),handleSaveBlock:B(t.onSave,function({prev:m,patch:_,value:C,source:M}){const p=C.global_block===!0&&C.id&&typeof C.html=="string"?{...C,html:Hh(C.html,String(C.id))}:C,v=m?ot(m,e):void 0;return{prev:v,patch:Ze(v,ot(_,e)),value:ot(p,e),source:M}},m=>m?st(m,e):void 0),handleRemoveBlock:B(t.onRemove,({value:m,source:_})=>({value:ot(m,e),source:_}),()=>{}),handleReadComments:B(r.byForeignKey("post").handleRead,m=>m,m=>m?.map(_=>er(_,e))),handleSaveComment:B(r.onSave,function({prev:m,patch:_,value:C,source:M}){const p=m?it(m,e):void 0;return{prev:p,patch:Ze(p,it(_,e)),value:it(C,e),source:M}},m=>m?er(m,e):void 0),handleRemoveComment:B(r.onRemove,({value:m,source:_})=>({value:it(m,e),source:_}),()=>{}),handleReadEmailRevisions:B(s.byForeignKey("parent").handleRead,m=>m,m=>m?.map(_=>Ft(_,e))),handleReadEmailAutosave:B(X(e,Go),m=>m,m=>m?Ft(m,e):null),handleEmailAutosave:B(s.onSave,function({prev:m,patch:_,value:C,source:M}){return{value:tr(C,e),source:M}},m=>m?Ft(m,e):void 0),handleRemoveEmailAutoSave:B(s.onRemove,({value:m,source:_})=>({value:tr(m,e),source:_}),()=>{}),handleEmailChanged:B(l.debounce(u,_i),m=>oe(m,e)),handleEmailInit:vi(B(N,m=>oe(m,e)),e),handlePreviousButtonClick:B(A,m=>oe(m,e)),handleNextButtonClick:B(E,m=>oe(m,e)),handleSaveButtonClick:B(g,m=>oe(m,e)),handleHtmlChanged:B(l.debounce(y,_i)),handleTestEmailSend:B(b,({html:m,..._})=>({..._,code:m,compiled:{html:m,ampHtml:""}})),handleTestEmailModal:B(D,m=>oe(m,e)),handleCloneEmail:B(a,m=>oe(m,e)),handleShareEmail:B(o),handlePreviewEmail:B(i),handleLivePreviewEmail:B(S)}}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 Fe(t[r]))}for(const r of Object.keys(t))n[r].setListener(e[r])}},im=l.createIdentifier$1("DataController"),am=l.createIdentifier$1("DataEvents");function bi(e){return e.getOrCreateInstance(im,()=>{const t=new Fh(e);return e.getInstance(l.DISPOSABLE_ID)?.addDisposable(t),t})}function yi(e){return e.getOrCreateInstance(am,()=>new om(e))}var lm=l.createIdentifier$1("plugin.pluginStart");function Si(e){return e.getOrCreateInstance(lm,()=>{let t;const n=new Promise(r=>{t=r});return e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>t()),{done:n,finish:t}})}function cm(e){return Si(e).done}function dm(e){const t=Si(e);return t.run===void 0&&(t.run=(e.getInstance(l.PLUGIN_COLLECTION_ID)?.activate()??Promise.resolve()).finally(t.finish)),t.run}var um=l.createIdentifier$1("plugin.startupShow");function fm(e){const t=bi(e),n=yi(e),r=e.getInstance(l.OPTIONS_SOURCE_ID),s=e.getInstance(l.DISPOSABLE_ID),o={current:Promise.resolve()};e.inject(um,o);let i=!1;const a=r?.watch(d=>{d&&n.setOptions(d),i=(d?.plugins?.length??0)>0,o.current=o.current.catch(()=>{})}),c=r?.select(d=>d?.content).watch(d=>{if(d===void 0)return;const u=()=>(W(te.showStart),t.show(d).finally(()=>W(te.showEnd))),f=i?cm(e).then(u):u();f.catch(()=>{}),o.current=f});a&&s?.addDisposable(a),c&&s?.addDisposable(c)}function pm(e){const t=bi(e);return{...yi(e).get(),show(n){return W(te.showStart),t.show(n).finally(()=>W(te.showEnd))},save(){return t.save()}}}function Ii(e){return/#set\s*\(\s*.*=.*\)/.test(e)}function Bt(e){const t=e.indexOf("(");if(t<0)return!0;let n=0,r="",s=!1;for(let o=t;o<e.length;o++){const i=e[o];if(s){s=!1;continue}if(i==="\\"){s=!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 hm(e){return(t,n,r)=>Bt(t)?e(t,n,r):!1}function mm(e){return t=>Bt(t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t)?e(t):!1}function gm(e){return(t,n,r)=>Bt(t)?Ii(t)?e(t,n,r):t:!1}function Em(e){return t=>{const n=t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t;return Bt(n)?Ii(n)?e(t):t:!1}}function vm(e){const t=/[<>&]/g;for(;t.exec(e)!==null;)return!0;return!1}function sr(e,t){const n=e.length;for(let r=0;r<n;r++){const s=e.charCodeAt(r);if(s===0||t==='"'&&s===34||t==="'"&&s===39||t===""&&(s===32||s===9||s===10||s===13||s===12||s===34||s===39||s===60||s===62||s===61||s===96))return!1}return!0}function _m(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",r=new Uint8Array(e);crypto.getRandomValues(r);let s="";for(let o=0;o<e;o++){const i=r[o]%62;s+=t.charAt(i)}return s}var bm=8,ym=class{_byKey=Object.create(null);_byValue=Object.create(null);getOrCreateByKey(e){let t=this._byKey[e];return t===void 0&&(t=_m(bm),this._byKey[e]=t,this._byValue[t]=e),t}getByValue(e){return this._byValue[e]}},jt=new ym;function wi(e,t){return t!==void 0&&!sr(e,t)?`%|{${jt.getOrCreateByKey(e)}}|%`:e}function Sm(e){const t=jt.getByValue(e.slice(3,e.length-3));return t===void 0?e:t}function q(e,t,n){return t!==void 0?sr(e,t)?e:`%|{${jt.getOrCreateByKey(e)}}|%`:`<!--${e}-->`}function Im(e){return e.replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&")}function Y(e){return e.startsWith("<!--")&&e.endsWith("-->")?Im(e.slice(4,-3)):e}function wm(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 s=e.match(/\[%\s*([^%]*?)\s*%\]/);s&&(r=s[1]);const o=r.trim();return t.test(o)||n.test(o)}function Tm(e,t,n){return t!==void 0?sr(e,t)?e:`%|{${jt.getOrCreateByKey(e)}}|%`:n||vm(e)||wm(e)?`<!--${e}-->`:e}var Ae=hm(q),De=mm(Y),Cm=gm(q),Am=Em(Y),Ti=e=>{e.escape("<!--","-->",t=>t,!1),e.escape("<style","</style>",t=>t,!1),e.escape("<script","<\/script>",t=>t,!1),e.unescape("%|{","}|%",Sm),e.escape("@{","}",q,!0).unescape("<!--@{","}-->",Y,!0),e.unescape("<!--%%%{{{","}}}%%%-->",t=>t.substring(10,t.length-9),!1),e.escape("${","}",wi,!0),e.escape("{{","}}",wi,!0),e.createSyntax("brace-percent").escape("{%","%}",q).unescape("<!--{%","%}-->",Y),e.createSyntax("brace-hash").escape("{#","#}",q).unescape("<!--{#","#}-->",Y),e.createSyntax("proscript").escape("[%","%]",Tm,!0).unescape("<!--[%","%]-->",Y,!0),e.createSyntax("getresponse").escape("[[IF","]]",q).escape("[[if","]]",q).escape("[[ELSE]]","",q).escape("[[else]]","",q).escape("[[ENDIF]]","",q).escape("[[endif]]","",q).unescape("<!--[[IF","]]-->",Y).unescape("<!--[[if","]]-->",Y).unescape("<!--[[ELSE]]","-->",Y).unescape("<!--[[else]]","-->",Y).unescape("<!--[[ENDIF]]","-->",Y).unescape("<!--[[endif]]","-->",Y),e.createSyntax("expert-sender").escape("<if",">",q).escape("</if",">",q).escape("<else",">",q).escape("</else",">",q).escape("<var ",">",q,!0).unescape("<!--<if ",">-->",Y).unescape("<!--</if",">-->",Y).unescape("<!--<else ",">-->",Y).unescape("<!--</else",">-->",Y).unescape("<!--<var",">-->",Y,!0),e.createSyntax("velocity").escape("#if",")",Ae).escape("#elseif",")",Ae).escape("#else","",q).escape("#foreach",")",Ae).escape("#macro",")",Ae).escape("#set",")",Cm,!0).escape("#parse",")",Ae).escape("#include",")",Ae).escape("#evaluate",")",Ae).escape("#end","",q).escape("#break","",q).escape("#stop","",q).unescape("<!--#macro","-->",De).unescape("<!--#if","-->",De).unescape("<!--#elseif","-->",De).unescape("<!--#else","-->",Y).unescape("<!--#foreach","-->",De).unescape("<!--#parse","-->",De).unescape("<!--#include","-->",De).unescape("<!--#evaluate","-->",De).unescape("<!--#end","-->",Y).unescape("<!--#break","-->",Y).unescape("<!--#stop","-->",Y).unescape("<!--#set","-->",Am,!0),e.createSyntax("mailchimp").escape("*|","|*",q).unescape("<!--*|","|*-->",Y)},or="bare",Dm=new Map;function Pm(e){return e?Dm.get(e)??or:or}var Ci=["brace-percent","brace-hash","proscript","getresponse","expert-sender","mailchimp","velocity"];function Ai(e){return Ci.includes(e)}function at(e){return e==="bare"||e==="html-comment"}function ir(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Rm(e,t=n=>{}){const n={output:{},editor:{}};if(e==null)return n;let r;if(typeof e=="string"){if(!at(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&&!at(u))return t(`templateDirectives.${d}: unknown form "${String(u)}", configuration ignored.`),n;if(r.syntaxes!==void 0&&!ir(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(!(!Ai(d)||u===void 0||at(u))){if(!ir(u))return t(`templateDirectives.syntaxes.${d}: expected a form or an object, configuration ignored.`),n;for(const f of["output","editor"]){const g=u[f];if(g!==void 0&&!at(g))return t(`templateDirectives.syntaxes.${d}.${f}: unknown form "${String(g)}", configuration ignored.`),n}}}if(r.output===void 0&&r.editor===void 0&&r.syntaxes===void 0)return n;const s=r.output??or;let o=r.editor;s==="bare"&&r.editor==="html-comment"&&(t('templateDirectives: editor="html-comment" requires output="html-comment"; editor was reset to match output.'),o=void 0);const i=[];if(r.syntaxes)for(const d of Object.keys(r.syntaxes)){if(!Ai(d)){t(`templateDirectives.syntaxes: unknown syntax id "${d}", entry ignored.`);continue}i.push(d)}else i.push(...Ci);const a={},c={};for(const d of i){const u=r.syntaxes?.[d],f=ir(u)?u:void 0,g=(at(u)?u:f?.output)??s;let E=f?.editor??o??g;g==="bare"&&E==="html-comment"&&(t(`templateDirectives.syntaxes.${d}: editor="html-comment" requires output="html-comment" for this id; editor was reset to "bare" for it.`),E="bare"),a[d]=g,c[d]=E}return{output:a,editor:c}}function Di(e,t,n,r){for(let s=t;s<n;s++){const o=e[s];r.insideAttributeValue?r.attributeQuoteChar==='"'||r.attributeQuoteChar==="'"?o===r.attributeQuoteChar&&(r.insideAttributeValue=!1,r.attributeQuoteChar=void 0):r.unquotedAttr&&/[\s>]/.test(o)&&(r.insideAttributeValue=!1,r.attributeQuoteChar=void 0,r.unquotedAttr=!1):o==="<"?r.insideTag=!0:o===">"?r.insideTag=!1:r.insideTag&&(o==='"'||o==="'")?(r.insideAttributeValue=!0,r.attributeQuoteChar=o,r.unquotedAttr=!1):r.insideTag&&/\S/.test(o)&&r.attributeQuoteChar===void 0&&e[s-1]==="="&&!['"',"'","`"].includes(o)&&(r.insideAttributeValue=!0,r.attributeQuoteChar="",r.unquotedAttr=!0)}}function lt(e,t){return e.start<t.end&&t.start<e.end}function Pi(e,t,n,r,s=[]){if(n&&(t=t.filter(u=>u.isVariable)),!t.length)return[];const o=t.flatMap(u=>u.match(e).flatMap(f=>!Number.isInteger(f.start)||!Number.isInteger(f.end)||f.start<0||f.end>e.length||f.start>=f.end?[]:[{range:f,mapFn:u.mapFn,overrideBuiltins:u.overrideBuiltins,syntax:u.syntax,isVariable:u.isVariable}])).sort((u,f)=>u.range.start-f.range.start||u.range.end-f.range.end),i=[],a=s.slice().sort((u,f)=>u.start-f.start),c={insideTag:!1,insideAttributeValue:!1,attributeQuoteChar:void 0,unquotedAttr:!1};let d=0;for(const{range:u,mapFn:f,overrideBuiltins:g,syntax:E,isVariable:S}of o){if(r?(c.insideAttributeValue=!0,c.attributeQuoteChar='"'):Di(e,d,u.start,c),d=u.end,a.some(w=>lt(w,u)))continue;const b=c.insideAttributeValue?c.attributeQuoteChar??"":void 0,h=e.substring(u.start,u.end),y=f(h,b,c.insideTag);y!==!1&&y!==h&&(i.push({range:u,text:y,overrideBuiltins:g,syntax:E,isVariable:S}),a.push(u))}return i.sort((u,f)=>u.range.start-f.range.start||u.range.end-f.range.end)}function Om(e,t){const n=t.reduce((a,{mapFn:c,start:d,end:u,syntax:f,isVariable:g})=>(a[d]||(a[d]=[]),a[d].push({value:u,mapFn:c,syntax:f,isVariable:g}),a),Object.create(null)),r=Object.keys(n).map(a=>a.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&")).join("|"),s=new RegExp(r,"g"),o=[];let i;for(;(i=s.exec(e))!==null;){const a=i[0];o.push({start:i.index,startToken:a,endTokens:n[a]})}return o}function ar(e,t,n,r,s=!1){const o=[];if(n&&(t=t.filter(d=>d.isVariable)),!t.length)return o;const i=Om(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:f,endTokens:g}=i[d];r?(a.insideAttributeValue=!0,a.attributeQuoteChar='"'):Di(e,c,u,a),c=u;const E=a.insideAttributeValue?a.attributeQuoteChar??"":void 0;let S=!1;for(const{mapFn:b,value:h,syntax:y,isVariable:w}of g){let A=u+f.length,D=e.indexOf(h,A);for(;D!==-1;){let N=D,m=u+f.length,_=0;for(;N!==-1;){const T=e.indexOf(f,m);if(T!==-1&&T<N)_++,m=T+f.length,N=e.indexOf(h,m);else if(_>0)_--,m=N+h.length,N=e.indexOf(h,m);else break}if(N<0)break;const C=N+h.length,M=e.substring(u,C),p=b(M,E,a.insideTag);if(p===!1){A=D+Math.max(h.length,1),D=e.indexOf(h,A);continue}(s||p!==M)&&o.push({range:{start:u,end:C},text:s?M:p,syntax:y,isVariable:w});const v=i.findIndex(({start:T})=>T>=C);v>d?d=v-1:d=i.length,S=!0;break}if(S)break}}return o}function Ut(e,t){if(!t.length)return e;const n=t.slice().sort((s,o)=>o.range.start-s.range.start);let r=e;for(const{text:s,range:o}of n)r=r.slice(0,o.start)+s+r.slice(o.end);return r}var Mm=class{_disposables=[];_escapes=[];_unescapes=[];_escapeMatchers=[];_unescapeMatchers=[];constructor(e=Ti){const{_escapes:t,_unescapes:n}=this;e({createSyntax(r){return{...this,syntax:r}},escape(r,s,o,i){return t.push({start:r,end:s,mapFn:o,isVariable:i,syntax:this.syntax||r}),this},unescape(r,s,o,i){return n.push({start:r,end:s,mapFn:o,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 s=!1;const o={dispose:()=>{s||(s=!0,this._escapeMatchers=this._escapeMatchers.filter(i=>i!==n),this._unescapeMatchers=this._unescapeMatchers.filter(i=>i!==r))}};return this.addDisposable(o),o}_collectMappings(e,t,n){const r=ar(e,this._escapes,t,n),s=Pi(e,this._escapeMatchers,t,n),o=s.filter(c=>c.overrideBuiltins).map(c=>c.range),i=r.filter(c=>!o.some(d=>lt(d,c.range))),a=s.filter(c=>c.overrideBuiltins||!i.some(d=>lt(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=ar(e,this._unescapes,t),r=Pi(e,this._unescapeMatchers,t,!1),s=r.filter(a=>a.overrideBuiltins).map(a=>a.range),o=n.filter(a=>!s.some(c=>lt(c,a.range))),i=r.filter(a=>a.overrideBuiltins||!o.some(c=>lt(a.range,c.range)));return[...o,...i].sort((a,c)=>a.range.start-c.range.start||a.range.end-c.range.end)}getRevertMappings(e,t,n){const r=n?s=>s!==void 0&&n.has(s):s=>Pm(s)==="html-comment";return this._collectRevertMappings(e,t).filter(s=>s.isVariable||!r(s.syntax))}getDetectedMappings(e,t,n){return ar(e,this._escapes,t,n,!0)}getEscapedText(e,t){return Ut(e,this.getMappings(e,t))}getUnescapedText(e,t,n){return Ut(e,this.getRevertMappings(e,t,n))}normalizeToPolicy(e,t){const n=o=>o===void 0?void 0:t[o],r=Object.values(t);let s=e;return r.includes("bare")&&(s=Ut(s,this._collectRevertMappings(s).filter(o=>n(o.syntax)==="bare"))),r.includes("html-comment")&&(s=Ut(s,this._collectMappings(s).filter(o=>!o.isVariable&&n(o.syntax)==="html-comment"&&o.text.startsWith("<!--")&&o.text.endsWith("-->")))),s}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()}};function Ri(e){return e.replace("<script","<___script").replace("<\/script>","</___script>")}var Oi=new Mm(e=>{e.escape("<script","<\/script>",t=>Ri(t)).unescape("<___script","</___script>",t=>t.replace("<___script","<script").replace("</___script>","<\/script>")),e.escape("<script","/>",t=>Ri(t)).unescape("<___script","/>",t=>t.replace("<___script","<script")),Ti(e)});function Lm(e){const t=Rm(e);if(!(Object.keys(t.output).length>0||Object.keys(t.editor).length>0))return so();const n=new Set(Object.keys(t.output).filter(s=>t.output[s]==="html-comment")),r=new Set(Object.keys(t.output));return{isConfigured:()=>!0,toEditorForm:s=>Oi.normalizeToPolicy(s,t.editor),toOutputForm:s=>Oi.normalizeToPolicy(s,t.output),keepWrappedOnOutput:n,editorPolicy:t.editor,warnAboutUnconfiguredInput:ro(r)}}function Nm(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:Lm(n)}),t.policy})}function p_(e){return e}var xm=[{name:"rest.client",setup:uh},{name:"auth.oauth",setup:l.provideOAuth},{name:"rest.identityHeaders",setup:ih},{name:"lifetime.destroyable",provides:[Vn],setup:ap},{name:"appInit",provides:[l.APP_ID,en],setup:sl},{name:"config",provides:[l.CONFIG_SOURCE_ID],setup:op},{name:"templateDirectives",provides:[l.TEMPLATE_DIRECTIVES_ID],setup:Nm},{name:"email.documents",setup:Cp},{name:"show.initPipeline",provides:[l.INIT_PIPELINE_ID],setup:fh},{name:"show",setup:fm},{name:"locale.service",provides:[nt],setup:nh},{name:"locale.fromConfig",awaits:{services:[l.CONFIG_SOURCE_ID,nt]},setup:rh},{name:"canvas.early",setup:Zu},{name:"canvas.previewSettings",setup:df},{name:"canvas.sandboxExtensions",setup:ff},{name:"canvas.sandboxScriptRelay",setup:mf},{name:"canvas.headerSync",provides:[_o],setup:nf},{name:"canvas.ampSync",setup:dd},{name:"canvas.moduleBridge",setup:Ud},{name:"canvas.port",setup:bd},{name:"canvas.images",setup:vd},{name:"canvas.edits",setup:Eu},{name:"canvas.blockContent",setup:uu},{name:"canvas.sandboxFill",provides:[Rn],setup:kf},{name:"canvas.reactions",setup:Qu}],km=class extends Error{cycle;constructor(e){super(`[units] цикл в зависимостях: ${e.join(" → ")}`),this.cycle=e}};function Fm(e){const t=new Map;for(const n of e)for(const r of n.provides??[]){const s=t.get(r)??[];s.push(n),t.set(r,s)}return t}function Bm(e,t){const n=[];for(const r of e.awaits?.services??[])for(const s of t.get(r)??[])s!==e&&n.push(s);return n}function Mi(e){const t=Fm(e),n=[],r=new Set,s=[],o=new Set,i=a=>{if(!r.has(a)){if(o.has(a)){const c=s.indexOf(a);throw new km([...s.slice(c),a].map(d=>d.name))}o.add(a),s.push(a);for(const c of Bm(a,t))i(c);s.pop(),o.delete(a),r.add(a),n.push(a)}};for(const a of e)i(a);return n}var Li;function lr(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=ce();e.inject(l.OPTIONS_SOURCE_ID,n),Li??=Mi(xm);for(const r of Li)r.setup(e);return n}function jm(e){}var Um=[{name:"save.previewFollow",setup:jm}],Ni=l.createIdentifier$1("plugin.lateUnitsInstalled");function Hm(e){if(!e.getInstance(Ni)){e.inject(Ni,!0);for(const t of Mi(Um))t.setup(e)}}function $m(e,t){return{project:Number(e),app_id:t?.app_id||0,app_config:t?.app_config||{},user:t?.user}}function Vm(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 Gm=l.defineMixin(e=>{let t,n,r;return{async setOptions(s){const o=r!==s.getAuthToken,i=!l.deepEqual(t,s.user),a=n!==s.project;if(r=s.getAuthToken,t=s.user,n=s.project,!(!e.getInstance(l.SECURITY_MODULE_ID)||!s.getAuthToken)&&!(!o&&!i&&!a))try{const c=await s.getAuthToken(s.user,s.project);e.inject(l.STANDALONE_BOOTSTRAP_TOKEN_ID,Promise.resolve(c||""));const d=Vm(c);if(!d)return;e.inject(l.STANDALONE_PROJECT_ID,d);const u=e.getInstance(l.APP_ID),f=u?await u.catch(()=>{}):void 0;e.inject(l.APP_ID,Promise.resolve($m(d,f)))}catch{}}}});function Ym(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 Wm=l.defineMixin(e=>{let t,n=!1;return{setOptions(r){const s=n;if(n=!0,!Qe(r)){t&&(Wf(e),$n(r)),t=void 0;return}const o=Rt(r);if(!o||t===o&&e.getInstance(l.SECURITY_MODULE_ID))return;t=o,e.inject(l.SECURITY_MODULE_ID,o);const i=e.getInstance(l.DISPOSABLE_ID);i&&Ym(e,i)}}}),qm=l.defineMixin(e=>{const t=e.getInstance(l.DISPOSABLE_ID),n=l.getEvent(e,l.APP_LOAD_EVENT_ID),r=B(n),s=t.addDisposable(new Fe(r));return{setOptions({handleLoad:o}){s.setListener(o)},instance:{handleLoad:r},dispose:()=>t.dispose()}});function xi(e,t,n=!0){const r=e,s=t;for(const o of Object.keys(s)){const i=s[o];i!=null&&(n&&typeof i=="object"?r[o]=xi(r[o]||{},i,!0):r[o]=i)}return e}async function zm(e){const t=(await Pa.__vitePreload(()=>Promise.resolve().then(()=>Kt.__toESM(Et("./static/umd/6639d610.js").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 ki=l.createIdentifier$1("EditorOptions"),cr=l.MONACO_EDITOR_OPTIONS;function Km(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 Xm(e){return e.getOrCreateInstance(ki,()=>{const t=ce(cr);let n=cr.fontFamily;return t.watch(r=>{!r.fontFamily||r.fontFamily===n||(n=r.fontFamily,Promise.resolve(zm(r.fontFamily.split(",")[0])).catch(()=>{}))}),t})}function Jm(e){return e?.getInstance(ki)?.get()??cr}function Qm(e,t={}){const n=Xm(e);n.set(xi({...n.get()},Km(t)))}function Zm(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 eg(e){return{fontSize:e.fontSize,fontFamily:e.fontFamily,tabSize:e.tabSize,wordWrap:e.wordWrap!=="off",minimap:e.minimap?.enabled,insertSpaces:e.insertSpaces}}var tg=l.createIdentifier$1("plugin.publicConfig");function dr(e){return e.getInstance(l.CONFIG_SOURCE_ID)?.get()??{}}function Fi(e){return e.getInstance(l.CONFIG_SOURCE_ID)?.layers()??{base:{},profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}}}function Bi(e){const t=No(e),n=dr(e);return{...n,locale:n.locale||"en_US",theme:n.theme||"light",editor:eg(Jm(e)),codeModeDirection:t.isCodeMode?t.direction:"none"}}function ji(e){return e.getInstance(l.CONFIG_SOURCE_ID)?.get()!==void 0}function ng(e){const t=l.createQueue(),n=se(e,l.CONFIG_CHANGED_EVENT_ID);let r,s,o=!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:f=!1}={})=>{await e.getInstance(l.CONFIG_SOURCE_ID)?.ready(),Wr(e).set(dr(e).revisionService===!0);const{codeModeDirection:g,editor:E}=dr(e);E&&Qm(e,Zm(E)),g!==void 0&&!(f&&g===s)&&(s=g,g==="none"?Hn(e,!1):(Hn(e,!0),Gf(e,g)))},c=async()=>{if(!ji(e))return;const f=Bi(e),g=JSON.stringify(f);g!==r&&(r=g,await n.fire(f))},d=async f=>{const g=e.getInstance(l.CONFIG_SOURCE_ID),E={advancedConfigs:Fi(e).advancedConfigs,serverSide:await i(),user:f};g?.setAdvancedConfigs({...E.advancedConfigs,...E.user?.advancedConfigs}),g?.replace(E.user,"user"),g?.replace(E.serverSide,"server"),await a(),await c()},u=f=>{const{commonStyles:g,...E}=f;return"commonStyles"in f&&cf(e,g===void 0?void 0:g),E};return{queue:t,reactToConfig:a,emitConfigChanged:c,resolveServerSideConfig:i,getConfig:()=>ji(e)?Bi(e):{},setConfig:t.decorate(async f=>{await d(u(f))}),updateConfig:t.decorate(async f=>{const g=u(f);await d({...Fi(e).user,...g})}),announceAssembled(){o||(o=!0,e.getInstance(l.CONFIG_SOURCE_ID)?.ready().then(t.decorate(async()=>{await a({onlyChangedCodeMode:!0}),await c()})))}}}function Ui(e){return e.getOrCreateInstance(tg,()=>ng(e))}function rg(e){const t=Ui(e);return{getConfig:()=>t.getConfig(),setConfig:n=>t.setConfig(n),updateConfig:n=>t.updateConfig(n)}}var sg=l.defineMixin(e=>{const t=e.getInstance(l.DISPOSABLE_ID),n=t.addDisposable(new l.AsyncEmitter),r=t.addDisposable(new l.AsyncEmitter),s=l.getEmitter(e,l.CONFIG_CHANGED_EVENT_ID),o=B(n.event),i=B(r.event),a=vi(B(s.event),e),c=t.addDisposable(new Fe(o)),d=t.addDisposable(new Fe(i)),u=t.addDisposable(new Fe(a));return{instance:{handleSetOptions:o,handleOptionsChanged:i,handleConfigChanged:a},async setOptions(f){c.setListener(f.handleSetOptions),d.setListener(f.handleOptionsChanged),u.setListener(f.handleConfigChanged),Ui(e).announceAssembled(),await n.fire(f),await r.fire(f)},dispose(){}}}),ur,Hi="core";function og(){const e=__useblocks__?.require;return typeof e!="function"?Promise.reject(new Error("[loadCore] AMD loader is unavailable")):new Promise((t,n)=>{e([Hi],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadCore] Failed to require core module")))})}function ig(e){const t=__useblocks__?.require?.warm;return typeof t!="function"?ct().then(()=>{}):t([Hi],e)}function ct(){return ur===void 0&&(ur=og().then(e=>(He()&&e.installDiagnostics().catch(t=>{}),e))),ur}var fr=null,pr=null;async function ag(e){typeof e?.prefetch=="function"&&await e.prefetch()}function hr(){return fr||(fr=ct().then(()=>{})),fr}function $i(e){return pr||(pr=ag(e)),pr}function lg(){return $i(typeof __useblocks__<"u"?__useblocks__:void 0)}function cg(){const e=typeof __useblocks__<"u"?__useblocks__:void 0,t=e?.__compatMissingReason;return e&&(e.__compatMissingReason=void 0),typeof t=="string"?t:void 0}function dg(e){return Promise.all([hr(),$i(e)]).then(()=>{})}function ug(e){const t=e?.preload?.start??e?.startupPrefetchMode;return t==="eager"||t==="idle"||t==="manual"||t==="off"?t:"idle"}function Vi(e,t){const n=e?.preload?.execute!==!1;Promise.resolve().then(()=>ig(t?{priority:t}:void 0)).then(()=>(An(t?{priority:t}:void 0),n?hr():void 0)).catch(()=>{})}function fg(e){const t=ug(e);if(t==="eager")Vi(e);else if(t==="idle"){const n=()=>Vi(e,"low");document.readyState==="complete"?n():window.addEventListener("load",n,{once:!0})}}var Gi="PluginRegistry";function pg(e=l.resolveContainer()){return e.getOrCreateInstance(Gi,()=>new Fa)}var Yi=new Ba(()=>pg()),hg=["handleAIImageRequest","handleAITextRequest","handleCloneEmail","handleConfigChanged","handleDestroy","handleEmailAutosave","handleEmailChanged","handleEmailInit","handleError","handleFileProxy","handleHtmlChanged","handleLimitUsage","handleLivePreviewEmail","handleLoad","handleLoadImage","handleNextButtonClick","handleNotify","handleOptionsChanged","handlePreheaderChanged","handlePreviewEmail","handlePreviousButtonClick","handleReadBlocks","handleReadComments","handleReadCommonBlocks","handleReadEmail","handleReadEmailAutosave","handleReadEmailRevisions","handleReadLocale","handleReadTemplateBlocks","handleRemoveBlock","handleRemoveComment","handleRemoveEmail","handleRemoveEmailAutoSave","handleSaveBlock","handleSaveButtonClick","handleSaveComment","handleSaveEmail","handleSetOptions","handleShareEmail","handleSubjectChanged","handleSuccess","handleTestEmailModal","handleTestEmailSend","handleTranslate","handleUrlProxy","handleValidate"],mg=["compileEmail","getBlocks","getComments","getEmail","getEmailRevisions","getEmailSnapshot","save","setConfig","show","updateConfig","useAsync","validateCode","waitPlugin"],Ht=new Map([...hg.map(e=>[e,"event"]),...mg.map(e=>[e,"async"]),["setEmailMeta","queued"],["setBlockMeta","queued"],["notify","queued"],["getConfig","sync"],["use","sync"],["getElement","element"],["getCodeErrors","codeErrors"],["container","field"],["undoRedoService","field"]]),gg=new Map([["use","use `useAsync()` or await `ready` first"]]);function Eg(e){return gg.get(e)??"await `ready` first"}var vg=new Set(["async","queued"]),_g=Symbol.for("emailmaker.earlyCtxPlaceholder");function Wi(e){return e[_g]=!0,e}function bg(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 (${Eg(e)}).`)}function yg(e){return new Error(`[emailmaker] ${e}() is missing from the editor instance after the core has loaded.`)}function Sg(e){return[...Ht].filter(([t,n])=>n!=="field"&&e[t]===void 0).map(([t])=>t).sort((t,n)=>t.localeCompare(n))}function Ig(e,t){for(const n of Sg(e)){const r=Ht.get(n);if(r!==void 0&&vg.has(r)){const s=async(...o)=>{await t;const i=e[n];if(typeof i!="function"||i===s)throw yg(n);return i.apply(e,o)};e[n]=Wi(s);continue}e[n]=Wi(()=>{throw bg(n)})}}function wg(e,t,n){e.getInstanceAsync(je).then(()=>{l.getEmitter(e,l.events.ON_NOTIFICATION).fire({type:"error",id:"PLUGIN_CREATE_ERROR",data:{plugin:t},innerException:n})},()=>{})}function Tg(e,t){e.getInstanceAsync(je).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 Cg=l.defineMixin(e=>{let t;function n(){return new Promise(s=>{const o=e.getOrCreateInstance(l.LATE_SURFACE_LISTENERS_ID,()=>new Set),i=()=>{o.delete(i),s()};o.add(i)})}function r(){if(!t)throw new Error("PluginCollection not initialized. Call init() first.");return t}return{async setOptions(s){const o=e.getInstance(l.INSTANCE_ID),i=e.getInstance(Gi);if(!t){t=new ka(o,i,{ensureHostRuntimeReady:lg,explainScriptFailure:cg,openEarlyWindow:()=>sm(e),reportLoadFailure:d=>Tg(e,d)}),e.inject(l.PLUGIN_COLLECTION_ID,t);const c=t.onLifecycle(d=>{d.type==="create:error"&&wg(e,d.name,d.error)});e.getInstance(l.DISPOSABLE_ID)?.addDisposable(c)}const a=s?.plugins||[];o&&(Ns(e),a.length>0&&Ig(o,n()),await t.setPlugins(a))},instance:{use(s){return typeof s=="function"?r().useByCtor(s):r().useByKey(s)},useAsync(s){return r().useAsync(s)},waitPlugin(s){return r().waitFor(s)}},dispose(){t?.dispose(),t=void 0}}}),qi=class{_listeners=[];add(e,t=0,n){const r={fn:n?e.bind(n):e,priority:t};return this._listeners.push(r),{dispose:()=>{const s=this._listeners.indexOf(r);s>=0&&this._listeners.splice(s,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}},Ag=l.createIdentifier$1("ELEMENT_INSERT_HTML_PIPELINE"),Dg=l.createIdentifier$1("BLOCK_INSERT_HTML_PIPELINE"),Pg="application_block_inserted",Rg=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(Dg,()=>new qi).add(e,t??0,n)}handleInject(e,t,n){const r=this._container.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService),s=n?e.bind(n):e;return r.addListener(Pg,s,t)}},mr=l.createIdentifier$1("ComponentRegistry"),Og=l.createIdentifier$1("ComponentRegistryGate");function gr(){return l.DependencyResolver.getOrCreateInstance(Og,()=>({pending:[]}))}function Mg(e=mr){return gr().factory!==void 0||l.DependencyResolver.getInstance(e)!==void 0}function Er(e,t,n=mr){if(Mg(n)){t($t(e,n));return}gr().pending.push(()=>t($t(e,n)))}function $t(e,t=mr){const n=l.DependencyResolver.getInstance(t);if(n)return n;const r=gr().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 Lg=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=o=>{if(!n){n=!0;for(const i of t)i.dispose();e(o)}};t.push(this._container.addService(l.ATOMS_HANDLERS_ID,{execute:o=>{r(o.value.map(i=>({name:i.name,html:i.html})))}}));const s=this._container.getInstance(l.HEADLESS_MODE_ID)?.watch(o=>{o&&r([])});s&&(n?s.dispose():t.push(s))})}update(e,t){const n=this._container;return n.addService(l.ATOMS_HANDLERS_ID,{execute:r=>{const s=$t(n),o=r.value.find(i=>i.name===e);if(o){const{icon:i,title:a,fallbackTooltip:c,...d}=t;i&&(o.icon=s.getReactNode(i)),a&&(o.title=s.getReactNode(a)),c&&(o.fallbackTooltip=s.getReactNode(c)),Object.assign(o,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 s=$t(n);r.value.splice(t??r.value.length,0,{...e,title:s.getReactNode(e.title),icon:s.getReactNode(e.icon),fallbackTooltip:s.getReactNode(e.fallbackTooltip)})}})}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(Ag,()=>new qi).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)}},Ng=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 xg(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>n!==void 0))}function zi(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 kg=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 Er(this._container,r=>{this._showModalEmitter.fire({...e,content:r.getReactNode(e.content),title:r.getReactNode(e.title),id:t,modalProps:zi(r,n)})}),t}close(e){this._closeModalEmitter.fire(e)}closeAll(){this._closeModalEmitter.fire()}update(e,t){const n=t.modalProps;Er(this._container,r=>{this._updateModalEmitter.fire(xg({...t,content:r.getReactNode(t.content),title:r.getReactNode(t.title),id:e,modalProps:zi(r,n)}))})}},Fg=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=s=>{this._loadedSettled||(this._loadedSettled=!0,r(s))}}),this.ready=new Promise((n,r)=>{this._resolveReady=()=>{this._readySettled||(this._readySettled=!0,n())},this._rejectReady=s=>{this._readySettled||(this._readySettled=!0,r(s))}})}_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)}},Bg=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,s=>{if(s.key===e){if(s.phase==="load"&&s.status==="success"){r.resolveLoaded();return}if(s.phase==="ready"&&s.status==="success"){r.resolveReady();return}if(s.phase==="load"){r.rejectLoad(new Error(s.error||`Sandbox script "${e}" failed to load.`));return}r.rejectReady(new Error(s.error||`Sandbox script "${e}" failed to initialize.`))}}),r=new Fg(t,n);return r}registerSandboxCSS(e){return this._container.addService(l.SANDBOX_EXTENSIONS_ID,{type:"link",key:e,parent:"head",attributes:{rel:"stylesheet",type:"text/css",href:e}})}registerSandboxCSSCode(e,t){return this._container.addService(l.SANDBOX_EXTENSIONS_ID,{type:"style",key:e,parent:"head",attributes:{type:"text/css"},innerHTML:t})}registerSandboxScript(e){const t=this._container.addService(l.SANDBOX_EXTENSIONS_ID,{type:"script",key:e,parent:"head",attributes:{src:e,type:"text/javascript"}});return this._createScriptHandle(e,t)}registerSandboxScriptCode(e,t){const n=this._container.addService(l.SANDBOX_EXTENSIONS_ID,{type:"script",key:e,parent:"head",attributes:{type:"text/javascript"},innerHTML:t});return this._createScriptHandle(e,n)}},jg=new Set([Symbol.for("react.element"),Symbol.for("react.transitional.element")]);function vr(e){if(typeof e!="object"||e===null)return!1;const t=e.$$typeof;return typeof t=="symbol"&&jg.has(t)}function Ki(){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 _r(){return`__settingsPanel:${Ki()}`}function br(e,t){return{type:e,props:t}}function Ug(e){return typeof e=="object"&&e!==null&&"type"in e&&"props"in e&&!vr(e)}function Xi(e,t,n){if(t==null||typeof t=="number"||typeof t=="boolean"||typeof t=="string")return t;if(vr(t)){const r=_r();return n(e.add(r,t)),br(r,{})}if(typeof t=="function"){const r=_r();return n(e.add(r,t)),br(r,{})}if(Ug(t)){const r=t.type;if(typeof r=="string")return t;if(vr(r)||typeof r=="function"){const s=_r();return n(e.add(s,r)),br(s,t.props)}return t}return t}var Hg=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??Ki();Er(this._container,n=>{const r=i=>this._trackRegistration(i),s=Xi(n,e.content,r),o=e.advancedTabs?.map(i=>({...i,content:Xi(n,i.content,r)}));l.getEmitter$1(this._container,l.SETTINGS_PANEL_EVENT).fire({...e,content:s,advancedTabs:o,instanceKey:t,type:l.ADVANCED_SETTINGS_PANEL})})}closeSettingsPanel(){this._clearPanelRegistrations(),l.getEmitter$1(this._container,l.SETTINGS_PANEL_EVENT).fire(null)}},Ji={SandboxScriptApi:Bg,ElementsApi:Lg,BlocksApi:Rg,MessageService:Ng,SettingsPanelApi:Hg,ModalApi:kg};function yr(e,t,n,r={}){const s=Object.assign({},e);for(const[o,i]of Object.entries(t))if(i!==void 0)if(n.includes(o)&&typeof i=="object"&&i!==null){const a=s[o],c=r[o]??{};s[o]=Object.assign({},typeof a=="object"&&a!==null?a:c,i)}else s[o]=i;return s}var ie={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}},$g={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"},Sr={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},Qi={color:"#1C52DC",contrastColor:"#FFFFFF",underline:!0},Ue={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:ie.border,borderRadius:ie.borderRadius,textAlign:"center",padding:ie.padding},Zi={backgroundColor:"#FFFFFF",contrastBackgroundColor:"#1C52DC",padding:ie.padding},Ir={contrastBackgroundColor:"#1C52DC",contrastTextColor:"#FFFFFF",baseBackgroundColor:"#F8F8F8",baseTextColor:"#333333",border:ie.border,borderRadius:ie.borderRadiusCards};function Vg(e){return{...$g,...e}}function Gg(e){return{...Sr,...e,bold:e?.bold??Sr.bold,italic:e?.italic??Sr.italic}}function Yg(e){return{...Qi,...e,underline:e?.underline??Qi.underline}}function Wg(e){return{...Ue,...e,bold:e?.bold??Ue.bold,italic:e?.italic??Ue.italic,border:{...Ue.border,...e?.border},borderRadius:{...Ue.borderRadius,...e?.borderRadius},padding:{...Ue.padding,...e?.padding}}}function qg(e){return{...Zi,...e,padding:{...Zi.padding,...e?.padding}}}function zg(e){return{...Ir,...e,border:{...Ir.border,...e?.border},borderRadius:{...Ir.borderRadius,...e?.borderRadius}}}function wr(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 ea(e){let t={...l.COMMON_STYLES};try{e&&e!=="{}"&&(t=JSON.parse(e))}catch{}return t}function Tr(e){return{text:Vg(e.text),headings:Gg(e.headings),links:Yg(e.links),buttons:Wg(e.buttons),block:qg(e.block),cards:zg(e.cards)}}var ta=l.createIdentifier$1("EmailSettingsPort"),Kg=1e4,na=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(!Ei(this._editor.container)||!Me(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(ta);if(!t)throw new Error("[extensions] email settings are not loaded yet — UI work starts at init()");return t}_getCurrentLayoutSettings(){return wr(this._settings().read())}_getCurrentContentStyles(){const e=Me(this._editor.container)?.current()?.get().attributes.common_styles;return Tr(ea(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(ta),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 s=r?.data,o=s?.operation;if(o===l.EVENT_TYPES.APPLICATION_EMAIL_SETTINGS_SET){const c=wr(s?.settings),d=this._getLayoutSnapshot(c);d!==this._prevLayoutSnapshot&&(this._prevLayoutSnapshot=d,this._layoutSettingsChanged.fire(c));return}if(o!==l.EVENT_TYPES.APPLICATION_COMMON_STYLES_UPDATE)return;const i=Tr(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=wr(n);this._prevLayoutSnapshot=this._getLayoutSnapshot(r),this._layoutSettingsChanged.fire(r)}async _waitForEmailSettingsFromIframe(e=Kg){const t=Me(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,s=l.getEvent(r,l.events.ON_EMAIL_INIT_ID);return new Promise(o=>{let i=!1,a;const c=()=>{a&&(clearTimeout(a),a=void 0)},d=s(()=>{i||(i=!0,c(),d.dispose(),o())});a=setTimeout(()=>{i||(i=!0,d.dispose(),o())},e)})}async getEmailContentStyles(){return this._getCurrentContentStyles()}async setEmailContentStyles(e){const t=Me(this._editor.container)?.current();if(!t)return;const n=ea(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=yr(n.buttons||{},e.buttons,["border","borderRadius","padding"],{border:ie.border,borderRadius:ie.borderRadius,padding:ie.padding})),e.block!==void 0&&(n.block=yr(n.block||{},e.block,["padding"],{padding:ie.padding})),e.cards!==void 0&&(n.cards=yr(n.cards||{},e.cards,["border","borderRadius"],{border:ie.border,borderRadius:ie.borderRadiusCards}));const r=JSON.stringify(n);Ke(t,{common_styles:r},{source:"system"}),this._settings().markAppearanceChanged();const s=Tr(n);this._prevContentSnapshot=this._getContentSnapshot(s),this._contentStylesChanged.fire(s)}},Xg={...Ji,EmailSettingsApi:na},Jg={...Ji},h_={...Jg,EmailSettingsApi:na},Qg={...Xg};function Zg(){Yi.addAll(Qg)}var eE=[l.defineMixin(()=>{Zg()}),qm,sg,Wm,l.JWTMixin,Gm,l.OAuthMixin];async function tE(){return(await ct()).asyncMixins}var nE=Cg,rE=e=>{let t=null,n=!1;return{instance:{},async setOptions(r){if(!t&&!n){let s;try{s=await tE()}catch(i){throw e.failPendingWaits(i),i}t=s(e);const o=await e.getInstanceAsync(l.INSTANCE_ID);Object.assign(o,t.instance||{});for(const i of e.getInstance(l.LATE_SURFACE_LISTENERS_ID)??[])i()}t&&await t.setOptions(r)},dispose(){t?.dispose(),n=!0}}},sE=l.combineMixins([...eE]);function Cr(){let e,t=!1;const n=new Map,r=new Map;function s(){for(const o of r.values())o();r.clear()}return{event(o,i,a){const c=Symbol("subscription");return t||(n.set(c,{listener:o,priority:i,thisArg:a}),e&&r.set(c,e(o,i,a))),()=>{n.delete(c),r.get(c)?.(),r.delete(c)}},attach(o){s(),e=o;for(const[i,{listener:a,priority:c,thisArg:d}]of n)r.set(i,o(a,c,d))},dispose(){t=!0,s(),n.clear(),e=void 0}}}function oE(e){const t=Cr(),n=Cr(),r=Cr();return e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{t.dispose(),n.dispose(),r.dispose()}),e.getInstanceAsync(je).then(s=>{t.attach(s.onNotify),n.attach(s.onError),r.attach(s.onSuccess)},()=>{}),{handleNotify:t.event,handleError:n.event,handleSuccess:r.event,notify(s){const o=e.getInstance(je);if(o){o.notify(s);return}e.getInstanceAsync(je).then(i=>i.notify(s),()=>{})}}}var ra=l.createIdentifier$1("CodeErrors"),iE=[];function aE(e){return e?.getInstance(ra)?.get()??iE}function lE(e){return e?.getInstance(ra)!==void 0}var cE=class extends l.Disposable{_container;_dataSources;_currentEmail;_blockMetaWrites=Promise.resolve();constructor(e){super(),this._container=e,this._dataSources=rt(e),this.addDisposable(l.getEvent(e,l.events.ON_EMAIL_CHANGED_ID)(t=>{this._currentEmail=t}))}openEmail(){return ai(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=>ot(t,this._container))}async _readProjectBlocks(){const e=await Sh(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=>it(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=>tr(n,this._container))}async getEmailSnapshot(){return oe(this.openEmail(),this._container)}setEmailMeta(e){const t=Qn(this._container);if(!t)return;const n=t.get().attributes.meta;Ke(t,{meta:Yn({meta:n},e).meta});const r=t.get().serverId;r!=null&&this._dataSources.emails.cache.addOrUpdate(r,s=>s&&Yn(s,e))}setBlockMeta(e,t){const n=async()=>{await this._readProjectBlocks();const{cache:r}=this._dataSources.blocks;await r.getIfPresent(e)&&await r.addOrUpdate(e,s=>s&&Yn(s,t))};this._blockMetaWrites=this._blockMetaWrites.then(n).catch(()=>{})}getCodeErrors(){return lE(this._container)?aE(this._container):void 0}},dE=l.createIdentifier$1("EmailDataController");function uE(e){return e.getOrCreateInstance(dE,()=>{const t=new cE(e);return e.getInstance(l.DISPOSABLE_ID)?.addDisposable(t),t})}function fE(e){const t=uE(e);return{getEmailSnapshot:()=>t.getEmailSnapshot(),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 pE(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 hE(e){let t;const n=Uo(e),r=l.getEvent(e,l.events.ON_DOCUMENT_SESSION_CHANGE);n.addDisposable(r(({history:o})=>{t=o}));const s=()=>t?pE(t):void 0;return{undoRedoService:{undo:()=>s()?.undo(),redo:()=>s()?.redo(),clear:()=>s()?.clear(),getPast:o=>s()?.getPast(o)??[],getFuture:o=>s()?.getFuture(o)??[],canUndo:()=>s()?.canUndo()??!1,canRedo:()=>s()?.canRedo()??!1,createSnapshot:()=>s()?.createSnapshot(),restoreSnapshot:o=>s()?.restoreSnapshot(o)}}}var mE=l.createIdentifier$1("plugin.mountElement");function gE(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 EE(e){return e.getOrCreateInstance(mE,()=>{let t=!1,n;return{get:()=>t?n:gE(e),set(r){t=!0,n=r}}})}function vE(e){const t=EE(e);return{getElement:()=>t.get()}}function _E(e){return{handleLoadImage:B(l.getEvent(e,l.events.UPLOAD_EVENT_ID)),handleFileProxy:B(l.getEvent(e,l.events.FILE_PROXY_EVENT_ID)),handleUrlProxy:B(l.getEvent(e,l.events.PROXY_URL_EVENT_ID)),handleAITextRequest:B(l.getEvent(e,l.events.AI_TEXT_REQUEST_ID)),handleAIImageRequest:B(l.getEvent(e,l.events.AI_IMAGE_REQUEST_ID)),handleReadLocale:B(l.getEvent(e,l.events.READ_LOCALE)),handleLimitUsage:B(l.getEvent(e,l.events.ON_LIMIT_ID)),handleTranslate:B(l.getEvent(e,l.events.ON_TRANSLATE_ID))}}var bE=[lp,pm,oE,rg,fE,hE,vE,_E];function yE(e,t=bE){const n=lr(e);Hm(e);const r=sE(e),s=nE(e),o=rE(e),i={...r.instance,...s.instance,...o.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 s.setOptions(c),await o.setOptions(c)}}}function SE(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 IE=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]}},wE="editor-runtime.react.copies",Ar=8;function dt(e){return e&&typeof e=="object"?e:void 0}function sa(e){const t=dt(e);if(!t)return;if(typeof t.useState=="function")return t.useState;const n=dt(t.default);return n&&typeof n.useState=="function"?n.useState:void 0}function TE(e){const t=dt(e),n=t&&typeof t.version=="string"?t.version:void 0,r=dt(t?.default),s=r&&typeof r.version=="string"?r.version:void 0;return n??s??"unknown"}function CE(e,t,n){return e.package===t&&e.version===n}function AE({ourReact:e,entries:t,packageName:n,version:r}){const s=sa(e);if(!s||!Array.isArray(t))return[];const o=[],i=new Set;for(const a of t){const c=dt(a);if(!c||!CE(c,n,r))continue;const d=sa(c.react);!d||d===s||i.has(d)||(i.add(d),o.push({package:n,version:r,reactVersion:TE(c.react),react:c.react}))}return o}function DE({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,Ar))n.push(` • React ${r.reactVersion}, loaded through ${r.package}@${r.version}/runtime/react`);return t.length>Ar&&n.push(` …and ${t.length-Ar} 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
|
|
2152
|
+
`)}function di(e){return e.replace(/<title[^>]*>[\s\S]*?<\/title>/gi,"")}function Ah(e,t,n,r){const s=Dh(e,t,n,r);return s===void 0}function Dh(e,t,n,r){const{email:s}=Nt(t,!1),o=Be(s,e),i=o.id;if(i===void 0)return"no-id";if(r!==void 0&&r!==i)return"other-id-shown";const a=yn(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=di(Zn(n??a.getContent()));if(o.html!==void 0&&di(Zn(o.html))!==u)return"html";if(o.subject!==void 0&&o.subject!==d.subject)return"subject";if(o.preheader!==void 0&&o.preheader!==d.preheader)return"preheader";if(o.common_styles!==void 0&&o.common_styles!==d.common_styles)return"common_styles"}function ui(e,t){const{email:n}=Nt(t,!1),r=Be(n,e);if(r.id!==void 0)return JSON.stringify([r.id,r.html===void 0?null:Zn(r.html),r.subject??null,r.preheader??null,r.common_styles??null])}function Ph(e,t){const n={...e};return delete n.id,{...n,...t}}function Rh(e){return e.html?e:{...e,html:oi}}function st({code:e,project:t,...n},r,s){const o=s??Wn(r);return{...n,...e?{html:Ie(r).toEditorForm(e)}:{},renderGuid:l.generateUUID(),...o===void 0?{}:{project:o}}}function ot({html:e,renderGuid:t,...n},r){const{requested:s}=tt(r);return Ee({...n,code:Ie(r).toOutputForm(e),project:s===void 0?n.project:s,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 fi(e){return yn(e)?.current()?.get().serverId??void 0}function er(e,t,n){return n===void 0&&(n=e.post===void 0?fi(t):e.post),{...e,content:e.content?`<p>${e.content}</p>`:"",post:n}}function it(e,t){return Ee({...e,link:void 0,comment_status:void 0})}function Ft({code:e,autosave:t,...n},r,s){return s===void 0&&(s=n.parent===void 0?fi(r):n.parent),{...n,...e?{html:e}:{},isAutosave:t===!0||tc(n.slug),parent:s}}function tr({html:e,isAutosave:t,...n},r){return Ee({...n,autosave:t?!0:void 0,code:e,guid:void 0,compiled:Ee({html:e,ampHtml:e&&""})})}var je=l.createIdentifier$1("NotificationService"),Oh=l.createIdentifier$1("emailTemplate.reads");async function Mh(e,t){try{return await Se(e).email(e).readEmail(t)??void 0}catch(n){n instanceof Error&&n.message,Nh(e,t,n);return}}var Lh=l.createIdentifier$1("emailTemplate.notifiedFailures");function Nh(e,t,n){if(n instanceof DOMException&&n.name==="AbortError")return;const r=e.getOrCreateInstance(Lh,()=>new Set);r.has(t)||(r.add(t),e.getInstanceAsync(je).then(()=>{l.getEmitter(e,l.events.ON_NOTIFICATION).fire({type:"warning",id:"TEMPLATE_READ_ERROR",data:{templateId:t},innerException:n})},()=>{}))}function xh(e,t){const n=e.getOrCreateInstance(Oh,()=>new Map),r=n.get(t);if(r!==void 0)return r;const s=Mh(e,t).then(o=>(o===void 0&&n.delete(t),o));return n.set(t,s),s}var kh="EXTERNAL",pi=Symbol("supersededShow");function Fh(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"[emailmaker] save failed")}var Bh="email_id",jh=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=rt(t),this._eventLock=wh(t);const n=z(e,l.events.ON_EMAIL_CHANGED_ID);this.addDisposable(n(r=>{this._currentEmail=r})),this.addDisposable(e.addService(l.REQUEST_HANDLER_ID,{execute:(r,s)=>{!s?.public&&this._currentEmail?.id&&!this._currentEmail.isNew&&r.headers.append(Bh,this._currentEmail.id)}}))}_getInitPipeline(){return this._container?.getInstance(l.INIT_PIPELINE_ID)??Pn}_throwIfDestroyed(){if(this.isDisposed())throw ge()}async getTemplateEmail(e){const t=await xh(this._container,String(e));if(!t)return;const n={...t,lock:!1,parent_email:String(e)};return delete n.id,n}async setBlocks(e=[]){const{cache:t}=this._dataSources.blocks,n=await kt(this._container);await t.setAll(e.filter(r=>r.id!==void 0).map(r=>[r.id,st(r,this._container,n)]))}async setEmailRevisions(e,t){if(e===void 0)return;const{cache:n}=this._dataSources.emailRevisions,r=e.filter(s=>s.id!==void 0).map(s=>[s.id,Ft(s,this._container,t)]);await n.setAll(r)}async setComments(e=[],t){const{cache:n}=this._dataSources.comments,r=e.filter(s=>s.id!==void 0).map(s=>[s.id,er(s,this._container,t)]);await n.setAll(r)}async setEmail(e,t,n,r,s){const o=this._dataSources.emails,i=o.cache,a=await kt(this._container),c=r??this._showToken;e=typeof e=="string"?{code:e}:{...e};let d=Be(e,this._container);const u=d.id;let f=u;if(u!==void 0){const g=await o.get(u);d={...g??{},...d,utm_parameters:d.utm_parameters??g?.utm_parameters??{},renderGuid:g?.renderGuid??l.generateUUID(),...c>0?{showToken:c}:{},...s?{showId:s}:{},project:a}}else{f=n??l.generateUUID();const g=await o.get(f);d={...d,utm_parameters:d.utm_parameters??{},renderGuid:g?.renderGuid??l.generateUUID(),...c>0?{showToken:c}:{},...s?{showId:s}:{},project:a},delete d.project}if(t){const g=await this.getTemplateEmail(String(t));g&&(d=Ph(g,d))}return u===void 0&&(d=Rh(d)),await i.setAll([[f,d]]),d}_rememberShow(e){this._prevCommand=e}_isRepeatOfLastShow(e){const t=this._lastShow;if(!t||t.signature!==ui(this._container,e))return!1;const n=xt(this._container);return n===void 0||n===t.html}_rememberShownContent(e){const t=ui(this._container,e);this._lastShow=t===void 0?void 0:{signature:t,html:xt(this._container)??""}}async _show(e,t){if(this._throwIfDestroyed(),t!==void 0&&Th({ticket:t,emailId:ci(e)},{ticket:this._showRequests,emailId:this._latestShowEmailId}))return this._showRequests,pi;if(!e)return;const n=this._getInitPipeline();l.throwIfAborted(n.signal);const r=Ch(e);if(!r&&Ah(this._container,e,xt(this._container),this._prevCommand?.id)||!r&&this._isRepeatOfLastShow(e))return;const s=Nt(e);s.email.id,this._prevCommand?.id;let o,i="",a=0,c=!1,d,u=Promise.resolve(),f,g=!1;try{this._eventLock.suspendChange();const{email:E,blocks:S,autosaves:b,comments:h,templateId:y,reload:I}=s;o=E.id;const A=Be(E,this._container),D=A.id,N=D??l.generateUUID(),m=await qe("getProject",kt(this._container));l.throwIfAborted(n.signal),i=l.generateUUID();const _={isNew:D===void 0,id:String(N),project:m},C=I===!0&&D!==void 0;C&&(await this._dataSources.emails.remove(String(D),{silent:!0}),String(D)),a=++this._showToken,String(N);const M=[];M.push(this.setBlocks(S)),E.id!==void 0&&(M.push(this.setComments(h)),M.push(this.setEmailRevisions(b,String(E.id)))),M.push(this.setEmail(E,Number(y),D===void 0?String(N):void 0,a,i)),await qe("setEmail+blocks+revisions",Promise.all(M),{emailId:D??String(N),showId:i,targetShowToken:a}),l.throwIfAborted(n.signal);const p=await this._dataSources.emails.get(String(N)),v=ve(this._container),T={id:i,token:a};D===void 0?f=v.startNewDraft(p??A,{patch:A,show:T}):C?f=v.reload(D,{email:p??A,patch:A,show:T}):v.sessionKey()===Le(D)?f=v.show(A,T):f=v.open(D,{email:p??A,patch:A,show:T});const L=!!this._prevCommand&&l.deepEqual(this._prevCommand,_);_.id,!this._prevCommand||l.deepEqual(this._prevCommand,_),this._prevCommand?.id,this._rememberShow(_),u=n.requestShow({showId:i,navId:String(N),emailId:D,isNew:D===void 0}),g=!0,String(N),c=!0}catch(E){d=E,g&&i&&n.failShow(i,E),l.isAbortError(E)||(ts(E),void 0)}finally{this._eventLock.resumeChange()}if(!c)throw d instanceof Error?d:new Error(`[useblocks] show() setup failed: ${String(d??"unknown error")}`);return qe("show-init-deferred",Promise.all([u,f?.whenReady().catch(E=>{if(E instanceof Ge){const S=gn(E);throw S?new Error(`[useblocks] show(): email open failed (${S})`,{cause:E}):E}})??Promise.resolve()]).then(()=>{}),{showId:i,emailId:o??null}).then(()=>{this._rememberShownContent(e)})}async _save(){this._throwIfDestroyed();const e=this._getInitPipeline();l.throwIfAborted(e.signal);const t=ve(this._container),n=await t.save("publish",{source:kh,fallbackTitle:Us(this._container)});if(l.throwIfAborted(e.signal),!n)throw Fh(t.saveState().error);return oe(li(this._container,this._currentEmail),this._container)}_queuedShow=this._queue.decorate((e,t)=>this._show(e,t),this);show=e=>{const t=this._showRequests+=1;this._latestShowEmailId=ci(e);const n=this._queuedShow(e,t).then(r=>r===pi?this._latestShow.catch(()=>{}):void 0);return this._latestShow=n,n};save=this._queue.decorate(this._save,this)};function Uh(e){return String(e).replace(/"/g,""")}function Hh(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 $h(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 hi(e,t,n){const r=new RegExp(`\\b${t}\\s*=\\s*["'][^"']*["']`,"i"),s=Uh(n);return r.test(e)?e.replace(r,`${t}="${s}"`):e.replace(/>$/,` ${t}="${s}">`)}function Vh(e,t,n){if(!e?.trim()||!t)return e;const r=$h(e);if(!r)return e;const s=String(t),o=Hh(n??new Date);let{full:i,index:a}=r;const c=i.length;return/\bem-block-id\s*=/.test(i)||(i=hi(i,"em-block-id",s)),i=hi(i,"em-block-version",o),e.slice(0,a)+i+e.slice(a+c)}function Gh(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 Yh(e,t){const n=e.insertFrom??t?.type,r=t?.blockId??(e.id!=null&&e.id!==""?String(e.id):void 0),s=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:s,fragmentRole:e.fragmentRole,id:r,title:e.title??void 0,blockType:e.type,meta:Gh(e)}}function nr(e,t){return t?Yh(t,e):{type:e.type,name:e.name,blockId:e.blockId,project:e.project,insertFrom:e.type}}var mi=["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"],Wh=[...mi,"html","id","project","password"],h_=new Set(["html",...mi,"global_block","project"]);function qh(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(Wh),r={};for(const s of Object.keys(e))n.has(s)||(r[s]=e[s]);return Object.keys(r).length>0&&(t.catalogExtra=r),t}function zh(e,t={}){return!e||typeof e!="object"?{html:"",insertFrom:t.type,name:t.name,project:t.project,id:t.blockId}:{...qh(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 rr=new WeakMap;function Kh(e){let t=rr.get(e);return t||(t={byId:new Map,fallback:[]},rr.set(e,t)),t}function Xh(e){rr.delete(e)}function Jh(e,t){const{byId:n,fallback:r}=Kh(t);if(e.blockId){const s=n.get(e.blockId);if(s){n.delete(e.blockId);const o=r.indexOf(s);return o>=0&&r.splice(o,1),s}return}for(let s=r.length-1;s>=0;s--){const o=r[s],i=e.name!=null&&e.name!==""&&o.name!=null&&o.name!==""&&o.name===e.name,a=e.type!=null&&e.type!==""&&o.insertFrom===e.type;if(i&&a)return r.splice(s,1),o.id!=null&&o.id!==""&&n.delete(String(o.id)),o}}async function Qh(e,t){const{blocks:n}=rt(e);return await n.cache.getIfPresent(t)??void 0}async function Zh(e,t){if(!t.blockId)return;const n=await Qh(e,t.blockId);if(n)return zh(n,t)}async function em(e,t){const n=Jh(e,t);if(n)return nr(e,n);const r=await Zh(t,e);return r?nr(e,r):nr(e,void 0)}var tm=l.createIdentifier("application_block_inserted"),nm=-1e3,gi=new WeakSet;function rm(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 sm(e){if(!e||gi.has(e))return;gi.add(e);const t=new l.Disposable,n=Q(e);return t.addDisposable(n.addListenerAsyncPipe(tm,async(r,s)=>{const o=rm(r)?await em(r,e):r;return s?s(o):o},nm)),t.addDisposable({dispose:()=>{Xh(e)}}),t}var Ei=l.createIdentifier$1("plugin.earlyWindow");function om(e){return e.getOrCreateInstance(Ei,()=>({depth:0}))}function im(e){const t=om(e);t.depth+=1;let n=!1;return()=>{n||(n=!0,t.depth-=1)}}function vi(e){return(e?.getInstance(Ei)?.depth??0)>0}function _i(e,t){let n,r=!1;return e(s=>{n=s,r=!0}),(s,o,i)=>{const a=e(s,o,i);if(r&&vi(t)){const c=n;queueMicrotask(()=>{s.call(i,c)})}return a}}var bi=100,am=class extends l.Disposable{_container;_events;constructor(e){super(),this._container=e;const t=sm(e);t&&this.addDisposable(t)}_get(){const e=this._container,{blocks:t,emails:n,comments:r,emailRevisions:s}=rt(e),o=z(e,l.events.ON_SHARE_ID),i=z(e,l.events.ON_SHOW_PREVIEW_ID),a=z(e,l.events.ON_EMAIL_CLONE_ID),c=z(e,l.events.ON_CODE_VALIDATE_ID),d=z(e,l.events.ON_SUBJECT_CHANGED_ID),u=z(e,l.events.ON_EMAIL_CHANGED_ID),f=z(e,l.events.ON_PREHEADER_CHANGED_ID),g=z(e,l.events.ON_SAVEBUTTON_CLICK_ID),E=z(e,l.events.ON_NEXTBUTTON_CLICK_ID),S=z(e,l.events.ON_SEND_LIVEPREVIEW_ID),b=z(e,l.events.ON_SEND_TESTEMAIL_ID),h=z(e,_h),y=z(e,l.events.ON_CONTENT_CHANGED_ID),I=z(e,vh),A=z(e,l.events.ON_PREVIOUSBUTTON_CLICK_ID),D=z(e,l.events.ON_SEND_EMAIL_MODAL_ID),N=l.filter(z(e,l.events.ON_EMAIL_INIT_ID),m=>!m.reset);return{handlePreheaderChanged:B(f),handleSubjectChanged:B(d),handleValidate:B(c),handleReadEmail:B(n.handlerRead,m=>m,m=>m&&Be(m,e)),handleSaveEmail:B(n.onSave,function({prev:m,patch:_,value:C,source:M}){const p=m?oe(m,e):void 0;return{prev:p,patch:Ze(p,oe(_,e)),value:oe(C,e),source:M}},m=>m?Be(m,e):void 0),handleRemoveEmail:B(n.onRemove,({value:m,source:_})=>({value:oe(m,e),source:_}),()=>{}),handleReadCommonBlocks:B(h,m=>m.project,m=>m?.map(_=>st(_,e))),handleReadTemplateBlocks:B(I,m=>m,m=>m?.map(_=>st(_,e))),handleReadBlocks:B(t.byForeignKey("project").handleRead,m=>tt(e).requested||String(m),m=>m?.map(_=>st(_,e))),handleSaveBlock:B(t.onSave,function({prev:m,patch:_,value:C,source:M}){const p=C.global_block===!0&&C.id&&typeof C.html=="string"?{...C,html:Vh(C.html,String(C.id))}:C,v=m?ot(m,e):void 0;return{prev:v,patch:Ze(v,ot(_,e)),value:ot(p,e),source:M}},m=>m?st(m,e):void 0),handleRemoveBlock:B(t.onRemove,({value:m,source:_})=>({value:ot(m,e),source:_}),()=>{}),handleReadComments:B(r.byForeignKey("post").handleRead,m=>m,m=>m?.map(_=>er(_,e))),handleSaveComment:B(r.onSave,function({prev:m,patch:_,value:C,source:M}){const p=m?it(m,e):void 0;return{prev:p,patch:Ze(p,it(_,e)),value:it(C,e),source:M}},m=>m?er(m,e):void 0),handleRemoveComment:B(r.onRemove,({value:m,source:_})=>({value:it(m,e),source:_}),()=>{}),handleReadEmailRevisions:B(s.byForeignKey("parent").handleRead,m=>m,m=>m?.map(_=>Ft(_,e))),handleReadEmailAutosave:B(z(e,Yo),m=>m,m=>m?Ft(m,e):null),handleEmailAutosave:B(s.onSave,function({prev:m,patch:_,value:C,source:M}){return{value:tr(C,e),source:M}},m=>m?Ft(m,e):void 0),handleRemoveEmailAutoSave:B(s.onRemove,({value:m,source:_})=>({value:tr(m,e),source:_}),()=>{}),handleEmailChanged:B(l.debounce(u,bi),m=>oe(m,e)),handleEmailInit:_i(B(N,m=>oe(m,e)),e),handlePreviousButtonClick:B(A,m=>oe(m,e)),handleNextButtonClick:B(E,m=>oe(m,e)),handleSaveButtonClick:B(g,m=>oe(m,e)),handleHtmlChanged:B(l.debounce(y,bi)),handleTestEmailSend:B(b,({html:m,..._})=>({..._,code:m,compiled:{html:m,ampHtml:""}})),handleTestEmailModal:B(D,m=>oe(m,e)),handleCloneEmail:B(a,m=>oe(m,e)),handleShareEmail:B(o),handlePreviewEmail:B(i),handleLivePreviewEmail:B(S)}}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 Fe(t[r]))}for(const r of Object.keys(t))n[r].setListener(e[r])}},lm=l.createIdentifier$1("DataController"),cm=l.createIdentifier$1("DataEvents");function yi(e){return e.getOrCreateInstance(lm,()=>{const t=new jh(e);return e.getInstance(l.DISPOSABLE_ID)?.addDisposable(t),t})}function Si(e){return e.getOrCreateInstance(cm,()=>new am(e))}var dm=l.createIdentifier$1("plugin.pluginStart");function wi(e){return e.getOrCreateInstance(dm,()=>{let t;const n=new Promise(r=>{t=r});return e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>t()),{done:n,finish:t}})}function um(e){return wi(e).done}function fm(e){const t=wi(e);return t.run===void 0&&(t.run=(e.getInstance(l.PLUGIN_COLLECTION_ID)?.activate()??Promise.resolve()).finally(t.finish)),t.run}var pm=l.createIdentifier$1("plugin.startupShow");function hm(e){const t=yi(e),n=Si(e),r=e.getInstance(l.OPTIONS_SOURCE_ID),s=e.getInstance(l.DISPOSABLE_ID),o={current:Promise.resolve()};e.inject(pm,o);let i=!1;const a=r?.watch(d=>{d&&n.setOptions(d),i=(d?.plugins?.length??0)>0,o.current=o.current.catch(()=>{})}),c=r?.select(d=>d?.content).watch(d=>{if(d===void 0)return;const u=()=>(W(te.showStart),t.show(d).finally(()=>W(te.showEnd))),f=i?um(e).then(u):u();f.catch(()=>{}),o.current=f});a&&s?.addDisposable(a),c&&s?.addDisposable(c)}function mm(e){const t=yi(e);return{...Si(e).get(),show(n){return W(te.showStart),t.show(n).finally(()=>W(te.showEnd))},save(){return t.save()}}}function Ii(e){return/#set\s*\(\s*.*=.*\)/.test(e)}function Bt(e){const t=e.indexOf("(");if(t<0)return!0;let n=0,r="",s=!1;for(let o=t;o<e.length;o++){const i=e[o];if(s){s=!1;continue}if(i==="\\"){s=!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 gm(e){return(t,n,r)=>Bt(t)?e(t,n,r):!1}function Em(e){return t=>Bt(t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t)?e(t):!1}function vm(e){return(t,n,r)=>Bt(t)?Ii(t)?e(t,n,r):t:!1}function _m(e){return t=>{const n=t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t;return Bt(n)?Ii(n)?e(t):t:!1}}function bm(e){const t=/[<>&]/g;for(;t.exec(e)!==null;)return!0;return!1}function sr(e,t){const n=e.length;for(let r=0;r<n;r++){const s=e.charCodeAt(r);if(s===0||t==='"'&&s===34||t==="'"&&s===39||t===""&&(s===32||s===9||s===10||s===13||s===12||s===34||s===39||s===60||s===62||s===61||s===96))return!1}return!0}function ym(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",r=new Uint8Array(e);crypto.getRandomValues(r);let s="";for(let o=0;o<e;o++){const i=r[o]%62;s+=t.charAt(i)}return s}var Sm=8,wm=class{_byKey=Object.create(null);_byValue=Object.create(null);getOrCreateByKey(e){let t=this._byKey[e];return t===void 0&&(t=ym(Sm),this._byKey[e]=t,this._byValue[t]=e),t}getByValue(e){return this._byValue[e]}},jt=new wm;function Ti(e,t){return t!==void 0&&!sr(e,t)?`%|{${jt.getOrCreateByKey(e)}}|%`:e}function Im(e){const t=jt.getByValue(e.slice(3,e.length-3));return t===void 0?e:t}function q(e,t,n){return t!==void 0?sr(e,t)?e:`%|{${jt.getOrCreateByKey(e)}}|%`:`<!--${e}-->`}function Tm(e){return e.replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&")}function Y(e){return e.startsWith("<!--")&&e.endsWith("-->")?Tm(e.slice(4,-3)):e}function Cm(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 s=e.match(/\[%\s*([^%]*?)\s*%\]/);s&&(r=s[1]);const o=r.trim();return t.test(o)||n.test(o)}function Am(e,t,n){return t!==void 0?sr(e,t)?e:`%|{${jt.getOrCreateByKey(e)}}|%`:n||bm(e)||Cm(e)?`<!--${e}-->`:e}var Ae=gm(q),De=Em(Y),Dm=vm(q),Pm=_m(Y),Ci=e=>{e.escape("<!--","-->",t=>t,!1),e.escape("<style","</style>",t=>t,!1),e.escape("<script","<\/script>",t=>t,!1),e.unescape("%|{","}|%",Im),e.escape("@{","}",q,!0).unescape("<!--@{","}-->",Y,!0),e.unescape("<!--%%%{{{","}}}%%%-->",t=>t.substring(10,t.length-9),!1),e.escape("${","}",Ti,!0),e.escape("{{","}}",Ti,!0),e.createSyntax("brace-percent").escape("{%","%}",q).unescape("<!--{%","%}-->",Y),e.createSyntax("brace-hash").escape("{#","#}",q).unescape("<!--{#","#}-->",Y),e.createSyntax("proscript").escape("[%","%]",Am,!0).unescape("<!--[%","%]-->",Y,!0),e.createSyntax("getresponse").escape("[[IF","]]",q).escape("[[if","]]",q).escape("[[ELSE]]","",q).escape("[[else]]","",q).escape("[[ENDIF]]","",q).escape("[[endif]]","",q).unescape("<!--[[IF","]]-->",Y).unescape("<!--[[if","]]-->",Y).unescape("<!--[[ELSE]]","-->",Y).unescape("<!--[[else]]","-->",Y).unescape("<!--[[ENDIF]]","-->",Y).unescape("<!--[[endif]]","-->",Y),e.createSyntax("expert-sender").escape("<if",">",q).escape("</if",">",q).escape("<else",">",q).escape("</else",">",q).escape("<var ",">",q,!0).unescape("<!--<if ",">-->",Y).unescape("<!--</if",">-->",Y).unescape("<!--<else ",">-->",Y).unescape("<!--</else",">-->",Y).unescape("<!--<var",">-->",Y,!0),e.createSyntax("velocity").escape("#if",")",Ae).escape("#elseif",")",Ae).escape("#else","",q).escape("#foreach",")",Ae).escape("#macro",")",Ae).escape("#set",")",Dm,!0).escape("#parse",")",Ae).escape("#include",")",Ae).escape("#evaluate",")",Ae).escape("#end","",q).escape("#break","",q).escape("#stop","",q).unescape("<!--#macro","-->",De).unescape("<!--#if","-->",De).unescape("<!--#elseif","-->",De).unescape("<!--#else","-->",Y).unescape("<!--#foreach","-->",De).unescape("<!--#parse","-->",De).unescape("<!--#include","-->",De).unescape("<!--#evaluate","-->",De).unescape("<!--#end","-->",Y).unescape("<!--#break","-->",Y).unescape("<!--#stop","-->",Y).unescape("<!--#set","-->",Pm,!0),e.createSyntax("mailchimp").escape("*|","|*",q).unescape("<!--*|","|*-->",Y)},or="bare",Rm=new Map;function Om(e){return e?Rm.get(e)??or:or}var Ai=["brace-percent","brace-hash","proscript","getresponse","expert-sender","mailchimp","velocity"];function Di(e){return Ai.includes(e)}function at(e){return e==="bare"||e==="html-comment"}function ir(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Mm(e,t=n=>{}){const n={output:{},editor:{}};if(e==null)return n;let r;if(typeof e=="string"){if(!at(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&&!at(u))return t(`templateDirectives.${d}: unknown form "${String(u)}", configuration ignored.`),n;if(r.syntaxes!==void 0&&!ir(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(!(!Di(d)||u===void 0||at(u))){if(!ir(u))return t(`templateDirectives.syntaxes.${d}: expected a form or an object, configuration ignored.`),n;for(const f of["output","editor"]){const g=u[f];if(g!==void 0&&!at(g))return t(`templateDirectives.syntaxes.${d}.${f}: unknown form "${String(g)}", configuration ignored.`),n}}}if(r.output===void 0&&r.editor===void 0&&r.syntaxes===void 0)return n;const s=r.output??or;let o=r.editor;s==="bare"&&r.editor==="html-comment"&&(t('templateDirectives: editor="html-comment" requires output="html-comment"; editor was reset to match output.'),o=void 0);const i=[];if(r.syntaxes)for(const d of Object.keys(r.syntaxes)){if(!Di(d)){t(`templateDirectives.syntaxes: unknown syntax id "${d}", entry ignored.`);continue}i.push(d)}else i.push(...Ai);const a={},c={};for(const d of i){const u=r.syntaxes?.[d],f=ir(u)?u:void 0,g=(at(u)?u:f?.output)??s;let E=f?.editor??o??g;g==="bare"&&E==="html-comment"&&(t(`templateDirectives.syntaxes.${d}: editor="html-comment" requires output="html-comment" for this id; editor was reset to "bare" for it.`),E="bare"),a[d]=g,c[d]=E}return{output:a,editor:c}}function Pi(e,t,n,r){for(let s=t;s<n;s++){const o=e[s];r.insideAttributeValue?r.attributeQuoteChar==='"'||r.attributeQuoteChar==="'"?o===r.attributeQuoteChar&&(r.insideAttributeValue=!1,r.attributeQuoteChar=void 0):r.unquotedAttr&&/[\s>]/.test(o)&&(r.insideAttributeValue=!1,r.attributeQuoteChar=void 0,r.unquotedAttr=!1):o==="<"?r.insideTag=!0:o===">"?r.insideTag=!1:r.insideTag&&(o==='"'||o==="'")?(r.insideAttributeValue=!0,r.attributeQuoteChar=o,r.unquotedAttr=!1):r.insideTag&&/\S/.test(o)&&r.attributeQuoteChar===void 0&&e[s-1]==="="&&!['"',"'","`"].includes(o)&&(r.insideAttributeValue=!0,r.attributeQuoteChar="",r.unquotedAttr=!0)}}function lt(e,t){return e.start<t.end&&t.start<e.end}function Ri(e,t,n,r,s=[]){if(n&&(t=t.filter(u=>u.isVariable)),!t.length)return[];const o=t.flatMap(u=>u.match(e).flatMap(f=>!Number.isInteger(f.start)||!Number.isInteger(f.end)||f.start<0||f.end>e.length||f.start>=f.end?[]:[{range:f,mapFn:u.mapFn,overrideBuiltins:u.overrideBuiltins,syntax:u.syntax,isVariable:u.isVariable}])).sort((u,f)=>u.range.start-f.range.start||u.range.end-f.range.end),i=[],a=s.slice().sort((u,f)=>u.start-f.start),c={insideTag:!1,insideAttributeValue:!1,attributeQuoteChar:void 0,unquotedAttr:!1};let d=0;for(const{range:u,mapFn:f,overrideBuiltins:g,syntax:E,isVariable:S}of o){if(r?(c.insideAttributeValue=!0,c.attributeQuoteChar='"'):Pi(e,d,u.start,c),d=u.end,a.some(I=>lt(I,u)))continue;const b=c.insideAttributeValue?c.attributeQuoteChar??"":void 0,h=e.substring(u.start,u.end),y=f(h,b,c.insideTag);y!==!1&&y!==h&&(i.push({range:u,text:y,overrideBuiltins:g,syntax:E,isVariable:S}),a.push(u))}return i.sort((u,f)=>u.range.start-f.range.start||u.range.end-f.range.end)}function Lm(e,t){const n=t.reduce((a,{mapFn:c,start:d,end:u,syntax:f,isVariable:g})=>(a[d]||(a[d]=[]),a[d].push({value:u,mapFn:c,syntax:f,isVariable:g}),a),Object.create(null)),r=Object.keys(n).map(a=>a.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&")).join("|"),s=new RegExp(r,"g"),o=[];let i;for(;(i=s.exec(e))!==null;){const a=i[0];o.push({start:i.index,startToken:a,endTokens:n[a]})}return o}function ar(e,t,n,r,s=!1){const o=[];if(n&&(t=t.filter(d=>d.isVariable)),!t.length)return o;const i=Lm(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:f,endTokens:g}=i[d];r?(a.insideAttributeValue=!0,a.attributeQuoteChar='"'):Pi(e,c,u,a),c=u;const E=a.insideAttributeValue?a.attributeQuoteChar??"":void 0;let S=!1;for(const{mapFn:b,value:h,syntax:y,isVariable:I}of g){let A=u+f.length,D=e.indexOf(h,A);for(;D!==-1;){let N=D,m=u+f.length,_=0;for(;N!==-1;){const T=e.indexOf(f,m);if(T!==-1&&T<N)_++,m=T+f.length,N=e.indexOf(h,m);else if(_>0)_--,m=N+h.length,N=e.indexOf(h,m);else break}if(N<0)break;const C=N+h.length,M=e.substring(u,C),p=b(M,E,a.insideTag);if(p===!1){A=D+Math.max(h.length,1),D=e.indexOf(h,A);continue}(s||p!==M)&&o.push({range:{start:u,end:C},text:s?M:p,syntax:y,isVariable:I});const v=i.findIndex(({start:T})=>T>=C);v>d?d=v-1:d=i.length,S=!0;break}if(S)break}}return o}function Ut(e,t){if(!t.length)return e;const n=t.slice().sort((s,o)=>o.range.start-s.range.start);let r=e;for(const{text:s,range:o}of n)r=r.slice(0,o.start)+s+r.slice(o.end);return r}var Nm=class{_disposables=[];_escapes=[];_unescapes=[];_escapeMatchers=[];_unescapeMatchers=[];constructor(e=Ci){const{_escapes:t,_unescapes:n}=this;e({createSyntax(r){return{...this,syntax:r}},escape(r,s,o,i){return t.push({start:r,end:s,mapFn:o,isVariable:i,syntax:this.syntax||r}),this},unescape(r,s,o,i){return n.push({start:r,end:s,mapFn:o,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 s=!1;const o={dispose:()=>{s||(s=!0,this._escapeMatchers=this._escapeMatchers.filter(i=>i!==n),this._unescapeMatchers=this._unescapeMatchers.filter(i=>i!==r))}};return this.addDisposable(o),o}_collectMappings(e,t,n){const r=ar(e,this._escapes,t,n),s=Ri(e,this._escapeMatchers,t,n),o=s.filter(c=>c.overrideBuiltins).map(c=>c.range),i=r.filter(c=>!o.some(d=>lt(d,c.range))),a=s.filter(c=>c.overrideBuiltins||!i.some(d=>lt(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=ar(e,this._unescapes,t),r=Ri(e,this._unescapeMatchers,t,!1),s=r.filter(a=>a.overrideBuiltins).map(a=>a.range),o=n.filter(a=>!s.some(c=>lt(c,a.range))),i=r.filter(a=>a.overrideBuiltins||!o.some(c=>lt(a.range,c.range)));return[...o,...i].sort((a,c)=>a.range.start-c.range.start||a.range.end-c.range.end)}getRevertMappings(e,t,n){const r=n?s=>s!==void 0&&n.has(s):s=>Om(s)==="html-comment";return this._collectRevertMappings(e,t).filter(s=>s.isVariable||!r(s.syntax))}getDetectedMappings(e,t,n){return ar(e,this._escapes,t,n,!0)}getEscapedText(e,t){return Ut(e,this.getMappings(e,t))}getUnescapedText(e,t,n){return Ut(e,this.getRevertMappings(e,t,n))}normalizeToPolicy(e,t){const n=o=>o===void 0?void 0:t[o],r=Object.values(t);let s=e;return r.includes("bare")&&(s=Ut(s,this._collectRevertMappings(s).filter(o=>n(o.syntax)==="bare"))),r.includes("html-comment")&&(s=Ut(s,this._collectMappings(s).filter(o=>!o.isVariable&&n(o.syntax)==="html-comment"&&o.text.startsWith("<!--")&&o.text.endsWith("-->")))),s}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()}};function Oi(e){return e.replace("<script","<___script").replace("<\/script>","</___script>")}var Mi=new Nm(e=>{e.escape("<script","<\/script>",t=>Oi(t)).unescape("<___script","</___script>",t=>t.replace("<___script","<script").replace("</___script>","<\/script>")),e.escape("<script","/>",t=>Oi(t)).unescape("<___script","/>",t=>t.replace("<___script","<script")),Ci(e)});function xm(e){const t=Mm(e);if(!(Object.keys(t.output).length>0||Object.keys(t.editor).length>0))return so();const n=new Set(Object.keys(t.output).filter(s=>t.output[s]==="html-comment")),r=new Set(Object.keys(t.output));return{isConfigured:()=>!0,toEditorForm:s=>Mi.normalizeToPolicy(s,t.editor),toOutputForm:s=>Mi.normalizeToPolicy(s,t.output),keepWrappedOnOutput:n,editorPolicy:t.editor,warnAboutUnconfiguredInput:ro(r)}}function km(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:xm(n)}),t.policy})}function m_(e){return e}var Fm=[{name:"rest.client",setup:ph},{name:"auth.oauth",setup:l.provideOAuth},{name:"rest.identityHeaders",setup:lh},{name:"lifetime.destroyable",provides:[Vn],setup:cp},{name:"appInit",provides:[l.APP_ID,en],setup:ol},{name:"config",provides:[l.CONFIG_SOURCE_ID],setup:ap},{name:"templateDirectives",provides:[l.TEMPLATE_DIRECTIVES_ID],setup:km},{name:"email.documents",setup:Dp},{name:"show.initPipeline",provides:[l.INIT_PIPELINE_ID],setup:hh},{name:"show",setup:hm},{name:"locale.service",provides:[nt],setup:sh},{name:"locale.fromConfig",awaits:{services:[l.CONFIG_SOURCE_ID,nt]},setup:oh},{name:"canvas.early",setup:tf},{name:"canvas.previewSettings",setup:ff},{name:"canvas.sandboxExtensions",setup:hf},{name:"canvas.sandboxScriptRelay",setup:Ef},{name:"canvas.headerSync",provides:[bo],setup:sf},{name:"canvas.ampSync",setup:ud},{name:"canvas.moduleBridge",setup:$d},{name:"canvas.port",setup:yd},{name:"canvas.images",setup:_d},{name:"canvas.edits",setup:_u},{name:"canvas.blockContent",setup:pu},{name:"canvas.sandboxFill",provides:[Rn],setup:Bf},{name:"canvas.reactions",setup:ef}],Bm=class extends Error{cycle;constructor(e){super(`[units] цикл в зависимостях: ${e.join(" → ")}`),this.cycle=e}};function jm(e){const t=new Map;for(const n of e)for(const r of n.provides??[]){const s=t.get(r)??[];s.push(n),t.set(r,s)}return t}function Um(e,t){const n=[];for(const r of e.awaits?.services??[])for(const s of t.get(r)??[])s!==e&&n.push(s);return n}function Li(e){const t=jm(e),n=[],r=new Set,s=[],o=new Set,i=a=>{if(!r.has(a)){if(o.has(a)){const c=s.indexOf(a);throw new Bm([...s.slice(c),a].map(d=>d.name))}o.add(a),s.push(a);for(const c of Um(a,t))i(c);s.pop(),o.delete(a),r.add(a),n.push(a)}};for(const a of e)i(a);return n}var Ni;function lr(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=de();e.inject(l.OPTIONS_SOURCE_ID,n),Ni??=Li(Fm);for(const r of Ni)r.setup(e);return n}function Hm(e){}var $m=[{name:"save.previewFollow",setup:Hm}],xi=l.createIdentifier$1("plugin.lateUnitsInstalled");function Vm(e){if(!e.getInstance(xi)){e.inject(xi,!0);for(const t of Li($m))t.setup(e)}}function Gm(e,t){return{project:Number(e),app_id:t?.app_id||0,app_config:t?.app_config||{},user:t?.user}}function Ym(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 Wm=l.defineMixin(e=>{let t,n,r;return{async setOptions(s){const o=r!==s.getAuthToken,i=!l.deepEqual(t,s.user),a=n!==s.project;if(r=s.getAuthToken,t=s.user,n=s.project,!(!e.getInstance(l.SECURITY_MODULE_ID)||!s.getAuthToken)&&!(!o&&!i&&!a))try{const c=await s.getAuthToken(s.user,s.project);e.inject(l.STANDALONE_BOOTSTRAP_TOKEN_ID,Promise.resolve(c||""));const d=Ym(c);if(!d)return;e.inject(l.STANDALONE_PROJECT_ID,d);const u=e.getInstance(l.APP_ID),f=u?await u.catch(()=>{}):void 0;e.inject(l.APP_ID,Promise.resolve(Gm(d,f)))}catch{}}}});function qm(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 zm=l.defineMixin(e=>{let t,n=!1;return{setOptions(r){const s=n;if(n=!0,!Qe(r)){t&&(zf(e),$n(r)),t=void 0;return}const o=Rt(r);if(!o||t===o&&e.getInstance(l.SECURITY_MODULE_ID))return;t=o,e.inject(l.SECURITY_MODULE_ID,o);const i=e.getInstance(l.DISPOSABLE_ID);i&&qm(e,i)}}}),Km=l.defineMixin(e=>{const t=e.getInstance(l.DISPOSABLE_ID),n=l.getEvent(e,l.APP_LOAD_EVENT_ID),r=B(n),s=t.addDisposable(new Fe(r));return{setOptions({handleLoad:o}){s.setListener(o)},instance:{handleLoad:r},dispose:()=>t.dispose()}});function ki(e,t,n=!0){const r=e,s=t;for(const o of Object.keys(s)){const i=s[o];i!=null&&(n&&typeof i=="object"?r[o]=ki(r[o]||{},i,!0):r[o]=i)}return e}async function Xm(e){const t=(await Ra.__vitePreload(()=>Promise.resolve().then(()=>Kt.__toESM(Et("./static/umd/6639d610.js").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 Fi=l.createIdentifier$1("EditorOptions"),cr=l.MONACO_EDITOR_OPTIONS;function Jm(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 Qm(e){return e.getOrCreateInstance(Fi,()=>{const t=de(cr);let n=cr.fontFamily;return t.watch(r=>{!r.fontFamily||r.fontFamily===n||(n=r.fontFamily,Promise.resolve(Xm(r.fontFamily.split(",")[0])).catch(()=>{}))}),t})}function Zm(e){return e?.getInstance(Fi)?.get()??cr}function eg(e,t={}){const n=Qm(e);n.set(ki({...n.get()},Jm(t)))}function tg(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 ng(e){return{fontSize:e.fontSize,fontFamily:e.fontFamily,tabSize:e.tabSize,wordWrap:e.wordWrap!=="off",minimap:e.minimap?.enabled,insertSpaces:e.insertSpaces}}var rg=l.createIdentifier$1("plugin.publicConfig");function dr(e){return e.getInstance(l.CONFIG_SOURCE_ID)?.get()??{}}function Bi(e){return e.getInstance(l.CONFIG_SOURCE_ID)?.layers()??{base:{},profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}}}function ji(e){const t=xo(e),n=dr(e);return{...n,locale:n.locale||"en_US",theme:n.theme||"light",editor:ng(Zm(e)),codeModeDirection:t.isCodeMode?t.direction:"none"}}function Ui(e){return e.getInstance(l.CONFIG_SOURCE_ID)?.get()!==void 0}function sg(e){const t=l.createQueue(),n=se(e,l.CONFIG_CHANGED_EVENT_ID);let r,s,o=!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:f=!1}={})=>{await e.getInstance(l.CONFIG_SOURCE_ID)?.ready(),Wr(e).set(dr(e).revisionService===!0);const{codeModeDirection:g,editor:E}=dr(e);E&&eg(e,tg(E)),g!==void 0&&!(f&&g===s)&&(s=g,g==="none"?Hn(e,!1):(Hn(e,!0),Wf(e,g)))},c=async()=>{if(!Ui(e))return;const f=ji(e),g=JSON.stringify(f);g!==r&&(r=g,await n.fire(f))},d=async f=>{const g=e.getInstance(l.CONFIG_SOURCE_ID),E={advancedConfigs:Bi(e).advancedConfigs,serverSide:await i(),user:f};g?.setAdvancedConfigs({...E.advancedConfigs,...E.user?.advancedConfigs}),g?.replace(E.user,"user"),g?.replace(E.serverSide,"server"),await a(),await c()},u=f=>{const{commonStyles:g,...E}=f;return"commonStyles"in f&&uf(e,g===void 0?void 0:g),E};return{queue:t,reactToConfig:a,emitConfigChanged:c,resolveServerSideConfig:i,getConfig:()=>Ui(e)?ji(e):{},setConfig:t.decorate(async f=>{await d(u(f))}),updateConfig:t.decorate(async f=>{const g=u(f);await d({...Bi(e).user,...g})}),announceAssembled(){o||(o=!0,e.getInstance(l.CONFIG_SOURCE_ID)?.ready().then(t.decorate(async()=>{await a({onlyChangedCodeMode:!0}),await c()})))}}}function Hi(e){return e.getOrCreateInstance(rg,()=>sg(e))}function og(e){const t=Hi(e);return{getConfig:()=>t.getConfig(),setConfig:n=>t.setConfig(n),updateConfig:n=>t.updateConfig(n)}}var ig=l.defineMixin(e=>{const t=e.getInstance(l.DISPOSABLE_ID),n=t.addDisposable(new l.AsyncEmitter),r=t.addDisposable(new l.AsyncEmitter),s=l.getEmitter(e,l.CONFIG_CHANGED_EVENT_ID),o=B(n.event),i=B(r.event),a=_i(B(s.event),e),c=t.addDisposable(new Fe(o)),d=t.addDisposable(new Fe(i)),u=t.addDisposable(new Fe(a));return{instance:{handleSetOptions:o,handleOptionsChanged:i,handleConfigChanged:a},async setOptions(f){c.setListener(f.handleSetOptions),d.setListener(f.handleOptionsChanged),u.setListener(f.handleConfigChanged),Hi(e).announceAssembled(),await n.fire(f),await r.fire(f)},dispose(){}}}),ur,$i="core";function ag(){const e=__useblocks__?.require;return typeof e!="function"?Promise.reject(new Error("[loadCore] AMD loader is unavailable")):new Promise((t,n)=>{e([$i],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadCore] Failed to require core module")))})}function lg(e){const t=__useblocks__?.require?.warm;return typeof t!="function"?ct().then(()=>{}):t([$i],e)}function ct(){return ur===void 0&&(ur=ag().then(e=>(He()&&e.installDiagnostics().catch(t=>{}),e))),ur}var fr=null,pr=null;async function cg(e){typeof e?.prefetch=="function"&&await e.prefetch()}function hr(){return fr||(fr=ct().then(()=>{})),fr}function Vi(e){return pr||(pr=cg(e)),pr}function dg(){return Vi(typeof __useblocks__<"u"?__useblocks__:void 0)}function ug(){const e=typeof __useblocks__<"u"?__useblocks__:void 0,t=e?.__compatMissingReason;return e&&(e.__compatMissingReason=void 0),typeof t=="string"?t:void 0}function fg(e){return Promise.all([hr(),Vi(e)]).then(()=>{})}function pg(e){const t=e?.preload?.start??e?.startupPrefetchMode;return t==="eager"||t==="idle"||t==="manual"||t==="off"?t:"idle"}function Gi(e,t){const n=e?.preload?.execute!==!1;Promise.resolve().then(()=>lg(t?{priority:t}:void 0)).then(()=>(An(t?{priority:t}:void 0),n?hr():void 0)).catch(()=>{})}function hg(e){const t=pg(e);if(t==="eager")Gi(e);else if(t==="idle"){const n=()=>Gi(e,"low");document.readyState==="complete"?n():window.addEventListener("load",n,{once:!0})}}var Yi="PluginRegistry";function mg(e=l.resolveContainer()){return e.getOrCreateInstance(Yi,()=>new Ba)}var Wi=new ja(()=>mg()),gg=["handleAIImageRequest","handleAITextRequest","handleCloneEmail","handleConfigChanged","handleDestroy","handleEmailAutosave","handleEmailChanged","handleEmailInit","handleError","handleFileProxy","handleHtmlChanged","handleLimitUsage","handleLivePreviewEmail","handleLoad","handleLoadImage","handleNextButtonClick","handleNotify","handleOptionsChanged","handlePreheaderChanged","handlePreviewEmail","handlePreviousButtonClick","handleReadBlocks","handleReadComments","handleReadCommonBlocks","handleReadEmail","handleReadEmailAutosave","handleReadEmailRevisions","handleReadLocale","handleReadTemplateBlocks","handleRemoveBlock","handleRemoveComment","handleRemoveEmail","handleRemoveEmailAutoSave","handleSaveBlock","handleSaveButtonClick","handleSaveComment","handleSaveEmail","handleSetOptions","handleShareEmail","handleSubjectChanged","handleSuccess","handleTestEmailModal","handleTestEmailSend","handleTranslate","handleUrlProxy","handleValidate"],Eg=["compileEmail","getBlocks","getComments","getEmail","getEmailRevisions","getEmailSnapshot","save","setConfig","show","updateConfig","useAsync","validateCode","waitPlugin"],Ht=new Map([...gg.map(e=>[e,"event"]),...Eg.map(e=>[e,"async"]),["setEmailMeta","queued"],["setBlockMeta","queued"],["notify","queued"],["getConfig","sync"],["use","sync"],["getElement","element"],["getCodeErrors","codeErrors"],["container","field"],["undoRedoService","field"]]),vg=new Map([["use","use `useAsync()` or await `ready` first"]]);function _g(e){return vg.get(e)??"await `ready` first"}var bg=new Set(["async","queued"]),yg=Symbol.for("emailmaker.earlyCtxPlaceholder");function qi(e){return e[yg]=!0,e}function Sg(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 (${_g(e)}).`)}function wg(e){return new Error(`[emailmaker] ${e}() is missing from the editor instance after the core has loaded.`)}function Ig(e){return[...Ht].filter(([t,n])=>n!=="field"&&e[t]===void 0).map(([t])=>t).sort((t,n)=>t.localeCompare(n))}function Tg(e,t){for(const n of Ig(e)){const r=Ht.get(n);if(r!==void 0&&bg.has(r)){const s=async(...o)=>{await t;const i=e[n];if(typeof i!="function"||i===s)throw wg(n);return i.apply(e,o)};e[n]=qi(s);continue}e[n]=qi(()=>{throw Sg(n)})}}function Cg(e,t,n){e.getInstanceAsync(je).then(()=>{l.getEmitter(e,l.events.ON_NOTIFICATION).fire({type:"error",id:"PLUGIN_CREATE_ERROR",data:{plugin:t},innerException:n})},()=>{})}function Ag(e,t){e.getInstanceAsync(je).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 Dg=l.defineMixin(e=>{let t;function n(){return new Promise(s=>{const o=e.getOrCreateInstance(l.LATE_SURFACE_LISTENERS_ID,()=>new Set),i=()=>{o.delete(i),s()};o.add(i)})}function r(){if(!t)throw new Error("PluginCollection not initialized. Call init() first.");return t}return{async setOptions(s){const o=e.getInstance(l.INSTANCE_ID),i=e.getInstance(Yi);if(!t){t=new Fa(o,i,{ensureHostRuntimeReady:dg,explainScriptFailure:ug,openEarlyWindow:()=>im(e),reportLoadFailure:d=>Ag(e,d)}),e.inject(l.PLUGIN_COLLECTION_ID,t);const c=t.onLifecycle(d=>{d.type==="create:error"&&Cg(e,d.name,d.error)});e.getInstance(l.DISPOSABLE_ID)?.addDisposable(c)}const a=s?.plugins||[];o&&(Ns(e),a.length>0&&Tg(o,n()),await t.setPlugins(a))},instance:{use(s){return typeof s=="function"?r().useByCtor(s):r().useByKey(s)},useAsync(s){return r().useAsync(s)},waitPlugin(s){return r().waitFor(s)}},dispose(){t?.dispose(),t=void 0}}}),zi=class{_listeners=[];add(e,t=0,n){const r={fn:n?e.bind(n):e,priority:t};return this._listeners.push(r),{dispose:()=>{const s=this._listeners.indexOf(r);s>=0&&this._listeners.splice(s,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}},Pg=l.createIdentifier$1("ELEMENT_INSERT_HTML_PIPELINE"),Rg=l.createIdentifier$1("BLOCK_INSERT_HTML_PIPELINE"),Og="application_block_inserted",Mg=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(Rg,()=>new zi).add(e,t??0,n)}handleInject(e,t,n){const r=this._container.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService),s=n?e.bind(n):e;return r.addListener(Og,s,t)}},mr=l.createIdentifier$1("ComponentRegistry"),Lg=l.createIdentifier$1("ComponentRegistryGate");function gr(){return l.DependencyResolver.getOrCreateInstance(Lg,()=>({pending:[]}))}function Ng(e=mr){return gr().factory!==void 0||l.DependencyResolver.getInstance(e)!==void 0}function Er(e,t,n=mr){if(Ng(n)){t($t(e,n));return}gr().pending.push(()=>t($t(e,n)))}function $t(e,t=mr){const n=l.DependencyResolver.getInstance(t);if(n)return n;const r=gr().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 xg=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=o=>{if(!n){n=!0;for(const i of t)i.dispose();e(o)}};t.push(this._container.addService(l.ATOMS_HANDLERS_ID,{execute:o=>{r(o.value.map(i=>({name:i.name,html:i.html})))}}));const s=this._container.getInstance(l.HEADLESS_MODE_ID)?.watch(o=>{o&&r([])});s&&(n?s.dispose():t.push(s))})}update(e,t){const n=this._container;return n.addService(l.ATOMS_HANDLERS_ID,{execute:r=>{const s=$t(n),o=r.value.find(i=>i.name===e);if(o){const{icon:i,title:a,fallbackTooltip:c,...d}=t;i&&(o.icon=s.getReactNode(i)),a&&(o.title=s.getReactNode(a)),c&&(o.fallbackTooltip=s.getReactNode(c)),Object.assign(o,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 s=$t(n);r.value.splice(t??r.value.length,0,{...e,title:s.getReactNode(e.title),icon:s.getReactNode(e.icon),fallbackTooltip:s.getReactNode(e.fallbackTooltip)})}})}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(Pg,()=>new zi).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)}},kg=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 Fg(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>n!==void 0))}function Ki(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 Bg=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 Er(this._container,r=>{this._showModalEmitter.fire({...e,content:r.getReactNode(e.content),title:r.getReactNode(e.title),id:t,modalProps:Ki(r,n)})}),t}close(e){this._closeModalEmitter.fire(e)}closeAll(){this._closeModalEmitter.fire()}update(e,t){const n=t.modalProps;Er(this._container,r=>{this._updateModalEmitter.fire(Fg({...t,content:r.getReactNode(t.content),title:r.getReactNode(t.title),id:e,modalProps:Ki(r,n)}))})}},jg=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=s=>{this._loadedSettled||(this._loadedSettled=!0,r(s))}}),this.ready=new Promise((n,r)=>{this._resolveReady=()=>{this._readySettled||(this._readySettled=!0,n())},this._rejectReady=s=>{this._readySettled||(this._readySettled=!0,r(s))}})}_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)}},Ug=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,s=>{if(s.key===e){if(s.phase==="load"&&s.status==="success"){r.resolveLoaded();return}if(s.phase==="ready"&&s.status==="success"){r.resolveReady();return}if(s.phase==="load"){r.rejectLoad(new Error(s.error||`Sandbox script "${e}" failed to load.`));return}r.rejectReady(new Error(s.error||`Sandbox script "${e}" failed to initialize.`))}}),r=new jg(t,n);return r}registerSandboxCSS(e){return this._container.addService(l.SANDBOX_EXTENSIONS_ID,{type:"link",key:e,parent:"head",attributes:{rel:"stylesheet",type:"text/css",href:e}})}registerSandboxCSSCode(e,t){return this._container.addService(l.SANDBOX_EXTENSIONS_ID,{type:"style",key:e,parent:"head",attributes:{type:"text/css"},innerHTML:t})}registerSandboxScript(e){const t=this._container.addService(l.SANDBOX_EXTENSIONS_ID,{type:"script",key:e,parent:"head",attributes:{src:e,type:"text/javascript"}});return this._createScriptHandle(e,t)}registerSandboxScriptCode(e,t){const n=this._container.addService(l.SANDBOX_EXTENSIONS_ID,{type:"script",key:e,parent:"head",attributes:{type:"text/javascript"},innerHTML:t});return this._createScriptHandle(e,n)}},Hg=new Set([Symbol.for("react.element"),Symbol.for("react.transitional.element")]);function vr(e){if(typeof e!="object"||e===null)return!1;const t=e.$$typeof;return typeof t=="symbol"&&Hg.has(t)}function Xi(){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 _r(){return`__settingsPanel:${Xi()}`}function br(e,t){return{type:e,props:t}}function $g(e){return typeof e=="object"&&e!==null&&"type"in e&&"props"in e&&!vr(e)}function Ji(e,t,n){if(t==null||typeof t=="number"||typeof t=="boolean"||typeof t=="string")return t;if(vr(t)){const r=_r();return n(e.add(r,t)),br(r,{})}if(typeof t=="function"){const r=_r();return n(e.add(r,t)),br(r,{})}if($g(t)){const r=t.type;if(typeof r=="string")return t;if(vr(r)||typeof r=="function"){const s=_r();return n(e.add(s,r)),br(s,t.props)}return t}return t}var Vg=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??Xi();Er(this._container,n=>{const r=i=>this._trackRegistration(i),s=Ji(n,e.content,r),o=e.advancedTabs?.map(i=>({...i,content:Ji(n,i.content,r)}));l.getEmitter$1(this._container,l.SETTINGS_PANEL_EVENT).fire({...e,content:s,advancedTabs:o,instanceKey:t,type:l.ADVANCED_SETTINGS_PANEL})})}closeSettingsPanel(){this._clearPanelRegistrations(),l.getEmitter$1(this._container,l.SETTINGS_PANEL_EVENT).fire(null)}},Qi={SandboxScriptApi:Ug,ElementsApi:xg,BlocksApi:Mg,MessageService:kg,SettingsPanelApi:Vg,ModalApi:Bg};function yr(e,t,n,r={}){const s=Object.assign({},e);for(const[o,i]of Object.entries(t))if(i!==void 0)if(n.includes(o)&&typeof i=="object"&&i!==null){const a=s[o],c=r[o]??{};s[o]=Object.assign({},typeof a=="object"&&a!==null?a:c,i)}else s[o]=i;return s}var ie={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}},Gg={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"},Sr={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},Zi={color:"#1C52DC",contrastColor:"#FFFFFF",underline:!0},Ue={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:ie.border,borderRadius:ie.borderRadius,textAlign:"center",padding:ie.padding},ea={backgroundColor:"#FFFFFF",contrastBackgroundColor:"#1C52DC",padding:ie.padding},wr={contrastBackgroundColor:"#1C52DC",contrastTextColor:"#FFFFFF",baseBackgroundColor:"#F8F8F8",baseTextColor:"#333333",border:ie.border,borderRadius:ie.borderRadiusCards};function Yg(e){return{...Gg,...e}}function Wg(e){return{...Sr,...e,bold:e?.bold??Sr.bold,italic:e?.italic??Sr.italic}}function qg(e){return{...Zi,...e,underline:e?.underline??Zi.underline}}function zg(e){return{...Ue,...e,bold:e?.bold??Ue.bold,italic:e?.italic??Ue.italic,border:{...Ue.border,...e?.border},borderRadius:{...Ue.borderRadius,...e?.borderRadius},padding:{...Ue.padding,...e?.padding}}}function Kg(e){return{...ea,...e,padding:{...ea.padding,...e?.padding}}}function Xg(e){return{...wr,...e,border:{...wr.border,...e?.border},borderRadius:{...wr.borderRadius,...e?.borderRadius}}}function Ir(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 ta(e){let t={...l.COMMON_STYLES};try{e&&e!=="{}"&&(t=JSON.parse(e))}catch{}return t}function Tr(e){return{text:Yg(e.text),headings:Wg(e.headings),links:qg(e.links),buttons:zg(e.buttons),block:Kg(e.block),cards:Xg(e.cards)}}var na=l.createIdentifier$1("EmailSettingsPort"),Jg=1e4,ra=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(!vi(this._editor.container)||!Me(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(na);if(!t)throw new Error("[extensions] email settings are not loaded yet — UI work starts at init()");return t}_getCurrentLayoutSettings(){return Ir(this._settings().read())}_getCurrentContentStyles(){const e=Me(this._editor.container)?.current()?.get().attributes.common_styles;return Tr(ta(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(na),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 s=r?.data,o=s?.operation;if(o===l.EVENT_TYPES.APPLICATION_EMAIL_SETTINGS_SET){const c=Ir(s?.settings),d=this._getLayoutSnapshot(c);d!==this._prevLayoutSnapshot&&(this._prevLayoutSnapshot=d,this._layoutSettingsChanged.fire(c));return}if(o!==l.EVENT_TYPES.APPLICATION_COMMON_STYLES_UPDATE)return;const i=Tr(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=Ir(n);this._prevLayoutSnapshot=this._getLayoutSnapshot(r),this._layoutSettingsChanged.fire(r)}async _waitForEmailSettingsFromIframe(e=Jg){const t=Me(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,s=l.getEvent(r,l.events.ON_EMAIL_INIT_ID);return new Promise(o=>{let i=!1,a;const c=()=>{a&&(clearTimeout(a),a=void 0)},d=s(()=>{i||(i=!0,c(),d.dispose(),o())});a=setTimeout(()=>{i||(i=!0,d.dispose(),o())},e)})}async getEmailContentStyles(){return this._getCurrentContentStyles()}async setEmailContentStyles(e){const t=Me(this._editor.container)?.current();if(!t)return;const n=ta(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=yr(n.buttons||{},e.buttons,["border","borderRadius","padding"],{border:ie.border,borderRadius:ie.borderRadius,padding:ie.padding})),e.block!==void 0&&(n.block=yr(n.block||{},e.block,["padding"],{padding:ie.padding})),e.cards!==void 0&&(n.cards=yr(n.cards||{},e.cards,["border","borderRadius"],{border:ie.border,borderRadius:ie.borderRadiusCards}));const r=JSON.stringify(n);Ke(t,{common_styles:r},{source:"system"}),this._settings().markAppearanceChanged();const s=Tr(n);this._prevContentSnapshot=this._getContentSnapshot(s),this._contentStylesChanged.fire(s)}},Qg={...Qi,EmailSettingsApi:ra},Zg={...Qi},g_={...Zg,EmailSettingsApi:ra},eE={...Qg};function tE(){Wi.addAll(eE)}var nE=[l.defineMixin(()=>{tE()}),Km,ig,zm,l.JWTMixin,Wm,l.OAuthMixin];async function rE(){return(await ct()).asyncMixins}var sE=Dg,oE=e=>{let t=null,n=!1;return{instance:{},async setOptions(r){if(!t&&!n){let s;try{s=await rE()}catch(i){throw e.failPendingWaits(i),i}t=s(e);const o=await e.getInstanceAsync(l.INSTANCE_ID);Object.assign(o,t.instance||{});for(const i of e.getInstance(l.LATE_SURFACE_LISTENERS_ID)??[])i()}t&&await t.setOptions(r)},dispose(){t?.dispose(),n=!0}}},iE=l.combineMixins([...nE]);function Cr(){let e,t=!1;const n=new Map,r=new Map;function s(){for(const o of r.values())o();r.clear()}return{event(o,i,a){const c=Symbol("subscription");return t||(n.set(c,{listener:o,priority:i,thisArg:a}),e&&r.set(c,e(o,i,a))),()=>{n.delete(c),r.get(c)?.(),r.delete(c)}},attach(o){s(),e=o;for(const[i,{listener:a,priority:c,thisArg:d}]of n)r.set(i,o(a,c,d))},dispose(){t=!0,s(),n.clear(),e=void 0}}}function aE(e){const t=Cr(),n=Cr(),r=Cr();return e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{t.dispose(),n.dispose(),r.dispose()}),e.getInstanceAsync(je).then(s=>{t.attach(s.onNotify),n.attach(s.onError),r.attach(s.onSuccess)},()=>{}),{handleNotify:t.event,handleError:n.event,handleSuccess:r.event,notify(s){const o=e.getInstance(je);if(o){o.notify(s);return}e.getInstanceAsync(je).then(i=>i.notify(s),()=>{})}}}var sa=l.createIdentifier$1("CodeErrors"),lE=[];function cE(e){return e?.getInstance(sa)?.get()??lE}function dE(e){return e?.getInstance(sa)!==void 0}var uE=class extends l.Disposable{_container;_dataSources;_currentEmail;_blockMetaWrites=Promise.resolve();constructor(e){super(),this._container=e,this._dataSources=rt(e),this.addDisposable(l.getEvent(e,l.events.ON_EMAIL_CHANGED_ID)(t=>{this._currentEmail=t}))}openEmail(){return li(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=>ot(t,this._container))}async _readProjectBlocks(){const e=await Ih(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=>it(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=>tr(n,this._container))}async getEmailSnapshot(){return oe(this.openEmail(),this._container)}setEmailMeta(e){const t=Qn(this._container);if(!t)return;const n=t.get().attributes.meta;Ke(t,{meta:Yn({meta:n},e).meta});const r=t.get().serverId;r!=null&&this._dataSources.emails.cache.addOrUpdate(r,s=>s&&Yn(s,e))}setBlockMeta(e,t){const n=async()=>{await this._readProjectBlocks();const{cache:r}=this._dataSources.blocks;await r.getIfPresent(e)&&await r.addOrUpdate(e,s=>s&&Yn(s,t))};this._blockMetaWrites=this._blockMetaWrites.then(n).catch(()=>{})}getCodeErrors(){return dE(this._container)?cE(this._container):void 0}},fE=l.createIdentifier$1("EmailDataController");function pE(e){return e.getOrCreateInstance(fE,()=>{const t=new uE(e);return e.getInstance(l.DISPOSABLE_ID)?.addDisposable(t),t})}function hE(e){const t=pE(e);return{getEmailSnapshot:()=>t.getEmailSnapshot(),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 mE(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 gE(e){let t;const n=Ho(e),r=l.getEvent(e,l.events.ON_DOCUMENT_SESSION_CHANGE);n.addDisposable(r(({history:o})=>{t=o}));const s=()=>t?mE(t):void 0;return{undoRedoService:{undo:()=>s()?.undo(),redo:()=>s()?.redo(),clear:()=>s()?.clear(),getPast:o=>s()?.getPast(o)??[],getFuture:o=>s()?.getFuture(o)??[],canUndo:()=>s()?.canUndo()??!1,canRedo:()=>s()?.canRedo()??!1,createSnapshot:()=>s()?.createSnapshot(),restoreSnapshot:o=>s()?.restoreSnapshot(o)}}}var EE=l.createIdentifier$1("plugin.mountElement");function vE(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 _E(e){return e.getOrCreateInstance(EE,()=>{let t=!1,n;return{get:()=>t?n:vE(e),set(r){t=!0,n=r}}})}function bE(e){const t=_E(e);return{getElement:()=>t.get()}}function yE(e){return{handleLoadImage:B(l.getEvent(e,l.events.UPLOAD_EVENT_ID)),handleFileProxy:B(l.getEvent(e,l.events.FILE_PROXY_EVENT_ID)),handleUrlProxy:B(l.getEvent(e,l.events.PROXY_URL_EVENT_ID)),handleAITextRequest:B(l.getEvent(e,l.events.AI_TEXT_REQUEST_ID)),handleAIImageRequest:B(l.getEvent(e,l.events.AI_IMAGE_REQUEST_ID)),handleReadLocale:B(l.getEvent(e,l.events.READ_LOCALE)),handleLimitUsage:B(l.getEvent(e,l.events.ON_LIMIT_ID)),handleTranslate:B(l.getEvent(e,l.events.ON_TRANSLATE_ID))}}var SE=[dp,mm,aE,og,hE,gE,bE,yE];function wE(e,t=SE){const n=lr(e);Vm(e);const r=iE(e),s=sE(e),o=oE(e),i={...r.instance,...s.instance,...o.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 s.setOptions(c),await o.setOptions(c)}}}function IE(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 TE=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]}},CE="editor-runtime.react.copies",Ar=8;function dt(e){return e&&typeof e=="object"?e:void 0}function oa(e){const t=dt(e);if(!t)return;if(typeof t.useState=="function")return t.useState;const n=dt(t.default);return n&&typeof n.useState=="function"?n.useState:void 0}function AE(e){const t=dt(e),n=t&&typeof t.version=="string"?t.version:void 0,r=dt(t?.default),s=r&&typeof r.version=="string"?r.version:void 0;return n??s??"unknown"}function DE(e,t,n){return e.package===t&&e.version===n}function PE({ourReact:e,entries:t,packageName:n,version:r}){const s=oa(e);if(!s||!Array.isArray(t))return[];const o=[],i=new Set;for(const a of t){const c=dt(a);if(!c||!DE(c,n,r))continue;const d=oa(c.react);!d||d===s||i.has(d)||(i.add(d),o.push({package:n,version:r,reactVersion:AE(c.react),react:c.react}))}return o}function RE({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,Ar))n.push(` • React ${r.reactVersion}, loaded through ${r.package}@${r.version}/runtime/react`);return t.length>Ar&&n.push(` …and ${t.length-Ar} 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 ia=new Set;function OE({packageName:e="useblocks",version:t="1.1.104",log:n=r=>{}}={}){const r=s=>{try{const o=globalThis[Symbol.for(CE)],i=PE({ourReact:s,entries:o,packageName:e,version:t}).filter(a=>!ia.has(a.react));if(!i.length)return;i.forEach(a=>ia.add(a.react)),n(RE({packageName:e,copies:i}))}catch{}};try{const s=Qt()?.modules?.React;if(s&&typeof s.then=="function"){s.then(r,()=>{});return}r(s)}catch{}}async function ME(e,t,n){l.throwIfAborted(e.signal);const r=t??l.DependencyResolver.createChild();lr(r);const s=r.getInstance(l.DISPOSABLE_ID);let o;async function i(){r.inject(l.COOKIE_MANAGER_ID,IE(new TE)),OE();const a=wE(r),c={...a.instance,container:r,get ready(){return o??Promise.resolve(c)},async reset(d){if(l.throwIfAborted(d.signal),s.isDisposed())throw ge();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),s.isDisposed()||await fm(r),e.devTools)try{const d=r.getInstance(l.PLUGIN_COLLECTION_ID);d&&await(await ct()).initDevTools(r,d)}catch{}return l.throwIfAborted(e.signal),l.getEmitter(r,l.APP_LOAD_EVENT_ID).fire(c),c}catch(d){throw s.dispose(),d}}try{return o=l.raceWithAbortSignal(i(),e.signal),o.catch(()=>{}),await o}catch(a){throw s.isDisposed()||s.dispose(),a}}var ut=new WeakMap;function LE(e){return e?ut.get(e):void 0}function aa(e){try{e.getInstance(l.DISPOSABLE_ID)?.dispose()}catch{}try{e.dispose()}catch{}}function NE(e,t){if(!e)return;const n=ut.get(e);n&&n!==t&&aa(n),ut.set(e,t)}function xE(e,t){e&&ut.get(e)===t&&ut.delete(e)}function kE(e){const t=l.DependencyResolver.createChild();return Qe(e)&&t.inject(l.SECURITY_MODULE_ID,Rt(e)),t}var ft=new WeakMap,FE="data-useblocks-config-styles";function BE(e){return typeof e=="string"?e.trim():""}function la(e,t){if(e.firstChild){e.insertBefore(t,e.firstChild);return}e.appendChild(t)}function jE(e,t,n){if(!e||typeof document>"u")return null;const r=BE(t),s=ft.get(e),o=n||e;if(!r)return s&&(s.remove(),ft.delete(e)),null;if(s)return s.textContent!==r&&(s.textContent=r),(s.parentNode!==o||s!==o.firstChild)&&la(o,s),s;const i=document.createElement("style");return i.setAttribute(FE,"true"),i.textContent=r,la(o,i),ft.set(e,i),i}function UE(e){if(!e)return;const t=ft.get(e);t&&(t.remove(),ft.delete(e))}var E_=!1;function ca(){return!1}var v_=28,HE=`
|
|
2154
2154
|
.blocks-app-initial-spinner-wrapper {
|
|
2155
2155
|
width: 100%;
|
|
2156
2156
|
height: 100%;
|
|
@@ -2179,11 +2179,11 @@ __useblocks__.define("useblocks.js",["require","exports","module","static/umd/b1
|
|
|
2179
2179
|
100% {
|
|
2180
2180
|
transform: rotate(360deg);
|
|
2181
2181
|
}
|
|
2182
|
-
}`;function UE(){return()=>{}}function HE(e,t){if(!la()||!e||typeof document>"u")return UE();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 s=document.createElement("style");s.setAttribute(t,"true"),s.textContent=jE,document.head?.appendChild(s),e.appendChild(n);let o=!1;return()=>{o||(o=!0,n.remove(),s.remove())}}function $E(e){if(!(e instanceof Error))return!1;const t=e;return t.terminal===!0||t.status===403||t.status===404}function VE({report:e}={}){const t=new Map,n=new Set,r=e??(s=>{});return{run(s,o){const i=t.get(s);if(i!==void 0)return i;const a=o().catch(c=>{throw n.has(s)||(n.add(s),r(c)),$E(c)||t.delete(s),c});return t.set(s,a),a},clear(){t.clear(),n.clear()},size(){return t.size}}}var Dr=VE();function ca(){Dr.clear()}l.setApiOriginFailoverHook(()=>Dr.clear());var da=new WeakMap;function Pr(e){return l.resolveExplicitApiBaseUrl(e)}function GE(e,t){const n=new Error(`[Loader] appInit request failed: ${e} ${t}`);return n.status=e,n}function YE(){const e=new Error("[Loader] appInit skipped: empty auth token");return e.terminal=!0,e}async function WE(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 Rr=new WeakMap;function Or(e,t){Rr.set(e,t)}function qE(e){return Rr.get(e)}function zE(e,t){return async({baseUrl:n})=>{const r=t(),s=r&&Rr.get(r)||e,o=Pr(n);if(!o)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 WE(s);if(s.getAuthToken&&!a)throw YE();a&&i.set("authorization",a);const c=await l.fetchWithApiOriginFailover("/app/v1/app_init",{method:"POST",headers:i,body:new URLSearchParams,credentials:"same-origin"},o,{attemptTimeout:$n(s)||void 0});if(!c.ok)throw GE(c.status,c.statusText);return await c.json()}}function KE(e){return JSON.stringify({baseUrl:Pr(e.baseUrl)||"",project:e.project??"",userId:e.user?.id??""})}function XE(e){return e.appInit?!0:!(e.jwtAuth&&!e.getAuthToken)}function JE(e){return t=>Dr.run(KE(t),()=>(W("appInit:start",{kind:"network"}),Promise.resolve(e(t)).finally(()=>W("appInit:end",{kind:"network"}))))}function QE(e,t){if(Qe(e)||!e.appInit&&!Pr(e.baseUrl)||!XE(e))return e;const n=e.appInit??zE(e,t);let r=da.get(n);return r||(r=JE(n),da.set(n,r)),{...e,appInit:r}}var ua=0;function ZE(){return ua}function ev(){ua+=1,ca()}var fa=new WeakMap,pa=new WeakMap,tv=3e4;function nv(e,t){return JSON.stringify({userId:e?.id??"",project:t??""})}function rv(e,t){try{const n=l.decodeJwt(e)?.exp;if(typeof n=="number"&&Number.isFinite(n)&&n>0)return n*1e3}catch{}return t+tv}function sv(e){const t=new Map,n=new Map;return async(r,s,o)=>{const i=nv(r,s);if(o)return n.delete(i),t.delete(i),ca(),e(r,s,o);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&&(W("authToken:start",{kind:"network"}),c=Promise.resolve(e(r,s,o)).then(d=>{const u=String(d||"").trim();return u&&n.set(i,{token:d,expiresAtMs:rv(u,Date.now())}),d}).finally(()=>{W("authToken:end",{kind:"network"}),t.delete(i)}),t.set(i,c)),c}}function ov(e){if(Qe(e))return e;const t=e.getAuthToken;if(!t)return e;let n=fa.get(t);const r=ZE();return(!n||pa.get(t)!==r)&&(n=sv(t),fa.set(t,n),pa.set(t,r)),Promise.resolve(n(e.user,e.project,void 0)).catch(s=>{}),{...e,getAuthToken:n}}var iv="[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 av(e){const t=new Error(iv,{cause:e});return t.name="EditorStartFailedError",t}var lv={getConfig:"await `ready` first",use:"use `useAsync()` or await `ready` first"};function ha(e){return new Error(`[emailmaker] \`${e}\` is not available on this editor`)}var ma=["handleLoad","handleDestroy"];function ga(e,t){let n=e;for(const r of ma){const s=e?.[r];typeof s=="function"&&(n={...n,[r]:(o,...i)=>s(t,...i)})}return n}function cv(e){let t,n="pending",r,s,o,i;const a=new Set,c=[],d=new Set;let u,f;const g=new Promise((I,P)=>{u=I,f=P});g.catch(()=>{});const E={},S=I=>t?.[I],b=()=>r??me(),h=(I,P)=>{const x=S(I);if(typeof x!="function")throw ha(I);return x.apply(t,P)},y=(I,P)=>{try{return Promise.resolve(h(I,P))}catch(x){return Promise.reject(x)}},w=()=>{const I=t?.container?.getInstance?.(l.DISPOSABLE_ID);if(!(n!=="ready"||I?.isDisposed()||typeof S("getConfig")!="function"))try{i=h("getConfig",[])}catch{}},A=()=>n==="dead"?Promise.reject(b()):n==="ready"?Promise.resolve():g,D=()=>{for(const[I,P]of Ht)P==="field"&&(E[I]=S(I))},N=I=>{const P=S(I.name);I.dispose||typeof P!="function"||n==="dead"||(I.dispose=P.apply(t,I.args))},m=()=>a.forEach(N),_=()=>{for(const I of a){try{I.dispose?.()}catch{}I.dispose=void 0}},C=()=>{D(),m()},M=()=>{o?.delete(C),o=void 0},p=(I,P)=>{const[x,...J]=P;return!ma.includes(I)||typeof x!="function"?P:[(re,...z)=>x(E,...z),...J]},v=(I,P)=>{if(n==="dead")return()=>{};if(n==="ready"&&typeof S(I)!="function")throw ha(I);const x={name:I,args:p(I,P)};return a.add(x),N(x),()=>{a.delete(x),x.dispose?.(),x.dispose=void 0}},T=()=>t?.container?.getInstance(l.OPTIONS_SOURCE_ID)?.get()?.content,L=()=>{const I=e.element();return I!==void 0&&typeof I!="string"?I:void 0},O=(I,P)=>{switch(P){case"event":return(...x)=>v(I,x);case"async":return(...x)=>(I==="show"&&x[0]!==void 0&&e.shown?.(x[0]),n!=="dead"&&typeof S(I)=="function"?y(I,x):A().then(()=>h(I,x)));case"queued":return(...x)=>{if(n==="dead"){if(I==="notify")return;throw b()}if(n==="pending"){c.push({name:I,args:x});return}return h(I,x)};case"sync":return(...x)=>{if(n==="dead"){if(I==="getConfig")return i;throw b()}if(typeof S(I)!="function")throw new Error(`[emailmaker] \`${I}\` is not available before the editor is ready: ${lv[I]??"await `ready` first"}`);const J=h(I,x);return I==="getConfig"&&(i=J),J};case"element":return()=>{if(typeof S(I)!="function")return L();try{return h(I,[])}catch{return L()}};case"codeErrors":return()=>n==="ready"&&typeof S(I)=="function"?h(I,[]):[];case"field":return}};for(const[I,P]of Ht)E[I]=O(I,P);E.reset=I=>(I?.content!==void 0&&e.shown?.(I.content),A().then(async()=>{const P=I?.content!==void 0&&l.deepEqual(I.content,T());await h("reset",[ga(I,F)]),P&&await h("show",[I.content])}).then(()=>E)),E.destroy=()=>{if(n==="dead")return;const I=l.createAbortError("[emailmaker] editor was destroyed before it was ready");s?.catch(()=>{}),d.forEach(P=>P(I)),w(),e.destroy()},Object.defineProperty(E,"ready",{get:()=>s,enumerable:!0,configurable:!0});const F=E;return{object:F,get state(){return n},get editor(){return t},bind:I=>{n==="dead"||t===I||(_(),M(),t=I,D(),m(),n==="pending"&&(o=I.container.getOrCreateInstance(l.LATE_SURFACE_LISTENERS_ID,()=>new Set),o.add(C)))},settle:()=>{if(n==="pending"){n="ready",M(),D(),m();for(const I of c.splice(0))try{h(I.name,I.args)}catch(P){queueMicrotask(()=>{throw P})}u()}},kill:(I,P)=>{n!=="dead"&&(w(),n="dead",r=I,c.length=0,d.forEach(x=>x(I)),M(),P?.keepSubscriptions||(_(),a.clear()),f(I))},detach:()=>{_(),a.clear()},setReady:I=>{s=I},trackCall:I=>(d.add(I),()=>d.delete(I)),hasCalls:()=>d.size>0}}var Mr="Editor mount element was removed from the document. Call instance.destroy() on host unmount.";function dv(){return l.createAbortError(Mr)}function Ea(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===Mr}function uv(e,t,n){if(typeof document>"u")return;let r=!1,s;const o=()=>{r=!0,s?.disconnect(),s=void 0},i=()=>{r||(o(),t())};if(n.addDispose(o),!e.isConnected){queueMicrotask(i);return}s=new MutationObserver(()=>{e.isConnected||i()});let a=e.parentNode;for(;a;)s.observe(a,{childList:!0}),a=a.parentNode}function fv(e){const{hostElementOption:t,resolvedElement:n,externalSignal:r,disposable:s}=e;if(t===void 0||!(n instanceof Element))return r;const o=new AbortController;return uv(n,()=>{n.id,o.abort(dv())},s),l.composeAbortSignals(r,o.signal)}var Lr="Superseded by newer init() on the same mount element";function va(){return l.createAbortError(Lr)}function _a(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===Lr}var pt=new Map,ba=new WeakMap,Vt=new WeakMap;function pv(e){if(e instanceof Element){const t=e.id?.trim();if(t)return`#${t}`}}function hv(e,{supersede:t=!1}={}){if(!e)return{previous:Promise.resolve(),release:()=>{}};const n=pv(e);(n?pt.get(n):void 0)?.forEach(u=>{u.element!==e&&u.controller.abort(va())});const r=ba.get(e)??new Set;t&&r.forEach(u=>{u.supersedable&&u.controller.abort(va())});const s=Vt.get(e)??Promise.resolve();let o;const i=new Promise(u=>{o=u}),a=s.then(()=>i);Vt.set(e,a),a.then(()=>{Vt.get(e)===a&&Vt.delete(e)});const c=new AbortController,d={element:e,controller:c,supersedable:t};if(r.add(d),ba.set(e,r),n){const u=pt.get(n)??new Set;u.add(d),pt.set(n,u)}return{signal:c.signal,previous:s,release:()=>{o(),r.delete(d);const u=n?pt.get(n):void 0;n&&u?.delete(d)&&u.size===0&&pt.delete(n)}}}var ht=new WeakMap;function Nr(e,t){return typeof t=="function"&&(/^(handle|on)[A-Z]/.test(e)||e==="getAuthToken")}function xr(e){return Object.entries(e).filter(([t,n])=>Nr(t,n)).map(([t])=>t).sort()}function ya(e){const t={};for(const[n,r]of Object.entries(e))n!=="signal"&&!Nr(n,r)&&(t[n]=r);return t}function kr(e,t,{fresh:n=!1}={}){if(!e)return t;let r=n?void 0:ht.get(e);r||(r={current:new Map,trampolines:new Map,lastOptions:t},ht.set(e,r));const{current:s,trampolines:o}=r;s.clear();const i={...t};for(const a of xr(t)){s.set(a,t[a]);let c=o.get(a);c||(c=(...d)=>s.get(a)?.(...d),o.set(a,c)),i[a]=c}return r.lastOptions=t,i}function Sa(e,t){const n=e?ht.get(e):void 0;if(n)for(const r of n.trampolines.keys()){const s=t[r];Nr(r,s)?n.current.set(r,s):n.current.delete(r)}}function mv(e){const t=e?ht.get(e):void 0;if(!t)return()=>{};const n=new Map(t.current),{lastOptions:r}=t;return()=>{t.current.clear(),n.forEach((s,o)=>t.current.set(o,s)),t.lastOptions=r}}function gv(e,t,n){const r=e?ht.get(e):void 0;if(!r||!n)return!1;const s=xr(t),o=l.deepEqual(s,xr(r.lastOptions)),i=s.every(a=>a==="getAuthToken"||n[a]===r.trampolines.get(a));return!o||!i||!l.deepEqual(ya(t),ya(r.lastOptions))?!1:(kr(e,t),!0)}var le=new WeakMap,E_=0;function Gt(e){let t=le.get(e);return t||(t={counted:new Set,leaving:new Set,order:[],options:new Map,latestCall:0,warned:!1},le.set(e,t)),t}var ve=e=>e!==void 0&&e.state!=="dead";function Ev(e){const t=le.get(e)?.shared;return ve(t)?t:void 0}function vv(e,t){Gt(e).shared=t}function _v(e,t){!(ve(e.shared)&&[...e.counted].some(ve))||e.warned||!t.devTools||(e.warned=!0)}function bv(e,t,n,r){const s=Gt(e);return s.latestCall+=1,s.releaseTimer!==void 0&&(clearTimeout(s.releaseTimer),s.releaseTimer=void 0),s.leaving.forEach(o=>o.detach()),s.leaving.clear(),n==="single"?s.shared=t:s.counted.add(t),s.options.set(t,r),s.order=[...s.order.filter(o=>o!==t&&ve(o)),t],_v(s,r),s.latestCall}function yv(e,t){return le.get(e)?.latestCall===t}function Sv(e){const t=le.get(e);if(t)return t.order=t.order.filter(ve),t.order.at(-1)?.object}function mt(e,t){const n=le.get(e);return n?ve(n.shared)&&n.shared!==t||[...n.counted].some(r=>r!==t&&ve(r)):!1}function Iv(e,t){const n=le.get(e),r=n?.order.filter(s=>s!==t&&ve(s)).at(-1);return r?n?.options.get(r):void 0}function Ia(e,t){Gt(e).content={value:t}}function wv(e){return le.get(e)?.content}function Tv(e,t,n,r){const s=Gt(e);if(s.counted.delete(t),s.options.delete(t),mt(e)){t.kill(n);return}t.kill(n,{keepSubscriptions:!0}),s.leaving.add(t),wa(e,r)}function wa(e,t){const n=le.get(e);!n||mt(e)||n.releaseTimer!==void 0||(n.releaseTimer=setTimeout(()=>{n.releaseTimer=void 0,!mt(e)&&(t(),n.leaving.forEach(r=>r.detach()),n.leaving.clear())},0))}function Cv(e,t){const n=le.get(e);if(n){n.releaseTimer!==void 0&&clearTimeout(n.releaseTimer);for(const r of[n.shared,...n.counted,...n.leaving])r?.kill(t);le.delete(e)}}var Av=Kt.__exportAll({FileManagerApiError:()=>Dv,IntegratorSaveTimeoutError:()=>an,SaveRefusedError:()=>Ye}),Dv=class Da extends Error{code;status;details;get httpStatus(){return this.status}constructor(t,n,r,s){super(t),this.name="FileManagerApiError",this.code=n,this.status=r,this.details=s,Error.captureStackTrace&&Error.captureStackTrace(this,Da)}},Pv=Kt.__exportAll({mapHttpStatusToErrorCode:()=>l.mapHttpStatusToErrorCode});function Rv(e,t){return{...e,element:t}}function Fr(){return()=>{}}function Ov(e){const t=e.element;return!t||typeof t=="string"||typeof document>"u"?Fr():(FE(t,e.config?.styles,t),()=>{BE(t)})}function Mv(e){if(!la()||e.initialSpinner===!1||typeof document>"u")return{options:e,cleanup:Fr()};const t=e.element;if(!t||typeof t=="string")return{options:e,cleanup:Fr()};t.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(s=>{s.remove()});const n=HE(t,"data-useblocks"),r=e.handleChunkLoaded;return{options:{...e,handleChunkLoaded:()=>{n(),r?.()}},cleanup:n}}function Lv(e,t){if(e.appInit||!("appInit"in t))return t;const n={...t};return delete n.appInit,n}function Yt(e){try{e.destroy()}catch{}}function Wt(e,...t){const n=l.ELEMENT_MAP.get(e);t.some(r=>r!==void 0&&r===n)&&l.ELEMENT_MAP.delete(e)}var Nv="1.1.102";async function xv(e){An(),await dg(typeof __useblocks__<"u"?__useblocks__:void 0)}async function kv(e){return Ta(e).ready}function Fv(e){if(typeof e!="string")return e??void 0;try{return document.querySelector(e)??void 0}catch{return}}function Bv(e){const t=l.ELEMENT_MAP.get(e);return t&&!(t instanceof Promise)?t:void 0}function qt(e,t,n){const r=t??Bv(e);r&&(Wt(e,r),Yt(r)),Cv(e,n)}function jv(e){const{control:t,mode:n,ref:r}=e,s=r.host;if(!s){const i=t.editor;Uv(i),t.kill(me());return}if(n==="single"){qt(s,t.editor,me());return}const o=Iv(s,t);Tv(s,t,me(),()=>qt(s,t.editor,me())),o&&mt(s)&&Sa(s,o)}function Uv(e){e&&Yt(e)}function Ta(e){W(te.initStart);const t=e.ownership==="counted"?"counted":"single",n=new AbortController,r=l.composeAbortSignals(e.signal,n.signal),s=t==="single"?Fv(e.element):void 0,o=s?Ev(s):void 0;let i;if(o)i={control:o,mode:t,ref:{host:s}};else{const u={},f=cv({element:()=>u.host??e.element,destroy:()=>jv(i),shown:g=>{u.host&&Ia(u.host,g)}});i={control:f,mode:t,ref:u},s&&vv(s,f)}const{control:a}=i,c=a.trackCall(u=>n.abort(u)),d=Wv(ga({...e,signal:r},a.object),i).then(()=>(c(),W(te.initEnd),a.settle(),a.object),u=>{c(),a.state==="pending"&&!a.hasCalls()&&a.kill(u);const f=i.ref.host;throw f&&wa(f,()=>qt(f,void 0,me())),u});return a.setReady(d),a.object}function Hv(e){const t=typeof e=="string"?document.querySelector(e):e;return t?Sv(t):void 0}function $v(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 s=Me(e.container)?.current();r=s!==void 0&&s.get().savedVersion!==null&&s.isDirty()}catch{t=void 0}return{options:t,signal:n,email:Vv(e),dirty:r}}async function Vv(e){try{return await e.getEmailSnapshot()}catch{return}}function Gv(e){const t=Me(e.container)?.current();t?.whenReady().then(()=>t.markUnsaved()).catch(()=>{})}function Ca(e,t){const{control:n,mode:r}=t;return r==="single"&&n.state==="ready"||mt(e,n)}async function Yv(e,t,n,r,s){if(r.mode==="counted"&&r.control.detach(),_a(s)||Ea(s))return;const o=()=>qt(t,e,av(s)),{options:i}=n;if(!i||!Ca(t,r)){o();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&&Gv(e),Ca(t,r)?l.ELEMENT_MAP.set(t,e):o()}catch{o()}}async function Wv(e,t){l.throwIfAborted(e.signal);const n=new l.Disposable;let r,s,o,i,a=0;try{const c=await l.waitForElement(e.element,n,e.signal);c&&(i=c,t.ref.host=c,a=bv(c,t.control,t.mode,e));const d=fv({hostElementOption:e.element,resolvedElement:c,externalSignal:e.signal,disposable:n}),u=hv(c,{supersede:t.mode==="single"});r=u.release;const f=l.composeAbortSignals(d,u.signal);l.throwIfAborted(f),o=mv(c),Sa(c,e),await l.raceWithAbortSignal(u.previous,f),s=qv(e,c,t,f,o);const g=await l.raceWithAbortSignal(s,f);return c&&e.content!==void 0&&Ia(c,e.content),g}catch(c){throw i&&o&&yv(i,a)&&o(),c}finally{const c=r;s!==void 0&&c?s.then(c,c):c?.(),n.dispose()}}async function Aa(e,t,n,r){const s=wv(t);n===void 0||r||!s||l.deepEqual(n,s.value)||await e.show(n)}async function qv(e,t,n,r,s){const{control:o}=n,i=b=>o.bind(b);l.throwIfAborted(r);let a;const c=b=>{ev();const h=ov(Rv(b,t)),y=QE(h,()=>a);return{preparedOptions:y,preparedOptionsWithSignal:r!=null?{...y,signal:r}:y}};let d;if(t){const b=l.ELEMENT_MAP.get(t);if(b){let h;try{h=await b,l.throwIfAborted(r)}catch{l.throwIfAborted(r),Wt(t,b),h=void 0}if(h)if(h.getElement()===t){const y=OE(t);a=y;const w=h.container.getInstance(l.OPTIONS_SOURCE_ID)?.get();if(gv(t,e,w))return i(h),r&&h.container.getInstance(l.INIT_PIPELINE_ID)?.relinkExternalSignal(r),l.ELEMENT_MAP.set(t,h),await Aa(h,t,e.content,!1),h;const A=!l.deepEqual(e.content,w?.content);d=c(kr(t,e));const{preparedOptions:D,preparedOptionsWithSignal:N}=d,m=y&&qE(y),_=$v(h);try{y&&Or(y,D),i(h);const C=await h.reset(Lv(e,N));return l.throwIfAborted(r),l.ELEMENT_MAP.set(t,h),await Aa(h,t,e.content,A),C}catch(C){if(y&&m&&Or(y,m),!Za(C))throw s(),await Yv(h,t,_,n,C),C;Wt(t,b,h),Yt(h),l.throwIfAborted(r)}}else Wt(t,b,h),Yt(h)}}l.throwIfAborted(r),d??=c(kr(t,e,{fresh:!0}));const{preparedOptions:u}=d,f=Ov(u),g=Mv(u),E=r!=null?{...g.options,signal:r}:g.options;let S;try{a=NE(E),ME(t,a),Or(a,u),lr(a).set(E),await hr(),W(te.coreReady),l.throwIfAborted(r),l.throwIfAborted(r),S=RE(E,a,{onInstance:i}),t&&l.ELEMENT_MAP.set(t,S);const b=await S;if(r?.aborted&&(b.destroy(),l.throwIfAborted(r)),t)if(l.ELEMENT_MAP.get(t)===S)l.ELEMENT_MAP.set(t,b);else throw b.destroy(),l.throwIfAborted(r),l.createAbortError(r?.reason);return b}catch(b){throw f(),g.cleanup(),a&&(ia(a),LE(t,a)),t&&S&&l.ELEMENT_MAP.get(t)===S&&l.ELEMENT_MAP.delete(t),b}}async function zv(e){return(await ct()).parseAMP(e)}typeof window<"u"&&(He()&&Ja(),fg(typeof __useblocks__<"u"?__useblocks__:void 0)),ne.ELEMENT_DETACHED_ABORT_MESSAGE=Mr,ne.SUPERSEDED_INIT_ABORT_MESSAGE=Lr,ne.create=Ta,Object.defineProperty(ne,"errors",{enumerable:!0,get:function(){return Av}}),ne.getInstance=Hv,Object.defineProperty(ne,"helpers",{enumerable:!0,get:function(){return Pv}}),ne.init=kv,ne.isElementDetachedError=Ea,ne.isSupersededInitError=_a,ne.parseAMP=zv,ne.pluginRegistry=Yi,ne.preload=xv,ne.version=Nv});
|
|
2182
|
+
}`;function $E(){return()=>{}}function VE(e,t){if(!ca()||!e||typeof document>"u")return $E();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 s=document.createElement("style");s.setAttribute(t,"true"),s.textContent=HE,document.head?.appendChild(s),e.appendChild(n);let o=!1;return()=>{o||(o=!0,n.remove(),s.remove())}}function GE(e){if(!(e instanceof Error))return!1;const t=e;return t.terminal===!0||t.status===403||t.status===404}function YE({report:e}={}){const t=new Map,n=new Set,r=e??(s=>{});return{run(s,o){const i=t.get(s);if(i!==void 0)return i;const a=o().catch(c=>{throw n.has(s)||(n.add(s),r(c)),GE(c)||t.delete(s),c});return t.set(s,a),a},clear(){t.clear(),n.clear()},size(){return t.size}}}var Dr=YE();function da(){Dr.clear()}l.setApiOriginFailoverHook(()=>Dr.clear());var ua=new WeakMap;function Pr(e){return l.resolveExplicitApiBaseUrl(e)}function WE(e,t){const n=new Error(`[Loader] appInit request failed: ${e} ${t}`);return n.status=e,n}function qE(){const e=new Error("[Loader] appInit skipped: empty auth token");return e.terminal=!0,e}async function zE(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 Rr=new WeakMap;function Or(e,t){Rr.set(e,t)}function KE(e){return Rr.get(e)}function XE(e,t){return async({baseUrl:n})=>{const r=t(),s=r&&Rr.get(r)||e,o=Pr(n);if(!o)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 zE(s);if(s.getAuthToken&&!a)throw qE();a&&i.set("authorization",a);const c=await l.fetchWithApiOriginFailover("/app/v1/app_init",{method:"POST",headers:i,body:new URLSearchParams,credentials:"same-origin"},o,{attemptTimeout:$n(s)||void 0});if(!c.ok)throw WE(c.status,c.statusText);return await c.json()}}function JE(e){return JSON.stringify({baseUrl:Pr(e.baseUrl)||"",project:e.project??"",userId:e.user?.id??""})}function QE(e){return e.appInit?!0:!(e.jwtAuth&&!e.getAuthToken)}function ZE(e){return t=>Dr.run(JE(t),()=>(W("appInit:start",{kind:"network"}),Promise.resolve(e(t)).finally(()=>W("appInit:end",{kind:"network"}))))}function ev(e,t){if(Qe(e)||!e.appInit&&!Pr(e.baseUrl)||!QE(e))return e;const n=e.appInit??XE(e,t);let r=ua.get(n);return r||(r=ZE(n),ua.set(n,r)),{...e,appInit:r}}var fa=0;function tv(){return fa}function nv(){fa+=1,da()}var pa=new WeakMap,ha=new WeakMap,rv=3e4;function sv(e,t){return JSON.stringify({userId:e?.id??"",project:t??""})}function ov(e,t){try{const n=l.decodeJwt(e)?.exp;if(typeof n=="number"&&Number.isFinite(n)&&n>0)return n*1e3}catch{}return t+rv}function iv(e){const t=new Map,n=new Map;return async(r,s,o)=>{const i=sv(r,s);if(o)return n.delete(i),t.delete(i),da(),e(r,s,o);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&&(W("authToken:start",{kind:"network"}),c=Promise.resolve(e(r,s,o)).then(d=>{const u=String(d||"").trim();return u&&n.set(i,{token:d,expiresAtMs:ov(u,Date.now())}),d}).finally(()=>{W("authToken:end",{kind:"network"}),t.delete(i)}),t.set(i,c)),c}}function av(e){if(Qe(e))return e;const t=e.getAuthToken;if(!t)return e;let n=pa.get(t);const r=tv();return(!n||ha.get(t)!==r)&&(n=iv(t),pa.set(t,n),ha.set(t,r)),Promise.resolve(n(e.user,e.project,void 0)).catch(s=>{}),{...e,getAuthToken:n}}var lv="[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 cv(e){const t=new Error(lv,{cause:e});return t.name="EditorStartFailedError",t}var dv={getConfig:"await `ready` first",use:"use `useAsync()` or await `ready` first"};function ma(e){return new Error(`[emailmaker] \`${e}\` is not available on this editor`)}var ga=["handleLoad","handleDestroy"];function Ea(e,t){let n=e;for(const r of ga){const s=e?.[r];typeof s=="function"&&(n={...n,[r]:(o,...i)=>s(t,...i)})}return n}function uv(e){let t,n="pending",r,s,o,i;const a=new Set,c=[],d=new Set;let u,f;const g=new Promise((w,P)=>{u=w,f=P});g.catch(()=>{});const E={},S=w=>t?.[w],b=()=>r??ge(),h=(w,P)=>{const k=S(w);if(typeof k!="function")throw ma(w);return k.apply(t,P)},y=(w,P)=>{try{return Promise.resolve(h(w,P))}catch(k){return Promise.reject(k)}},I=()=>{const w=t?.container?.getInstance?.(l.DISPOSABLE_ID);if(!(n!=="ready"||w?.isDisposed()||typeof S("getConfig")!="function"))try{i=h("getConfig",[])}catch{}},A=()=>n==="dead"?Promise.reject(b()):n==="ready"?Promise.resolve():g,D=()=>{for(const[w,P]of Ht)P==="field"&&(E[w]=S(w))},N=w=>{const P=S(w.name);w.dispose||typeof P!="function"||n==="dead"||(w.dispose=P.apply(t,w.args))},m=()=>a.forEach(N),_=()=>{for(const w of a){try{w.dispose?.()}catch{}w.dispose=void 0}},C=()=>{D(),m()},M=()=>{o?.delete(C),o=void 0},p=(w,P)=>{const[k,...K]=P;return!ga.includes(w)||typeof k!="function"?P:[(re,...J)=>k(E,...J),...K]},v=(w,P)=>{if(n==="dead")return()=>{};if(n==="ready"&&typeof S(w)!="function")throw ma(w);const k={name:w,args:p(w,P)};return a.add(k),N(k),()=>{a.delete(k),k.dispose?.(),k.dispose=void 0}},T=()=>t?.container?.getInstance(l.OPTIONS_SOURCE_ID)?.get()?.content,L=()=>{const w=e.element();return w!==void 0&&typeof w!="string"?w:void 0},O=(w,P)=>{switch(P){case"event":return(...k)=>v(w,k);case"async":return(...k)=>(w==="show"&&k[0]!==void 0&&e.shown?.(k[0]),n!=="dead"&&typeof S(w)=="function"?y(w,k):A().then(()=>h(w,k)));case"queued":return(...k)=>{if(n==="dead"){if(w==="notify")return;throw b()}if(n==="pending"){c.push({name:w,args:k});return}return h(w,k)};case"sync":return(...k)=>{if(n==="dead"){if(w==="getConfig")return i;throw b()}if(typeof S(w)!="function")throw new Error(`[emailmaker] \`${w}\` is not available before the editor is ready: ${dv[w]??"await `ready` first"}`);const K=h(w,k);return w==="getConfig"&&(i=K),K};case"element":return()=>{if(typeof S(w)!="function")return L();try{return h(w,[])}catch{return L()}};case"codeErrors":return()=>n==="ready"&&typeof S(w)=="function"?h(w,[]):[];case"field":return}};for(const[w,P]of Ht)E[w]=O(w,P);E.reset=w=>(w?.content!==void 0&&e.shown?.(w.content),A().then(async()=>{const P=w?.content!==void 0&&l.deepEqual(w.content,T());await h("reset",[Ea(w,F)]),P&&await h("show",[w.content])}).then(()=>E)),E.destroy=()=>{if(n==="dead")return;const w=l.createAbortError("[emailmaker] editor was destroyed before it was ready");s?.catch(()=>{}),d.forEach(P=>P(w)),I(),e.destroy()},Object.defineProperty(E,"ready",{get:()=>s,enumerable:!0,configurable:!0});const F=E;return{object:F,get state(){return n},get editor(){return t},bind:w=>{n==="dead"||t===w||(_(),M(),t=w,D(),m(),n==="pending"&&(o=w.container.getOrCreateInstance(l.LATE_SURFACE_LISTENERS_ID,()=>new Set),o.add(C)))},settle:()=>{if(n==="pending"){n="ready",M(),D(),m();for(const w of c.splice(0))try{h(w.name,w.args)}catch(P){queueMicrotask(()=>{throw P})}u()}},kill:(w,P)=>{n!=="dead"&&(I(),n="dead",r=w,c.length=0,d.forEach(k=>k(w)),M(),P?.keepSubscriptions||(_(),a.clear()),f(w))},detach:()=>{_(),a.clear()},setReady:w=>{s=w},trackCall:w=>(d.add(w),()=>d.delete(w)),hasCalls:()=>d.size>0}}var Mr="Editor mount element was removed from the document. Call instance.destroy() on host unmount.";function fv(){return l.createAbortError(Mr)}function va(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===Mr}function pv(e,t,n){if(typeof document>"u")return;let r=!1,s;const o=()=>{r=!0,s?.disconnect(),s=void 0},i=()=>{r||(o(),t())};if(n.addDispose(o),!e.isConnected){queueMicrotask(i);return}s=new MutationObserver(()=>{e.isConnected||i()});let a=e.parentNode;for(;a;)s.observe(a,{childList:!0}),a=a.parentNode}function hv(e){const{hostElementOption:t,resolvedElement:n,externalSignal:r,disposable:s}=e;if(t===void 0||!(n instanceof Element))return r;const o=new AbortController;return pv(n,()=>{n.id,o.abort(fv())},s),l.composeAbortSignals(r,o.signal)}var Lr="Superseded by newer init() on the same mount element";function _a(){return l.createAbortError(Lr)}function ba(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===Lr}var pt=new Map,ya=new WeakMap,Vt=new WeakMap;function mv(e){if(e instanceof Element){const t=e.id?.trim();if(t)return`#${t}`}}function gv(e,{supersede:t=!1}={}){if(!e)return{previous:Promise.resolve(),release:()=>{}};const n=mv(e);(n?pt.get(n):void 0)?.forEach(u=>{u.element!==e&&u.controller.abort(_a())});const r=ya.get(e)??new Set;t&&r.forEach(u=>{u.supersedable&&u.controller.abort(_a())});const s=Vt.get(e)??Promise.resolve();let o;const i=new Promise(u=>{o=u}),a=s.then(()=>i);Vt.set(e,a),a.then(()=>{Vt.get(e)===a&&Vt.delete(e)});const c=new AbortController,d={element:e,controller:c,supersedable:t};if(r.add(d),ya.set(e,r),n){const u=pt.get(n)??new Set;u.add(d),pt.set(n,u)}return{signal:c.signal,previous:s,release:()=>{o(),r.delete(d);const u=n?pt.get(n):void 0;n&&u?.delete(d)&&u.size===0&&pt.delete(n)}}}var ht=new WeakMap;function Nr(e,t){return typeof t=="function"&&(/^(handle|on)[A-Z]/.test(e)||e==="getAuthToken")}function xr(e){return Object.entries(e).filter(([t,n])=>Nr(t,n)).map(([t])=>t).sort()}function Sa(e){const t={};for(const[n,r]of Object.entries(e))n!=="signal"&&!Nr(n,r)&&(t[n]=r);return t}function kr(e,t,{fresh:n=!1}={}){if(!e)return t;let r=n?void 0:ht.get(e);r||(r={current:new Map,trampolines:new Map,lastOptions:t},ht.set(e,r));const{current:s,trampolines:o}=r;s.clear();const i={...t};for(const a of xr(t)){s.set(a,t[a]);let c=o.get(a);c||(c=(...d)=>s.get(a)?.(...d),o.set(a,c)),i[a]=c}return r.lastOptions=t,i}function wa(e,t){const n=e?ht.get(e):void 0;if(n)for(const r of n.trampolines.keys()){const s=t[r];Nr(r,s)?n.current.set(r,s):n.current.delete(r)}}function Ev(e){const t=e?ht.get(e):void 0;if(!t)return()=>{};const n=new Map(t.current),{lastOptions:r}=t;return()=>{t.current.clear(),n.forEach((s,o)=>t.current.set(o,s)),t.lastOptions=r}}function vv(e,t,n){const r=e?ht.get(e):void 0;if(!r||!n)return!1;const s=xr(t),o=l.deepEqual(s,xr(r.lastOptions)),i=s.every(a=>a==="getAuthToken"||n[a]===r.trampolines.get(a));return!o||!i||!l.deepEqual(Sa(t),Sa(r.lastOptions))?!1:(kr(e,t),!0)}var le=new WeakMap,__=0;function Gt(e){let t=le.get(e);return t||(t={counted:new Set,leaving:new Set,order:[],options:new Map,latestCall:0,warned:!1},le.set(e,t)),t}var _e=e=>e!==void 0&&e.state!=="dead";function _v(e){const t=le.get(e)?.shared;return _e(t)?t:void 0}function bv(e,t){Gt(e).shared=t}function yv(e,t){!(_e(e.shared)&&[...e.counted].some(_e))||e.warned||!t.devTools||(e.warned=!0)}function Sv(e,t,n,r){const s=Gt(e);return s.latestCall+=1,s.releaseTimer!==void 0&&(clearTimeout(s.releaseTimer),s.releaseTimer=void 0),s.leaving.forEach(o=>o.detach()),s.leaving.clear(),n==="single"?s.shared=t:s.counted.add(t),s.options.set(t,r),s.order=[...s.order.filter(o=>o!==t&&_e(o)),t],yv(s,r),s.latestCall}function wv(e,t){return le.get(e)?.latestCall===t}function Iv(e){const t=le.get(e);if(t)return t.order=t.order.filter(_e),t.order.at(-1)?.object}function mt(e,t){const n=le.get(e);return n?_e(n.shared)&&n.shared!==t||[...n.counted].some(r=>r!==t&&_e(r)):!1}function Tv(e,t){const n=le.get(e),r=n?.order.filter(s=>s!==t&&_e(s)).at(-1);return r?n?.options.get(r):void 0}function Ia(e,t){Gt(e).content={value:t}}function Cv(e){return le.get(e)?.content}function Av(e,t,n,r){const s=Gt(e);if(s.counted.delete(t),s.options.delete(t),mt(e)){t.kill(n);return}t.kill(n,{keepSubscriptions:!0}),s.leaving.add(t),Ta(e,r)}function Ta(e,t){const n=le.get(e);!n||mt(e)||n.releaseTimer!==void 0||(n.releaseTimer=setTimeout(()=>{n.releaseTimer=void 0,!mt(e)&&(t(),n.leaving.forEach(r=>r.detach()),n.leaving.clear())},0))}function Dv(e,t){const n=le.get(e);if(n){n.releaseTimer!==void 0&&clearTimeout(n.releaseTimer);for(const r of[n.shared,...n.counted,...n.leaving])r?.kill(t);le.delete(e)}}var Pv=Kt.__exportAll({FileManagerApiError:()=>Rv,IntegratorSaveTimeoutError:()=>an,SaveRefusedError:()=>Ye}),Rv=class Pa extends Error{code;status;details;get httpStatus(){return this.status}constructor(t,n,r,s){super(t),this.name="FileManagerApiError",this.code=n,this.status=r,this.details=s,Error.captureStackTrace&&Error.captureStackTrace(this,Pa)}},Ov=Kt.__exportAll({mapHttpStatusToErrorCode:()=>l.mapHttpStatusToErrorCode});function Mv(e,t){return{...e,element:t}}function Fr(){return()=>{}}function Lv(e){const t=e.element;return!t||typeof t=="string"||typeof document>"u"?Fr():(jE(t,e.config?.styles,t),()=>{UE(t)})}function Nv(e){if(!ca()||e.initialSpinner===!1||typeof document>"u")return{options:e,cleanup:Fr()};const t=e.element;if(!t||typeof t=="string")return{options:e,cleanup:Fr()};t.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(s=>{s.remove()});const n=VE(t,"data-useblocks"),r=e.handleChunkLoaded;return{options:{...e,handleChunkLoaded:()=>{n(),r?.()}},cleanup:n}}function xv(e,t){if(e.appInit||!("appInit"in t))return t;const n={...t};return delete n.appInit,n}function Yt(e){try{e.destroy()}catch{}}function Wt(e,...t){const n=l.ELEMENT_MAP.get(e);t.some(r=>r!==void 0&&r===n)&&l.ELEMENT_MAP.delete(e)}var kv="1.1.104";async function Fv(e){An(),await fg(typeof __useblocks__<"u"?__useblocks__:void 0)}async function Bv(e){return Ca(e).ready}function jv(e){if(typeof e!="string")return e??void 0;try{return document.querySelector(e)??void 0}catch{return}}function Uv(e){const t=l.ELEMENT_MAP.get(e);return t&&!(t instanceof Promise)?t:void 0}function qt(e,t,n){const r=t??Uv(e);r&&(Wt(e,r),Yt(r)),Dv(e,n)}function Hv(e){const{control:t,mode:n,ref:r}=e,s=r.host;if(!s){const i=t.editor;$v(i),t.kill(ge());return}if(n==="single"){qt(s,t.editor,ge());return}const o=Tv(s,t);Av(s,t,ge(),()=>qt(s,t.editor,ge())),o&&mt(s)&&wa(s,o)}function $v(e){e&&Yt(e)}function Ca(e){W(te.initStart);const t=e.ownership==="counted"?"counted":"single",n=new AbortController,r=l.composeAbortSignals(e.signal,n.signal),s=t==="single"?jv(e.element):void 0,o=s?_v(s):void 0;let i;if(o)i={control:o,mode:t,ref:{host:s}};else{const u={},f=uv({element:()=>u.host??e.element,destroy:()=>Hv(i),shown:g=>{u.host&&Ia(u.host,g)}});i={control:f,mode:t,ref:u},s&&bv(s,f)}const{control:a}=i,c=a.trackCall(u=>n.abort(u)),d=zv(Ea({...e,signal:r},a.object),i).then(()=>(c(),W(te.initEnd),a.settle(),a.object),u=>{c(),a.state==="pending"&&!a.hasCalls()&&a.kill(u);const f=i.ref.host;throw f&&Ta(f,()=>qt(f,void 0,ge())),u});return a.setReady(d),a.object}function Vv(e){const t=typeof e=="string"?document.querySelector(e):e;return t?Iv(t):void 0}function Gv(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 s=Me(e.container)?.current();r=s!==void 0&&s.get().savedVersion!==null&&s.isDirty()}catch{t=void 0}return{options:t,signal:n,email:Yv(e),dirty:r}}async function Yv(e){try{return await e.getEmailSnapshot()}catch{return}}function Wv(e){const t=Me(e.container)?.current();t?.whenReady().then(()=>t.markUnsaved()).catch(()=>{})}function Aa(e,t){const{control:n,mode:r}=t;return r==="single"&&n.state==="ready"||mt(e,n)}async function qv(e,t,n,r,s){if(r.mode==="counted"&&r.control.detach(),ba(s)||va(s))return;const o=()=>qt(t,e,cv(s)),{options:i}=n;if(!i||!Aa(t,r)){o();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&&Wv(e),Aa(t,r)?l.ELEMENT_MAP.set(t,e):o()}catch{o()}}async function zv(e,t){l.throwIfAborted(e.signal);const n=new l.Disposable;let r,s,o,i,a=0;try{const c=await l.waitForElement(e.element,n,e.signal);c&&(i=c,t.ref.host=c,a=Sv(c,t.control,t.mode,e));const d=hv({hostElementOption:e.element,resolvedElement:c,externalSignal:e.signal,disposable:n}),u=gv(c,{supersede:t.mode==="single"});r=u.release;const f=l.composeAbortSignals(d,u.signal);l.throwIfAborted(f),o=Ev(c),wa(c,e),await l.raceWithAbortSignal(u.previous,f),s=Kv(e,c,t,f,o);const g=await l.raceWithAbortSignal(s,f);return c&&e.content!==void 0&&Ia(c,e.content),g}catch(c){throw i&&o&&wv(i,a)&&o(),c}finally{const c=r;s!==void 0&&c?s.then(c,c):c?.(),n.dispose()}}async function Da(e,t,n,r){const s=Cv(t);n===void 0||r||!s||l.deepEqual(n,s.value)||await e.show(n)}async function Kv(e,t,n,r,s){const{control:o}=n,i=b=>o.bind(b);l.throwIfAborted(r);let a;const c=b=>{nv();const h=av(Mv(b,t)),y=ev(h,()=>a);return{preparedOptions:y,preparedOptionsWithSignal:r!=null?{...y,signal:r}:y}};let d;if(t){const b=l.ELEMENT_MAP.get(t);if(b){let h;try{h=await b,l.throwIfAborted(r)}catch{l.throwIfAborted(r),Wt(t,b),h=void 0}if(h)if(h.getElement()===t){const y=LE(t);a=y;const I=h.container.getInstance(l.OPTIONS_SOURCE_ID)?.get();if(vv(t,e,I))return i(h),r&&h.container.getInstance(l.INIT_PIPELINE_ID)?.relinkExternalSignal(r),l.ELEMENT_MAP.set(t,h),await Da(h,t,e.content,!1),h;const A=!l.deepEqual(e.content,I?.content);d=c(kr(t,e));const{preparedOptions:D,preparedOptionsWithSignal:N}=d,m=y&&KE(y),_=Gv(h);try{y&&Or(y,D),i(h);const C=await h.reset(xv(e,N));return l.throwIfAborted(r),l.ELEMENT_MAP.set(t,h),await Da(h,t,e.content,A),C}catch(C){if(y&&m&&Or(y,m),!el(C))throw s(),await qv(h,t,_,n,C),C;Wt(t,b,h),Yt(h),l.throwIfAborted(r)}}else Wt(t,b,h),Yt(h)}}l.throwIfAborted(r),d??=c(kr(t,e,{fresh:!0}));const{preparedOptions:u}=d,f=Lv(u),g=Nv(u),E=r!=null?{...g.options,signal:r}:g.options;let S;try{a=kE(E),NE(t,a),Or(a,u),lr(a).set(E),await hr(),W(te.coreReady),l.throwIfAborted(r),l.throwIfAborted(r),S=ME(E,a,{onInstance:i}),t&&l.ELEMENT_MAP.set(t,S);const b=await S;if(r?.aborted&&(b.destroy(),l.throwIfAborted(r)),t)if(l.ELEMENT_MAP.get(t)===S)l.ELEMENT_MAP.set(t,b);else throw b.destroy(),l.throwIfAborted(r),l.createAbortError(r?.reason);return b}catch(b){throw f(),g.cleanup(),a&&(aa(a),xE(t,a)),t&&S&&l.ELEMENT_MAP.get(t)===S&&l.ELEMENT_MAP.delete(t),b}}async function Xv(e){return(await ct()).parseAMP(e)}typeof window<"u"&&(He()&&Qa(),hg(typeof __useblocks__<"u"?__useblocks__:void 0)),ne.ELEMENT_DETACHED_ABORT_MESSAGE=Mr,ne.SUPERSEDED_INIT_ABORT_MESSAGE=Lr,ne.create=Ca,Object.defineProperty(ne,"errors",{enumerable:!0,get:function(){return Pv}}),ne.getInstance=Vv,Object.defineProperty(ne,"helpers",{enumerable:!0,get:function(){return Ov}}),ne.init=Bv,ne.isElementDetachedError=va,ne.isSupersededInitError=ba,ne.parseAMP=Xv,ne.pluginRegistry=Wi,ne.preload=Fv,ne.version=kv});
|
|
2183
2183
|
|
|
2184
2184
|
|
|
2185
2185
|
// Возвращаем API из entry модуля
|
|
2186
2186
|
return __useblocks__.syncRequire("useblocks.js");
|
|
2187
2187
|
});
|
|
2188
2188
|
|
|
2189
|
-
__useblocks__.require.config({"graph":{"core":["__delivery__/libs"],"static/core/
|
|
2189
|
+
__useblocks__.require.config({"graph":{"core":["__delivery__/libs"],"static/core/160bf060.js":[],"static/core/1c7109ca.js":["static/core/e47dcbb0.js","__delivery__/libs","monaco"],"static/core/1ed86ed3.js":[],"static/core/2929f344.js":["static/core/485d0f3d.js"],"static/core/319ebaa7.js":["static/core/3fbfc93f.js","static/core/ff7d14e8.js","__delivery__/libs"],"static/core/394d0d8b.js":["__delivery__/libs"],"static/core/3acb2fc4.js":[],"static/core/3cacdac0.js":["static/core/8f653f65.js","static/core/394d0d8b.js","__delivery__/libs","static/core/3fbfc93f.js"],"static/core/3fbfc93f.js":["static/core/e7620593.js","static/core/ff7d14e8.js","__delivery__/libs"],"static/core/3fd50a29.js":[],"static/core/485d0f3d.js":[],"static/core/48da14fd.js":[],"static/core/4c8d0155.js":[],"static/core/559147cb.js":["static/core/3fbfc93f.js","__delivery__/libs"],"static/core/5d8f3441.js":["static/core/485d0f3d.js","static/core/727176a9.js","static/core/cf249009.js"],"static/core/5d9ff4d5.js":[],"static/core/6561b34a.js":[],"static/core/727176a9.js":[],"static/core/73d6d76e.js":[],"static/core/756874c6.js":[],"static/core/7b850506.js":[],"static/core/89044032.js":["static/core/394d0d8b.js","__delivery__/libs"],"static/core/8aef9403.js":["static/core/3fbfc93f.js","static/core/8f653f65.js","static/core/559147cb.js","static/core/89044032.js","__delivery__/libs"],"static/core/8f653f65.js":["static/core/3fbfc93f.js","__delivery__/libs"],"static/core/a11fe298.js":[],"static/core/a6303cb2.js":["static/core/ff7d14e8.js"],"static/core/b17bcc2f.js":[],"static/core/beafdd63.js":[],"static/core/c7ba829b.js":[],"static/core/cbde9d66.js":[],"static/core/cf249009.js":["static/core/727176a9.js"],"static/core/cf79afe3.js":[],"static/core/dcc37768.js":[],"static/core/e47dcbb0.js":[],"static/core/e50befab.js":[],"static/core/e7620593.js":[],"static/core/f422ba3d.js":[],"static/core/f7fba0d2.js":["static/core/727176a9.js"],"static/core/fb2fe2db.js":[],"static/core/ff7d14e8.js":[],"static/monaco/editor.api-C9c1WLns.js":[],"monaco":["static/monaco/editor.api-C9c1WLns.js","static/monaco/lspLanguageFeatures-DY3n8M13.js"],"static/monaco/lspLanguageFeatures-DY3n8M13.js":["static/monaco/editor.api-C9c1WLns.js"],"useblocks.js":[],"static/umd/6639d610.js":["static/umd/b11043e6.js"],"static/umd/b11043e6.js":[],"static/umd/d786efbb.js":[],"static/umd/e8914784.js":[]},"bundles":{"static/core/394d0d8b.js":["static/core/c339b179.js","static/core/8060a027.js","static/core/cfd3c582.js"],"static/core/2929f344.js":["static/core/a71c4cd8.js"],"static/core/319ebaa7.js":["static/core/8daf15a4.js"],"static/core/89044032.js":["static/core/a73da823.js"],"static/core/3cacdac0.js":["static/core/88f1e8a1.js"],"core":["static/core/2ff39ddf.js","static/core/c1dc75d5.js","static/core/729e4a66.js","static/core/601709d6.js","static/core/d0ef2f52.js"]}});
|