useblocks 1.1.85-dev.2 → 1.1.85-dev.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/iframe/.vite/manifest.json +4 -4
  2. package/iframe/js/{discussHandlers.BtCUuj58.js → discussHandlers.BxlCsZ-4.js} +2 -2
  3. package/iframe/js/iframe-eblock.body.js +1 -1
  4. package/iframe/js/iframe-eblock.js +1 -1
  5. package/iframe/js/iframe.body.js +2 -2
  6. package/iframe/js/iframe.js +1 -1
  7. package/node_modules/useblocks-ui-kit/package.json +1 -1
  8. package/package.json +2 -2
  9. package/runtime/react/index.js +1 -1
  10. package/static/core/{ef3477dd.js → 14a79b09.js} +1 -1
  11. package/static/core/{6c7df338.js → 199dc589.js} +1 -1
  12. package/static/core/{ca873214.js → 230f23ec.js} +1 -1
  13. package/static/core/{181088a9.js → 30f16e98.js} +1 -1
  14. package/static/core/{6fdfa46d.js → 34730be9.js} +1 -1
  15. package/static/core/{9b7f52a5.js → 364dcebf.js} +1 -1
  16. package/static/core/{43affb86.js → 4916b3a1.js} +1 -1
  17. package/static/core/{c789db17.js → 4f790fdc.js} +1 -1
  18. package/static/core/{d74b0853.js → 520ec797.js} +3 -3
  19. package/static/core/{2639f789.js → 57c114f0.js} +1 -1
  20. package/static/core/{cab426fa.js → 5bf994b4.js} +1 -1
  21. package/static/core/{13563d2c.js → 6541580a.js} +1 -1
  22. package/static/core/{a72f1f53.js → 79431a89.js} +1 -1
  23. package/static/core/{b502ca96.js → 8fb0fe48.js} +1 -1
  24. package/static/core/{fad0a613.js → 9a70cc1e.js} +1 -1
  25. package/static/core/{6589e3b8.js → a15ab67d.js} +1 -1
  26. package/static/core/{576452f9.js → adf6e008.js} +1 -1
  27. package/static/core/{f0f90842.js → b743a76d.js} +1 -1
  28. package/static/core/{c6d342f2.js → b97bd382.js} +6 -6
  29. package/static/core/{92e10a15.js → ddb5a35d.js} +1 -1
  30. package/static/core/{70b2c337.js → dfddbd68.js} +1 -1
  31. package/static/core/{6eeae572.js → f3eda1c7.js} +1 -1
  32. package/static/core/{5f0c0e3a.js → ffb36e93.js} +1 -1
  33. package/static/umd-runtime/runtime.js +1 -1
  34. package/{useblocks-core.4865197d.js → useblocks-core.168aeeb1.js} +8 -8
  35. package/useblocks-esm.js +6 -6
  36. package/{useblocks-po.4865197d.js → useblocks-po.168aeeb1.js} +1 -1
  37. package/useblocks.js +6 -6
  38. package/vite/index.cjs +99 -3
  39. package/vite/index.js +99 -3
  40. package/webpack/index.cjs +93 -0
  41. package/webpack/index.js +93 -0
  42. /package/iframe/{iframe-eblock.4865197d.html → iframe-eblock.168aeeb1.html} +0 -0
  43. /package/iframe/{iframe.4865197d.html → iframe.168aeeb1.html} +0 -0
@@ -42,4 +42,4 @@ __useblocks__.define("po",["require","exports","module"],function(na,ct,aa){Obje
42
42
 
43
43
  `),"utf-8"):u.convert(i.join(`
44
44
 
45
- `),this._charset)}})),Hn=R(((o,t)=>{var e=je(),u=st();t.exports=function(p,h){return new f(p,h).parse()};function f(p,h){this._fileContents=p,this._writeFunc="writeUInt32LE",this._readFunc="readUInt32LE",this._charset=h||"iso-8859-1",this._table={charset:this._charset,headers:void 0,translations:{}}}f.prototype.MAGIC=2500072158,f.prototype._checkMagick=function(){return this._fileContents.readUInt32LE(0)===this.MAGIC?(this._readFunc="readUInt32LE",this._writeFunc="writeUInt32LE",!0):this._fileContents.readUInt32BE(0)===this.MAGIC?(this._readFunc="readUInt32BE",this._writeFunc="writeUInt32BE",!0):!1},f.prototype._loadTranslationTable=function(){for(var p=this._offsetOriginals,h=this._offsetTranslations,i,r,s,n,l=0;l<this._total;l++)r=this._fileContents[this._readFunc](p),p+=4,i=this._fileContents[this._readFunc](p),p+=4,s=this._fileContents.slice(i,i+r),r=this._fileContents[this._readFunc](h),h+=4,i=this._fileContents[this._readFunc](h),h+=4,n=this._fileContents.slice(i,i+r),!l&&!s.toString()&&this._handleCharset(n),s=e.convert(s,"utf-8",this._charset).toString("utf-8"),n=e.convert(n,"utf-8",this._charset).toString("utf-8"),this._addString(s,n);this._fileContents=null},f.prototype._handleCharset=function(p){var h=p.toString(),i;(i=h.match(/[; ]charset\s*=\s*([\w-]+)/i))&&(this._charset=this._table.charset=u.formatCharset(i[1],this._charset)),p=e.convert(p,"utf-8",this._charset).toString("utf-8"),this._table.headers=u.parseHeader(p)},f.prototype._addString=function(p,h){var i={},r,s,n;p=p.split(""),p.length>1?(s=p.shift(),i.msgctxt=s):s="",p=p.join(""),r=p.split("\0"),p=r.shift(),i.msgid=p,(n=r.join("\0"))&&(i.msgid_plural=n),h=h.split("\0"),i.msgstr=[].concat(h||[]),this._table.translations[s]||(this._table.translations[s]={}),this._table.translations[s][p]=i},f.prototype.parse=function(){return this._checkMagick()?(this._revision=this._fileContents[this._readFunc](4),this._total=this._fileContents[this._readFunc](8),this._offsetOriginals=this._fileContents[this._readFunc](12),this._offsetTranslations=this._fileContents[this._readFunc](16),this._loadTranslationTable(),this._table):!1}})),Jn=R(((o,t)=>{var e=ot().Buffer,u=je(),f=st();t.exports=function(h){return new p(h).compile()};function p(h){this._table=h||{},this._table.headers=this._table.headers||{},this._table.translations=this._table.translations||{},this._translations=[],this._writeFunc="writeUInt32LE",this._handleCharset()}p.prototype.MAGIC=2500072158,p.prototype._handleCharset=function(){var h=(this._table.headers["content-type"]||"text/plain").split(";"),i=h.shift(),r=f.formatCharset(this._table.charset),s=[];s=h.map(function(n){var l=n.split("="),y=l.shift().trim(),g=l.join("=");return y.toLowerCase()==="charset"?(r||(r=f.formatCharset(g.trim()||"utf-8")),"charset="+r):n}),r||(r=this._table.charset||"utf-8",s.push("charset="+r)),this._table.charset=r,this._table.headers["content-type"]=i+"; "+s.join("; "),this._charset=r},p.prototype._generateList=function(){var h=[];return h.push({msgid:e.alloc(0),msgstr:u.convert(f.generateHeader(this._table.headers),this._charset)}),Object.keys(this._table.translations).forEach(function(i){typeof this._table.translations[i]=="object"&&Object.keys(this._table.translations[i]).forEach(function(r){if(typeof this._table.translations[i][r]=="object"&&!(i===""&&r==="")){var s=this._table.translations[i][r].msgid_plural,n=r,l;i&&(n=i+""+n),s&&(n+="\0"+s),l=[].concat(this._table.translations[i][r].msgstr||[]).join("\0"),h.push({msgid:u.convert(n,this._charset),msgstr:u.convert(l,this._charset)})}}.bind(this))}.bind(this)),h},p.prototype._calculateSize=function(h){var i=0,r=0,s=0;return h.forEach(function(n){i+=n.msgid.length+1,r+=n.msgstr.length+1}),s=28+8*h.length+8*h.length+i+r,{msgid:i,msgstr:r,total:s}},p.prototype._build=function(h,i){var r=e.alloc(i.total),s=0,n,l;for(r[this._writeFunc](this.MAGIC,0),r[this._writeFunc](0,4),r[this._writeFunc](h.length,8),r[this._writeFunc](28,12),r[this._writeFunc](28+8*h.length,16),r[this._writeFunc](0,20),r[this._writeFunc](28+8*h.length*2,24),s=28+16*h.length,n=0,l=h.length;n<l;n++)h[n].msgid.copy(r,s),r[this._writeFunc](h[n].msgid.length,28+n*8),r[this._writeFunc](s,28+n*8+4),r[s+h[n].msgid.length]=0,s+=h[n].msgid.length+1;for(n=0,l=h.length;n<l;n++)h[n].msgstr.copy(r,s),r[this._writeFunc](h[n].msgstr.length,28+8*h.length+n*8),r[this._writeFunc](s,28+8*h.length+n*8+4),r[s+h[n].msgstr.length]=0,s+=h[n].msgstr.length+1;return r},p.prototype.compile=function(){var h=this._generateList(),i=this._calculateSize(h);return h.sort(function(r,s){return r.msgid>s.msgid?1:r.msgid<s.msgid?-1:0}),this._build(h,i)}})),Xn=R(((o,t)=>{var e=Yn();t.exports={po:{parse:e.parse,createParseStream:e.stream,compile:Vn()},mo:{parse:Hn(),compile:Jn()}}})),Kn=R(((o,t)=>{var e=Wn();t.exports=function(u,f){f=f||{};const p={pretty:!1,fuzzy:!1,stringify:!1,format:"raw",domain:"messages",charset:"utf8",fullMF:!1,mfOptions:{}};for(const n in p)f[n]=typeof f[n]<"u"?f[n]:p[n];let h={},i={};if(f.format==="mf"){const n=u.toString().includes('"Plural-Forms:')?f.mfOptions:Object.assign({},{pluralFunction:()=>0},f.mfOptions);return i=Object.keys(n).length>0?e.parsePo(u,n):e.parsePo(u),f.fullMF?f.stringify?JSON.stringify(i,null,f.pretty?" ":null):i:(i&&(i.translations&&i.translations[""]?(h=i.translations[""],Object.keys(i.translations).forEach(function(l){l===""?Object.keys(i.translations[""]).forEach(function(y){h[y]=i.translations[""][y]}):h[l]=i.translations[l]})):h=i.translations||{}),f.stringify?JSON.stringify(h,null,f.pretty?" ":null):h)}const r=Xn().po.parse(u,p.charset),s=r.translations;if(Object.keys(s).forEach(function(n){const l=r.translations[n],y=r.headers?r.headers["plural-forms"]:"";Object.keys(l).forEach(function(g,b){const w=l[g],v=n.length?n+""+g:g,B=w.comments&&w.comments.flag&&w.comments.flag.match(/fuzzy/)!==null;(!B||f.fuzzy)&&(f.format==="jed"?i[v]=[w.msgid_plural?w.msgid_plural:null].concat(w.msgstr):y==="nplurals=1; plural=0;"?(msgstr=w.msgid_plural?[w.msgstr]:w.msgstr,i[v]=[w.msgid_plural?w.msgid_plural:null].concat(msgstr)):i[v]=[w.msgid_plural?w.msgid_plural:null].concat(w.msgstr)),f["fallback-to-msgid"]&&(B&&!f.fuzzy||w.msgstr[0]==="")&&(i[v]=[w.msgid_plural?w.msgid_plural:null].concat(w.msgid_plural?[g,w.msgid_plural]:[g]))})}),r.headers&&(i[""]=r.headers),f.format==="mf"&&delete i[""],f.format.indexOf("jed")===0){const n={domain:f.domain,locale_data:{}};if(f.format==="jed"){for(const l in i)if(i.hasOwnProperty(l)&&l!==""){for(let y=2;y<i[l].length;y++)i[l][y]===""&&(i[l][y]=i[l][0]);i[l].shift()}}n.locale_data[f.domain]=i,n.locale_data[f.domain][""]={domain:f.domain,plural_forms:i[""]["plural-forms"],lang:i[""].language},i=n}return f.stringify?JSON.stringify(i,null,f.pretty?" ":null):i}})),Zn=It(Kn());function Qn(o){if(typeof o=="function")return o;const t=o?.default;return typeof t=="function"?t:void 0}function ea(o){if(!(o==null||typeof o!="object"||Array.isArray(o)))return o}function ta(o){const t=Qn(Zn.default)?.(o,{format:"jed",fuzzy:!0,domain:"default"});return ea(t?.locale_data?.default)}var ra="1.1.85-dev.2";ct.parsePoCatalog=ta,ct.version=ra});
45
+ `),this._charset)}})),Hn=R(((o,t)=>{var e=je(),u=st();t.exports=function(p,h){return new f(p,h).parse()};function f(p,h){this._fileContents=p,this._writeFunc="writeUInt32LE",this._readFunc="readUInt32LE",this._charset=h||"iso-8859-1",this._table={charset:this._charset,headers:void 0,translations:{}}}f.prototype.MAGIC=2500072158,f.prototype._checkMagick=function(){return this._fileContents.readUInt32LE(0)===this.MAGIC?(this._readFunc="readUInt32LE",this._writeFunc="writeUInt32LE",!0):this._fileContents.readUInt32BE(0)===this.MAGIC?(this._readFunc="readUInt32BE",this._writeFunc="writeUInt32BE",!0):!1},f.prototype._loadTranslationTable=function(){for(var p=this._offsetOriginals,h=this._offsetTranslations,i,r,s,n,l=0;l<this._total;l++)r=this._fileContents[this._readFunc](p),p+=4,i=this._fileContents[this._readFunc](p),p+=4,s=this._fileContents.slice(i,i+r),r=this._fileContents[this._readFunc](h),h+=4,i=this._fileContents[this._readFunc](h),h+=4,n=this._fileContents.slice(i,i+r),!l&&!s.toString()&&this._handleCharset(n),s=e.convert(s,"utf-8",this._charset).toString("utf-8"),n=e.convert(n,"utf-8",this._charset).toString("utf-8"),this._addString(s,n);this._fileContents=null},f.prototype._handleCharset=function(p){var h=p.toString(),i;(i=h.match(/[; ]charset\s*=\s*([\w-]+)/i))&&(this._charset=this._table.charset=u.formatCharset(i[1],this._charset)),p=e.convert(p,"utf-8",this._charset).toString("utf-8"),this._table.headers=u.parseHeader(p)},f.prototype._addString=function(p,h){var i={},r,s,n;p=p.split(""),p.length>1?(s=p.shift(),i.msgctxt=s):s="",p=p.join(""),r=p.split("\0"),p=r.shift(),i.msgid=p,(n=r.join("\0"))&&(i.msgid_plural=n),h=h.split("\0"),i.msgstr=[].concat(h||[]),this._table.translations[s]||(this._table.translations[s]={}),this._table.translations[s][p]=i},f.prototype.parse=function(){return this._checkMagick()?(this._revision=this._fileContents[this._readFunc](4),this._total=this._fileContents[this._readFunc](8),this._offsetOriginals=this._fileContents[this._readFunc](12),this._offsetTranslations=this._fileContents[this._readFunc](16),this._loadTranslationTable(),this._table):!1}})),Jn=R(((o,t)=>{var e=ot().Buffer,u=je(),f=st();t.exports=function(h){return new p(h).compile()};function p(h){this._table=h||{},this._table.headers=this._table.headers||{},this._table.translations=this._table.translations||{},this._translations=[],this._writeFunc="writeUInt32LE",this._handleCharset()}p.prototype.MAGIC=2500072158,p.prototype._handleCharset=function(){var h=(this._table.headers["content-type"]||"text/plain").split(";"),i=h.shift(),r=f.formatCharset(this._table.charset),s=[];s=h.map(function(n){var l=n.split("="),y=l.shift().trim(),g=l.join("=");return y.toLowerCase()==="charset"?(r||(r=f.formatCharset(g.trim()||"utf-8")),"charset="+r):n}),r||(r=this._table.charset||"utf-8",s.push("charset="+r)),this._table.charset=r,this._table.headers["content-type"]=i+"; "+s.join("; "),this._charset=r},p.prototype._generateList=function(){var h=[];return h.push({msgid:e.alloc(0),msgstr:u.convert(f.generateHeader(this._table.headers),this._charset)}),Object.keys(this._table.translations).forEach(function(i){typeof this._table.translations[i]=="object"&&Object.keys(this._table.translations[i]).forEach(function(r){if(typeof this._table.translations[i][r]=="object"&&!(i===""&&r==="")){var s=this._table.translations[i][r].msgid_plural,n=r,l;i&&(n=i+""+n),s&&(n+="\0"+s),l=[].concat(this._table.translations[i][r].msgstr||[]).join("\0"),h.push({msgid:u.convert(n,this._charset),msgstr:u.convert(l,this._charset)})}}.bind(this))}.bind(this)),h},p.prototype._calculateSize=function(h){var i=0,r=0,s=0;return h.forEach(function(n){i+=n.msgid.length+1,r+=n.msgstr.length+1}),s=28+8*h.length+8*h.length+i+r,{msgid:i,msgstr:r,total:s}},p.prototype._build=function(h,i){var r=e.alloc(i.total),s=0,n,l;for(r[this._writeFunc](this.MAGIC,0),r[this._writeFunc](0,4),r[this._writeFunc](h.length,8),r[this._writeFunc](28,12),r[this._writeFunc](28+8*h.length,16),r[this._writeFunc](0,20),r[this._writeFunc](28+8*h.length*2,24),s=28+16*h.length,n=0,l=h.length;n<l;n++)h[n].msgid.copy(r,s),r[this._writeFunc](h[n].msgid.length,28+n*8),r[this._writeFunc](s,28+n*8+4),r[s+h[n].msgid.length]=0,s+=h[n].msgid.length+1;for(n=0,l=h.length;n<l;n++)h[n].msgstr.copy(r,s),r[this._writeFunc](h[n].msgstr.length,28+8*h.length+n*8),r[this._writeFunc](s,28+8*h.length+n*8+4),r[s+h[n].msgstr.length]=0,s+=h[n].msgstr.length+1;return r},p.prototype.compile=function(){var h=this._generateList(),i=this._calculateSize(h);return h.sort(function(r,s){return r.msgid>s.msgid?1:r.msgid<s.msgid?-1:0}),this._build(h,i)}})),Xn=R(((o,t)=>{var e=Yn();t.exports={po:{parse:e.parse,createParseStream:e.stream,compile:Vn()},mo:{parse:Hn(),compile:Jn()}}})),Kn=R(((o,t)=>{var e=Wn();t.exports=function(u,f){f=f||{};const p={pretty:!1,fuzzy:!1,stringify:!1,format:"raw",domain:"messages",charset:"utf8",fullMF:!1,mfOptions:{}};for(const n in p)f[n]=typeof f[n]<"u"?f[n]:p[n];let h={},i={};if(f.format==="mf"){const n=u.toString().includes('"Plural-Forms:')?f.mfOptions:Object.assign({},{pluralFunction:()=>0},f.mfOptions);return i=Object.keys(n).length>0?e.parsePo(u,n):e.parsePo(u),f.fullMF?f.stringify?JSON.stringify(i,null,f.pretty?" ":null):i:(i&&(i.translations&&i.translations[""]?(h=i.translations[""],Object.keys(i.translations).forEach(function(l){l===""?Object.keys(i.translations[""]).forEach(function(y){h[y]=i.translations[""][y]}):h[l]=i.translations[l]})):h=i.translations||{}),f.stringify?JSON.stringify(h,null,f.pretty?" ":null):h)}const r=Xn().po.parse(u,p.charset),s=r.translations;if(Object.keys(s).forEach(function(n){const l=r.translations[n],y=r.headers?r.headers["plural-forms"]:"";Object.keys(l).forEach(function(g,b){const w=l[g],v=n.length?n+""+g:g,B=w.comments&&w.comments.flag&&w.comments.flag.match(/fuzzy/)!==null;(!B||f.fuzzy)&&(f.format==="jed"?i[v]=[w.msgid_plural?w.msgid_plural:null].concat(w.msgstr):y==="nplurals=1; plural=0;"?(msgstr=w.msgid_plural?[w.msgstr]:w.msgstr,i[v]=[w.msgid_plural?w.msgid_plural:null].concat(msgstr)):i[v]=[w.msgid_plural?w.msgid_plural:null].concat(w.msgstr)),f["fallback-to-msgid"]&&(B&&!f.fuzzy||w.msgstr[0]==="")&&(i[v]=[w.msgid_plural?w.msgid_plural:null].concat(w.msgid_plural?[g,w.msgid_plural]:[g]))})}),r.headers&&(i[""]=r.headers),f.format==="mf"&&delete i[""],f.format.indexOf("jed")===0){const n={domain:f.domain,locale_data:{}};if(f.format==="jed"){for(const l in i)if(i.hasOwnProperty(l)&&l!==""){for(let y=2;y<i[l].length;y++)i[l][y]===""&&(i[l][y]=i[l][0]);i[l].shift()}}n.locale_data[f.domain]=i,n.locale_data[f.domain][""]={domain:f.domain,plural_forms:i[""]["plural-forms"],lang:i[""].language},i=n}return f.stringify?JSON.stringify(i,null,f.pretty?" ":null):i}})),Zn=It(Kn());function Qn(o){if(typeof o=="function")return o;const t=o?.default;return typeof t=="function"?t:void 0}function ea(o){if(!(o==null||typeof o!="object"||Array.isArray(o)))return o}function ta(o){const t=Qn(Zn.default)?.(o,{format:"jed",fuzzy:!0,domain:"default"});return ea(t?.locale_data?.default)}var ra="1.1.85-dev.3";ct.parsePoCatalog=ta,ct.version=ra});
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.4865197d.js","monaco":"static/monaco/index.js","po":"useblocks-po.4865197d.js"} });
1017
+ __amdEnv.require.config({ baseUrl: "./", paths: {"core":"useblocks-core.168aeeb1.js","monaco":"static/monaco/index.js","po":"useblocks-po.168aeeb1.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.85-dev.2";
1365
+ ns.version = "1.1.85-dev.3";
1366
1366
  }
1367
1367
 
1368
1368
  var modules = ns.modules = Object.create(null);
@@ -2080,7 +2080,7 @@ __useblocks__.define("useblocks.js",["require","exports","module","static/umd/a6
2080
2080
  `,`
2081
2081
  `)===t.replaceAll(`\r
2082
2082
  `,`
2083
- `)}function qi({emailId:e,readAutosave:t,revisionServiceEnabled:n,isHistoryAvailable:r,readShownContent:s,onFacts:o,onLate:i,onError:c,pageLoadTs:l=Yi()}){let u=null,d=!1,p=!1,m=0,b={emailId:e,historyLoaded:!1,isRecovering:!1},S=null;const E=new Promise(D=>{S=D}),g=D=>{b={...b,...D},o(b)},_=D=>{m+=1,g({applied:{phase:D,seq:m}})},v=()=>{u?.timer&&clearTimeout(u.timer),u=null},I=D=>{if(!p){if(S){const R=S;S=null,R(D),D.revision&&_(D.phase);return}i(D)&&D.revision&&_(D.phase)}},A=()=>{if(!u||p)return;const D=u.phase==="fast",R=D?Ui:Gi,U=D?$i:Vi;u.timer=setTimeout(()=>{const M=u;if(!(!M||p)){if(M.attempts+=1,y(),D&&M.attempts>=U){const{pending:G}=M;Ue(e),g({isRecovering:!1}),I({revision:{html:G.html,common_styles:G.common_styles,subject:G.subject,preheader:G.preheader},phase:"timeout"}),d=!0,M.phase="bg",M.attempts=0,A();return}if(!D&&M.attempts>=U){Ue(e),v(),g({isRecovering:!1}),d=!0;return}A()}},R),u.timer.unref?.()},P=D=>{u={phase:"fast",attempts:0,pending:D,timer:null},g({isRecovering:!0}),A()},h=(D,R)=>Hn(D.autosave,R===void 0?{}:{freshSince:R})?D.autosave:null,w=D=>{if(p)return;if(g({historyLoaded:!0,latestRevisionAt:D.latestAt!==void 0&&Number.isFinite(D.latestAt)?D.latestAt:void 0}),n&&u){const M=h(D,u.pending.sentAt);if(!M)return;const G=u.phase==="fast"?"found":"bg";Ue(e),v(),g({isRecovering:!1}),d=!0,I({revision:M,phase:G});return}if(d)return;const R=n?ji(e):null,U=R&&(R.sentAt<l||!zi(R.html,s()))?R:null;if(U){const M=h(D,U.sentAt);if(M){Ue(e),d=!0,I({revision:M,phase:"found"});return}P(U);return}d=!0,I({revision:h(D),phase:"normal"})},f=D=>{p||(c?.(D),b.historyLoaded||(g({historyLoaded:!1,latestRevisionAt:void 0}),x()),!u&&I({revision:null,phase:"normal"}))},y=()=>t(e).then(w).catch(f);let T,O=!1;const x=()=>{O||u||p||(O=!0,T=setTimeout(()=>{T=void 0,!p&&!b.historyLoaded&&y()},Hi))},q=()=>{p||(g({historyLoaded:!1,latestRevisionAt:void 0}),I({revision:null,phase:"normal"}))};return r?r().then(D=>D?y():q()):y(),{verdict:()=>E,dispose(){p=!0,T!==void 0&&(clearTimeout(T),T=void 0),v()}}}function Ki({port:e,revisionServiceEnabled:t,isHistoryAvailable:n,emailId:r,readShownContent:s,onFacts:o}){let i=null;const c=qi({emailId:r,readAutosave:l=>e.readAutosave(l),revisionServiceEnabled:t,...n?{isHistoryAvailable:n}:{},readShownContent:s,onFacts:o,onLate:({revision:l,phase:u})=>{const d=Wn(l);return i?.(d)??!1},onError:l=>{l instanceof Error&&l.message}});return{id:"recovery",load:()=>c.verdict().then(({revision:l})=>Wn(l)),watch(l){return i=l,()=>{i=null,c.dispose()}}}}function ir(e,t){return{readRevisions:(n,r)=>t.readRevisions(n,r),readAutosave:n=>t.readAutosave(n),async saveAutosave(n,r){Bi(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 Wi(e,t){return{readEmail:n=>e.readEmail(n),createEmail:n=>e.createEmail(n),async updateEmail(n,r){const s=await t.updateEmail(n,r);return await e.updateEmail(n,r),s}}}var ar=a.createIdentifier$1("CurrentUser"),lr={};function cr(e){return e.getOrCreateInstance(ar,()=>pe(lr))}function dr(e){return e?.getInstance(ar)?.get()??lr}function ur(e){return e?.getInstance(a.CONFIG_SOURCE_ID)?.get()??{}}var Xi=1.5;function Ji(e){return!e.isEnabled||e.isUserBusy||!e.isReady||!e.isInited?"none":e.isNew?"create":!e.isDirty||e.isSnapshotSent||!e.isHistoryLoaded||e.latestRevisionAgeMs!==void 0&&e.latestRevisionAgeMs<=Xi*e.autosaveTimeoutMs?"none":"revision"}var Qi=4;function Zi(e){const{readDocument:t,readEnvironment:n,onCreate:r,onRevision:s}=e,o=e.readFailures??(()=>0),i=()=>n().autosaveTimeoutMs*2**Math.min(o(),Qi),c=()=>{const _=t();if(!_||_.isDisposed())return"none";const{latestRevisionAt:v,snapshotVersion:I,...A}=n();return Ji({...A,isDirty:_.isDirty(),isNew:_.isNew(),isReady:_.isReady(),latestRevisionAgeMs:v!=null?Date.now()-v:void 0,isSnapshotSent:I!=null&&I===_.get().version})},l=()=>{const _=t();if(!_||_.isDisposed())return!1;if(!_.isDirty())return _.isNew();const{snapshotVersion:v}=n();return!(v!=null&&v===_.get().version)};let u,d,p,m,b=!1;const S=()=>{d=void 0;const _=t();if(!_||_.isDisposed())return;if(_.get().docId!==u){E();return}const v=c();v==="create"?r():v==="revision"?s():l()&&(u=_.get().docId,d=setTimeout(S,i()))},E=()=>{const _=t();b||!_||d!==void 0||c()==="none"&&!l()||(u=_.get().docId,d=setTimeout(S,i()))},g=()=>{const _=t();_!==p&&(m?.(),p=_,m=_?.subscribe(E),d!==void 0&&(clearTimeout(d),d=void 0))};return g(),E(),{refresh:()=>{b||(g(),E())},stop:()=>{b=!0,m?.(),m=void 0,p=void 0,d!==void 0&&(clearTimeout(d),d=void 0)}}}var fr=a.createIdentifier$1("documentSession.autosaveUiFacts"),pr={isUserBusy:!1,saveContext:{}};function ea(e){return e.getOrCreateInstance(fr,()=>pe(pr))}function mr(e){return e?.getInstance(fr)?.get()??pr}var ta=1e4;function na(e,t){const n=()=>{const l=t.current(),u=l?.get().serverId??void 0,d=ne(t.sessionKey()),p=t.recoveryFacts(),m=p?.emailId===u?p:void 0,b=t.revisionFacts(),S=m?.latestRevisionAt,E=b?.lastRevisionAt,g=dr(e).profile;return{isInited:d||l?.get().attributes.is_inited===!0,isEnabled:!!g?.autosaves,isHistoryLoaded:m?.historyLoaded===!0,isUserBusy:mr(e).isUserBusy,autosaveTimeoutMs:ur(e).autosaveTimeout||ta,latestRevisionAt:S!==void 0||E!==void 0?Math.max(S??0,E??0):void 0,snapshotVersion:b?.snapshotVersion}},r=()=>{const l=mr(e).saveContext;return{...l,project:l.project??t.current()?.get().attributes.project}},s=Zi({readDocument:()=>t.current(),readEnvironment:n,readFailures:()=>t.saveState().failures,onCreate:()=>{ne(t.sessionKey())||t.save("materialize",r())},onRevision:()=>{t.save("snapshot",{project:r().project})}}),o=t.subscribe(s.refresh),i=cr(e).watch(()=>s.refresh()),c=ea(e).watch(()=>s.refresh());return()=>{o(),i.dispose(),c.dispose(),s.stop()}}var hr=12e3;function se(e){return e.getOrCreateInstance(it,()=>{const t=Di({resolveAdapters:(r,s)=>oa(r,e,s),resolveWritePort:()=>gr(e),resolveHistoryPort:r=>ne(r)?br(e):Er(e),resolveTerms:()=>xi(e),canEdit:r=>ko(e,r),notifyBeforeSave:Vo(e),timeoutMs:hr,onAdapterError:(r,s)=>{s instanceof Error&&s.message,Me(s,{origin:"email-source-adapter",tags:{source:r}})},onTimeout:r=>{}}),n=na(e,t);return e.getInstance(a.DISPOSABLE_ID)?.addDispose(n),t})}function mt(e){return e?.getInstance(it)}function gr(e){const t=Oi(e);return t?ht(e)?Wi(t,le(e).email(e)):t:le(e).email(e)}function ra(e){return or(e)!==void 0||nr(e)}function Er(e){const t=or(e);return t?ht(e)?(j("port:history:server-backed"),ir(t,le(e).history(e))):(j("port:history:integrator"),t):(j("port:history:rest (порт не зарегистрирован)"),le(e).history(e))}function br(e){const t=sr(e);return t?ht(e)?(j("port:block-history:server-backed"),ir(t,le(e).blockHistory(e))):(j("port:block-history:integrator"),t):(j("port:block-history:rest (порт не зарегистрирован)"),le(e).blockHistory(e))}function sa(e){return sr(e)!==void 0||nr(e)}function ht(e){return An(e)}function oa({email:e,patch:t,serverId:n,key:r},s,o){const i=[];e?i.push({id:"rest",load:()=>qn(e),required:!0}):n&&i.push(Ri(gr(s),n)),t&&i.push({id:"plugin",load:()=>Kn(t)});const c=ne(r);return Yo(n)&&(c?sa(s):ra(s))&&i.push(Ki({port:c?br(s):Er(s),revisionServiceEnabled:An(s),...!c&&Bo(s)?{isHistoryAvailable:()=>jo(s)}:{},emailId:n,readShownContent:()=>o.readShownContent(),onFacts:l=>o.publishRecoveryFacts(l)})),i}function Y(e){return e.getOrCreateInstance(a.MESSAGE_SERVICE_ID,()=>new a.MessageService)}var _r=new WeakMap,gt=new WeakMap;function oe(e){return _r.get(e)??0}function vr(e,t){let n=gt.get(e);return n||(n=new Set,gt.set(e,n)),n.add(t),()=>{n?.delete(t)}}function ia(e){_r.set(e,oe(e)+1),gt.get(e)?.forEach(t=>t())}function aa(e){const t=se(e),n=Y(e).addListener(a.EVENT_TYPES.APPLICATION_HAS_AMP,r=>{Ie(t)?.mutate({attributes:{isAmp:r}},{source:"remote"})});e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>n.dispose())}function la(e){return e.size>0&&(e.type===""||e.type.startsWith("image/"))}function ca(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 c=await t(o,{mode:"cors",credentials:"omit",cache:i?"no-cache":"default"});if(!c.ok)return;const l=await c.blob();return la(l)?l:void 0}catch{return}}}}var ce={maxBytes:67108864,maxImageBytes:4194304,ttlMs:18e5};function da(e){const t={maxBytes:e.maxBytes??ce.maxBytes,maxImageBytes:e.maxImageBytes??ce.maxImageBytes,ttlMs:e.ttlMs??ce.ttlMs},n=e.now??(()=>Date.now()),r=new Map,s=new Map,o={hits:0,loads:0,failures:0};let i=0;const c=p=>{const m=r.get(p);m&&(i-=m.bytes,r.delete(p))},l=p=>t.ttlMs<=0||n()-p.storedAt<t.ttlMs,u=()=>{if(i<=t.maxBytes)return;const p=[...r.entries()].sort((m,b)=>m[1].usedAt-b[1].usedAt);for(const[m]of p){if(i<=t.maxBytes)return;c(m)}},d=(p,m)=>{m.size>t.maxImageBytes||(r.set(p,{blob:m,bytes:m.size,storedAt:n(),usedAt:n()}),i+=m.size,u())};return{async get(p){const m=r.get(p);if(m&&l(m))return m.usedAt=n(),o.hits+=1,m.blob;m&&c(p);const b=s.get(p);if(b!==void 0)return b;o.loads+=1;const S=(async()=>{try{const E=await e.load(p);return E?d(p,E):o.failures+=1,E}catch{o.failures+=1;return}finally{s.delete(p)}})();return s.set(p,S),S},forget(p){c(p),s.delete(p)},clear(){r.clear(),s.clear(),i=0},stats(){return{entries:r.size,bytes:i,...o}}}}var ua=["emcdn.ru","scr.emcdn.ru"];function fa(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 pa(e,t){const n=(r,s)=>{const o=new Set(s?t:[]);for(const i of r){const c=fa(i);c&&o.add(c)}return[...o]};return e?Array.isArray(e)?n(e,!0):n(e.value??[],e.replace!==!0):[...t]}function yr(e){const t=e??{},n=t.isPlugin!==!0?ua:[],r=t.canvasImageCache;if(r===!1)return{enabled:!1,sourceHosts:[],...ce};const s=r===!0||r===void 0?{}:r;return{enabled:s.enabled!==!1,sourceHosts:pa(s.sourceHosts,n),maxBytes:s.maxBytes??ce.maxBytes,maxImageBytes:s.maxImageBytes??ce.maxImageBytes,ttlMs:s.ttlMs??ce.ttlMs}}function ma(e){const t=Y(e),n=e.getInstance(a.CONFIG_SOURCE_ID);let r=yr(n?.get());const s=ca({sourceHosts:()=>r.sourceHosts}),o=da({load:S=>s.load(S),maxBytes:r.maxBytes,maxImageBytes:r.maxImageBytes,ttlMs:r.ttlMs}),i=()=>{t.send(a.EVENT_TYPES.SANDBOX_CANVAS_IMAGE_CACHE_SETUP,{enabled:r.enabled,sourceHosts:[...r.sourceHosts]})},c=t.onInit(()=>i()),l=n?.watch(()=>{const S=yr(n.get()),E=JSON.stringify(S)!==JSON.stringify(r);r=S,S.enabled||o.clear(),E&&t.isInited()&&i()}),u={asked:0,served:0,refused:0},d=[],p=(S,E)=>(u.refused+=1,d.push({url:S,reason:E}),d.length>20&&d.shift(),{refused:!0}),m=Object.assign(globalThis,{__emmCanvasImages__:()=>({settings:r,counters:{...u},refusals:[...d],store:o.stats()})}),b=t.addListenerAsync(a.EVENT_TYPES.APPLICATION_CANVAS_IMAGE_GET,async S=>{const E=S?.url??"";if(u.asked+=1,!r.enabled||!E)return p(E,"disabled");if(!s.accepts(E))return p(E,"host");S.fresh&&o.forget(E);const g=await o.get(E);return g?(u.served+=1,{blob:g}):p(E,"load-failed")});e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{c.dispose(),l?.dispose(),b.dispose(),o.clear(),delete m.__emmCanvasImages__})}var ha=2e3;function ga(e){const t=Y(e),n=new Set,r=()=>{const i=t.getTarget();if(!i||t.hasPort(i))return;const c=new MessageChannel;let l=!1;const u=p=>{p.data?.operationId==="em:port-ready"&&(l=!0,c.port1.removeEventListener("message",u),t.drainWindow(i))};c.port1.addEventListener("message",u),t.sendPort(i,c.port2),t.usePort(c.port1,!1,i);const d=setTimeout(()=>{n.delete(d),!l&&(Me(new Error("canvas port did not come up, staying on window messaging"),{origin:"canvas-channel"}),c.port1.removeEventListener("message",u),t.useWindow(i))},ha);n.add(d)},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(a.DISPOSABLE_ID)?.addDispose(()=>{for(const i of n)clearTimeout(i);o.dispose(),delete s.__emmCanvasPort__})}var Ea=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function ba(e){return Ea.test(e)||e.indexOf("//")===0}function He(e){return e&&(e.endsWith("/")?e:`${e}/`)}function _a(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:""}function Sr(e,t){const n=e==null||e===""?"./":String(e);if(ba(n))return He(n);const r=t??_a();if(!r)return He(n);try{return He(new URL(n,r).href)}catch{return He(n)}}function va(){return typeof __useblocks__<"u"&&__useblocks__?.publicPath?Sr(__useblocks__.publicPath):Sr("/")}var ya=()=>"",Sa=()=>"4865197d";function Ir(e){const t=e?"iframe-eblock":"iframe",n=ya();if(n){const o=n.replace(/\/?$/,"/");return bn(`${o}${t}.html`,ve())}const r=Sa(),s=`${va().replace(/\/?$/,"/")}iframe/`;return bn(`${s}${t}${r?`.${r}`:""}.html`,ve())}var wr="allow-top-navigation allow-scripts allow-popups allow-popups-to-escape-sandbox";function Et(e){return/^file:/i.test(String(e||"").trim())}function Ia(e){return Et(e)?`${wr} allow-same-origin`:wr}var qp="em:module-body",wa="em:module-body-ack";function Ta(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 bt(e){const t=e.split(/[?#]/)[0].split("/").pop()??"",n=/^(.+?)(?:\.[0-9a-f]{6,})?\.html$/.exec(t);return n?`js/${n[1]}.body.js`:void 0}function Aa(e,t){const n=bt(t)?.replace(/^js\/|\.body\.js$/g,""),r=n?e[`${n}.html`]:void 0;return r?(r.imports??[]).map(s=>e[s]?.file).filter(s=>!!s):[]}function Ca(e,t){const n=bt(t)?.replace(/\.body\.js$/,".js");if(!n||!(n in e))return[];const r=new Set([n]),s=[n],o=[];for(;s.length>0;)for(const i of e[s.shift()]??[])r.has(i)||(r.add(i),o.push(i),s.push(i));return o}async function Pa(e){try{const t=await fetch(e);return t.ok?await t.blob():void 0}catch{return}}function Da(e){const t=new Map,n=r=>{const s=Ta(r,e.canvasSrc,e.origin);if(!s)return;const o=t.get(s);if(o!==void 0)return o;const i=e.fetchBody(s);return t.set(s,i),i};return{take(r){return n(r)??Promise.resolve(void 0)},warm(r){for(const s of r)n(s)},reset(){t.clear()},get size(){return t.size}}}async function Ra(e,t,n){try{const r=new URL(".vite/manifest.json",new URL("./",new URL(e,t))).href,s=await fetch(r);if(!s.ok)return;const o=await s.json();n(Aa(o,e))}catch{}}function Oa(e){try{return Et(new URL(e,window.location.href).href)}catch{return Et(window.location.href)}}function La(e){Y(e);const t=Ir(!1);if(Oa(t))return;const n=Da({canvasSrc:t,origin:window.location.href,fetchBody:Pa}),r=bt(t);r&&n.warm([r]);const s={"js/iframe-eblock.js":["js/discussHandlers.BtCUuj58.js","js/typograf.all.BbXdyfMT.js"],"js/iframe.js":["js/rolldown-runtime.BRlIiq3h.js","js/discussHandlers.BtCUuj58.js"],"js/darkreader.CyLMh7_H.js":[],"js/discussHandlers.BtCUuj58.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?n.warm(Ca(s,t)):Ra(t,window.location.href,i=>n.warm(i));const o=i=>{const c=i.data;if(!c||c.operationId!=="em:module-body"||!c.result)return;const l=i.source;l&&(l.postMessage({operationId:wa,for:c.result},"*"),n.take(c.data?.url??"").then(u=>{l.postMessage({operationId:c.result,data:u??null},"*")}))};window.addEventListener("message",o),e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{window.removeEventListener("message",o),n.reset()})}var me=/<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,Na=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,he=/<style\b[^>]*>[\s\S]*?<\/style>/gi,Tr=/display:\s*none\s*!important/gi,xa=/((?:html\s*,\s*body|body\s*,\s*html)\s*\{)([^}]*)(\})/gi,Ma=/\s*height\s*:\s*100%\s*!important\s*;?/gi,Fa=/height\s*:\s*100%\s*!important/i,ka=[".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 Ba(e){return Tr.lastIndex=0,(e.match(Tr)||[]).length}function Ar(e){const t=e.trim(),n=Ba(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=ka.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 ja(e){he.lastIndex=0;for(const t of e.matchAll(he))if(Ar(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function Ua(e){let t=!1;return he.lastIndex=0,{html:e.replace(he,n=>Ar(n.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):n),found:t}}function Ha(e){return me.lastIndex=0,me.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||ja(e)}function $a(e){if(!Ha(e))return{html:e,found:!1};let t=!1,n=e;me.lastIndex=0,me.test(n)&&(me.lastIndex=0,n=n.replace(me,""),t=!0),(/\sbis_[a-z0-9_-]+\s*=/.test(n)||/\sdata-bis-config\s*=/.test(n))&&(n=n.replace(Na,""),t=!0);const r=Ua(n);return n=r.html,t=t||r.found,{html:n,found:t}}function Ga(e){return!e||!Fa.test(e)?e:(he.lastIndex=0,e.replace(he,t=>t.replace(xa,(n,r,s,o)=>`${r}${s.replace(Ma,"")}${o}`)))}function Cr(e){const t=$a(e.replaceAll(`\r
2083
+ `)}function qi({emailId:e,readAutosave:t,revisionServiceEnabled:n,isHistoryAvailable:r,readShownContent:s,onFacts:o,onLate:i,onError:c,pageLoadTs:l=Yi()}){let u=null,d=!1,p=!1,m=0,b={emailId:e,historyLoaded:!1,isRecovering:!1},S=null;const E=new Promise(D=>{S=D}),g=D=>{b={...b,...D},o(b)},_=D=>{m+=1,g({applied:{phase:D,seq:m}})},v=()=>{u?.timer&&clearTimeout(u.timer),u=null},I=D=>{if(!p){if(S){const R=S;S=null,R(D),D.revision&&_(D.phase);return}i(D)&&D.revision&&_(D.phase)}},A=()=>{if(!u||p)return;const D=u.phase==="fast",R=D?Ui:Gi,U=D?$i:Vi;u.timer=setTimeout(()=>{const M=u;if(!(!M||p)){if(M.attempts+=1,y(),D&&M.attempts>=U){const{pending:G}=M;Ue(e),g({isRecovering:!1}),I({revision:{html:G.html,common_styles:G.common_styles,subject:G.subject,preheader:G.preheader},phase:"timeout"}),d=!0,M.phase="bg",M.attempts=0,A();return}if(!D&&M.attempts>=U){Ue(e),v(),g({isRecovering:!1}),d=!0;return}A()}},R),u.timer.unref?.()},P=D=>{u={phase:"fast",attempts:0,pending:D,timer:null},g({isRecovering:!0}),A()},h=(D,R)=>Hn(D.autosave,R===void 0?{}:{freshSince:R})?D.autosave:null,w=D=>{if(p)return;if(g({historyLoaded:!0,latestRevisionAt:D.latestAt!==void 0&&Number.isFinite(D.latestAt)?D.latestAt:void 0}),n&&u){const M=h(D,u.pending.sentAt);if(!M)return;const G=u.phase==="fast"?"found":"bg";Ue(e),v(),g({isRecovering:!1}),d=!0,I({revision:M,phase:G});return}if(d)return;const R=n?ji(e):null,U=R&&(R.sentAt<l||!zi(R.html,s()))?R:null;if(U){const M=h(D,U.sentAt);if(M){Ue(e),d=!0,I({revision:M,phase:"found"});return}P(U);return}d=!0,I({revision:h(D),phase:"normal"})},f=D=>{p||(c?.(D),b.historyLoaded||(g({historyLoaded:!1,latestRevisionAt:void 0}),x()),!u&&I({revision:null,phase:"normal"}))},y=()=>t(e).then(w).catch(f);let T,O=!1;const x=()=>{O||u||p||(O=!0,T=setTimeout(()=>{T=void 0,!p&&!b.historyLoaded&&y()},Hi))},q=()=>{p||(g({historyLoaded:!1,latestRevisionAt:void 0}),I({revision:null,phase:"normal"}))};return r?r().then(D=>D?y():q()):y(),{verdict:()=>E,dispose(){p=!0,T!==void 0&&(clearTimeout(T),T=void 0),v()}}}function Ki({port:e,revisionServiceEnabled:t,isHistoryAvailable:n,emailId:r,readShownContent:s,onFacts:o}){let i=null;const c=qi({emailId:r,readAutosave:l=>e.readAutosave(l),revisionServiceEnabled:t,...n?{isHistoryAvailable:n}:{},readShownContent:s,onFacts:o,onLate:({revision:l,phase:u})=>{const d=Wn(l);return i?.(d)??!1},onError:l=>{l instanceof Error&&l.message}});return{id:"recovery",load:()=>c.verdict().then(({revision:l})=>Wn(l)),watch(l){return i=l,()=>{i=null,c.dispose()}}}}function ir(e,t){return{readRevisions:(n,r)=>t.readRevisions(n,r),readAutosave:n=>t.readAutosave(n),async saveAutosave(n,r){Bi(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 Wi(e,t){return{readEmail:n=>e.readEmail(n),createEmail:n=>e.createEmail(n),async updateEmail(n,r){const s=await t.updateEmail(n,r);return await e.updateEmail(n,r),s}}}var ar=a.createIdentifier$1("CurrentUser"),lr={};function cr(e){return e.getOrCreateInstance(ar,()=>pe(lr))}function dr(e){return e?.getInstance(ar)?.get()??lr}function ur(e){return e?.getInstance(a.CONFIG_SOURCE_ID)?.get()??{}}var Xi=1.5;function Ji(e){return!e.isEnabled||e.isUserBusy||!e.isReady||!e.isInited?"none":e.isNew?"create":!e.isDirty||e.isSnapshotSent||!e.isHistoryLoaded||e.latestRevisionAgeMs!==void 0&&e.latestRevisionAgeMs<=Xi*e.autosaveTimeoutMs?"none":"revision"}var Qi=4;function Zi(e){const{readDocument:t,readEnvironment:n,onCreate:r,onRevision:s}=e,o=e.readFailures??(()=>0),i=()=>n().autosaveTimeoutMs*2**Math.min(o(),Qi),c=()=>{const _=t();if(!_||_.isDisposed())return"none";const{latestRevisionAt:v,snapshotVersion:I,...A}=n();return Ji({...A,isDirty:_.isDirty(),isNew:_.isNew(),isReady:_.isReady(),latestRevisionAgeMs:v!=null?Date.now()-v:void 0,isSnapshotSent:I!=null&&I===_.get().version})},l=()=>{const _=t();if(!_||_.isDisposed())return!1;if(!_.isDirty())return _.isNew();const{snapshotVersion:v}=n();return!(v!=null&&v===_.get().version)};let u,d,p,m,b=!1;const S=()=>{d=void 0;const _=t();if(!_||_.isDisposed())return;if(_.get().docId!==u){E();return}const v=c();v==="create"?r():v==="revision"?s():l()&&(u=_.get().docId,d=setTimeout(S,i()))},E=()=>{const _=t();b||!_||d!==void 0||c()==="none"&&!l()||(u=_.get().docId,d=setTimeout(S,i()))},g=()=>{const _=t();_!==p&&(m?.(),p=_,m=_?.subscribe(E),d!==void 0&&(clearTimeout(d),d=void 0))};return g(),E(),{refresh:()=>{b||(g(),E())},stop:()=>{b=!0,m?.(),m=void 0,p=void 0,d!==void 0&&(clearTimeout(d),d=void 0)}}}var fr=a.createIdentifier$1("documentSession.autosaveUiFacts"),pr={isUserBusy:!1,saveContext:{}};function ea(e){return e.getOrCreateInstance(fr,()=>pe(pr))}function mr(e){return e?.getInstance(fr)?.get()??pr}var ta=1e4;function na(e,t){const n=()=>{const l=t.current(),u=l?.get().serverId??void 0,d=ne(t.sessionKey()),p=t.recoveryFacts(),m=p?.emailId===u?p:void 0,b=t.revisionFacts(),S=m?.latestRevisionAt,E=b?.lastRevisionAt,g=dr(e).profile;return{isInited:d||l?.get().attributes.is_inited===!0,isEnabled:!!g?.autosaves,isHistoryLoaded:m?.historyLoaded===!0,isUserBusy:mr(e).isUserBusy,autosaveTimeoutMs:ur(e).autosaveTimeout||ta,latestRevisionAt:S!==void 0||E!==void 0?Math.max(S??0,E??0):void 0,snapshotVersion:b?.snapshotVersion}},r=()=>{const l=mr(e).saveContext;return{...l,project:l.project??t.current()?.get().attributes.project}},s=Zi({readDocument:()=>t.current(),readEnvironment:n,readFailures:()=>t.saveState().failures,onCreate:()=>{ne(t.sessionKey())||t.save("materialize",r())},onRevision:()=>{t.save("snapshot",{project:r().project})}}),o=t.subscribe(s.refresh),i=cr(e).watch(()=>s.refresh()),c=ea(e).watch(()=>s.refresh());return()=>{o(),i.dispose(),c.dispose(),s.stop()}}var hr=12e3;function se(e){return e.getOrCreateInstance(it,()=>{const t=Di({resolveAdapters:(r,s)=>oa(r,e,s),resolveWritePort:()=>gr(e),resolveHistoryPort:r=>ne(r)?br(e):Er(e),resolveTerms:()=>xi(e),canEdit:r=>ko(e,r),notifyBeforeSave:Vo(e),timeoutMs:hr,onAdapterError:(r,s)=>{s instanceof Error&&s.message,Me(s,{origin:"email-source-adapter",tags:{source:r}})},onTimeout:r=>{}}),n=na(e,t);return e.getInstance(a.DISPOSABLE_ID)?.addDispose(n),t})}function mt(e){return e?.getInstance(it)}function gr(e){const t=Oi(e);return t?ht(e)?Wi(t,le(e).email(e)):t:le(e).email(e)}function ra(e){return or(e)!==void 0||nr(e)}function Er(e){const t=or(e);return t?ht(e)?(j("port:history:server-backed"),ir(t,le(e).history(e))):(j("port:history:integrator"),t):(j("port:history:rest (порт не зарегистрирован)"),le(e).history(e))}function br(e){const t=sr(e);return t?ht(e)?(j("port:block-history:server-backed"),ir(t,le(e).blockHistory(e))):(j("port:block-history:integrator"),t):(j("port:block-history:rest (порт не зарегистрирован)"),le(e).blockHistory(e))}function sa(e){return sr(e)!==void 0||nr(e)}function ht(e){return An(e)}function oa({email:e,patch:t,serverId:n,key:r},s,o){const i=[];e?i.push({id:"rest",load:()=>qn(e),required:!0}):n&&i.push(Ri(gr(s),n)),t&&i.push({id:"plugin",load:()=>Kn(t)});const c=ne(r);return Yo(n)&&(c?sa(s):ra(s))&&i.push(Ki({port:c?br(s):Er(s),revisionServiceEnabled:An(s),...!c&&Bo(s)?{isHistoryAvailable:()=>jo(s)}:{},emailId:n,readShownContent:()=>o.readShownContent(),onFacts:l=>o.publishRecoveryFacts(l)})),i}function Y(e){return e.getOrCreateInstance(a.MESSAGE_SERVICE_ID,()=>new a.MessageService)}var _r=new WeakMap,gt=new WeakMap;function oe(e){return _r.get(e)??0}function vr(e,t){let n=gt.get(e);return n||(n=new Set,gt.set(e,n)),n.add(t),()=>{n?.delete(t)}}function ia(e){_r.set(e,oe(e)+1),gt.get(e)?.forEach(t=>t())}function aa(e){const t=se(e),n=Y(e).addListener(a.EVENT_TYPES.APPLICATION_HAS_AMP,r=>{Ie(t)?.mutate({attributes:{isAmp:r}},{source:"remote"})});e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>n.dispose())}function la(e){return e.size>0&&(e.type===""||e.type.startsWith("image/"))}function ca(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 c=await t(o,{mode:"cors",credentials:"omit",cache:i?"no-cache":"default"});if(!c.ok)return;const l=await c.blob();return la(l)?l:void 0}catch{return}}}}var ce={maxBytes:67108864,maxImageBytes:4194304,ttlMs:18e5};function da(e){const t={maxBytes:e.maxBytes??ce.maxBytes,maxImageBytes:e.maxImageBytes??ce.maxImageBytes,ttlMs:e.ttlMs??ce.ttlMs},n=e.now??(()=>Date.now()),r=new Map,s=new Map,o={hits:0,loads:0,failures:0};let i=0;const c=p=>{const m=r.get(p);m&&(i-=m.bytes,r.delete(p))},l=p=>t.ttlMs<=0||n()-p.storedAt<t.ttlMs,u=()=>{if(i<=t.maxBytes)return;const p=[...r.entries()].sort((m,b)=>m[1].usedAt-b[1].usedAt);for(const[m]of p){if(i<=t.maxBytes)return;c(m)}},d=(p,m)=>{m.size>t.maxImageBytes||(r.set(p,{blob:m,bytes:m.size,storedAt:n(),usedAt:n()}),i+=m.size,u())};return{async get(p){const m=r.get(p);if(m&&l(m))return m.usedAt=n(),o.hits+=1,m.blob;m&&c(p);const b=s.get(p);if(b!==void 0)return b;o.loads+=1;const S=(async()=>{try{const E=await e.load(p);return E?d(p,E):o.failures+=1,E}catch{o.failures+=1;return}finally{s.delete(p)}})();return s.set(p,S),S},forget(p){c(p),s.delete(p)},clear(){r.clear(),s.clear(),i=0},stats(){return{entries:r.size,bytes:i,...o}}}}var ua=["emcdn.ru","scr.emcdn.ru"];function fa(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 pa(e,t){const n=(r,s)=>{const o=new Set(s?t:[]);for(const i of r){const c=fa(i);c&&o.add(c)}return[...o]};return e?Array.isArray(e)?n(e,!0):n(e.value??[],e.replace!==!0):[...t]}function yr(e){const t=e??{},n=t.isPlugin!==!0?ua:[],r=t.canvasImageCache;if(r===!1)return{enabled:!1,sourceHosts:[],...ce};const s=r===!0||r===void 0?{}:r;return{enabled:s.enabled!==!1,sourceHosts:pa(s.sourceHosts,n),maxBytes:s.maxBytes??ce.maxBytes,maxImageBytes:s.maxImageBytes??ce.maxImageBytes,ttlMs:s.ttlMs??ce.ttlMs}}function ma(e){const t=Y(e),n=e.getInstance(a.CONFIG_SOURCE_ID);let r=yr(n?.get());const s=ca({sourceHosts:()=>r.sourceHosts}),o=da({load:S=>s.load(S),maxBytes:r.maxBytes,maxImageBytes:r.maxImageBytes,ttlMs:r.ttlMs}),i=()=>{t.send(a.EVENT_TYPES.SANDBOX_CANVAS_IMAGE_CACHE_SETUP,{enabled:r.enabled,sourceHosts:[...r.sourceHosts]})},c=t.onInit(()=>i()),l=n?.watch(()=>{const S=yr(n.get()),E=JSON.stringify(S)!==JSON.stringify(r);r=S,S.enabled||o.clear(),E&&t.isInited()&&i()}),u={asked:0,served:0,refused:0},d=[],p=(S,E)=>(u.refused+=1,d.push({url:S,reason:E}),d.length>20&&d.shift(),{refused:!0}),m=Object.assign(globalThis,{__emmCanvasImages__:()=>({settings:r,counters:{...u},refusals:[...d],store:o.stats()})}),b=t.addListenerAsync(a.EVENT_TYPES.APPLICATION_CANVAS_IMAGE_GET,async S=>{const E=S?.url??"";if(u.asked+=1,!r.enabled||!E)return p(E,"disabled");if(!s.accepts(E))return p(E,"host");S.fresh&&o.forget(E);const g=await o.get(E);return g?(u.served+=1,{blob:g}):p(E,"load-failed")});e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{c.dispose(),l?.dispose(),b.dispose(),o.clear(),delete m.__emmCanvasImages__})}var ha=2e3;function ga(e){const t=Y(e),n=new Set,r=()=>{const i=t.getTarget();if(!i||t.hasPort(i))return;const c=new MessageChannel;let l=!1;const u=p=>{p.data?.operationId==="em:port-ready"&&(l=!0,c.port1.removeEventListener("message",u),t.drainWindow(i))};c.port1.addEventListener("message",u),t.sendPort(i,c.port2),t.usePort(c.port1,!1,i);const d=setTimeout(()=>{n.delete(d),!l&&(Me(new Error("canvas port did not come up, staying on window messaging"),{origin:"canvas-channel"}),c.port1.removeEventListener("message",u),t.useWindow(i))},ha);n.add(d)},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(a.DISPOSABLE_ID)?.addDispose(()=>{for(const i of n)clearTimeout(i);o.dispose(),delete s.__emmCanvasPort__})}var Ea=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function ba(e){return Ea.test(e)||e.indexOf("//")===0}function He(e){return e&&(e.endsWith("/")?e:`${e}/`)}function _a(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:""}function Sr(e,t){const n=e==null||e===""?"./":String(e);if(ba(n))return He(n);const r=t??_a();if(!r)return He(n);try{return He(new URL(n,r).href)}catch{return He(n)}}function va(){return typeof __useblocks__<"u"&&__useblocks__?.publicPath?Sr(__useblocks__.publicPath):Sr("/")}var ya=()=>"",Sa=()=>"168aeeb1";function Ir(e){const t=e?"iframe-eblock":"iframe",n=ya();if(n){const o=n.replace(/\/?$/,"/");return bn(`${o}${t}.html`,ve())}const r=Sa(),s=`${va().replace(/\/?$/,"/")}iframe/`;return bn(`${s}${t}${r?`.${r}`:""}.html`,ve())}var wr="allow-top-navigation allow-scripts allow-popups allow-popups-to-escape-sandbox";function Et(e){return/^file:/i.test(String(e||"").trim())}function Ia(e){return Et(e)?`${wr} allow-same-origin`:wr}var qp="em:module-body",wa="em:module-body-ack";function Ta(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 bt(e){const t=e.split(/[?#]/)[0].split("/").pop()??"",n=/^(.+?)(?:\.[0-9a-f]{6,})?\.html$/.exec(t);return n?`js/${n[1]}.body.js`:void 0}function Aa(e,t){const n=bt(t)?.replace(/^js\/|\.body\.js$/g,""),r=n?e[`${n}.html`]:void 0;return r?(r.imports??[]).map(s=>e[s]?.file).filter(s=>!!s):[]}function Ca(e,t){const n=bt(t)?.replace(/\.body\.js$/,".js");if(!n||!(n in e))return[];const r=new Set([n]),s=[n],o=[];for(;s.length>0;)for(const i of e[s.shift()]??[])r.has(i)||(r.add(i),o.push(i),s.push(i));return o}async function Pa(e){try{const t=await fetch(e);return t.ok?await t.blob():void 0}catch{return}}function Da(e){const t=new Map,n=r=>{const s=Ta(r,e.canvasSrc,e.origin);if(!s)return;const o=t.get(s);if(o!==void 0)return o;const i=e.fetchBody(s);return t.set(s,i),i};return{take(r){return n(r)??Promise.resolve(void 0)},warm(r){for(const s of r)n(s)},reset(){t.clear()},get size(){return t.size}}}async function Ra(e,t,n){try{const r=new URL(".vite/manifest.json",new URL("./",new URL(e,t))).href,s=await fetch(r);if(!s.ok)return;const o=await s.json();n(Aa(o,e))}catch{}}function Oa(e){try{return Et(new URL(e,window.location.href).href)}catch{return Et(window.location.href)}}function La(e){Y(e);const t=Ir(!1);if(Oa(t))return;const n=Da({canvasSrc:t,origin:window.location.href,fetchBody:Pa}),r=bt(t);r&&n.warm([r]);const s={"js/iframe-eblock.js":["js/discussHandlers.BxlCsZ-4.js","js/typograf.all.BbXdyfMT.js"],"js/iframe.js":["js/rolldown-runtime.BRlIiq3h.js","js/discussHandlers.BxlCsZ-4.js"],"js/darkreader.CyLMh7_H.js":[],"js/discussHandlers.BxlCsZ-4.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?n.warm(Ca(s,t)):Ra(t,window.location.href,i=>n.warm(i));const o=i=>{const c=i.data;if(!c||c.operationId!=="em:module-body"||!c.result)return;const l=i.source;l&&(l.postMessage({operationId:wa,for:c.result},"*"),n.take(c.data?.url??"").then(u=>{l.postMessage({operationId:c.result,data:u??null},"*")}))};window.addEventListener("message",o),e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{window.removeEventListener("message",o),n.reset()})}var me=/<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,Na=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,he=/<style\b[^>]*>[\s\S]*?<\/style>/gi,Tr=/display:\s*none\s*!important/gi,xa=/((?:html\s*,\s*body|body\s*,\s*html)\s*\{)([^}]*)(\})/gi,Ma=/\s*height\s*:\s*100%\s*!important\s*;?/gi,Fa=/height\s*:\s*100%\s*!important/i,ka=[".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 Ba(e){return Tr.lastIndex=0,(e.match(Tr)||[]).length}function Ar(e){const t=e.trim(),n=Ba(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=ka.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 ja(e){he.lastIndex=0;for(const t of e.matchAll(he))if(Ar(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function Ua(e){let t=!1;return he.lastIndex=0,{html:e.replace(he,n=>Ar(n.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):n),found:t}}function Ha(e){return me.lastIndex=0,me.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||ja(e)}function $a(e){if(!Ha(e))return{html:e,found:!1};let t=!1,n=e;me.lastIndex=0,me.test(n)&&(me.lastIndex=0,n=n.replace(me,""),t=!0),(/\sbis_[a-z0-9_-]+\s*=/.test(n)||/\sdata-bis-config\s*=/.test(n))&&(n=n.replace(Na,""),t=!0);const r=Ua(n);return n=r.html,t=t||r.found,{html:n,found:t}}function Ga(e){return!e||!Fa.test(e)?e:(he.lastIndex=0,e.replace(he,t=>t.replace(xa,(n,r,s,o)=>`${r}${s.replace(Ma,"")}${o}`)))}function Cr(e){const t=$a(e.replaceAll(`\r
2084
2084
  `,`
2085
2085
  `));return{html:Ga(t.html),hasBrowserExtensionArtifacts:t.found}}function _t(e){return e?.getContent()??""}function Pr(e,t){e?.mutate({content:$n(t)},{source:"remote"})}function Dr(e){return a.createIdentifier$1(e)}function Q(e,t){return e.getOrCreateInstance(t,()=>new a.AsyncEmitter)}function H(e,t){return e.getOrCreateInstance(t,()=>new a.AsyncEmitter).event}function vt(e,t,n,r){return{html:e,guid:t,...Object.keys(n).length>0?{templateDirectivesPolicy:n}:{},...r!==void 0?{rev:r}:{}}}var Va=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}},Ya=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(a.createAbortError("Superseded by newer show()")),n.aborted?Promise.reject(a.createAbortError(n.reason)):(this._activeRequest=e,new Promise((r,s)=>{const o=setTimeout(()=>{this._settle(e.showId,()=>{s(new Va(e.showId,t))})},t);o.unref?.();const i=()=>{this._settle(e.showId,()=>{s(a.createAbortError(n.reason))})};n.addEventListener("abort",i,{once:!0});const c=()=>{clearTimeout(o),n.removeEventListener("abort",i)};this._pending.set(e.showId,{request:e,resolve:r,reject:s,timeoutId:o,dispose:c});for(const l of this._listeners)l(e)}))}completeShow(e){this._settle(e,t=>{t.resolve()})}hasPendingShow(e){return this._pending.has(e)}failShow(e,t){this._settle(e,n=>{n.reject(t)})}rejectAll(e){this._rejectPending(e),this._activeRequest=null}_settle(e,t){const n=this._pending.get(e);n&&(n.dispose(),this._pending.delete(e),this._activeRequest?.showId===e&&(this._activeRequest=null),t(n))}_rejectPending(e){for(const[,t]of this._pending)t.dispose(),t.reject(e);this._pending.clear()}};function za(e,t){return{contentReady:t.contentReady??e?.contentReady,sandboxReady:t.sandboxReady??e?.sandboxReady,sandbox:t.sandbox?{...e?.sandbox,...t.sandbox}:e?.sandbox}}function qa(e){if(!e||!(e.contentReady!==void 0||e.sandboxReady!==void 0||e.sandbox!==void 0))return;const t=Ln(e),n=Nn(e),r=Ho(e.sandbox);t<n+r}var Rr=class{_controller=new AbortController;_externalSignalDisposable=new a.Disposable;_sessionChangeListeners=new Set;_showRegistry=new Ya;_timeouts;_generation=0;_sessionStarted=!1;get signal(){return this._controller.signal}get generation(){return this._generation}get contentReadyTimeoutMs(){return Ln(this._timeouts)}getSandboxTimeoutMs(e){return On(e,this._timeouts?.sandbox)}getSandboxReadyTimeoutMs(){return Nn(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=za(this._timeouts,e.timeouts),qa(this._timeouts));const t=e.replaceSession===!0||!this._sessionStarted||e.timeouts!==void 0||e.signal!==void 0;this._sessionStarted=!0,t&&(this._replaceSessionController(),this.bumpGeneration()),(e.signal!==void 0||t)&&this._linkExternalSignal(e.signal)}abort(e){const t=e??a.createAbortError("Editor instance destroyed");this._showRegistry.rejectAll(t),this._controller.signal.aborted||(this._controller.abort(t),this.bumpGeneration()),this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new a.Disposable}_replaceSessionController(){this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new a.Disposable,this._showRegistry.rejectAll(a.createAbortError("Init session replaced")),this._controller.signal.aborted||this._controller.abort(a.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??a.createAbortError()),this.bumpGeneration());return}const t=()=>{this._controller.signal.aborted||(this._controller.abort(e.reason??a.createAbortError()),this.bumpGeneration())};e.addEventListener("abort",t),this._externalSignalDisposable.addDispose(()=>{e.removeEventListener("abort",t)})}},yt=(()=>{const e=new Rr;return e.configure({}),e})(),Ka=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 Wa(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 Xa(e,t,n){return e.isInited()&&e.getTarget()?Promise.resolve():(a.throwIfAborted(n),new Promise((r,s)=>{let o=!1,i,c;const l=d=>{o||(o=!0,i!==void 0&&(clearTimeout(i),i=void 0),c?.dispose(),n?.removeEventListener("abort",u),d())},u=()=>{l(()=>s(a.createAbortError(n?.reason)))};if(c=e.onInit(()=>{e.isInited()&&e.getTarget()&&l(()=>r())}),e.isInited()&&e.getTarget()){l(()=>r());return}t>0&&(i=setTimeout(()=>{l(()=>s(new Ka(t)))},t)),n?.addEventListener("abort",u)}))}var Ja=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 Qa(e,t,n){return t<=0?e:new Promise((r,s)=>{let o=!1,i;const c=l=>{o||(o=!0,i!==void 0&&(clearTimeout(i),i=void 0),l())};i=setTimeout(()=>{c(()=>s(new Ja(n,t)))},t),e.then(l=>{c(()=>r(l))},l=>{c(()=>s(l))})})}var Za=2,$e=Symbol("sandbox:frame-replaced");function ee(e,t,n,r,s,o,i){const c=`sandbox:${t}`,l=o?.getSandboxTimeoutMs(t)??lt[t],u=()=>{let S=Qa(e.sendAsync(n,r),l,c);return S=a.raceWithAbortSignal(S,o?.signal),we(c,S,s)};if(t==="INIT_START"&&Wa(e)){const S=o?.getSandboxReadyTimeoutMs()??2e4,E=e,g=_=>{const v=Xa(E,S,o?.signal);return we("sandbox:INIT_START:ready-wait",v,s).then(()=>{if(!i||_<=0)return u();const I=i.getGeneration();let A;const P=new Promise((w,f)=>{A=i.onChange(()=>{i.getGeneration()!==I&&f($e)})}),h=u();return h.catch(()=>{}),Promise.race([h,P]).finally(()=>A?.()).catch(w=>{if(w!==$e)throw w;return{...s},g(_-1)})})};return g(Za)}if(!i)return u();const d=i.getGeneration();let p;const m=new Promise((S,E)=>{p=i.onChange(()=>{i.getGeneration()!==d&&E($e)})}),b=u();return b.catch(()=>{}),Promise.race([b,m]).finally(()=>p?.()).catch(S=>{throw S===$e&&{...s},S})}var el=[["brace-percent",/<!--\{%/],["brace-hash",/<!--\{#/],["proscript",/<!--\[%/],["getresponse",/<!--\[\[(?:if|else\]\]|endif\]\])/i],["mailchimp",/<!--\*\|/],["expert-sender",/<!--<\/?(?:if|else|var)/i]],tl=200;function nl(e=new Set){const t=new Set;return(n,r)=>{if(!el.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>=tl&&t.clear(),t.add(s))}}function rl(){return{isConfigured:()=>!1,toEditorForm:e=>e,toOutputForm:e=>e,keepWrappedOnOutput:new Set,editorPolicy:{},warnAboutUnconfiguredInput:nl()}}var sl=rl();function ge(e){return e?.getInstance(a.TEMPLATE_DIRECTIVES_ID)??sl}function ol(e){const t=se(e),n=Y(e),r=()=>e.getInstance(a.INIT_PIPELINE_ID)??yt;let s,o,i=!1,c=!1;const l=async(v,I,A)=>{const P=A.generation,h=()=>A.generation!==P||A.signal.aborted||t.current()!==v||c,w=oe(n);i=!0;try{if(await ee(n,"INIT_START",a.EVENT_TYPES.SANDBOX_INIT_START,{guid:I},void 0,A),h())return;const{html:f,hasBrowserExtensionArtifacts:y}=Cr(_t(v));if(y&&Q(e,a.events.ON_BROWSER_EXTENSION_DETECTED_ID).fire(),Pr(v,f),await ee(n,"SET_ENTITY",a.EVENT_TYPES.SANDBOX_SET_ENTITY,vt(_t(v),I,ge(e).editorPolicy,v.get().version),void 0,A),h())return;await ee(n,"INITED",a.EVENT_TYPES.SANDBOX_INITED,{guid:I},void 0,A),s=I,o=w}finally{i=!1}},u=()=>ne(t.sessionKey())?t.current():void 0,d=()=>{if(c||i)return;const v=u(),I=v?.get().docId;if(!v||!I||s===I&&o===oe(n)||!v.isReady())return;const A=r();A.signal.aborted||l(v,I,A).catch(()=>{})};let p=!1;const m=()=>{p||c||(p=!0,queueMicrotask(()=>{p=!1,d()}))};let b,S;const E=()=>{const v=u(),I=v?.get().docId;I!==S&&(b?.(),S=I,b=v?.subscribe(m)),m()},g=t.subscribe(E),_=vr(n,m);E(),e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{c=!0,_(),b?.(),g()})}var il=200;function al({startVersion:e,limit:t=il}){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 c=n.filter(u=>u.version>i);s(i);let l=o;for(const u of c){if(u.fromCanvas||u.contentReplaced||!u.changes)return null;const d=u.changes,p=[];for(const m of l){const b=Qo(m.range,d,"after");if(!b)return null;p.push({range:b,text:m.text})}l=p}return l}}}function ll(e,t){let n=0;return e.map(({start:r,end:s,text:o})=>{const i=new J(r,t.slice(r,s),r+n,o);return n+=o.length-(s-r),i})}function cl(e,t){const n=[...e].sort((r,s)=>r.range.start-s.range.start);return ll(n.map(({range:r,text:s})=>({start:r.start,end:r.end,text:s})),t)}function dl(e){return[...e].sort((t,n)=>n.oldPosition-t.oldPosition).map(t=>({range:{start:t.oldPosition,end:t.oldEnd},text:t.newText}))}var St=a.createIdentifier$1("canvas.sandboxFill");function Or(e){return e.getInstance(St)?.pipeline.isEventsLocked()===!0}function It(e){Me(e,{origin:"canvas-channel"})}function ul(e){const t=se(e),n=Y(e);let r;const s=(l,u)=>{const d=l.get().docId;let p=!1,m=null,b=null;const S=al({startVersion:l.get().version});let E=l.getContent();const g=async(P,h)=>{if(b){b.push({edits:P,rev:h});return}b=[{edits:P,rev:h}];try{do{const w=b.splice(0,b.length);await n.sendAsync(a.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,{edits:w.map(f=>f.edits),guid:d,rev:w[w.length-1].rev})}while(b.length)}finally{b=null}},_=(P,h)=>{const w=b?.splice(0,b.length)??[];w.length&&n.sendAsync(a.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,{edits:w.map(f=>f.edits),guid:d,rev:w[w.length-1].rev}).catch(It),n.sendAsync(a.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,{edits:[P],guid:d,rev:l.get().version,...h!==null?{changeId:h}:{}}).catch(It)},v=P=>{const{guid:h,pushUndoStop:w}=P;if(h!==d)return;const f=ci(P);let{edits:y}=P;if(f.baseRev!==null){const O=S.rebase(y,f.baseRev);if(!O){Me(new Error("canvas batch conflicts with newer document changes"),{origin:"canvas-channel"}),_([],f.changeId);return}y=O}const T=l.get().version;try{p=!0,m=f.changeId;const O=cl(y,l.getContent());w===!1?u.applyWithoutHistory(O):l.mutate({changes:O},{source:Or(e)?"system":"user"})}finally{p=!1,m=null}l.get().version===T&&f.baseRev!==null&&_([],f.changeId)},I=l.subscribe(({changes:P,version:h})=>{const w=l.getContent(),f=!P?.length&&w!==E;if(E=w,S.record({version:h,changes:P,contentReplaced:f,fromCanvas:p}),!P?.length)return;const y=dl(P);p?_(y,m):g(y,h).catch(It)}),A=n.addListener(a.EVENT_TYPES.APPLICATION_UPDATE_ENTITY,v);return()=>{I(),A.dispose()}};let o;const i=()=>{const l=t.current(),u=t.history(),d=l?.get().docId;d!==o&&(r?.(),r=void 0,o=d,l&&u&&(r=s(l,u)))},c=t.subscribe(i);i(),e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{r?.(),c()})}var fl=300,pl=15e3,Lr="em-canvas-busy-style";function ml(){if(document.getElementById(Lr))return;const e=document.createElement("style");e.id=Lr,e.textContent="@keyframes em-canvas-busy-spin{to{transform:rotate(360deg)}}",document.head.appendChild(e)}function hl(e){const t=e.getBoundingClientRect(),n=document.createElement("div");return n.setAttribute("aria-busy","true"),Object.assign(n.style,{position:"fixed",left:`${t.left}px`,top:`${t.top}px`,width:`${t.width}px`,height:`${t.height}px`,cursor:"progress",display:"flex",alignItems:"center",justifyContent:"center"}),e.appendChild(n),{showSpinner(){ml(),n.style.background="rgba(128, 128, 128, 0.15)";const r=document.createElement("div");Object.assign(r.style,{width:"32px",height:"32px",borderRadius:"50%",border:"3px solid rgba(128, 128, 128, 0.35)",borderTopColor:"rgba(80, 80, 80, 0.9)",animation:"em-canvas-busy-spin 0.8s linear infinite"}),n.appendChild(r)},remove:()=>n.remove()}}var gl=8e3;function El(){return{element:document.createElement("iframe"),ready:()=>Promise.reject(new Error("[canvas] нет элемента монтирования")),reload:()=>Promise.resolve(),reloadQuietly:()=>Promise.resolve(),scrollBy:()=>{},shown:!1,whenShown:()=>Promise.resolve(),alignTo:()=>{},resize:()=>{},dispose:()=>{}}}var bl=e=>{for(let t=e?.parentElement??null;t;t=t.parentElement){const n=getComputedStyle(t).overflowY;if(n==="auto"||n==="scroll"||n==="hidden")return t}return null};function _l(e,t,n,r,s){const o=n.readyTimeoutMs??gl,i=document.createElement("div");i.dataset.canvasHost=e,r&&(i.dataset.canvasPlace=r),i.style.position="fixed",i.style.overflow="hidden",i.style.visibility="hidden";const c=n.resolveSrc(e),l=document.createElement("iframe");l.setAttribute("sandbox",n.resolveSandbox(c)),l.setAttribute("allow","clipboard-read; clipboard-write"),l.setAttribute("title","Email content"),l.style.width="100%",l.style.border="0",l.style.display="block",l.style.minHeight="600px",l.src=c,i.appendChild(l),t.appendChild(i),n.mark?.("created"),s||n.onCreated?.(l);const u=new a.Disposable;let d=!1,p=!1,m,b,S,E;const g=()=>{clearTimeout(E),E=setTimeout(()=>{p||(p=!0,b?.(new Error(`[canvas] ${e}: документ не загрузился за ${o} мс`)))},o)},_=()=>d?(S=Promise.resolve(),p=!0,S):(p=!1,S=new Promise((L,k)=>{m=L,b=k}),g(),S),v=()=>{if(clearTimeout(E),d=!0,p){S=Promise.resolve();return}p=!0,n.mark?.("loaded"),m?.()};l.addEventListener("load",v),u.addDispose(()=>{clearTimeout(E),l.removeEventListener("load",v)});let I;const A=()=>{I??=n.bindResizer?.(l)};let P=null,h=null,w;const f=()=>{if(!P){i.style.visibility="hidden",l.removeAttribute("id");return}n.elementId&&(l.id=n.elementId);const L=P.getBoundingClientRect(),k=h?.isConnected?h:bl(P),F=k?k.getBoundingClientRect():null,V=F?Math.max(L.top,F.top):L.top,de=F?Math.min(L.bottom,F.bottom):L.bottom,tt=Math.max(0,de-V);i.style.visibility=tt>0?"visible":"hidden",i.style.left=`${L.left}px`,i.style.top=`${V}px`,i.style.width=`${L.width}px`,i.style.height=`${tt}px`,l.style.transform=`translateY(${L.top-V}px)`};let y="",T="",O=0,x;const q=()=>{if(!P){x=void 0;return}x=window.requestAnimationFrame(q);const L=P.getBoundingClientRect(),k=h?.isConnected?h.getBoundingClientRect():void 0,F=`${Math.round(L.left)}:${Math.round(L.top)}:${Math.round(L.width)}:${Math.round(L.height)}:${k?`${Math.round(k.top)}:${Math.round(k.height)}`:"-"}`;F!==y&&(y=F,f());const V=l.getBoundingClientRect().height;V>0&&V!==O&&(O=V,P.style.height=`${V}px`);const de=getComputedStyle(P).pointerEvents;de!==T&&(T=de,i.style.pointerEvents=de)},D=()=>{x===void 0&&P&&(x=window.requestAnimationFrame(q))},R=()=>{x!==void 0&&(window.cancelAnimationFrame(x),x=void 0)},U=()=>f();let M=[];const G=(L,k)=>{if(h=k,L&&M.length>0){const F=M;M=[],F.forEach(V=>V())}if(L===P){f();return}if(w?.disconnect(),w=void 0,P&&P.style.removeProperty("height"),y="",O=0,T="",P=L,!L){R(),f();return}n.onShown?.(l);try{if(typeof ResizeObserver=="function"){const F=new ResizeObserver(f);typeof F.observe=="function"&&(w=F,w.observe(L))}}catch{w=void 0}f(),A(),D()};window.addEventListener("scroll",U,!0),window.addEventListener("resize",U),u.addDispose(()=>{w?.disconnect(),x!==void 0&&window.cancelAnimationFrame(x),window.removeEventListener("scroll",U,!0),window.removeEventListener("resize",U)});const ae=L=>{d=!1,L&&n.onReload?.(l);let k;p||S===void 0?k=_():(g(),k=S);try{l.contentWindow?.location.reload()}catch{l.src=c}return k};return{element:l,ready(){return S??_()},reload:()=>ae(!0),reloadQuietly:()=>ae(!1),get shown(){return P!==null},whenShown(){return P!==null?Promise.resolve():new Promise(L=>{M.push(L)})},alignTo(L,k){G(L,k??null)},scrollBy(L,k){for(let F=P?.parentElement??null;F;F=F.parentElement){const V=getComputedStyle(F);if((V.overflowY==="auto"||V.overflowY==="scroll")&&F.scrollHeight>F.clientHeight){F.scrollTop+=k,F.scrollLeft+=L;return}}window.scrollBy(L,k)},resize(){I?.resize()},dispose(){G(null,null),I?.dispose(),u.dispose(),i.remove()}}}function vl(e){const t=new Map;let n="a";const r=()=>n==="a"?"b":"a",s=(d,p)=>d==="email"?`email:${p??n}`:d;let o,i=[];const c=()=>{i.forEach(d=>clearTimeout(d)),i=[],o?.remove(),o=void 0},l=new Map,u=(d,p,m)=>{const b=s(d,p),S=t.get(b);if(S)return S;const E=e.resolveMount();if(!E)return El();const g=_l(d,E,e,d==="email"?p??n:void 0,m);return t.set(b,g),g};return{get:d=>u(d),current:d=>u(d),peek:d=>t.get(s(d)),spare:()=>t.get(s("email",r())),ensureSpare:()=>u("email",r(),!0),promote(){const d=t.get(s("email",r()));if(!d)return;const p=t.get(s("email"));n=r();const m=l.get("email");d.alignTo(m?.slot??null,m?.clip??null),p?.alignTo(null)},alignSurface(d,p,m){l.set(d,{slot:p,clip:m??null}),(p?u(d):t.get(s(d)))?.alignTo(p,m??null)},visible(){for(const d of t.values())if(d.shown)return d},byWindow(d){if(d){for(const p of t.values())if(p.element.contentWindow===d)return p}},busy(d){c();const p=d?e.resolveMount():void 0;if(!p)return;const m=hl(p);o=m,i=[setTimeout(()=>m.showSpinner(),fl),setTimeout(c,pl)]},dispose(){c(),t.forEach(d=>d.dispose()),t.clear(),l.clear(),n="a"}}}var yl=a.createIdentifier$1("canvas.resizerBinder"),wt=a.createIdentifier$1("canvas.service"),Sl={created:z.canvasCreated,loaded:z.canvasLoaded};function Il(e,t){if(e.getInstance(wt))return;const n=vl({resolveMount:()=>t.resolveMount(),resolveSrc:s=>t.resolveSrc(s),resolveSandbox:Ia,elementId:t.elementId,bindResizer:s=>e.getInstance(yl)?.(s),onCreated:s=>Ge(e,s,"fresh"),onReload:s=>Ge(e,s,"fresh"),onShown:s=>Ge(e,s,"switch"),mark:s=>t.mark?.(Sl[s])}),r=Y(e).addListener(a.EVENT_TYPES.SANDBOX_WHEEL,s=>{n.visible()?.scrollBy(s?.deltaX??0,s?.deltaY??0)});e.inject(wt,n),e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{r.dispose(),n.dispose()})}function Ge(e,t,n){const r=Y(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),ia(r))}function wl(e,t){Ge(e,t,"promote")}function Tl(e,t){const n=t.contentWindow;n&&Y(e).greet(n)}function Al(e,t){const n=t.contentWindow;n&&Y(e).forget(n)}function ie(e){return e.getInstance(wt)}function Cl(e){const t=Y(e),n=()=>ie(e)?.byWindow(t.getTarget()),r=t.addListenerAsync(a.EVENT_TYPES.RELOAD,async()=>{await n()?.reload()}),s=t.addListener(i=>{i.data?.operation===a.EVENT_TYPES.SANDBOX_RESIZED&&n()?.resize()}),o=H(e,a.events.ON_EMAIL_INIT_ID)(()=>{n()?.resize()});e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{r.dispose(),s.dispose(),o.dispose()})}var Kp=a.createIdentifier$1("HeadlessMode"),Pl=a.createIdentifier$1("HiddenMount");function Dl(e){return e.getOrCreateInstance(Pl,()=>pe(!1))}function Nr(){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 Rl(e){const t=e.getInstance(a.OPTIONS_SOURCE_ID);let n,r;e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{r?.remove(),r=void 0}),Il(e,{resolveMount:()=>n,resolveSrc:o=>Ir(o==="block"),elementId:"email_iframe",mark:o=>j(o)}),t?.watch(o=>{if(n)return;const i=o?.element;if(i instanceof HTMLElement)n=i;else if(o!==void 0)n=r??=Nr();else return;ie(e)?.get("email")});let s;e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{s?.remove(),s=void 0}),Dl(e).watch(o=>{const i=ie(e);if(i){if(o){s??=Nr(),i.alignSurface("email",s,s);return}s&&(i.alignSurface("email",null),s.remove(),s=void 0)}})}var xr=a.createIdentifier$1("canvas.headerFlow"),Mr=["subject","preheader"],Ol=3e3,Ll={subject:a.EVENT_TYPES.SANDBOX_SUBJECT_UPDATE,preheader:a.EVENT_TYPES.SANDBOX_PREHEADER_UPDATE};function Nl(e){const t=se(e),n=Y(e),r=E=>E?"remote":Or(e)?"system":"user",s=(E,{guid:g,value:_,forced:v})=>{const I=Ie(t);if(!I||typeof _!="string"||g&&g!==I.get().docId)return;const A=t.forcedHeaders();if(A?.[E]&&!v&&_!==A[E])return;v&&t.endForcedHeaders();const P=I.get().attributes[E]??"";c=!0;try{Be(I,{[E]:_},{source:r(v)})}finally{c=!1}o[E]=_,Q(e,a.events.ON_HEADER_APPLIED_ID).fire({field:E,value:_,forced:!!v,isGenerated:_!==P&&!!_})};let o={},i,c=!1,l=Promise.resolve();const u=(E,g,_)=>{l=n.sendAsync(Ll[E],{value:g,guid:Ie(t)?.get().docId,..._?{force:!0,echo:!0}:{}}).catch(v=>{})};let d;e.inject(xr,{whenDelivered:async()=>{await l},reassert:E=>{const g=Ie(t),_=Mr.filter(v=>E[v]);if(!(!g||_.length===0)){c=!0;try{Be(g,Object.fromEntries(_.map(v=>[v,E[v]])),{source:"system"})}finally{c=!1}t.beginForcedHeaders({subject:E.subject??"",preheader:E.preheader??""}),clearTimeout(d),d=setTimeout(()=>t.endForcedHeaders(),Ol);for(const v of _)o[v]=E[v],u(v,E[v],!0)}}});const p=()=>{i?.(),i=void 0;const E=Ie(t);if(!E){o={};return}const g=E.get().attributes;o={subject:g.subject,preheader:g.preheader},i=E.subscribe(({source:_})=>{if(c)return;const v=E.get().attributes,I=t.forcedHeaders();for(const A of Mr){const P=v[A];P!==o[A]&&(o[A]=P,u(A,P??"",_==="system"&&I?.[A]!==void 0))}})};p();const m=t.subscribe(p),b=n.addListenerAsync(a.EVENT_TYPES.APPLICATION_SUBJECT_UPDATE,E=>s("subject",E)),S=n.addListenerAsync(a.EVENT_TYPES.APPLICATION_PREHEADER_UPDATE,E=>s("preheader",E));e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{b.dispose(),S.dispose(),m(),i?.(),clearTimeout(d)})}function Fr(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Tt(e,t){const n={...e};for(const r of Object.keys(t)){const s=t[r],o=e[r];Fr(s)&&Fr(o)?n[r]=Tt(o,s):s!==void 0&&(n[r]=s)}return n}function xl(e,t){const n=a.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 Tt(n,s)}catch{}}return t&&typeof t=="object"&&!Array.isArray(t)?Tt(n,t):n}function Ml(){const e=window.localStorage.getItem(a.LOCAL_STORAGE_ITEMS.em_color_scheme),t=matchMedia("(prefers-color-scheme: dark)").matches?a.DARK:a.LIGHT;return e&&e!=="system"?e:t}function Fl(){const e=window.localStorage.getItem(a.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 kl(e){const{config:t}=e;return{operation:a.EVENT_TYPES.UPDATE_PREVIEW,theme:e.theme,commonStyles:xl(e.emailCommonStyles,e.defaultCommonStyles),pathEnabled:t.pathEnabled,copyPasteEnabled:t.copyPasteEnabled,saveBlockEnabled:t.saveBlockEnabled,editImageControlEnabled:t.editImageControlEnabled,codeMode:e.codeMode,elementAIimageEnabled:t.elementAIimageEnabled,imageCenterStockEnabled:t.imageCenterStockEnabled,imageCenterGifEnabled:t.imageCenterGifEnabled,imageCenterEditorEnabled:t.imageCenterEditorEnabled,blocksAddPanelEnabled:t.blocksAddPanelEnabled!==!1&&t.blocksSectionsShow!==!1,lockEditor:t.lockEditor,appName:e.appName}}function Bl(e){const t=Y(e),n=e.getInstance(a.CONFIG_SOURCE_ID),r=e.getInstance(a.OPTIONS_SOURCE_ID),s=se(e);let o,i="";const c=()=>{const _=n?.get()??{},v=kl({config:_,emailCommonStyles:s.current()?.get().attributes?.common_styles,defaultCommonStyles:o,theme:Ml(),codeMode:Fl(),appName:"useblocks"}),I=JSON.stringify(v);I!==i&&(i=I,t.send(v))},l=t.onInit(()=>{i="",c()}),u=()=>{t.isInited()&&c()},d=n?.watch(u),p=r?.watch(_=>{o=_?.commonStyles,u()});let m;const b=()=>{m?.(),m=s.current()?.subscribe(u),u()};b();const S=s.subscribe(b),E=matchMedia(a.PREFERS_COLOR_SCHEME_DARK),g=()=>u();E.addEventListener("change",g),e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{l.dispose(),d?.dispose(),p?.dispose(),m?.(),S(),E.removeEventListener("change",g)})}var At;(function(e){function t(s,o,i=(c,l)=>c===l){if(s===o)return!0;if(s.length!==o.length)return!1;for(let c=0;c<s.length;c++)if(!i(s[c],o[c]))return!1;return!0}e.isEqual=t;function n(s,o=i=>i){const i=new Set;return s.filter(c=>{const l=o(c);return i.has(l)?!1:(i.add(l),!0)})}e.unique=n;function r(s=[],o=[],i=(c,l)=>c===l){const c=[],l=[],u=[];for(const d of s){const p=o.find(m=>i(d,m));p?u.push({prev:d,next:p}):l.push(d)}for(const d of o)s.find(p=>i(d,p))||c.push(d);return{added:c,removed:l,exists:u}}e.diff=r})(At||(At={}));function jl(e,t){return e.type===t.type&&e.key===t.key}function Ul(e){const t=Y(e),n=()=>e.getServices(a.SANDBOX_EXTENSIONS_ID)??[];let r=[];const s=t.onInit(()=>{r=n(),t.send(a.EVENT_TYPES.SANDBOX_ADD_EXTENSIONS,r)}),o=a.getServiceContainerId(a.SANDBOX_EXTENSIONS_ID),i=e.onInject(c=>{if(c!==o)return;const l=n();if(!t.isInited()){r=l;return}const{added:u,removed:d}=At.diff(r,l,jl);if(r=l,d.length){if(d.some(p=>p.type==="script")){t.send(a.EVENT_TYPES.RELOAD);return}t.send(a.EVENT_TYPES.SANDBOX_REMOVE_EXTENSIONS,d.map(p=>p.key))}u.length&&t.send(a.EVENT_TYPES.SANDBOX_ADD_EXTENSIONS,u)});e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{s.dispose(),i?.dispose()})}var Hl=a.createIdentifier$1("prewarm.editorVisible");function $l(e){if(typeof requestAnimationFrame!="function"){setTimeout(e,0);return}requestAnimationFrame(()=>requestAnimationFrame(e))}function Gl(e={}){const t=e.paint??$l;let n=!1,r=!1,s=!1,o=!1,i=!1;const c=[],l=()=>{i||o||!n||!r||!s||(o=!0,t(()=>{i=!0,j(z.editorVisible);for(const u of c.splice(0))u()}))};return{noteShellVisible(){n=!0,l()},notePagePainted(){r=!0,l()},noteContentShown(){s=!0,l()},whenVisible(u){if(i){u();return}c.push(u)},contentShown:()=>s}}function Vl(e){return e.getOrCreateInstance(Hl,()=>Gl())}var Yl=500,zl=500,ql=5e3;function Kl(e){const t=e.quietMs??Yl,n=e.floorMs??zl,r=e.ceilingMs??ql;let s,o,i=0;const c=()=>{clearTimeout(s),clearTimeout(o),s=void 0,o=void 0},l=()=>{c(),e.run()},u=()=>{clearTimeout(s);const d=n-(Date.now()-i);s=setTimeout(l,Math.max(t,d))};return{start(){c(),i=Date.now(),o=setTimeout(l,r),u()},notify(){s!==void 0&&u()},cancel:c}}function Wl({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},c={...e,...i};return Object.defineProperty(c,"html",{get:()=>t()??"",enumerable:!0,configurable:!0}),c}var kr="self-init:";function Xl(e){return e.startsWith(kr)}function Br(e,t){const n=e.getActiveShowRequest();return Xl(t)?n===null:n?.showId===t&&e.hasPendingShow(t)}function Jl(e){const t=()=>e.initPipeline(),n=e.messageService,r=()=>e.waitScope?.()??t();let s="";const o=()=>e.readDocument()?_t(e.readDocument()):s,i=()=>ge(e.container).editorPolicy,c=()=>e.readEmail(),l=()=>{const u=c();return{...u,id:e.isTemplate()||u.isNew?void 0:u.id,html:o()}};return{readContent:o,publicEmail:l,sendInitStart:()=>ee(n,"INIT_START",a.EVENT_TYPES.SANDBOX_INIT_START,{guid:c().renderGuid},void 0,r()),sendInited:()=>ee(n,"INITED",a.EVENT_TYPES.SANDBOX_INITED,{guid:c().renderGuid},void 0,r()),async sendContent(){const u=c(),{html:d,hasBrowserExtensionArtifacts:p}=Cr(u?.html||"");p&&e.events.browserExtensionDetected(),Pr(e.readDocument(),d),s=d,await ee(n,"SET_ENTITY",a.EVENT_TYPES.SANDBOX_SET_ENTITY,vt(o(),u.renderGuid,i(),e.readDocument()?.get().version),{guid:u.renderGuid,emailId:u.id??null},r())},refreshContent:()=>ee(n,"SET_ENTITY",a.EVENT_TYPES.SANDBOX_SET_ENTITY,vt(o(),c().renderGuid,i(),e.readDocument()?.get().version),void 0,r()),sendPreheader:async()=>{const u=c();if(u.preheader!==void 0)return ee(n,"PREHEADER",a.EVENT_TYPES.SANDBOX_PREHEADER_UPDATE,{value:u.preheader,guid:u.renderGuid,force:!0},void 0,r())},sendSubject:async()=>{const u=c();if(u.subject!==void 0)return ee(n,"SUBJECT",a.EVENT_TYPES.SANDBOX_SUBJECT_UPDATE,{value:u.subject,guid:u.renderGuid,force:!0},void 0,r())},revealFilled:()=>e.revealFilled?.()??Promise.resolve(),showFilled:u=>e.showFilled?.(u),readTarget:()=>e.readTarget?.(),fireWillInit:()=>e.events.willInit(l()),fireInit(u,d){if(!Br(t(),u)){t().getActiveShowRequest()?.showId;return}const p=c();p.id,p.renderGuid,t().completeShow(u),Be(e.readDocument(),{is_inited:!0},{source:"system"});const m=l();return d&&(m.reset=!0),e.events.inited(m)},fireEmailChanged(){e.events.emailChanged(l())},fireContentChanged(){e.events.contentChanged(o())}}}function Ql(e){const t=()=>e.initPipeline();let n=!1,r,s,o,i=0,c;const l=Jl({...e,waitScope:()=>({getSandboxTimeoutMs:g=>t().getSandboxTimeoutMs(g),getSandboxReadyTimeoutMs:()=>t().getSandboxReadyTimeoutMs(),signal:c?.signal??t().signal})});let u;const d=(g,_)=>{if(u===g)return;u=g;const v=i;setTimeout(()=>{i!==v||t().signal.aborted||S(g,_).catch(()=>{})},0)},p=()=>{c?.abort(),c=void 0};let m;const b=()=>{const g=t().signal;g!==m&&(m?.removeEventListener("abort",p),m=g,g.addEventListener("abort",p))};async function S(g,_){const v=++i;p(),c=new AbortController,b();const I=()=>i!==v,A=l.readTarget(),P=t().generation,h=()=>P===t().generation&&!t().signal.aborted,w=_?"init:reset-":"init:";if(!_){const T=l.publicEmail();T?.id,T?.renderGuid,T?.preheader}let f=!1,y=!1;try{n=!0,await l.sendInitStart(),l.fireWillInit(),await(_?l.refreshContent():l.sendContent()),f=!0,_||l.publicEmail()?.id;try{await l.sendPreheader()}catch(T){`${w}`,String(T)}try{await l.sendSubject()}catch(T){`${w}`,String(T)}if(I()||l.showFilled(A),await l.sendInited(),y=!0,s===g){const T=e.readSandboxGeneration?.()??o;T!==void 0&&(r=T)}await l.revealFilled()}catch(T){throw I()||(`${w}`,{...e.describeSurface?.(),error:String(T)},void 0),!I()&&Br(t(),g)&&t().failShow(g,T),T}finally{E(g,_,w,{superseded:I(),sessionGeneration:P,contentApplied:f,sandboxInitedAcked:y,commit:h()})}}function E(g,_,v,I){const{superseded:A,contentApplied:P,sandboxInitedAcked:h}=I;if(A){`${v}`;return}h&&I.commit?l.fireInit(g,_||void 0):h?(`${v}`,I.sessionGeneration,t().generation,t().signal.aborted,void 0):P?(`${v}`,void 0):(`${v}`,void 0),n=!1,c=void 0,!h&&s===g&&(s=void 0,r===o&&(r=void 0)),!h&&P&&d(g,_)}return{channel:l,isEventsLocked:()=>n,filledGeneration:()=>r,markFilled:g=>{r=g},lastCorrelation:()=>s,markCorrelation:g=>{s=g},bumpRunSeq:()=>{i+=1},noteSandboxGeneration:g=>{o=g},fill:g=>S(g,!1),refill:g=>S(g,!0),stop:()=>{i+=1,p(),n=!1,m?.removeEventListener("abort",p),m=void 0}}}function Zl(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:jr(e,n)}function jr(e,t){return t?e?.id==null?!1:String(e.id)===String(t):!0}function ec(e){const{pipeline:t,readEmail:n,readDocument:r,readRouteEmailId:s,readSandboxGeneration:o}=e,i=d=>{const p=n(),m=s();if(!Zl(p,d,m)){d.showId,d.navId,d.emailId,p?.id,p?.showId,p?.renderGuid;return}d.showId,p?.id,p?.renderGuid,t.markFilled(o()),t.markCorrelation(d.showId),t.fill(d.showId).catch(()=>{})};return{showRequested:d=>{i(d)},showRequestIdentityChanged:()=>{const d=e.initPipeline().getActiveShowRequest();d&&i(d)},selfInitChanged:()=>{if(e.initPipeline().getActiveShowRequest())return;const d=o();if(t.filledGeneration()===d)return;const p=n(),m=s();if(!p?.renderGuid||!jr(p,m))return;const b=`${kr}${p.renderGuid}`;t.markFilled(d),t.markCorrelation(b);const S=r()?.isReady()===!0;p.id,p.renderGuid,(S?E=>t.refill(E):E=>t.fill(E))(b).catch(()=>{t.lastCorrelation()===b&&t.markFilled(void 0)})},saasChanged:()=>{const d=n();d?.renderGuid,d?.showToken,d?.id}}}function tc(e){return e??""}function nc(e,t,n,r){return[e??"",t??"",n==null?"":String(n),r??""].join("|")}function rc(e){const t=se(e),n=Y(e),r=()=>ne(t.sessionKey())?void 0:t.current(),s=()=>{const C=r();return Wl({attributes:C?.get().attributes??{},readContent:()=>C?.getContent(),docId:C?.get().docId,hasSession:!!C,serverId:C?.get().serverId,show:t.showFacts()})},o=()=>e.getInstance(a.INIT_PIPELINE_ID)??yt;let i={},c=!1;const l=e.getInstance(a.OPTIONS_SOURCE_ID)?.watch(C=>{c=!!C?.element});let u=!1,d=!1,p=!1,m=0;const b=()=>{const C=ie(e);if(!C)return;const $=++m,B=C.spare();return B&&Al(e,B.element),(B?B.reloadQuietly():C.ensureSpare()?.ready())?.then(()=>{if($!==m)return;u=!0;const Z=C.spare();Z&&Tl(e,Z.element),p&&(p=!1,T(),G())})},S=Kl({run:()=>{p||b()?.catch(()=>{})}}),E=()=>{Vl(e).noteContentShown(),!u&&!p&&S.start()};let g=!1;const I=Ql({container:e,messageService:n,initPipeline:o,readDocument:r,readEmail:s,revealFilled:()=>{const C=ie(e);return g&&C&&(g=!1,S.start()),c?C?.current("email").whenShown()??Promise.resolve():Promise.resolve()},showFilled:C=>{const $=ie(e),B=$?.spare()?.element.contentWindow;d&&$&&B&&C===B&&(d=!1,$.promote(),$.busy(!1),g=!0)},readTarget:()=>n.getTarget(),isTemplate:()=>!!i.isTemplate,readSandboxGeneration:()=>oe(n),describeSurface:()=>({canvasPath:y,promoted:d,spareClean:u,handshake:n.isInited(),generation:oe(n)}),events:{willInit:C=>{Q(e,a.events.WILL_EMAIL_INIT_ID).fire(C)},inited:C=>{E(),Q(e,a.events.ON_EMAIL_INIT_ID).fire(C)},contentChanged:C=>{Q(e,a.events.ON_CONTENT_CHANGED_ID).fire(C)},emailChanged:C=>{Q(e,a.events.ON_EMAIL_CHANGED_ID).fire(C)},browserExtensionDetected:()=>{Q(e,a.events.ON_BROWSER_EXTENSION_DETECTED_ID).fire()}}}),A=ec({pipeline:I,initPipeline:o,readEmail:s,readDocument:r,readRouteEmailId:()=>i.emailId,readSandboxGeneration:()=>oe(n)});let P="",h="",w="";const f=C=>C.length>0;let y="none";const T=()=>{const C=ie(e)?.spare();C&&(n.send({operation:a.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!0}),u=!1,d=!0,wl(e,C.element))},O=(C,$)=>{const B=ie(e);if(!B)return!0;const Z=B.spare(),ue=Z&&u?"spare":"prepare";if(y=ue,B.busy(!0),Z&&u)return T(),!0;S.cancel(),n.send({operation:a.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!0});const fe=b();if(fe===void 0)return y="reload",B.busy(!1),B.peek("email")?.reload(),!0;p=!0;const mn=m;return fe.catch(()=>{!p||mn!==m||(p=!1,y="reload",B.busy(!1),B.peek("email")?.reload())}),!1},x=()=>{de(),I.noteSandboxGeneration(oe(n));const C=s(),$=nc(C?.renderGuid,C?.showId,C?.id,i.emailId),B=tc(C?.renderGuid);if(B!==h){const fe=f(h),mn=h;h=B,fe&&O(mn,B)}if(p)return;$!==P&&(P=$,A.showRequestIdentityChanged());const Z=r(),ue=`${$}|${Z?.get().docId??""}|${oe(n)}`;ue!==w&&Z?.isReady()===!0&&(w=ue,A.selfInitChanged()),A.saasChanged(),U()};let q=!1,D="",R="";const U=()=>{const C=s();if(!C?.renderGuid)return;const $=I.channel.readContent(),B=JSON.stringify([C.preheader,C.common_styles,C.meta,C.subject,C.utm_parameters?.utm_campaign??"",C.utm_parameters?.utm_content??"",C.utm_parameters?.utm_medium??"",C.utm_parameters?.utm_source??"",C.utm_parameters?.utm_term??""]),Z=q&&$!==R,ue=q&&B!==D;if(q=!0,R=$,D=B,I.isEventsLocked())return;const fe={...C,id:i.isTemplate||C.isNew?void 0:C.id,html:$};if(Z){Q(e,a.events.ON_CONTENT_CHANGED_ID).fire($),Q(e,a.events.ON_EMAIL_CHANGED_ID).fire(fe);return}ue&&C.is_inited&&Q(e,a.events.ON_EMAIL_CHANGED_ID).fire(fe)};let M=!1;const G=()=>{M||(M=!0,queueMicrotask(()=>{M=!1,x()}))};e.inject(St,{pipeline:I,setRoute:C=>{C.emailId===i.emailId&&!!C.isTemplate==!!i.isTemplate||(i=C,G())}});let ae,L;const k=()=>{const C=r()?.get().docId;C!==L&&(ae?.(),L=C,ae=r()?.subscribe(G)),G()};let F,V;const de=()=>{const C=e.getInstance(a.INIT_PIPELINE_ID);!C||C===F||(V?.(),F=C,V=C.onShowRequested($=>A.showRequested($)))},tt=n.addListener(C=>{C.data?.operation===a.EVENT_TYPES.SANDBOX_RESIZED&&S.notify()}),Fp=t.subscribe(k),kp=vr(n,G);k(),e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{l?.dispose(),V?.(),kp(),Fp(),ae?.(),tt.dispose(),S.cancel(),I.stop()})}function sc(){return a.USEBLOCKS!=="useblocks"}var Ct={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},oc={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}},Ur=Ct,ic=["freeUserBlocks","blocks"],Hr={};function ac(e){Hr=e}var $r=e=>ic.includes(e)?Ur:Hr[e]??Ur,Pt={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},lc={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},cc={...Pt,config:{...Pt.config,imageCenterFileManagerView:!1}};ac({pro:oc,editor:lc,simple:sc()?Pt:cc,freeUserBlocks:Ct,blocks:Ct});var Gr=new Set;function dc(){return window.localStorage.getItem(a.LOCAL_STORAGE_ITEMS.em_color_scheme)??void 0}function uc(e){return Gr.add(e),e(dc()),{dispose(){Gr.delete(e)}}}function Dt(e,t){return e.user.mode||e.serverSide.mode||t||"pro"}function fc(e,t){return t.modeDefaults(Dt(e,t.fallbackMode))}function pc(e,t){const n=Dt(e,t);return e.serverSide.advancedConfigs?.[n]||{}}function mc(e,t){const n=Dt(e,t),r=e.user?.advancedConfigs?.[n],s=r!==void 0?r:e.user?.advancedConfigs?.pro;return{...e.advancedConfigs?.[n],...s}}function hc(e){let t;for(const n of e)n?.fileManager&&(t={...t,...n.fileManager});return t}function gc(e){return a.mergeResourceProxyLayers(e.map(t=>t?.resourceProxy))}function Ec(e){return a.mergeResourceProxyPolicyLayers(e.map(t=>t?.resourceProxyPolicy))}function bc(e){return a.mergeBackendProxyLayers(e.map(t=>t?.backendProxy))}function _c(e){return a.mergeShallowConfigLayers(e.map(t=>t?.backendProxyPolicy||{}).filter(Boolean))}function vc(e,t){return[e.base,fc(e,t),e.profile,e.serverSide,pc(e,t.fallbackMode),e.user,mc(e,t.fallbackMode),e.local]}function Rt(e,t){const n=vc(e,t),r=a.mergeShallowConfigLayers(n),s=hc(n);s!==void 0&&(r.fileManager=s);const o=gc(n);o!==void 0&&(r.resourceProxy=o);const i=Ec(n);i&&Object.keys(i).length>0&&(r.resourceProxyPolicy=i);const c=bc(n);c!==void 0&&(r.backendProxy=c);const l=_c(n);return l&&Object.keys(l).length>0&&(r.backendProxyPolicy=l),r}var yc=["backendProxy","backendProxyPolicy","resourceProxy","resourceProxyPolicy"];function Vr(e){return e==="server"?"serverSide":e}function Sc({env:e,base:t={},budgetMs:n}){const r={base:t,profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}},s=pe();let o={kind:"pending"},i;const c=new Promise(m=>{i=m}),l=n===void 0?void 0:setTimeout(()=>{d({kind:"absent",reason:`серверный слой не пришёл за ${n} мс`})},n);function u(){o.kind!=="pending"&&s.set(Rt(r,e))}function d(m){if(o.kind!=="pending")return;clearTimeout(l),o=m;const b=Rt(r,e);s.set(b),i(b)}function p(m,b){r[Vr(m)]=b,m==="server"&&o.kind==="pending"?d({kind:"applied"}):u()}return{watch:m=>s.watch(m),select:m=>s.select(m),get:()=>s.get(),ready:()=>c,state:()=>o,layers:()=>({...r}),bootstrap(){const m=Rt(r,e);return Object.fromEntries(yc.map(b=>[b,m[b]]))},merge(m,b){p(b,{...r[Vr(b)],...m})},replace(m,b){p(b,m)},setMode(m){r.user={...r.user,mode:m},u()},setAdvancedConfigs(m){r.advancedConfigs=m,u()},serverAbsent(m){d({kind:"absent",reason:m})},applyServerResponse(m){o.kind==="pending"&&p("server",{...r.serverSide,...m})},dispose(){clearTimeout(l)}}}var Ic=5e3,wc="blocks";function Tc(){return{...$r(wc)?.config,mergeTags:void 0}}function Ac(e,t){e.getInstance(a.OPTIONS_SOURCE_ID)?.watch(n=>{t.setAdvancedConfigs({...n.advancedConfigs,...n.config?.advancedConfigs}),t.replace(n.config??{},"user")})}function Cc(e,t){let n;cr(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 Pc(e,t){let n=null;const r=uc(s=>{const o=typeof s=="string"&&s?s:void 0;o!==n&&(n=o,t.replace(o?{theme:o}:{},"local"))});e.getInstance(a.DISPOSABLE_ID)?.addDisposable(r)}async function Dc(e,t){if(e.getInstance(ot)===void 0){t.serverAbsent("app_init не зарегистрирован");return}try{const n=await e.getInstanceAsync(a.APP_ID);t.applyServerResponse(n?.app_config??{})}catch(n){t.serverAbsent(`app_init не выполнился: ${String(n)}`)}}function Rc(e){e.injectFactory(a.CONFIG_SOURCE_ID,(t,n)=>{if(n)return n;const r=Sc({base:Tc(),env:{modeDefaults:s=>$r(s)?.config||{},fallbackMode:localStorage.getItem("configSwither")||void 0},budgetMs:Ic});return Ac(e,r),Cc(e,r),Pc(e,r),Dc(e,r),e.getInstance(a.DISPOSABLE_ID)?.addDisposable(r),r},!0)}var Ee=class extends a.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 N(e,t,n){const r=a.snapshot(e);return(s,o,i)=>{const c=r(async l=>{const u=t?t(l):l;i&&s.bind(i);const d=await s(u);return n?n(d):d},o,i);return()=>c.dispose()}}var Oc=class{deps;handleDestroy;constructor(e){this.deps=e;const t=new a.Emitter;this.handleDestroy=N(t.event),e.lifetime.addDispose(()=>t.fire(e.getInstance()));const n=e.lifetime.addDisposable(new Ee(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{}}},Ot=a.createIdentifier$1("DestroyableService");function Lc(e){e.injectFactory(Ot,()=>{const t=e.getInstance(a.DISPOSABLE_ID);if(!t)throw new Error("[plugin] время жизни экземпляра не зарегистрировано");return new Oc({lifetime:t,options:e.getInstance(a.OPTIONS_SOURCE_ID),getInstance:()=>e.getInstance(a.INSTANCE_ID),release:()=>a.releaseContainer(e.getInstance(a.STORE_ID)??e)})},!0)}function Nc(e){const t=e.getInstance(Ot);if(!t)throw new Error("[plugin] provideDestroyable не выполнен до сборки поверхности");return{handleDestroy:t.handleDestroy,destroy:()=>t.destroy()}}var xc=1e3;function Yr(e,t,n=xc,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(!Yr(e[i],t[i],n,r+1))return!1;return!0}return!1}function Te(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];Yr(s,o)||(n[r]=s)}return n}var Mc=class extends Error{timeoutMs;constructor(e){super(`[useblocks] handleSaveEmail не ответил за ${e}ms — письмо не сохранено`),this.timeoutMs=e,this.name="IntegratorSaveTimeoutError"}},Fc=({source:e,emailtags:t,group:n,tags:r,...s})=>s,kc=()=>xn();async function Bc({emails:e},t){const n=kc();let r;try{return await Promise.race([e.notifySave(t),new Promise((s,o)=>{r=setTimeout(()=>{const i=new Mc(n);t.value.id,o(i)},n)})])}finally{r!==void 0&&clearTimeout(r)}}function jc(e){const{emails:t}=e,n=async(r,s)=>{const o=Fc(s),i=r===void 0?void 0:await t.cache.getIfPresent(r),c=i?{...i,...o}:o,l=await Bc(e,{prev:i,patch:i?Te(i,o):o,value:c,source:s.source??""}),u=String(l.id??r??a.generateUUID()),d=l.id===void 0?{...l,id:u}:l;return await t.cache.addOrUpdate(u,()=>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:a.generateUUID()}},async updateEmail(r,s){return await n(r,s)}}}var Lt=20,Uc=({source:e,emailtags:t,group:n,tags:r,...s})=>s;function Hc({revisions:e,revisionsByEmail:t}){const n=async(r,s)=>(t.clear(),await t.get(r,{page:s}),(await e.cache.values()??[]).filter(o=>String(o?.parent)===String(r)));return{async readRevisions(r,s=1){const o=await n(r,s);return{revisions:o.slice(Lt*(s-1),Lt*s),page:s,hasMore:o.length>Lt*s}},async readAutosave(r){return fi(await n(r,1))},async saveAutosave(r,s){const o=Uc(s);return await e.create({...o,parent:r,modified:new Date().toString()})}}}var $c=class extends a.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}},Gc=class extends a.AsyncEmitter{};function Wp(e){return e}var zr=class extends a.Disposable{_items=new Map;_onChangeEmitter=new a.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 a.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 Vc(e,{filter:t,order:n="asc",orderBy:r,page:s,pageSize:o=20}={}){const i=e.length;let c=e.length;if(t!==void 0){const l=Object.keys(t);e=e.filter(u=>{for(const d of l){const p=u[d],m=t[d];return d==="id"||typeof p!="string"?p===m:typeof m=="string"&&p.startsWith(m)}return!0}),c=e.length}return r&&(e=e.sort((l,u)=>(l[r]>u[r]?1:u[r]>l[r]?-1:0)*(n==="asc"?1:-1))),s!==void 0&&(e=e.slice(o*(s-1),o*s)),{data:e,filteredTotal:c,total:i,totalPages:Math.ceil(c/o)}}function Yc(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 zc(e,t){return qr(e)&&qr(t)?String(e)===String(t):e===t}function qr(e){return typeof e=="string"||typeof e=="number"}var qc=class extends a.Disposable{_cache=new zr;_readEmitter=new a.AsyncEmitter;_saveEmitter=this.addDisposable(new $c);_removeEmitter=this.addDisposable(new Gc);_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 a.Disposable);n.addDispose(()=>delete this._foreignCache[e]);const r=n.addDisposable(new zr),s=n.addDisposable(new a.AsyncEmitter);t=this._foreignCache[e]={get:async(o,i={})=>{await r.getOrCreate(o,async()=>{try{const l=Yc(await s.fire(o))||[];for(const u of l)u[e]=o,await this._cache.add(u.id,u);return l}catch{return[]}});const c=(await this._cache.values()||[]).filter(l=>{const u=l[e];return u==null||zc(u,o)});return Vc(c,i)},first(o,i={}){return t.get(o,{...i,page:1,pageSize:1}).then(({data:c})=>c[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=a.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?Te(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 Ae(e){const t=a.createIdentifier$1(e);return n=>n.getOrCreateInstance(t,()=>new qc)}function Kc(e){const t=e.getInstance(a.DISPOSABLE_ID);if(!t)throw new Error("Failed");return t}function Kr(e){return Object.prototype.hasOwnProperty.call(e,"meta")}function Wc(e,t,n){return e&&!Kr(t)&&Kr(e)?{...n,meta:e.meta}:n}var Wr=Ae("plugin.dataSource.emails"),Xr=Ae("plugin.dataSource.emailRevisions"),Jr=a.createIdentifier$1("emailDocuments.provided");function Xc(e){const t=Wr(e),n=Xr(e),r=n.byForeignKey("parent");return e.getInstance(Jr)?{emails:t,emailRevisions:n}:(e.inject(Jr,!0),Li(e,jc({emails:t})),Fi(e,Hc({revisions:n,revisionsByEmail:r})),Kc(e).addDisposable(t.onSave(({prev:s,patch:o,value:i})=>Wc(s,o,i),Number.MIN_VALUE)),{emails:t,emailRevisions:n})}function Qr(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 Jc(e){try{return localStorage.getItem(e)===null?!1:(localStorage.removeItem(e),!0)}catch{return!1}}var Qc="po",Ve=null;function Zc(){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([Qc],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadPoParser] Failed to require po module")))})}function ed(){return Ve===null&&(Ve=Zc().catch(e=>{throw Ve=null,e})),Ve}async function Zr(e){if(typeof e=="object")return Nt(e);if(typeof e!="string")return;const t=e.trim();if(t)return t.startsWith("{")||t.startsWith("[")?td(t):nd(t)}function Nt(e){if(!(e==null||typeof e!="object"||Array.isArray(e)))return e}function td(e){try{return Nt(JSON.parse(e))}catch{return}}var es=!1;async function nd(e){try{return Nt((await ed()).parsePoCatalog(e))}catch{es||(es=!0);return}}var rd="em_locale",sd="em_ant_locale",od="locale",id="ant_locale";function xt(e){try{return JSON.parse(localStorage.getItem(e)||"")}catch{return null}}function ts(e,t){const n=xt(e);if(!n)return null;try{localStorage.removeItem(e),localStorage.setItem(t,JSON.stringify(n))}catch{}return n}function ad(){return xt("em_locale")??ts(od,"em_locale")}function ns(e){try{localStorage.setItem(rd,JSON.stringify(e))}catch{}}function ld(){return xt("em_ant_locale")??ts(id,"em_ant_locale")}function cd(e,t){try{localStorage.setItem(sd,JSON.stringify({id:e,data:t}))}catch{}}var Xp="en_US",dd=8e3;function ud(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 fd(e){const t=ad(),n=ld();let r={ready:!1},s;const o=pe(r);let i=0;const c=g=>{r={...r,...g},o.set(r)},l=()=>{r.ready||c({ready:!0})},u=setTimeout(l,e.unlockAfterMs??dd),d=g=>g!==i;let p;async function m(g,_){if(n?.id===g&&n.data&&c({antd:n.data}),!p)return;const v=await p(g).catch(()=>{});!v||d(_)||(c({antd:v}),cd(g,v))}async function b(g,_){const v=await e.askHost(g).catch(()=>null);if(d(_))return!0;if(v==null)return!1;const I=await Zr(v);return d(_)||(I&&c({catalog:I}),l()),!0}async function S(g,_){const v=await e.readList();if(d(_))return;if("error"in v){c({failure:{kind:"GET_LOCALES_ERROR",error:v.error}}),l();return}const I=v.data.find(P=>P.locale===g);if(!I){Jc("em_locale")&&c({catalog:void 0}),l();return}if(Qr(t,I)&&(!s||s.catalog===t?.data)){l();return}if(s?.entry&&r.catalog===s.catalog&&Qr(s.entry,I)){ns(s.entry),l();return}const A=await e.readCatalog(g);if(!d(_)){if("error"in A){c({failure:{kind:"GET_LOCALE_ERROR",error:A.error}}),l();return}A.data&&(s?.id===g&&r.catalog===s.catalog&&ud(s.catalog,A.data)||c({catalog:A.data}),ns({id:g,time:I.updatedAt||Math.floor(Date.now()/1e3),hash:I.contentHash,data:A.data})),l()}}async function E(g,_){if(!await b(g,_)){if(!d(_)&&(s?.id===g&&r.catalog===s.catalog||g==="en_US")&&l(),e.canUseNetwork&&!e.canUseNetwork()){l();return}await S(g,_)}}return{set(g){if(!g||g===r.id)return;const _=i+=1;c({id:g,failure:void 0});const v=s?.id===g&&r.catalog===s.catalog;(s&&!v&&r.catalog===s.catalog||g==="en_US"&&r.catalog)&&c({catalog:void 0}),t?.id===g&&t.data&&(c({catalog:t.data}),l()),m(g,_),E(g,_)},prime(g,_,v){r.id||r.catalog||!_||(s=t?.id===g&&t.data&&(!v||t.time>=v.time)?{id:g,catalog:t.data}:{id:g,catalog:_,entry:v?{id:g,time:v.time,hash:v.hash,data:_}:void 0},c({catalog:s.catalog}))},useAntdLoader(g){p=g,r.id&&m(r.id,i)},state:o,snapshot:()=>r,dispose:()=>clearTimeout(u)}}var pd=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})},md=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:c,...l})=>{const u=(typeof t=="boolean"?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},d=this.mergeRequestParams(l,u),p=s&&this.toQueryString(s),m=this.contentFormatters[r||"application/json"],b=o||d.format;return this.customFetch(`${i||this.baseUrl||""}${n}${p?`?${p}`:""}`,{...d,headers:{...d.headers||{},...r&&r!=="multipart/form-data"?{"Content-Type":r}:{}},signal:(c?this.createAbortSignal(c):d.signal)||null,body:typeof e>"u"||e===null?null:m(e)}).then(async S=>{const E=S;E.data=null,E.error=null;const g=b?S.clone():S,_=b?await g[b]().then(v=>(E.ok?E.data=v:E.error=v,E)).catch(v=>(E.error=v,E)):E;return c&&this.abortControllers.delete(c),_})}},hd=a.createIdentifier$1("rest.v2.transport"),rs=Symbol("rest.v2.secureRequest");function gd(e){return e.getOrCreateInstance(hd,()=>{const t=e.getInstance(a.CUSTOM_FETCH_ID)?.execute||fetch;return new md({baseUrl:"https://app.useblocks.io/api/v2",securityWorker:()=>({[rs]:!0}),customFetch:(n,r={})=>{const{[rs]:s,...o}=r;return t(n,{...o,[a.PUBLIC_REQUEST]:s!==!0})}})})}function Ed(e,t){const n=gd(e);return Object.assign({},...t.map(r=>new r(n)))}function ss(e,t){if(e!=null&&typeof e=="object"){const n=e[t];if(typeof n=="string"&&n!=="")return n}}function os(e){const t=e.error,n=t?.error;return n&&typeof n=="object"?{status:e.status,data:{code:ss(n.details,"wp_code")??n.code,message:ss(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 is(e){return!e.ok||!!e.error}function bd(e){try{const t=localStorage.getItem(e);if(t==="true")return!0;if(t==="false")return!1}catch{}}function as(){return bd(a.LOCAL_STORAGE_ITEMS.em_translations_v2)??!0}function _d(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function vd(e){const t=e?Date.parse(e):NaN;return Number.isNaN(t)?0:Math.floor(t/1e3)}function yd(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:_d(r[1])}),t},[]):[]}function Sd(e){return(e?.items??[]).reduce((t,n)=>(n.locale&&t.push({locale:n.locale,updatedAt:vd(n.updated_at),contentHash:n.content_hash}),t),[])}function ls(e){return Ed(e,[pd])}function Ye(e){return{error:{status:"FETCH_ERROR",error:e instanceof Error?e.message:"locale request failed"}}}function Mt(e){return!e.ok||e.error!=null}function Ft(e){const t=e.error;return{error:{status:e.status,data:t?.data??e.error}}}async function kt(e){return{data:await Zr(e)??null}}async function Id(e){if(as())try{const n=await ls(e).localesList();return is(n)?{error:os(n)}:{data:Sd(n.data)}}catch(n){return Ye(n)}const t=a.getApi(e,[Tn]);try{const n=await t.get_translations2({file:"react_app"});return Mt(n)?Ft(n):{data:yd(n.data)}}catch(n){return Ye(n)}}async function wd(e,t){if(as())try{const r=await ls(e).jsonList({locale:t});return is(r)?{error:os(r)}:kt(r.data)}catch(r){return Ye(r)}const n=a.getApi(e,[Tn]);try{const r=await n.get_translations3({id:t,file:"react_app"});return Mt(r)?Ft(r):kt(r.data)}catch{try{const r=await n.get_translations3({id:"en_US",file:"react_app"});return Mt(r)?Ft(r):kt(r.data)}catch(r){return Ye(r)}}}var Ce=a.createIdentifier$1("locale.service");function Td(e){if(e.getInstance(Ce))return;const t=fd({readList:()=>Id(e),readCatalog:n=>wd(e,n),askHost:async n=>(await Q(e,a.events.READ_LOCALE).fire(n))[0],canUseNetwork:()=>!e.getInstance(a.SECURITY_MODULE_ID)});e.inject(Ce,t),e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>t.dispose())}function Ad(e){const t=e.getInstance(a.CONFIG_SOURCE_ID);if(!t)return;const n=e.getInstance(Ce);if(!n)return;const r=t.select(s=>s.locale).watch(s=>n.set(s));e.getInstance(a.DISPOSABLE_ID)?.addDisposable(r)}var Cd="user_id",Pd="project_id",cs=a.createIdentifier$1("rest.identityHeadersProvided");function Dd(e){if(e.getInstance(cs))return;e.inject(cs,!0);let t;e.getInstance(a.OPTIONS_SOURCE_ID)?.watch(n=>{t=n}),e.addService(a.REQUEST_HANDLER_ID,{execute(n,r){if(r?.public)return;const s=t?.user?.id??dr(e).profile?.id;s!=null&&s!==""&&n.headers.set(Cd,String(s));const o=t?.project;o!=null&&o!==""&&n.headers.set(Pd,String(o))}})}function Rd(e){if(!e)return!1;try{return e.getInstance(a.SECURITY_MODULE_ID)!==void 0}catch{return!1}}var Od="Invalid standaloneKey.",Jp=a.createIdentifier$1("StandaloneMockGuard");function Ld(){const e=new Error(Od);return e.name="InvalidStandaloneKeyError",e}function Nd(e){e.addService(a.REQUEST_HANDLER_ID,{execute:()=>{if(Rd(e))throw Ld()}})}function xd(e){a.registerRestTransport(e),Nd(e)}function Md(e){const t=new Rr;e.inject(a.INIT_PIPELINE_ID,t);let n;const r=e.getInstance(a.OPTIONS_SOURCE_ID)?.watch(o=>{o&&(o.signal!==void 0&&(n=o.signal),t.configure({replaceSession:!0,...o.timeouts!==void 0?{timeouts:o.timeouts}:{},...n!==void 0?{signal:n}:{}}))}),s=e.getInstance(a.DISPOSABLE_ID);r&&s?.addDisposable(r),s?.addDispose(()=>{t.abort()})}var Fd=Ae("plugin.dataSource.blocks"),kd=Ae("plugin.dataSource.blockRevisions"),Bd=Ae("plugin.dataSource.comments"),jd=Dr(),Ud=Dr(),ds=`<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2086
2086
  <html>
@@ -2126,7 +2126,7 @@ __useblocks__.define("useblocks.js",["require","exports","module","static/umd/a6
2126
2126
  </html>`;function Hd(e){return{isNew:!0,is_inited:!1,subject:void 0,preheader:void 0,description:"",html:ds,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 $d=a.createIdentifier$1("CurrentProject"),Gd={};function ze(e){return e?.getInstance($d)?.get()??Gd}function us(e){const t=ze(e).card?.id,n=Number(t);return t!=null&&t!==""&&Number.isFinite(n)?n:void 0}var fs=new Set(["email","block","blocks","autosaves","revisions","comments","templateId","reload"]);function Vd(e){return!Object.keys(e).some(t=>fs.has(t))}function Yd(e){const t={},n={};for(const[r,s]of Object.entries(e))fs.has(r)?t[r]=s:n[r]=s;return{showOptions:t,misplacedEmailFields:n}}function ps(e){const t=e.id;if(!(t===null||typeof t=="string"&&t.trim()===""))return e;const n={...e};return delete n.id,n}function Qp(e){}function qe(e){return{emails:Wr(e),blocks:Fd(e),emailRevisions:Xr(e),blocksRevision:kd(e),comments:Bd(e)}}function zd(e){const t=Object.values(qe(e));return{suspendChange(){t.forEach(n=>n.suspendChange())},resumeChange(){t.forEach(n=>n.resumeChange())}}}function Bt(e,t=!0){if(typeof e=="string")return{email:{code:e}};if(Vd(e))return{email:ps(e)};{const{showOptions:n,misplacedEmailFields:r}=Yd(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:ps({...r,...o})}}}function ms(e){return mt(e)?.current()}function Ke(e){return ms(e)?.getContent()}function qd(e,t){const n=t??Hd(),r=ms(e)?.get();return r?{...n,...r.attributes,id:r.serverId??void 0,isNew:r.serverId===null,html:Ke(e)??n.html}:n}async function jt(e){return(await e.getInstanceAsync(a.APP_ID))?.project}function be({code:e,project:t,...n},r){const s=re(n),o=us(r),i=ge(r);return e&&i.warnAboutUnconfiguredInput(e,n.id),{...s,...e?{html:i.toEditorForm(e)}:{},...o===void 0?{}:{project:o},utm_parameters:s.utm_parameters||{},_embedded:void 0}}function W({html:e,renderGuid:t,showToken:n,showId:r,...s},o){const{requested:i}=ze(o),c=ur(o);return re({...s,code:ge(o).toOutputForm(e),project:i===void 0?s.project:i,utm_parameters:c.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 Ut(e){return e==null?"":e.replaceAll(`\r
2127
2127
  `,`
2128
2128
  `)}function hs(e){return e.replace(/<title[^>]*>[\s\S]*?<\/title>/gi,"")}function Kd(e,t,n,r){const s=Wd(e,t,n,r);return s===void 0}function Wd(e,t,n,r){const{email:s}=Bt(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 c=mt(e)?.current();if(!c)return"no-session";const l=c.get(),u=l.attributes;if(l.serverId!==i)return"document-id";if(u.is_inited!==!0)return"not-inited";const d=hs(Ut(n??c.getContent()));if(o.html!==void 0&&hs(Ut(o.html))!==d)return"html";if(o.subject!==void 0&&o.subject!==u.subject)return"subject";if(o.preheader!==void 0&&o.preheader!==u.preheader)return"preheader";if(o.common_styles!==void 0&&o.common_styles!==u.common_styles)return"common_styles"}function gs(e,t){const{email:n}=Bt(t,!1),r=be(n,e);if(r.id!==void 0)return JSON.stringify([r.id,r.html===void 0?null:Ut(r.html),r.subject??null,r.preheader??null,r.common_styles??null])}function Xd(e,t){const n={...e};return delete n.id,{...n,...t}}function Jd(e){return e.html?e:{...e,html:ds}}function Pe({code:e,project:t,...n},r,s){const o=s??us(r);return{...n,...e?{html:ge(r).toEditorForm(e)}:{},renderGuid:a.generateUUID(),...o===void 0?{}:{project:o}}}function We({html:e,renderGuid:t,...n},r){const{requested:s}=ze(r);return re({...n,code:ge(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 Es(e){return mt(e)?.current()?.get().serverId??void 0}function Ht(e,t,n){return n===void 0&&(n=e.post===void 0?Es(t):e.post),{...e,content:e.content?`<p>${e.content}</p>`:"",post:n}}function Xe(e,t){return re({...e,link:void 0,comment_status:void 0})}function $t({code:e,...t},n,r){return r===void 0&&(r=t.parent===void 0?Es(n):t.parent),{...t,...e?{html:e}:{},parent:r}}function bs({html:e,...t},n){return re({...t,code:e,guid:void 0,compiled:re({html:e,ampHtml:e&&""})})}var Qd=a.createIdentifier$1("emailTemplate.reads");async function Zd(e,t){try{return await le(e).email(e).readEmail(t)??void 0}catch(n){n instanceof Error&&n.message;return}}function eu(e,t){const n=e.getOrCreateInstance(Qd,()=>new Map),r=n.get(t);if(r!==void 0)return r;const s=Zd(e,t).then(o=>(o===void 0&&n.delete(t),o));return n.set(t,s),s}var tu="EXTERNAL";function nu(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"сохранение не состоялось")}var ru="email_id",su=class extends a.Disposable{_container;_prevCommand;_lastShow;_showToken=0;_showRequests=0;_dataSources;_eventLock;_queue=a.createQueue();_currentEmail;constructor(e){super(),this._container=e;const t=e;this._dataSources=qe(t),this._eventLock=zd(t);const n=H(e,a.events.ON_EMAIL_CHANGED_ID);this.addDisposable(n(r=>{this._currentEmail=r})),this.addDisposable(e.addService(a.REQUEST_HANDLER_ID,{execute:(r,s)=>{!s?.public&&this._currentEmail?.id&&!this._currentEmail.isNew&&r.headers.append(ru,this._currentEmail.id)}}))}_getInitPipeline(){return this._container?.getInstance(a.INIT_PIPELINE_ID)??yt}_throwIfDestroyed(){if(this.isDisposed())throw Sn()}async getTemplateEmail(e){const t=await eu(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 jt(this._container);await t.setAll(e.filter(r=>r.id!==void 0).map(r=>[r.id,Pe(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,$t(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,Ht(s,this._container,t)]);await n.setAll(r)}async setEmail(e,t,n,r,s){const o=this._dataSources.emails,i=o.cache,c=await jt(this._container),l=r??this._showToken;e=typeof e=="string"?{code:e}:{...e};let u=be(e,this._container);const d=u.id;let p=d;if(d!==void 0){const m=await o.get(d);u={...m??{},...u,renderGuid:m?.renderGuid??a.generateUUID(),...l>0?{showToken:l}:{},...s?{showId:s}:{},project:c}}else{p=n??a.generateUUID();const m=await o.get(p);u={...u,renderGuid:m?.renderGuid??a.generateUUID(),...l>0?{showToken:l}:{},...s?{showId:s}:{},project:c},delete u.project}if(t){const m=await this.getTemplateEmail(String(t));m&&(u=Xd(m,u))}return d===void 0&&(u=Jd(u)),await i.addOrUpdate(p,()=>u),u}_rememberShow(e){this._prevCommand=e}_isRepeatOfLastShow(e){const t=this._lastShow;if(!t||t.signature!==gs(this._container,e))return!1;const n=Ke(this._container);return n===void 0||n===t.html}_rememberShownContent(e){const t=gs(this._container,e);this._lastShow=t===void 0?void 0:{signature:t,html:Ke(this._container)??""}}async _show(e,t){if(this._throwIfDestroyed(),t!==void 0&&t!==this._showRequests){this._showRequests;return}if(!e)return;const n=this._getInitPipeline();if(a.throwIfAborted(n.signal),Kd(this._container,e,Ke(this._container),this._prevCommand?.id)||this._isRepeatOfLastShow(e))return;const r=Bt(e);r.email.id,this._prevCommand?.id;let s,o="",i=0,c=!1,l,u=Promise.resolve(),d,p=!1;try{this._eventLock.suspendChange();const{email:m,blocks:b,autosaves:S,comments:E,templateId:g,reload:_}=r;s=m.id;const v=be(m,this._container),I=v.id,A=I??a.generateUUID(),P=await we("getProject",jt(this._container));a.throwIfAborted(n.signal),o=a.generateUUID();const h={isNew:I===void 0,id:String(A),project:P},w=_===!0&&I!==void 0;w&&(await this._dataSources.emails.remove(String(I),{silent:!0}),String(I)),i=++this._showToken,String(A);const f=[];f.push(this.setBlocks(b)),m.id!==void 0&&(f.push(this.setComments(E)),f.push(this.setEmailRevisions(S,String(m.id)))),f.push(this.setEmail(m,Number(g),I===void 0?String(A):void 0,i,o)),await we("setEmail+blocks+revisions",Promise.all(f),{emailId:I??String(A),showId:o,targetShowToken:i}),a.throwIfAborted(n.signal);const y=await this._dataSources.emails.get(String(A)),T=se(this._container),O={id:o,token:i};I===void 0?d=T.startNewDraft(y??v,{patch:v,show:O}):w?d=T.reload(I,{email:y??v,patch:v,show:O}):T.sessionKey()===Se(I)?d=T.show(v,O):d=T.open(I,{email:y??v,patch:v,show:O});const x=!!this._prevCommand&&a.deepEqual(this._prevCommand,h);h.id,!this._prevCommand||a.deepEqual(this._prevCommand,h),this._prevCommand?.id,this._rememberShow(h),u=n.requestShow({showId:o,navId:String(A),emailId:I,isNew:I===void 0}),p=!0,String(A),c=!0}catch(m){l=m,p&&o&&n.failShow(o,m),String(m)}finally{this._eventLock.resumeChange()}if(!c)throw l instanceof Error?l:new Error(`[useblocks] show() setup failed: ${String(l??"unknown error")}`);return we("show-init-deferred",Promise.all([u,d?.whenReady().catch(m=>{if(m instanceof ke){const b=Zn(m);throw b?new Error(`[useblocks] show(): email open failed (${b})`,{cause:m}):m}})??Promise.resolve()]).then(()=>{}),{showId:o,emailId:s??null}).then(()=>{this._rememberShownContent(e)})}async _save(){this._throwIfDestroyed();const e=this._getInitPipeline();a.throwIfAborted(e.signal);const t=se(this._container),n=await t.save("publish",{source:tu});if(a.throwIfAborted(e.signal),!n)throw nu(t.saveState().error);return W(qd(this._container,this._currentEmail),this._container)}_queuedShow=this._queue.decorate((e,t)=>this._show(e,t),this);show=e=>{const t=this._showRequests+=1;return this._queuedShow(e,t)};save=this._queue.decorate(this._save,this)};function ou(e){return String(e).replace(/"/g,"&quot;")}function iu(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 au(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 _s(e,t,n){const r=new RegExp(`\\b${t}\\s*=\\s*["'][^"']*["']`,"i"),s=ou(n);return r.test(e)?e.replace(r,`${t}="${s}"`):e.replace(/>$/,` ${t}="${s}">`)}function lu(e,t,n){if(!e?.trim()||!t)return e;const r=au(e);if(!r)return e;const s=String(t),o=iu(n??new Date);let{full:i,index:c}=r;const l=i.length;return/\bem-block-id\s*=/.test(i)||(i=_s(i,"em-block-id",s)),i=_s(i,"em-block-version",o),e.slice(0,c)+i+e.slice(c+l)}function cu(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 du(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:cu(e)}}function Gt(e,t){return t?du(t,e):{type:e.type,name:e.name,blockId:e.blockId,project:e.project,insertFrom:e.type}}var vs=["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"],uu=[...vs,"html","id","project","password"],Zp=new Set(["html",...vs,"global_block","project"]);function fu(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(uu),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 pu(e,t={}){return!e||typeof e!="object"?{html:"",insertFrom:t.type,name:t.name,project:t.project,id:t.blockId}:{...fu(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 Vt=new WeakMap;function mu(e){let t=Vt.get(e);return t||(t={byId:new Map,fallback:[]},Vt.set(e,t)),t}function hu(e){Vt.delete(e)}function gu(e,t){const{byId:n,fallback:r}=mu(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,c=e.type!=null&&e.type!==""&&o.insertFrom===e.type;if(i&&c)return r.splice(s,1),o.id!=null&&o.id!==""&&n.delete(String(o.id)),o}}async function Eu(e,t){const{blocks:n}=qe(e);return await n.cache.getIfPresent(t)??void 0}async function bu(e,t){if(!t.blockId)return;const n=await Eu(e,t.blockId);if(n)return pu(n,t)}async function _u(e,t){const n=gu(e,t);if(n)return Gt(e,n);const r=await bu(t,e);return r?Gt(e,r):Gt(e,void 0)}var vu=a.createIdentifier("application_block_inserted"),yu=-1e3,ys=new WeakSet;function Su(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 Iu(e){if(!e||ys.has(e))return;ys.add(e);const t=new a.Disposable,n=Y(e);return t.addDisposable(n.addListenerAsyncPipe(vu,async(r,s)=>{const o=Su(r)?await _u(r,e):r;return s?s(o):o},yu)),t.addDisposable({dispose:()=>{hu(e)}}),t}var Ss=100,wu=class extends a.Disposable{_container;_events;constructor(e){super(),this._container=e;const t=Iu(e);t&&this.addDisposable(t)}_get(){const e=this._container,{blocks:t,emails:n,comments:r,emailRevisions:s}=qe(e),o=H(e,a.events.ON_SHARE_ID),i=H(e,a.events.ON_SHOW_PREVIEW_ID),c=H(e,a.events.ON_EMAIL_CLONE_ID),l=H(e,a.events.ON_CODE_VALIDATE_ID),u=H(e,a.events.ON_SUBJECT_CHANGED_ID),d=H(e,a.events.ON_EMAIL_CHANGED_ID),p=H(e,a.events.ON_PREHEADER_CHANGED_ID),m=H(e,a.events.ON_SAVEBUTTON_CLICK_ID),b=H(e,a.events.ON_NEXTBUTTON_CLICK_ID),S=H(e,a.events.ON_SEND_LIVEPREVIEW_ID),E=H(e,a.events.ON_SEND_TESTEMAIL_ID),g=H(e,Ud),_=H(e,a.events.ON_CONTENT_CHANGED_ID),v=H(e,jd),I=H(e,a.events.ON_PREVIOUSBUTTON_CLICK_ID),A=H(e,a.events.ON_SEND_EMAIL_MODAL_ID),P=a.filter(H(e,a.events.ON_EMAIL_INIT_ID),h=>!h.reset);return{handlePreheaderChanged:N(p),handleSubjectChanged:N(u),handleValidate:N(l),handleReadEmail:N(n.handlerRead,h=>h,h=>h&&be(h,e)),handleSaveEmail:N(n.onSave,function({prev:h,patch:w,value:f,source:y}){const T=h?W(h,e):void 0;return{prev:T,patch:Te(T,W(w,e)),value:W(f,e),source:y}},h=>h?be(h,e):void 0),handleRemoveEmail:N(n.onRemove,({value:h,source:w})=>({value:W(h,e),source:w}),()=>{}),handleReadCommonBlocks:N(g,h=>h.project,h=>h?.map(w=>Pe(w,e))),handleReadTemplateBlocks:N(v,h=>h,h=>h?.map(w=>Pe(w,e))),handleReadBlocks:N(t.byForeignKey("project").handleRead,h=>ze(e).requested||String(h),h=>h?.map(w=>Pe(w,e))),handleSaveBlock:N(t.onSave,function({prev:h,patch:w,value:f,source:y}){const T=f.global_block===!0&&f.id&&typeof f.html=="string"?{...f,html:lu(f.html,String(f.id))}:f,O=h?We(h,e):void 0;return{prev:O,patch:Te(O,We(w,e)),value:We(T,e),source:y}},h=>h?Pe(h,e):void 0),handleRemoveBlock:N(t.onRemove,({value:h,source:w})=>({value:We(h,e),source:w}),()=>{}),handleReadComments:N(r.byForeignKey("post").handleRead,h=>h,h=>h?.map(w=>Ht(w,e))),handleSaveComment:N(r.onSave,function({prev:h,patch:w,value:f,source:y}){const T=h?Xe(h,e):void 0;return{prev:T,patch:Te(T,Xe(w,e)),value:Xe(f,e),source:y}},h=>h?Ht(h,e):void 0),handleRemoveComment:N(r.onRemove,({value:h,source:w})=>({value:Xe(h,e),source:w}),()=>{}),handleReadEmailRevisions:N(s.byForeignKey("parent").handleRead,h=>h,h=>h?.map(w=>$t(w,e))),handleEmailAutosave:N(s.onSave,function({prev:h,patch:w,value:f,source:y}){return{value:bs(f,e),source:y}},h=>h?$t(h,e):void 0),handleRemoveEmailAutoSave:N(s.onRemove,({value:h,source:w})=>({value:bs(h,e),source:w}),()=>{}),handleEmailChanged:N(a.debounce(d,Ss),h=>W(h,e)),handleEmailInit:N(P,h=>W(h,e)),handlePreviousButtonClick:N(I,h=>W(h,e)),handleNextButtonClick:N(b,h=>W(h,e)),handleSaveButtonClick:N(m,h=>W(h,e)),handleHtmlChanged:N(a.debounce(_,Ss)),handleTestEmailSend:N(E,({html:h,...w})=>({...w,code:h,compiled:{html:h,ampHtml:""}})),handleTestEmailModal:N(A,h=>W(h,e)),handleCloneEmail:N(c,h=>W(h,e)),handleShareEmail:N(o),handlePreviewEmail:N(i),handleLivePreviewEmail:N(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 Ee(t[r]))}for(const r of Object.keys(t))n[r].setListener(e[r])}},Tu=a.createIdentifier$1("DataController"),Au=a.createIdentifier$1("DataEvents");function Is(e){return e.getOrCreateInstance(Tu,()=>{const t=new su(e);return e.getInstance(a.DISPOSABLE_ID)?.addDisposable(t),t})}function ws(e){return e.getOrCreateInstance(Au,()=>new wu(e))}var Cu=a.createIdentifier$1("plugin.startupShow");function Pu(e){const t=Is(e),n=ws(e),r=e.getInstance(a.OPTIONS_SOURCE_ID),s=e.getInstance(a.DISPOSABLE_ID),o={current:Promise.resolve()};e.inject(Cu,o);const i=r?.watch(l=>{l&&n.setOptions(l)}),c=r?.select(l=>l?.content).watch(l=>{l!==void 0&&(j(z.showStart),o.current=(async()=>{try{await t.show(l)}catch{}finally{j(z.showEnd)}})())});i&&s?.addDisposable(i),c&&s?.addDisposable(c)}function Du(e){const t=Is(e);return{...ws(e).get(),show(n){return j(z.showStart),t.show(n).finally(()=>j(z.showEnd))},save(){return t.save()}}}function em(e){return e}var Ru=[{name:"rest.client",setup:xd},{name:"auth.oauth",setup:a.provideOAuth},{name:"rest.identityHeaders",setup:Dd},{name:"lifetime.destroyable",provides:[Ot],setup:Lc},{name:"appInit",provides:[a.APP_ID,ot],setup:No},{name:"config",provides:[a.CONFIG_SOURCE_ID],setup:Rc},{name:"email.documents",setup:Xc},{name:"show.initPipeline",provides:[a.INIT_PIPELINE_ID],setup:Md},{name:"show",setup:Pu},{name:"locale.service",provides:[Ce],setup:Td},{name:"locale.fromConfig",awaits:{services:[a.CONFIG_SOURCE_ID,Ce]},setup:Ad},{name:"canvas.early",setup:Rl},{name:"canvas.previewSettings",setup:Bl},{name:"canvas.sandboxExtensions",setup:Ul},{name:"canvas.headerSync",provides:[xr],setup:Nl},{name:"canvas.ampSync",setup:aa},{name:"canvas.moduleBridge",setup:La},{name:"canvas.port",setup:ga},{name:"canvas.images",setup:ma},{name:"canvas.edits",setup:ul},{name:"canvas.blockContent",setup:ol},{name:"canvas.sandboxFill",provides:[St],setup:rc},{name:"canvas.reactions",setup:Cl}],Ou=class extends Error{cycle;constructor(e){super(`[units] цикл в зависимостях: ${e.join(" → ")}`),this.cycle=e}};function Lu(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 Nu(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 Ts(e){const t=Lu(e),n=[],r=new Set,s=[],o=new Set,i=c=>{if(!r.has(c)){if(o.has(c)){const l=s.indexOf(c);throw new Ou([...s.slice(l),c].map(u=>u.name))}o.add(c),s.push(c);for(const l of Nu(c,t))i(l);s.pop(),o.delete(c),r.add(c),n.push(c)}};for(const c of e)i(c);return n}var As;function Yt(e){const t=e.getInstance(a.OPTIONS_SOURCE_ID);if(t)return t;e.getInstance(a.DISPOSABLE_ID)||e.inject(a.DISPOSABLE_ID,new a.Disposable);const n=pe();e.inject(a.OPTIONS_SOURCE_ID,n),As??=Ts(Ru);for(const r of As)r.setup(e);return n}function xu(e){}var Mu=[{name:"save.previewFollow",setup:xu}],Cs=a.createIdentifier$1("plugin.lateUnitsInstalled");function Fu(e){if(!e.getInstance(Cs)){e.inject(Cs,!0);for(const t of Ts(Mu))t.setup(e)}}function ku(e,t){return{project:Number(e),app_id:t?.app_id||0,app_config:t?.app_config||{},user:t?.user}}function Bu(e){if(!e)return;const t=a.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 ju=a.defineMixin(e=>{let t,n,r;return{async setOptions(s){const o=r!==s.getAuthToken,i=!a.deepEqual(t,s.user),c=n!==s.project;if(r=s.getAuthToken,t=s.user,n=s.project,!(!e.getInstance(a.SECURITY_MODULE_ID)||!s.getAuthToken)&&!(!o&&!i&&!c))try{const l=await s.getAuthToken(s.user,s.project);e.inject(a.STANDALONE_BOOTSTRAP_TOKEN_ID,Promise.resolve(l||""));const u=Bu(l);if(!u)return;e.inject(a.STANDALONE_PROJECT_ID,u);const d=e.getInstance(a.APP_ID),p=d?await d.catch(()=>{}):void 0;e.inject(a.APP_ID,Promise.resolve(ku(u,p)))}catch{}}}});function Uu(e,t){if(e.getInstance(a.STANDALONE_FILE_PROXY_REGISTERED_ID))return;e.inject(a.STANDALONE_FILE_PROXY_REGISTERED_ID,!0);const n=a.getEvent(e,a.events.FILE_PROXY_EVENT_ID);t.addDisposable(n(async({url:r})=>(await fetch(r)).blob(),Number.MIN_VALUE))}function Hu(e){e.getInstance(a.STANDALONE_ACTIVATED_ID)||e.inject(a.SECURITY_MODULE_ID,void 0)}function Je(e){return String(e.standaloneKey||"").trim()||void 0}function $u(e){return e.standaloneOnAuthFailure===!0?!0:e.config?.standaloneOnAuthFailure===!0}function zt(e){return $u(e)?!!Je(e):!1}function Qe(e){return!!Je(e)&&!zt(e)}var Gu=a.defineMixin(e=>{let t,n=!1;return{setOptions(r){const s=n;if(n=!0,!Qe(r)){t&&(Hu(e),zt(r)),t=void 0;return}const o=Je(r);if(!o||t===o&&e.getInstance(a.SECURITY_MODULE_ID))return;t=o,e.inject(a.SECURITY_MODULE_ID,o);const i=e.getInstance(a.DISPOSABLE_ID);i&&Uu(e,i)}}}),Vu=a.defineMixin(e=>{const t=e.getInstance(a.DISPOSABLE_ID),n=a.getEvent(e,a.APP_LOAD_EVENT_ID),r=N(n),s=t.addDisposable(new Ee(r));return{setOptions({handleLoad:o}){s.setListener(o)},instance:{handleLoad:r},dispose:()=>t.dispose()}}),Yu=a.defineMixin(e=>{const t=e.getInstance(a.DISPOSABLE_ID),n=t.addDisposable(new a.AsyncEmitter),r=t.addDisposable(new a.AsyncEmitter),s=a.getEmitter(e,a.CONFIG_CHANGED_EVENT_ID),o=N(n.event),i=N(r.event),c=N(s.event),l=t.addDisposable(new Ee(o)),u=t.addDisposable(new Ee(i)),d=t.addDisposable(new Ee(c));return{instance:{handleSetOptions:o,handleOptionsChanged:i,handleConfigChanged:c},async setOptions(p){l.setListener(p.handleSetOptions),u.setListener(p.handleOptionsChanged),d.setListener(p.handleConfigChanged),await n.fire(p),await r.fire(p)},dispose(){}}}),qt,Ps="core";function zu(){const e=__useblocks__?.require;return typeof e!="function"?Promise.reject(new Error("[loadCore] AMD loader is unavailable")):new Promise((t,n)=>{e([Ps],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadCore] Failed to require core module")))})}function qu(e){const t=__useblocks__?.require?.warm;return typeof t!="function"?De().then(()=>{}):t([Ps],e)}function De(){return qt===void 0&&(qt=zu().then(e=>(ve()&&e.installDiagnostics().catch(t=>{}),e))),qt}var Kt=null,Wt=null;async function Ku(e){typeof e?.prefetch=="function"&&await e.prefetch()}function Xt(){return Kt||(Kt=De().then(()=>{})),Kt}function Ds(e){return Wt||(Wt=Ku(e)),Wt}function Wu(){return Ds(typeof __useblocks__<"u"?__useblocks__:void 0)}function Xu(e){return Promise.all([Xt(),Ds(e)]).then(()=>{})}function Ju(e){const t=e?.preload?.start??e?.startupPrefetchMode;return t==="eager"||t==="idle"||t==="manual"||t==="off"?t:"idle"}function Rs(e,t){const n=e?.preload?.execute!==!1;Promise.resolve().then(()=>qu(t?{priority:t}:void 0)).then(()=>n?Xt():void 0).catch(()=>{})}function Qu(e){const t=Ju(e);if(t==="eager")Rs(e);else if(t==="idle"){const n=()=>Rs(e,"low");document.readyState==="complete"?n():window.addEventListener("load",n,{once:!0})}}var Os="PluginRegistry";function Zu(e=a.resolveContainer()){return e.getOrCreateInstance(Os,()=>new mo)}var Ls=new ho(()=>Zu()),ef=a.defineMixin(e=>{let t;function n(){if(!t)throw new Error("PluginCollection not initialized. Call init() first.");return t}return{async setOptions(r){const s=e.getInstance(a.INSTANCE_ID),o=e.getInstance(Os);t||(t=new po(s,o,{ensureHostRuntimeReady:Wu}),e.inject(a.PLUGIN_COLLECTION_ID,t));const i=r?.plugins||[];s&&await t.setPlugins(i)},instance:{use(r){return typeof r=="function"?n().useByCtor(r):n().useByKey(r)},useAsync(r){return n().useAsync(r)},waitPlugin(r){return n().waitFor(r)}},dispose(){t?.dispose(),t=void 0}}}),Ns=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}},tf=a.createIdentifier$1("ELEMENT_INSERT_HTML_PIPELINE"),nf=a.createIdentifier$1("BLOCK_INSERT_HTML_PIPELINE"),rf="application_block_inserted",sf=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(nf,()=>new Ns).add(e,t??0,n)}handleInject(e,t,n){const r=this._container.getOrCreateInstance(a.MESSAGE_SERVICE_ID,()=>new a.MessageService),s=n?e.bind(n):e;return r.addListener(rf,s,t)}},of=a.createIdentifier$1("ComponentRegistry"),xs;function Re(e,t=of){const n=a.DependencyResolver.getInstance(t);if(n)return n;if(!xs)throw new Error("[extensions] component registry is not loaded yet — UI work starts at init()");return a.DependencyResolver.getOrCreateInstance(t,xs)}var af=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}getNames(){return new Promise(e=>{const t=this._container.addService(a.ATOMS_HANDLERS_ID,{execute:n=>{t.dispose(),e(n.value.map(r=>({name:r.name,html:r.html})))}})})}update(e,t){const n=this._container,r=Re(n);return n.addService(a.ATOMS_HANDLERS_ID,{execute:s=>{const o=s.value.find(i=>i.name===e);if(o){const{icon:i,title:c,fallbackTooltip:l,...u}=t;i&&(o.icon=r.getReactNode(i)),c&&(o.title=r.getReactNode(c)),l&&(o.fallbackTooltip=r.getReactNode(l)),Object.assign(o,u)}}})}delete(e){this._container.addService(a.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,r=Re(n);return n.addService(a.ATOMS_HANDLERS_ID,{execute:s=>{s.value.splice(t??s.value.length,0,{...e,title:r.getReactNode(e.title),icon:r.getReactNode(e.icon),fallbackTooltip:r.getReactNode(e.fallbackTooltip)})}})}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(tf,()=>new Ns).add(e,t??0,n)}handleInject(e,t,n){return a.getEmitter$1(this._container,a.HANDLE_ATOM_INSERT_ID).event(r=>{e({name:r.name,className:r.className||"",html:r.html})},t,n)}},lf=class{_messageService;constructor(e){this._messageService=e.container.getOrCreateInstance(a.MESSAGE_SERVICE_ID,()=>new a.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 cf(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>n!==void 0))}var df=class{_context;_showModalEmitter;_closeModalEmitter;_updateModalEmitter;constructor(e){this._context=e;const t=e.container;this._showModalEmitter=a.getEmitter$1(t,a.MODAL_SHOW_EVENT),this._closeModalEmitter=a.getEmitter$1(t,a.MODAL_CLOSE_EVENT),this._updateModalEmitter=a.getEmitter$1(t,a.MODAL_UPDATE_EVENT)}get _container(){return this._context.container}show(e){const t=Re(this._container),n=`modal_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,r=e.modalProps;return this._showModalEmitter.fire({...e,content:t.getReactNode(e.content),title:t.getReactNode(e.title),id:n,modalProps:r?{...r,footer:t.getReactNode(r.footer),okText:t.getReactNode(r.okText),cancelText:t.getReactNode(r.cancelText),closeIcon:t.getReactNode(r.closeIcon)}:void 0}),n}close(e){this._closeModalEmitter.fire(e)}closeAll(){this._closeModalEmitter.fire()}update(e,t){const n=Re(this._container),r=t.modalProps;this._updateModalEmitter.fire(cf({...t,content:n.getReactNode(t.content),title:n.getReactNode(t.title),id:e,modalProps:r?{...r,footer:n.getReactNode(r.footer),okText:n.getReactNode(r.okText),cancelText:n.getReactNode(r.cancelText),closeIcon:n.getReactNode(r.closeIcon)}:void 0}))}},uf=class{_registration;_loadedDisposable;loaded;ready;_loadedSettled=!1;_readySettled=!1;constructor(e,t){this._registration=e,this._loadedDisposable=t,this.loaded=new Promise((n,r)=>{const s=()=>this._loadedDisposable.dispose(),o=()=>{this._loadedSettled||(this._loadedSettled=!0,this._readySettled&&s(),n())},i=c=>{this._loadedSettled||(this._loadedSettled=!0,this._readySettled&&s(),r(c))};this._resolveLoaded=o,this._rejectLoaded=i}),this.ready=new Promise((n,r)=>{const s=()=>this._loadedDisposable.dispose(),o=()=>{this._readySettled||(this._readySettled=!0,this._loadedSettled&&s(),n())},i=c=>{this._readySettled||(this._readySettled=!0,this._loadedSettled&&s(),r(c))};this._resolveReady=o,this._rejectReady=i})}_resolveLoaded=()=>{};_rejectLoaded=()=>{};_resolveReady=()=>{};_rejectReady=()=>{};resolveLoaded(){this._resolveLoaded()}resolveReady(){this._resolveReady()}rejectLoad(e){this._rejectLoaded(e),this._rejectReady(e)}rejectReady(e){this._rejectReady(e)}dispose(){this._registration.dispose();const e=new Error("Sandbox script registration disposed before completion.");this.rejectLoad(e),this.rejectReady(e)}},ff=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}get _messageService(){return this._container.getOrCreateInstance(a.MESSAGE_SERVICE_ID,()=>new a.MessageService)}_createScriptHandle(e,t){const n=this._messageService.addListener(a.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 uf(t,n);return r}registerSandboxCSS(e){return this._container.addService(a.SANDBOX_EXTENSIONS_ID,{type:"link",key:e,parent:"head",attributes:{rel:"stylesheet",type:"text/css",href:e}})}registerSandboxCSSCode(e,t){return this._container.addService(a.SANDBOX_EXTENSIONS_ID,{type:"style",key:e,parent:"head",attributes:{type:"text/css"},innerHTML:t})}registerSandboxScript(e){const t=this._container.addService(a.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(a.SANDBOX_EXTENSIONS_ID,{type:"script",key:e,parent:"head",attributes:{type:"text/javascript"},innerHTML:t});return this._createScriptHandle(e,n)}},pf=new Set([Symbol.for("react.element"),Symbol.for("react.transitional.element")]);function Jt(e){if(typeof e!="object"||e===null)return!1;const t=e.$$typeof;return typeof t=="symbol"&&pf.has(t)}function Ms(){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 Qt(){return`__settingsPanel:${Ms()}`}function Zt(e,t){return{type:e,props:t}}function mf(e){return typeof e=="object"&&e!==null&&"type"in e&&"props"in e&&!Jt(e)}function Fs(e,t,n){if(t==null||typeof t=="number"||typeof t=="boolean"||typeof t=="string")return t;if(Jt(t)){const r=Qt();return n(e.add(r,t)),Zt(r,{})}if(typeof t=="function"){const r=Qt();return n(e.add(r,t)),Zt(r,{})}if(mf(t)){const r=t.type;if(typeof r=="string")return t;if(Jt(r)||typeof r=="function"){const s=Qt();return n(e.add(s,r)),Zt(s,t.props)}return t}return t}var hf=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=Re(this._container),n=i=>this._trackRegistration(i),r=Fs(t,e.content,n),s=e.advancedTabs?.map(i=>({...i,content:Fs(t,i.content,n)})),o=e.instanceKey??Ms();a.getEmitter$1(this._container,a.SETTINGS_PANEL_EVENT).fire({...e,content:r,advancedTabs:s,instanceKey:o,type:a.ADVANCED_SETTINGS_PANEL})}closeSettingsPanel(){this._clearPanelRegistrations(),a.getEmitter$1(this._container,a.SETTINGS_PANEL_EVENT).fire(null)}},ks={SandboxScriptApi:ff,ElementsApi:af,BlocksApi:sf,MessageService:lf,SettingsPanelApi:hf,ModalApi:df};function en(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 c=s[o],l=r[o]??{};s[o]=Object.assign({},typeof c=="object"&&c!==null?c:l,i)}else s[o]=i;return s}var X={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}},gf={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"},tn={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},Bs={color:"#1C52DC",contrastColor:"#FFFFFF",underline:!0},_e={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:X.border,borderRadius:X.borderRadius,textAlign:"center",padding:X.padding},js={backgroundColor:"#FFFFFF",contrastBackgroundColor:"#1C52DC",padding:X.padding},nn={contrastBackgroundColor:"#1C52DC",contrastTextColor:"#FFFFFF",baseBackgroundColor:"#F8F8F8",baseTextColor:"#333333",border:X.border,borderRadius:X.borderRadiusCards};function Ef(e){return{...gf,...e}}function bf(e){return{...tn,...e,bold:e?.bold??tn.bold,italic:e?.italic??tn.italic}}function _f(e){return{...Bs,...e,underline:e?.underline??Bs.underline}}function vf(e){return{..._e,...e,bold:e?.bold??_e.bold,italic:e?.italic??_e.italic,border:{..._e.border,...e?.border},borderRadius:{..._e.borderRadius,...e?.borderRadius},padding:{..._e.padding,...e?.padding}}}function yf(e){return{...js,...e,padding:{...js.padding,...e?.padding}}}function Sf(e){return{...nn,...e,border:{...nn.border,...e?.border},borderRadius:{...nn.borderRadius,...e?.borderRadius}}}function rn(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 Us(e){let t={...a.COMMON_STYLES};try{e&&e!=="{}"&&(t=JSON.parse(e))}catch{}return t}function sn(e){return{text:Ef(e.text),headings:bf(e.headings),links:_f(e.links),buttons:vf(e.buttons),block:yf(e.block),cards:Sf(e.cards)}}var Hs=a.createIdentifier$1("EmailSettingsPort"),If=1e4,$s=class{_editor;_layoutSettingsChanged=new a.Emitter;_contentStylesChanged=new a.Emitter;_messageSubscription;_messageSubscriptionPromise;_prevLayoutSnapshot;_prevContentSnapshot;constructor(e){this._editor=e}onChangeEmailLayoutSettings(e){const t=this._layoutSettingsChanged.event(e);return this._ensureMessageSubscription(),{dispose:()=>{t.dispose(),this._disposeMessageSubscriptionIfUnused()}}}onChangeEmailContentStyles(e){const t=this._contentStylesChanged.event(e);return this._ensureMessageSubscription(),{dispose:()=>{t.dispose(),this._disposeMessageSubscriptionIfUnused()}}}_disposeMessageSubscriptionIfUnused(){this._layoutSettingsChanged.hasListeners()||this._contentStylesChanged.hasListeners()||(this._messageSubscription?.dispose(),this._messageSubscription=void 0)}_settings(e=this._editor.container){const t=e.getInstance(Hs);if(!t)throw new Error("[extensions] настройки письма ещё не загружены — работа с UI начинается с init()");return t}_getCurrentLayoutSettings(){return rn(this._settings().read())}_getCurrentContentStyles(){const e=at(this._editor.container)?.current()?.get().attributes.common_styles;return sn(Us(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(Hs),this._messageSubscription)return;const e=this._editor.container.getOrCreateInstance(a.MESSAGE_SERVICE_ID,()=>new a.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===a.EVENT_TYPES.APPLICATION_EMAIL_SETTINGS_SET){const l=rn(s?.settings),u=this._getLayoutSnapshot(l);u!==this._prevLayoutSnapshot&&(this._prevLayoutSnapshot=u,this._layoutSettingsChanged.fire(l));return}if(o!==a.EVENT_TYPES.APPLICATION_COMMON_STYLES_UPDATE)return;const i=sn(r.data?.settings?.commonStyles??{...a.COMMON_STYLES}),c=this._getContentSnapshot(i);c!==this._prevContentSnapshot&&(this._prevContentSnapshot=c,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=rn(n);this._prevLayoutSnapshot=this._getLayoutSnapshot(r),this._layoutSettingsChanged.fire(r)}async _waitForEmailSettingsFromIframe(e=If){const t=at(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=a.getEvent(r,a.events.ON_EMAIL_INIT_ID);return new Promise(o=>{let i=!1,c;const l=()=>{c&&(clearTimeout(c),c=void 0)},u=s(()=>{i||(i=!0,l(),u.dispose(),o())});c=setTimeout(()=>{i||(i=!0,u.dispose(),o())},e)})}async getEmailContentStyles(){return this._getCurrentContentStyles()}async setEmailContentStyles(e){const t=at(this._editor.container)?.current();if(!t)return;const n=Us(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=en(n.buttons||{},e.buttons,["border","borderRadius","padding"],{border:X.border,borderRadius:X.borderRadius,padding:X.padding})),e.block!==void 0&&(n.block=en(n.block||{},e.block,["padding"],{padding:X.padding})),e.cards!==void 0&&(n.cards=en(n.cards||{},e.cards,["border","borderRadius"],{border:X.border,borderRadius:X.borderRadiusCards}));const r=JSON.stringify(n);Be(t,{common_styles:r}),this._settings().markAppearanceChanged();const s=sn(n);this._prevContentSnapshot=this._getContentSnapshot(s),this._contentStylesChanged.fire(s)}},wf={...ks,EmailSettingsApi:$s},Tf={...ks},tm={...Tf,EmailSettingsApi:$s},Af={...wf};function Cf(){Ls.addAll(Af)}var Pf=[a.defineMixin(()=>{Cf()}),Vu,Yu,Gu,a.JWTMixin,ju,a.OAuthMixin];async function Df(){return(await De()).asyncMixins}var Rf=ef,Of=e=>{let t=null,n=!1;return{instance:{},async setOptions(r){if(!t&&!n){let s;try{s=await Df()}catch(i){throw e.failPendingWaits(i),i}t=s(e);const o=await e.getInstanceAsync(a.INSTANCE_ID);Object.assign(o,t.instance||{})}t&&await t.setOptions(r)},dispose(){t?.dispose(),n=!0}}},Lf=a.combineMixins([...Pf]);function on(){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,c){const l=Symbol("subscription");return t||(n.set(l,{listener:o,priority:i,thisArg:c}),e&&r.set(l,e(o,i,c))),()=>{n.delete(l),r.get(l)?.(),r.delete(l)}},attach(o){s(),e=o;for(const[i,{listener:c,priority:l,thisArg:u}]of n)r.set(i,o(c,l,u))},dispose(){t=!0,s(),n.clear(),e=void 0}}}var Gs=a.createIdentifier$1("NotificationService");function Nf(e){const t=on(),n=on(),r=on();return e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{t.dispose(),n.dispose(),r.dispose()}),e.getInstanceAsync(Gs).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(Gs);if(!o)throw new Error("[plugin] notify() вызван до загрузки редактора");o.notify(s)}}}var xf=[Nc,Du,Nf];function Mf(e,t=xf){const n=Yt(e);Fu(e);const r=Lf(e),s=Rf(e),o=Of(e),i={...r.instance,...s.instance,...o.instance};for(const l of t)Object.assign(i,l(e));let c=!0;return{instance:i,async setOptions(l){await r.setOptions(l);const u=c&&n.get()===l;c=!1,u||n.set(l),await s.setOptions(l),await o.setOptions(l)}}}var Ff=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]}},kf="editor-runtime.react.copies",an=8;function Oe(e){return e&&typeof e=="object"?e:void 0}function Vs(e){const t=Oe(e);if(!t)return;if(typeof t.useState=="function")return t.useState;const n=Oe(t.default);return n&&typeof n.useState=="function"?n.useState:void 0}function Bf(e){const t=Oe(e),n=t&&typeof t.version=="string"?t.version:void 0,r=Oe(t?.default),s=r&&typeof r.version=="string"?r.version:void 0;return n??s??"unknown"}function jf(e,t,n){return e.package===t&&e.version===n}function Uf({ourReact:e,entries:t,packageName:n,version:r}){const s=Vs(e);if(!s||!Array.isArray(t))return[];const o=[],i=new Set;for(const c of t){const l=Oe(c);if(!l||!jf(l,n,r))continue;const u=Vs(l.react);!u||u===s||i.has(u)||(i.add(u),o.push({package:n,version:r,reactVersion:Bf(l.react),react:l.react}))}return o}function Hf({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,an))n.push(` • React ${r.reactVersion}, loaded through ${r.package}@${r.version}/runtime/react`);return t.length>an&&n.push(` …and ${t.length-an} 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(`
2129
- `)}var Ys=new Set;function $f({packageName:e="useblocks",version:t="1.1.85-dev.2",log:n=r=>{}}={}){const r=s=>{try{const o=globalThis[Symbol.for(kf)],i=Uf({ourReact:s,entries:o,packageName:e,version:t}).filter(c=>!Ys.has(c.react));if(!i.length)return;i.forEach(c=>Ys.add(c.react)),n(Hf({packageName:e,copies:i}))}catch{}};try{const s=rt()?.modules?.React;if(s&&typeof s.then=="function"){s.then(r,()=>{});return}r(s)}catch{}}async function Gf(e,t){a.throwIfAborted(e.signal);const n=t??a.DependencyResolver.createChild();Yt(n);const r=n.getInstance(a.DISPOSABLE_ID);async function s(){n.inject(a.COOKIE_MANAGER_ID,new Ff),$f();const o=Mf(n),i={...o.instance,container:n,async reset(c){if(a.throwIfAborted(c.signal),r.isDisposed())throw Sn();return await o.setOptions(c),i}};n.inject(a.INSTANCE_ID,i);try{if(await o.setOptions(e),a.throwIfAborted(e.signal),r.isDisposed()||await n.getInstance(a.PLUGIN_COLLECTION_ID)?.activate(),e.devTools)try{const c=n.getInstance(a.PLUGIN_COLLECTION_ID);c&&await(await De()).initDevTools(n,c)}catch{}return a.throwIfAborted(e.signal),a.getEmitter(n,a.APP_LOAD_EVENT_ID).fire(i),i}catch(c){throw r.dispose(),c}}try{return await a.raceWithAbortSignal(s(),e.signal)}catch(o){throw r.isDisposed()||r.dispose(),o}}var Le=new WeakMap;function Vf(e){return e?Le.get(e):void 0}function zs(e){try{e.getInstance(a.DISPOSABLE_ID)?.dispose()}catch{}try{e.dispose()}catch{}}function Yf(e,t){if(!e)return;const n=Le.get(e);n&&n!==t&&zs(n),Le.set(e,t)}function zf(e,t){e&&Le.get(e)===t&&Le.delete(e)}function qf(e){const t=a.DependencyResolver.createChild();return Qe(e)&&t.inject(a.SECURITY_MODULE_ID,Je(e)),t}var Ne=new WeakMap,Kf="data-useblocks-config-styles";function Wf(e){return typeof e=="string"?e.trim():""}function qs(e,t){if(e.firstChild){e.insertBefore(t,e.firstChild);return}e.appendChild(t)}function Xf(e,t,n){if(!e||typeof document>"u")return null;const r=Wf(t),s=Ne.get(e),o=n||e;if(!r)return s&&(s.remove(),Ne.delete(e)),null;if(s)return s.textContent!==r&&(s.textContent=r),(s.parentNode!==o||s!==o.firstChild)&&qs(o,s),s;const i=document.createElement("style");return i.setAttribute(Kf,"true"),i.textContent=r,qs(o,i),Ne.set(e,i),i}function Jf(e){if(!e)return;const t=Ne.get(e);t&&(t.remove(),Ne.delete(e))}var nm=!1;function Ks(){return!1}var rm=28,Qf=`
2129
+ `)}var Ys=new Set;function $f({packageName:e="useblocks",version:t="1.1.85-dev.3",log:n=r=>{}}={}){const r=s=>{try{const o=globalThis[Symbol.for(kf)],i=Uf({ourReact:s,entries:o,packageName:e,version:t}).filter(c=>!Ys.has(c.react));if(!i.length)return;i.forEach(c=>Ys.add(c.react)),n(Hf({packageName:e,copies:i}))}catch{}};try{const s=rt()?.modules?.React;if(s&&typeof s.then=="function"){s.then(r,()=>{});return}r(s)}catch{}}async function Gf(e,t){a.throwIfAborted(e.signal);const n=t??a.DependencyResolver.createChild();Yt(n);const r=n.getInstance(a.DISPOSABLE_ID);async function s(){n.inject(a.COOKIE_MANAGER_ID,new Ff),$f();const o=Mf(n),i={...o.instance,container:n,async reset(c){if(a.throwIfAborted(c.signal),r.isDisposed())throw Sn();return await o.setOptions(c),i}};n.inject(a.INSTANCE_ID,i);try{if(await o.setOptions(e),a.throwIfAborted(e.signal),r.isDisposed()||await n.getInstance(a.PLUGIN_COLLECTION_ID)?.activate(),e.devTools)try{const c=n.getInstance(a.PLUGIN_COLLECTION_ID);c&&await(await De()).initDevTools(n,c)}catch{}return a.throwIfAborted(e.signal),a.getEmitter(n,a.APP_LOAD_EVENT_ID).fire(i),i}catch(c){throw r.dispose(),c}}try{return await a.raceWithAbortSignal(s(),e.signal)}catch(o){throw r.isDisposed()||r.dispose(),o}}var Le=new WeakMap;function Vf(e){return e?Le.get(e):void 0}function zs(e){try{e.getInstance(a.DISPOSABLE_ID)?.dispose()}catch{}try{e.dispose()}catch{}}function Yf(e,t){if(!e)return;const n=Le.get(e);n&&n!==t&&zs(n),Le.set(e,t)}function zf(e,t){e&&Le.get(e)===t&&Le.delete(e)}function qf(e){const t=a.DependencyResolver.createChild();return Qe(e)&&t.inject(a.SECURITY_MODULE_ID,Je(e)),t}var Ne=new WeakMap,Kf="data-useblocks-config-styles";function Wf(e){return typeof e=="string"?e.trim():""}function qs(e,t){if(e.firstChild){e.insertBefore(t,e.firstChild);return}e.appendChild(t)}function Xf(e,t,n){if(!e||typeof document>"u")return null;const r=Wf(t),s=Ne.get(e),o=n||e;if(!r)return s&&(s.remove(),Ne.delete(e)),null;if(s)return s.textContent!==r&&(s.textContent=r),(s.parentNode!==o||s!==o.firstChild)&&qs(o,s),s;const i=document.createElement("style");return i.setAttribute(Kf,"true"),i.textContent=r,qs(o,i),Ne.set(e,i),i}function Jf(e){if(!e)return;const t=Ne.get(e);t&&(t.remove(),Ne.delete(e))}var nm=!1;function Ks(){return!1}var rm=28,Qf=`
2130
2130
  .blocks-app-initial-spinner-wrapper {
2131
2131
  width: 100%;
2132
2132
  height: 100%;
@@ -2155,11 +2155,11 @@ __useblocks__.define("useblocks.js",["require","exports","module","static/umd/a6
2155
2155
  100% {
2156
2156
  transform: rotate(360deg);
2157
2157
  }
2158
- }`;function Zf(){return()=>{}}function ep(e,t){if(!Ks()||!e||typeof document>"u")return Zf();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=Qf,document.head?.appendChild(s),e.appendChild(n);let o=!1;return()=>{o||(o=!0,n.remove(),s.remove())}}function tp(e){if(!(e instanceof Error))return!1;const t=e;return t.terminal===!0||t.status===403||t.status===404}function np({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 c=o().catch(l=>{throw n.has(s)||(n.add(s),r(l)),tp(l)||t.delete(s),l});return t.set(s,c),c},clear(){t.clear(),n.clear()},size(){return t.size}}}var ln=np();function Ws(){ln.clear()}a.setApiOriginFailoverHook(()=>ln.clear());var Xs=new WeakMap,Js=new WeakMap;function rp(e,t){let n=Js.get(t);n||(n=new Map,Js.set(t,n));const r=n.get(e);if(r!==void 0)return r;const s=t.getInstance(a.CUSTOM_FETCH_ID),o=a.createTransport({baseUrl:e,customFetch:s?.execute??fetch},t);return n.set(e,o),o}function cn(e){return a.resolveExplicitApiBaseUrl(e)}function sp(e,t){const n=new Error(`[Loader] appInit request failed: ${e} ${t}`);return n.status=e,n}function op(){const e=new Error("[Loader] appInit skipped: empty auth token");return e.terminal=!0,e}async function ip(e){if(!e.getAuthToken)return;const t=await e.getAuthToken(e.user,e.project,void 0),n=String(t||"").trim();return n?`Bearer ${n}`:void 0}function ap(e,t){return async({baseUrl:n})=>{const r=cn(n);if(!r)throw new Error("[Loader] appInit requires baseUrl or REACT_APP_OPENAPI_BASE_URL");const s=new Headers({Accept:"application/json"});if(e.getAuthToken&&!await ip(e))throw op();const o=t();if(!o)throw new Error("[Loader] appInit requires the instance container");const i=new wn(rp(r,o)),c={headers:Object.fromEntries(s.entries()),credentials:"same-origin",failoverAttemptTimeout:zt(e)||void 0},l=await i.app_init_create({},c);if(!l.ok)throw sp(l.status,l.statusText);return l.data}}function lp(e){return JSON.stringify({baseUrl:cn(e.baseUrl)||"",project:e.project??"",userId:e.user?.id??""})}function cp(e){return e.appInit?!0:!(e.jwtAuth&&!e.getAuthToken)}function dp(e){return t=>ln.run(lp(t),()=>(j("appInit:start",{kind:"network"}),Promise.resolve(e(t)).finally(()=>j("appInit:end",{kind:"network"}))))}function up(e,t){if(Qe(e)||!e.appInit&&!cn(e.baseUrl)||!cp(e))return e;const n=e.appInit??ap(e,t);let r=Xs.get(n);return r||(r=dp(n),Xs.set(n,r)),{...e,appInit:r}}var Qs=0;function fp(){return Qs}function pp(){Qs+=1,Ws()}var Zs=new WeakMap,eo=new WeakMap,mp=3e4;function hp(e,t){return JSON.stringify({userId:e?.id??"",project:t??""})}function gp(e,t){try{const n=a.decodeJwt(e)?.exp;if(typeof n=="number"&&Number.isFinite(n)&&n>0)return n*1e3}catch{}return t+mp}function Ep(e){const t=new Map,n=new Map;return async(r,s,o)=>{const i=hp(r,s);if(o)return n.delete(i),t.delete(i),Ws(),e(r,s,o);const c=n.get(i);if(c&&!t.has(i)){if(c.expiresAtMs>Date.now())return c.token;n.delete(i)}let l=t.get(i);return l===void 0&&(j("authToken:start",{kind:"network"}),l=Promise.resolve(e(r,s,o)).then(u=>{const d=String(u||"").trim();return d&&n.set(i,{token:u,expiresAtMs:gp(d,Date.now())}),u}).finally(()=>{j("authToken:end",{kind:"network"}),t.delete(i)}),t.set(i,l)),l}}function bp(e){if(Qe(e))return e;const t=e.getAuthToken;if(!t)return e;let n=Zs.get(t);const r=fp();return(!n||eo.get(t)!==r)&&(n=Ep(t),Zs.set(t,n),eo.set(t,r)),Promise.resolve(n(e.user,e.project,void 0)).catch(s=>{}),{...e,getAuthToken:n}}var dn="Editor mount element was removed from the document. Call instance.destroy() on host unmount.";function _p(){return a.createAbortError(dn)}function to(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===dn}function vp(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 c=e.parentNode;for(;c;)s.observe(c,{childList:!0}),c=c.parentNode}function yp(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 vp(n,()=>{n.id,o.abort(_p())},s),a.composeAbortSignals(r,o.signal)}var un="Superseded by newer init() on the same mount element";function no(){return a.createAbortError(un)}function ro(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===un}var Ze=new Map,et=new WeakMap;function Sp(e){if(e instanceof Element){const t=e.id?.trim();if(t)return`#${t}`}}function Ip(e){if(!e)return{release:()=>{}};const t=Sp(e);et.get(e)?.abort(no()),t&&Ze.get(t)?.abort(no());const n=new AbortController;return et.set(e,n),t&&Ze.set(t,n),{signal:n.signal,release:()=>{et.get(e)===n&&et.delete(e),t&&Ze.get(t)===n&&Ze.delete(t)}}}var wp=gn({FileManagerApiError:()=>Tp}),Tp=class io 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,io)}},Ap=gn({mapHttpStatusToErrorCode:()=>a.mapHttpStatusToErrorCode});function Cp(e,t){return{...e,element:t}}function fn(){return()=>{}}function Pp(e){const t=e.element;return!t||typeof t=="string"||typeof document>"u"?fn():(Xf(t,e.config?.styles,t),()=>{Jf(t)})}function Dp(e){if(!Ks()||e.initialSpinner===!1||typeof document>"u")return{options:e,cleanup:fn()};const t=e.element;if(!t||typeof t=="string")return{options:e,cleanup:fn()};t.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(s=>{s.remove()});const n=ep(t,"data-useblocks"),r=e.handleChunkLoaded;return{options:{...e,handleChunkLoaded:()=>{n(),r?.()}},cleanup:n}}function so(e){return e instanceof DOMException&&e.name==="AbortError"}function oo(e){try{e.destroy()}catch{}}function pn(e,...t){const n=a.ELEMENT_MAP.get(e);t.some(r=>r!==void 0&&r===n)&&a.ELEMENT_MAP.delete(e)}var Rp="1.1.85-dev.2";async function Op(e){await Xu(typeof __useblocks__<"u"?__useblocks__:void 0)}async function Lp(e){j(z.initStart);const t=await Np(e);return j(z.initEnd),t}async function Np(e){a.throwIfAborted(e.signal);const t=new a.Disposable;let n;try{const r=await a.waitForElement(e.element,t,e.signal),s=yp({hostElementOption:e.element,resolvedElement:r,externalSignal:e.signal,disposable:t}),o=Ip(r);n=o.release;const i=a.composeAbortSignals(s,o.signal);return await a.raceWithAbortSignal(xp(e,r,i),i)}finally{n?.(),t.dispose()}}async function xp(e,t,n){a.throwIfAborted(n),pp();const r=Cp(e,t),s=bp(r);let o;const i=up(s,()=>o),c=n!=null?{...i,signal:n}:i;if(t){const m=a.ELEMENT_MAP.get(t);if(m){let b;try{b=await m,a.throwIfAborted(n)}catch(S){if(a.throwIfAborted(n),pn(t,m),so(S))throw S;b=void 0}if(b)if(b.getElement()===t)try{return o=Vf(t),await b.reset(c)}catch(S){if(a.throwIfAborted(n),ro(S)||to(S)||so(S)&&n?.aborted)throw S;pn(t,m,b),oo(b)}else pn(t,m,b),oo(b)}}a.throwIfAborted(n);const l=Pp(i),u=Dp(i),d=n!=null?{...u.options,signal:n}:u.options;let p;try{o=qf(d),Yf(t,o),Yt(o).set(d),await Xt(),j(z.coreReady),a.throwIfAborted(n),a.throwIfAborted(n),p=Gf(d,o),t&&a.ELEMENT_MAP.set(t,p);const m=await p;if(n?.aborted&&(m.destroy(),a.throwIfAborted(n)),t)if(a.ELEMENT_MAP.get(t)===p)a.ELEMENT_MAP.set(t,m);else throw m.destroy(),a.throwIfAborted(n),a.createAbortError(n?.reason);return m}catch(m){throw l(),u.cleanup(),o&&(zs(o),zf(t,o)),t&&p&&a.ELEMENT_MAP.get(t)===p&&a.ELEMENT_MAP.delete(t),m}}async function Mp(e){return(await De()).parseAMP(e)}typeof window<"u"&&(ve()&&Po(),Qu(typeof __useblocks__<"u"?__useblocks__:void 0)),K.ELEMENT_DETACHED_ABORT_MESSAGE=dn,K.SUPERSEDED_INIT_ABORT_MESSAGE=un,Object.defineProperty(K,"errors",{enumerable:!0,get:function(){return wp}}),Object.defineProperty(K,"helpers",{enumerable:!0,get:function(){return Ap}}),K.init=Lp,K.isElementDetachedError=to,K.isSupersededInitError=ro,K.parseAMP=Mp,K.pluginRegistry=Ls,K.preload=Op,K.version=Rp});
2158
+ }`;function Zf(){return()=>{}}function ep(e,t){if(!Ks()||!e||typeof document>"u")return Zf();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=Qf,document.head?.appendChild(s),e.appendChild(n);let o=!1;return()=>{o||(o=!0,n.remove(),s.remove())}}function tp(e){if(!(e instanceof Error))return!1;const t=e;return t.terminal===!0||t.status===403||t.status===404}function np({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 c=o().catch(l=>{throw n.has(s)||(n.add(s),r(l)),tp(l)||t.delete(s),l});return t.set(s,c),c},clear(){t.clear(),n.clear()},size(){return t.size}}}var ln=np();function Ws(){ln.clear()}a.setApiOriginFailoverHook(()=>ln.clear());var Xs=new WeakMap,Js=new WeakMap;function rp(e,t){let n=Js.get(t);n||(n=new Map,Js.set(t,n));const r=n.get(e);if(r!==void 0)return r;const s=t.getInstance(a.CUSTOM_FETCH_ID),o=a.createTransport({baseUrl:e,customFetch:s?.execute??fetch},t);return n.set(e,o),o}function cn(e){return a.resolveExplicitApiBaseUrl(e)}function sp(e,t){const n=new Error(`[Loader] appInit request failed: ${e} ${t}`);return n.status=e,n}function op(){const e=new Error("[Loader] appInit skipped: empty auth token");return e.terminal=!0,e}async function ip(e){if(!e.getAuthToken)return;const t=await e.getAuthToken(e.user,e.project,void 0),n=String(t||"").trim();return n?`Bearer ${n}`:void 0}function ap(e,t){return async({baseUrl:n})=>{const r=cn(n);if(!r)throw new Error("[Loader] appInit requires baseUrl or REACT_APP_OPENAPI_BASE_URL");const s=new Headers({Accept:"application/json"});if(e.getAuthToken&&!await ip(e))throw op();const o=t();if(!o)throw new Error("[Loader] appInit requires the instance container");const i=new wn(rp(r,o)),c={headers:Object.fromEntries(s.entries()),credentials:"same-origin",failoverAttemptTimeout:zt(e)||void 0},l=await i.app_init_create({},c);if(!l.ok)throw sp(l.status,l.statusText);return l.data}}function lp(e){return JSON.stringify({baseUrl:cn(e.baseUrl)||"",project:e.project??"",userId:e.user?.id??""})}function cp(e){return e.appInit?!0:!(e.jwtAuth&&!e.getAuthToken)}function dp(e){return t=>ln.run(lp(t),()=>(j("appInit:start",{kind:"network"}),Promise.resolve(e(t)).finally(()=>j("appInit:end",{kind:"network"}))))}function up(e,t){if(Qe(e)||!e.appInit&&!cn(e.baseUrl)||!cp(e))return e;const n=e.appInit??ap(e,t);let r=Xs.get(n);return r||(r=dp(n),Xs.set(n,r)),{...e,appInit:r}}var Qs=0;function fp(){return Qs}function pp(){Qs+=1,Ws()}var Zs=new WeakMap,eo=new WeakMap,mp=3e4;function hp(e,t){return JSON.stringify({userId:e?.id??"",project:t??""})}function gp(e,t){try{const n=a.decodeJwt(e)?.exp;if(typeof n=="number"&&Number.isFinite(n)&&n>0)return n*1e3}catch{}return t+mp}function Ep(e){const t=new Map,n=new Map;return async(r,s,o)=>{const i=hp(r,s);if(o)return n.delete(i),t.delete(i),Ws(),e(r,s,o);const c=n.get(i);if(c&&!t.has(i)){if(c.expiresAtMs>Date.now())return c.token;n.delete(i)}let l=t.get(i);return l===void 0&&(j("authToken:start",{kind:"network"}),l=Promise.resolve(e(r,s,o)).then(u=>{const d=String(u||"").trim();return d&&n.set(i,{token:u,expiresAtMs:gp(d,Date.now())}),u}).finally(()=>{j("authToken:end",{kind:"network"}),t.delete(i)}),t.set(i,l)),l}}function bp(e){if(Qe(e))return e;const t=e.getAuthToken;if(!t)return e;let n=Zs.get(t);const r=fp();return(!n||eo.get(t)!==r)&&(n=Ep(t),Zs.set(t,n),eo.set(t,r)),Promise.resolve(n(e.user,e.project,void 0)).catch(s=>{}),{...e,getAuthToken:n}}var dn="Editor mount element was removed from the document. Call instance.destroy() on host unmount.";function _p(){return a.createAbortError(dn)}function to(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===dn}function vp(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 c=e.parentNode;for(;c;)s.observe(c,{childList:!0}),c=c.parentNode}function yp(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 vp(n,()=>{n.id,o.abort(_p())},s),a.composeAbortSignals(r,o.signal)}var un="Superseded by newer init() on the same mount element";function no(){return a.createAbortError(un)}function ro(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===un}var Ze=new Map,et=new WeakMap;function Sp(e){if(e instanceof Element){const t=e.id?.trim();if(t)return`#${t}`}}function Ip(e){if(!e)return{release:()=>{}};const t=Sp(e);et.get(e)?.abort(no()),t&&Ze.get(t)?.abort(no());const n=new AbortController;return et.set(e,n),t&&Ze.set(t,n),{signal:n.signal,release:()=>{et.get(e)===n&&et.delete(e),t&&Ze.get(t)===n&&Ze.delete(t)}}}var wp=gn({FileManagerApiError:()=>Tp}),Tp=class io 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,io)}},Ap=gn({mapHttpStatusToErrorCode:()=>a.mapHttpStatusToErrorCode});function Cp(e,t){return{...e,element:t}}function fn(){return()=>{}}function Pp(e){const t=e.element;return!t||typeof t=="string"||typeof document>"u"?fn():(Xf(t,e.config?.styles,t),()=>{Jf(t)})}function Dp(e){if(!Ks()||e.initialSpinner===!1||typeof document>"u")return{options:e,cleanup:fn()};const t=e.element;if(!t||typeof t=="string")return{options:e,cleanup:fn()};t.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(s=>{s.remove()});const n=ep(t,"data-useblocks"),r=e.handleChunkLoaded;return{options:{...e,handleChunkLoaded:()=>{n(),r?.()}},cleanup:n}}function so(e){return e instanceof DOMException&&e.name==="AbortError"}function oo(e){try{e.destroy()}catch{}}function pn(e,...t){const n=a.ELEMENT_MAP.get(e);t.some(r=>r!==void 0&&r===n)&&a.ELEMENT_MAP.delete(e)}var Rp="1.1.85-dev.3";async function Op(e){await Xu(typeof __useblocks__<"u"?__useblocks__:void 0)}async function Lp(e){j(z.initStart);const t=await Np(e);return j(z.initEnd),t}async function Np(e){a.throwIfAborted(e.signal);const t=new a.Disposable;let n;try{const r=await a.waitForElement(e.element,t,e.signal),s=yp({hostElementOption:e.element,resolvedElement:r,externalSignal:e.signal,disposable:t}),o=Ip(r);n=o.release;const i=a.composeAbortSignals(s,o.signal);return await a.raceWithAbortSignal(xp(e,r,i),i)}finally{n?.(),t.dispose()}}async function xp(e,t,n){a.throwIfAborted(n),pp();const r=Cp(e,t),s=bp(r);let o;const i=up(s,()=>o),c=n!=null?{...i,signal:n}:i;if(t){const m=a.ELEMENT_MAP.get(t);if(m){let b;try{b=await m,a.throwIfAborted(n)}catch(S){if(a.throwIfAborted(n),pn(t,m),so(S))throw S;b=void 0}if(b)if(b.getElement()===t)try{return o=Vf(t),await b.reset(c)}catch(S){if(a.throwIfAborted(n),ro(S)||to(S)||so(S)&&n?.aborted)throw S;pn(t,m,b),oo(b)}else pn(t,m,b),oo(b)}}a.throwIfAborted(n);const l=Pp(i),u=Dp(i),d=n!=null?{...u.options,signal:n}:u.options;let p;try{o=qf(d),Yf(t,o),Yt(o).set(d),await Xt(),j(z.coreReady),a.throwIfAborted(n),a.throwIfAborted(n),p=Gf(d,o),t&&a.ELEMENT_MAP.set(t,p);const m=await p;if(n?.aborted&&(m.destroy(),a.throwIfAborted(n)),t)if(a.ELEMENT_MAP.get(t)===p)a.ELEMENT_MAP.set(t,m);else throw m.destroy(),a.throwIfAborted(n),a.createAbortError(n?.reason);return m}catch(m){throw l(),u.cleanup(),o&&(zs(o),zf(t,o)),t&&p&&a.ELEMENT_MAP.get(t)===p&&a.ELEMENT_MAP.delete(t),m}}async function Mp(e){return(await De()).parseAMP(e)}typeof window<"u"&&(ve()&&Po(),Qu(typeof __useblocks__<"u"?__useblocks__:void 0)),K.ELEMENT_DETACHED_ABORT_MESSAGE=dn,K.SUPERSEDED_INIT_ABORT_MESSAGE=un,Object.defineProperty(K,"errors",{enumerable:!0,get:function(){return wp}}),Object.defineProperty(K,"helpers",{enumerable:!0,get:function(){return Ap}}),K.init=Lp,K.isElementDetachedError=to,K.isSupersededInitError=ro,K.parseAMP=Mp,K.pluginRegistry=Ls,K.preload=Op,K.version=Rp});
2159
2159
 
2160
2160
 
2161
2161
  // Возвращаем API из entry модуля
2162
2162
  return __useblocks__.syncRequire("useblocks.js");
2163
2163
  });
2164
2164
 
2165
- __useblocks__.require.config({"graph":{"core":["__delivery__/libs"],"static/core/13563d2c.js":["static/core/ca873214.js"],"static/core/181088a9.js":["static/core/576452f9.js"],"static/core/2639f789.js":[],"static/core/3832a02d.js":["static/core/d74b0853.js","__delivery__/libs"],"static/core/3fd50a29.js":[],"static/core/43affb86.js":["static/core/576452f9.js","static/core/ca873214.js","static/core/13563d2c.js"],"static/core/48da14fd.js":[],"static/core/52fbc985.js":[],"static/core/576452f9.js":[],"static/core/5f0c0e3a.js":[],"static/core/6561b34a.js":[],"static/core/6589e3b8.js":[],"static/core/6c7df338.js":[],"static/core/6eeae572.js":[],"static/core/6fdfa46d.js":["static/core/d74b0853.js","static/core/c789db17.js","__delivery__/libs"],"static/core/70b2c337.js":[],"static/core/79749848.js":[],"static/core/7b850506.js":[],"static/core/92e10a15.js":["static/core/e47dcbb0.js","__delivery__/libs","monaco"],"static/core/9b7f52a5.js":[],"static/core/a72f1f53.js":["static/core/c789db17.js","static/core/ef3477dd.js","__delivery__/libs"],"static/core/ac50dfd1.js":[],"static/core/b502ca96.js":[],"static/core/c6d342f2.js":["__delivery__/libs"],"static/core/c789db17.js":[],"static/core/ca873214.js":[],"static/core/cab426fa.js":[],"static/core/d74b0853.js":["static/core/c6d342f2.js","__delivery__/libs"],"static/core/e0d71533.js":[],"static/core/e47dcbb0.js":[],"static/core/e50befab.js":[],"static/core/ecad56ba.js":["static/core/d74b0853.js"],"static/core/ef3477dd.js":["static/core/c6d342f2.js","__delivery__/libs"],"static/core/f0f90842.js":["static/core/ca873214.js"],"static/core/fad0a613.js":[],"static/core/fb2fe2db.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/a6c87b84.js":[]},"bundles":{"static/core/c6d342f2.js":["static/core/b4e5fcbd.js","static/core/555eda67.js","static/core/f102fe60.js","static/core/fb7c05bc.js"],"static/core/181088a9.js":["static/core/a71c4cd8.js"],"static/core/3832a02d.js":["static/core/a3cd808c.js"],"static/core/ef3477dd.js":["static/core/a73da823.js"],"static/core/d74b0853.js":["static/core/ee9ea283.js","static/core/5a0df1c2.js","static/core/f7fccabd.js"],"core":["static/core/2ff39ddf.js","static/core/fe480726.js","static/core/6c10ee28.js","static/core/a8c3a77f.js","static/core/129055d9.js"]}});
2165
+ __useblocks__.require.config({"graph":{"core":["__delivery__/libs"],"static/core/14a79b09.js":["static/core/b97bd382.js","__delivery__/libs"],"static/core/199dc589.js":[],"static/core/230f23ec.js":[],"static/core/30f16e98.js":["static/core/adf6e008.js"],"static/core/34730be9.js":["static/core/520ec797.js","static/core/4f790fdc.js","__delivery__/libs"],"static/core/364dcebf.js":[],"static/core/3832a02d.js":["static/core/520ec797.js","__delivery__/libs"],"static/core/3fd50a29.js":[],"static/core/48da14fd.js":[],"static/core/4916b3a1.js":["static/core/adf6e008.js","static/core/230f23ec.js","static/core/6541580a.js"],"static/core/4f790fdc.js":[],"static/core/520ec797.js":["static/core/b97bd382.js","__delivery__/libs"],"static/core/52fbc985.js":[],"static/core/57c114f0.js":[],"static/core/5bf994b4.js":[],"static/core/6541580a.js":["static/core/230f23ec.js"],"static/core/6561b34a.js":[],"static/core/79431a89.js":["static/core/4f790fdc.js","static/core/14a79b09.js","__delivery__/libs"],"static/core/79749848.js":[],"static/core/7b850506.js":[],"static/core/8fb0fe48.js":[],"static/core/9a70cc1e.js":[],"static/core/a15ab67d.js":[],"static/core/ac50dfd1.js":[],"static/core/adf6e008.js":[],"static/core/b743a76d.js":["static/core/230f23ec.js"],"static/core/b97bd382.js":["__delivery__/libs"],"static/core/ddb5a35d.js":["static/core/e47dcbb0.js","__delivery__/libs","monaco"],"static/core/dfddbd68.js":[],"static/core/e0d71533.js":[],"static/core/e47dcbb0.js":[],"static/core/e50befab.js":[],"static/core/ecad56ba.js":["static/core/520ec797.js"],"static/core/f3eda1c7.js":[],"static/core/fb2fe2db.js":[],"static/core/ffb36e93.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/a6c87b84.js":[]},"bundles":{"static/core/b97bd382.js":["static/core/3bd1b21b.js","static/core/867b0259.js","static/core/a50825ac.js","static/core/daf98928.js"],"static/core/30f16e98.js":["static/core/a71c4cd8.js"],"static/core/3832a02d.js":["static/core/a3cd808c.js"],"static/core/14a79b09.js":["static/core/a73da823.js"],"static/core/520ec797.js":["static/core/dbeb2f23.js","static/core/5a0df1c2.js","static/core/f7fccabd.js"],"core":["static/core/2ff39ddf.js","static/core/fe480726.js","static/core/c00a8e02.js","static/core/d3e05bb9.js","static/core/a5b517f0.js"]}});