useblocks 1.0.28 → 1.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/asset-manifest.json +11 -11
- package/iframe/{iframe-eblock.34a9404248018e7465b3.html → iframe-eblock.53548d0d68a5fcc103dd.html} +1 -1
- package/iframe/{iframe.34a9404248018e7465b3.html → iframe.53548d0d68a5fcc103dd.html} +1 -1
- package/iframe/js/cssbeautify.js +1 -1
- package/iframe/sandbox-eblock.js +1 -1
- package/iframe/sandbox.js +1 -1
- package/package.json +2 -2
- package/plugin.html +1 -1
- package/plugin_blocks_test.html +1 -1
- package/plugin_default.html +1 -1
- package/plugin_s.html +1 -1
- package/react/index.d.ts +2 -2
- package/react/index.jsx +2 -2
- package/static/js/1795.d703cd5e.js +1 -0
- package/static/js/2256.64e6bc89.js +1 -0
- package/static/js/{5571.4464f3b4.js → 5571.285b4a70.js} +1 -1
- package/static/js/{5957.4f68d3d9.js → 5957.d2ad88af.js} +2 -2
- package/static/js/698.bb8e8eef.js +1 -0
- package/static/js/7400.23d7a885.js +1 -0
- package/translations.pot +83 -67
- package/useblocks-esm.js +1 -1
- package/useblocks.d.ts +128 -139
- package/useblocks.js +1 -1
- package/emailmaker.d.ts +0 -571
- package/static/js/1795.a33323f4.js +0 -1
- package/static/js/2256.89c1e152.js +0 -1
- package/static/js/698.6b8840b5.js +0 -1
- package/static/js/7400.beb54415.js +0 -1
- /package/static/js/{5957.4f68d3d9.js.LICENSE.txt → 5957.d2ad88af.js.LICENSE.txt} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunkemail_maker=globalThis.webpackChunkemail_maker||[]).push([[1795],{13329:(e,t,i)=>{i.d(t,{D3:()=>u,RS:()=>l});var n=i(45934),s=i(92810),o=i(41664),a=i(23397),r=i(23580),c=i(95152);const d=(0,o.Q)();function l(e,t,i){e instanceof c.m||(e=(0,r.My)(e));e.getOrCreateInstance(d,(()=>new a.v)).fire({id:t,payload:i})}const u=(e,t)=>{const i=function(e,t){return(0,r.My)(e).getOrCreateInstance(d,(()=>new a.v)).addEventListener}((0,n.Pj)());(0,s.useEffect)((()=>{const n=i((({id:i,payload:n})=>{i===e&&t(n)}));return()=>n.dispose()}),[i,e,t])}},95152:(e,t,i)=>{i.d(t,{m:()=>a});var n=i(23397),s=i(77509);function o(e){return`service_container_${e}`}class a extends s.j{constructor(e){super(),this._parent=e,this._injections=Object.create(null),this._emitter=this.addDisposable(new n.v)}inject(e,t,i){if("function"===typeof t){let n=this._injections[e],s="function"===typeof n?n():n;const o=this._injections[e]=()=>(s=t(this,s),s);i&&o()}else this._injections[e]=()=>t;this._emitter.fire(e)}_find(e){var t;return this._injections[e]||(null===(t=this._parent)||void 0===t?void 0:t._find(e))}_onInject(e,t,i=new s.j){return i.addDisposable(this._emitter.addEventListener((n=>{e===n&&(i.dispose(),t(this.getInstance(n)))}))),this._parent&&i.addDisposable(this._parent._onInject(e,t,i)),this.addDisposable(i),i}getInstance(e){const t=this._find(e);if("function"===typeof t)return t()}getOrCreateInstance(e,t){const i=this._find(e);if("function"===typeof i)return i();{const i=t(this);return this.inject(e,i),i}}getInstanceAsync(e){const t=this._find(e);return"function"===typeof t?Promise.resolve(t()):new Promise((t=>this._onInject(e,(()=>t(this.getInstance(e))))))}addService(e,t){const i=o(e);this.inject(i,((e,i=[])=>i.indexOf(t)<0?[...i,t]:i));const n=new s.j;return n.addDispose((()=>{this.inject(i,((e,i=[])=>i.filter((e=>e!==t))))})),n}getServices(e){var t;const i=o(e);return[...this.getInstance(i)||[],...(null===(t=this._parent)||void 0===t?void 0:t.getServices(e))||[]]}createChild(){return new a(this)}dispose(){this._injections=Object.create(null)}}},23397:(e,t,i)=>{i.d(t,{v:()=>s});var n=i(77509);class s extends n.j{constructor(e){super(),this._options=e,this._listeners=[],this.fire=e=>{if(!this.isDisposed()){let t;const i=this._listeners;for(const n of i){if(!1===t)return!1;t=t instanceof Promise?t.then((e=>!1!==e&&!this.isDisposed()&&n(e))).catch((e=>console.log(e))):n(e)}return t}},this.addEventListener=e=>{const t=this._listeners;var i;(t.push(e),1===t.length)&&((null===(i=this._options)||void 0===i?void 0:i.onFirstListenerAdd)&&this._options.onFirstListenerAdd());return{dispose:()=>{const i=t.indexOf(e);var n;i>=0&&(t.splice(i),t.length||(null===(n=this._options)||void 0===n?void 0:n.onFirstListenerAdd)&&this._options.onLastListenerRemove())}}},this.event=this.addEventListener}}let o;!function(e){function t(e){let t;const i=new s({onFirstListenerAdd(){t=e(i.fire)},onLastListenerRemove(){t.dispose()}});return i.event}e.snapshot=t,e.filter=function(e,i){return t((t=>e((e=>i(e)&&t(e)))))},e.map=function(e,i){return t((t=>e((e=>t(i(e))))))}}(o||(o={}))},93982:(e,t,i)=>{i.d(t,{Zc:()=>d,_q:()=>l,cZ:()=>r,dB:()=>c,ml:()=>u});var n=i(45934),s=i(41664),o=i(23580),a=i(55654);function r(e){return(0,s.Q)(e)}function c(e,t){return(0,o.My)(e).getOrCreateInstance(t,(()=>new a.lt))}function d(e,t){return(0,o.My)(e).getOrCreateInstance(t,(()=>new a.lt)).event}function l(e){return u(e).event}function u(e){return c((0,n.Pj)(),e)}},32269:(e,t,i)=>{i.d(t,{Cb:()=>W,Cl:()=>m,DI:()=>L,Dx:()=>D,EU:()=>B,HT:()=>$,Hy:()=>X,Id:()=>h,Np:()=>T,Qi:()=>z,Tr:()=>G,X7:()=>F,XZ:()=>x,Yq:()=>v,Z1:()=>H,_9:()=>U,_q:()=>Z,au:()=>k,d_:()=>P,el:()=>S,ez:()=>E,fq:()=>g,gq:()=>O,i0:()=>N,iV:()=>R,jG:()=>d.j,p6:()=>C,sh:()=>V,vl:()=>l.v,wB:()=>I});var n=i(74267),s=i(92810),o=i(85163),a=i(1741),r=i.n(a),c=i(45695),d=i(77509),l=i(23397),u=i(71210),p=i(70082);const h=e=>{Object.keys(o.A9).forEach((t=>{"onboarding_success"!==e.get(o.A9[t])&&e.remove(o.A9[t])}))};function m(e){const t=(0,n.A)(e);return isNaN(t)?new Date(e):t}const v=(e,t,i=!1)=>{Date;const n=new Date,s=e.getDate()===n.getDate()&&e.getMonth()===n.getMonth()&&e.getFullYear()===n.getFullYear();if(i&&s){const i=Math.floor((n-e)/1e3),s=Math.floor(i/60),o=Math.floor(s/60);if(i<60)return t("Just now");if(o>0){const e=s%60;return`${o} ${t("hour","hours",o)} ${e} ${t("minute","minutes",e)}`}return`${s} ${t("minute","minutes",s)}`}{const t=new Intl.DateTimeFormat(navigator.language,{dateStyle:"short"}),i=new Intl.DateTimeFormat(navigator.language,{timeStyle:"short"});return t.format(e)+" "+i.format(e)}},g=e=>{const t=e.match(/(\(copy\))( \d+)?$/),i=null===t||void 0===t?void 0:t[1],n=null===t||void 0===t?void 0:t[2];return i?n?`${e.slice(0,-n.length)} ${+n.slice(1)+1}`:`${e} 2`:`${e} (copy)`};function f(e,t,i){const n=new Map,s=new RegExp(`(${t})(.*?)(${i})`,"gis");return e=e.replaceAll(s,((e,t,i,s)=>{const o=(0,u.l)();return n.set(o,i),t+o+s})),{escapes:n,html:e}}function _(e,t){let i=[];for(const[n,s]of t){const{escapes:t,html:o}=f(e,n,s);e=o,i.push([n,s,t])}return{escapes:i,html:e}}function y(e,t,i,n){const s=new RegExp(`(${t})(.*?)(${i})`,"gis");return e.replaceAll(s,((e,t,i,s)=>{const o=n.get(i);return"string"===typeof o?t+o+s:e}))}const w=/<title>(.*)<\/title>/gm,S=(e,t)=>{let{escapes:i,html:n}=_(e,[["<style.*?>","<\\/style>"],["<script.*?>","<\\/script>"],["<\\!--","--\x3e"]]);return n=n.replaceAll(w,((e,i)=>i===t?`<title>${g(i)}</title>`:e)),function(e,t){for(const[i,n,s]of t)e=y(e,i,n,s);return e}(n,i.reverse())};function E(e){let{html:t}=_(e,[["<style.*?>","<\\/style>"],["<script.*?>","<\\/script>"],["<\\!--","--\x3e"]]);return[...t.matchAll(w)].map((e=>e[1])).find((e=>!!e))}const b="bottomRight",C=(e,t,i=b)=>{var n,s,o,a;t.error({innerException:e.error instanceof Error?e.error:void 0,message:(0,p.jsx)("div",{dangerouslySetInnerHTML:{__html:(null===(n=e.error)||void 0===n||null===(s=n.data)||void 0===s?void 0:s.code)||(null===(o=e.error)||void 0===o?void 0:o.status)||e.error}}),description:(0,p.jsx)("div",{dangerouslySetInnerHTML:{__html:(null===(a=e.error.data)||void 0===a?void 0:a.message)||e.error.error}}),placement:i})},I=(e,t,i=b)=>{t.success({message:e,placement:i})},A="ascend",j="descend",M="desc",O=e=>{switch(e){case A:return"asc";case j:return M;default:return""}},T=e=>{switch(e){case"asc":return A;case M:return j;default:return""}},D=e=>{const t=document.createElement("div");return t.className=e||"resizer",t},k=/[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/,L=e=>new Promise(((t,i)=>{let n=new Image;n.src=e,n.addEventListener("load",(()=>{t("success")})),n.addEventListener("error",(()=>{i("error")})),n=null})),B=(e,t)=>{for(const i of t)"object"===typeof e.properties&&(e=e.properties[i]);return e},P=e=>e instanceof Array?e.map((e=>({label:e,value:e}))):Object.keys(e).map((t=>({label:e[t],value:t}))),N=(e,t,i=!0)=>{const n=Object.keys(t);for(const s of n){const n=t[s];void 0!==n&&null!==n&&(e[s]=i&&"object"===typeof n?N(e[s]||{},n,!0):n)}return e},R=e=>new Promise(((t,i)=>{r().load({google:{families:[e]},classes:!1,active:t,inactive:i})})),x=(e,t)=>{t&&e(t)},U=()=>{const e=(0,c.XW)();return(0,s.useCallback)(((t,i)=>{document.querySelectorAll(".block-search__preview").forEach((e=>e.remove()));const n=document.getElementById("iframe-scroll-top"),s=document.getElementById("iframe-scroll-bottom"),a=document.getElementById("email_iframe"),r=document.body.getBoundingClientRect().height,c=a.getClientRects()[0];c.top<0&&(n.style.display="block"),c.top+c.height>r&&(s.style.display="block");const d={operation:o.Ru.SANDBOX_BLOCK_INSERT,settings:{blockHTML:i||null,targetBlock:null,project:"useblocks"}};t.dataTransfer.setData("Text",JSON.stringify(d)),e(d)}),[e])},z=()=>{const e=(0,c.XW)();return(0,s.useCallback)(((t,i,n)=>{const s=document.getElementById("iframe-scroll-top"),a=document.getElementById("iframe-scroll-bottom"),r=document.getElementById("email_iframe"),c=document.body.getBoundingClientRect().height,d=r.getClientRects()[0];d.top<0&&(s.style.display="block"),d.top+d.height>c&&(a.style.display="block");const l={operation:o.Ru.SANDBOX_ATOM_INSERT,settings:{atomHTML:i.html||null,targetBlock:null}};n(i)&&t.dataTransfer.setData("Text",JSON.stringify(l)),e(l)}),[e])},V=()=>{const e=(0,c.XW)();return(0,s.useCallback)(((t,i)=>{e({operation:o.Ru.SANDBOX_BLOCK_INSERT,action:"insert",settings:{blockHTML:i}})}),[e])},F=()=>{const e=(0,c.XW)();return(0,s.useCallback)(((t,i)=>{e({operation:o.Ru.SANDBOX_ATOM_INSERT,action:"insert",settings:{atomHTML:i}})}),[e])},H=(e,t)=>{t.success({maskClosable:!0,centered:!0,title:e("Coming soon"),content:e("The feature is under development."),okText:e("Ok. I'll be waiting"),onOk:()=>{}})},W=()=>{const e=(0,c.XW)();return(t,i)=>{e({operation:o.Ru.SANDBOX_ELEMENT_SETTINGS_SET,settings:t,type:i})}},Z=(e,t="")=>{var i,n;const s=[];return null===(i=e._embedded)||void 0===i||null===(n=i["wp:term"])||void 0===n||n.filter((e=>{var i;return!!e.length&&(!t||(null===(i=e[0])||void 0===i?void 0:i.taxonomy)===t)})).forEach((e=>{const t=e[0].taxonomy;s[t]||(s[t]=[]),s[t]=e.map((e=>({id:e.id,name:e.name,children:e.children}))),s[s.length]=s[t]})),""!==t&&s.length?s[t]:s},$=(e,t="")=>{var i,n,s,o,a;return(null===(i=e._embedded)||void 0===i||null===(n=i["wp:term"])||void 0===n||null===(s=n.find((e=>{var i;return!!e.length&&(!t||(null===(i=e[0])||void 0===i?void 0:i.taxonomy)===t)})))||void 0===s||null===(o=s.find((e=>{var t;return null===e||void 0===e||null===(t=e.name)||void 0===t?void 0:t.startsWith("project_")})))||void 0===o||null===(a=o.children)||void 0===a?void 0:a.map((e=>({id:e.id,name:e.name,count:e.count}))))||null},X=(e,t)=>{const i=e.target,n=t.getBoundingClientRect().height,s=i.getBoundingClientRect().height-n,o=e.clientY-t.getBoundingClientRect().top-30,a=-s*(Math.min(Math.max(o,0),n-60)/(n-60));i.style.transform=`translateY(${a}px)`},G=({target:e})=>{e.style.transform="translateY(0)"}},20116:(e,t,i)=>{function n(e){return t=>{const i=t.query,n=t.queryFn||((e,t,n,s)=>s(i(e)));n&&(t.query=void 0,t.queryFn=async(t,i,s,o)=>{try{let a=await e(t);return"function"===typeof a&&(a=await a((async(e,t=i,a=s,r=o)=>{const c=await n(e,t,a,r);if(c.error)throw c.error;return c.data}))),{data:a,error:null}}catch(a){return{error:a}}})}}function s(){return n((()=>{}))}function o(e,t){const i={},s=Object.keys(t);for(const o of s)i[o]=n(t[o]);e.enhanceEndpoints({endpoints:i})}function a(e,t){for(const i of Object.keys(t))t[i](e)}i.d(t,{BD:()=>a,BX:()=>o,nM:()=>n,pl:()=>s})},98589:(e,t,i)=>{function n(e,t){if(e===t)return!0;if("object"===typeof e&&e&&"object"===typeof t&&t){const i=Object.keys(e),s=Object.keys(t);if(i.length!==s.length)return!1;for(const o of i)if(!n(e[o],t[o]))return!1;return!0}return!1}function s(e,t){if(!e)return t;const i={};for(const s of Object.keys(t))n(t[s],e[s])||(i[s]=t[s]);return i}i.d(t,{g:()=>s})},91738:(e,t,i)=>{i.d(t,{AU:()=>l});var n=i(90854),s=i(58689),o=i(44824),a=i(85974),r=i(91391);const c=e=>function(e){var t;return function(e){return"___SCRIPT"===e.tagName}(e)&&(null===(t=e.src)||void 0===t?void 0:t.startsWith(r.gP))}(e)||(0,a.Nh)(e)||(0,n.BF)(e),d=e=>{if(c(e))return!0;if((0,n.vq)(e)||(0,n.wz)(e))for(const t of e.querySelectorAll("*"))if(c(t))return!0;return!1};async function l(e,t){"string"===typeof e&&(e={code:e});const i=e.code?await(0,s.PJ)(e.code||"",[s.qy],e.utm_parameters,(async e=>{void 0===t&&(t=d(e)),t&&await(0,o.e)(e,"html")})):"",n=e.code&&t?await(0,s.PJ)(e.code||"",[s.qy],e.utm_parameters,(async e=>{await(0,o.e)(e,"amp")})):"";return{...e,compiled:{html:i,ampHtml:n}}}},91366:(e,t,i)=>{i.d(t,{Qq:()=>v,PL:()=>f,KA:()=>g,wz:()=>_});var n=i(33288),s=i(41664),o=i(15230),a=i(32269),r=i(55654);class c extends r.IO{async execute([e],t){for(const i of t){const t=await i(e);t&&(void 0===t.id&&(t.id=e.value.id),e.value=t)}return e.value}}var d=i(98589);class l extends r.lt{}var u=i(56991);class p extends a.jG{constructor(...e){super(...e),this._items=new Map,this._onChangeEmitter=new r.HN,this.onChange=this._onChangeEmitter.event}async _getOrCreate(e,t){const i=this._items;let n;if(i.has(e))try{n=await i.get(e)}catch{t&&(n=await t())}else t&&(n=await t(),n&&this._onChangeEmitter.fire());return n}async _addOrUpdate(e,t){let i;const n=this._items;if(n.has(e))try{i=await n.get(e)}catch{}const s=await t(i);return(0,u.bD)(i,s)||this._onChangeEmitter.fire(),s}entries(){return Promise.all([...this._items.entries()].map((([e,t])=>t.then((t=>[e,t]))))).then((e=>e.filter((([e,t])=>!!t))))}values(){return Promise.all([...this._items.values()].map((e=>e)).filter((e=>!!e)))}getOrCreate(e,t){let i=this._getOrCreate(e,(()=>t(e)));return this._items.set(e,i),i}addOrUpdate(e,t){let i=this._addOrUpdate(e,t);return this._items.set(e,i),i}add(e,t){const i=Promise.resolve(t);return this._items.set(e,i),i}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=[],i=new Set(Array.from(e).map((([e,t])=>e))),n=(await this.entries()).filter((([e,t])=>!i.has(e)));for(const[s,o]of e)t.push(this.addOrUpdate(s,(()=>o))),i.add(s);for(const[e]of n)t.push(this.remove(e));return await Promise.all(t),n}finally{this.resumeChange()}}clear(){this._items.clear(),this._onChangeEmitter.fire()}suspendChange(){this._onChangeEmitter.suspend()}resumeChange(){this._onChangeEmitter.resume()}}var h=i(71210);class m extends a.jG{constructor(...e){super(...e),this._cache=new p,this._readEmitter=new r.lt,this._saveEmitter=this.addDisposable(new c),this._removeEmitter=this.addDisposable(new l),this._foreignCache=Object.create(null),this.handlerRead=this._readEmitter.event,this.onSave=this._saveEmitter.event,this.onRemove=this._removeEmitter.event,this.onChange=this._cache.onChange}async get(e){return this._cache.getOrCreate(e,(async t=>Object.assign({id:e},...(await this._readEmitter.fire(e)).filter((e=>!!e)))))}get cache(){return this._cache}byForeignKey(e){let t=this._foreignCache[e];if(!t){const i=this.addDisposable(new a.jG);i.addDispose((()=>delete this._foreignCache[e]));const n=i.addDisposable(new p),s=i.addDisposable(new r.lt);t=this._foreignCache[e]={get:async(t,i={})=>(await n.getOrCreate(t,(async()=>{try{const i=function(e=[]){if((e=e.filter((e=>e))).length<=1)return e[0];let t=new Map;for(const i of e)for(const e of i)if(void 0!==e.id){let i=t.get(e.id)||{};t.set(e.id,{...i,...e})}return[...t].map((([e,t])=>t))}(await s.fire(t))||[];for(const n of i)n[e]=t,await this._cache.add(n.id,n);return i}catch{return[]}})),function(e,{filter:t,order:i="asc",orderBy:n,page:s,pageSize:o=20}={}){const a=e.length;let r=e.length;if(void 0!==t){const i=Object.keys(t);r=(e=e.filter((e=>{for(const n of i){const i=e[n],s=t[n];return"id"===n||"string"!==typeof i?i===s:"string"===typeof s&&i.startsWith(s)}return!0}))).length}return n&&(e=e.sort(((e,t)=>(e[n]>t[n]?1:t[n]>e[n]?-1:0)*("asc"===i?1:-1)))),void 0!==s&&(e=e.slice(o*(s-1),o*s-1)),{data:e,filteredTotal:r,total:a,totalPages:Math.floor(a/o)}}(await this._cache.values()||[],i)),first:(e,i={})=>t.get(e,{...i,page:1,pageSize:1}).then((e=>e[0])),handleRead:s.event,clear(){n.clear()},dispose(){i.dispose()}}}return t}async create(e,{source:t="",silent:i}={}){let n=e;return i||(n=await this._saveEmitter.fire({prev:void 0,patch:e,value:n,source:t})),void 0===n.id&&(n.id=(0,h.l)()),await this._cache.addOrUpdate(n.id,(()=>n))}async update(e,t,{source:i="",silent:n}={}){return this._cache.addOrUpdate(e,(async e=>{let s=e?{...e,...t}:t;if(!n)return t=e?(0,d.g)(e,t):t,await this._saveEmitter.fire({prev:e,patch:t,value:s,source:i})}))}async remove(e,{source:t="",silent:i}={}){const n=await this._cache.remove(e);return i||await this._removeEmitter.fire({value:n,source:t}),n}refresh(){this._cache.clear();for(const e of Object.values(this._foreignCache))e.clear()}suspendChange(){this._cache.suspendChange()}resumeChange(){this._cache.resumeChange()}}i(18398);function v(){const e=(0,s.Q)();return t=>n.di.getOrCreateInstance(t,e,(()=>new m))}function g(e){const t=n.di.getInstance(e,o.ax);if(!t)throw new Error("Failed");return t}function f(e){const t=n.di.getInstance(e,o.Lz);if(!t)throw new Error("Failed");return t}function _(e){return g(e).getState().userSlice.currentUser}},13437:(e,t,i)=>{i.d(t,{A:()=>a,i:()=>o});var n=i(71210),s=i(814);function o({code:e,...t},i){var s,o;const a=i.getState();return{...t,...e?{html:e}:{},renderGuid:(0,n.l)(),project:null===(s=a.projectSlice)||void 0===s||null===(o=s.project)||void 0===o?void 0:o.id}}function a({html:e,renderGuid:t,...i},n){const o=n.getState(),{project:a}=o.configSlice;return(0,s.TB)({...i,code:e,project:void 0===a?i.project:a,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})}},91253:(e,t,i)=>{i.d(t,{I:()=>o,y:()=>s});var n=i(814);function s(e,t,i){const n=t.getState();var s,o;void 0===i&&(i=void 0===e.post?null===(s=n.emailSlice)||void 0===s||null===(o=s.email)||void 0===o?void 0:o.id:e.post);return{...e,content:e.content?`<p>${e.content}</p>`:"",post:i}}function o(e,t){return(0,n.TB)({...e,link:void 0,comment_status:void 0})}},81304:(e,t,i)=>{i.d(t,{E:()=>a,I:()=>o});var n=i(71210),s=i(814);function o({code:e,...t},i){var s,o;const a=i.getState();return{...t,...e?{html:e}:{},renderGuid:(0,n.l)(),project:null===(s=a.projectSlice)||void 0===s||null===(o=s.project)||void 0===o?void 0:o.id,utm_parameters:t.utm_parameters||{},_embedded:void 0}}function a({html:e,renderGuid:t,...i},n){const o=n.getState(),{project:a,config:r}=o.configSlice;return(0,s.TB)({...i,code:e,project:void 0===a?i.project:a,utm_parameters:r.UTMEnabled?i.utm_parameters:void 0,tags:void 0,template:void 0,guid:void 0,emailtags:void 0,project_title:void 0,project_author:void 0,is_template:void 0,is_inited:void 0,compiled:(0,s.TB)({html:e,ampHtml:e&&""})})}},4453:(e,t,i)=>{i.d(t,{E:()=>o,_:()=>s});var n=i(814);function s({code:e,...t},i,n){const s=i.getState();var o,a;void 0===n&&(n=void 0===t.parent?null===(o=s.emailSlice)||void 0===o||null===(a=o.email)||void 0===a?void 0:a.id:t.parent);return{...t,...e?{html:e}:{},parent:n}}function o({html:e,...t},i){return(0,n.TB)({...t,code:e,guid:void 0,compiled:(0,n.TB)({html:e,ampHtml:e&&""})})}},23036:(e,t,i)=>{i.d(t,{Xy:()=>a,bg:()=>c,yc:()=>r});var n=i(20116),s=i(55701),o=i(91366);const a=(0,o.Qq)(),r=(0,o.Qq)();function c(e){const t=a(e),i=t.byForeignKey("project"),c=r(e),d=c.byForeignKey("parent"),{dispatch:l,getState:u}=(0,o.KA)(e),p=(0,o.PL)(e);p.addDisposable(t.onChange((()=>l(s.VM.util.invalidateTags(["Blocks"]))))),p.addDisposable(t.onSave((({prev:e,patch:t,value:i})=>{(e=e?{...e,...t}:t)&&i.html===e.html&&i.title===e.title&&(i.renderGuid=e.renderGuid)}),Number.MIN_VALUE)),(0,n.BX)(s.VM,{async getBlocks(e){const t={};e.name&&(t.title=e.name),e.type&&(t.type=e.type);return await i.get(e.projectId,{filter:t,page:e.page,pageSize:e.pageSize,order:e.order,orderBy:e.orderby}).then((({data:e})=>e))},getBlocksSchema:()=>e=>e({}),getParentEmailBlocks:e=>t=>t(e),getTemplateBlocks:e=>t=>t(e),async getBlock(e){const t=u().projectSlice.project.id;return i.first(t,{filter:{id:e}})},getBlockHistory:async({blockId:e,page:t=1})=>({...await d.get(e,{page:t}),args:{blockId:e,page:t}}),addBlock:e=>async i=>{const n=await t.create(e);return u().configSlice.config.preventSendDataToEM||i(n).catch((e=>console.log(e))),n},editBlock:({blockId:e,...i})=>t.update(e,i),deleteBlock:e=>t.remove("object"===typeof e?e.id:e),addTag:e=>e,getDeletableTag:([e,t])=>[],autoSaveBlock:({blockId:e,body:t})=>c.create({...t,parent:e})})}},72788:(e,t,i)=>{i.d(t,{B:()=>c,D:()=>r});var n=i(18777),s=i(91366),o=i(68415),a=i(20116);const r=(0,s.Qq)();function c(e){const t=r(e),i=t.byForeignKey("post"),{dispatch:c}=(0,s.KA)(e);(0,s.PL)(e).addDisposable(t.onChange((()=>c(n.Jg.util.invalidateTags(["Comments"]))))),(0,a.BX)(n.Jg,{getComments:e=>i.get(e).then((({data:e})=>e)),addComment({subjectId:e,author:i,parent:n,content:s,author_name:a,author_email:r,targetId:c}){const d={post:e,author:i,author_name:a,author_email:r,content:s,parent:n,target_id:c,date:(0,o.A)(new Date),author_avatar_urls:{}};return t.create(d)},deleteComment:e=>t.remove(e),editComment:({commentId:e,...i})=>t.update(e,i),deleteTarget:e=>t.update(e,{target_id:""})})}},87265:(e,t,i)=>{i.d(t,{Av:()=>r,jw:()=>c,sE:()=>d});var n=i(17581),s=i(91366),o=i(71210),a=i(20116);const r=(0,s.Qq)(),c=(0,s.Qq)();function d(e){const t=r(e),i=c(e),d=i.byForeignKey("parent"),{dispatch:l,getState:u}=(0,s.KA)(e),p=(0,s.PL)(e);p.addDisposable(t.onChange((async()=>{l(n.GY.util.invalidateTags(["Email"]))}))),p.addDisposable(i.onChange((()=>{l(n.GY.util.invalidateTags(["EmailAutosaves"]))}))),p.addDisposable(t.onSave((({prev:e,patch:t,value:i})=>{(e=e?{...e,...t}:t)&&i.subject===e.subject&&i.html===e.html&&i.preheader===e.preheader&&i.title===e.title&&(i.renderGuid=e.renderGuid)}),Number.MIN_VALUE)),(0,a.BX)(n.GY,{getEmails:e=>[],getTemplateEmails:e=>t=>t(e),getEmail:async e=>await t.get(e),getEmailHistory:({emailId:e,page:t=1})=>(d.clear(),async n=>{if(u().configSlice.config.revisionService){const s=await n({emailId:e,page:t});for(const e of s.data)i.cache.add(e.id,e);return s}return{...await d.get(e,{page:t}),args:{emailId:e,page:t}}}),async addEmail({source:e,...i}){const n=await t.create(i,{source:e});return n.renderGuid||(n.renderGuid=(0,o.l)()),n},editEmail:e=>async i=>{let{emailId:n,source:s,...o}=e;return u().configSlice.config.revisionService&&(o=await i(e)),t.update(n,o,{source:s})},deleteEmail:e=>t.remove("object"===typeof e?e.id:e),addTag:e=>e,getDeletableTag:([e,t])=>[],autoSaveEmail:({emailId:e,body:t})=>async n=>(u().configSlice.config.revisionService&&(t=await n({emailId:e,body:t})),await i.create({...t,parent:e,modified:(new Date).toString()}))})}},43347:(e,t,i)=>{i.d(t,{Ri:()=>u,uS:()=>p});var n=i(15230),s=i(63531),o=i(33288),a=i(55654),r=i(93982),c=i(13522),d=i(20116);const l="tmp",u=o.di.createIdentifier();o.di.createIdentifier();function p(e){const t=o.di.getInstance(e,n.Lz);if(!t)throw new Error("Something was wrong");const i=t.addDisposable(new a.lt);o.di.inject(e,u,i);const p=(0,r.dB)(e,c.A.ON_SEND_TESTEMAIL_ID),h=(0,r.dB)(e,c.A.ON_SEND_LIVEPREVIEW_ID);(0,d.BX)(s.yH,{uploadImage:t=>async s=>{const a=e.getState(),{project:r}=a.configSlice,c=t.folder===l?null:await i.fire({file:t.file,project:r}),d=c?c.find((e=>e)):null;return d?[{file_url:d,project:r}]:s({...t,user_id:String((await o.di.getInstanceAsync(e,n.sZ)).app_id)})},sendTestEmail:t=>async i=>{const s=e.getState(),{project:a}=s.configSlice;(await p.fire({project:a,email_id:t.email_id,subject:t.subject,email:t.email,html:t.html,from_name:t.from_name})).some((e=>!1===e))&&await i({...t,user_id:String((await o.di.getInstanceAsync(e,n.sZ)).app_id)})},async sendLivePreview(t){const i=e.getState(),{project:n}=i.configSlice;(await h.fire({project:n,id:t.email,subject:t.subject,html:t.content})).some((e=>!1===e))},sendShortLink:e=>t=>t(e)})}},14999:(e,t,i)=>{i.d(t,{A:()=>S});var n=i(20116),s=i(53200);var o=i(84612);var a=i(91366),r=i(39990);var c=i(15230),d=i(47036);var l=i(95679);var u=i(62689);var p=i(84568);var h=i(46312);var m=i(65119);var v=i(43347),g=i(83351);var f=i(23036),_=i(72788),y=i(94381);var w=i(87265);const S={addUserToProjectApiMock:function(){s.B.enhanceEndpoints({endpoints:{addUserToProject:(0,n.pl)()}})},AiApiMock:function(){(0,n.BX)(o.Zs,{sendMessage:({body:e})=>t=>t({body:e}),getDialog:e=>t=>t(e)})},authorizationApiMock:function(e){let t={id:"0",username:"",email:"",password:"",code_editor:{},theme:"light",locale:(0,a.wz)(e).locale,counters:{},avatar_urls:{},autosaves:!0};r.Q2.enhanceEndpoints({endpoints:{userRegistration:(0,n.pl)(),getSchema:(0,n.nM)((()=>e=>e({}))),getMe:(0,n.nM)((()=>t)),editMe:(0,n.nM)((e=>t={...t,...e})),getSubscriptions:(0,n.nM)((()=>[]))}})},blocksApiMock:f.bg,commentsApiMock:_.B,emailsApiMock:w.sE,emailRawApiMock:function(){(0,n.BX)(d.f,{getEmailRaw({emailId:e,secret_hash:t}){throw new Error(c.f5)}})},imageApiMock:function(){(0,n.BX)(l.CL,{sendAiImageRequest:function({body:e}){return t=>t({body:e})},getAiImage:e=>t=>t(e)})},localesApiMock:function(e){(0,n.BX)(y.Ad,{getLocale:async({id:e})=>t=>t({id:e}),getLocales:()=>async e=>e({})})},notificationsApiMock:function(){(0,n.BX)(u.vx,{getNotifications:e=>[],notificationShown({id:e,datetime:t}){throw new Error(c.f5)}})},projectsApiMock:function(e){let t;(0,n.BX)(p.Nq,{getProjects:(e={page:1})=>[],getProject:e=>i=>t||(t=i(e).then((t=>({...t,id:e})))),addProject(e){throw new Error},editProject:({projectId:e,...i})=>t=t.then((t=>({...t,...i,id:e}))),deleteProject(e){throw new Error}})},proxyApiMock:function(){(0,n.BX)(h.Z8,{getFile({url:e,tryFetch:t=!0,type:i}){throw new Error(c.f5)}})},recoverPasswordApiMock:function(){(0,n.BX)(m.yR,{resetPassword(e){throw new Error(c.f5)},setPassword(e){throw new Error(c.f5)},validateRecoverPasswordCode(e){throw new Error(c.f5)}})},saveFileApiMock:v.uS,tokenApiMock:function(){(0,n.BX)(g.OV,{tokenCreate:e=>t=>t(e),tokenValidate:()=>e=>e({})})}}},62410:(e,t,i)=>{i.d(t,{r:()=>_});var n=i(33288),s=i(14386),o=i(18398),a=i(47358),r=i(86286),c=i(39990),d=i(99751),l=i(15230),u=i(13652);var p=i(39217),h=i(32269),m=i(91366),v=i(93982),g=i(13522),f=i(48802);const _=(0,s.l)((e=>{const t=(0,m.PL)(e),i=(0,f.m)((0,v.Zc)(e,g.A.READ_LOCALE)),s=t.addDisposable(new f.U(i)),_=e.dispatch,y=n.di.getInstanceAsync(e,l.sZ).then((e=>(null===e||void 0===e?void 0:e.app_config)||{}),(e=>(console.log(e),{}))),w=(0,u.y)(),S=async(...t)=>{const i=Object.assign({},...t),{locale:n="en_US",theme:s,editor:d,codeModeDirection:l,...u}=i;if(d){const e=function(e){return{font_size:e.fontSize,font_family:e.fontFamily,tab_size:e.tabSize,word_wrap:e.wordWrap,minimap:e.minimap,insert_spaces:e.insertSpaces,indentSize:e.indentSize}}(d);await _((0,r.ww)(e))}if(void 0!==l&&("none"===l?_((0,a.N6)(!1)):(_((0,a.N6)(!0)),_((0,a.Uf)(l)))),"string"===typeof n){const t=(0,m.wz)(e);_(c.Q2.endpoints.editMe.initiate({...t,locale:n}))}"string"===typeof s&&_((0,r.Yl)(s)),_((0,o._R)(u))};let E;return{setOptions:w.decorate((async({config:i={},project:a,user:c,advancedConfigs:l={},handleReadLocale:u})=>{var m;s.setListener(u);let v=l[(null===i||void 0===i?void 0:i.mode)||"editor"]||(null===(m=(0,d.$)((null===i||void 0===i?void 0:i.mode)||"editor"))||void 0===m?void 0:m.config);if(v={...v,configSwither:i.configSwither||!1},await S(v,await y,i),_((0,o.bn)(String(a))),_((0,o.ee)(l)),E&&E.dispose(),E=new h.jG,c){let i={email:"",password:"",...c,id:"number"===typeof c.id?String(c.id):c.id};void 0===c.id&&delete i.id,_((0,r.gV)(i)),c.id&&t.addDisposable(n.di.addService(e,p.jY,{execute(e){e.headers.append("user_id",i.id)}}))}a&&t.addDisposable(n.di.addService(e,p.jY,{execute(e){e.headers.append("project_id",String(a))}}))})),instance:{setConfig:w.decorate((async e=>{var t;let i=null===(t=(0,d.$)((null===e||void 0===e?void 0:e.mode)||"editor"))||void 0===t?void 0:t.config;await S(i,await y,e)})),getConfig:()=>function(e){var t,i;const n=e.getState(),s=n[r.Ay.name],c=n[o.Ay.name],d=n[a.Ay.name];return{...c.config,theme:null===(t=s.currentUser)||void 0===t?void 0:t.theme,locale:null===(i=s.currentUser)||void 0===i?void 0:i.locale,codeModeDirection:d.isCodeMode?d.codeModeDirection:"none",editor:(l=s.monacoOptions,{fontSize:l.font_size,fontFamily:l.font_family,tabSize:l.tab_size,wordWrap:l.word_wrap,minimap:l.minimap,insertSpaces:l.insert_spaces,indentSize:l.indentSize})};var l}(e),updateConfig:w.decorate((e=>S(e))),handleReadLocale:i}}}))},33746:(e,t,i)=>{i.d(t,{F:()=>c});var n=i(44141),s=i(33288),o=i(15230),a=i(14386),r=i(39217);const c=(0,a.l)((e=>{let t=!0;return{setOptions(i){if(i.hasOwnProperty("baseUrl")){const n=s.di.getInstance(e,r.eT),o=n.getOptions(),a=(0,r.qT)(i.baseUrl);o.baseUrl!==a&&(n.setOptions({baseUrl:a}),t=!0)}if(t){const i=s.di.getInstance(e,n.Pz);s.di.inject(e,o.sZ,(async(e,t)=>t||i.app.app_init_create({}).then((({data:e})=>e))),!0),t=!0}}}}))},19209:(e,t,i)=>{i.d(t,{F:()=>p});var n=i(14386),s=i(14315),o=i(33288),a=i(41664),r=i(39217),c=i(13652),d=i(85163);const l=(0,a.Q)(),u=(0,a.Q)(),p=(0,n.l)((e=>({setOptions(t){const i=(0,c.y)(),n=(0,r.mg)(e);o.di.addService(e,r.jY,{execute:i.decorate((async i=>{if(t.jwtAuth){let a=o.di.getInstance(e,l),r=o.di.getInstance(e,u);if(!r&&!a){const i=await n.jwtAuth.token_create({body:t.jwtAuth,type:s.cM.Json});if(i.error)throw r=d.ff,o.di.inject(e,u,d.ff),new Error(d.ff);a=i.data.token,o.di.inject(e,l,a)}r||i.headers.append("authorization",`Bearer ${a}`)}}))})}})))},91514:(e,t,i)=>{i.d(t,{h:()=>d});var n=i(14386),s=i(41664),o=i(33288),a=i(39217),r=i(47271);const c=(0,s.Q)(),d=(0,n.l)((e=>{let t;return o.di.addService(e,a.jY,{execute:async i=>{if(t){const t=await o.di.getInstanceAsync(e,c);t&&i.headers.append("authorization",`Bearer ${t}`)}}}),{setOptions(i){t!==i.getAuthToken&&(t=i.getAuthToken,o.di.inject(e,c,void 0),o.di.inject(e,c,(async(e,i)=>{try{let e=await i;var n;return t?e&&1e3*(null===(n=(0,r.iU)(e))||void 0===n?void 0:n.exp)>function(){const e=new Date;return e.valueOf()-60*e.getTimezoneOffset()*1e3}()?e:await t(e):""}catch(s){return console.log(s),""}}),!0))}}}))},14386:(e,t,i)=>{function n(e){return async function(t){return{setOptions:()=>{},instance:{},dispose:()=>{},...await e(t)||{}}}}function s(e){return async t=>{const i={},n=[];for(const s of e)n.push(await s(t));for(const e of n)Object.assign(i,e.instance);return{instance:i,setOptions:e=>{const t=n.map((t=>t.setOptions(e)));return t.some((e=>e instanceof Promise))?Promise.all(t).then((()=>{})):void 0},dispose:()=>{for(const e of n)e.dispose()}}}}i.d(t,{E:()=>s,l:()=>n})},893:(e,t,i)=>{i.d(t,{m:()=>c});var n=i(17126),s=i(92810),o=i(45934),a=i(18398),r=i(70082);const c=({children:e})=>{const[t,i]=(0,s.useState)(),c=(0,o.d4)(a.p5);return(0,r.jsxs)("div",{className:"App blocks-app blocks-plugin",children:[c&&(0,r.jsx)("style",{dangerouslySetInnerHTML:{__html:c}}),(0,r.jsx)(n.fh.Provider,{value:t,children:e}),(0,r.jsx)("div",{ref:i,className:"blocks-modal-container"})]})}},97001:(e,t,i)=>{i.d(t,{P:()=>C});var n=i(32269),s=i(93556),o=i(23580),a=i(71210),r=i(56991),c=i(13329),d=i(28316),l=i(18398),u=i(13437),p=i(81304),h=i(4453),m=i(91253),v=i(33288),g=i(15230),f=i(13652),_=i(13522),y=i(93982),w=i(91738),S=i(17581),E=i(39217);const b="EXTERNAL";class C extends n.jG{constructor(e){super(),this._store=e,this._emailTemplateCache=Object.create(null),this._prevCommand=void 0,this._prevContent=void 0,this._dataSources=void 0,this._eventLock=void 0,this._queue=(0,f.y)(),this._model=void 0,this._currentEmail=void 0,this.show=this._queue.decorate(this._show,this),this.save=this._queue.decorate(this._save,this);const t=(0,o.My)(e);this._dataSources=(0,s.zC)(t),this._eventLock=(0,s.QQ)(t);const i=(0,y.Zc)(e,_.A.ON_MODEL_CHANGE),n=(0,y.Zc)(e,_.A.ON_EMAIL_CHANGED_ID);this.addDisposable(i((e=>{this._model=e}))),this.addDisposable(n((e=>{this._currentEmail=e}))),this.addDisposable(v.di.addService(e,E.jY,{execute:e=>{var t;null!==(t=this._currentEmail)&&void 0!==t&&t.id&&!this._currentEmail.isNew&&e.headers.append("email_id",this._currentEmail.id)}}))}async getProject(){const e=await v.di.getInstanceAsync(this._store,g.sZ);return null===e||void 0===e?void 0:e.project}async getTemplateEmail(e){e=String(e);let t=this._emailTemplateCache[e];if(!t){const i=await this._store.dispatch(S.GY.endpoints.getTemplateEmail.initiate(e));i.error?console.log(i.error):(t={...i.data,lock:!1,parent_email:e},delete t.id)}return t}async getBlocks(){const{cache:e}=this._dataSources.blocks,t=await this.getProject();return(await e.values()).filter((e=>e.project===t)).map((e=>(0,u.A)(e,this._store)))}async getComments(){const{cache:e}=this._dataSources.comments,t=await this.getEmail();return(await e.values()).filter((e=>e.post===t.id)).map((e=>(0,m.I)(e,this._store)))}async getEmailRevisions(){const{cache:e}=this._dataSources.emailRevisions,t=await this.getEmail();return(await e.values()).filter((e=>e.parent===t.id)).map((e=>(0,h.E)(e,this._store)))}async setBlocks(e=[]){const{cache:t}=this._dataSources.blocks;await t.setAll(e.filter((e=>void 0!==e.id)).map((e=>[e.id,(0,u.i)(e,this._store)])))}async setEmailRevisions(e=[],t){const{cache:i}=this._dataSources.emailRevisions,n=e.filter((e=>void 0!==e.id)).map((e=>[e.id,(0,h._)(e,this._store,t)]));await i.setAll(n)}async setComments(e=[],t){const{cache:i}=this._dataSources.comments,n=e.filter((e=>void 0!==e.id)).map((e=>[e.id,(0,m.y)(e,this._store,t)]));await i.setAll(n)}async getEmail(){const e=this._store.getState(),t=e.emailSlice.email.id?e.emailSlice.email:e.newEmailSlice.email,i=(0,p.E)({...t,html:this._model?this._model.getValue():t.html},this._store);return(0,w.AU)(i,t.isAmp)}async compileEmail(){const e=this._store.getState(),t=e.emailSlice.email.id?e.emailSlice.email:e.newEmailSlice.email,i=(0,p.E)({...t,html:this._model?this._model.getValue():t.html},this._store);return(0,w.AU)(i,t.isAmp)}async setEmail(e,t,i=!1){const n=this._dataSources.emails,s=n.cache,o=await this.getProject();e="string"===typeof e?{code:e}:{...e};let r=(0,p.I)(e,this._store);const c=r.id;let d=c;if(void 0!==c?r={...await n.get(c),...r,project:o}:(r={...r,project:o},d=(0,a.l)(),delete r.project),t){const e=await this.getTemplateEmail(String(t));e&&(r={...e,id:String(t),...r})}await s.setAll([[d,r]]),i&&this._runShowCommand({isNew:void 0===c,id:d,project:o})}_runShowCommand(e){const t={...e,type:"email"};this._prevCommand&&!(0,r.bD)(this._prevCommand,e)?(0,c.RS)(this._store,d._1,t):this._store.dispatch((0,l.Ir)(t)),this._prevCommand=e}async _show(e){try{if(this._eventLock.suspendChange(),e!==this._prevContent){this._prevContent=e;const{email:t,blocks:i,autosaves:n,comments:o,templateId:a}=(0,s.Uw)(e),r=[];r.push(this.setBlocks(i)),void 0!==t.id&&(r.push(this.setComments(o)),r.push(this.setEmailRevisions(n))),r.push(this.setEmail(t,Number(a),!0)),await Promise.all(r)}}catch(t){console.log(t)}finally{this._eventLock.resumeChange()}return new Promise((e=>{(0,y.Zc)(this._store,_.A.ON_EMAIL_INIT_ID)((()=>e()))}))}_save(){return new Promise((async e=>{const t=this._dataSources.emails,i=this.addDisposable(t.onSave((({value:t,source:n})=>{n===b&&(i.dispose(),e((0,p.E)(t,this._store)))}),Number.MIN_VALUE));(0,c.RS)(this._store,d.Kp,b)}))}}},44376:(e,t,i)=>{i.d(t,{y:()=>g});var n=i(23580),s=i(93556),o=i(81304),a=i(13437),r=i(91253),c=i(4453),d=i(32269),l=i(48802),u=i(13522),p=i(93982),h=i(18398),m=i(98589),v=i(55654);class g extends d.jG{constructor(e){super(),this._store=e,this._events=void 0,this._listenersUpdaters=void 0}_get(){const e=this._store,t=(0,n.My)(e),{blocks:i,emails:d,comments:g,emailRevisions:f}=(0,s.zC)(t),_=(0,p.Zc)(e,u.A.ON_SAVEBUTTON_CLICK_ID),y=(0,p.Zc)(e,u.A.ON_PREVIOUSBUTTON_CLICK_ID),w=(0,p.Zc)(e,u.A.ON_NEXTBUTTON_CLICK_ID),S=(0,p.Zc)(e,u.A.ON_EMAIL_INIT_ID),E=(0,p.Zc)(e,u.A.ON_EMAIL_CHANGED_ID),b=(0,p.Zc)(e,u.A.ON_CONTENT_CHANGED_ID),C=(0,p.Zc)(e,u.A.ON_SEND_TESTEMAIL_ID),I=(0,p.Zc)(e,u.A.ON_SEND_EMAIL_MODAL_ID),A=(0,p.Zc)(e,u.A.ON_EMAIL_CLONE_ID),j=(0,p.Zc)(e,u.A.ON_SHARE_ID),M=(0,p.Zc)(e,u.A.ON_SHOW_PREVIEW_ID),O=(0,p.Zc)(e,u.A.ON_SEND_LIVEPREVIEW_ID);return{handleReadEmail:(0,l.m)(d.handlerRead,(e=>e),(t=>t&&(0,o.I)(t,e))),handleSaveEmail:(0,l.m)(d.onSave,(function({prev:t,patch:i,value:n,source:s}){const a=t?(0,o.E)(t,e):void 0;return{prev:a,patch:(0,m.g)(a,(0,o.E)(i,e)),value:(0,o.E)(n,e),source:s}}),(t=>t?(0,o.I)(t,e):void 0)),handleRemoveEmail:(0,l.m)(d.onRemove,(({value:t,source:i})=>({value:(0,o.E)(t,e),source:i})),(()=>{})),handleReadBlocks:(0,l.m)(i.byForeignKey("project").handleRead,(t=>(0,h.jY)(e.getState())||String(t)),(t=>null===t||void 0===t?void 0:t.map((t=>(0,a.i)(t,e))))),handleSaveBlock:(0,l.m)(i.onSave,(function({prev:t,patch:i,value:n,source:s}){const o=t?(0,a.A)(t,e):void 0;return{prev:o,patch:(0,m.g)(o,(0,a.A)(i,e)),value:(0,a.A)(n,e),source:s}}),(t=>t?(0,a.i)(t,e):void 0)),handleRemoveBlock:(0,l.m)(i.onRemove,(({value:t,source:i})=>({value:(0,a.A)(t,e),source:i})),(()=>{})),handleReadComments:(0,l.m)(g.byForeignKey("post").handleRead,(e=>e),(t=>null===t||void 0===t?void 0:t.map((t=>(0,r.y)(t,e))))),handleSaveComment:(0,l.m)(g.onSave,(function({prev:t,patch:i,value:n,source:s}){const o=t?(0,r.I)(t,e):void 0;return{prev:o,patch:(0,m.g)(o,(0,r.I)(i,e)),value:(0,r.I)(n,e),source:s}}),(t=>t?(0,r.y)(t,e):void 0)),handleRemoveComment:(0,l.m)(g.onRemove,(({value:t,source:i})=>({value:(0,r.I)(t,e),source:i})),(()=>{})),handleReadEmailRevisions:(0,l.m)(f.byForeignKey("parent").handleRead,(e=>e),(t=>null===t||void 0===t?void 0:t.map((t=>(0,c._)(t,e))))),handleEmailAutosave:(0,l.m)(f.onSave,(function({prev:t,patch:i,value:n,source:s}){return{value:(0,c.E)(n,e),source:s}}),(t=>t?(0,c._)(t,e):void 0)),handleRemoveEmailAutoSave:(0,l.m)(f.onRemove,(({value:t,source:i})=>({value:(0,c.E)(t,e),source:i})),(()=>{})),handleEmailChanged:(0,l.m)((0,v.sg)(E,100),(t=>(0,o.E)(t,e))),handleEmailInit:(0,l.m)(S,(t=>(0,o.E)(t,e))),handlePreviousButtonClick:(0,l.m)(y,(t=>(0,o.E)(t,e))),handleNextButtonClick:(0,l.m)(w,(t=>(0,o.E)(t,e))),handleSaveButtonClick:(0,l.m)(_,(t=>(0,o.E)(t,e))),handleHtmlChanged:(0,l.m)((0,v.sg)(b,100)),handleTestEmailSend:(0,l.m)(C,(({html:e,...t})=>({...t,code:e,compiled:{html:e,ampHtml:""}}))),handleTestEmailModal:(0,l.m)(I,(t=>(0,o.E)(t,e))),handleCloneEmail:(0,l.m)(A,(t=>(0,o.E)(t,e))),handleShareEmail:(0,l.m)(j),handlePreviewEmail:(0,l.m)(M),handleLivePreviewEmail:(0,l.m)(O)}}get(){return this._events||(this._events=this._get())}setOptions(e={}){const t=this.get();let i=this._listenersUpdaters;if(!i){i=this._listenersUpdaters={};for(const e of Object.keys(t))i[e]=this.addDisposable(new l.U(t[e]))}for(const n of Object.keys(t))i[n].setListener(e[n])}}},93556:(e,t,i)=>{i.d(t,{QQ:()=>r,Uw:()=>c,zC:()=>a});var n=i(23036),s=i(72788),o=i(87265);function a(e){return{emails:(0,o.Av)(e),blocks:(0,n.Xy)(e),emailRevisions:(0,o.jw)(e),blocksRevision:(0,n.yc)(e),comments:(0,s.D)(e)}}function r(e){const t=Object.values(a(e));return{suspendChange(){t.forEach((e=>e.suspendChange()))},resumeChange(){t.forEach((e=>e.resumeChange()))}}}function c(e){return"string"===typeof e?{email:{code:e}}:function(e){return!e.hasOwnProperty("email")&&!e.hasOwnProperty("block")&&!e.hasOwnProperty("templateId")}(e)?{email:e}:{...e,email:"string"===typeof e.email?{code:e.email}:e.email||{}}}},8671:(e,t,i)=>{i.d(t,{e:()=>c});var n=i(14386),s=i(33288),o=i(15230),a=i(32269),r=i(48802);const c=(0,n.l)((e=>{const t=s.di.getInstance(e,o.Lz),i=t.addDisposable(new a.vl),n=(0,r.m)(i.event),c=t.addDisposable(new r.U(n));return{setOptions({handleDestroy:e}){c.setListener(e)},instance:{handleDestroy:n,destroy:()=>t.dispose()}}}))},63772:(e,t,i)=>{i.d(t,{Z:()=>c});var n=i(14386),s=i(43347),o=i(33288),a=i(48802),r=i(15230);const c=(0,n.l)((e=>{const t=o.di.getInstance(e,r.Lz),i=o.di.getInstance(e,s.Ri),n=(0,a.m)(i.event),c=t.addDisposable(new a.U(n));return{setOptions(e){c.setListener(e.handleLoadImage)},instance:{handleLoadImage:(0,a.m)(i.event)}}}))},55853:(e,t,i)=>{i.d(t,{E:()=>c});var n=i(14386),s=i(33288),o=i(15230),a=i(55654),r=i(48802);const c=(0,n.l)((e=>{const t=s.di.getInstance(e,o.Lz),i=t.addDisposable(new a.vl),n=s.di.getInstanceAsync(e,o.Cd);n.then((({instance:e})=>i.fire(e)));const c=(0,r.m)(i.event),d=t.addDisposable(new r.U(c));return{setOptions({handleLoad:e}){d.setListener(e)},instance:{handleLoad:c,reset:e=>n.then((({instance:t,setOptions:i})=>Promise.resolve(i(e)).then((()=>t))))},destroy:()=>t.dispose()}}))},1281:(e,t,i)=>{i.d(t,{Z:()=>g});var n=i(14386),s=i(33288),o=i(15230),a=i(48802),r=i(13329),c=i(28316),d=(i(92810),i(814)),l=i(70082);function u(e){return"string"===typeof e?e:e?(0,l.jsx)("div",{ref:t=>null===t||void 0===t?void 0:t.replaceWith(e)}):void 0}function p(e,t="success"){return"string"===typeof e&&(e={message:e}),(0,d.TB)({type:e.type||t,data:e.data,innerException:e.innerException,message:u(e.message),description:u(e.description),btn:u(e.btn),onClose:e.onClose,duration:e.duration,icon:u(e.icon),placement:e.placement,style:e.style,closeIcon:"boolean"===typeof e.closeIcon||"undefined"===typeof e.closeIcon?e.closeIcon:u(e.closeIcon),props:e.props,role:e.role})}var h=i(13522),m=i(55654),v=i(93982);const g=(0,n.l)((e=>{const t=s.di.getInstance(e,o.Lz),i=(0,v.Zc)(e,h.A.ON_NOTIFICATION),n=(0,m.pb)(i,(e=>"error"===e.type)),d=(0,m.pb)(i,(e=>"success"===e.type)),l=(0,a.m)(i,(e=>e),(e=>"string"===typeof e||"object"===typeof e?p(e):e)),u=(0,a.m)(n,(e=>e),(e=>"string"===typeof e||"object"===typeof e?p(e,"error"):e)),g=(0,a.m)(d,(e=>e),(e=>"string"===typeof e||"object"===typeof e?p(e):e)),f=t.addDisposable(new a.U(l)),_=t.addDisposable(new a.U(u)),y=t.addDisposable(new a.U(g));return{setOptions({handleNotify:e,handleSuccess:t,handleError:i}){f.setListener(e),_.setListener(i),y.setListener(t)},instance:{notify(t){(0,r.RS)(e,c.Sb,{placement:"bottomRight",...p(t)})},handleNotify:l,handleError:u,handleSuccess:g}}}))},89949:(e,t,i)=>{i.d(t,{R:()=>a});var n=i(92810),s=i(45934),o=i(39990);const a=({onLoad:e,children:t})=>{(0,n.useEffect)((()=>{e&&e()}),[e]);const i=(0,s.wA)();return(0,n.useMemo)((()=>i(o.Q2.endpoints.getMe.initiate({}))),[i]),t}},55654:(e,t,i)=>{i.d(t,{HN:()=>l,IO:()=>o,P9:()=>a,lt:()=>p,pb:()=>c,sg:()=>d,vl:()=>u});var n=i(32269);class s extends n.jG{constructor(...e){super(...e),this._listeners=[],this.event=this._addListener.bind(this)}getListeners(e){return this._listeners.flatMap((([t])=>"function"===typeof t?t:t.getListeners(e)))}hasListeners(){return this._listeners.length>0}_addListener(e,t=0,i){if(!this.isDisposed()){const n=this._listeners;i&&"function"===typeof e&&(e=e.bind(i));const s=n.findIndex((([e,i])=>t<i)),o=[e,t];return n.splice(s>=0?s:n.length,0,o),{dispose(){const e=n.indexOf(o);e>=0&&n.splice(e,1)}}}}dispose(){this._listeners.splice(0,this._listeners.length),super.dispose()}}class o extends s{constructor(...e){super(...e),this.fire=this._fire.bind(this)}execute(e,t){for(const n of t)try{n(...e)}catch(i){console.log(i)}}_fire(...e){if(!this.isDisposed())return this.execute(e,this.getListeners(e))||void 0}}function a(e,t=0){const i=new s;return i.addDisposable(e(i,t)),i.event}class r extends s{constructor(e){super(),this._filter=e}getListeners(e){return this._filter(...e)?super.getListeners(e):[]}}function c(e,t,i=0){const n=new r(t);return n.addDisposable(e(n,i)),n.event}function d(e,t=0,i=0){const n=new o;let s,a=0;return n.addDisposable(e(((...e)=>{s=e,a||(a=setTimeout((()=>{n.fire(...s),a=0}),t))}),i)),n.event}class l extends o{constructor(...e){super(...e),this._suspendCounter=0,this._wasFired=!1}proccessResult(){}execute([e],t){if(this._suspendCounter)this._wasFired=!0;else for(const n of t)try{n(e)}catch(i){console.log(i)}}suspend(){this._suspendCounter++}resume(){0===--this._suspendCounter&&(this._wasFired&&this.fire(),this._wasFired=!1)}}class u extends o{execute([e],t){for(const n of t)try{n(e)}catch(i){console.log(i)}}}class p extends o{async execute([e],t){const i=[];for(const n of t){const t=await n(e);i.push(t)}return i}}},48802:(e,t,i)=>{i.d(t,{U:()=>o,m:()=>a});var n=i(32269),s=i(55654);class o extends n.jG{constructor(e){super(),this._event=e,this._listener=void 0,this._disposeEvent=void 0}setListener(e){this._listener!==e&&(this._listener=e,this._disposeEvent&&this._disposeEvent(),this._disposeEvent=e?this._event(e):void 0)}dispose(){this._disposeEvent&&this._disposeEvent(),super.dispose()}}function a(e,t,i){const n=(0,s.P9)(e);return(e,s,o)=>{const a=n((async n=>{const s=t?t(n):n;o&&e.bind(o);const a=await e(s);return i?i(a):a}),s,o);return()=>a.dispose()}}},13652:(e,t,i)=>{i.d(t,{y:()=>n});const n=e=>{let t={current:Promise.resolve(),state:e,decorate:(e,i)=>(i&&(e=e.bind(i)),function(...i){const n=t.current.then((()=>e(...i)));return t.current=n.then((e=>{t.state=e}),(e=>{console.log(e)})),n})};return t}},18398:(e,t,i)=>{i.d(t,{Ay:()=>b,EV:()=>S,GH:()=>m,Ir:()=>v,Kj:()=>E,RP:()=>u,_R:()=>f,bn:()=>_,ee:()=>y,jY:()=>h,p5:()=>p,s0:()=>d,zg:()=>l});var n=i(90536),s=i(31770),o=i(99751);const a="configSlice",r=(0,s.ur)((0,o.$)("pro")),c=(0,n.createSlice)({name:a,initialState:{...r,initialMergeTags:void 0},reducers:{setPage:(e,t)=>{e.page=t.payload},setConfig:(e,t)=>{e.config={...r.config,...t.payload}},changeConfigMode:(e,t)=>{var i,n,s;const a=null!==(i=null===e||void 0===e||null===(n=e.advancedConfigs)||void 0===n?void 0:n[t.payload])&&void 0!==i?i:null===(s=(0,o.$)(t.payload))||void 0===s?void 0:s.config;if("simple"!==e.config.mode&&"simple"!==t.payload){const t={...e.config,...Object.fromEntries(Object.entries(a).filter((([e])=>o.i.includes(e))))};e.config=t}else e.config={...e.config,...(0,o.$)(t.payload).config}},setInitialMergeTags:(e,t)=>{e.initialMergeTags=t.payload},setMergeTags:(e,t)=>{e.config.mergeTags=t.payload},updateConfig:(e,t)=>{e.config={...e.config,...t.payload}},setProject:(e,t)=>{e.project=t.payload},setAdvancedConfigs:(e,t)=>{e.advancedConfigs=t.payload}},extraReducers:e=>{}}),d=e=>e[a].page,l=e=>e[a].config,u=e=>e[a].config.themes,p=e=>e[a].config.styles,h=e=>e[a].project,m=e=>e[a].config.mergeTags||e[a].initialMergeTags,{setPage:v,setConfig:g,updateConfig:f,setProject:_,setAdvancedConfigs:y,setMergeTags:w,changeConfigMode:S,setInitialMergeTags:E}=c.actions,b=c},47358:(e,t,i)=>{i.d(t,{Ay:()=>N,B:()=>j,Bp:()=>C,CS:()=>D,Ct:()=>T,Fk:()=>v,Fv:()=>L,N6:()=>E,NQ:()=>O,Oo:()=>h,PM:()=>m,Tn:()=>B,Uf:()=>y,V$:()=>P,Wm:()=>M,cL:()=>A,mi:()=>g,qf:()=>p,sy:()=>I,vc:()=>f,vs:()=>_,wW:()=>w,wr:()=>S,yy:()=>k});var n=i(90536),s=i(85163),o=i(31770),a=i(55701);const r=window.localStorage.getItem(s.V0.em_code_mode_settings),c=r&&JSON.parse(r),d=(0,o.ur)({activeModal:"",lastActiveSettingsTab:s.Bv,activeSettingsTab:s.Bv,isPanelHistoryCollapsed:!0,monacoHeight:0,isCodeMode:(null===c||void 0===c?void 0:c.isCodeMode)||s.EW.isPlugin,codeModeDirection:(null===c||void 0===c?void 0:c.codeModeDirection)||"left",emailWidth:"100%",emailViewType:s.Vp,mobileViewActive:{shutdown:!0,styles:!0},emailMaxWidthSize:425,propertiesPanelKey:s.WU,parentBlocks:[]}),l="emailPageSlice",u=(0,n.createSlice)({name:l,initialState:d,reducers:{openModal:(e,t)=>{e.activeModal=t.payload},closeModal:e=>{e.activeModal=""},setActiveSettingsTab:(e,t)=>{e.lastActiveSettingsTab=e.activeSettingsTab,e.activeSettingsTab=t.payload,t.payload!==s.Vv&&(e.isPanelHistoryCollapsed=!0)},resetToLastActiveSettingsTab:e=>{"Properties"===e.lastActiveSettingsTab?e.activeSettingsTab="Build":e.activeSettingsTab=e.lastActiveSettingsTab,e.lastActiveSettingsTab!==s.Vv&&(e.isPanelHistoryCollapsed=!0)},switchIsPanelHistoryCollapsed:(e,t)=>{e.isPanelHistoryCollapsed=t.payload||!e.isPanelHistoryCollapsed},setEmailWidth:(e,{payload:t})=>{e.emailWidth=t,e.emailViewType=t>e.emailMaxWidthSize||"100%"===t?s.Vp:s.ND,window.localStorage.setItem(s.V0.em_default_sizes,JSON.stringify(t))},setEmailMaxWidthSize:(e,{payload:t})=>{e.emailMaxWidthSize=t},setEmailViewType:(e,t)=>{e.emailViewType=t.payload},switchCodeMode:e=>{const t=!e.isCodeMode;e.isCodeMode=t,window.localStorage.setItem(s.V0.em_code_mode_settings,JSON.stringify({codeModeDirection:e.codeModeDirection,isCodeMode:t}))},setCodeMode:(e,t)=>{const i=t.payload;e.isCodeMode!==i&&(e.isCodeMode=i,window.localStorage.setItem(s.V0.em_code_mode_settings,JSON.stringify({codeModeDirection:e.codeModeDirection,isCodeMode:i})))},switchCodeModeDirection:(e,t)=>{e.codeModeDirection=t.payload,window.localStorage.setItem(s.V0.em_code_mode_settings,JSON.stringify({isCodeMode:e.isCodeMode,codeModeDirection:t.payload}))},setMobileViewActive:(e,t)=>{e.mobileViewActive=t.payload},setPropertiesPanelKey:(e,t)=>{e.propertiesPanelKey=t.payload},resetParentBlocks:e=>{e.parentBlocks=[]},setParentBlocks:(e,t)=>{e.parentBlocks=t.payload}},extraReducers:e=>{e.addMatcher(a.VM.endpoints.getParentEmailBlocks.matchFulfilled,((e,t)=>{e.parentBlocks=t.payload}))}}),{openModal:p,closeModal:h,setActiveSettingsTab:m,resetToLastActiveSettingsTab:v,switchIsPanelHistoryCollapsed:g,setEmailWidth:f,switchCodeMode:_,switchCodeModeDirection:y,setMobileViewActive:w,setEmailViewType:S,setCodeMode:E,setEmailMaxWidthSize:b,setPropertiesPanelKey:C,resetParentBlocks:I}=u.actions,A=e=>e[l].activeModal,j=e=>e[l].activeSettingsTab,M=e=>e[l].isPanelHistoryCollapsed,O=e=>e[l].emailWidth,T=e=>e[l].emailViewType,D=e=>e[l].mobileViewActive,k=e=>e[l].codeModeDirection,L=e=>e[l].isCodeMode,B=e=>e[l].propertiesPanelKey,P=e=>e[l].parentBlocks,N=u},86286:(e,t,i)=>{i.d(t,{Ay:()=>S,B:()=>g,B$:()=>w,C1:()=>f,Yl:()=>p,gV:()=>v,hZ:()=>y,ko:()=>h,ku:()=>u,ww:()=>d,yf:()=>_});var n=i(90536),s=i(39990),o=i(85163),a=i(32269);const r=(0,i(31770).ur)({currentUser:{},currentSchema:{},monacoOptions:o.rW,monacoDidMount:!1}),c="userSlice",d=(0,n.createAsyncThunk)("user/setMonacoOptions",(async(e,{getState:t})=>{const i=t()[c],n="string"===typeof e.font_family?`${e.font_family}, sans-serif`:void 0,s=void 0!==e.word_wrap?e.word_wrap?"on":"off":void 0;return n&&i.monacoOptions.fontFamily!==n&&await(0,a.iV)(e.font_family),{tabSize:e.tab_size,fontFamily:n,fontSize:e.font_size,wordWrap:s,insertSpaces:e.insert_spaces,minimap:{enabled:e.minimap}}})),l=(0,n.createSlice)({name:c,initialState:r,reducers:{setMonacoDidMount:(e,{payload:t})=>{e.monacoDidMount=t},setTheme:(e,{payload:t})=>{e.currentUser.theme=t},setUserLocale:(e,{payload:t})=>{e.currentUser.locale=t},setUserAutosaves:(e,{payload:t})=>{e.currentUser.autosaves=t},setUser:(e,{payload:t})=>{e.currentUser={...e.currentUser,...t}}},extraReducers:e=>{e.addCase(d.fulfilled,((e,t)=>{const i=t.payload;e.monacoOptions=(0,a.i0)({...e.monacoOptions},i)})),e.addMatcher(s.Q2.endpoints.editMe.matchFulfilled,((e,t)=>{e.currentUser=t.payload})),e.addMatcher(s.Q2.endpoints.getMe.matchFulfilled,((e,t)=>{e.currentUser=t.payload})),e.addMatcher(s.Q2.endpoints.getSchema.matchFulfilled,((e,t)=>{e.currentSchema=t.payload.schema}))}}),{setMonacoDidMount:u,setTheme:p,setUserLocale:h,setUserAutosaves:m,setUser:v}=l.actions,g=e=>{var t;return null===(t=e[c].currentUser)||void 0===t?void 0:t.locale},f=e=>e[c].currentUser,_=e=>e[c].currentSchema,y=e=>e[c].monacoOptions,w=e=>{var t;return 3891!==(null===(t=e[c].currentUser.subscription)||void 0===t?void 0:t.ID)},S=l},57964:()=>{}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunkemail_maker=globalThis.webpackChunkemail_maker||[]).push([[2256],{35069:(e,t,o)=>{o.d(t,{A:()=>S});var s=o(92810),a=o(12280),l=o(14852),i=o(43005),n=o(2018),r=o(7744),d=o(55039),c=o(81662),m=o(71157),u=o(66170),p=o(28372),h=o(45934),g=o(23287),x=o(64617),v=o(55701),f=o(84568),b=o(79154),_=o(47358),j=o(32269),y=o(56991),A=o(85163),k=o(70082);const S=({isModalVisible:e,htmlContent:t,projectId:o})=>{const{__:S}=(0,g.s9)(),w=(0,h.wA)(),[C]=a.A.useForm(),[I,E]=(0,s.useState)([]),[N,T]=(0,v.pP)(),{data:B}=(0,v.h1)(),L=(0,m.hN)(),R=(0,y.rD)(),[P,F]=(0,s.useState)([]),{data:M,refetch:D}=(0,x.KC)(),{refetch:z}=(0,v.SB)({projectId:o,pageSize:1e3,page:1,tags:null,name:null,type:null,notEmbed:!0,order:"asc",orderby:"title"}),O=`project_${o}`,H=M&&(0,j._q)(M,A.YY).find((e=>e.name===O)),V=(0,j._q)(M,A.YY)||[],q=null===V||void 0===V?void 0:V.map((e=>e.id)),[$,G]=(0,v.Gr)(),[X,U]=(0,f.OD)();(0,s.useEffect)((()=>{F((0,j._q)(M,A.YY).map((e=>({value:e.name}))))}),[M]),(0,s.useEffect)((()=>{if(B){const e=B.schema.properties.acf.properties.type.items.enum;let t=[];for(let o in e)t.push({label:S(A.jg[e[o]]),value:e[o]});E(t)}}),[B,S]);const W=()=>{C.validateFields().then((e=>{const s=e.tags;if((null===s||void 0===s?void 0:s.length)>10)return void L.error({id:"BLOCK_TOO_MANY_TAGS_ERROR",data:(0,m.x_)(e),message:S("Maximum 10 tags available."),placement:"bottomRight"});const a=a=>{const l=null===s||void 0===s?void 0:s.map((e=>{const t=null===V||void 0===V?void 0:V.find((t=>t.name===e));return t?t.id:$({name:e,parent:a}).then((({error:t,data:o})=>{var s,a;return 400===(null===t||void 0===t?void 0:t.status)?null===t||void 0===t||null===(s=t.data)||void 0===s||null===(a=s.data)||void 0===a?void 0:a.term_id:o?o.id:void(t&&L.fromError("TAG_CREATING_ERROR",e,t))}))})),i=(e,s=[])=>{N({title:e.title,project:o,html:t,type:e.type?e.type:"Other",blocktags:s.join(",")}).then((a=>{if(a.error)return L.error({id:"BLOCK_CREATING_ERROR",data:{title:e.title,html:t},innerException:a.error,message:(0,k.jsx)("div",{dangerouslySetInnerHTML:{__html:a.error.data.code}}),description:(0,k.jsx)("div",{dangerouslySetInnerHTML:{__html:a.error.data.message}}),placement:"bottomRight"}),C.resetFields(),void Y();C.resetFields(),Y();let l=new Set([...q,...s]);D(),X({projectId:o,blocktags:[...l].join(",")}).then((e=>{e.error&&L.error({message:(0,k.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.code}}),description:(0,k.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.message}}),placement:"bottomRight"}),L.success({id:"BLOCK_CREATING_SUCCESS",data:(0,m.x_)(a.data),message:S("The block \u201c")+a.data.title+S("\u201d was successfully created."),placement:"bottomRight"}),z()}))}))};l?Promise.all(l).then((t=>{i(e,t)})):i(e),document.querySelector(".blocks-search__blocks-wrapper")&&(document.querySelector(".blocks-search__blocks-wrapper").style.removeProperty("transition"),document.querySelector(".blocks-search__blocks-wrapper").style.opacity=0,document.querySelectorAll(".blocks-search__result-body").forEach((e=>e.style.removeProperty("height"))),setTimeout((()=>{document.querySelectorAll(".blocks-search__result-body").forEach((e=>{e.style.height=207*e.offsetHeight/640+"px"})),document.querySelector(".blocks-search__blocks-wrapper").style.transition="opacity 0.2s",document.querySelectorAll(".blocks-search__blocks-wrapper").forEach((e=>e.style.opacity=1))}),1500))};H?a(H.id):$({name:O}).then((async({data:e,error:t})=>{if(t)L.fromError("FOLDER_CREATING_ERROR",O,t);else{const{data:t,error:s}=await X({projectId:o,blocktags:e.id});s?L.fromError("BLOCK_CLONING_ERROR",(0,m.x_)(e),s):t&&a(t.blocktags&&t.blocktags[0])}})).catch((e=>console.error(e)))}))},Y=()=>{w((0,_.Oo)())};return(0,k.jsx)(l.A,{title:(0,k.jsxs)("div",{children:[(0,k.jsx)(u.A,{})," ",S("Add new block")]}),className:"blocks-modal",open:e,onOk:W,onCancel:Y,centered:!0,footer:[(0,k.jsxs)(i.Ay,{size:"large",type:"primary",loading:T.isLoading,onClick:W,children:[(0,k.jsx)(b.h,{className:"modal-new-block__icon-create"}),S("Create block")]},"submit")],children:(0,k.jsxs)(a.A,{form:C,layout:"vertical",name:"add_new_block_form",onFinish:W,initialValues:{title:"",type:"",tags:[]},autoComplete:"off",style:{padding:"10px 24px 0"},children:[(0,k.jsxs)(n.A,{gutter:16,children:[(0,k.jsxs)(r.A,{span:12,children:[" ",(0,k.jsx)(a.A.Item,{label:S("Block name"),name:"title",rules:[{required:!0,message:S("Please input block name")}],style:{marginBottom:15},children:(0,k.jsx)(d.A,{disabled:T.isLoading||G.isLoading||U.isLoading,size:"large",placeholder:S("Enter block name"),spellCheck:"false"})})]}),(0,k.jsx)(r.A,{span:12,children:(0,k.jsx)(a.A.Item,{label:S("Type"),name:"type",rules:[{required:!0,message:S("Please choose block type")}],style:{marginBottom:15},children:(0,k.jsx)(c.A,{disabled:T.isLoading||G.isLoading||U.isLoading,size:"large",placeholder:S("Choose block type"),options:I})})})]}),R.tagsEnabled&&(0,k.jsx)(a.A.Item,{label:S("Tags"),name:"tags",children:(0,k.jsx)(c.A,{size:"large",mode:"tags",placeholder:S("Add some tags"),tooltip:{title:S("Tags help you find the block in the list."),icon:(0,k.jsx)(p.A,{})},disabled:T.isLoading||G.isLoading||U.isLoading,options:P})})]})})}},28288:(e,t,o)=>{o.d(t,{A:()=>v});var s=o(92810),a=o(14852),l=o(69417),i=o(45934),n=o(64617),r=o(38883),d=o.n(r),c=o(23287),m=o(47358),u=o(85163),p=o(32269),h=o(90070),g=(o(55231),o(75855),o(47018)),x=o(70082);const v=({isModalVisible:e})=>{const{__:t}=(0,c.s9)(),o=(0,i.wA)(),r=(0,n.Zp)(),v=(0,h.p6)();let f=(0,n.zy)();const b=(0,s.useRef)(null);let _=[];return _.push({title:t("From scratch"),click:()=>{o((0,m.Oo)()),v.set(u.A9.em_new_email,6892),(0,p.XZ)(r,`${f.pathname}/new`)}}),_.push({title:"Template gallery",img:g,click:()=>{o((0,m.Oo)()),window.location="https://useblocks.io/templates/"}}),(0,x.jsx)(a.A,{title:t("Create new email"),open:e,onCancel:()=>{o((0,m.Oo)())},centered:!0,footer:!1,width:"inherit",className:"modal-new-email blocks-modal",children:(0,x.jsx)("div",{className:"modal-new-email__cards-grid",children:_&&_.map(((e,t)=>(0,x.jsx)(l.A,{className:"element-card element-card_new-email",hoverable:!0,cover:(0,x.jsx)(x.Fragment,{children:(0,x.jsx)("div",{ref:b,className:d()({"element-card__img-wrapper":e.img,"element-card__no-img":!e.img}),onClick:()=>null===e||void 0===e?void 0:e.click(),children:e.img&&(0,x.jsx)("img",{className:"element-card__img",alt:e.title,src:e.img,onMouseMove:e=>(0,p.Hy)(e,b.current),onMouseLeave:p.Tr})})}),children:(0,x.jsx)("div",{className:"element-card__title-wrapper",onClick:()=>null===e||void 0===e?void 0:e.click(),children:(0,x.jsx)("span",{className:"element-card__title",children:e.title})})},e.img+t)))})})}},92851:(e,t,o)=>{o.d(t,{A:()=>v});var s=o(92810),a=o(12280),l=o(14852),i=o(43005),n=o(55039),r=o(71157),d=o(45934),c=o(23287),m=o(84568),u=o(93563),p=o(64936),h=o(85163),g=o(32269),x=o(70082);const v=({project:e,parentFolderId:t=null,folderTaxonomy:o})=>{const{__:v,_x:f}=(0,c.s9)(),b=(0,d.wA)(),[_]=a.A.useForm(),j=(0,s.useRef)(null),y=(0,d.d4)(p.cL)===h.lx.ADD_NEW_FOLDER_MODAL,A=(0,r.hN)(),k=`project_${e.id}`,[S]=(0,m.OD)(),[w]=(0,u.f1)(),C=(0,s.useCallback)((()=>{_.resetFields(),setTimeout((()=>{var e;return null===(e=j.current)||void 0===e?void 0:e.focus({cursor:"start"})}),0)}),[_]);(0,s.useEffect)((()=>{y&&C()}),[y,C]);const I=()=>b((0,p.Oo)()),[E,N]=(0,u.Yb)(),[T,B]=(0,s.useState)(!1),[L,R]=(0,s.useState)(t),P=()=>{_.validateFields().then((({name:t})=>(B(!0),L?E({name:t,parent:L}).then((({data:e,error:t})=>{t?(0,g.p6)({error:t},A):(A.success({message:v("The folder \u201c")+e.name+f("\u201d was successfully created.","folder"),placement:"bottomRight"}),window.localStorage.setItem(h.V0.em_folder_is_open,"true"),I(),w({parent:L}))})):E({name:k}).then((({data:s,error:a})=>{if(!a)return S({projectId:e.id,[o]:s.id||L}).then((({data:e,error:s})=>{if(a)(0,g.p6)({error:a},A);else if(e)return E({name:t,parent:e[o][0]}).then((({data:t,error:s})=>{if(!s)return A.success({message:v("The folder \u201c")+t.name+f("\u201d was successfully created.","folder"),placement:"bottomRight"}),R(e[o][0]),w({parent:e[o][0]}).then(((e,t)=>{e?(window.localStorage.setItem(h.V0.em_folder_is_open,"true"),I()):t&&(0,g.p6)({error:t},A)}));(0,g.p6)({error:s},A)}))}));(0,g.p6)({error:a},A)})).catch((e=>console.error(e))).finally((()=>B(!1)))))).catch((e=>console.error(e))).finally((()=>B(!1)))};return(0,x.jsx)(l.A,{title:v("Add a new folder"),open:y,onOk:P,onCancel:I,className:"new-folder-modal",centered:!0,footer:[(0,x.jsx)(i.Ay,{type:"primary",size:"large",loading:N.isLoading||T,onClick:P,children:v("Create folder")},"submit")],children:(0,x.jsx)(a.A,{form:_,layout:"vertical",name:"add_new_folder_form",onFinish:P,initialValues:{remember:!1,name:""},autoComplete:"off",style:{paddingTop:10},children:(0,x.jsx)(a.A.Item,{name:"name",rules:[{required:!0,message:v("Please enter the folder name")}],children:(0,x.jsx)(n.A,{disabled:N.isLoading,size:"large",placeholder:v("Enter the folder name"),ref:j,style:{marginBottom:5}})})})})}},68919:(e,t,o)=>{o.d(t,{A:()=>f});var s=o(92810),a=o(12280),l=o(14852),i=o(43005),n=o(55039),r=o(71157),d=o(64617),c=o(45934),m=o(23287),u=o(84568),p=o(64936),h=o(86286),g=o(85163),x=o(47381),v=o(70082);const f=({isModalVisible:e})=>{const{__:t}=(0,m.s9)(),o=(0,c.wA)(),[f]=a.A.useForm(),b=(0,s.useRef)(null),_=(0,d.Zp)(),j=(0,r.hN)(),y=(0,c.d4)(h.C1),[A,k]=(0,u.lD)();(0,s.useEffect)((()=>{e&&(f.resetFields(),setTimeout((()=>{var e;return null===(e=b.current)||void 0===e?void 0:e.focus({cursor:"end"})}),400))}),[e,f]);const S=()=>{f.validateFields().then((e=>((0,x.d)({event:"submit_form",action:"create_new_project",label:e.name}),A({title:e.name,members:{owner:y.id}})))).then((e=>{if(e.error)throw j.error({message:(0,v.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.code}}),description:(0,v.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.message}}),placement:"bottomRight"}),o((0,p.Oo)()),new Error(g.ff);e.data&&(j.success({message:t("The project \u201c")+e.data.title+t("\u201d was successfully created."),placement:"bottomRight"}),o((0,p.Oo)()),_(`/projects/${e.data.id}/emails?status=new_project&page=1`))})).catch((e=>{console.error("e",e)}))};return(0,v.jsx)(l.A,{title:t("Add a new project"),open:e,onOk:S,onCancel:()=>o((0,p.Oo)()),className:"blocks-modal blocks-modal_create",centered:!0,footer:[(0,v.jsx)(i.Ay,{className:"em-analytics__project-add",type:"primary",size:"large",loading:k.isLoading,onClick:S,children:t("Create project")},"submit")],styles:{mask:{backgroundColor:"var(--colorBgLayout)"}},children:(0,v.jsx)(a.A,{form:f,layout:"vertical",name:"add_new_project_form",onFinish:S,initialValues:{remember:!1,name:""},autoComplete:"off",style:{padding:"10px 24px 0"},children:(0,v.jsx)(a.A.Item,{extra:t("This can be\xa0the name of\xa0your company, department, website, project, marketing campaign, or\xa0other activity."),name:"name",rules:[{required:!0,message:t("Please enter the project name")}],children:(0,v.jsx)(n.A,{disabled:k.isLoading,size:"large",placeholder:t("Enter the project name"),ref:b,style:{marginBottom:5}})})})})}},43319:(e,t,o)=>{o.d(t,{A:()=>H});var s=o(92810),a=o(38883),l=o.n(a),i=o(95838),n=o(12280),r=o(29234),d=o(2018),c=o(7744),m=o(66726),u=o(78159),p=o(81e3),h=o(8701),g=o(71086),x=o(55039),v=o(81662),f=o(62767),b=o(45934),_=o(23287),j=o(26238),y=o(49343),A=o(62303),k=o(85163),S=o(65983),w=o(47358),C=o(45695),I=o(56991),E=o(70082);const{backgroundColor:N,backgroundImage:T,backgroundPositionX:B,backgroundPositionY:L,backgroundRepeat:R,responsive:P,backgroundColorContent:F,width:M}={backgroundColor:"backgroundColor",backgroundImage:"backgroundImage",backgroundPositionX:"backgroundPositionX",backgroundPositionY:"backgroundPositionY",backgroundRepeat:"backgroundRepeat",responsive:"responsive",backgroundColorContent:"backgroundColorContent",width:"width"},D={[N]:"",[T]:"",[B]:"",[L]:"",[R]:"checked",[F]:"",[M]:""},{useToken:z}=i.A,O=({className:e})=>{var t,o,a;const{__:i}=(0,_.s9)(),F=(0,C.XW)(),M=(0,b.wA)(),O=(0,b.d4)(S.uJ),H=(0,b.d4)(S.iy),[V]=n.A.useForm(),[q,$]=(0,s.useState)(!0),G=(0,I.rD)(),X=(0,b.d4)(w.B),{token:U}=z(),W=i("Email not yet loaded or global container not found."),Y=[{label:i("Not defined"),value:"none"},{label:i("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:i("Repeat background (repeat)"),value:"repeat"},{label:i("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:i("Repeat background vertically (repeat-y)"),value:"repeat-y"}];(0,s.useEffect)((()=>{var e,t,o,s;V.setFieldsValue({...O,width:null===(e=O.width)||void 0===e?void 0:e.value,widthDim:null===(t=O.width)||void 0===t?void 0:t.dim,backgroundImage:O.backgroundImage?null===(o=O.backgroundImage[0])||void 0===o?void 0:o.value:"",backgroundRepeat:""===O[R]?"repeat":O[R],responsive:null===(s=O.responsive)||void 0===s?void 0:s.shutdown}),$(!O.backgroundImage)}),[O,V]);return(0,E.jsx)("div",{className:l()("appearance-panel",{[e]:e}),children:(0,E.jsxs)(n.A,{form:V,layout:"vertical",name:"appearance_panel_form",initialValues:{remember:!1,...D},onValuesChange:e=>{var t;const o=V.getFieldsValue(!0),s=Object.keys(e)[0];switch(s){case B:case L:F({operation:k.Ru.SANDBOX_EMAIL_SETTINGS_SET,settings:{[s]:""===e[s]?"none":e[s]}});break;case T:$(""===e[s]),F({operation:k.Ru.SANDBOX_EMAIL_SETTINGS_SET,settings:{[s]:[{...null===O||void 0===O||null===(t=O.backgroundImage)||void 0===t?void 0:t[0],value:e[s]}]}});break;case P:F({operation:k.Ru.SANDBOX_EMAIL_SETTINGS_SET,settings:{responsive:{shutdown:e[s],styles:e[s]},width:o.width}});break;default:F({operation:k.Ru.SANDBOX_EMAIL_SETTINGS_SET,settings:e})}},autoComplete:"off",className:"element-controls",children:[H?(0,E.jsx)(r.A,{style:{marginBottom:"24px"},message:W,type:"error"}):null,(0,E.jsxs)(n.A.Item,{style:{marginBottom:"0"},children:[(0,E.jsx)("div",{className:"form-group-title",style:{paddingTop:0},children:i("Email layout width")}),(0,E.jsx)(d.A,{gutter:10,children:(0,E.jsx)(c.A,{span:12,children:(0,E.jsx)(m.A,{trigger:["hover"],title:null!==(t=O.width)&&void 0!==t&&t.value?i("This field sets the width of the email."):i("Couldn`t determine the email width"),placement:"right",children:(0,E.jsx)(n.A.Item,{name:"width",style:{marginBottom:U.formItemMarginBottomXS},children:(0,E.jsx)(u.A,{min:0,placeholder:i("Width"),prefix:(0,E.jsx)(f.A,{}),disabled:!(null!==(o=O.width)&&void 0!==o&&o.value),addonAfter:"px"})})})})}),(0,E.jsx)(d.A,{gutter:20,children:(0,E.jsx)(c.A,{span:24,children:(0,E.jsxs)(p.A,{size:8,align:"baseline",children:[(0,E.jsx)(n.A.Item,{name:"responsive",valuePropName:"checked",children:(0,E.jsx)(h.A,{size:"small",name:"responsive",id:"responsive",disabled:void 0===(null===(a=O.responsive)||void 0===a?void 0:a.shutdown),onChange:e=>{M((0,w.wW)({shutdown:e,styles:e})),F({operation:k.Ru.SANDBOX_IFRAME_SETSIZE,settings:{iframeWidth:document.querySelector(".email-pane__iframe").getBoundingClientRect().width}})}})}),(0,E.jsx)("div",{className:"ant-form-item-switch-label",children:(0,E.jsx)("label",{htmlFor:"responsive",style:{verticalAlign:"middle"},children:i("Responsive email")})})]})})})]}),(0,E.jsx)(g.A,{className:"selected-td-form__divider"}),(0,E.jsx)("div",{className:"form-group-title",children:i("Email background color")}),(0,E.jsxs)(d.A,{gutter:10,style:{paddingBottom:q?16:4},children:[(0,E.jsx)(c.A,{span:12,children:(0,E.jsx)(m.A,{trigger:["hover"],title:i("Background color"),placement:"bottom",children:(0,E.jsx)(n.A.Item,{name:N,style:{marginBottom:U.formItemMarginBottomXS},rules:[{message:i("Please set the background color")}],children:(0,E.jsx)(j.A,{placeholder:i("Background color"),usedColors:O.usedColors})})})}),(0,E.jsx)(c.A,{span:q?12:24,children:G.formEmailFieldBackgroundImageEnabled&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(y.A,{form:V,label:i("Background image"),name:T,tooltipTitle:i("Background image"),disabled:H||"Styles"!==X,elementSettings:O}),!q&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(n.A.Item,{style:{marginBottom:"0"},children:(0,E.jsxs)(d.A,{gutter:10,children:[(0,E.jsx)(c.A,{span:12,children:(0,E.jsx)(m.A,{trigger:["hover"],title:i("Horizontal position"),placement:"bottom",children:(0,E.jsx)(n.A.Item,{name:B,style:{marginBottom:U.formItemMarginBottomXS},children:(0,E.jsx)(x.A,{placeholder:i("Horizontal position"),prefix:(0,E.jsx)(A.A,{icon:"BgPositionHorizontal"})})})})}),(0,E.jsx)(c.A,{span:12,children:(0,E.jsx)(m.A,{trigger:["hover"],title:i("Vertical position"),placement:"bottom",children:(0,E.jsx)(n.A.Item,{name:L,style:{marginBottom:U.formItemMarginBottomXS},children:(0,E.jsx)(x.A,{placeholder:i("Vertical position"),prefix:(0,E.jsx)(A.A,{icon:"BgPositionVertical"})})})})})]})}),(0,E.jsx)(m.A,{trigger:["hover"],title:i("Background image repeat"),placement:"bottom",children:(0,E.jsx)(n.A.Item,{name:R,children:(0,E.jsx)(v.A,{placeholder:i("Please select"),disabled:H,options:Y,getPopupContainer:e=>e.parentNode})})})]})]})})]}),(0,E.jsx)(g.A,{className:"selected-td-form__divider"}),(0,E.jsx)("div",{className:"form-group-title",children:i("Content background color")}),(0,E.jsx)(m.A,{trigger:["hover"],title:i("Content background color"),placement:"bottom",children:(0,E.jsx)(n.A.Item,{name:"backgroundColorContent",style:{marginBottom:U.formItemMarginBottomMD+4},rules:[{message:i("Please set the background color")}],children:(0,E.jsx)(j.A,{placeholder:i("Background color"),isDisabled:void 0===O.backgroundColorContent,usedColors:O.usedColors})})})]})})};O.defaultProps={className:""};const H=O},16106:(e,t,o)=>{o.d(t,{A:()=>D});var s=o(92810),a=o(81e3),l=o(66726),i=o(23287),n=o(74436),r=o(24358),d=o(42797),c=o.n(d),m=o(50483),u=o.n(m),p=o(95550),h=o.n(p),g=o(71811),x=o.n(g),v=o(35465),f=o.n(v),b=o(44789),_=o.n(b),j=o(77098),y=o.n(j),A=o(16409),k=o(48304),S=o.n(k),w=o(59817),C=o(79757),I=o(78588),E=o.n(I),N=o(62303),T=o(92779),B=o(86286),L=o(36404),R=o(32269),P=o(56991),F=o(45934),M=o(70082);const D=()=>{var e,t;const o=(0,i.s9)(),{__:d}=o,m=(0,P.rD)(),p=(0,F.d4)(L.yN),g=(0,F.d4)(B.B$),v=(0,F.d4)(B.C1),b=(0,F.d4)(B.B),j=(0,R.X7)(),k=(0,R.Qi)(),[I,D]=(0,s.useState)(!1),[z,O]=(0,s.useState)(0);let H=!(g||(null===(e=v.id)||void 0===e?void 0:e.toString())!==(null===p||void 0===p||null===(t=p.members)||void 0===t?void 0:t.owner.ID));const V=[];m.elementImageEnabled&&V.push({title:d("Image"),icon:(0,M.jsx)(N.A,{icon:"ElementImage"}),html:n.A,className:"",name:"image"}),m.elementAIimageEnabled&&V.push({title:d("AI image"),icon:(0,M.jsx)(N.A,{icon:"ElementImageAI"}),html:r.A,className:"ai",name:"ai-image"}),m.elementTextEnabled&&V.push({title:d("Text"),icon:(0,M.jsx)(N.A,{icon:"ElementText"}),html:c()(o),className:"",name:"text"}),m.elementHeaderEnabled&&V.push({title:d("Header"),icon:(0,M.jsx)(N.A,{icon:"ElementTitle"}),html:u()(o),className:"",name:"header"}),m.elementButtonEnabled&&V.push({title:d("Button"),icon:(0,M.jsx)(N.A,{icon:"ElementButton"}),html:h()(o),className:"",name:"button"}),m.elementSpacerEnabled&&V.push({title:d("Spacer"),icon:(0,M.jsx)(N.A,{icon:"ElementSpacer"}),html:y(),className:"",name:"spacer"}),m.elementListULEnabled&&V.push({title:d("List UL"),icon:(0,M.jsx)(N.A,{icon:"ElementListUL"}),html:x()(o),className:"",name:"list-ul"}),m.elementListOLEnabled&&V.push({title:d("List OL"),icon:(0,M.jsx)(N.A,{icon:"ElementListOL"}),html:f()(o),className:"",name:"list-ol"}),m.elementDividerEnabled&&V.push({title:d("Divider"),icon:(0,M.jsx)(N.A,{icon:"ElementDivider"}),html:_(),className:"",name:"divider"}),m.elementSocialEnabled&&V.push({title:d("Social media"),icon:(0,M.jsx)(N.A,{icon:"ElementSocial"}),html:A.A,className:"",name:"social"}),m.elementTableEnabled&&V.push({title:d("Table"),icon:(0,M.jsx)(N.A,{icon:"ElementTable"}),html:S()(o),className:"",name:"table"}),m.elementCountdownEnabled&&V.push({title:d("Countdown"),icon:(0,M.jsx)(N.A,{icon:"ElementCountdown"}),html:(0,w.A)(b),className:"",name:"countdown"}),m.elementVideoEnabled&&V.push({title:d("Video"),icon:(0,M.jsx)(N.A,{icon:"ElementVideo"}),html:C.A,className:"",name:"video"}),m.elementCarouselEnabled&&V.push({title:d("Carousel"),icon:(0,M.jsx)(N.A,{icon:"ElementCarousel"}),html:E()(o),className:"amp",name:"amp-carousel"}),m.elementFormEnabled&&V.push({title:d("Form"),icon:(0,M.jsx)(N.A,{icon:"ElementForm"}),html:null,className:"amp",name:"amp-form"});const q=e=>!H||"ai-image"!==e.name||(setTimeout((()=>{D(!0),O(2)}),1e3),!1);return(0,M.jsxs)("div",{className:"atoms",children:[(0,M.jsx)("div",{className:"atoms__list",children:(0,M.jsx)(a.A,{wrap:!0,style:{justifyContent:"space-between",rowGap:10},children:V&&V.map(((e,t)=>e.html?(0,M.jsxs)("div",{className:"ant-card-hoverable atoms__item "+e.className,draggable:!0,onClick:t=>j(t,e.html),onDragStart:t=>k(t,e,q),"data-test-name":e.name,children:[(0,M.jsx)("span",{className:"atom-image",children:e.icon}),(0,M.jsx)("span",{className:"atom-title",children:e.title})]},e.title+t.toString()):(0,M.jsx)(l.A,{title:d("Coming soon"),placement:"top",children:(0,M.jsxs)("div",{className:"atoms__item atoms__item_inactive "+e.className,"data-test-name":e.name,children:[(0,M.jsx)("span",{className:"atom-image",children:e.icon}),(0,M.jsx)("span",{className:"atom-title",children:e.title})]},e.title+t.toString())},e.title+t.toString())))})}),(0,M.jsx)(T.A,{open:I,onCancel:()=>D(!1),initialSlide:z})]})}},59297:(e,t,o)=>{o.d(t,{A:()=>$});var s=o(92810),a=o(41919),l=o(95838),i=o(2018),n=o(7744),r=o(64617),d=o(94822),c=o(23287),m=o(83351),u=o(38883),p=o.n(u),h=o(70082);const{useToken:g}=l.A,x=({className:e,fontSize:t,to:o})=>{const{token:s}=g();return(0,h.jsx)(d.N_,{className:p()("app-logo",{[e]:e}),style:{fontSize:t?`${t}px`:"40px",color:s.colorText},to:o,children:(0,h.jsx)("span",{style:{fontWeight:500},children:(0,h.jsxs)("b",{children:["bl",(0,h.jsx)("em",{children:"o"}),"cks"]})})})};var v=o(72981),f=o(85163),b=o(69156),_=o(90070),j=o(89831);const{useToken:y}=l.A,A={},k={width:1012,color:"#fff",textAlign:"center",height:"100%"};var S;!function(e){e.fade="fade",e.scrollx="scrollx"}(S||(S={}));const w=({data:e=[],sliderStyle:t=A,coruselStyle:o=k,customDots:s=!1,carouselRef:a,effect:l=S.fade,header:i=!1,...n})=>{const{token:r}=y();return(0,h.jsxs)(h.Fragment,{children:[s&&(0,h.jsx)("div",{className:"custom-dot",children:e.length}),(0,h.jsx)(j.A,{style:o,ref:a,effect:l,...n,children:e.map((e=>(0,h.jsxs)("div",{style:o,className:"slide",children:[i&&(0,h.jsx)("div",{className:"slide-title",style:{color:r.colorText,fontWeight:700,lineHeight:"1.2",textAlign:"center",marginTop:10,marginBottom:20,marginLeft:"auto",marginRight:"auto"},children:null===e||void 0===e?void 0:e.textHeader}),null===e||void 0===e?void 0:e.content]},e.id)))})]})};var C=o(13338),I=o(62303);const E={position:"relative",display:"inline-block",margin:20,width:50,height:50,borderRadius:"50%",overflow:"hidden",cursor:"pointer"},N={position:"absolute",top:0,left:0,width:"100%",height:"100%",zIndex:0},T={fontSize:24,position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1,color:"#1890FF"},B=({icon:e,isActive:t,onClick:o,duration:a,onComplete:l})=>{const[i,n]=(0,s.useState)(0),r=window.localStorage.getItem(f.V0.em_color_scheme),d=matchMedia(f.F3).matches?f.nd:f.T,c=r||d;return(0,s.useEffect)((()=>{if(t){let e=Date.now();const t=setInterval((()=>{const o=Date.now()-e,s=Math.min(o/a*100,100);n(s),100===s&&(clearInterval(t),l())}),10);return()=>clearInterval(t)}n(0)}),[t,a,l]),(0,h.jsxs)("div",{style:{...E,backgroundColor:"dark"===c?"#1e1e1f":"#edeff1"},onClick:o,children:[(0,h.jsx)(C.A,{type:"circle",percent:i,strokeColor:"#1890ff",strokeWidth:4,trailColor:"transparent",size:50,format:()=>null,style:N}),(0,h.jsx)(I.A,{icon:e,style:T})]})},L=({carouselRef:e})=>{const[t,o]=(0,s.useState)(0),[a,l]=(0,s.useState)(!0),i=8e3,n=(0,s.useRef)(null),r=["SliderGroup","SliderTemplates","SliderBlocks","SliderAdaptive","SliderMagic"];(0,s.useEffect)((()=>{var o;null===(o=e.current)||void 0===o||o.goTo(t)}),[t,e]);const d=()=>{var s;null===(s=e.current)||void 0===s||s.goTo((t+1)%r.length),o((e=>(e+1)%r.length))};return(0,s.useEffect)((()=>{if(a)return n.current&&clearTimeout(n.current),n.current=setTimeout((()=>{o((e=>e%r.length))}),i),()=>clearTimeout(n.current)}),[a,i,r.length]),(0,s.useEffect)((()=>{l(!0)}),[]),(0,h.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",paddingTop:10},children:r.map(((e,s)=>(0,h.jsx)(B,{icon:e,isActive:t===s,onClick:()=>(e=>{o(e),l(!1)})(s),duration:i,onComplete:d},s)))})},R=(0,s.forwardRef)((({data:e=[],sliderStyle:t,customDots:o=!1,...a},l)=>{const i=(0,s.useRef)(null);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(L,{carouselRef:i}),(0,h.jsx)(w,{data:e,carouselRef:i,dots:!1,header:!0,...a})]})}));o(84093),o(42854),o(81871),o(39024),o(35929);var P=o(50195),F=o(59142),M=o(27544),D=o(59045),z=o(97970);const O=[{id:"1",textHeader:"Add your team members with a few clicks of your mouse",content:(0,h.jsx)("img",{src:F,alt:"login1stSlide"})},{id:"2",textHeader:"100+ ready-made templates for your work",content:(0,h.jsx)("img",{src:P,alt:"login2stSlide"})},{id:"3",textHeader:"Make emails in minutes with drag-n-drop",content:(0,h.jsx)("img",{src:M,alt:"login3stSlide"})},{id:"4",textHeader:"Responsive email templates that look great on any device",content:(0,h.jsx)("img",{src:D,alt:"login4stSlide"})},{id:"5",textHeader:"Use AI to generate text and images for your emails",content:(0,h.jsx)("img",{src:z,alt:"login5stSlide"})}],H=O,{Content:V}=a.A,{useToken:q}=l.A,$=({children:e})=>{var t,o;const{__:l}=(0,c.s9)(),{token:u}=q(),p=(0,r.Zp)(),[g,j]=(0,s.useState)(!1),y=(0,_.p6)(),[,A]=(0,d.ok)(),[k]=(0,m.UH)(),S=(0,r.zy)(),w=null===S||void 0===S||null===(t=S.state)||void 0===t||null===(o=t.from)||void 0===o?void 0:o.search;return(0,s.useEffect)((()=>{w&&A(w)}),[w,A]),(0,s.useEffect)((()=>{(0,b.FN)(u)}),[u]),(0,s.useEffect)((()=>{y.get(f.A9.em_token)?k().then((e=>{if(e.error)return y.remove(f.A9.em_token),void j(!0);p("/projects",{replace:!0})})):j(!0)}),[p,k,y]),(0,h.jsx)(a.A,{className:"auth-page-layout",children:g?(0,h.jsx)(V,{className:"auth-page-layout__container container",children:(0,h.jsxs)(i.A,{justify:"center",align:"middle",style:{minHeight:"100vh",flexFlow:"nowrap"},children:[(0,h.jsx)(n.A,{className:"auth-page-layout__col auth-page-layout__col_form",flex:1,children:(0,h.jsxs)("div",{children:[(0,h.jsxs)("div",{className:"auth-page-layout__heading",children:[(0,h.jsx)(x,{className:"auth-page-layout__logo",fontSize:30,to:"/projects"}),(0,h.jsx)("p",{className:"auth-page-layout__logo-text",style:{color:u.colorText,fontWeight:400,fontSize:14},children:l("Email builder for your teamwork")})]}),e]})}),(0,h.jsx)(n.A,{className:"generel-col",flex:1,children:(0,h.jsx)(i.A,{align:"bottom",justify:"center",style:{minHeight:"100vh"},children:(0,h.jsx)("div",{style:{display:"flex",flexDirection:"column",justifyContent:"flex-end",alignItems:"center"},children:(0,h.jsx)(R,{data:H})})})})]})}):(0,h.jsx)(v.A,{})})}},92267:(e,t,o)=>{o.d(t,{A:()=>y});var s=o(92810),a=o(38883),l=o.n(a),i=o(81662),n=o(12280),r=o(29234),d=o(55039),c=o(28372),m=o(45934),u=o(23287),p=o(85163),h=o(7760),g=o(45695),x=o(70082);const{Option:v}=i.A,{width:f,widthDim:b}={width:"width",widthDim:"widthDim"},_={[f]:"",[b]:""},j=({className:e})=>{const{__:t}=(0,u.s9)(),o=(0,m.d4)(h.JV),a=(0,m.d4)(h.iy),[b]=n.A.useForm(),j=(0,g.XW)(),y=t("Block not yet loaded or global container not found.");(0,s.useEffect)((()=>{b.setFieldsValue({width:o.width.value,widthDim:o.width.dim})}),[o,b]);return(0,x.jsx)("div",{className:l()("block-appearance-panel",{[e]:e}),children:(0,x.jsxs)(n.A,{form:b,layout:"vertical",name:"block_appearance_panel_form",initialValues:{remember:!1,..._},onValuesChange:e=>{const t=b.getFieldsValue(!0),o=Object.keys(e)[0];let s;switch(o){case"width":s={[o]:{value:e[o],dim:t.widthDim}};break;case"widthDim":s={width:{value:t.width,dim:e[o]}};break;default:return}j({operation:p.Ru.SANDBOX_BLOCK_SETTINGS_SET,settings:s})},autoComplete:"off",children:[a?(0,x.jsx)(r.A,{style:{marginBottom:"24px"},message:y,type:"error"}):null,(0,x.jsx)(n.A.Item,{label:t("Container width"),name:f,tooltip:{title:t("Specifies the block width."),icon:(0,x.jsx)(c.A,{})},rules:[{message:t("Please input container width")}],children:(0,x.jsx)(d.A,{disabled:a,placeholder:t("Container width"),addonAfter:(0,x.jsx)(n.A.Item,{name:"widthDim",noStyle:!0,children:(0,x.jsxs)(i.A,{className:"select-after",getPopupContainer:e=>e.parentNode,children:[(0,x.jsx)(v,{value:"px",children:"px"}),(0,x.jsx)(v,{value:"%",children:"%"})]})})})})]})})};j.defaultProps={className:""};const y=j},98519:(e,t,o)=>{o.d(t,{A:()=>P});var s=o(92810),a=o(95838),l=o(12280),i=o(33206),n=o(55039),r=o(29234),d=o(4800),c=o(49246),m=o(71086),u=o(71157),p=o(9452),h=o(85677),g=o(77406),x=o(64617),v=o(45934),f=o(23287),b=o(38883),_=o.n(b),j=o(84568),y=o(55701),A=o(47358),k=o(85163),S=o(32269),w=o(42068),C=o(70082);const I=e=>e=(e=(e=(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,"")).replace(/<\/?(?:script|embed|object|frameset|frame|iframe|applet|meta)[^>]*>/gi,"")).replace(/ on\w+="[^"]*"/g,"")).replace(/ on\w+='[^']*'/g,""),{name:E,type:N,tags:T}={name:"name",type:"type",tags:"tags"},B={[E]:"",[N]:[],[T]:[]},L={Header:10,Menu:20,Banners:30,Content:40,Lists:50,Buttons:60,Promocodes:70,"E-Commerce":80,Articles:90,Polls:100,Applications:110,Feature:120,Separators:130,Contacts:140,Footer:150},{useToken:R}=a.A,P=({parentEmailId:e=k.iU,blocksTab:t,search:o,reloadBlockScreens:a})=>{const{projectId:b}=(0,x.g)(),P=(0,S.sh)(),F=(0,S._9)(),[M]=l.A.useForm(),{data:D}=(0,y.h1)(),{token:z}=R(),{__:O,_x:H}=(0,f.s9)(),V=(0,u.hN)(),{modal:q}=i.A.useApp(),{confirm:$}=q;let G=(0,x.zy)();const X=(0,v.d4)(A.V$),U=(0,s.useRef)(null),W=(0,s.useRef)(null),Y=(0,s.useRef)(null),K=(0,s.useRef)(null),Z=(0,s.useRef)(null),J=(0,v.Pj)();(0,s.useEffect)((()=>{var e;null===(e=W.current)||void 0===e||e.scrollTo({top:0})}),[t,o]);const{data:Q}=j.Nq.endpoints.getProject.select(+b)(J.getState()),[ee,te]=(0,s.useState)({projectId:b,pageSize:1e3,page:1,tags:null,name:null,type:null,notEmbed:!0,order:"asc",orderby:"title"});(0,s.useEffect)((()=>{o||(M.setFieldsValue(B),Be({type:null,name:null}),a())}),[o,M,a]),(0,s.useEffect)((()=>{if(D){const e=D.schema.properties.acf.properties.type.items.enum;let t=[];for(let o in e)t.push({label:O(k.jg[e[o]]),value:e[o]})}}),[D,O]);const{isSuccess:oe,isError:se,isLoading:ae,isFetching:le,data:ie,refetch:ne,error:re}=(0,y.SB)({...ee,page:1}),de=(0,s.useMemo)((()=>{if(oe&&ie)return[...ie].sort(((e,t)=>L[e.type]-L[t.type]))}),[oe,ie]),[ce,me]=(0,s.useState)([]);(0,w.Z)((e=>{e!==se&&V.fromError("BLOCK_GET_ERROR",{},re,!0)}),[se,re,V]);const[ue,pe]=(0,s.useState)({emailId:e,pageSize:1e3,page:1,projectId:k.p5,notEmbed:!0,name:null,type:null}),{isSuccess:he,isError:ge,isLoading:xe,isFetching:ve}=(0,y.OD)({...ue,emailId:e,page:1},{skip:!e||X.length}),fe=(0,s.useMemo)((()=>{if(he||X.length)return[...X].sort(((e,t)=>L[e.type]-L[t.type]))}),[he,X]),[be,_e]=(0,s.useState)([]);(0,s.useEffect)((()=>{const e=new Set;if(X.length&&fe){for(const t of fe)t.type&&e.add(t.type);_e(Array.from(e))}}),[X.length,fe]);const[je,ye]=(0,s.useState)({pageSize:1e3,page:1,notEmbed:!0,name:null,type:null}),{isSuccess:Ae,isError:ke,isLoading:Se,isFetching:we,data:Ce=[]}=(0,y.kz)({...je,page:1}),Ie=(0,s.useMemo)((()=>{if(Ce.length)return[...Ce].sort(((e,t)=>L[e.type]-L[t.type]))}),[Ce]),[Ee,Ne]=(0,s.useState)([]);(0,s.useEffect)((()=>{const e=new Set;if(Ie&&Ce.length){for(const t of Ie)t.type&&e.add(t.type);Ne(Array.from(e))}}),[Ce.length,Ie]);const Te=(0,s.useMemo)((()=>{const e=new Set;for(const t of ce)e.add(t);for(const t of be)e.add(t);for(const t of Ee)e.add(t);return Array.from(e)}),[Ee,be,ce]),Be=e=>{te((t=>({...t,...e,page:1}))),pe((t=>({...t,...e,page:1}))),ye((t=>({...t,...e,page:1})))},Le=(0,s.useCallback)((()=>{document.querySelector(".blocks-search__result-wrapper.is_search")&&(document.querySelector(".blocks-search__result-wrapper").style.removeProperty("transition"),document.querySelector(".blocks-search__result-wrapper").style.opacity=0,document.querySelectorAll(".blocks-search__result-body").forEach((e=>e.style.removeProperty("height"))),document.querySelectorAll(".blocks-search__result-body").forEach((e=>{e.style.height=207*e.offsetHeight/640+"px"})),document.querySelector(".blocks-search__result-wrapper").style.transition="opacity 0.2s",document.querySelectorAll(".blocks-search__result-wrapper").forEach((e=>e.style.opacity=1)))}),[]);(0,s.useEffect)((()=>{we||Se||!Ae||"template"===t||(o?Le():a())}),[we,Se,Ae,Le,ee.name,a,o,t]),(0,s.useEffect)((()=>{const e=new Set;if(oe&&de){for(const t of de)t.type&&e.add(t.type);me(Array.from(e))}}),[oe,de]);const Re=e=>{a(),e.target.getAttribute("data-type")?(e.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach((e=>e.style.display="none")),e.target.closest(".blocks-search").querySelectorAll(`[data-type="${e.target.getAttribute("data-type")}"]`).forEach((e=>e.style.display="block"))):e.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach((e=>e.style.display="block")),e.target.parentElement.querySelector(".active").classList.remove("active"),e.target.classList.add("active")};let Pe=null;const Fe=e=>{clearTimeout(Pe);let t=document.querySelector(".block-search__preview")?document.querySelector(".block-search__preview"):null,o=document.querySelector(".block-search__preview-title")?document.querySelector(".block-search__preview-title"):null,s=document.querySelector(".block-search__preview-content")?document.querySelector(".block-search__preview-content"):null;document.querySelector(".block-search__preview")||(t=document.createElement("div"),t.classList.add("block-search__preview"),o=document.createElement("div"),o.classList.add("block-search__preview-title"),s=document.createElement("div"),s.classList.add("block-search__preview-content"),t.append(s),t.append(o),document.querySelector(".email-pane__col_settings-inner").append(t)),o.innerHTML="",s.innerHTML="",o.innerHTML=e.title;let a=e.html.replaceAll(/<style((.|\n|\r)*?)<\/style>/gi,"").trim();s.innerHTML=I('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+a+"</table>"),"1"!==t.style.opacity&&setTimeout((function(){t.style.opacity="1",t.style.transform="translateX(-100%)"}),10)},Me=()=>{let e=document.querySelector(".block-search__preview");e&&(Pe=setTimeout((()=>{e.style.opacity="0",e.style.transform="translateX(-99%)",setTimeout((function(){e.remove()}),300)}),300))};(0,s.useEffect)((()=>{document.querySelectorAll(".blocks-search__result").forEach((e=>{e.style.display="block"}))}),[t]);const De=!(null!==ie&&void 0!==ie&&ie.length)&&(!e||!(null!==X&&void 0!==X&&X.length))&&!(null!==Ce&&void 0!==Ce&&Ce.length)&&(ee.tags||ee.name||ee.type)&&!(ae||le);(0,s.useEffect)((()=>{ae||le||a()}),[ae,le,a]),(0,s.useEffect)((()=>{("common"===t||o)&&setTimeout(a,50)}),[ie,a,t,o]);const ze=e=>{$({maskClosable:!0,centered:!0,title:H("Are you sure you want to delete the \u201c","block")+e.title+O("\u201d block?"),icon:(0,C.jsx)(p.A,{}),okText:O("Yes"),cancelText:O("No"),onOk:()=>(e=>J.dispatch(y.VM.endpoints.deleteBlock.initiate(e.id)).then((t=>{t.error&&V.fromError("BLOCK_REMOVING_ERROR",(0,u.x_)(e),t.error),V.success({id:"BLOCK_REMOVING_SUCCESS",data:(0,u.x_)(e),message:O("The block \u201c")+t.data.title+H("\u201d was successfully removed.","block")}),ne()})))(e)})},Oe=(e,t)=>`${e.pathname.split("emails")[0]}blocks/${t.id}`,He=e=>{let t=[{key:"Delete block",className:"blocks-search__result__menu-item",icon:(0,C.jsx)(p.A,{style:{fontSize:"16px",margin:0}}),style:{color:z.colorError},onClick:()=>ze(e)}];return!k.EW.isPlugin&&t.unshift({key:"Edit block",className:"blocks-search__result__menu-item",icon:(0,C.jsx)(h.A,{style:{fontSize:"16px",margin:0}}),label:(0,C.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:Oe(G,e),children:" "})}),t};return(0,C.jsxs)("div",{className:_()("blocks-search",{is_search:o}),children:[(0,C.jsx)(l.A,{className:_()("blocks-search__form",{is_search:o}),form:M,layout:"vertical",name:"blocks_search_form",initialValues:{...B},onValuesChange:e=>{const t=Object.keys(e)[0],o=M.getFieldsValue(!0);switch(t){case T:const s=(0,S._q)(Q,k.YY).filter((o=>e[t].includes(o.name))).map((e=>e.id))||null;Be({tags:s});break;case N:Be({type:o.type||null});break;case E:U.current&&window.clearTimeout(U.current),U.current=window.setTimeout((function(){Be({name:o.name||null})}),300)}},autoComplete:"off",children:(0,C.jsx)(l.A.Item,{name:E,children:(0,C.jsx)(n.A,{placeholder:O("Search by title"),allowClear:!0,suffix:(0,C.jsx)(g.A,{className:"cards-search__search-icon, input-icon",style:{fontSize:"16px",cursor:"pointer"}})})})}),(se||ge||ke)&&(0,C.jsx)(r.A,{message:O("Error"),description:O("Error when receiving data. Try again (reload page) or contact support."),type:"error",showIcon:!0}),o&&!De&&(0,C.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,C.jsxs)("ul",{children:[(0,C.jsx)("li",{"data-type":"",className:"active",onClick:Re,children:O("All")},"search_All"),Te.map((e=>(0,C.jsx)("li",{"data-type":e,onClick:Re,children:O(k.jg[e])},"search_"+e)))]})}),(0,C.jsxs)("div",{ref:W,className:_()("blocks-search__result-wrapper",{is_search:o}),children:[("project"===t||o)&&(0,C.jsxs)(C.Fragment,{children:[!!ce.length&&!o&&(0,C.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,C.jsxs)("ul",{children:[(0,C.jsx)("li",{"data-type":"",className:"active",onClick:Re,children:O("All")},"blocksSections_All"),ce.map((e=>(0,C.jsx)("li",{"data-type":e,onClick:Re,children:O(k.jg[e])},"blocksSections_"+e)))]})}),(0,C.jsxs)("div",{className:_()("blocks-search__blocks-wrapper",{is_search:o}),ref:Y,children:[(0,C.jsx)("div",{className:"blocks-search__result-holder",children:!(ae||le)&&(null!==de&&void 0!==de&&de.length?de.map(((e,t)=>{const o=I('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+e.html+"</table>");return(0,C.jsx)("div",{className:"blocks-search__result","data-type":e.type,children:(0,C.jsx)(d.A,{placement:"leftTop",menu:{items:He(e)},overlayStyle:{minWidth:"auto",paddingRight:6},children:(0,C.jsx)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:t=>P(t,e.html),onDragStart:t=>F(t,e.html),onMouseEnter:()=>Fe({html:e.html,title:e.title}),onMouseLeave:Me,children:(0,C.jsx)("div",{className:"blocks-search__result-html",dangerouslySetInnerHTML:{__html:o},style:{transform:"scale(0.3234375)"}})})},"commenMenu")},e.id+t.toString())})):!(ee.tags||ee.name||ee.type)&&oe&&!(ae||le)&&!o&&(0,C.jsxs)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:[O("You don`t have any saved blocks yet."),(0,C.jsx)("br",{}),(0,C.jsx)("br",{}),O("To add a block from the dashboard click the"),(0,C.jsx)("br",{}),(0,C.jsx)("svg",{style:{position:"relative",top:"2px"},xmlns:"http://www.w3.org/2000/svg",focusable:"false",viewBox:"0 0 448 512",width:"1em",height:"1em",fill:"currentColor",children:(0,C.jsx)("path",{d:"M433.9 129.9l-83.9-83.9A48 48 0 0 0 316.1 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V163.9a48 48 0 0 0 -14.1-33.9zM272 80v80H144V80h128zm122 352H54a6 6 0 0 1 -6-6V86a6 6 0 0 1 6-6h42v104c0 13.3 10.7 24 24 24h176c13.3 0 24-10.7 24-24V83.9l78.2 78.2a6 6 0 0 1 1.8 4.2V426a6 6 0 0 1 -6 6zM224 232c-48.5 0-88 39.5-88 88s39.5 88 88 88 88-39.5 88-88-39.5-88-88-88zm0 128c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40z"})})," ",O("Save to Blocks button.")]}))}),(ae||le)&&(0,C.jsx)(c.A,{active:!0})]})]}),o&&(null===ie||void 0===ie?void 0:ie.length)>0&&(null===X||void 0===X?void 0:X.length)>0&&(0,C.jsx)(m.A,{className:"blocks-search__result-divider"}),("template"===t||o)&&e&&(0,C.jsxs)(C.Fragment,{children:[!!be.length&&!o&&(0,C.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,C.jsxs)("ul",{children:[(0,C.jsx)("li",{"data-type":"",className:"active",onClick:Re,children:O("All")},"templateBlocksSections_All"),be.map((e=>(0,C.jsx)("li",{"data-type":e,onClick:Re,children:O(k.jg[e])},"templateBlocksSections_"+e)))]})}),(0,C.jsxs)("div",{className:_()("blocks-search__blocks-wrapper",{is_search:o}),ref:K,children:[(0,C.jsxs)("div",{className:"blocks-search__result-holder",children:[X&&!xe&&!ve&&null!==fe&&void 0!==fe&&fe.length?(0,C.jsx)(C.Fragment,{children:fe.map(((e,t)=>{const o=I('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+e.html+"</table>");return(0,C.jsx)("div",{className:"blocks-search__result","data-type":e.type,children:(0,C.jsx)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:t=>P(t,e.html),onDragStart:t=>F(t,e.html),onMouseEnter:()=>Fe({html:e.html,title:e.title}),onMouseLeave:()=>Me(),children:(0,C.jsx)("div",{className:"blocks-search__result-html",dangerouslySetInnerHTML:{__html:o},style:{transform:"scale(0.3234375)"}})})},e.id+t.toString())}))}):!o&&!Se&&!ve&&(0,C.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:O("No related blocks found.")})," "]}),(xe||ve)&&(0,C.jsx)(c.A,{active:!0})]})]}),o&&(null===X||void 0===X?void 0:X.length)>0&&(null===Ce||void 0===Ce?void 0:Ce.length)>0&&(0,C.jsx)(m.A,{className:"blocks-search__result-divider"}),("common"===t||o)&&(0,C.jsxs)(C.Fragment,{children:[!(null===Ee||void 0===Ee||!Ee.length)&&!o&&(0,C.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,C.jsxs)("ul",{children:[(0,C.jsx)("li",{"data-type":"",className:"active",onClick:Re,children:O("All")},"commonBlocksSections_All"),Ee.map((e=>(0,C.jsx)("li",{"data-type":e,onClick:Re,children:O(k.jg[e])},"commonBlocksSections_"+e)))]})}),(0,C.jsxs)("div",{className:_()("blocks-search__blocks-wrapper",{is_search:o}),ref:Z,children:[(0,C.jsxs)("div",{className:"blocks-search__result-holder",children:[Ae&&!(null===Ie||void 0===Ie||!Ie.length)&&!(we||Se)&&(0,C.jsx)(C.Fragment,{children:Ie.map(((e,t)=>{const o=I('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+e.html+"</table>");return(0,C.jsx)("div",{className:"blocks-search__result","data-type":e.type,children:(0,C.jsx)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:t=>P(t,e.html),onDragStart:t=>F(t,e.html),onMouseEnter:()=>Fe({html:e.html,title:e.title}),onMouseLeave:()=>Me(),children:(0,C.jsx)("div",{className:"blocks-search__result-html",dangerouslySetInnerHTML:{__html:o},style:{transform:"scale(0.3234375)"}})})},e.id+t.toString())}))})," "]}),(Se||we)&&(0,C.jsx)(c.A,{active:!0})]})]}),De&&(0,C.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:O("There are no blocks for this request.")})]})]})}},29067:(e,t,o)=>{o.d(t,{A:()=>$});var s=o(92810),a=o(95838),l=o(33206),i=o(81e3),n=o(66522),r=o(4800),d=o(49246),c=o(29234),m=o(21349),u=o(33151),p=o(71157),h=o(9452),g=o(82013),x=o(9588),v=o(79612),f=o(10900),b=o(85677),_=o(20350),j=o(64586),y=o(8114),A=o(74267),k=o(64617),S=o(94822),w=o(45934),C=o(23287),I=o(38883),E=o.n(I),N=o(57903),T=o(43063),B=o(72981),L=o(55701),R=o(34524),P=o(7760),F=o(86286),M=o(32269),D=o(31844),z=o(85163),O=o(70082);const{useToken:H}=a.A,V=(e,t)=>`${e.pathname}/${t.id}`,q=24,$=({projectId:e,emailsView:t,createPage:o=!1,currentFolderId:a,foldersList:I,refetchProjectFolders:$,projectTags:G=[],activeTagId:X,setActiveTagHandler:U,projectEmailsCounter:W=0})=>{var Y,K,Z,J,Q,ee,te,oe;const{__:se,_x:ae}=(0,C.s9)(),le=(0,w.wA)(),ie=(0,w.d4)(R.D2),ne=(0,w.d4)(R.dV),re=(0,w.d4)(F.C1),de=(0,w.d4)(R.NP),ce=(0,w.d4)(R.qM),me=(0,w.d4)(R.ux),ue=(0,w.d4)(P.b9);let pe=(0,k.zy)();const{owner:he,admin:ge}=(0,D.A)(),xe=(0,k.Zp)(),{token:ve}=H(),{modal:fe}=l.A.useApp(),be=(0,p.hN)(),{confirm:_e}=fe,je=(0,w.Pj)(),[ye,Ae]=(0,S.ok)(),{refetch:ke}=(0,k.KC)(),Se=+ye.get("page"),we=ye.get("folder"),Ce=+ye.get("tag"),[Ie,Ee]=(0,L.pP)(),[Ne]=(0,L.R2)(),[Te]=(0,L.OZ)(),[Be,Le]=(0,s.useState)(!1),Re=a&&a===z.UW,Pe=a===z.y2&&!Ce;(0,s.useEffect)((()=>{le((0,R.FC)())}),[le]);const[Fe,Me]=(0,s.useState)({projectId:e,page:Pe?Se:1,pageSize:q,notEmbed:!0,tags:null,folderTag:null}),{isLoading:De,isSuccess:ze,isError:Oe,isFetching:He,refetch:Ve,error:qe}=(0,L.SB)({...Fe,folderTag:null,tags:null,status:"main"},{skip:o||!(null===(Y=Fe.name)||void 0===Y||!Y.length)&&a!==z.y2}),[$e,Ge]=(0,s.useState)({page:Se||1,pageSize:q,folderTag:null,tags:[]}),{isLoading:Xe,isSuccess:Ue,isError:We,isFetching:Ye,data:Ke=[],refetch:Ze,error:Je}=(0,L.kz)($e,{skip:!o||(Math.ceil(ie/q)||1)<$e.page}),[Qe,et]=(0,s.useState)({projectId:e,page:1,pageSize:q,notEmbed:!0,tags:Ce&&[Ce],folderTag:a}),{isLoading:tt,isSuccess:ot,isError:st,isFetching:at,error:lt}=(0,L.SB)({...Qe,tags:a&&Qe.folderTag?null:Qe.tags,status:"custom"},{skip:o||Re||a===z.y2||Qe.folderTag!==a||!(null===(K=Qe.name)||void 0===K||!K.length)&&(Re||a===z.y2)}),[it,nt]=(0,s.useState)({projectId:e,page:Re?Se:1,pageSize:q,notEmbed:!0,tags:Ce&&[Ce],folderTag:null,status:"trash"}),[rt,dt]=(0,s.useState)(!1),{isLoading:ct,isSuccess:mt,isError:ut,isFetching:pt,data:ht,refetch:gt,error:xt}=(0,L.SB)({...it,status:"trash",folderTag:null,page:rt?it.page:1},{skip:o||(Math.ceil(ne/q)||1)<it.page||!(null===(Z=it.name)||void 0===Z||!Z.length)&&!Re||!(null===(J=it.tags)||void 0===J||!J[0])&&me>0});(0,s.useEffect)((()=>{dt(!!ht||Math.ceil(ne/q)>=it.page)}),[ht,it.page,ne]);const vt=o?$e:Re?it:Pe?Fe:Qe,ft=o?Ue:Re?mt:Pe?ze:ot,bt=o?Xe:Re?ct:Pe?De:tt,_t=o?We:Re?ut:Pe?Oe:st,jt=o?Ye:Re?pt:Pe?He:at,yt=o?Ze:Re?gt:Pe?Ve:()=>{var e;return le(L.VM.endpoints.getBlocks.initiate({...vt,folderTag:a||(null===(e=vt.tags)||void 0===e?void 0:e[0])||!1}))},At=o?Je:Re?xt:Pe?qe:lt,kt=(o?ie:Re?ne:Pe?ie:null===de||void 0===de||null===(Q=de[a||(null===(ee=Qe.tags)||void 0===ee?void 0:ee[0])])||void 0===Q?void 0:Q.total)||0,St=o?Ke:Re?me:Pe?ce:null===de||void 0===de||null===(te=de[a||(null===(oe=Qe.tags)||void 0===oe?void 0:oe[0])])||void 0===te?void 0:te.list,wt=(0,s.useCallback)((e=>{o?Ge((t=>({...t,...e}))):Re?nt((t=>({...t,...e}))):Pe?Me((t=>({...t,...e}))):et((t=>({...t,...e})))}),[o,Re,Pe]);(0,s.useEffect)((()=>{var e;"rest_post_invalid_page_number"===(null===At||void 0===At||null===(e=At.data)||void 0===e?void 0:e.code)&&wt({page:1})}),[At,wt]),(0,s.useEffect)((()=>{if(!o){(we&&we!==a||X&&Ce!==X)&&wt({folderTag:a,page:1});let e={page:we===a&&vt.page?vt.page:1};a&&!Ce&&(e.blockfolder=a),X&&(e.tag=X),Ae(e,{replace:!0})}}),[vt.page,xe,o,we,a,X,Ce,wt,Ae]);const Ct=e=>{_e({maskClosable:!0,centered:!0,title:ae(Re?"Are you sure to irrevocably delete the \u201c":"Are you sure you want to delete the \u201c","block")+e.title+se("\u201d block?"),icon:(0,O.jsx)(h.A,{style:{color:"#ff4d4f"}}),okText:se("Yes"),cancelText:se("No"),onOk:()=>(e=>je.dispatch(L.VM.endpoints.deleteBlock.initiate({id:e.id,force:Re})).then((e=>{e.error?(0,M.p6)(e,be):e.data&&((0,M.wB)(se("The block \u201c")+e.data.title+ae("\u201d was successfully removed.","block"),be),yt(),$(),gt(),ke())})))(e)})},It=e=>{Le(!0),Te({blockId:null===e||void 0===e?void 0:e.id,status:"publish"}).then((t=>{t.error?be.error({message:(0,O.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.code}}),description:(0,O.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.message}}),placement:"bottomRight"}):(e.blockfolder[0]?yt():Ve(),$(),gt(),ke(),be.success({message:se("The block \u201c")+e.title+ae("\u201d was successfully recovered.","recovery"),placement:"bottomRight"})),Le(!1)}))},Et=e=>{Le(!0),Ne(null===e||void 0===e?void 0:e.id).then((e=>{const t=e.data;Ie({title:(0,M.fq)(t.title),blocktags:t.blocktags,blockfolder:t.blockfolder,project:t.project,subject:t.subject,description:t.description,html:(0,M.el)(t.html||"",t.title),type:t.type?t.type:"Other"}).then((e=>{e.error?be.error({message:(0,O.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.code}}),description:(0,O.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.message}}),placement:"bottomRight"}):(Ve(),be.success({message:se("The copy of block \u201c")+t.title+ae("\u201d was successfully created.","block"),placement:"bottomRight"})),Le(!1)}))}))},Nt=(e,t)=>{Te({blockId:t.id,blockfolder:e.key===z.y2?[]:[e.key]}).then((e=>{var o,s;(null===e||void 0===e||null===(o=e.data)||void 0===o?void 0:o.blockfolder[0])&&le(L.VM.endpoints.getBlocks.initiate({...vt,folderTag:(null===e||void 0===e||null===(s=e.data)||void 0===s?void 0:s.blockfolder[0])||null})),a!==z.y2&&(le((0,R.wK)({blockfolder:a,blockId:t.id})),le(L.VM.endpoints.getBlocks.initiate({...vt,folderTag:a||null}))),Ve(),$()})).catch((e=>console.warn("err",e)))},Tt=[{width:"26%",title:se("Block"),dataIndex:"title",render:(e,t,o)=>(0,O.jsx)(S.N_,{to:V(pe,t),children:e})},{width:"14%",title:se("Type"),dataIndex:"type",render:(e,t,o)=>e},{width:"20%",title:se("Tags"),dataIndex:"blocktags",render:(e,t,o)=>(0,O.jsx)(i.A,{wrap:!0,size:10,children:e&&e.map((e=>{const t=null===G||void 0===G?void 0:G.find((t=>{var o;return(null===(o=t.id)||void 0===o?void 0:o.toString())===(null===e||void 0===e?void 0:e.toString())}));return t&&(0,O.jsx)(n.A,{color:ve.colorPrimary,style:{cursor:"pointer",borderRadius:6,marginRight:0},onClick:()=>U(null,t.id),children:t.name},t.id)||null}))})},{width:"3%",title:"",dataIndex:"lock",render:(e,t,o)=>{var s,a;return e&&(0,O.jsx)(g.A,{className:E()("lock-icon",{"lock-icon__disabled":!(he||ge||(null===(s=re.id)||void 0===s?void 0:s.toString())===(null===(a=t.author)||void 0===a?void 0:a.toString()))})})}},{width:"16%",title:se("Creator"),dataIndex:["_embedded","author"],render:(e,t,o)=>{var s;return(null===e||void 0===e||null===(s=e[0])||void 0===s?void 0:s.name)||""}},{width:"9%",title:ae("Created","block"),className:"nobr",dataIndex:"date",render:(e,t,o)=>(0,M.Yq)((0,A.A)(e),se),sorter:!0,sortOrder:(0,M.Np)(vt.order)},{width:"3%",title:"",dataIndex:"",key:"x",onCell:()=>({style:{padding:0}}),render:(e,t)=>{var o,s,a,l,i,n,d,c;const m=t.blockfolder[0]||null,u={icon:(0,O.jsx)(x.A,{style:{fontSize:18}}),label:se("New blocks"),key:z.y2,onClick:e=>Nt(e,t)},p=null===I||void 0===I?void 0:I.map((e=>({icon:(0,O.jsx)(v.A,{style:{fontSize:18}}),label:e.name,key:e.id,className:e.id,onClick:e=>Nt(e,t)}))),A=(null===p||void 0===p?void 0:p.filter((e=>!m||e.key!==m)))||[];m&&(null===A||void 0===A||A.unshift(u));let k=[];return(he||ge||(null===(o=re.id)||void 0===o?void 0:o.toString())===(null===(s=t.author)||void 0===s?void 0:s.toString()))&&!Re&&k.push({label:(0,O.jsx)(N.A,{element:t},"Lock"),icon:t.lock?(0,O.jsx)(f.A,{style:{fontSize:"16px"}}):(0,O.jsx)(g.A,{style:{fontSize:"16px"}})}),(he||ge||(null===(a=re.id)||void 0===a?void 0:a.toString())===(null===(l=t.author)||void 0===l?void 0:l.toString()))&&!Re&&A.length>0&&k.push({label:se("Transfer to folder"),icon:(0,O.jsx)(v.A,{style:{fontSize:"16px"}}),children:A}),!Re&&k.push({label:(0,O.jsx)(S.N_,{to:V(pe,t),children:se("Edit")}),icon:(0,O.jsx)(b.A,{style:{fontSize:"16px"}}),key:"Export",className:"em-analytics__block-enter"},{label:se("Clone"),key:"Clone",icon:(0,O.jsx)(_.A,{style:{fontSize:"16px"}}),className:"em-analytics__block-clone",disabled:Ee.isLoading,onClick:()=>Et(t)}),(he||ge||(null===(i=re.id)||void 0===i?void 0:i.toString())===(null===(n=t.author)||void 0===n?void 0:n.toString()))&&Re&&k.push({label:se("Recover"),icon:(0,O.jsx)(j.A,{style:{fontSize:"16px"}}),key:"Recover",onClick:()=>It(t)}),(he||ge||(null===(d=re.id)||void 0===d?void 0:d.toString())===(null===(c=t.author)||void 0===c?void 0:c.toString()))&&k.push({label:se("Remove"),icon:(0,O.jsx)(h.A,{style:{fontSize:"16px"}}),key:"Remove",className:"em-analytics__block-remove",style:{color:"#ff4d4f"},onClick:()=>Ct(t)}),(0,O.jsx)(r.A,{arrow:"true",placement:"bottomRight",menu:{items:k},trigger:["hover"],children:(0,O.jsx)("span",{className:"projects-table__actions",children:(0,O.jsx)(y.A,{})})})}}],[Bt,Lt]=(0,s.useState)(!1);return(0,s.useEffect)((()=>{var e;for(let t in ue)if(t||""===t||0===t.length){Lt(!0),wt({...ue,folderTag:a,page:1});break}(null!==(e=ue.tags)&&void 0!==e&&e.length||ue.name)&&wt({...ue,folderTag:a,page:1})}),[ue,le,a,Re,wt,o]),(0,O.jsxs)("div",{className:"project-blocks-page__list",children:[bt&&!(null!==St&&void 0!==St&&St.length)&&(0,O.jsx)(d.A,{active:!0}),_t&&(0,O.jsx)(c.A,{message:se("Error"),description:se("Error when receiving data. Try again (reload page) or contact support."),type:"error",showIcon:!0}),!bt&&!jt&&0===(null===St||void 0===St?void 0:St.length)&&(Bt||W>0?(0,O.jsx)(c.A,{message:se("Blocks not found"),description:"",type:"info",showIcon:!0}):a!==z.y2?(0,O.jsx)(c.A,{message:se("You don't have any blocks in this folder."),description:se("Add your first block to the folder..."),type:"info",showIcon:!0}):(0,O.jsx)(c.A,{message:se("You don't have any blocks yet."),description:se("Add your first block by clicking the Create a new block button."),type:"info",showIcon:!0})),(null===St||void 0===St?void 0:St.length)>0&&t===z.rl&&(0,O.jsx)(m.A,{rowKey:e=>e.id,bordered:!0,dataSource:St,columns:Tt,loading:jt||Be,onChange:(e,t,{order:o,field:s},{action:a})=>{"sort"===a&&wt(o?{page:vt.page||1,order:(0,M.gq)(o),orderby:s,pageSize:q}:{page:vt.page||1,pageSize:q})},showSizeChanger:!1,pageSize:q,pagination:{current:vt.page||1,total:kt,hideOnSinglePage:!0,showSizeChanger:!1,pageSize:q,position:["bottomLeft"],onChange:(t,o)=>wt({projectId:e,page:t,pageSize:o})}}),((null===St||void 0===St?void 0:St.length)>0||ft)&&t===z.Y$&&(0,O.jsxs)(O.Fragment,{children:[De&&(0,O.jsx)(d.A,{active:!0}),(jt||Be)&&(0,O.jsx)("div",{className:"project-blocks-page__loader",children:(0,O.jsx)(B.A,{small:!0})}),(0,O.jsx)("div",{className:"project-blocks-page__cards-grid",children:St&&St.map((e=>(0,O.jsx)(T.A,{element:e,setSearchFilters:U,isTrash:Re,foldersList:I,refetch:Ve,projectTags:G,foldersHandlers:{handleRemove:Ct,handleRecover:It,handleClone:Et,handlerChangeFolder:Nt}},e.id)))}),(0,O.jsx)(u.A,{current:vt.page||1,total:kt,hideOnSinglePage:!0,showSizeChanger:!1,pageSize:q,onChange:(t,o)=>wt({projectId:e,page:t,pageSize:o})})]})]})}},21731:(e,t,o)=>{o.d(t,{A:()=>te});o(92810);var s=o(33206),a=o(81e3),l=o(4800),i=o(43005),n=o(71157),r=o(64617),d=o(46312),c=o(63531),m=o(81304),u=o(44335),p=o(9452),h=o(20350),g=o(3625),x=o(10900),v=o(82013),f=o(65953),b=o(80925),_=o(55348),j=o(27071),y=o(60015),A=o(73259),k=o(66282),S=o(4907),w=o(45934),C=o(23287),I=o(59287),E=o(83953),N=o(57903),T=o(62303),B=o(86286),L=o(36404),R=o(32269),P=o(56991),F=o(47381),M=o(14598),D=o(58689),z=o(17581),O=o(93563),H=o(64936),V=o(62677),q=o(85163),$=o(76207),G=o(31844),X=o(32411),U=o(90070),W=o(85974),Y=o(90854),K=o(7205),Z=o(93982),J=o(13522),Q=o(44824),ee=o(70082);const te=({email:e,autoSaveEmailResult:t,autoSaveBlockResult:o})=>{var te,oe,se,ae,le,ie,ne,re;const{__:de,_x:ce}=(0,C.s9)(),me=(0,w.wA)(),[ue]=(0,d.mI)(),[pe]=(0,c.dS)();let he=(0,r.Zp)();const{owner:ge,admin:xe}=(0,G.A)(),ve=(0,w.d4)(B.C1),{modal:fe}=s.A.useApp(),be=(0,n.hN)(),{confirm:_e}=fe,je=(0,w.Pj)(),ye=(0,U.p6)(),Ae=(0,P.rD)(),{projectId:ke}=(0,r.g)(),Se=(0,Z.ml)(J.A.ON_EMAIL_CLONE_ID),we=(0,w.d4)(L.yN),[Ce]=(0,V.N)(),[Ie,Ee]=(0,z.Kh)(),{data:Ne}=(0,r.KC)(),{data:Te,refetch:Be}=(0,O.Jz)({parent:null===(te=Ne.folder)||void 0===te?void 0:te[0]},{skip:!(null!==(oe=Ne.folder)&&void 0!==oe&&oe[0])}),Le=()=>null===e.title?de("New email title"):e.title,Re=(0,X.fn)(),Pe=(t,o=(null===Re||void 0===Re?void 0:Re.getValue())||"")=>Ie({title:Le(),project:null===Ne||void 0===Ne?void 0:Ne.id,subject:e.subject,description:e.description,html:o,parent_email:e.parent_email||q.iU}).then((e=>{if(e.error)return be.error({message:(0,ee.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.code}}),description:(0,ee.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.message}}),placement:"bottomRight"}),Promise.reject();{const o=e.data;return t(o,(()=>je.dispatch(z.GY.endpoints.deleteEmail.initiate({id:o.id,force:!0}))))}})),Fe=(e=1)=>((e=1)=>Pe(((t,o)=>({href:(0,I.W)(q.Tm,(null===Ne||void 0===Ne?void 0:Ne.id)||0,t.id,void 0,!1,e),dispose:o}))))(e).then((({href:e,dispose:t})=>(0,D.SR)(e).finally(t))),Me=async e=>{const t=e.querySelectorAll("[em-operation=exportAsPicture]"),o=new Map;for(let a=0,l=t.length;a<l;a++){const e=t[a];e.setAttribute("em-export-id",a),o.set(`[em-export-id='${a}']`,e)}if(o.size)try{const{data:t,dispose:a}=await((e,t,o=2)=>Pe(((t,s)=>({data:e.map((e=>({selector:e,href:(0,I.W)(q.Tm,(null===Ne||void 0===Ne?void 0:Ne.id)||0,t.id,void 0,!1,o,e)}))),dispose:s})),t))([...o.keys()],(0,Y.b6)(e),2);try{const s=t.map((async({href:t,selector:s},a)=>{const l=o.get(s);if("TD"===l.tagName){l.removeAttribute("style");for(const e of[...l.classList])e.startsWith("em-mob-")&&l.classList.remove(e)}const i=await(async(e,t)=>{var o;const s="string"===typeof e?null===(o=await ue({url:e}))||void 0===o?void 0:o.data:e;if(t.split(".").length<2){const e=u.extension(s.type);e&&(t=`${t}.${e}`)}const a=new File([s],t.toLowerCase()),l=await pe({user_id:ve.id,folder:Ne.id,file:a});var i,n,r;return l.error||400===(null===(i=l.data.data)||void 0===i?void 0:i.status)?"string"===typeof e?e:"":null===(n=l.data)||void 0===n||null===(r=n[0])||void 0===r?void 0:r.file_url})(t,`${a}-${l.tagName.toLowerCase()}.png`),n=parseInt(getComputedStyle(l).width);let r=new Image(n);r.setAttribute("border","0"),r.setAttribute("style",`display: block; width: 100%; max-width: ${n}px;`),r.alt="",r.src=i;const d=l.querySelector("a");if(d){const t=e.createElement("a");t.setAttribute("target","_blank"),t.setAttribute("href",d.getAttribute("href")),t.appendChild(r),r=t}if("TD"===l.tagName){const e=l.cloneNode();e.removeAttribute("em-operation"),e.appendChild(r),r=e}l.replaceWith(r)}));await Promise.all(s)}catch(s){console.log(s)}finally{a()}}catch(s){console.log(s)}},De=t=>{var o;if("0"===(null===Ne||void 0===Ne?void 0:Ne.limits.preview_limit)&&ke&&(null===ve||void 0===ve||null===(o=ve.counters)||void 0===o?void 0:o.emails_counter)>2&&!t.querySelector(".em-powered-logo")){const o="https://cdn.useblocks.io/blocks/powered.png",s="https%3A%2F%2Fuseblocks.io",a=`<a href="${`https://racs.rest/v3/link?app=useblocks&project=${ke}&email=${e.id}&link=${s}`}" target="_blank"><img src="https://racs.rest/v3/pixel/123.png?image=${o}&project=${ke}&email=${e.id}" width="150" height="50" border="0" alt="" style="display: inline-block; width: 100%; max-width: 150px;"></a>`;t.querySelector("body > table:last-child > tbody:last-child > tr:last-child, body > div > table:last-child > tbody:last-child > tr:last-child")&&t.querySelector("body > table:last-child > tbody:last-child > tr:last-child, body > div > table:last-child > tbody:last-child > tr:last-child").insertAdjacentHTML("afterend",`<tr em="block" class="em-powered-logo">\n <td align="center" bgcolor="#FFFFFF">${a}</td>\n </tr>`)}return t},ze=t=>{(0,F.d)({event:"click",action:"export_email",export_type:"HTML"});const o=document.querySelector(".email-preview"),s=getComputedStyle(o);(0,D.PJ)(null===Re||void 0===Re?void 0:Re.getValue(),[s.width],e.utm_parameters,(async e=>{await Me(e),De(e),await(0,Q.e)(e,t)})).then((e=>{const t=new Blob([e],{type:"text/html;charset=utf-8"});(0,$.saveAs)(t,`${Le()}.html`)})).catch((e=>console.log(e)))},Oe=t=>{(0,F.d)({event:"click",action:"export_email",export_type:"Clipboard"});const o=document.querySelector(".email-preview"),s=getComputedStyle(o);(0,D.PJ)(null===Re||void 0===Re?void 0:Re.getValue(),[s.width],e.utm_parameters,(async e=>{await Me(e),De(e),await(0,Q.e)(e,t)})).then((e=>navigator.clipboard.writeText(e).then((function(){(0,R.wB)(de("The email has been copied to the clipboard."),be)})))).catch((e=>console.log(e)))},He=e=>new Promise(((t,o)=>{fetch(e).then((e=>t(e.blob())),(()=>(e=>{const t=ye.get(q.A9.em_token);return fetch(`https://app.useblocks.io/api/wp-json/cors-proxy/v1/get?url=${encodeURIComponent(e)}`,{headers:{authorization:`Bearer ${t}`}}).then((e=>e.blob()))})(e).then(t,o))).catch((()=>{}))})),Ve=t=>{(0,F.d)({event:"click",action:"export_email",export_type:"ZIP"});const o=document.querySelector(".email-preview"),s=getComputedStyle(o);(0,D.Mp)(null===Re||void 0===Re?void 0:Re.getValue(),[s.width],e.utm_parameters,He,(async e=>{await Me(e),De(e),await(0,Q.e)(e,t)})).then((e=>(0,$.saveAs)(e,`${Le()}.zip`))).catch((e=>console.log(e)))},qe=()=>{e.isNew?(q.EW.isPlugin||he(`/projects/${Ne.id}/emails`),(0,R.wB)(de("The draft of the email has been deleted."),be)):$e(e,he)},$e=(e,t)=>{_e({maskClosable:!0,centered:!0,title:ce("Are you sure to delete \u201c","email")+e.title+de("\u201d email?"),icon:(0,ee.jsx)(p.A,{style:{color:"#ff4d4f"}}),okText:de("Yes"),cancelText:de("No"),onOk:()=>((e,t)=>je.dispatch(z.GY.endpoints.deleteEmail.initiate(e.id)).then((o=>{o.error&&(0,R.p6)(o,be),e.project&&!q.EW.isPlugin&&t(`/projects/${e.project}/emails`),(0,R.wB)(de("The email \u201c")+o.data.title+ce("\u201d was successfully removed.","email"),be)})))(e,t)})},Ge=async e=>{const t=e[0];try{const e=await(0,M.q2)(t,(async(e,t)=>{let o;if("string"===typeof e)try{var s;e=(0,K.A)(e),o=null===(s=await ue({url:e}))||void 0===s?void 0:s.data}catch(d){return e}else o=e;if(t.split(".").length<2){const e=u.extension(o.type);e&&(t=`${t}.${e}`)}const a=new File([o],t.toLowerCase()),l=await pe({user_id:ve.id,folder:Ne.id,file:a});var i,n,r;if(!l.error&&400!==(null===(i=l.data.data)||void 0===i?void 0:i.status))return null===(n=l.data)||void 0===n||null===(r=n[0])||void 0===r?void 0:r.file_url;return"string"===typeof e?e:""}),(e=>{e.title||(e.title=(0,D.Ay)(t.name)[0])}));Re.setValue(e)}catch(o){const e=o instanceof Error?o.message:o;be.error({message:(0,ee.jsx)("div",{dangerouslySetInnerHTML:{__html:e}}),placement:"bottomRight"})}(0,F.d)({event:"upload_file",action:"import_email"})};let Xe=[];Ae.emailDropdownMenuClone&&Xe.push({label:de("Clone"),icon:(0,ee.jsx)(h.A,{style:{fontSize:"16px"}}),key:"Clone",className:"em-analytics__email-clone",disabled:Ee.isLoading,onClick:async()=>{if(e.isNew)be.warning({message:de("To create a copy, you need to save the email."),placement:"bottomRight"});else{var t,o,s,a,l;if((await Se.fire(e)).some((e=>!1===e)))return;Ie({title:(0,R.fq)(e.title),project:null===Ne||void 0===Ne?void 0:Ne.id,description:e.description,html:(0,R.el)((null===Re||void 0===Re?void 0:Re.getValue())||"",e.title),parent_email:e.parent_email||q.iU,common_styles:e.common_styles||"",utm_parameters:{utm_source:null===(t=e.utm_parameters)||void 0===t?void 0:t.utm_source,utm_medium:null===(o=e.utm_parameters)||void 0===o?void 0:o.utm_medium,utm_campaign:null===(s=e.utm_parameters)||void 0===s?void 0:s.utm_campaign,utm_term:null===(a=e.utm_parameters)||void 0===a?void 0:a.utm_term,utm_content:null===(l=e.utm_parameters)||void 0===l?void 0:l.utm_content},emailtags:e.emailtags,folder:e.folder}).then((t=>{t.error?be.error({message:(0,ee.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.code}}),description:(0,ee.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.message}}),placement:"bottomRight"}):(he(`/projects/${Ne.id}/emails/${t.data.id}`),be.success({message:de("The copy of email \u201c")+e.title+de("\u201d was successfully created."),placement:"bottomRight"}),Te&&Be())}))}}}),Ae.emailDropdownMenuImport&&Xe.push({label:ce("Import","verb"),icon:(0,ee.jsx)(g.A,{style:{fontSize:"16px"}}),key:"Import",className:"em-analytics__editor-page__import",onClick:()=>{(0,F.d)({event:"click",action:"import_email"}),(0,M.QM)("application/zip, message/rfc822, text/html",Ge)}}),(ge||xe||(null===(se=ve.id)||void 0===se?void 0:se.toString())===(null===(ae=e.author)||void 0===ae?void 0:ae.toString()))&&(Ae.emailDropdownMenuLock&&Xe.push({label:(0,ee.jsx)(N.A,{element:e},"Lock"),icon:e.lock?(0,ee.jsx)(x.A,{style:{fontSize:"16px"}}):(0,ee.jsx)(v.A,{style:{fontSize:"16px"}}),disabled:e.isNew}),Ae.emailDropdownMenuRemove&&Xe.push({label:de("Remove"),icon:(0,ee.jsx)(p.A,{style:{fontSize:"16px"}}),key:"Remove",className:"em-analytics__email-remove",style:{color:"#ff4d4f"},onClick:qe}));const Ue=e.isAmp;let We=[];return We.push({key:"html",label:de("Code"),icon:(0,ee.jsx)(f.A,{style:{fontSize:"16px"}}),...Ue?{children:[{key:"\u0441ode_html",label:de("AMP"),onClick:()=>ze("amp")},{key:"html_amp",label:de("HTML"),onClick:()=>ze("html")}]}:{onClick:()=>ze()}},{key:"zip",label:de("ZIP"),icon:(0,ee.jsx)(b.A,{style:{fontSize:"16px"}}),...Ue?{children:[{key:"zip_html",label:de("AMP"),onClick:()=>Ve("amp")},{key:"zip_amp",label:de("HTML"),onClick:()=>Ve("html")}]}:{onClick:()=>Ve()}},{key:"clipboard",label:de("Clipboard"),icon:(0,ee.jsx)(_.A,{style:{fontSize:"16px"}}),...Ue?{children:[{key:"clipboard_html",label:de("AMP"),onClick:()=>Oe("amp")},{key:"clipboard_amp",label:de("HTML"),onClick:()=>Oe("html")}]}:{onClick:()=>Oe()}},{key:"webhook",icon:(0,ee.jsx)(T.A,{icon:"WebHook",style:{fontSize:"16px"}}),label:de("WebHook"),onClick:()=>{we.webhook?((0,F.d)({event:"click",action:"export_email",export_type:"webhook"}),Ce({url:we.webhook,body:(0,m.E)(e,je)}).then((e=>{e.error?200===e.error.originalStatus?be.success({message:de("Success!"),description:de("WebHook successfully sent!"),placement:"bottomRight"}):be.error({message:(0,ee.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.status}}),description:(0,ee.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.error}}),placement:"bottomRight"}):be.success({message:de("Success!"),description:de("WebHook successfully sent!"),placement:"bottomRight"})}))):(me((0,H.YF)("webhooksettings")),me((0,H.qf)(q.lx.EDIT_PROJECT_MODAL)))}},{key:"outlook",icon:(0,ee.jsx)(j.A,{style:{fontSize:"16px"}}),label:de("Outlook"),onClick:()=>(t=>{(0,F.d)({event:"click",action:"export_email",export_type:"Outlook"});const o=document.querySelector(".email-preview"),s=getComputedStyle(o),a=async(e,t)=>{if("amp"===t){for(const t of e.querySelectorAll(".em-amp-show-disabled"))t.remove();await(0,W.Sc)(e,{mappedTags:{script:"___script"}})}else if("html"===t){for(const t of e.querySelectorAll(".em-amp-show-only"))t.remove();(0,W.Km)(e,{mappedTags:{script:"___script"}})}await Me(e),De(e)};(0,D.pH)(e.title,null===Re||void 0===Re?void 0:Re.getValue(),[s.width,s.height],e.utm_parameters,t?{"text/html;charset=utf-8":e=>a(e,"amp"),"text/x-amp-html;charset=utf-8":e=>a(e,"html")}:a).then((e=>{const t=new Blob([e],{type:"text/html;charset=utf-8"});(0,$.saveAs)(t,`${Le()}.eml`)})).catch((e=>console.log(e)))})(Ue)},{key:"pdf",icon:(0,ee.jsx)(y.A,{style:{fontSize:"16px"}}),label:de("PDF"),onClick:()=>Fe(2).then((e=>(0,D.EB)(e,.375))).then((e=>e.save(`${Le()}.pdf`))).then((0,F.d)({event:"click",action:"export_email",export_type:"PDF"}))},{key:"img",icon:(0,ee.jsx)(A.A,{style:{fontSize:"16px"}}),label:de("PNG"),onClick:()=>Fe(1).then(D.gZ).then((e=>(0,$.saveAs)(e,`${Le()}.png`))).then((0,F.d)({event:"click",action:"export_email",export_type:"Image"}))}),(0,ee.jsx)(ee.Fragment,{children:(0,ee.jsxs)(a.A,{children:[Ae.emailDropdownMenuEnabled&&(0,ee.jsx)(l.A,{arrow:{pointAtCenter:!0},placement:"bottom",menu:{items:Xe},children:(0,ee.jsx)(i.Ay,{type:"default",block:!1,className:"email-page-header__btn email-page-header__btn_extra",onClick:()=>{},children:(0,ee.jsx)(k.A,{})})},"Actions"),Ae.emailExportEnabled&&(0,ee.jsx)(l.A,{arrow:{pointAtCenter:!0},placement:"bottom",menu:{items:We},children:(0,ee.jsx)(i.Ay,{className:"em-analytics__email-page__export",type:"default",icon:(0,ee.jsx)(S.A,{}),children:de("Export")},"Export")},"Export"),!e.hasOwnProperty("type")&&(0,ee.jsx)(I.A,{autoSaveEmailResult:t,email:e,isEditableRights:ge||xe||(null===(le=ve.id)||void 0===le?void 0:le.toString())===(null===(ie=e.author)||void 0===ie?void 0:ie.toString())},"Save"),!!e.hasOwnProperty("type")&&(0,ee.jsx)(E.A,{block:e,isEditableRights:ge||xe||(null===(ne=ve.id)||void 0===ne?void 0:ne.toString())===(null===(re=e.author)||void 0===re?void 0:re.toString()),autoSaveBlockResult:o},"Save")]})})}},30961:(e,t,o)=>{o.d(t,{A:()=>C});var s=o(92810),a=o(95838),l=o(12280),i=o(2018),n=o(55039),r=o(81662),d=o(77406),c=o(81500),m=o(45934),u=o(64617),p=o(23287),h=o(84568),g=o(17581),x=o(55701),v=o(7760),f=o(65983),b=o(32269),_=o(85163),j=o(70082);const{useToken:y}=a.A,{name:A,type:k,tags:S}={name:"name",type:"type",tags:"tags"},w={[A]:"",[k]:[],[S]:[]},C=({isBlocks:e=!1,templateEmailId:t=!1})=>{const{__:o}=(0,p.s9)(),{projectId:a}=(0,u.g)(),[C]=l.A.useForm(),{data:I}=(0,x.h1)(),E=(0,m.wA)(),N=(0,m.d4)(v.b9),T=(0,m.d4)(f.CT),{token:B}=y(),L=(0,m.Pj)(),R=e?N:T,{isSuccess:P,data:F}=h.Nq.endpoints.getProject.select(+a)(L.getState(),{skip:t}),{isSuccess:M,data:D}=(0,g.sl)(+t,{skip:!t}),z=(0,s.useCallback)((()=>{E(e?(0,v.om)({}):(0,f.om)({}))}),[E,e]);(0,s.useEffect)((()=>{z()}),[z]),(0,s.useEffect)((()=>{}),[M,D,t]),(0,s.useEffect)((()=>{}),[P,F,e,t]);const[O,H]=(0,s.useState)([]);let V;(0,s.useEffect)((()=>{if(I){const e=I.schema.properties.acf.properties.type.items.enum;let t=[];for(let s in e)t.push({label:o(_.jg[e[s]]),value:e[s]});H(t)}}),[I,o]);const[q,$]=(0,s.useState)(!1);return(0,s.useEffect)((()=>{const o=t?M&&(0,b._q)(D,_.zh).filter((e=>{var t;return null===R||void 0===R||null===(t=R.tags)||void 0===t?void 0:t.includes(e.id)})).map((e=>e.name))||[]:P&&(0,b._q)(F,e?_.YY:_.zh).filter((e=>{var t;return null===R||void 0===R||null===(t=R.tags)||void 0===t?void 0:t.includes(e.id)})).map((e=>e.name))||[];C.setFieldsValue({tags:o})}),[P,R,e,C,F,M,D,t]),(0,j.jsx)("div",{className:"cards-search",children:(0,j.jsx)(l.A,{form:C,name:"cards_search_form",initialValues:{...w},onValuesChange:o=>{const s=Object.keys(o)[0],a=C.getFieldsValue(!0);switch(s){case S:const l=t?(0,b._q)(D,_.zh).filter((e=>o[s].includes(e.name))).map((e=>e.id))||null:(0,b._q)(F,e?_.YY:_.zh).filter((e=>o[s].includes(e.name))).map((e=>e.id))||null;E(e?(0,v.om)({...R,tags:l}):(0,f.om)({...R,tags:l}));break;case k:E(e?(0,v.om)({...R,type:a.type||null}):(0,f.om)({...R,type:a.type||null}));break;case A:V&&window.clearTimeout(V),V=window.setTimeout((function(){E(e?(0,v.om)({...R,name:a.name}):(0,f.om)({...R,name:a.name}))}),100)}},autoComplete:"off",children:(0,j.jsxs)(i.A,{wrap:!1,gutter:0,children:[(0,j.jsx)(l.A.Item,{className:"cards-search__by-title",name:A,children:(0,j.jsx)(n.A,{placeholder:o("Search by title"),allowClear:!0,bordered:!1,size:"large",prefix:(0,j.jsx)(d.A,{className:"cards-search__search-icon, input-icon",style:{cursor:"pointer",fontSize:20}})})}),e&&(0,j.jsx)(l.A.Item,{className:"cards-search__type-select",name:k,rules:[{message:o("Please choose the block type")}],children:(0,j.jsx)(r.A,{placeholder:o("Filter by type"),options:O,getPopupContainer:e=>e.parentNode,suffixIcon:(0,j.jsx)(c.A,{style:{fontSize:"16px",color:B.colorText},onClick:()=>$(!q),className:"input-icon"}),allowClear:!0,open:q,onDropdownVisibleChange:e=>{$(e)}})})]})})})}},26238:(e,t,o)=>{o.d(t,{A:()=>v});var s=o(92810),a=o(2018),l=o(7744),i=o(43005),n=o(71086),r=o(64588),d=o(55039),c=o(38883),m=o.n(c),u=o(45934),p=o(23287),h=o(62303),g=o(65983),x=(o(23081),o(70082));const v=({id:e,onChange:t,value:o,alignRight:c,placeholder:v,isDisabled:f=!1,usedColors:b=[],codeMode:_=!1})=>{const{__:j}=(0,p.s9)(),y=(0,u.d4)(g.iy),[A,k]=(0,s.useState)(!0),S=(0,s.useRef)(null),w=(0,s.useRef)(null),C=(0,s.useRef)(t);(0,s.useEffect)((()=>{"undefined"===typeof EyeDropper&&k(!1)}),[o]);const I=async()=>{try{if("undefined"===typeof EyeDropper)return void alert("Your browser does not support the EyeDropper API.");const e=new EyeDropper,t=(await e.open()).sRGBHex.toUpperCase();C.current&&C.current(t),S.current&&(S.current.style.backgroundColor=t),w.current&&(w.current.input.value=t)}catch(e){console.error("Error picking the color: ",e)}};return(0,x.jsx)("div",{className:"color-picker-input",children:(0,x.jsxs)("div",{className:m()("color-picker-input__control-wrap",{"color-picker-input__empty":!o}),children:[(0,x.jsx)(r.A,{disabledAlpha:!0,format:"hex",defaultFormat:"hex",getPopupContainer:e=>e.closest(_?".selected_text_common_form_mobile":".email-pane__collapse-wrapper"),className:"color-picker-input__btn-wrap",rootClassName:"verticalColorpicker",value:""===o?null:o,onChange:e=>{const t=e.toHexString().toUpperCase();C.current&&C.current(t),S.current&&(S.current.style.backgroundColor=t),w.current&&(w.current.input.value=t)},panelRender:(e,{components:{Picker:t,Presets:o}})=>(0,x.jsxs)(a.A,{justify:"space-between",wrap:!1,children:[(0,x.jsxs)(l.A,{flex:"auto",children:[(0,x.jsx)(t,{}),A&&(0,x.jsx)(i.Ay,{onClick:I,size:"small",style:{position:"absolute",top:215,left:179,height:28,width:28,padding:0,zIndex:2,minWidth:"auto",fontSize:18},children:(0,x.jsx)(h.A,{icon:"Colorize",style:{position:"relative",top:-2}})})]}),(0,x.jsx)(n.A,{type:"vertical",style:{height:"auto"}}),(0,x.jsx)(l.A,{span:8,children:(0,x.jsx)(o,{})})]}),presets:[{label:j("Used"),colors:b},{label:j("Recommended"),colors:["#000000","#595959","#BFBFBF","#E5E5E5","#F5F5F5","#F5222D","#FA8C16","#FADB14","#8BBB11","#52C41A","#13A8A8","#1677FF","#2F54EB"]}]}),""===o&&(0,x.jsx)("div",{className:"color-picker-input__empty-bg"}),(0,x.jsx)(d.A,{allowClear:!0,id:e,disabled:y||f,className:"color-picker-input__control",placeholder:v||j("Select color"),value:o,ref:w,onChange:t})]})})}},26254:(e,t,o)=>{o.d(t,{A:()=>_t});var s=o(92810),a=o(95838),l=o(20648),i=o(33206),n=o(45934),r=o(49497),d=o(64617),c=o(19817),m=o(59297),u=o(12280),p=o(71086),h=o(55039),g=o(43005),x=o(81e3),v=o(96492),f=o(86889),b=o(71157),_=o(82013),j=o(9588),y=o(94822),A=o(38883),k=o.n(A),S=o(23287),w=o(29993),C=o(86524);var I=o(70082);var E=o(83351),N=o(15865),T=o(39990),B=o(1779),L=o(141),R=o(85163),P=o(47381),F=o(90070);const M="sign_in_form",D="sign_up_form",z=({className:e})=>{const{__:t}=(0,S.s9)(),o=(0,d.Zp)(),a=(0,n.wA)(),{search:l}=(0,d.zy)(),[i]=(0,T.Lj)(),[r]=(0,E.uX)(),[c,m]=(0,s.useState)(M),A=(0,b.hN)(),z=(0,F.p6)(),[O]=(0,B.p)(),[H]=(0,L.x)(),V={name:"password",rules:[{required:!0,message:t("Please enter your password")}],placeholderForCreate:t("Create a password"),placeholderForSignIn:t("Enter your password"),prefix:(0,I.jsx)(_.A,{style:{fontSize:16,color:"#1890FF"}})},q={name:"email",rules:[{required:!0,message:t("Please enter your email address"),type:"email"}],placeholder:t("Enter your email"),prefix:(0,I.jsx)(j.A,{style:{fontSize:16,color:"#1890FF"}})},$=[{name:M,tabTitle:t("Sign In"),fields:[q,V],initialValues:{remember:!1,email:"",password:"",rememberMe:{valuePropName:"checked"}}},{name:D,tabTitle:t("Sign Up"),fields:[q],initialValues:{remember:!1,email:"",password:"",privacyPolicy:!1,newsletterConsent:!1}}];(0,s.useEffect)((()=>{null!==l&&void 0!==l&&l.startsWith("?signup")&&m(D)}),[l]);const G=e=>{W[M].onFinish(e,!0)},[X,U]=(0,s.useState)(""),W={[M]:{onFinish:(e,t=!1)=>{U(R.F5),a(T.Q2.util.resetApiState());(t?H(e):r({username:e.email,password:e.password})).then((t=>{var o;if(t.error)throw A.error({message:(0,I.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.code}}),description:(0,I.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.message}}),placement:"bottomRight"}),U(R.ff),w.wd("Something went wrong in auth 1",{extra:t.error.data}),new Error(R.ff);if(401===(null===(o=t.data.data)||void 0===o?void 0:o.status))throw A.error({message:(0,I.jsx)("div",{dangerouslySetInnerHTML:{__html:t.data.code}}),description:(0,I.jsx)("div",{dangerouslySetInnerHTML:{__html:t.data.message}}),placement:"bottomRight"}),U(R.ff),w.wd("Something went wrong in auth 1 because of no email in yan or gmail",{extra:t.data}),new Error(R.ff);z.set(R.A9.em_token,t.data.token,{expires:e.rememberMe?30:1});let s=t;return a(T.Q2.endpoints.getMe.initiate()).then((e=>({result:e,tokenData:s})))})).then((e=>{var s,l,i,n,r;let{result:d,tokenData:c}=e;var m;if(d.error)throw A.error({message:(0,I.jsx)("div",{dangerouslySetInnerHTML:{__html:d.error.data.code}}),description:(0,I.jsx)("div",{dangerouslySetInnerHTML:{__html:d.error.data.message}}),placement:"bottomRight"}),U(R.ff),w.wd("Something went wrong in auth 2",{extra:null===(m=d.error)||void 0===m?void 0:m.data}),new Error(R.ff);const u=z.get(R.A9.promocode);u&&(z.remove(R.A9.promocode),a(N.So.endpoints.checkPromo.initiate({code:u,type:"by_link"})));const p=d.data.last_used_project?`/projects/${d.data.last_used_project}/emails`:"/projects";o(p,{replace:!0}),(0,P.d)({type:t?"Google":"Default",event:"submit_form",action:t&&null!==(s=c.data)&&void 0!==s&&s.is_reg?"registration":"authorization",user_email:null===d||void 0===d||null===(l=d.data)||void 0===l?void 0:l.email,carrotquest_hash:null===d||void 0===d||null===(i=d.data)||void 0===i?void 0:i.carrotquest_hash,user_id:null===d||void 0===d||null===(n=d.data)||void 0===n?void 0:n.id,email_subscription_consent:null===d||void 0===d||null===(r=d.data)||void 0===r?void 0:r.email_subscription_consent})})).catch((e=>{var t;U(R.ff),w.wd("Something went wrong in auth 3",{extra:null===(t=e.error)||void 0===t?void 0:t.data})}))},onFinishFailed:e=>{w.wd("onFinishFailed SIGN_IN",{extra:e})}},[D]:{onFinish:e=>{U(R.F5),a(T.Q2.util.resetApiState()),i({email:e.email,username:e.email,reg_type:"simple"}).then((e=>{if(e.error)throw A.error({message:(0,I.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.code}}),description:(0,I.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.message}}),placement:"bottomRight"}),U(R.ff),w.wd("onFinishFailed SIGN_UP",{extra:e.error}),new Error(R.ff);return 200===e.data.code&&A.success({message:(0,I.jsx)("div",{dangerouslySetInnerHTML:{__html:e.data.message}}),description:(0,I.jsx)("div",{dangerouslySetInnerHTML:{__html:e.data.is_simple_reg_message}}),placement:"bottomRight"}),e})).then((t=>{var o;if(t.error)throw A.error({message:(0,I.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.code}}),description:(0,I.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.message}}),placement:"bottomRight"}),U(R.ff),w.wd("Something went wrong in auth 4",{extra:null===(o=t.error)||void 0===o?void 0:o.data}),new Error(R.ff);return z.set(R.A9.em_token,t.data.token,{expires:1}),a(T.Q2.endpoints.editMe.initiate({privacy_policy_agreement:e.privacyPolicy,newsletter_consent:e.newsletterConsent}))})).then((e=>{var t,s,a,l,i;if(e.error)throw A.error({message:(0,I.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.code}}),description:(0,I.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.message}}),placement:"bottomRight"}),w.wd("Something went wrong in auth 5",{extra:null===(i=e.error)||void 0===i?void 0:i.data}),new Error(R.ff);o("/projects?status=newbie",{replace:!0}),(0,P.d)({type:"Default",event:"submit_form",action:"registration",user_email:null===e||void 0===e||null===(t=e.data)||void 0===t?void 0:t.email,carrotquest_hash:null===e||void 0===e||null===(s=e.data)||void 0===s?void 0:s.carrotquest_hash,user_id:null===e||void 0===e||null===(a=e.data)||void 0===a?void 0:a.id,email_subscription_consent:null===e||void 0===e||null===(l=e.data)||void 0===l?void 0:l.email_subscription_consent})})).catch((e=>{var t;w.wd("Something went wrong in auth 6",{extra:null===(t=e.error)||void 0===t?void 0:t.data}),U(R.ff)}))},onFinishFailed:e=>{w.wd("onFinishFailed SIGN_UP",{extra:e})}}};let Y=[];return $.map((e=>Y.push({label:e.tabTitle,key:e.name,className:"dfsdfsdf",children:(0,I.jsxs)(u.A,{name:e.name,initialValues:e.initialValues,onFinish:W[e.name].onFinish,onFinishFailed:W[e.name].onFinishFailed,autoComplete:"off",children:[(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(u.A.Item,{children:(0,I.jsx)(C.j,{onSuccess:G,shape:"circle",width:360})}),(0,I.jsx)(p.A,{plain:!0,children:t("or")})]}),e.fields.map((o=>(0,I.jsx)(u.A.Item,{style:{marginBottom:10},name:o.name,extra:e.name===D&&"password"===o.name&&t("At least 8 characters in both cases, including letters, numbers, and special characters."),validateTrigger:["onSubmit"],rules:"password"===o.name&&e.name===D?[{required:!0,message:t("Please enter your password")},()=>({validator:(e,o)=>o.length>=8&&/[0-9]/.test(o)&&/[a-z]/.test(o)&&/[A-Z]/.test(o)&&/\W+|_/g.test(o)?Promise.resolve():Promise.reject(new Error(t("The password does not meet the requirements:")))})]:o.rules,children:"password"===o.name?(0,I.jsx)(h.A.Password,{style:{border:"none",borderRadius:5,height:39,marginBottom:10},variant:"borderless",size:"large",disabled:X===R.F5,type:o.name,placeholder:e.name===M?o.placeholderForSignIn:o.placeholderForCreate,prefix:o.prefix,autoComplete:e.name===M?"":"new-password"}):(0,I.jsx)(h.A,{style:{border:"none",borderRadius:5,height:39},variant:"borderless",size:"large",disabled:X===R.F5,placeholder:o.placeholder,prefix:o.prefix,autoComplete:"off"})},o.name))),(0,I.jsx)(u.A.Item,{children:(0,I.jsx)(g.Ay,{style:{height:44,borderRadius:5,marginTop:10,marginBottom:16,fontSize:18},size:"large",loading:X===R.F5,block:!0,type:"primary",htmlType:"submit",className:e.name===M?"em-analytics__sign-in":"em-analytics__sign-up",children:e.tabTitle})}),e.name===M&&(0,I.jsx)(u.A.Item,{children:(0,I.jsxs)(x.A,{style:{display:"flex"},className:"auth-form__space",children:[(0,I.jsx)(u.A.Item,{name:"rememberMe",valuePropName:"checked",noStyle:!0,children:(0,I.jsx)(v.A,{disabled:X===R.F5,children:t("Remember me")})}),(0,I.jsx)(y.N_,{to:"/recover-password",children:t("Forgot your password?")})]})}),e.name===D&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(u.A.Item,{name:"privacyPolicy",valuePropName:"checked",className:"auth-form__checkbox auth-form__checkbox_pp",rules:[{validator:(e,o)=>o?Promise.resolve():Promise.reject(new Error(t("Please accept the agreement")))}],children:(0,I.jsxs)(v.A,{disabled:X===R.F5,children:[t("I agree to the")," ",(0,I.jsx)("a",{href:"https://useblocks.io/privacy-policy/",target:"_blank",rel:"noopener noreferrer",children:t("Privacy Policy.")})]})}),(0,I.jsx)(u.A.Item,{name:"newsletterConsent",valuePropName:"checked",className:"auth-form__checkbox",children:(0,I.jsx)(v.A,{disabled:X===R.F5,className:"em-analytics__receive-updates-blocks",children:t("I would like to receive updates from Blocks.")})})]})]})}))),(0,I.jsxs)("div",{className:k()("auth-form",{[e]:e}),children:[!1,(0,I.jsx)(f.A,{activeKey:c,className:"auth-form__tabs",defaultActiveKey:c,onChange:e=>m(e),items:Y})]})},O=()=>(0,I.jsx)(m.A,{className:"auth-page",children:(0,I.jsx)(z,{className:"auth-page__form"})}),H=()=>((0,s.useEffect)((()=>{window.YaSendSuggestToken(`https://${document.location.host}/auth`,{flag:!0})}),[]),(0,I.jsx)(I.Fragment,{}));var V=o(79381),q=o(36852),$=o(24420),G=o(44338),X=o(32983),U=o(21999),W=o(4519),Y=o(41919),K=o(76662),Z=o(66726),J=o(2018),Q=o(7744),ee=o(58013),te=o(98655),oe=o(30961),se=o(20757),ae=o(32269);const{Content:le}=Y.A,{Paragraph:ie}=K.A,ne=()=>{const{__:e}=(0,S.s9)(),{projectId:t,emailId:o}=(0,d.g)(),a=(0,F.p6)();let l=(0,d.Zp)();const i=a.get(R.A9.em_template_email)||o;(0,s.useEffect)((()=>{document.body.classList.remove("editor")}),[]);const n=(0,I.jsx)(I.Fragment,{children:(0,I.jsxs)(x.A,{size:10,children:[(0,I.jsx)(Z.A,{title:e("To emails"),placement:"left",children:(0,I.jsx)(g.Ay,{type:"text",icon:(0,I.jsx)(ee.A,{}),onClick:()=>(0,ae.XZ)(l,`/projects/${t}`),shape:"circle"})}),(0,I.jsx)(ie,{className:"ant-page-header-heading-title",children:e("Select email template")}),(0,I.jsx)(oe.A,{isBlocks:!1,templateEmailId:i})]})}),r=(0,I.jsx)(I.Fragment,{});return(0,I.jsxs)(Y.A,{className:"template-page",children:[(0,I.jsx)(se.A,{leftBlock:n,rightBlock:r}),(0,I.jsx)(le,{className:"template-page__container",children:(0,I.jsx)("div",{className:"template-page__content container",children:(0,I.jsx)(J.A,{gutter:50,children:(0,I.jsx)(Q.A,{span:24,children:(0,I.jsx)(te.A,{projectId:t,emailsView:R.Y$,createPage:!0})})})})})]})};var re=o(19263),de=o(24239),ce=o(85879),me=o(25072),ue=o(72981),pe=o(77242),he=o(4800),ge=o(9452),xe=o(20350),ve=o(10900),fe=o(85677),be=o(66282),_e=o(83953),je=o(57903),ye=o(2491),Ae=o(55701),ke=o(7760),Se=o(47358),we=o(65983),Ce=o(87790),Ie=o(86286),Ee=o(32411),Ne=o(31844),Te=o(22197);const{Paragraph:Be}=K.A,{useToken:Le}=a.A,Re=({block:e,autoSaveBlockResult:t})=>{var o,s,a,l,r,c;const{__:m,_x:u}=(0,S.s9)();let p=(0,n.wA)(),h=(0,d.Zp)();const v=(0,n.d4)(Ie.C1),{modal:f}=i.A.useApp(),j=(0,b.hN)(),{confirm:y}=f,{token:A}=Le(),w=(0,n.d4)(Se.yy),C=e.hasOwnProperty("type")?R.IE:R.Tm,E=(0,n.d4)(we.qX),N=(0,n.d4)(ke.qX),T=C===R.Tm?E:N,B=(0,n.d4)(Se.Fv),{data:L}=(0,d.KC)(),{owner:P,admin:F}=(0,Ne.A)(),M=(0,n.Pj)(),D=(e,t)=>{y({maskClosable:!0,centered:!0,title:u("Are you sure you want to delete the \u201c","block")+e.title+m("\u201d block?"),icon:(0,I.jsx)(ge.A,{}),okText:m("Yes"),cancelText:m("No"),onOk:()=>((e,t)=>M.dispatch(Ae.VM.endpoints.deleteBlock.initiate(e.id)).then((o=>{o.error&&j.fromError("BLOCK_REMOVING_ERROR",(0,b.x_)(e),o.error),t(`/projects/${e.project}/blocks`),j.success({id:"BLOCK_REMOVING_SUCCESS",message:m("The block \u201c")+o.data.title+u("\u201d was successfully removed.","block"),data:(0,b.x_)(e)})})))(e,t)})},[z,O]=(0,Ae.pP)(),H=(0,Ee.fn)();let V=[];V.push({label:m("Clone"),icon:(0,I.jsx)(xe.A,{style:{fontSize:"16px"}}),key:"Clone",className:"em-analytics__block-clone",disabled:O.isLoading,onClick:()=>{e.isNew?j.warning({id:"COPY_NOT_SAVED",payload:e,message:m("To create a copy, you need to save the block."),placement:"bottomRight"}):z({title:(0,ae.fq)(e.title),blocktags:e.blocktags,project:L.id,subject:e.subject,description:e.description,html:(null===H||void 0===H?void 0:H.getValue())||"",type:e.type?e.type:"Other"}).then((t=>{t.error?j.error({id:"BLOCK_CLONING_ERROR",data:(0,b.x_)(e),innerException:t.error,message:(0,I.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.code}}),description:(0,I.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.message}}),placement:"bottomRight"}):(h(`/projects/${L.id}/blocks/${t.data.id}`),j.success({id:"BLOCK_CLONING_SUCCESS",data:(0,b.x_)(e),message:m("The copy of block \u201c")+e.title+u("\u201d was successfully created.","block"),placement:"bottomRight"}))}))}}),(P||F||(null===(o=v.id)||void 0===o?void 0:o.toString())===(null===(s=e.author)||void 0===s?void 0:s.toString()))&&V.push({label:(0,I.jsx)(je.A,{element:e},"Lock"),icon:e.lock?(0,I.jsx)(ve.A,{style:{fontSize:"16px"}}):(0,I.jsx)(_.A,{style:{fontSize:"16px"}}),disabled:e.isNew},{label:m("Remove"),icon:(0,I.jsx)(ge.A,{style:{fontSize:"16px"}}),key:"Remove",className:"em-analytics__block-remove",onClick:()=>{e.isNew?(h(`/projects/${L.id}/blocks`),j.success({id:"BLOCK_REMOVING_SUCCESS",message:m("The draft of the block has been deleted."),data:(0,b.x_)(e)})):D(e,h)},style:{color:"#ff4d4f"}}),(0,Te.A)(null===e.title?m("New block title"):e.title);const q=(0,I.jsx)(I.Fragment,{children:(0,I.jsxs)(x.A,{size:10,children:[(0,I.jsx)(Z.A,{title:m("To emails"),placement:"left",children:(0,I.jsx)(g.Ay,{type:"text",icon:(0,I.jsx)(ee.A,{}),onClick:()=>{h(`/projects/${L.id}/blocks`)},shape:"circle"})}),(0,I.jsx)(Be,{className:"ant-page-header-heading-title",editable:{triggerType:["text","icon"],icon:(0,I.jsx)(fe.A,{className:"email-page-header__icon-edit"}),onChange:t=>{e.isNew?p((0,Ce.qT)(t)):p(Ae.VM.util.updateQueryData("getBlock",e.id,(e=>{Object.assign(e,{title:t})})))}},children:null===e.title?m("New block title"):e.title})]})}),$=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(ye.A,{emailElement:e}),e.lock?(0,I.jsx)(_.A,{className:k()("lock-icon",{"lock-icon__disabled":!(P||F||(null===(a=v.id)||void 0===a?void 0:a.toString())===(null===(l=e.author)||void 0===l?void 0:l.toString()))}),style:{color:A.colorPrimary,fontSize:"16px"}},"Lock"):null,(0,I.jsx)(he.A,{arrow:"true",menu:{items:V},children:(0,I.jsx)(g.Ay,{className:"block-page-header__btn block-page-header__btn_extra",onClick:()=>{},children:(0,I.jsx)(be.A,{})})},"Actions"),(0,I.jsx)(_e.A,{className:"em-analytics__block-save",block:e,isEditableRights:P||F||(null===(r=v.id)||void 0===r?void 0:r.toString())===(null===(c=e.author)||void 0===c?void 0:c.toString()),autoSaveBlockResult:t},"Save")]});return(0,I.jsx)(se.A,{leftBlock:q,rightBlock:$,className:"header_blocks",isHeaderCodeMenuOpen:((null===T||void 0===T?void 0:T.type)===R.bV.TEXT||(null===T||void 0===T?void 0:T.type)===R.bV.LINK||T.type===R.bV.BUTTON)&&B&&"bottom"!==w})};var Pe=o(53204),Fe=o(39738),Me=o(64037),De=o(45695),ze=o(9653);const{Content:Oe}=Y.A,He=()=>{const{__:e}=(0,S.s9)(),t=(0,De.XW)(),{blockId:o,projectId:a}=(0,d.g)(),l=(0,n.wA)();let i=(0,d.Zp)();const r=(0,Ee.fn)(),c=(0,F.p6)(),m=(0,n.d4)(ke.gm),u=(0,n.d4)(Ce.ah),p=(0,n.d4)(Ie.C1),h=(0,n.d4)(Pe.M),x=(0,n.d4)(Se.Wm),v=(0,n.d4)(Fe.p1),[f]=(0,Ae.yW)(),b=c.get(R.A9.em_new_block),{isSuccess:_,data:j}=(0,Ae.bg)(+b,{skip:!b}),[y,A]=(0,s.useState)(!1);(0,s.useEffect)((()=>{b&&_&&(l((0,Ce.Bp)(j)),A(!0))}),[b,_,l,j]);const{isLoading:k,isSuccess:w,isError:C,error:E}=(0,Ae.bg)(o,{skip:!o}),N=b?_:w,T=w&&null!==m&&void 0!==m&&m.id?m:_&&u,B=(0,s.useRef)(0),{isSuccess:L,isLoading:P}=(0,Ae.J4)({blockId:+o},{skip:!o}),[M,D]=(0,s.useState)(null);(0,s.useEffect)((()=>{if(L&&!P&&null!==v&&void 0!==v&&v.length){var e;const s=v[0];if((null===M||void 0===M?void 0:M.toString())!==(null===(e=T.id)||void 0===e?void 0:e.toString())){var t;if(null!==(t=s.slug)&&void 0!==t&&t.includes("autosave")&&r){var o;const e=null===(o=s.html)||void 0===o?void 0:o.replaceAll("\r\n","\n");l((0,ke.DL)(e))}D(T.id)}}}),[l,v,L,P,T,M,r,o]),(0,ze.U)(T);const z=(0,s.useCallback)((()=>{const e=()=>{f({blockId:null===m||void 0===m?void 0:m.id,body:{title:null===m||void 0===m?void 0:m.title,emailId:null===m||void 0===m?void 0:m.id,project:null===m||void 0===m?void 0:m.project,html:null===r||void 0===r?void 0:r.getValue(),excerpt:null===m||void 0===m?void 0:m.date_gmt}}).then((e=>{})).catch((e=>{console.log(e)}))};if(v&&v.length>0){const t=[...v].sort(((e,t)=>Date.parse(null===t||void 0===t?void 0:t.modified)-Date.parse(null===e||void 0===e?void 0:e.modified)))[0];(Date.parse(new Date)-Date.parse(null===t||void 0===t?void 0:t.modified))/1e3>30&&x&&!h&&e()}else x&&!h&&e()}),[v,f,m,h,x,r]);(0,s.useEffect)((()=>{m&&null!==p&&void 0!==p&&p.autosaves&&!h&&(clearTimeout(B.current),B.current=setTimeout(z,1e4))}),[m,z,p,h]);const O=(0,Ee.aD)(r),H=(0,s.useCallback)((()=>{O.undo()}),[O]),V=(0,s.useCallback)((()=>{O.redo()}),[O]),q=(0,s.useRef)();(0,s.useEffect)((()=>{q.current!==(null===T||void 0===T?void 0:T.id)&&(O.clear(),q.current=null===T||void 0===T?void 0:T.id)}),[T,O]);const $=(0,s.useCallback)((e=>{(window.navigator.appVersion.indexOf("Mac")&&e.metaKey||e.ctrlKey)&&"KeyZ"===e.code&&(e.preventDefault(),e.shiftKey?V():H())}),[H,V]);(0,s.useEffect)((()=>(document.body.classList.add("editor"),()=>{l((0,Pe.rI)()),l((0,Fe.qX)()),l((0,Se.PM)(R.Bv))})),[l]);(0,Me.A)((e=>{const t=e.data.operation,o=e.data.action,s=document.getElementById("iframe-scroll-top"),a=document.getElementById("iframe-scroll-bottom");if(t===R.Ru.APPLICATION_ACTION&&("undo"===o?H():"redo"===o&&V()),t===R.Ru.APPLICATION_SCROLL_BLOCK_SHOW){const e=document.getElementById("iframe-scroll-top"),t=document.getElementById("iframe-scroll-bottom"),o=document.getElementById("email_iframe"),s=document.body.getBoundingClientRect().height,a=o.getClientRects()[0];a.top<0&&(e.style.display="block"),a.top+a.height>s&&(t.style.display="block")}t===R.Ru.APPLICATION_SCROLL_BLOCK_HIDE&&(s.style.display="none",a.style.display="none")}));const G=e=>{e.preventDefault(),e.target&&t({operation:R.Ru.SANDBOX_DRAG_CANCEL})},X=()=>{},U=e=>{e.preventDefault();const t=document.getElementById("iframe-scroll-top"),o=document.getElementById("iframe-scroll-bottom"),s=document.getElementById("pane-content-iframe"),a=document.getElementById("email_iframe"),{height:l,top:i}=a.getBoundingClientRect(),n=document.body.getBoundingClientRect().height;i>1?"block"===t.style.display&&(t.style.display="none"):"none"===t.style.display&&(t.style.display="block"),l-n+i<1?"block"===o.style.display&&(o.style.display="none"):"none"===o.style.display&&(o.style.display="block"),e.target===t&&s.scrollBy(0,-20),e.target===o&&s.scrollBy(0,20)},W=()=>{const e=document.getElementById("iframe-scroll-top"),t=document.getElementById("iframe-scroll-bottom");e&&t&&(e.style.display="none",t.style.display="none")};return(0,s.useEffect)((()=>(window.addEventListener("dragstart",X),window.addEventListener("drop",G),window.addEventListener("dragend",W),window.addEventListener("dragover",U),window.addEventListener("keydown",$),window.addEventListener("dragenter dragleave",(e=>{e.preventDefault()})),()=>{window.removeEventListener("dragstart",X),window.removeEventListener("drop",G),window.removeEventListener("dragover",U),window.removeEventListener("dragend",W),window.removeEventListener("keydown",$),window.removeEventListener("dragenter dragleave",(e=>{e.preventDefault()}))}))),(0,I.jsxs)(Y.A,{className:"block-page",children:[T&&(0,I.jsx)(Re,{block:T}),k&&(0,I.jsx)(ue.A,{}),C&&E&&(0,I.jsx)(Y.A,{children:(0,I.jsx)(Oe,{style:{paddingTop:"40px"},children:(0,I.jsx)("div",{className:"container",children:(0,I.jsx)(me.Ay,{status:E.status,title:E.status,subTitle:E.data.message,extra:(0,I.jsx)(g.Ay,{type:"primary",onClick:()=>{i(`/projects/${a}/blocks`)},children:e("Back To Project")})})})})}),(!o&&(!b||y&&u)||w&&m)&&(0,I.jsx)(pe.A,{emailElement:T,isSuccess:N})]})};var Ve=o(6099),qe=o(24495),$e=o(17445),Ge=o(24293),Xe=o(49246),Ue=o(20984),We=o(69417),Ye=o(8701),Ke=o(13338),Ze=o(79716),Je=o(41564),Qe=o(90775),et=o(64936),tt=o(76793),ot=o(843),st=o(35317);const{Paragraph:at}=K.A,{Content:lt}=Y.A,it="Early",nt="Monthly",rt=(e,t)=>t?e>100?"#FF4D4F":e<100?"#52c41a":100===e?"rgba(0, 0, 0, 0.25)":void 0:"transparent",dt=()=>{const{__:e,_n:t}=(0,S.s9)();let o=(0,d.Zp)();const a=(0,n.wA)(),l=(0,n.d4)(Ie.C1),i=(0,n.d4)(et.cL),[r,c]=(0,tt.Cl)(),[m,p]=(0,ot.IJ)(),[v,f]=(0,st.O)(),{isSuccess:_,isLoading:j,data:y}=(0,T.W5)(),[A]=(0,T.on)(),w=(0,b.hN)(),[C,E]=(0,s.useState)(!1),[B]=u.A.useForm(),L=(0,F.p6)(),[P,M]=(0,s.useState)({discount:null,promocode:null,expiration:null}),{counters:{emails_counter:D,projects_counter:z,users_counter:O,preview_counter:H,payments_counter:V,optimization_counter:q},subscription:$,subscription_end:G,recurring_payments:X,subscription_id:U,promocode:W,subscription_amount:K,enterprise_users_limit:J,enterprise_price:Q,enterprise_12_price:te,email:oe,name:le}=l,[ie,ne]=(0,s.useState)(it);(0,s.useEffect)((()=>{var e,t;(null===$||void 0===$||null===(e=$.post_title)||void 0===e?void 0:e.split(" ").length)>1?ne(it):1===(null===$||void 0===$||null===(t=$.post_title)||void 0===t?void 0:t.split(" ").length)&&ne(nt)}),[null===$||void 0===$?void 0:$.post_title]);const[re,de]=(0,s.useState)([]);(0,s.useEffect)((()=>{de([3891,ie===nt?4965:4966,ie===nt?3892:4953,ie===nt?3893:4952,ie===nt?3894:4954])}),[ie]);const[ce,me]=(0,s.useState)(null),ue=null===ce||void 0===ce?void 0:ce.limits,pe=null===ce||void 0===ce?void 0:ce.title.split(" ")[0];(0,s.useEffect)((()=>{_&&y&&me(y.find((e=>{var t,o;return(null===(t=e.id)||void 0===t?void 0:t.toString())===(null===$||void 0===$||null===(o=$.ID)||void 0===o?void 0:o.toString())})))}),[y,_,$]),(0,s.useEffect)((()=>{0}),[]);const[he,ge]=(0,s.useState)(""),xe=(e,t,o,s)=>{ge(e);const i=L.get(R.A9.em_token);if("Personal"!==t&&"Advanced"!==t&&"Pro"!==t&&!s||"Community"!==pe&&"Free"!==pe)document.body.classList.remove("editor"),a((0,et.qf)(R.lx.SWITCH_TO_PLAN_MODAL));else{0;{const t={email:l.email,subscription:e,price:+o,amount:ie===it?12*o:+o,token:i,discount:P.discount};v(JSON.stringify(t)).then((e=>{var t,o;if(200===(null===e||void 0===e||null===(t=e.data)||void 0===t||null===(o=t.data)||void 0===o?void 0:o.status))return window.location.href=e.data.checkout_url,null;e.error}))}}},[ve,fe]=(0,s.useState)(!1);(0,s.useEffect)((()=>{fe(X)}),[X]);(0,s.useEffect)((()=>{const e=setInterval((()=>{A()}),1e4);return()=>clearInterval(e)}),[A]);const be=(0,I.jsxs)(x.A,{size:10,children:[(0,I.jsx)(g.Ay,{type:"text",icon:(0,I.jsx)(ee.A,{}),onClick:()=>(0,ae.XZ)(o,"/projects"),shape:"circle"}),(0,I.jsx)(at,{className:"ant-page-header-heading-title",children:e("Billing")})]}),_e=(0,I.jsx)(I.Fragment,{}),je=(0,s.useCallback)((e=>{E(!0),a(N.So.endpoints.checkPromo.initiate({code:e,type:"self"})).then((({data:t})=>400===(null===t||void 0===t?void 0:t.status)?{error:{data:t}}:e?a(N.So.endpoints.getPromoInfo.initiate({code:e})):void 0)).then((e=>{var t;if((e.error||e.data.hasOwnProperty("status")&&200!==(null===(t=e.data)||void 0===t?void 0:t.status))&&(0,ae.p6)(e,w),null!==e&&void 0!==e&&e.data){let t={...e.data};const a=new Date(e.data.expiration),l=new Date;var o,s;if(t.promocode=e.data.promocode.toUpperCase(),a>l)M(t),(null===e||void 0===e||null===(o=e.data)||void 0===o?void 0:o.message)&&(0,ae.wB)(null===e||void 0===e||null===(s=e.data)||void 0===s?void 0:s.message,w)}else P.promocode||M({...P,promocode:""})})).catch((e=>{(0,ae.p6)(e,w),console.warn("error",e)})).finally((()=>{E(!1)}))}),[a,P,w]),ye=e=>{return P.discount&&e?(t=e-e*P.discount/100,"useblocks"===R.oy?Math.round(t):100*Math.floor(t/100)):e;var t};(0,s.useEffect)((()=>{!+V&&W&&"Free"===pe&&null===P.promocode&&je(W)}),[je,V,W,pe,P.promocode]);const Ae=(0,I.jsx)(Ze.A,{style:{fontSize:48},spin:!0});return(0,I.jsxs)(Y.A,{className:"billing-page",children:[(0,I.jsx)(se.A,{leftBlock:be,rightBlock:_e}),(f.isLoading||f.isSuccess)&&(0,I.jsx)("div",{style:{position:"fixed",height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--colorBgLayout)",zIndex:10,opacity:.5},children:(0,I.jsx)(Ge.A,{size:"large",indicator:Ae})}),(0,I.jsx)(lt,{className:"billing-page__container",children:(0,I.jsxs)("div",{className:"billing-page__content container",children:[j&&(0,I.jsx)(Xe.A,{active:!0}),ue&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(Ue.Ay.Group,{defaultValue:it,value:ie,style:{marginBottom:32,marginRight:25},onChange:e=>{ne(e.target.value)},children:[(0,I.jsx)(Ue.Ay.Button,{value:it,children:e("Bill yearly (-15%)")}),(0,I.jsx)(Ue.Ay.Button,{value:nt,children:e("Bill monthly")})]}),"Free"===pe&&!+V&&(0,I.jsxs)(u.A,{form:B,layout:"inline",name:"promo_code_form",autoComplete:"off",initialValues:{promocode:""},onFinish:({promocode:e})=>{B.resetFields(),e&&je(e)},className:"billing-page__form",children:[(0,I.jsx)(u.A.Item,{name:"promocode",className:"billing-page__form-input",children:(0,I.jsx)(h.A,{placeholder:e("Use promocode")})}),(0,I.jsx)(u.A.Item,{className:"billing-page__form-submit",children:(0,I.jsx)(g.Ay,{type:"primary",htmlType:"submit",children:C?(0,I.jsx)(Ze.A,{}):(0,I.jsx)(Je.A,{})})})]}),(0,I.jsx)("div",{className:"billing-page__cards-list",children:re.map((o=>{const{title:s,limits:{emails_limit:a,projects_limit:l,users_limit:i},price:n}=null===y||void 0===y?void 0:y.find((e=>{var t;return(null===(t=e.id)||void 0===t?void 0:t.toString())===(null===o||void 0===o?void 0:o.toString())})),r=a&&D>a||l&&z>l||i&&O>i,d=s.split(" ")[0];let c=null,m=null;return J&&Q&&"Enterprise"===s&&(c=!0),J&&te&&"Enterprise 12"===s&&(m=!0),(0,I.jsxs)(We.A,{hoverable:!0,style:{width:240},"data-name":s,children:[(0,I.jsx)("p",{className:"billing-page__card-title",children:d}),(("Enterprise"!==d||c||m)&&"Free"!==d&&P.discount&&!+V||s===ce.title&&!!+K&&+K<+n)&&(0,I.jsx)("span",{className:"billing-page__card-price_old",children:(0,I.jsxs)("s",{children:["\xa0","Enterprise"!==d?n:c?Q:m,"useblocks"===R.oy?"$":"\u20bd","\xa0"]})}),(0,I.jsxs)("p",{className:"billing-page__card-price",children:["Enterprise"!==d||c||m?"useblocks"===R.oy&&"$":"",s===ce.title&&"Free"!==ce.title&&+K?K:"Enterprise"!==d?ye(n):c?ye(Q):m?ye(te):e("By request"),("Community"===d||"Free"===d)&&"0","Enterprise"!==d||c||m?"useblocks"!==R.oy&&"\u20bd":"",(0,I.jsx)("span",{className:"billing-page__card-price_sub",children:("Personal"===d||"Advanced"===d||"Pro"===d)&&e("/ month")})]}),(0,I.jsxs)("ul",{className:"billing-page__card-list",children:[(0,I.jsxs)("li",{children:["\u2022 ",a||"\u221e"," ",t(" email"," emails",a)]}),(0,I.jsxs)("li",{children:["\u2022 ",l||"\u221e"," ",t(" project"," projects",l)]}),(0,I.jsxs)("li",{children:["\u2022"," ","Enterprise"===d&&(c||m)&&J||i||"\u221e"," ",t(" member"," members",i)]})]}),(0,I.jsx)(Z.A,{className:"billing-page__tooltip",placement:"topLeft",title:"Community"!==pe&&"Free"!==pe||!r?"":e("Switching is not possible due to exceeding the limit"),children:(0,I.jsx)(g.Ay,{className:k()("billing-page__card-button",{"billing-page__card-button_current":s===ce.title}),type:s===ce.title?"default":"primary",size:"large",onClick:()=>xe(s,d,n||c&&Q||m&&te,c||m),disabled:("Community"===pe||"Free"===pe)&&r,title:"Community"!==pe&&"Free"!==pe||!r?"":e("Switching is not possible due to exceeding the limit"),children:s===ce.title?e("Current plan"):e("Enterprise"!==d||c||m?"Switch to this plan":"Contact us")})})]},s)}))}),P.promocode&&P.discount&&!+V&&"Free"===pe&&(0,I.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,I.jsxs)("div",{className:"billing-page__promo-data",children:[e("Discount with promo code: "),P.promocode]}),P.description&&(0,I.jsx)("div",{style:{marginBottom:"-45px"},dangerouslySetInnerHTML:{__html:P.description}})]}),"Community"!==pe&&"Free"!==pe&&G&&(0,I.jsxs)("div",{className:"billing-page__paid-block",children:[(0,I.jsxs)("div",{className:"billing-page__paid-data",children:[e("Paid until: "),G]}),U&&(0,I.jsxs)("div",{className:"billing-page__recurring-switch-wrapper",children:[(0,I.jsx)(Ye.A,{className:"billing-page__recurring-switch",checked:ve,onChange:(e,t)=>{t.preventDefault(),e?(()=>{const e={sid:U,uid:l.id};m(e).then((e=>{var t,o;e.isSuccess&&200===(null===e||void 0===e||null===(t=e.data)||void 0===t||null===(o=t.data)||void 0===o?void 0:o.status)?(fe(!0),A().then((t=>{var o;t.data&&(0,ae.wB)(null===e||void 0===e||null===(o=e.data)||void 0===o?void 0:o.message,w)}))):(fe(!1),(0,ae.p6)(e,w))}))})():(()=>{const e={sid:U,uid:l.id};r(e).then((e=>{var t,o;e.isSuccess&&200===(null===e||void 0===e||null===(t=e.data)||void 0===t||null===(o=t.data)||void 0===o?void 0:o.status)?(fe(!1),A().then((t=>{var o;t.data&&(0,ae.wB)(null===e||void 0===e||null===(o=e.data)||void 0===o?void 0:o.message,w)}))):(fe(!0),(0,ae.p6)(e,w))}))})()},disabled:c.isLoading||c.isFetching||p.isLoading||p.isFetching}),(0,I.jsx)("span",{className:"billing-page__recurring-switch-text",children:e("Recurring payments")})]})]}),(0,I.jsx)("p",{className:"billing-page__title",children:e("Usage")}),(0,I.jsxs)("div",{className:"billing-page__progress-block",children:[(0,I.jsx)(Ke.A,{percent:D/ue.emails_limit*100,format:()=>(0,I.jsx)("span",{className:"billing-page__progress-block-counts",children:`${D} ${e("of")} ${ue.emails_limit||"\u221e"} ${t(" email"," emails",ue.emails_limit||"\u221e")}`}),size:"medium",strokeColor:rt(D/ue.emails_limit*100,ue.emails_limit)}),(0,I.jsx)(Ke.A,{percent:z/ue.projects_limit*100,format:()=>(0,I.jsx)("span",{className:"billing-page__progress-block-counts",children:`${z} ${e("of")} ${ue.projects_limit||"\u221e"} ${t(" project"," projects",ue.projects_limit||"\u221e")}`}),size:"medium",strokeColor:rt(z/ue.projects_limit*100,ue.projects_limit)}),(0,I.jsx)(Ke.A,{percent:O/("Enterprise"===pe&&J||ue.users_limit)*100,format:()=>(0,I.jsx)("span",{className:"billing-page__progress-block-counts",children:`${O} ${e("of")} ${"Enterprise"===pe&&J||ue.users_limit||"\u221e"} ${t(" member"," members",ue.users_limit)}`}),size:"medium",strokeColor:rt(O/(ue.users_limit||"Enterprise"===pe&&J)*100,ue.users_limit||"Enterprise"===pe&&J)}),(0,I.jsx)(Ke.A,{percent:H/ue.preview_limit*100,format:()=>(0,I.jsx)("span",{className:"billing-page__progress-block-counts",children:`${H} ${e("of")} ${ue.preview_limit} ${t(" preview"," previews",ue.preview_limit)}`}),size:"medium",strokeColor:rt(H/ue.preview_limit*100,ue.preview_limit)}),(0,I.jsx)(Ke.A,{percent:q/ue.optimization_limit*100,format:()=>(0,I.jsx)("span",{className:"billing-page__progress-block-counts",children:`${q} ${e("of")} ${ue.optimization_limit>0?ue.optimization_limit:"\u221e"} ${t(" optimisation"," optimisations",ue.optimization_limit)}`}),size:"medium",strokeColor:rt(q/ue.optimization_limit*100,ue.optimization_limit)})]})]})]})}),(0,I.jsx)(Qe.A,{isModalVisible:i===R.lx.SWITCH_TO_PLAN_MODAL,userEmail:oe,subscriptionRequest:he,userName:le,currentPlane:null===ce||void 0===ce?void 0:ce.title})]})};var ct=o(84568),mt=o(18398),ut=o(56991);d.BV.propTypes={};const pt=()=>{const e=(0,n.wA)(),t=(0,F.p6)(),o=(0,n.d4)(Ie.C1);(0,s.useEffect)((()=>{const t=null===o||void 0===o?void 0:o.code_editor;t&&e((0,Ie.ww)(t))}),[o,e]),(0,s.useEffect)((()=>{const o=t.get(R.A9.em_token),s=t.get(R.A9.promocode);o&&s&&(e(N.So.endpoints.checkPromo.initiate({code:s,type:"by_link"})),t.remove(R.A9.promocode))}),[e,t]);const[a,l]=(0,s.useState)(null),i=(0,n.d4)(mt.s0),r=i.project?(0,ut.Mu)(i):void 0;return(0,s.useEffect)((()=>{if(!R.EW.isPlugin){const s=t.get(R.A9.em_token);null!==o&&void 0!==o&&o.last_used_project?l(null===o||void 0===o?void 0:o.last_used_project):o&&s&&e(ct.Nq.endpoints.getProjects.initiate()).then((e=>{var t;l((null===(t=e.data)||void 0===t?void 0:t[0].id)||!1)})).catch((()=>l(!1)))}}),[o,e,t]),(0,b.O5)(),R.EW.isPlugin&&void 0===r?(0,I.jsx)(I.Fragment,{}):(0,I.jsxs)(d.BV,{children:[(0,I.jsx)(d.qh,{path:"/auth",element:(0,I.jsx)(c.A,{children:(0,I.jsx)(O,{})})}),(0,I.jsx)(d.qh,{path:"/yandex-login",element:(0,I.jsx)(H,{})}),(0,I.jsx)(d.qh,{path:"/recover-password",element:(0,I.jsx)(q.A,{})}),(0,I.jsx)(d.qh,{path:"/email/:emailId/raw",element:(0,I.jsx)($e.A,{})}),(0,I.jsxs)(d.qh,{path:"/",element:(0,I.jsx)(c.A,{children:(0,I.jsx)(V.A,{})}),children:[(0,I.jsx)(d.qh,{path:"/billing",element:(0,I.jsx)(dt,{})}),(0,I.jsx)(d.qh,{index:!0,element:(0,I.jsx)(X.A,{to:r||"projects"})}),(0,I.jsxs)(d.qh,{path:"emails",children:[(0,I.jsx)(d.qh,{index:!0,element:(0,I.jsx)(U.A,{lastProjectId:a})}),(0,I.jsx)(d.qh,{path:"new",element:(0,I.jsx)(U.A,{lastProjectId:a})})]}),(0,I.jsxs)(d.qh,{path:"projects",children:[(0,I.jsx)(d.qh,{index:!0,element:(0,I.jsx)($.A,{})}),(0,I.jsxs)(d.qh,{path:":projectId",element:(0,I.jsx)(Ve.A,{}),children:[(0,I.jsxs)(d.qh,{path:"emails",children:[(0,I.jsx)(d.qh,{index:!0,element:(0,I.jsx)(G.A,{})}),(0,I.jsx)(d.qh,{path:":emailId",element:(0,I.jsx)(ce.A,{}),children:(0,I.jsx)(d.qh,{path:":preview",element:(0,I.jsx)(ce.A,{})})}),(0,I.jsx)(d.qh,{path:"new",element:(0,I.jsx)(ce.A,{})}),(0,I.jsxs)(d.qh,{path:"new_from",children:[(0,I.jsx)(d.qh,{index:!0,element:(0,I.jsx)($.A,{})}),(0,I.jsx)(d.qh,{path:":emailId",element:(0,I.jsx)(W.A,{})})]}),(0,I.jsx)(d.qh,{path:"create",children:(0,I.jsx)(d.qh,{index:!0,element:(0,I.jsx)(ne,{})})})]}),(0,I.jsxs)(d.qh,{path:"blocks",children:[(0,I.jsx)(d.qh,{index:!0,element:(0,I.jsx)(re.A,{})}),(0,I.jsx)(d.qh,{path:":blockId",element:(0,I.jsx)(He,{})}),(0,I.jsx)(d.qh,{path:"new",element:(0,I.jsx)(He,{})})]}),(0,I.jsx)(d.qh,{path:"members",element:(0,I.jsx)(qe.A,{})})]})]}),(0,I.jsx)(d.qh,{path:"*",element:(0,I.jsx)(de.A,{})})]})]})};var ht=o(69156),gt=o(4701),xt=o(17126);const vt=(0,o(84869).A)(),ft={hashed:!1,algorithm:a.A.defaultAlgorithm,token:{colorLink:"#1677ff",colorInfo:"#722ed1",colorTextBase:"#000000",colorBgLayout:"#f0f2f5",borderRadiusXL:16,borderRadiusLG:12,borderRadius:8,borderRadiusSM:6,colorDarken1:"rgba(0, 0, 0, 0.08)",colorFillSecondaryDarken:"rgba(0, 0, 0, 0.1)",formControlHeight:34,borderWidth:1,borderColorHover:"#C5C5C5",formItemMarginBottomMD:20,formItemMarginBottomXS:8,colorSecondaryH:265.03,colorSecondaryS:"63.92%",colorSecondaryL:"50%",colorSecondaryBgH:273,colorSecondaryBgS:"100%",colorSecondaryBgL:"93%",appZoom:1},components:{Progress:{colorFillSecondary:"#ffffff"},Tabs:{titleFontSize:16,titleFontSizeSM:16,fontSize:16,fontSizeLG:16}}},bt={hashed:!1,algorithm:a.A.darkAlgorithm,token:{colorBgBase:"#1F1F1F",colorInfo:"#9254de",colorLink:"#1890ff",colorLinkHover:"#69c0ff",wireframe:!1,borderRadiusXL:16,borderRadiusLG:12,borderRadius:8,borderRadiusSM:6,borderWidth:1,colorDarken1:"rgba(0, 0, 0, 0.9)",colorFillSecondaryDarken:"rgba(255, 255, 255, 0.16)",formControlHeight:34,borderColorHover:"rgba(255, 255, 255, 0.3)",formItemMarginBottomMD:20,formItemMarginBottomXS:8,appZoom:1},components:{Tabs:{titleFontSize:16,titleFontSizeSM:16,fontSize:16,fontSizeLG:16}}};const _t=function(){const e=(0,n.d4)(we.Up),t=(0,n.d4)(Ie.C1),o=window.localStorage.getItem(R.V0.em_color_scheme),a=matchMedia(R.F3).matches?R.nd:R.T,[d,c]=(0,s.useState)(o||a),m=(0,ut.rD)(),u=(0,n.wA)(),p=(0,ht.c8)();(0,s.useEffect)((()=>{const e=R.EW.isPlugin?null===t||void 0===t?void 0:t.theme:o||a;c(e),(0,ht.A5)(e),u((0,we.eX)(e===R.nd?`vs-${e}`:R.T)),p()}),[o,e,a,null===t||void 0===t?void 0:t.theme,m.pathEnabled,u,p]);const h=(0,s.useCallback)((e=>{e&&e!==R.IJ?((0,ht.Hk)(e),localStorage.setItem(R.V0.em_color_scheme,e)):localStorage.removeItem(R.V0.em_color_scheme)}),[]);(0,s.useEffect)((()=>{const e=null===t||void 0===t?void 0:t.theme,o=localStorage.getItem(R.V0.em_color_scheme);e&&e!==o&&h(e)}),[t,h]);const g=(0,s.useCallback)((()=>{const e=localStorage.getItem(R.V0.em_color_scheme);h(e)}),[h]);(0,s.useEffect)((()=>{g()}),[g]);const x=(0,n.d4)(mt.RP),[v,f]=(0,s.useState)("light"===d?ft:bt),[b]=(0,s.useState)(1);(0,s.useEffect)((()=>{const e="light"===d?ft:bt,t=x[d],o=t?(0,gt.TJ)(e,t):e;f({...o,token:{...o.token,appZoom:b}})}),[f,d,x,b]);const _=(0,xt.LG)(),j=(0,s.useCallback)((()=>_),[_]);return(0,I.jsx)(l.Ay,{theme:v,getPopupContainer:j,children:(0,I.jsx)(r.N7,{transformers:[vt],children:(0,I.jsx)(i.A,{children:(0,I.jsx)(pt,{})})})})}},45927:(e,t,o)=>{o.d(t,{A:()=>H});var s=o(92810),a=o(38883),l=o.n(a),i=o(95838),n=o(12280),r=o(29234),d=o(66726),c=o(2018),m=o(7744),u=o(71086),p=o(81e3),h=o(43005),g=o(7166),x=o(28348),v=o(29756),f=o(62767),b=o(6391),_=o(69372),j=o(62342),y=o(14461),A=o(82013),k=o(23287),S=o(45934),w=o(88296),C=o(26238),I=o(68031),E=o(21519),N=o(71495),T=o(44997),B=o(65983),L=o(47358),R=o(45695),P=o(56991),F=o(85163),M=o(47520),D=o(70082);const{useToken:z}=i.A,O=({className:e,email:t})=>{const{__:o}=(0,k.s9)(),a=(0,R.XW)(),[i]=n.A.useForm(),[O,H]=(0,s.useState)({}),[V,q]=(0,s.useState)(!0),[$,G]=(0,s.useState)(!1),X=(0,S.d4)(B.uJ),U=(0,P.rD)(),{token:W}=z(),Y={buttonsPaddingTop:"top",buttonsPaddingLeft:"left",buttonsPaddingRight:"right",buttonsPaddingBottom:"bottom"},K=t.common_styles&&"{}"!==t.common_styles?JSON.parse(t.common_styles):F.BD,[Z,J]=(0,s.useState)(null),Q=!!t.common_styles&&"{}"!==t.common_styles,ee=(0,S.d4)(L.Wm);(0,s.useEffect)((()=>{ee||J(null)}),[K,J,ee]),(0,s.useEffect)((()=>{!Z&&J({textFontFamily:K.text.fontFamily,textFontSize:K.text.fontSize,textFontSizeDim:K.text.fontSizeDim,textLineHeight:K.text.lineHeight,textLineHeightDim:K.text.lineHeightDim,textColor:K.text.color,textAlign:K.text.textAlign,textPaddingBottom:K.text.paddingBottom,textPaddingBottomDim:K.text.paddingBottomDim,headingFontFamily:K.headings.fontFamily,headingFontSize:K.headings.fontSize,headingFontSizeDim:K.headings.fontSizeDim,headingLineHeight:K.headings.lineHeight,headingLineHeightDim:K.headings.lineHeightDim,headingColor:K.headings.color,headingAlign:K.headings.textAlign,headingPaddingTop:K.headings.paddingTop,headingPaddingTopDim:K.headings.paddingTopDim,headingPaddingBottom:K.headings.paddingBottom,headingPaddingBottomDim:K.headings.paddingBottomDim,headingLetterSpacing:K.headings.letterSpacing,headingLetterSpacingDim:K.headings.letterSpacingDim,headingBold:K.headings.bold,headingItalic:K.headings.italic,linkColor:K.links.color,linkUnderline:K.links.underline,buttonsFontFamily:K.buttons.fontFamily,buttonsFontSize:K.buttons.fontSize,buttonsFontSizeDim:K.buttons.fontSizeDim,buttonsLetterSpacing:K.buttons.letterSpacing,buttonsLetterSpacingDim:K.buttons.letterSpacingDim,buttonsColor:K.buttons.color,buttonsBold:K.buttons.bold,buttonsItalic:K.buttons.italic,buttonsBackgroundColor:K.buttons.backgroundColor,buttonsMarginTop:K.buttons.marginTop,buttonsMarginTopDim:K.buttons.marginTopDim,buttonsMarginBottom:K.buttons.marginBottom,buttonsMarginBottomDim:K.buttons.marginBottomDim,buttonsBorder:K.buttons.border,buttonsAlign:K.buttons.textAlign,buttonsBorderRadius:K.buttons.borderRadius,buttonsPadding:K.buttons.padding})}),[K,Z]);const[te,oe]=(0,s.useState)(K.headings.fontSize-1),[se,ae]=(0,s.useState)(K.text.fontSize+1);(0,s.useEffect)((()=>{if(Z){var e,t,o,s;const a=Z.buttonsBorder;H(a);const l=Object.keys(a).find((e=>{var t,o,s;return(null===(t=a[e])||void 0===t?void 0:t.width)||(null===(o=a[e])||void 0===o?void 0:o.style)||(null===(s=a[e])||void 0===s?void 0:s.color)}));i.setFieldsValue({borderPosition:l||"all",borderWidth:null!==(null===(e=a[l])||void 0===e?void 0:e.width)?null===(t=a[l])||void 0===t?void 0:t.width:"",borderColor:(null===(o=a[l])||void 0===o?void 0:o.color)||"",borderStyle:(null===(s=a[l])||void 0===s?void 0:s.style)||"",borderRadiusAll:(0,M.ok)(Z.buttonsBorderRadius.all),borderRadiusTopLeft:(0,M.ok)(Z.buttonsBorderRadius.topLeft),borderRadiusBottomLeft:(0,M.ok)(Z.buttonsBorderRadius.bottomLeft),borderRadiusTopRight:(0,M.ok)(Z.buttonsBorderRadius.topRight),borderRadiusBottomRight:(0,M.ok)(Z.buttonsBorderRadius.bottomRight)}),!(0,M.ok)(Z.buttonsBorderRadius.all)&&((0,M.ok)(Z.buttonsBorderRadius.topLeft)||(0,M.ok)(Z.buttonsBorderRadius.bottomLeft)||(0,M.ok)(Z.buttonsBorderRadius.topRight)||(0,M.ok)(Z.buttonsBorderRadius.bottomRight))?q(!1):q(!0),Z.buttonsPadding&&!(0,M.ok)(Z.buttonsPadding.all)&&((0,M.ok)(Z.buttonsPadding.bottom)||(0,M.ok)(Z.buttonsPadding.right)||(0,M.ok)(Z.buttonsPadding.left)||(0,M.ok)(Z.buttonsPadding.top))&&G(!1)}}),[i,Z]);const le=e=>{const t=e.target.closest("button"),o=t.name;t.className=t.classList.contains("selected-td-form__button--active")?"ant-btn ant-btn-default":"ant-btn ant-btn-default selected-td-form__button--active",t.blur(),a({operation:F.Ru.SANDBOX_EMAIL_SETTINGS_SET,settings:{[o]:t.classList.contains("selected-td-form__button--active")}})};return Z&&(0,D.jsx)("div",{className:l()("appearance-panel",{[e]:e}),children:(0,D.jsxs)(n.A,{form:i,layout:"vertical",name:"content_appearance_panel_form",initialValues:Z,onValuesChange:e=>{const t=i.getFieldsValue(!0),o=Object.keys(e)[0];let s={};switch(o){case"headingFontSize":oe(t.headingFontSize-1),s=e;break;case"textFontSize":ae(t.textFontSize+1),s=e;break;case"borderStyle":s={buttonsBorder:{[t.borderPosition]:{...O[t.borderPosition],style:e[o]}}},"all"===t.borderPosition?H((s=>({...F.iV,[t.borderPosition]:{...s[t.borderPosition],style:e[o]}}))):H((s=>({...s,[t.borderPosition]:{...s[t.borderPosition],style:e[o]}})));break;case"borderColor":s={buttonsBorder:{[t.borderPosition]:{...O[t.borderPosition],color:e[o]}}},"all"===t.borderPosition?H((s=>({...F.iV,[t.borderPosition]:{...s[t.borderPosition],color:e[o]}}))):H((s=>({...s,[t.borderPosition]:{...s[t.borderPosition],color:e[o]}})));break;case"borderWidth":s={buttonsBorder:{[t.borderPosition]:{...O[t.borderPosition],width:e[o]}}},"all"===t.borderPosition?H((s=>({...F.iV,[t.borderPosition]:{...s[t.borderPosition],width:e[o]}}))):H((s=>({...s,[t.borderPosition]:{...s[t.borderPosition],width:e[o]}})));break;case"borderPosition":i.setFieldsValue({borderWidth:O[e[o]].width||"",borderColor:O[e[o]].color||"",borderStyle:O[e[o]].style||""});break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":s={buttonsBorderRadius:{[F.wF[o]]:+e[o]}};break;case"buttonsPaddingTop":case"buttonsPaddingLeft":case"buttonsPaddingRight":case"buttonsPaddingBottom":$?(s={padding:{all:+e[o]}},i.setFieldsValue({paddingTop:e[o],paddingLeft:e[o],paddingRight:e[o],paddingBottom:e[o]})):s={buttonsPadding:{[Y[o]]:+e[o]}};break;default:s=e}"borderPosition"!==o&&a({operation:F.Ru.SANDBOX_EMAIL_SETTINGS_SET,settings:s})},autoComplete:"off",className:"element-controls",children:[Q?null:(0,D.jsx)(r.A,{style:{marginBottom:"24px"},message:o("It looks like the email was not created in our service, so the content styles won`t work. Read more about content styles in the help."),type:"info"}),(0,D.jsx)("div",{className:"form-group-title",style:{paddingTop:0},children:o("General text")}),(0,D.jsx)(d.A,{trigger:["hover"],title:o("Font of the general text"),placement:"bottom",children:(0,D.jsx)(n.A.Item,{name:"textFontFamily",style:{marginBottom:W.formItemMarginBottomXS},children:(0,D.jsx)(w.A,{value:Z.textFontFamily})})}),(0,D.jsxs)(c.A,{gutter:10,children:[(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Font size of the general text"),placement:"bottom",children:(0,D.jsx)(n.A.Item,{name:"textFontSize",children:(0,D.jsx)(T.A,{min:0,max:te,placeholder:o("Font size"),prefix:(0,D.jsx)(g.A,{}),addonAfter:"px"})})})}),(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Line height of the general text"),placement:"bottom",children:(0,D.jsx)(n.A.Item,{name:"textLineHeight",children:(0,D.jsx)(T.A,{min:0,placeholder:o("Line height"),prefix:(0,D.jsx)(x.A,{}),addonAfter:"px"})})})})]}),(0,D.jsxs)(c.A,{gutter:10,style:{paddingBottom:4},children:[(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Color of the general text"),placement:"bottom",children:(0,D.jsx)(n.A.Item,{name:"textColor",children:(0,D.jsx)(C.A,{placeholder:o("Text color"),usedColors:X.usedColors})})})}),(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Bottom padding of the general text"),placement:"bottom",children:(0,D.jsx)(n.A.Item,{name:"textPaddingBottom",children:(0,D.jsx)(T.A,{min:0,placeholder:o("Bottom padding"),prefix:(0,D.jsx)(v.A,{}),addonAfter:"px"})})})})]}),(0,D.jsx)(u.A,{className:"selected-td-form__divider"}),(0,D.jsx)("div",{className:"form-group-title",children:o("Headings")}),(0,D.jsx)(d.A,{trigger:["hover"],title:o("Heading font"),placement:"left",children:(0,D.jsx)(n.A.Item,{name:"headingFontFamily",style:{marginBottom:W.formItemMarginBottomXS},children:(0,D.jsx)(w.A,{})})}),(0,D.jsxs)(c.A,{gutter:10,children:[(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Heading font size"),placement:"bottom",children:(0,D.jsx)(n.A.Item,{name:"headingFontSize",style:{marginBottom:W.formItemMarginBottomXS},children:(0,D.jsx)(T.A,{min:se,placeholder:o("Font size"),prefix:(0,D.jsx)(g.A,{}),addonAfter:"px"})})})}),(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Heading line height"),placement:"bottom",children:(0,D.jsx)(n.A.Item,{name:"headingLineHeight",style:{marginBottom:W.formItemMarginBottomXS},children:(0,D.jsx)(T.A,{min:0,placeholder:o("Line height"),prefix:(0,D.jsx)(x.A,{}),addonAfter:"px"})})})})]}),(0,D.jsxs)(c.A,{gutter:10,children:[(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Heading letter spacing"),placement:"bottom",children:(0,D.jsx)(n.A.Item,{name:"headingLetterSpacing",children:(0,D.jsx)(T.A,{min:0,placeholder:o("Letter spacing"),prefix:(0,D.jsx)(f.A,{}),addonAfter:"px"})})})}),(0,D.jsx)(m.A,{span:12,children:(0,D.jsxs)(p.A,{children:[(0,D.jsx)(h.Ay,{className:l()({"selected-td-form__button--active":Z.headingBold}),type:"default",name:"headingBold",onClick:le,children:(0,D.jsx)(b.A,{})}),(0,D.jsx)(h.Ay,{className:l()({"selected-td-form__button--active":Z.headingItalic}),type:"default",name:"headingItalic",onClick:le,children:(0,D.jsx)(_.A,{})})]})})]}),(0,D.jsxs)(c.A,{gutter:10,children:[(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Heading color"),placement:"bottom",children:(0,D.jsx)(n.A.Item,{name:"headingColor",children:(0,D.jsx)(C.A,{placeholder:o("Heading color"),usedColors:X.usedColors})})})}),(0,D.jsx)(m.A,{span:12})]}),(0,D.jsxs)(c.A,{gutter:10,style:{paddingBottom:4},children:[(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Top padding"),placement:"bottom",children:(0,D.jsx)(n.A.Item,{name:"headingPaddingTop",children:(0,D.jsx)(T.A,{min:0,placeholder:o("Top padding"),prefix:(0,D.jsx)(j.A,{}),addonAfter:"px"})})})}),(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Bottom padding"),placement:"bottom",children:(0,D.jsx)(n.A.Item,{name:"headingPaddingBottom",children:(0,D.jsx)(T.A,{min:0,placeholder:o("Bottom padding"),prefix:(0,D.jsx)(v.A,{}),addonAfter:"px"})})})})]}),(0,D.jsx)(u.A,{className:"selected-td-form__divider"}),(0,D.jsx)("div",{className:"form-group-title",children:o("Links")}),(0,D.jsxs)(c.A,{gutter:10,style:{paddingBottom:4},children:[(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Link color"),placement:"left",children:(0,D.jsx)(n.A.Item,{name:"linkColor",children:(0,D.jsx)(C.A,{placeholder:o("Link color"),usedColors:X.usedColors})})})}),(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(h.Ay,{className:l()({"selected-td-form__button--active":Z.linkUnderline}),type:"default",name:"linkUnderline",onClick:le,children:(0,D.jsx)(y.A,{})})})]}),(0,D.jsx)(u.A,{className:"selected-td-form__divider"}),(0,D.jsxs)("div",{className:"form-group-title",children:[o("Buttons")," ",(0,D.jsx)("span",{className:"form-group-title__bull",children:"\u2022"})," ",o("Text")]}),(0,D.jsx)(d.A,{trigger:["hover"],title:o("Buttons font"),placement:"left",children:(0,D.jsx)(n.A.Item,{name:"buttonsFontFamily",style:{marginBottom:W.formItemMarginBottomXS},children:(0,D.jsx)(w.A,{})})}),(0,D.jsxs)(c.A,{gutter:10,children:[(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Buttons font size"),placement:"bottom",children:(0,D.jsx)(n.A.Item,{name:"buttonsFontSize",style:{marginBottom:W.formItemMarginBottomXS},children:(0,D.jsx)(T.A,{min:0,placeholder:o("Font size"),prefix:(0,D.jsx)(g.A,{}),addonAfter:"px"})})})}),(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Buttons letter spacing"),placement:"bottom",children:(0,D.jsx)(n.A.Item,{name:"buttonsLetterSpacing",style:{marginBottom:W.formItemMarginBottomXS},children:(0,D.jsx)(T.A,{min:0,placeholder:o("Letter spacing"),prefix:(0,D.jsx)(f.A,{}),addonAfter:"px"})})})})]}),(0,D.jsxs)(c.A,{gutter:10,style:{paddingBottom:4},children:[(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Buttons text color"),placement:"bottom",children:(0,D.jsx)(n.A.Item,{name:"buttonsColor",children:(0,D.jsx)(C.A,{placeholder:o("Buttons text color"),usedColors:X.usedColors})})})}),(0,D.jsx)(m.A,{span:12,children:(0,D.jsxs)(p.A,{children:[(0,D.jsx)(h.Ay,{className:l()({"selected-td-form__button--active":Z.buttonsBold}),type:"default",name:"buttonsBold",onClick:le,children:(0,D.jsx)(b.A,{})}),(0,D.jsx)(h.Ay,{className:l()({"selected-td-form__button--active":Z.buttonsItalic}),type:"default",name:"buttonsItalic",onClick:le,children:(0,D.jsx)(_.A,{})})]})}),U.formButtonFieldTextAlignEnabled&&(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(I.A,{form:i,elementSettings:{textAlign:"",type:"email"},imgParent:!1,name:"buttonsAlign"})})]}),(0,D.jsx)(u.A,{className:"selected-td-form__divider"}),(0,D.jsxs)("div",{className:"form-group-title",children:[o("Buttons")," ",(0,D.jsx)("span",{className:"form-group-title__bull",children:"\u2022"})," ",o("Paddings & Background")]}),(0,D.jsxs)(c.A,{gutter:30,style:{paddingBottom:4},children:[U.formButtonFieldPaddingsEnabled&&(0,D.jsx)(D.Fragment,{children:(0,D.jsx)(m.A,{children:(0,D.jsxs)(p.A,{size:W.formItemMarginBottomXS,direction:"vertical",children:[(0,D.jsx)(c.A,{children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Top padding"),placement:"top",children:(0,D.jsx)(n.A.Item,{name:"buttonsPaddingTop",className:"selected-td-form__padding-input",style:{margin:"auto"},children:(0,D.jsx)(T.A,{min:0,className:"selected-td-form__padding-input"})})})}),(0,D.jsx)(c.A,{children:(0,D.jsxs)(p.A,{size:W.formItemMarginBottomXS,children:[(0,D.jsx)(d.A,{trigger:["hover"],title:o("Left padding"),placement:"left",children:(0,D.jsx)(n.A.Item,{name:"buttonsPaddingLeft",className:"selected-td-form__padding-input",style:{marginBottom:0},children:(0,D.jsx)(T.A,{min:0})})}),(0,D.jsx)(h.Ay,{className:l()("selected-td-form__button",{"selected-td-form__button--active":$}),onClick:()=>{G((e=>!e))},children:(0,D.jsx)(A.A,{style:{fontSize:"16px"}})}),(0,D.jsx)(d.A,{trigger:["hover"],title:o("Right padding"),placement:"right",children:(0,D.jsx)(n.A.Item,{name:"buttonsPaddingRight",className:"selected-td-form__padding-input",style:{marginBottom:0},children:(0,D.jsx)(T.A,{min:0})})})]})}),(0,D.jsx)(c.A,{children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Bottom padding"),placement:"bottom",children:(0,D.jsx)(n.A.Item,{name:"buttonsPaddingBottom",className:"selected-td-form__padding-input",style:{margin:"0 auto 20px"},children:(0,D.jsx)(T.A,{min:0})})})})]})})}),(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Buttons background color"),placement:"left",children:(0,D.jsx)(n.A.Item,{name:"buttonsBackgroundColor",children:(0,D.jsx)(C.A,{placeholder:o("Background color"),usedColors:X.usedColors})})})})]}),U.formFieldBorderEnabled&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(u.A,{className:"selected-td-form__divider"}),(0,D.jsxs)("div",{className:"form-group-title",children:[o("Buttons")," ",(0,D.jsx)("span",{className:"form-group-title__bull",children:"\u2022"})," ",o("Borders")]}),(0,D.jsx)("div",{style:{paddingBottom:4},children:(0,D.jsx)(E.A,{borders:Z.buttonsBorder})})]}),U.formFieldBorderRadiusEnabled&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(u.A,{className:"selected-td-form__divider"}),(0,D.jsxs)("div",{className:"form-group-title",children:[o("Buttons")," ",(0,D.jsx)("span",{className:"form-group-title__bull",children:"\u2022"})," ",o("Border radius")]}),(0,D.jsx)("div",{style:{paddingBottom:4},children:(0,D.jsx)(N.A,{form:i,oneBorderRadiusValue:V,setOneBorderRadiusValue:q,elementSettings:Z})})]}),(0,D.jsx)(u.A,{className:"selected-td-form__divider"}),(0,D.jsxs)("div",{className:"form-group-title",children:[o("Buttons")," ",(0,D.jsx)("span",{className:"form-group-title__bull",children:"\u2022"})," ",o("Margins")]}),(0,D.jsxs)(c.A,{gutter:10,style:{paddingBottom:4},children:[(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Top margin"),placement:"top",children:(0,D.jsx)(n.A.Item,{name:"buttonsMarginTop",children:(0,D.jsx)(T.A,{min:0,placeholder:o("Top margin"),prefix:(0,D.jsx)(j.A,{}),addonAfter:"px"})})})}),(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Bottom margin"),placement:"top",children:(0,D.jsx)(n.A.Item,{name:"buttonsMarginBottom",children:(0,D.jsx)(T.A,{min:0,placeholder:o("Bottom margin"),prefix:(0,D.jsx)(v.A,{}),addonAfter:"px"})})})})]})]})})};O.defaultProps={className:""};const H=O},88296:(e,t,o)=>{o.d(t,{A:()=>c});var s=o(92810),a=o(79579),l=o(23287),i=o(42642),n=o(70082);const r=[{label:"Segoe UI, Helvetica Neue, Helvetica, Roboto, Arial, sans-serif",value:"-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif",className:"Segoe"},{label:"Helvetica, Roboto, Arial, sans-serif",value:"Helvetica, Roboto, Arial, sans-serif",className:"Helvetica"},{label:"Arial Black, Gadget, sans-serif",value:"'Arial Black', Gadget, sans-serif",className:"ArialBlack"},{label:"Comic Sans MS, cursive",value:"'Comic Sans MS', cursive",className:"ComicSans"},{label:"Courier New, Courier, monospace",value:"'Courier New', Courier, monospace",className:"CourierNew"},{label:"Georgia, serif",value:"Georgia, serif",className:"Georgia"},{label:"Impact, Charcoal, sans-serif",value:"Impact, Charcoal, sans-serif",className:"Impact"},{label:"Lucida Console, Monaco, monospace",value:"'Lucida Console', Monaco, monospace",className:"LucidaConsole"},{label:"Lucida Sans Unicode, Lucida Grande, sans-serif",value:"'Lucida Sans Unicode', 'Lucida Grande', sans-serif",className:"LucidaSans"},{label:"Palatino Linotype, Book Antiqua, Palatino, serif",value:"'Palatino Linotype', 'Book Antiqua', Palatino, serif",className:"Palatino"},{label:"Tahoma, Geneva, sans-serif",value:"Tahoma, Geneva, sans-serif",className:"Tahoma"},{label:"Times New Roman, Times, serif",value:"'Times New Roman', Times, serif",className:"TimesNewRoman"},{label:"Trebuchet MS, Helvetica, sans-serif",value:"'Trebuchet MS', Helvetica, sans-serif",className:"Trebuchet"},{label:"Verdana, Geneva, sans-serif",value:"Verdana, Geneva, sans-serif",className:"Verdana"}],d={100:"Thin","100i":"Thin Italic",200:"ExtraLight","200i":"ExtraLight Italic",300:"Light","300i":"Light Italic",400:"Regular","400i":"Regular Italic",500:"Medium","500i":"Medium Italic",600:"SemiBold","600i":"SemiBold Italic",700:"Bold","700i":"Bold Italic",800:"ExtraBold","800i":"ExtraBold Italic",900:"Black","900i":"Black Italic"},c=({value:e,onChange:t,textEditor:o=!1,codeMode:c=!1})=>{const{__:m}=(0,l.s9)(),u=[],p=[],[h,g]=(0,s.useState)(),[x,v]=(0,s.useState)(e),f=i.Mz.filter((e=>e.subsets.includes("cyrillic")&&"Sans Serif"===e.category&&e.popularity<100));f.forEach((e=>{u.push({label:e.family,value:e.family,children:Object.keys(e.fonts).filter((e=>d[e])).map((e=>({label:d[e],value:d[e]})))})}));const b=i.Mz.filter((e=>e.subsets.includes("cyrillic")&&"Serif"===e.category&&e.popularity<100));return b.forEach((e=>p.push({label:e.family,value:e.family,children:Object.keys(e.fonts).filter((e=>d[e])).map((e=>({label:d[e],value:d[e]})))}))),(0,s.useEffect)((()=>{if(o&&e!==x)if(e)if("Sans Serif"===e[1]){var t;g(["Google Fonts","Sans Serif",null===(t=f.find((t=>(null===t||void 0===t?void 0:t.family.replace(/\s/g,""))===e[2].replace(/\s/g,""))))||void 0===t?void 0:t.family,e[3].replace(/Italic/g," Italic")])}else if("Serif"===e[1]){var s;g(["Google Fonts","Serif",null===(s=b.find((t=>(null===t||void 0===t?void 0:t.family.replace(/\s/g,""))===e[2].replace(/\s/g,""))))||void 0===s?void 0:s.family,e[3].replace(/Italic/g," Italic")])}else"Safe Fonts"!==e[0]&&void 0!==h||g(e);else g([""]);else void 0===h&&x&&g(e);o||g(e),v(e)}),[e,f,b,h,o,x]),(0,n.jsx)(a.A,{allowClear:!1,showSearch:!0,value:h,placement:"bottomRight",options:[{label:m("Safe Fonts"),value:"Safe Fonts",children:r},{label:m("Google Fonts"),value:"Google Fonts",children:[{label:m("Sans Serif"),value:"Sans Serif",children:u},{label:m("Serif"),value:"Serif",children:p}]}],getPopupContainer:e=>e.closest(c?".selected_text_common_form_mobile":o?".email-pane__collapse-wrapper":".email-pane__content-col"),onChange:t})}},97562:(e,t,o)=>{o.d(t,{A:()=>D});var s=o(92810),a=o(95838),l=o(55039),i=o(33206),n=o(57806),r=o(29234),d=o(4800),c=o(12280),m=o(81e3),u=o(92328),p=o(43005),h=o(66726),g=o(28964),x=o(45934),v=o(37792),f=o(66170),b=o(64586),_=o(85677),j=o(9452),y=o(23287),A=o(85163),k=o(86286),S=o(64037),w=o(62303),C=o(18777),I=o(17581),E=o(55701),N=o(45695),T=o(32269),B=o(32411),L=o(38883),R=o.n(L),P=o(70082);const{useToken:F}=a.A,{TextArea:M}=l.A,D=({comments:e,subjectId:t,isLoggedIn:o,projectTitle:a="",emailElementType:L,email:D})=>{const{__:z,_n:O}=(0,y.s9)(),H=(0,N.XW)(),{modal:V}=i.A.useApp(),{error:q,notification:$}=V,{token:G}=F(),X=(0,s.useRef)(null),[U,W]=(0,s.useState)(""),[Y,K]=(0,s.useState)("ADD"),[Z,J]=(0,s.useState)(!1),[Q,ee]=(0,s.useState)(null),[te,oe]=(0,s.useState)(null),[se,ae]=(0,s.useState)(""),[le,ie]=(0,s.useState)(""),[ne,re]=(0,s.useState)(!1),[de,ce]=(0,s.useState)(""),[me,ue]=(0,C.z2)(),[pe,he]=(0,C.HI)(),[ge,xe]=(0,C.kk)(),[ve,fe]=(0,C.vn)(),[be]=(0,I.LX)(),[_e]=(0,E.yW)(),je=(0,x.d4)(k.C1),ye=(0,B.fn)(),Ae=()=>{const e={title:null===D||void 0===D?void 0:D.title,emailId:null===D||void 0===D?void 0:D.id,project:null===D||void 0===D?void 0:D.project,html:null===ye||void 0===ye?void 0:ye.getValue(),excerpt:null===D||void 0===D?void 0:D.date_gmt};"email"===L?be({emailId:null===D||void 0===D?void 0:D.id,body:e}).catch((e=>{console.log(e)})):_e({blockId:null===D||void 0===D?void 0:D.id,body:e}).catch((e=>{console.log(e)}))};function ke(e){oe(Q),ae(""),K("REPLY")}const Se=()=>{q({maskClosable:!0,centered:!0,title:z("Please log in"),content:z(`To leave comments you must be logged into EmailMaker and added to the project "${a}".`),okText:z("Okay. I'll log in.")})};async function we(){o?(await ge({commentId:te,content:le,targetId:de}).unwrap(),K("ADD"),ie(""),oe(0),re(!1),J(!1),ce(""),H({operation:A.Ru.SANDBOX_DISCUSS_RESET})):Se()}const Ce=e=>{K("ADD"),ie(""),oe(0),re(!1),J(!1),ce(""),H({operation:A.Ru.SANDBOX_DISCUSS_RESET})},Ie=async()=>{o?((U||se)&&await me({subjectId:t,author:je.id,parent:"ADD"===Y?"0":te,content:U||se,author_name:je.name,author_email:je.email,targetId:de}).then((e=>{e.error&&$.error({message:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.code}}),description:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.message}}),placement:"bottomRight"})})),ce(""),K("ADD"),ae(""),W(""),oe(0),re(!1),J(!1),H({operation:A.Ru.SANDBOX_DISCUSS_RESET})):Se()};function Ee(){ne?(J(!1),re(!1),H({operation:A.Ru.SANDBOX_DISCUSS_REMOVE_TARGET,value:de})):(J(!Z),H({operation:A.Ru.SANDBOX_DISCUSS_SET_TARGET,value:!Z}),Z&&re(!1))}(0,S.A)((e=>{const t=e.data.operation;if(t===A.Ru.APPLICATION_DISCUSS_SET_ID&&(ce(e.data.settings.value),""!==e.data.settings.value?(re(!0),J(!1)):(re(!1),J(!0))),t===A.Ru.APPLICATION_DISCUSS_SAVE_TARGET&&Ae(),t===A.Ru.APPLICATION_DISCUSS_GET_COMMENT)if(document.querySelector('.comment-icon-target[target-id="'+e.data.settings.targetId+'"]')){let t=document.querySelector('.comment-icon-target[target-id="'+e.data.settings.targetId+'"]').closest(".ant-comment");document.querySelector(".comment-block")?document.querySelector(".comment-block").scrollTo(0,t.offsetTop):document.querySelector(".em-analytics__email-tab-discuss .ant-tabs-content").scrollTo(0,t.offsetTop),t.classList.add("active"),setTimeout((()=>{t.classList.remove("active")}),2e3)}else H({operation:A.Ru.SANDBOX_DISCUSS_REMOVE_TARGET,value:e.data.settings.targetId}),$.error({message:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:z("There's no such comment.")}}),placement:"bottomRight"});t===A.Ru.APPLICATION_DISCUSS_NO_COMMENT&&$.error({message:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:z("There's no such element in the email.")}}),placement:"bottomRight"})}));const Ne=e=>{H({operation:A.Ru.SANDBOX_DISCUSS_GET_TARGET,value:e})},Te=e=>(null===e||void 0===e||e.sort(((e,t)=>e.date>t.date?1:-1)),(0,P.jsx)(P.Fragment,{children:e&&!!e.length&&(0,P.jsx)(n.A,{className:"comment-list",itemLayout:"horizontal",dataSource:e,renderItem:e=>(0,P.jsx)(P.Fragment,{children:(0,P.jsx)("li",{id:e.id,children:(0,P.jsxs)(P.Fragment,{children:["deleted"===e.status&&e.clildren&&(0,P.jsx)(g.A,{className:"deletedComment",content:(0,P.jsx)(r.A,{description:z("Comment was removed."),type:"info"}),children:Te(e.children)}),"deleted"!==e.status&&(0,P.jsx)(P.Fragment,{children:(0,P.jsx)(g.A,{author_id:e.author_id,author:e.author_name,avatar:e.author_avatar_urls&&e.author_avatar_urls[48]||"",className:R()(e.target_id&&"targetted-comment-item",(!e.author_avatar_urls||!e.author_avatar_urls[48])&&"comment-item-noavatar"),content:(0,P.jsx)(d.A,{placement:"left",onOpenChange:()=>ee(e.id),menu:{items:e.author===je.id?Re:Pe},overlayStyle:{minWidth:"auto",paddingRight:6},children:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:e.content}})},"commenMenu"),datetime:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)("span",{dangerouslySetInnerHTML:{__html:e.date&&(0,T.Yq)((0,T.Cl)(e.date),O,!0)}}),e.target_id&&(0,P.jsx)("span",{className:"comment-icon-target","target-id":e.target_id,onClick:()=>Ne(e.target_id),children:(0,P.jsx)(v.A,{style:{color:G.colorInfo,top:-2,position:"relative"}})})]}),children:(0,P.jsxs)(P.Fragment,{children:["REPLY"===Y&&te===e.id&&Le,"EDIT"===Y&&te===e.id&&Be,Te(e.children)]})})})]})})})})})),Be=(0,P.jsxs)(c.A,{onFinish:we,className:"commentForm",children:[(0,P.jsx)(c.A.Item,{style:{marginBottom:10},children:(0,P.jsx)(M,{className:"textarea-reply",value:le,onChange:e=>ie(e.target.value),rows:4,placeholder:z("Editing comments"),onKeyDown:e=>"Escape"===e.key&&Ce(),onPressEnter:e=>"Enter"===e.key&&e.ctrlKey&&we(),ref:X})}),(0,P.jsx)(c.A.Item,{className:"buttons",children:(0,P.jsxs)(m.A,{children:[ne?(0,P.jsx)(u.A,{title:z("Are you sure?"),okText:z("Yes"),cancelText:z("No"),onConfirm:function(e){ve(te),re(!1),ce(""),H({operation:A.Ru.SANDBOX_DISCUSS_REMOVE_TARGET,value:de})},children:(0,P.jsx)(p.Ay,{loading:fe.isLoading,type:Z||ne&&"EDIT"===Y&&""!==de?"primary":"default",className:"button-target "+(Z&&!ne?"button-target_choose":""),style:ne&&"EDIT"===Y&&""!==de?{background:G.colorInfo}:{},children:(0,P.jsx)(v.A,{className:"icon-target"})})}):(0,P.jsx)(p.Ay,{onClick:Ee,loading:fe.isLoading,type:Z||ne&&"EDIT"===Y&&""!==de?"primary":"default",className:"button-target "+(Z&&!ne?"button-target_choose":""),style:ne&&"EDIT"===Y&&""!==de?{background:G.colorInfo}:{},children:(0,P.jsx)(v.A,{className:"icon-target"})}),(0,P.jsxs)(p.Ay,{className:"button-reply",type:"primary",loading:xe.isLoading,htmlType:"submit",children:[z("Save")," ",(0,P.jsx)(f.A,{})]}),(0,P.jsx)(p.Ay,{onClick:Ce,className:"button-reply",children:z("Cancel")})]})})]}),Le=(0,P.jsxs)(c.A,{name:"reply",className:"commentForm",onFinish:Ie,children:[(0,P.jsx)(c.A.Item,{style:{marginBottom:10},children:(0,P.jsx)(M,{className:"textarea-reply",value:se,onChange:e=>ae(e.target.value),rows:4,placeholder:z("Reply to the comment"),onKeyDown:e=>"Escape"===e.key&&Ce(),onPressEnter:e=>"Enter"===e.key&&e.ctrlKey&&Ie(),ref:X})}),(0,P.jsx)(c.A.Item,{hidden:!0,name:"targetId",children:(0,P.jsx)(l.A,{type:"hidden"})}),(0,P.jsx)(c.A.Item,{className:"buttons",children:(0,P.jsxs)(m.A,{children:[(0,P.jsx)(h.A,{placement:"top",title:z("Add a note"),overlayStyle:{maxWidth:"150px"},children:(0,P.jsx)(p.Ay,{onClick:Ee,type:Z||ne&&"REPLY"===Y&&""!==de?"primary":"default",className:"button-target "+(Z&&!ne?"button-target_choose":""),style:ne&&"REPLY"===Y&&""!==de?{background:G.colorInfo}:{},children:(0,P.jsx)(v.A,{className:"icon-target"})})}),(0,P.jsxs)(p.Ay,{className:"button-reply",type:"primary",loading:"REPLY"===Y&&ue.isLoading,htmlType:"submit",children:[z("Reply")," ",(0,P.jsx)(w.A,{icon:"SendOutlined"})]}),(0,P.jsx)(p.Ay,{onClick:Ce,className:"button-reply",ghost:!0,type:"primary",children:z("Cancel")})]})})]});(0,s.useEffect)((()=>{"REPLY"===Y&&X.current.focus({cursor:"start"}),"EDIT"===Y&&X.current.focus({cursor:"end"})}),[Y]);let Re=[];Re.push({key:"Reply to comment",icon:(0,P.jsx)(b.A,{style:{fontSize:"16px"}}),label:z("Reply"),onClick:ke},{key:"Edit comment",icon:(0,P.jsx)(_.A,{style:{fontSize:"16px"}}),label:z("Edit"),onClick:function(t){var o,s,a,l,i;oe(Q),re(Boolean(null===(o=e.find((e=>{var t;return(null===(t=e.id)||void 0===t?void 0:t.toString())===Q})))||void 0===o||null===(s=o.target_id)||void 0===s?void 0:s.toString())),ie(null===(a=e.find((e=>{var t;return(null===(t=e.id)||void 0===t?void 0:t.toString())===Q})))||void 0===a||null===(l=a.content)||void 0===l||null===(i=l.slice(3,-5))||void 0===i?void 0:i.toString()),K("EDIT")}},{key:"Delete comment",icon:(0,P.jsx)(j.A,{style:{fontSize:"16px"}}),label:z("Delete"),style:{color:G.colorError},onClick:function(){var t,o;oe(Q),e.filter((e=>e.parent===Q)).length?ge({commentId:Q,status:"deleted"}).unwrap():pe(Q),(null===(t=document.querySelector('.discuss-main li[id="'+Q+'"] .comment-icon-target'))||void 0===t?void 0:t.getAttribute("target-id"))&&H({operation:A.Ru.SANDBOX_DISCUSS_REMOVE_TARGET,value:null===(o=document.querySelector('.discuss-main li[id="'+Q+'"] .comment-icon-target'))||void 0===o?void 0:o.getAttribute("target-id")}),Ae(),ce("")}});let Pe=[];return Pe.push({key:"Reply to comment",icon:(0,P.jsx)(b.A,{style:{fontSize:"16px"}}),label:z("Reply"),onClick:ke}),(0,P.jsxs)("div",{className:"discuss-main",children:[e.length>0&&(0,P.jsx)(n.A,{className:"comment-list",itemLayout:"horizontal",dataSource:function(e){let t=JSON.parse(JSON.stringify(e));if(!t||!t.length)return[];let o=[],s=new Map;for(let a=0,l=t.length;a<l;++a){let e=t[a],l=s.get(e.id);if(l&&!Array.isArray(l)||(l&&(e.children=l),s.set(e.id,e)),"0"===String(e.parent))o.push(e);else{let t=s.get(e.parent);if(t){(Array.isArray(t)?t:t.children=t.children||[]).push(e)}else s.set(e.parent,[e])}}return o.forEach((e=>{"deleted"!==e.status||e.children||!he.isUninitialized&&!he.isSuccess||pe(e.id).unwrap().catch((e=>{}))})),o}(e),renderItem:e=>(0,P.jsxs)("li",{id:e.id,children:["deleted"===e.comment_status&&(0,P.jsx)(g.A,{className:"deletedComment",content:(0,P.jsx)(r.A,{description:z("Comment was removed."),type:"info"}),children:Te(e.children)}),"deleted"!==e.comment_status&&(0,P.jsx)(P.Fragment,{children:(0,P.jsx)(g.A,{author_id:e.author_id,author:e.author_name,avatar:e.author_avatar_urls&&e.author_avatar_urls[48]||"",className:R()(e.target_id&&"targetted-comment-item",(!e.author_avatar_urls||!e.author_avatar_urls[48])&&"comment-item-noavatar"),content:(0,P.jsx)(d.A,{placement:"left",destroyPopupOnHide:!0,onOpenChange:()=>ee(e.id),menu:{items:e.author===je.id?Re:Pe},overlayStyle:{minWidth:"auto"},children:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:e.content}})},"commenMenu"),datetime:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)("span",{dangerouslySetInnerHTML:{__html:e.date&&(0,T.Yq)((0,T.Cl)(e.date),O,!0)}}),e.target_id&&(0,P.jsx)("span",{className:"comment-icon-target","target-id":e.target_id,onClick:()=>Ne(e.target_id),children:(0,P.jsx)(v.A,{style:{color:G.colorInfo,top:-2,position:"relative"}})})]}),children:(0,P.jsxs)(P.Fragment,{children:["REPLY"===Y&&te===e.id&&Le,"EDIT"===Y&&te===e.id&&Be,Te(e.children)]})})})]})}),(0,P.jsxs)(c.A,{onFinish:Ie,className:"ADD"===Y?"addMode":"replyEditMode",children:[(0,P.jsx)(c.A.Item,{style:{marginBottom:10},children:(0,P.jsx)(M,{value:U,onChange:e=>W(e.target.value),rows:4,placeholder:z("Leave your comment"),className:"textarea-comment",onPressEnter:e=>"Enter"===e.key&&e.ctrlKey&&Ie()})}),(0,P.jsxs)(c.A.Item,{children:[(0,P.jsx)(h.A,{placement:"top",title:z("Add a note"),overlayStyle:{maxWidth:"150px"},children:(0,P.jsx)(p.Ay,{onClick:Ee,type:Z||ne&&"ADD"===Y&&""!==de?"primary":"default",className:"button-target "+(Z&&!ne?"button-target_choose":""),style:ne&&"ADD"===Y&&""!==de?{background:G.colorInfo}:{},children:(0,P.jsx)(v.A,{className:"icon-target"})})}),(0,P.jsxs)(p.Ay,{className:"button-add",type:"primary",loading:"ADD"===Y&&ue.isLoading,htmlType:"submit",children:[z("Send")," ",(0,P.jsx)(w.A,{icon:"SendOutlined"})]})]})]})]})}},63719:(e,t,o)=>{o.d(t,{A:()=>R});var s=o(92810),a=o(55039),l=o(66726),i=o(57806),n=o(12280),r=o(43005),d=o(4800),c=o(14852),m=o(71157),u=o(28964),p=o(23287),h=o(74267),g=o(25984),x=o(64617),v=o(45934),f=o(81325),b=o(79716),_=o(70082);const j=e=>{const{__:t}=(0,p.s9)();return[{key:"\ud83d\udce7",label:(0,_.jsxs)("div",{onClick:()=>{e("theme-and-preheader-generator")},children:["\ud83d\udce7 ",t("Subject line & preheader generator")]})},{key:"\ud83c\udf0e",label:(0,_.jsxs)("div",{onClick:()=>{e("translator")},children:["\ud83c\udf0e ",t("Translator")]})},{key:"\ud83d\udcc4",label:(0,_.jsxs)("div",{onClick:()=>{e("writer")},children:["\ud83d\udcc4 ",t("Copywriter")]})},{key:"\ud83d\udd0e",label:(0,_.jsxs)("div",{onClick:()=>{e("corrector")},children:["\ud83d\udd0e ",t("Proofreader")]})},{key:"\ud83e\udde0",label:(0,_.jsxs)("div",{onClick:()=>{e("psychologist")},children:["\ud83e\udde0 ",t("Psychologist")]})},{key:"\ud83d\udcc8",label:(0,_.jsxs)("div",{onClick:()=>{e("marketolog")},children:["\ud83d\udcc8 ",t("Marketer")]})},{key:"\u2728",label:(0,_.jsxs)("div",{onClick:()=>{e("email-generator")},children:["\u2728 ",t("Email generator")]})}]};var y=o(62303),A=o(84612),k=o(58819),S=o(86286),w=o(65983),C=o(45695),I=o(32269),E=o(47381),N=o(85163),T=o(32411),B=o(58689);const{TextArea:L}=a.A,R=({messages:e})=>{const{__:t,_n:o}=(0,p.s9)(),a=(0,v.wA)(),R=(0,C.XW)(),P=(0,C.QC)(),{projectId:F,emailId:M}=(0,x.g)(),[D,z]=(0,A.EQ)(),[O]=(0,A.YG)(),[H,{data:V=[]}]=(0,k.y4)(),[q,$]=(0,s.useState)(null),[G,X]=(0,s.useState)(!1),[U,W]=(0,s.useState)(null),[Y]=(0,k.MN)(),K=(0,v.d4)(w.Hs),Z=(0,v.d4)(S.C1),J=(0,m.hN)(),Q=(0,T.fn)(),[ee,te]=(0,s.useState)([]),[oe,se]=(0,s.useState)(""),ae=(0,s.useRef)(null),[le,ie]=(0,s.useState)(!1),[ne,re]=(0,s.useState)(!1),de={cursor:ne?"not-allowed":"default",pointerEvents:ne?"none":"auto"},ce=async()=>await P.sendAsync(N.Ru.SANDBOX_IS_EMAIL_EMPTY),me=()=>{X(!0),re(!0),Y({task_id:U,entity_id:M,status:"started"}).then((()=>{pe()}))},ue=(0,s.useCallback)((()=>{var e;const t=null===(e=ae.current)||void 0===e?void 0:e.closest(".ant-tabs-content.ant-tabs-content-top");setTimeout((()=>{null===t||void 0===t||t.scrollTo({top:t.scrollHeight,behavior:"smooth"})}),0)}),[ae]),pe=(0,s.useCallback)((()=>{O({entity_id:M}).then((e=>{te(e.data.documents),ue()}))}),[M,O,te,ue]);(0,s.useEffect)((()=>{let e;if(G){var t,o;const s=null===(t=V[V.length-1])||void 0===t||null===(o=t.processing)||void 0===o?void 0:o.email;if(s){let t=V[V.length-1].status;if(e=setInterval(Q.setValue(s),500),0===t){Y({task_id:U,entity_id:M,status:"completed"}).then((()=>{pe()})),re(!1)}}q&&(clearInterval(e),a((0,w.AJ)(s)),X(!1),$(!1))}return()=>{clearInterval(e)}}),[Q,q,a,V,G,K,M,U,pe,Y,z]),(0,s.useEffect)(ue,[ue]),(0,s.useEffect)((()=>{(null===e||void 0===e?void 0:e.length)>0&&te(e),R({operation:N.Ru.SANDBOX_EMAIL_CONTENT_GET})}),[e,R]),(0,s.useEffect)((()=>{const e=P.onInit((()=>{P.send({operation:N.Ru.SANDBOX_LOCK_EDIT,data:ne}),P.send({operation:N.Ru.SANDBOX_LOCK_DISCUSS,value:ne})}));return()=>e.dispose()}),[ne,P]);const he=async()=>{if(oe){const e=oe.replace(/ /g," ").replace(/\n/g,"<br />"),t={project_id:F,connection:"chat",entity_id:M,message:e,locale:Z.locale.slice(0,2),subject:K.subject||"",preheader:K.preheader||"",textContent:(0,B.T5)(Q.getValue())};(0,E.d)({event:"submit_form",action:"chat_whit_ai_assistant",entity_id:t.entity_id,project_id:t.project_id});const o=[{data:{role:"user",message:e,userInfo:{display_name:Z.first_name+" "+Z.last_name,avatar_url:Z.avatar_urls[24]}}},{data:{role:"assistant",message:"\u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442",isLoading:!0}}];te((e=>[...e,...o])),D({body:t}).then((e=>{if(401===e.data.status)throw new Error(N.ff);if(e.data.task_id){let t=e.data.task_id;W(t),H({id:t,setError:$}),ce().then((e=>{e?me():ie(!0)}))}pe()})).catch((e=>{var t,o;J.error({message:(0,_.jsx)("div",{dangerouslySetInnerHTML:{__html:(null===e||void 0===e||null===(t=e.data)||void 0===t?void 0:t.code)||"Error"}}),description:(0,_.jsx)("div",{dangerouslySetInnerHTML:{__html:(null===e||void 0===e||null===(o=e.data)||void 0===o?void 0:o.message)||"Something went wrong"}}),placement:"bottomRight"})})),se("")}},ge=e=>{const t={data:{role:"assistant",message:"\u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442",isLoading:!0}};te((e=>[...e,t]));const o={project_id:F,connection:"chat",entity_id:M,context:e,locale:Z.locale.slice(0,2),subject:K.subject||"",preheader:K.preheader||"",textContent:(0,B.T5)(Q.getValue())};(0,E.d)({event:"select",action:"select_ai_assistant_role",context:o.context,entity_id:o.entity_id,project_id:o.project_id}),D({body:o}).then((e=>{if(401===e.data.status)throw new Error(N.ff);pe()})).catch((e=>{var t,o;J.error({message:(0,_.jsx)("div",{dangerouslySetInnerHTML:{__html:(null===e||void 0===e||null===(t=e.data)||void 0===t?void 0:t.code)||"Error"}}),description:(0,_.jsx)("div",{dangerouslySetInnerHTML:{__html:(null===e||void 0===e||null===(o=e.data)||void 0===o?void 0:o.message)||"Something went wrong"}}),placement:"bottomRight"})}))},xe={replace:e=>{var o,s,a,i,n,r,d,c;if(null!==(o=e.attribs)&&void 0!==o&&null!==(s=o.class)&&void 0!==s&&s.split(" ").includes("ai-response-title"))return(0,_.jsx)(l.A,{placement:"left",title:t("Replace the title"),children:(0,_.jsx)("div",{onClick:()=>(e=>{const o=e.children[0].data;P.send(N.Ru.SANDBOX_SUBJECT_UPDATE,{value:e.children[0].data,guid:K.renderGuid,fromAI:!0}),J.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",message:t("Title copied to email settings"),placement:"bottomRight",data:o})})(e),children:(0,_.jsx)("span",{className:"ai-response-title",children:(0,g.zd)(e.children,xe)})})});if(null!==(a=e.attribs)&&void 0!==a&&null!==(i=a.class)&&void 0!==i&&i.split(" ").includes("ai-response-preheader"))return(0,_.jsx)(l.A,{placement:"left",title:t("Replace the preheader"),children:(0,_.jsx)("div",{onClick:()=>(e=>{const o=e.children[0].data;P.send(N.Ru.SANDBOX_PREHEADER_UPDATE,{value:e.children[0].data,guid:K.renderGuid,fromAI:!0}),J.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",message:t("Preheader copied to email settings"),placement:"bottomRight",data:o,duration:300})})(e),children:(0,_.jsx)("span",{className:"ai-response-preheader",children:(0,g.zd)(e.children,xe)})})});if(null!==(n=e.attribs)&&void 0!==n&&null!==(r=n.class)&&void 0!==r&&r.split(" ").includes("ai-response-copy"))return(0,_.jsx)(l.A,{placement:"left",title:t("Copy to clipboard"),children:(0,_.jsx)("div",{onClick:()=>(e=>{const o=e.children[0].data;navigator.clipboard.writeText(o).then((()=>{J.success({id:"TEXT_COPIED_TO_CLIPBOARD",message:t("Text copied to clipboard"),placement:"bottomRight",data:o})})).catch((e=>{console.error("\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0442\u0435\u043a\u0441\u0442\u0430: ",e)}))})(e),children:(0,_.jsx)("span",{className:"ai-response-copy",children:(0,g.zd)(e.children,xe)})})});if(null!==(d=e.attribs)&&void 0!==d&&null!==(c=d.class)&&void 0!==c&&c.split(" ").includes("ai-response-user-message")){var m,u,p,h,x;const t=(null===(m=e.attribs)||void 0===m?void 0:m.data)||(null===(u=e.children)||void 0===u||null===(p=u[0])||void 0===p?void 0:p.data);return(0,_.jsx)("li",{className:null===(h=e.attribs)||void 0===h?void 0:h.class,data:null===(x=e.attribs)||void 0===x?void 0:x.data,onClick:()=>(e=>{const t={data:{role:"user",message:e,userInfo:{display_name:Z.first_name+" "+Z.last_name,avatar_url:Z.avatar_urls[24]}}};te((e=>[...e,t]));const o={data:{role:"assistant",message:"\u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442",isLoading:!0}};te((e=>[...e,o]));const s={project_id:F,connection:"chat",entity_id:M,message:e,locale:Z.locale.slice(0,2),subject:K.subject||"",preheader:K.preheader||"",textContent:(0,B.T5)(Q.getValue())};D({body:s}).then((e=>{if(401===e.data.status)throw new Error(N.ff);if(e.data.task_id){let t=e.data.task_id;H({id:t,setError:$}),ce().then((e=>{e?me():ie(!0)}))}pe()})).catch((e=>{var t,o;J.error({message:(0,_.jsx)("div",{dangerouslySetInnerHTML:{__html:(null===e||void 0===e||null===(t=e.data)||void 0===t?void 0:t.code)||"Error"}}),description:(0,_.jsx)("div",{dangerouslySetInnerHTML:{__html:(null===e||void 0===e||null===(o=e.data)||void 0===o?void 0:o.message)||"Something went wrong"}}),placement:"bottomRight"})}))})(t),children:(0,g.zd)(e.children,xe)})}}};return(0,_.jsxs)("div",{ref:ae,className:"discuss-main",children:[ee.length>0&&(0,_.jsx)(i.A,{onClick:e=>{"string"===typeof e.target.className&&e.target.className.includes("ai-response-change-context")&&(z.isLoading||ge(e.target.role))},className:"comment-list",itemLayout:"horizontal",dataSource:ee,renderItem:e=>{var s,a,l;return(0,_.jsx)("li",{id:e._id,children:(0,_.jsx)(u.A,{className:e.data.userInfo?"":"ai-comment",avatar:"assistant"===e.data.role?(0,_.jsx)(y.A,{icon:"ChatGpt",className:"anticon-robot",style:{color:"#ffffff",width:24,height:24,borderRadius:"50%",justifyContent:"center"}}):!e.data.userInfo||!e.data._modified&&N.EW.isPlugin?Z.avatar_urls[24]||(0,_.jsx)(f.A,{style:{color:"#ffffff",width:24,height:24,borderRadius:"50%",justifyContent:"center"}}):e.data.userInfo.avatar_url,author:(0,_.jsx)("div",{style:de,children:"user"===(null===e||void 0===e||null===(s=e.data)||void 0===s?void 0:s.role)?N.EW.isPlugin?(null===Z||void 0===Z?void 0:Z.username)||t("User"):null===(a=e.data)||void 0===a||null===(l=a.userInfo)||void 0===l?void 0:l.display_name:t("AI Assistant")}),datetime:e._created?(0,_.jsx)("span",{dangerouslySetInnerHTML:{__html:(0,I.Yq)((0,h.A)(e._created),o,!0)}}):null,content:e.data.isLoading?(0,_.jsx)("div",{className:"spin",children:(0,_.jsx)(b.A,{style:{fontSize:24},spin:!0})}):(0,_.jsx)("div",{style:de,children:(0,g.Ay)(e.data.message,xe)})})},e._id)}}),(0,_.jsxs)(n.A,{onFinish:he,className:"addMode",children:[(0,_.jsx)(n.A.Item,{style:{marginBottom:10},children:(0,_.jsx)(L,{disabled:ne,value:oe,onChange:e=>se(e.target.value),rows:4,placeholder:t("Type your request"),className:"textarea-comment",onPressEnter:e=>"Enter"===e.key&&e.ctrlKey&&he(),spellCheck:"false"})}),(0,_.jsxs)(n.A.Item,{children:[(0,_.jsx)(r.Ay,{disabled:z.isLoading||ne,type:"default",style:{background:"var(--colorInfo)",color:"#ffffff"},className:"button-target",children:(0,_.jsx)(d.A,{placement:"top",disabled:ne,arrow:{pointAtCenter:!0},menu:{items:j(ge)},children:(0,_.jsxs)("div",{disabled:ne,style:{margin:0,padding:0},children:[(0,_.jsx)(y.A,{icon:"ChatGpt"}),t("Role")]})},"Export")}),(0,_.jsxs)(r.Ay,{disabled:z.isLoading||ne,className:"button-add",type:"primary",htmlType:"submit",children:[t("Send")," ",(0,_.jsx)(y.A,{icon:"SendOutlined"})]})]})]}),(0,_.jsx)(c.A,{title:t("Warning"),centered:!0,open:le,onOk:()=>{me(),ie(!1)},onCancel:()=>{ie(!1)},children:(0,_.jsx)("p",{children:t("The current template will be changed to the generated one, are you sure about this?")})})]})}},44997:(e,t,o)=>{o.d(t,{A:()=>n});var s=o(92810),a=o(78159),l=o(70082);const i=s.forwardRef(((e,t)=>{const[o,i]=(0,s.useState)(!1),[n,r]=(0,s.useState)(0),[d,c]=(0,s.useState)(e.value||e.defaultValue),[m,u]=(0,s.useState)(e.value||e.defaultValue),p=()=>i(!1),h=(0,s.useCallback)((t=>{if(o){const o=t.clientX-n;let s=(d||0)+o*e.dragspeed;s=Math.max(0,Math.round(s)),e.max&&(s=Math.min(s,e.max)),u(s),e.onChange&&e.onChange(s)}}),[o,e,d,n]);return(0,s.useEffect)((()=>{e.value||0===e.value?u(e.value):e.defaultValue||0===e.defaultValue?u(e.defaultValue):u(null)}),[e.value,e.defaultValue]),(0,s.useEffect)((()=>(document.addEventListener("mouseup",p),document.addEventListener("mousemove",h),()=>{document.removeEventListener("mouseup",p),document.removeEventListener("mousemove",h)})),[o,n,d,h]),(0,l.jsxs)("div",{onMouseDown:e=>{var t,o;e.target.hasAttribute("class")&&null!==(t=e.target)&&void 0!==t&&null!==(o=t.className)&&void 0!==o&&o.includes("ant-input-number-affix-wrapper")&&(i(!0),r(e.clientX),c(m))},children:[(0,l.jsx)(a.A,{...e,ref:t,value:m,className:"input-draggable"}),o&&(0,l.jsx)("div",{style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",cursor:"ew-resize"},onMouseUp:p})]})}));i.defaultProps={dragspeed:1};const n=i},65052:(e,t,o)=>{o.d(t,{A:()=>R});var s=o(92810),a=o(45934),l=o(81662),i=o(12280),n=o(2018),r=o(7744),d=o(55039),c=o(8701),m=o(14852),u=o(43005),p=o(86889),h=o(71157),g=o(39110),x=o(55782),v=o(28372),f=o(5031),b=o(81325),_=o(23287),j=o(64936),y=o(86286),A=o(65983),k=o(39990),S=o(83351),w=o(44997),C=o(32269),I=o(69156),E=o(45695),N=o(85163),T=o(70082);const{Option:B}=l.A,L="profile",R=({isModalVisible:e})=>{const{__:t}=(0,_.s9)(),o=(0,a.d4)(y.C1),R=(0,a.d4)(y.yf),[P,F]=(0,k.hZ)(),[M]=(0,S.uX)(),D=(0,h.hN)(),z=(0,E.XW)(),O=(0,a.wA)(),[H]=i.A.useForm(),[V,q]=(0,s.useState)([]),[$,G]=(0,s.useState)([]),[X,U]=(0,s.useState)(L),[W,Y]=(0,s.useState)({currentPassword:!1,newPassword:!1,confirmPassword:!1}),[K,Z]=(0,s.useState)((()=>o.locale)),[J,Q]=(0,k.b9)(),ee=(0,s.useRef)(null),te=t("If you turn the switch off, lines of code will not wrap. If you turn the switch on, lines of code will wrap at the viewport.");(0,s.useEffect)((()=>{if(H&&e){U(L),P(void 0,!0);const e=o.code_editor;Z(o.locale),H.setFieldsValue({firstName:o.first_name,lastName:o.last_name,email:o.email,theme:o.theme,currentPassword:"",newPassword:"",confirmPassword:"",autosaves:Boolean(o.autosaves),hideMergetags:Boolean(o.hide_mergetags),language:o.locale,newsLetterConsent:Boolean(o.newsletter_consent),codeEditor:{fontSize:e.font_size||10,fontFamily:e.font_family,tabSize:e.tab_size||2,wordWrap:Boolean(e.word_wrap),minimap:Boolean(e.minimap),insertSpaces:Boolean(e.insert_spaces)}})}}),[o,H,e,P,Z]),(0,s.useEffect)((()=>{if(H&&e){if(F.isSuccess){var t,o,s,a;let e=null===(t=(0,C.EU)(R,["acf","theme"]))||void 0===t||null===(o=t.items)||void 0===o?void 0:o.enum;const l=null===(s=(0,C.EU)(R,["acf","code_editor","font_family"]))||void 0===s||null===(a=s.items)||void 0===a?void 0:a.enum;q((0,C.d_)(e)),G((0,C.d_)(l))}F.isError&&(0,C.p6)(F,D)}}),[F,H,e,R,D]);const oe=()=>{const e=window.localStorage.getItem(N.V0.em_color_scheme),s=matchMedia(N.F3).matches?N.nd:N.T;z({operation:N.Ru.UPDATE_PREVIEW,theme:e||s}),H.validateFields().then((e=>{const s=e.codeEditor;e.currentPassword&&e.newPassword?M({username:o.email,password:e.currentPassword}).then((o=>{o.error?(H.setFieldsValue({currentPassword:"",newPassword:"",confirmPassword:""}),ee.current.focus({cursor:"start"}),D.error({message:(0,T.jsx)("div",{dangerouslySetInnerHTML:{__html:t("You entered the current password incorrectly.")}}),description:(0,T.jsx)("div",{dangerouslySetInnerHTML:{__html:t("Please, try to change your password again.")}}),placement:"bottomRight"})):J({password:e.newPassword})})):J({first_name:e.firstName,last_name:e.lastName,email:e.email,locale:e.language,autosaves:e.autosaves,hide_mergetags:e.hideMergetags,theme:e.theme,newsletter_consent:e.newsLetterConsent,code_editor:s?{font_size:s.fontSize,font_family:s.fontFamily,tab_size:s.tabSize,word_wrap:s.wordWrap,minimap:s.minimap,insert_spaces:s.insertSpaces}:null})}))};(0,s.useEffect)((()=>{Q.isError&&(0,C.p6)(Q,D)}),[Q,D]),(0,s.useEffect)((()=>{Q.isSuccess&&((0,C.wB)(t("Your profile was successfully updated."),D),O((0,j.Oo)()))}),[O,Q,t,D]);const[se,ae]=(0,s.useState)("");(0,s.useEffect)((()=>{const t=window.localStorage.getItem(N.V0.em_color_scheme);e&&(H.setFieldsValue({theme:null!==t?t:N.IJ}),ae(null!==t?t:N.IJ))}),[H,e]);const le=(0,s.useCallback)((e=>{let t;if((0,I.Hk)(e),e===N.IJ){const e=matchMedia(N.F3).matches?N.nd:N.T;localStorage.removeItem(N.V0.em_color_scheme),t=e}else localStorage.setItem(N.V0.em_color_scheme,e),t=e;O((0,A.eX)(t===N.nd?`vs-${t}`:N.T)),(0,I.A5)(t)}),[O]),ie=(0,s.useCallback)((()=>{se!==H.getFieldValue("theme")&&le(se),O((0,y.ww)(o.code_editor)),O((0,y.ko)(K)),O((0,j.Oo)())}),[o.code_editor,O,H,se,le,K]);let ne=[{label:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(g.A,{}),t("Profile")]}),key:L,className:"em-analytics__profile-user",children:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(n.A,{gutter:16,children:[(0,T.jsxs)(r.A,{span:12,children:[" ",(0,T.jsx)(i.A.Item,{label:t("First name"),name:"firstName",children:(0,T.jsx)(d.A,{placeholder:t("Enter your first name")})})]}),(0,T.jsx)(r.A,{span:12,children:(0,T.jsx)(i.A.Item,{label:t("Last name"),name:"lastName",children:(0,T.jsx)(d.A,{placeholder:t("Enter your last name")})})})]}),(0,T.jsxs)(n.A,{gutter:16,children:[(0,T.jsx)(r.A,{span:12,children:(0,T.jsx)(i.A.Item,{label:t("Email"),name:"email",children:(0,T.jsx)(d.A,{disabled:!0,placeholder:t("Enter your email")})})}),(0,T.jsx)(r.A,{span:12,children:(0,T.jsx)(i.A.Item,{label:t("Theme"),name:"theme",children:(0,T.jsx)(l.A,{placeholder:t("Select a theme"),children:V.map((e=>{let o="";switch(e.value){case"light":o=t("Light");break;case"dark":o=t("Dark");break;default:o=t("System")}return(0,T.jsx)(B,{value:e.value,children:o},e.value)}))})})})]}),(0,T.jsxs)(n.A,{gutter:16,children:[(0,T.jsx)(r.A,{span:12,children:(0,T.jsx)(i.A.Item,{label:t("Newsletter Subscription"),valuePropName:"checked",name:["newsLetterConsent"],children:(0,T.jsx)(c.A,{})})}),(0,T.jsx)(r.A,{span:12,children:(0,T.jsx)(i.A.Item,{label:t("Autosave in editor"),valuePropName:"checked",name:["autosaves"],children:(0,T.jsx)(c.A,{})})})]})]})},{label:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(x.A,{}),t("Code editor")]}),key:"editor",className:"account-settings-codeiditor-tab-content em-analytics__profile-code-editor",children:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(n.A,{gutter:16,children:[(0,T.jsx)(r.A,{span:8,children:(0,T.jsx)(i.A.Item,{label:t("Font size"),name:["codeEditor","fontSize"],children:(0,T.jsx)(w.A,{min:6,max:100})})}),(0,T.jsx)(r.A,{span:8,children:(0,T.jsx)(i.A.Item,{label:t("Tab size"),name:["codeEditor","tabSize"],children:(0,T.jsx)(w.A,{min:1,max:10})})}),(0,T.jsx)(r.A,{span:8,children:(0,T.jsx)(i.A.Item,{label:t("Font family"),name:["codeEditor","fontFamily"],children:(0,T.jsx)(l.A,{placeholder:t("Select a font family"),children:$.map((e=>(0,T.jsx)(B,{value:e.value,children:e.label},e.value)))})})})]}),(0,T.jsxs)(n.A,{gutter:16,children:[(0,T.jsx)(r.A,{span:8,children:(0,T.jsx)(i.A.Item,{label:t("Line wrap"),valuePropName:"checked",name:["codeEditor","wordWrap"],tooltip:{title:te,icon:(0,T.jsx)(v.A,{})},children:(0,T.jsx)(c.A,{})})}),(0,T.jsx)(r.A,{span:8,children:(0,T.jsx)(i.A.Item,{label:t("Minimap"),valuePropName:"checked",name:["codeEditor","minimap"],tooltip:{title:t("Display the minimap."),icon:(0,T.jsx)(v.A,{})},children:(0,T.jsx)(c.A,{})})}),(0,T.jsx)(r.A,{span:8,children:(0,T.jsx)(i.A.Item,{label:t("Insert spaces"),valuePropName:"checked",name:["codeEditor","insertSpaces"],tooltip:{title:t("Prefer spaces over tabs."),icon:(0,T.jsx)(v.A,{})},children:(0,T.jsx)(c.A,{})})})]})]})},{label:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.A,{}),t("Security")]}),key:"security",className:"account-settings-security-tab-content em-analytics__profile-code-editor",children:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(n.A,{gutter:16,children:(0,T.jsx)(r.A,{span:12,children:(0,T.jsx)(i.A.Item,{label:t("Current password"),name:"currentPassword",children:(0,T.jsx)(d.A.Password,{readOnly:!W.currentPassword,onFocus:()=>Y((e=>({...e,currentPassword:!0}))),ref:ee,placeholder:t("Enter your current password")})})})}),(0,T.jsxs)(n.A,{gutter:16,children:[(0,T.jsx)(r.A,{span:12,children:(0,T.jsx)(i.A.Item,{label:t("New password"),name:"newPassword",extra:t("At least 8 characters, including a combination of uppercase and lowercase letters, numbers, and special characters."),validateTrigger:["onSubmit"],rules:[{required:!1,message:t("Enter your new password")},({getFieldValue:e})=>({validator(o,s){if("security"===X){return e("currentPassword")?s.length>=8&&/[0-9]/.test(s)&&/[a-z]/.test(s)&&/[A-Z]/.test(s)&&/\W+|_/g.test(s)?Promise.resolve():Promise.reject(new Error(t("The password is too simple."))):Promise.reject(new Error("Enter your current password"))}return Promise.resolve()}})],children:(0,T.jsx)(d.A.Password,{readOnly:!W.newPassword,onFocus:()=>Y((e=>({...e,newPassword:!0}))),placeholder:t("Enter your new password")})})}),(0,T.jsx)(r.A,{span:12,children:(0,T.jsx)(i.A.Item,{label:t("Confirmation"),name:"confirmPassword",validateTrigger:["onSubmit"],rules:[{required:"security"===X,message:t("Repeat the new password")},({getFieldValue:e})=>({validator:(o,s)=>s&&e("newPassword")!==s?Promise.reject(new Error(t("The two passwords that you entered do not match!"))):Promise.resolve()})],children:(0,T.jsx)(d.A.Password,{readOnly:!W.confirmPassword,onFocus:()=>Y((e=>({...e,confirmPassword:!0}))),placeholder:t("Repeat the new password")})})})]})]})}];return(0,T.jsx)(m.A,{width:572,className:"account-settings blocks-modal",title:(0,T.jsxs)("div",{children:[(0,T.jsx)(b.A,{})," ",t("Account settings")]}),open:e,onOk:oe,onCancel:ie,centered:!0,footer:[(0,T.jsx)(u.Ay,{size:"large",className:"em-analytics__profile-save",type:"primary",loading:Q.isLoading,onClick:oe,children:t("Update")},"Update")],children:(0,T.jsx)(i.A,{form:H,layout:"vertical",name:"edit_profile_form",onFinish:oe,initialValues:{remember:!1,firstName:"",lastName:"",email:"",theme:"system",currentPassword:"",newPassword:"",confirmPassword:"",autosaves:!1,email_builder_config:"simple",hideMergetags:!0,newsLetterConsent:!1,code_editor:{fontSize:10,fontFamily:"Anonymous Pro",tabSize:2,wordWrap:!0,minimap:!1,insertSpaces:!1}},onValuesChange:e=>{e.theme&&le(e.theme);const t=e.codeEditor;e.language&&O((0,y.ko)(e.language)),e.codeEditor&&O((0,y.ww)({font_size:t.fontSize,font_family:t.fontFamily,tab_size:t.tabSize,word_wrap:t.wordWrap,minimap:t.minimap,insert_spaces:t.insertSpaces}))},autoComplete:"off",children:(0,T.jsx)(p.A,{activeKey:X,onChange:e=>U(e),items:ne})})})}},35285:(e,t,o)=>{o.d(t,{A:()=>N});var s=o(92810),a=o(12280),l=o(2018),i=o(7744),n=o(55039),r=o(96492),d=o(14852),c=o(43005),m=o(86889),u=o(71157),p=o(45934),h=o(23287),g=o(53931),x=o(6790),v=o(31540),f=o(25273),b=o(8375),_=o(84568),j=o(64936),y=o(36404),A=o(85163),k=o(32269),S=o(70082);const w="mainsettings",C="ftpsettings",I="webhooksettings",E=({isModalVisible:e,selectedProject:t=null})=>{const{__:o}=(0,h.s9)(),E=(0,p.wA)(),[N]=a.A.useForm(),T=(0,s.useRef)(null),B=(0,s.useRef)(null),L=(0,s.useRef)(null),R=(0,p.d4)(y.yN),P=(0,p.d4)(j.gU),F=(0,u.hN)(),M=(0,p.d4)(j.cL),[D,z]=(0,s.useState)(w),[O,H]=(0,s.useState)(!1),V=t||R,q=[C,w,I].includes(P),[$,G]=(0,_.OD)();(0,s.useEffect)((()=>{if(M===A.lx.EDIT_PROJECT_MODAL){const e={mainsettings:T,ftpsettings:B,webhooksettings:L};setTimeout((()=>{var t;return null===(t=e[D].current)||void 0===t?void 0:t.focus({cursor:"end"})}),200)}}),[M,D]),(0,s.useEffect)((()=>{q&&z(P)}),[P,q,z,E]);let X=[{label:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(g.A,{}),o("Main settings")]}),key:w,className:"em-analytics__mainsettings-project",children:(0,S.jsx)(S.Fragment,{children:(0,S.jsx)(l.A,{gutter:24,children:(0,S.jsx)(i.A,{span:24,children:(0,S.jsx)(a.A.Item,{label:o("Project name"),name:"name",extra:o("This can be\xa0the name of\xa0your company, department, website, project, marketing campaign, or\xa0other activity."),rules:[{required:!0,message:o("Please type the project name.")}],children:(0,S.jsx)(n.A,{ref:T,placeholder:o("Type the project name"),style:{marginBottom:5}})})})})})},{label:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(x.A,{}),o("FTP settings")]}),key:C,className:"em-analytics__ftpsettings-project",children:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(l.A,{gutter:24,children:[(0,S.jsx)(i.A,{span:12,children:(0,S.jsx)(a.A.Item,{label:o("Host"),name:["ftpSettings","host"],children:(0,S.jsx)(n.A,{ref:B,placeholder:o("Type the FTP host"),disabled:O})})}),(0,S.jsx)(i.A,{span:12,children:(0,S.jsx)(a.A.Item,{label:o("Port"),name:["ftpSettings","port"],children:(0,S.jsx)(n.A,{placeholder:o("Type the FTP port"),disabled:O})})})]}),(0,S.jsxs)(l.A,{gutter:24,children:[(0,S.jsx)(i.A,{span:12,children:(0,S.jsx)(a.A.Item,{label:o("Directory"),name:["ftpSettings","directory"],children:(0,S.jsx)(n.A,{placeholder:o("Type the file directory"),disabled:O})})}),(0,S.jsx)(i.A,{span:12,children:(0,S.jsx)(a.A.Item,{label:o("URL catalog"),name:["ftpSettings","domain"],children:(0,S.jsx)(n.A,{placeholder:o("Type the URL catalog"),disabled:O})})})]}),(0,S.jsxs)(l.A,{gutter:24,children:[(0,S.jsx)(i.A,{span:12,children:(0,S.jsx)(a.A.Item,{label:o("Login"),name:["ftpSettings","login"],children:(0,S.jsx)(n.A,{placeholder:o("Type the FTP login"),disabled:O})})}),(0,S.jsx)(i.A,{span:12,children:(0,S.jsx)(a.A.Item,{label:o("Password"),name:["ftpSettings","password"],children:(0,S.jsx)(n.A.Password,{placeholder:o("Type the FTP password"),disabled:O,iconRender:e=>e?(0,S.jsx)(v.A,{}):(0,S.jsx)(f.A,{})})})})]}),(0,S.jsx)(l.A,{gutter:24,children:(0,S.jsx)(i.A,{span:24,children:(0,S.jsx)(a.A.Item,{noStyle:!0,children:(0,S.jsx)(r.A,{checked:O,onChange:e=>H(Boolean(e.target.checked)),children:o("Use default CDN")})})})})]})},{label:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(g.A,{}),o("WebHook settings")]}),key:I,className:"em-analytics__mainsettings-project",children:(0,S.jsx)(S.Fragment,{children:(0,S.jsx)(l.A,{gutter:24,children:(0,S.jsx)(i.A,{span:24,children:(0,S.jsx)(a.A.Item,{label:o("WebHook settings"),name:"webhook",extra:o("Before exporting the project you must fill in the url where the webHook request will be sent to"),rules:[{type:"url",message:o("Please enter correct url.")},q&&{required:!0,message:o("Please type the webhook url.")}],children:(0,S.jsx)(n.A,{ref:L,placeholder:o("Type the project webHook"),style:{marginBottom:5}})})})})})}];(0,s.useEffect)((()=>{if(e&&V){const e=V.ftp_settings;H(e.use_default_cdn),N.setFieldsValue({name:V.title,webhook:V.webhook||"",ftpSettings:{host:e.host||"",port:e.port||"",directory:e.directory||"",domain:e.domain||"",login:e.login||"",password:e.password||""}})}}),[N,V,e]);const U=()=>{N.validateFields().then((e=>{const t=e.ftpSettings;V&&$({projectId:V.id,title:e.name,webhook:e.webhook?e.webhook:"",ftp_settings:t?{host:t.host,port:t.port,directory:t.directory,domain:t.domain,login:t.login,password:t.password,use_default_cdn:O}:null}).then((({data:e,error:t})=>{e?e.title!==V.title?F.success({message:o("The project \u201c")+V.title+o("\u201d was successfully changed to \u201c")+e.title+o("\u201d."),placement:"bottomRight"}):F.success({message:o("The project settings was successfully saved."),placement:"bottomRight"}):t&&(0,k.p6)({error:t},F),E((0,j.YF)("")),E((0,j.Oo)())}))}))};return(0,S.jsx)(d.A,{title:(0,S.jsxs)("div",{children:[(0,S.jsx)(b.A,{})," ",o("Project settings")]}),className:"blocks-modal",open:e,onOk:U,onCancel:()=>{E((0,j.YF)("")),E((0,j.Oo)())},centered:!0,footer:[(0,S.jsx)(c.Ay,{size:"large",className:"em-analytics__project-save",type:"primary",loading:G.isLoading,onClick:U,children:o("Update")},"submit")],children:(0,S.jsx)(a.A,{form:N,layout:"vertical",name:`edit_project_form_${null===V||void 0===V?void 0:V.id}`,onFinish:U,initialValues:{remember:!1,name:""},autoComplete:"off",children:(0,S.jsx)(m.A,{activeKey:D,onChange:z,items:X})})})};E.defaultProps={selectedProject:null};const N=E}}]);
|