@emailmaker/emailmaker 1.0.63 → 1.0.65
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 +24 -24
- package/emailmaker-esm.js +1 -1
- package/emailmaker.js +1 -1
- package/iframe/{iframe-eblock.14f8a673f34d72ec88de.html → iframe-eblock.65025a3a3b961397985d.html} +1 -1
- package/iframe/{iframe.14f8a673f34d72ec88de.html → iframe.65025a3a3b961397985d.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 +1 -1
- package/plugin.html +1 -1
- package/plugin_blocks_test.html +1 -1
- package/plugin_default.html +1 -1
- package/plugin_idigital.html +1 -1
- package/plugin_s.html +1 -1
- package/static/css/4529.35cacca2.css +1 -0
- package/static/css/5211.ee9091cb.css +1 -0
- package/static/css/{8995.641d0157.css → 8995.e03861fc.css} +1 -1
- package/static/js/1399.9b89879e.js +1 -0
- package/static/js/2574.b19cf539.js +1 -0
- package/static/js/{4529.2bb46065.js → 4529.c018e479.js} +1 -1
- package/static/js/5211.f95f3f6a.js +1 -0
- package/static/js/{7291.d2241d85.js → 7291.811d0dc1.js} +1 -1
- package/static/js/{7967.5136da11.js → 7967.249c928a.js} +1 -1
- package/static/js/{8689.aa776e90.chunk.js → 8689.d58c90cd.chunk.js} +1 -1
- package/static/js/{8995.54a7ed6e.js → 8995.cf63e259.js} +1 -1
- package/static/js/{emailmaker_core.6e2a56e1.js → emailmaker_core.f6105663.js} +1 -1
- package/translations.pot +63 -63
- package/static/css/4529.8008d20d.css +0 -1
- package/static/css/5211.61fd92f8.css +0 -1
- package/static/js/1399.162f8a92.js +0 -1
- package/static/js/2574.c0f56526.js +0 -1
- package/static/js/5211.d27a1e14.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunkemail_maker=globalThis.webpackChunkemail_maker||[]).push([[2574],{78451:(e,t,o)=>{o.d(t,{A:()=>n});var l=o(92810),r=o(45934),s=o(64617),a=o(86739),i=o(65983);const n=()=>{const e=(0,r.wA)(),t=(0,r.d4)(i.zn);let o=(0,s.zy)();(0,l.useEffect)((()=>{/emails\/[0-9]+$/.test(o.pathname)||t&&e(a.GY.util.invalidateTags([{type:"Emails",id:+t}]))}),[o,e,t])}},64037:(e,t,o)=>{o.d(t,{A:()=>s});var l=o(92810),r=o(45695);function s(e,t){const o=(0,r.QC)();(0,l.useEffect)((()=>{const l=o.addListener(e,t);return()=>{l.dispose()}}),[o,e,t])}},31844:(e,t,o)=>{o.d(t,{A:()=>n});var l=o(92810),r=o(64617),s=o(45934),a=o(86286),i=o(84568);const n=e=>{const t=(0,s.d4)(a.C1),[o,n]=(0,l.useState)({owner:!1,admin:!1}),d=(0,r.KC)(),{data:c}=(0,i.fo)(e,{skip:!e||!t.id||!(null!==d&&void 0!==d&&d.isUninitialized)}),m=(null===d||void 0===d?void 0:d.data)||c;return(0,l.useEffect)((()=>{if(m){var e,o;const{owner:l,admins:r,users:s}=m.members,a=r?r.map((e=>e.ID)):r,i=s?s.map((e=>e.ID)):s;n({owner:(null===(e=l.ID)||void 0===e?void 0:e.toString())===(null===(o=t.id)||void 0===o?void 0:o.toString()),admin:a&&a.includes(t.id),user:i&&i.includes(t.id)})}}),[m,t.id]),o}},3289:(e,t,o)=>{o.d(t,{A:()=>d});var l=o(92810),r=o(45934),s=o(64617),a=o(87790),i=o(85163),n=o(90070);const d=()=>{const e=(0,r.wA)(),t=(0,n.p6)(),o=(0,r.d4)(a.Sl);let d=(0,s.zy)();(0,l.useEffect)((()=>{d.pathname.endsWith("/new")||o&&(e((0,a.X8)()),t.remove(i.A9.em_new_block))}),[d,o,e,t])}},19366:(e,t,o)=>{o.d(t,{A:()=>d});var l=o(92810),r=o(45934),s=o(64617),a=o(8493),i=o(85163),n=o(90070);const d=()=>{const e=(0,n.p6)(),t=(0,r.wA)(),o=(0,r.d4)(a.$S);let d=(0,s.zy)();(0,l.useEffect)((()=>{d.pathname.endsWith("/new")||(e.remove(i.A9.em_new_email),e.remove(i.A9.em_template_email),o&&t((0,a.Et)()))}),[d,o,t,e])}},22197:(e,t,o)=>{o.d(t,{A:()=>r});var l=o(85163);const r=e=>{if(!l.EW.isPlugin){let t="";t="EmailMaker",document.title=e+" - "+t}}},46950:(e,t,o)=>{o.d(t,{A:()=>c});o(92810);var l=o(95838),r=o(64617),s=o(66522),a=o(70082);const i=({className:e,style:t,color:o,text:l,bordered:r,...i})=>{const n=l||"";return(0,a.jsx)(s.A,{style:t,color:o,bordered:r,className:e,...i,children:n})};var n=o(23287),d=o(56991);const c=({text:e,counter:t,limits:o,wrapperStyles:s})=>{const{__:c,_n:m}=(0,n.s9)(),u=(0,r.Zp)(),p=(0,d.rD)(),{token:h}=l.A.useToken(),g=+o>0,b=!g||t<+o,f=p.billingPageUrl||"/billing",v=t+" "+c("of")+" "+(g?o:"\u221e")+" "+(e||m("test","tests",o))+" "+c("were used");return(0,a.jsxs)("div",{className:"limits-couter-wrapper",style:s,children:[(0,a.jsx)(i,{bordered:!1,text:v,className:"limit-counter",style:{color:b?h.colorText:"white"},color:b?h.colorFillSecondary:"rgb(255, 77, 79)"}),g&&(0,a.jsx)("div",{style:{fontSize:14,textDecoration:"underline"},onClick:()=>u(f),children:c("Need more?")})]})}},35055:(e,t,o)=>{o.d(t,{A:()=>f});var l=o(92810),r=o(12280),s=o(14852),a=o(43005),i=o(55039),n=o(45934),d=o(23287),c=o(64617),m=o(90070),u=o(64936),p=o(85163),h=o(32269),g=o(70082);const b="description",f=()=>{const{__:e}=(0,d.s9)(),t=(0,n.wA)(),[o]=r.A.useForm(),f=(0,l.useRef)(null),v=(0,n.d4)(u.cL)===p.lx.ADD_NEW_AI_EMAIL,y=(0,m.p6)(),x=(0,c.Zp)(),{projectId:_}=(0,c.g)(),A=(0,l.useCallback)((()=>{o.resetFields(),setTimeout((()=>{var e;return null===(e=f.current)||void 0===e?void 0:e.focus()}),0)}),[o]);(0,l.useEffect)((()=>{v&&A()}),[v,A]);const j=()=>t((0,u.Oo)()),k=()=>{const e=`/projects/${_}/emails/new`,t=String(278056);y.set(p.A9.em_new_email,t),o.validateFields().then((({description:t})=>{window.localStorage.setItem(p.V0.em_active_tab,p.z$),window.localStorage.setItem(p.V0.em_ai_settings,t),(0,h.XZ)(x,e),j()}))};return(0,g.jsx)(s.A,{title:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("span",{children:e("I'd be happy to create an email for you! ")}),(0,g.jsx)("p",{children:e("Start with a detailed description of your email.")})]}),open:v,onOk:k,onCancel:j,className:"new-folder-modal",centered:!0,footer:[(0,g.jsx)(a.Ay,{type:"primary",size:"large",onClick:k,children:e("Generate Email")},"submit")],children:(0,g.jsx)(r.A,{form:o,layout:"vertical",name:"add_new_folder_form",onFinish:k,initialValues:{[b]:""},autoComplete:"off",style:{paddingTop:10},children:(0,g.jsx)(r.A.Item,{name:b,rules:[{required:!0,message:e("Please enter the description")}],children:(0,g.jsx)(i.A,{size:"large",placeholder:e("Please enter the description"),ref:f,style:{marginBottom:5}})})})})}},35069:(e,t,o)=>{o.d(t,{A:()=>S});var l=o(92810),r=o(12280),s=o(14852),a=o(43005),i=o(2018),n=o(7744),d=o(55039),c=o(81662),m=o(71157),u=o(66170),p=o(28372),h=o(45934),g=o(23287),b=o(64617),f=o(55701),v=o(84568),y=o(79154),x=o(47358),_=o(32269),A=o(56991),j=o(85163),k=o(70082);const S=({isModalVisible:e,htmlContent:t,projectId:o})=>{const{__:S}=(0,g.s9)(),w=(0,h.wA)(),[C]=r.A.useForm(),[E,T]=(0,l.useState)([]),[I,N]=(0,f.pP)(),{data:R}=(0,f.h1)(),B=(0,m.hN)(),L=(0,A.rD)(),[P,F]=(0,l.useState)([]),{data:M,refetch:D}=(0,b.KC)(),{refetch:z}=(0,f.SB)({projectId:o,pageSize:1e3,page:1,tags:null,name:null,type:null,notEmbed:!0,order:"asc",orderby:"title"}),O=`project_${o}`,q=M&&(0,_._q)(M,j.YY).find((e=>e.name===O)),H=(0,_._q)(M,j.YY)||[],$=null===H||void 0===H?void 0:H.map((e=>e.id)),[V,W]=(0,f.Gr)(),[G,U]=(0,v.OD)();(0,l.useEffect)((()=>{F((0,_._q)(M,j.YY).map((e=>({value:e.name}))))}),[M]),(0,l.useEffect)((()=>{if(R){const e=R.schema.properties.acf.properties.type.items.enum;let t=[];for(let o in e)t.push({label:S(j.jg[e[o]]),value:e[o]});T(t)}}),[R,S]);const X=()=>{C.validateFields().then((e=>{const l=e.tags;if((null===l||void 0===l?void 0:l.length)>10)return void B.error({id:"BLOCK_TOO_MANY_TAGS_ERROR",data:(0,m.x_)(e),message:S("Maximum 10 tags available."),placement:"bottomRight"});const r=r=>{const s=null===l||void 0===l?void 0:l.map((e=>{const t=null===H||void 0===H?void 0:H.find((t=>t.name===e));return t?t.id:V({name:e,parent:r}).then((({error:t,data:o})=>{var l,r;return 400===(null===t||void 0===t?void 0:t.status)?null===t||void 0===t||null===(l=t.data)||void 0===l||null===(r=l.data)||void 0===r?void 0:r.term_id:o?o.id:void(t&&B.fromError("TAG_CREATING_ERROR",e,t))}))})),a=(e,l=[])=>{I({title:e.title,project:o,html:t,type:e.type?e.type:"Other",blocktags:l.join(",")}).then((r=>{if(r.error)return B.error({id:"BLOCK_CREATING_ERROR",data:{title:e.title,html:t},innerException:r.error,message:(0,k.jsx)("div",{dangerouslySetInnerHTML:{__html:r.error.data.code}}),description:(0,k.jsx)("div",{dangerouslySetInnerHTML:{__html:r.error.data.message}}),placement:"bottomRight"}),C.resetFields(),void Y();C.resetFields(),Y();let s=new Set([...$,...l]);D(),G({projectId:o,blocktags:[...s].join(",")}).then((e=>{e.error&&B.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"}),B.success({id:"BLOCK_CREATING_SUCCESS",data:(0,m.x_)(r.data),message:S("The block \u201c")+r.data.title+S("\u201d was successfully created."),placement:"bottomRight"}),z()}))}))};s?Promise.all(s).then((t=>{a(e,t)})):a(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/660+"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))};q?r(q.id):V({name:O}).then((async({data:e,error:t})=>{if(t)B.fromError("FOLDER_CREATING_ERROR",O,t);else{const{data:t,error:l}=await G({projectId:o,blocktags:e.id});l?B.fromError("BLOCK_CLONING_ERROR",(0,m.x_)(e),l):t&&r(t.blocktags&&t.blocktags[0])}})).catch((e=>console.error(e)))}))},Y=()=>{w((0,x.Oo)())};return(0,k.jsx)(s.A,{title:(0,k.jsxs)("div",{children:[(0,k.jsx)(u.A,{})," ",S("Add new block")]}),className:"blocks-modal",open:e,onOk:X,onCancel:Y,centered:!0,footer:[(0,k.jsxs)(a.Ay,{size:"large",type:"primary",loading:N.isLoading,onClick:X,children:[(0,k.jsx)(y.h,{className:"modal-new-block__icon-create"}),S("Create block")]},"submit")],children:(0,k.jsxs)(r.A,{form:C,layout:"vertical",name:"add_new_block_form",onFinish:X,initialValues:{title:"",type:"",tags:[]},autoComplete:"off",style:{padding:"10px 24px 0"},children:[(0,k.jsxs)(i.A,{gutter:16,children:[(0,k.jsxs)(n.A,{span:12,children:[" ",(0,k.jsx)(r.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:N.isLoading||W.isLoading||U.isLoading,size:"large",placeholder:S("Enter block name"),spellCheck:"false"})})]}),(0,k.jsx)(n.A,{span:12,children:(0,k.jsx)(r.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:N.isLoading||W.isLoading||U.isLoading,size:"large",placeholder:S("Choose block type"),options:E})})})]}),L.tagsEnabled&&(0,k.jsx)(r.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:N.isLoading||W.isLoading||U.isLoading,options:P})})]})})}},28288:(e,t,o)=>{o.d(t,{A:()=>v});var l=o(92810),r=o(14852),s=o(69417),a=o(45934),i=o(64617),n=o(38883),d=o.n(n),c=o(23287),m=o(47358),u=o(85163),p=o(32269),h=o(90070),g=o(98578),b=o(54416),f=(o(68777),o(70082));const v=({isModalVisible:e})=>{const{__:t}=(0,c.s9)(),o=(0,a.wA)(),n=(0,i.Zp)(),v=(0,h.p6)();let y=(0,i.zy)();const x=(0,l.useRef)(null);let _=[];return _.push({title:t("From scratch"),click:()=>{o((0,m.Oo)()),v.set(u.A9.em_new_email,127017),(0,p.XZ)(n,`${y.pathname}/new`)}}),_.push({title:"\u0428\u0430\u0431\u043b\u043e\u043d \u0432 \u0441\u0432\u0435\u0442\u043b\u043e\u0439 \u0442\u0435\u043c\u0435",img:g,click:()=>{o((0,m.Oo)()),v.set(u.A9.em_template_email,1868),(0,p.XZ)(n,`${y.pathname}/new_from/1868`)}}),_.push({title:"\u0428\u0430\u0431\u043b\u043e\u043d \u0432 \u0442\u0451\u043c\u043d\u043e\u0439 \u0442\u0435\u043c\u0435",img:b,click:()=>{o((0,m.Oo)()),v.set(u.A9.em_template_email,1869),(0,p.XZ)(n,`${y.pathname}/new_from/1869`)}}),(0,f.jsx)(r.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,f.jsx)("div",{className:"modal-new-email__cards-grid",children:_&&_.map(((e,t)=>(0,f.jsx)(s.A,{className:"element-card element-card_new-email",hoverable:!0,cover:(0,f.jsx)(f.Fragment,{children:(0,f.jsx)("div",{ref:x,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,f.jsx)("img",{className:"element-card__img",alt:e.title,src:e.img,onMouseMove:e=>(0,p.Hy)(e,x.current),onMouseLeave:p.Tr})})}),children:(0,f.jsx)("div",{className:"element-card__title-wrapper",onClick:()=>null===e||void 0===e?void 0:e.click(),children:(0,f.jsx)("span",{className:"element-card__title",children:e.title})})},e.img+t)))})})}},92851:(e,t,o)=>{o.d(t,{A:()=>f});var l=o(92810),r=o(12280),s=o(14852),a=o(43005),i=o(55039),n=o(71157),d=o(45934),c=o(23287),m=o(84568),u=o(93563),p=o(64936),h=o(85163),g=o(32269),b=o(70082);const f=({project:e,parentFolderId:t=null,folderTaxonomy:o})=>{const{__:f,_x:v}=(0,c.s9)(),y=(0,d.wA)(),[x]=r.A.useForm(),_=(0,l.useRef)(null),A=(0,d.d4)(p.cL)===h.lx.ADD_NEW_FOLDER_MODAL,j=(0,n.hN)(),k=`project_${e.id}`,[S]=(0,m.OD)(),[w]=(0,u.f1)(),C=(0,l.useCallback)((()=>{x.resetFields(),setTimeout((()=>{var e;return null===(e=_.current)||void 0===e?void 0:e.focus({cursor:"start"})}),0)}),[x]);(0,l.useEffect)((()=>{A&&C()}),[A,C]);const E=()=>y((0,p.Oo)()),[T,I]=(0,u.Yb)(),[N,R]=(0,l.useState)(!1),[B,L]=(0,l.useState)(t),P=()=>{x.validateFields().then((({name:t})=>(R(!0),B?T({name:t,parent:B}).then((({data:e,error:t})=>{t?(0,g.p6)({error:t},j):(j.success({message:f("The folder \u201c")+e.name+v("\u201d was successfully created.","folder"),placement:"bottomRight"}),window.localStorage.setItem(h.V0.em_folder_is_open,"true"),E(),w({parent:B}))})):T({name:k}).then((({data:l,error:r})=>{if(!r)return S({projectId:e.id,[o]:l.id||B}).then((({data:e,error:l})=>{if(r)(0,g.p6)({error:r},j);else if(e)return T({name:t,parent:e[o][0]}).then((({data:t,error:l})=>{if(!l)return j.success({message:f("The folder \u201c")+t.name+v("\u201d was successfully created.","folder"),placement:"bottomRight"}),L(e[o][0]),w({parent:e[o][0]}).then(((e,t)=>{e?(window.localStorage.setItem(h.V0.em_folder_is_open,"true"),E()):t&&(0,g.p6)({error:t},j)}));(0,g.p6)({error:l},j)}))}));(0,g.p6)({error:r},j)})).catch((e=>console.error(e))).finally((()=>R(!1)))))).catch((e=>console.error(e))).finally((()=>R(!1)))};return(0,b.jsx)(s.A,{title:f("Add a new folder"),open:A,onOk:P,onCancel:E,className:"new-folder-modal",centered:!0,footer:[(0,b.jsx)(a.Ay,{type:"primary",size:"large",loading:I.isLoading||N,onClick:P,children:f("Create folder")},"submit")],children:(0,b.jsx)(r.A,{form:x,layout:"vertical",name:"add_new_folder_form",onFinish:P,initialValues:{remember:!1,name:""},autoComplete:"off",style:{paddingTop:10},children:(0,b.jsx)(r.A.Item,{name:"name",rules:[{required:!0,message:f("Please enter the folder name")}],children:(0,b.jsx)(i.A,{disabled:I.isLoading,size:"large",placeholder:f("Enter the folder name"),ref:_,style:{marginBottom:5}})})})})}},58353:(e,t,o)=>{o.d(t,{A:()=>v});var l=o(92810),r=o(12280),s=o(14852),a=o(43005),i=o(55039),n=o(71157),d=o(45934),c=o(23287),m=o(84568),u=o(93563),p=o(64936),h=o(32269),g=o(85163),b=o(64617),f=o(70082);const v=({taxonomy:e})=>{var t;const{__:o,_x:v}=(0,c.s9)(),y=(0,d.wA)(),[x]=r.A.useForm(),_=(0,l.useRef)(null),A=(0,d.d4)(p.cL)===g.lx.ADD_NEW_GROUP_MODAL,j=(0,n.hN)();let k;({data:k}=(0,b.KC)());const S=`project_${k.id}`,w=null===(t=k[g.bV.GROUP])||void 0===t?void 0:t[0],[C]=(0,m.OD)(),[E]=(0,u.y$)(),T=(0,l.useCallback)((()=>{x.resetFields(),setTimeout((()=>{var e;return null===(e=_.current)||void 0===e?void 0:e.focus({cursor:"start"})}),0)}),[x]);(0,l.useEffect)((()=>{A&&T()}),[A,T]);const I=()=>y((0,p.Oo)()),[N,R]=(0,u.JI)(),[B,L]=(0,l.useState)(!1),[P,F]=(0,l.useState)(w),M=()=>{const t=(t,l)=>C({projectId:k.id,[e]:l||P}).then((async l=>{if("error"in l)(0,h.p6)(l,j);else if("data"in l){let r=l.data;const s=await N({name:t,parent:r[e][0]});if(!("error"in s))return j.success({message:o("The group \u201c")+s.data.name+v("\u201d was successfully created.",e),placement:"bottomRight"}),F(r[e][0]),E({parent:r[e][0]}).then((({data:e,error:t})=>{e?I():t&&(0,h.p6)({error:t},j)}));(0,h.p6)(s,j)}}));x.validateFields().then((({name:l})=>(L(!0),console.log("currentParentGroupId",P),P?N({name:l,parent:P}).then((t=>{"error"in t?(0,h.p6)(t,j):(j.success({message:o("The group \u201c")+t.data.name+v("\u201d was successfully created.",e),placement:"bottomRight"}),I(),E({parent:P}))})):N({name:S}).then((e=>{if(!("error"in e))return t(l,e.data.id);{console.log("res",e);const{data:o}=e.error;if("term_exists"===o.code&&o.data.term_id)return t(l,o.data.term_id);(0,h.p6)(e,j)}})).catch((e=>console.error(e))).finally((()=>L(!1)))))).catch((e=>console.error(e))).finally((()=>L(!1)))};return(0,f.jsx)(s.A,{title:o("Add a new group"),open:A,onOk:M,onCancel:I,className:"new-group-modal",centered:!0,footer:[(0,f.jsx)(a.Ay,{type:"primary",size:"large",loading:R.isLoading||B,onClick:M,children:o("Create group")},"submit")],children:(0,f.jsx)(r.A,{form:x,layout:"vertical",name:"add_new_group_form",onFinish:M,initialValues:{remember:!1,name:""},autoComplete:"off",style:{paddingTop:10},children:(0,f.jsx)(r.A.Item,{name:"name",rules:[{required:!0,message:o("Please enter the group name")}],children:(0,f.jsx)(i.A,{disabled:R.isLoading,size:"large",placeholder:o("Enter the group name"),ref:_,style:{marginBottom:5}})})})})}},68919:(e,t,o)=>{o.d(t,{A:()=>v});var l=o(92810),r=o(12280),s=o(14852),a=o(43005),i=o(55039),n=o(71157),d=o(64617),c=o(45934),m=o(23287),u=o(84568),p=o(64936),h=o(86286),g=o(85163),b=o(47381),f=o(70082);const v=({isModalVisible:e})=>{const{__:t}=(0,m.s9)(),o=(0,c.wA)(),[v]=r.A.useForm(),y=(0,l.useRef)(null),x=(0,d.Zp)(),_=(0,n.hN)(),A=(0,c.d4)(h.C1),j=(0,b.u)(),[k,S]=(0,u.lD)();(0,l.useEffect)((()=>{e&&(v.resetFields(),setTimeout((()=>{var e;return null===(e=y.current)||void 0===e?void 0:e.focus({cursor:"end"})}),400))}),[e,v]);const w=()=>{v.validateFields().then((e=>(j({event:"submit_form",action:"create_new_project",label:e.name}),k({title:e.name,members:{owner:A.id}})))).then((e=>{if(e.error)throw _.error({message:(0,f.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.code}}),description:(0,f.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.message}}),placement:"bottomRight"}),o((0,p.Oo)()),new Error(g.ff);e.data&&(_.success({message:t("The project \u201c")+e.data.title+t("\u201d was successfully created."),placement:"bottomRight"}),o((0,p.Oo)()),x(`/projects/${e.data.id}/emails?status=new_project&page=1`))})).catch((e=>{console.error("e",e)}))};return(0,f.jsx)(s.A,{title:t("Add a new project"),open:e,onOk:w,onCancel:()=>o((0,p.Oo)()),className:"blocks-modal blocks-modal_create",centered:!0,footer:[(0,f.jsx)(a.Ay,{className:"em-analytics__project-add",type:"primary",size:"large",loading:S.isLoading,onClick:w,children:t("Create project")},"submit")],styles:{mask:{backgroundColor:"var(--colorBgLayout)"}},children:(0,f.jsx)(r.A,{form:v,layout:"vertical",name:"add_new_project_form",onFinish:w,initialValues:{remember:!1,name:""},autoComplete:"off",style:{padding:"10px 24px 0"},children:(0,f.jsx)(r.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,f.jsx)(i.A,{disabled:S.isLoading,size:"large",placeholder:t("Enter the project name"),ref:y,style:{marginBottom:5}})})})})}},43319:(e,t,o)=>{o.d(t,{A:()=>H});var l=o(92810),r=o(38883),s=o.n(r),a=o(95838),i=o(12280),n=o(29234),d=o(2018),c=o(7744),m=o(66726),u=o(78159),p=o(81e3),h=o(8701),g=o(71086),b=o(55039),f=o(81662),v=o(62767),y=o(45934),x=o(23287),_=o(26238),A=o(49343),j=o(62303),k=o(85163),S=o(65983),w=o(47358),C=o(45695),E=o(56991),T=o(70082);const{backgroundColor:I,backgroundImage:N,backgroundPositionX:R,backgroundPositionY:B,backgroundRepeat:L,backgroundSize:P,responsive:F,backgroundColorContent:M,width:D}={backgroundColor:"backgroundColor",backgroundImage:"backgroundImage",backgroundPositionX:"backgroundPositionX",backgroundPositionY:"backgroundPositionY",backgroundRepeat:"backgroundRepeat",backgroundSize:"backgroundSize",responsive:"responsive",backgroundColorContent:"backgroundColorContent",width:"width"},z={[I]:"",[N]:"",[R]:"",[B]:"",[L]:"checked",[P]:"",[M]:"",[D]:""},{useToken:O}=a.A,q=({className:e,email:t})=>{var o,r,a;const{__:M}=(0,x.s9)(),{token:D}=O(),q=(0,y.wA)(),H=(0,E.rD)(),[$]=i.A.useForm(),V=(0,C.XW)(),W=(0,y.d4)(S.uJ),G=(0,y.d4)(S.iy),U=(0,y.d4)(w.B),X=(0,y.d4)(S.mD),[Y,K]=(0,l.useState)(!0),Z=M("Email not yet loaded or global container not found.");(0,l.useEffect)((()=>{X&&(q((0,S.S_)(!1)),V({operation:k.Ru.INIT_PREVIEW}))}),[$,X,q,V,t.common_styles]);const J=[{label:M("Not defined"),value:"none"},{label:M("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:M("Repeat background (repeat)"),value:"repeat"},{label:M("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:M("Repeat background vertically (repeat-y)"),value:"repeat-y"}],Q=[{label:M("Not defined"),value:""},{label:M("Contain"),value:"contain"},{label:M("Cover"),value:"cover"}];(0,l.useEffect)((()=>{var e,t,o,l;$.setFieldsValue({...W,width:null===(e=W.width)||void 0===e?void 0:e.value,widthDim:null===(t=W.width)||void 0===t?void 0:t.dim,backgroundImage:W.backgroundImage?null===(o=W.backgroundImage[0])||void 0===o?void 0:o.value:"",backgroundRepeat:""===W[L]?"repeat":W[L],backgroundSize:W[P],responsive:null===(l=W.responsive)||void 0===l?void 0:l.shutdown}),K(!W.backgroundImage)}),[W,$]);return(0,T.jsx)("div",{className:s()("appearance-panel",{[e]:e}),children:(0,T.jsxs)(i.A,{form:$,layout:"vertical",name:"appearance_panel_form",initialValues:{remember:!1,...z},onValuesChange:e=>{var t;const o=$.getFieldsValue(!0),l=Object.keys(e)[0];switch(l){case R:case B:V({operation:k.Ru.SANDBOX_EMAIL_SETTINGS_SET,settings:{[l]:""===e[l]?"none":e[l]}});break;case N:K(""===e[l]),V({operation:k.Ru.SANDBOX_EMAIL_SETTINGS_SET,settings:{[l]:[{...null===W||void 0===W||null===(t=W.backgroundImage)||void 0===t?void 0:t[0],type:"url",value:e[l]}],backgroundSize:"cover"}});break;case F:V({operation:k.Ru.SANDBOX_EMAIL_SETTINGS_SET,settings:{responsive:{shutdown:e[l],styles:e[l]},width:o.width}});break;default:V({operation:k.Ru.SANDBOX_EMAIL_SETTINGS_SET,settings:e})}},autoComplete:"off",className:"element-controls",children:[G?(0,T.jsx)(n.A,{style:{marginBottom:"24px"},message:Z,type:"error"}):null,(0,T.jsxs)(i.A.Item,{style:{marginBottom:"0"},children:[(0,T.jsx)("div",{className:"form-group-title",style:{paddingTop:0},children:M("Email layout width")}),(0,T.jsx)(d.A,{gutter:10,children:(0,T.jsx)(c.A,{span:12,children:(0,T.jsx)(m.A,{trigger:["hover"],title:null!==(o=W.width)&&void 0!==o&&o.value?M("This field sets the width of the email."):M("Couldn`t determine the email width"),placement:"right",children:(0,T.jsx)(i.A.Item,{name:"width",style:{marginBottom:D.formItemMarginBottomXS},children:(0,T.jsx)(u.A,{min:0,placeholder:M("Width"),prefix:(0,T.jsx)(v.A,{}),disabled:!(null!==(r=W.width)&&void 0!==r&&r.value),addonAfter:"px"})})})})}),(0,T.jsx)(d.A,{gutter:20,children:(0,T.jsx)(c.A,{span:24,children:(0,T.jsxs)(p.A,{size:8,align:"baseline",children:[(0,T.jsx)(i.A.Item,{name:"responsive",valuePropName:"checked",children:(0,T.jsx)(h.A,{size:"small",name:"responsive",id:"responsive",disabled:void 0===(null===(a=W.responsive)||void 0===a?void 0:a.shutdown),onChange:e=>{q((0,w.wW)({shutdown:e,styles:e})),V({operation:k.Ru.SANDBOX_IFRAME_SETSIZE,settings:{iframeWidth:document.querySelector(".email-pane__iframe").getBoundingClientRect().width}})}})}),(0,T.jsx)("div",{className:"ant-form-item-switch-label",children:(0,T.jsx)("label",{htmlFor:"responsive",style:{verticalAlign:"middle"},children:M("Responsive email")})})]})})})]}),(0,T.jsx)(g.A,{className:"selected-td-form__divider"}),(0,T.jsx)("div",{className:"form-group-title",children:M("Email background color")}),(0,T.jsxs)(d.A,{gutter:10,style:{paddingBottom:Y?16:4},children:[(0,T.jsx)(c.A,{span:12,children:(0,T.jsx)(m.A,{trigger:["hover"],title:M("Background color"),placement:"bottom",children:(0,T.jsx)(i.A.Item,{name:I,style:{marginBottom:D.formItemMarginBottomXS},rules:[{message:M("Please set the background color")}],children:(0,T.jsx)(_.A,{placeholder:M("Background color"),usedColors:W.usedColors})})})}),(0,T.jsx)(c.A,{span:Y?12:24,children:H.formEmailFieldBackgroundImageEnabled&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(A.A,{form:$,label:M("Background image"),name:N,tooltipTitle:M("Background image"),disabled:G||"Styles"!==U,elementSettings:W}),!Y&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(i.A.Item,{style:{marginBottom:"0"},children:(0,T.jsxs)(d.A,{gutter:10,children:[(0,T.jsx)(c.A,{span:12,children:(0,T.jsx)(m.A,{trigger:["hover"],title:M("Horizontal position"),placement:"bottom",children:(0,T.jsx)(i.A.Item,{name:R,style:{marginBottom:D.formItemMarginBottomXS},children:(0,T.jsx)(b.A,{placeholder:M("Horizontal position"),prefix:(0,T.jsx)(j.A,{icon:"BgPositionHorizontal"})})})})}),(0,T.jsx)(c.A,{span:12,children:(0,T.jsx)(m.A,{trigger:["hover"],title:M("Vertical position"),placement:"bottom",children:(0,T.jsx)(i.A.Item,{name:B,style:{marginBottom:D.formItemMarginBottomXS},children:(0,T.jsx)(b.A,{placeholder:M("Vertical position"),prefix:(0,T.jsx)(j.A,{icon:"BgPositionVertical"})})})})})]})}),(0,T.jsxs)(d.A,{gutter:10,children:[(0,T.jsx)(c.A,{span:12,children:(0,T.jsx)(m.A,{trigger:["hover"],title:M("Background image repeat"),placement:"bottom",children:(0,T.jsx)(i.A.Item,{name:L,children:(0,T.jsx)(f.A,{placeholder:M("Please select"),disabled:G,options:J,getPopupContainer:e=>e.parentNode})})})}),(0,T.jsx)(c.A,{span:12,children:(0,T.jsx)(m.A,{trigger:["hover"],title:M("Background image size"),placement:"top",children:(0,T.jsx)(i.A.Item,{name:P,children:(0,T.jsx)(f.A,{placeholder:M("Please select"),disabled:G,options:Q,getPopupContainer:e=>e.parentNode})})})})]})]})]})})]})]})})};q.defaultProps={className:""};const H=q},16106:(e,t,o)=>{o.d(t,{A:()=>O});var l=o(92810),r=o(81e3),s=o(66726),a=o(23287),i=o(74436),n=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),b=o.n(g),f=o(35465),v=o.n(f),y=o(44789),x=o.n(y),_=o(77098),A=o.n(_),j=o(19032),k=o(48304),S=o.n(k),w=o(59817),C=o(79757),E=o(78588),T=o.n(E),I=o(40829),N=o.n(I),R=o(62303),B=o(92779),L=o(86286),P=o(36404),F=o(32269),M=o(56991),D=o(45934),z=o(70082);const O=()=>{var e,t;const o=(0,a.s9)(),{__:d}=o,m=(0,M.rD)(),p=(0,D.d4)(P.yN),g=(0,D.d4)(L.B$),f=(0,D.d4)(L.C1),y=(0,D.d4)(L.B),_=(0,F.X7)(),k=(0,F.Qi)(),[E,I]=(0,l.useState)(!1),[O,q]=(0,l.useState)(0);let H=!(g||(null===(e=f.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))&&!0;const $=[];m.elementImageEnabled&&$.push({title:d("Image"),icon:(0,z.jsx)(R.A,{icon:"ElementImage"}),html:i.A,className:"",name:"image"}),m.elementAIimageEnabled&&$.push({title:d("AI image"),icon:(0,z.jsx)(R.A,{icon:"ElementImageAI"}),html:n.A,className:"ai",name:"ai-image"}),m.elementTextEnabled&&$.push({title:d("Text"),icon:(0,z.jsx)(R.A,{icon:"ElementText"}),html:c()(o),className:"",name:"text"}),m.elementHeaderEnabled&&$.push({title:d("Header"),icon:(0,z.jsx)(R.A,{icon:"ElementTitle"}),html:u()(o),className:"",name:"header"}),m.elementButtonEnabled&&$.push({title:d("Button"),icon:(0,z.jsx)(R.A,{icon:"ElementButton"}),html:h()(o),className:"",name:"button"}),m.elementSpacerEnabled&&$.push({title:d("Spacer"),icon:(0,z.jsx)(R.A,{icon:"ElementSpacer"}),html:A(),className:"",name:"spacer"}),m.elementListULEnabled&&$.push({title:d("List UL"),icon:(0,z.jsx)(R.A,{icon:"ElementListUL"}),html:b()(o),className:"",name:"list-ul"}),m.elementListOLEnabled&&$.push({title:d("List OL"),icon:(0,z.jsx)(R.A,{icon:"ElementListOL"}),html:v()(o),className:"",name:"list-ol"}),m.elementDividerEnabled&&$.push({title:d("Divider"),icon:(0,z.jsx)(R.A,{icon:"ElementDivider"}),html:x(),className:"",name:"divider"}),m.elementSocialEnabled&&$.push({title:d("Social media"),icon:(0,z.jsx)(R.A,{icon:"ElementSocial"}),html:j.A,className:"",name:"social"}),m.elementTableEnabled&&$.push({title:d("Table"),icon:(0,z.jsx)(R.A,{icon:"ElementTable"}),html:S()(o),className:"",name:"table"}),m.elementCountdownEnabled&&$.push({title:d("Countdown"),icon:(0,z.jsx)(R.A,{icon:"ElementCountdown"}),html:(0,w.A)(y),className:"",name:"countdown"}),m.elementVideoEnabled&&$.push({title:d("Video"),icon:(0,z.jsx)(R.A,{icon:"ElementVideo"}),html:C.A,className:"",name:"video"}),m.elementCarouselEnabled&&$.push({title:d("Carousel"),icon:(0,z.jsx)(R.A,{icon:"ElementCarousel"}),html:T()(o),className:"amp",name:"amp-carousel"}),m.elementAccordionEnabled&&$.push({title:d("Accordion"),icon:(0,z.jsx)(R.A,{icon:"ElementAccordion"}),html:N()(o),className:"amp",name:"amp-accordion"}),m.elementFormEnabled&&$.push({title:d("Form"),icon:(0,z.jsx)(R.A,{icon:"ElementForm"}),html:null,className:"amp",name:"amp-form"});const V=e=>!H||"ai-image"!==e.name||(setTimeout((()=>{I(!0),q(2)}),1e3),!1);return(0,z.jsxs)("div",{className:"atoms",children:[(0,z.jsx)("div",{className:"atoms__list",children:(0,z.jsx)(r.A,{wrap:!0,style:{justifyContent:"space-between",rowGap:10},children:$&&$.map(((e,t)=>e.html?(0,z.jsxs)("div",{className:"ant-card-hoverable atoms__item "+e.className,draggable:!0,onClick:t=>_(t,e.html),onDragStart:t=>k(t,e,V),"data-test-name":e.name,children:[(0,z.jsx)("span",{className:"atom-image",children:e.icon}),(0,z.jsx)("span",{className:"atom-title",children:e.title})]},e.title+t.toString()):(0,z.jsx)(s.A,{title:d("Coming soon"),placement:"top",children:(0,z.jsxs)("div",{className:"atoms__item atoms__item_inactive "+e.className,"data-test-name":e.name,children:[(0,z.jsx)("span",{className:"atom-image",children:e.icon}),(0,z.jsx)("span",{className:"atom-title",children:e.title})]},e.title+t.toString())},e.title+t.toString())))})}),(0,z.jsx)(B.A,{open:E,onCancel:()=>I(!1),initialSlide:O})]})}},59297:(e,t,o)=>{o.d(t,{A:()=>$});var l=o(92810),r=o(41919),s=o(95838),a=o(2018),i=o(7744),n=o(64617),d=o(94822),c=o(23287),m=o(83351),u=o(38883),p=o.n(u),h=o(70082);const{useToken:g}=s.A,b=({className:e,fontSize:t,to:o})=>{const{token:l}=g();return(0,h.jsx)(d.N_,{className:p()("app-logo",{[e]:e}),style:{fontSize:t?`${t}px`:"40px",color:l.colorText},to:o,children:(0,h.jsxs)("span",{children:[(0,h.jsx)("b",{children:"Email"}),"Maker"]})})};var f=o(72981),v=o(85163),y=o(69156),x=o(90070),_=o(89831);const{useToken:A}=s.A,j={},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=j,coruselStyle:o=k,customDots:l=!1,carouselRef:r,effect:s=S.fade,header:a=!1,...i})=>{const{token:n}=A();return(0,h.jsxs)(h.Fragment,{children:[l&&(0,h.jsx)("div",{className:"custom-dot",children:e.length}),(0,h.jsx)(_.A,{style:o,ref:r,effect:s,...i,children:e.map((e=>(0,h.jsxs)("div",{style:o,className:"slide",children:[a&&(0,h.jsx)("div",{className:"slide-title",style:{color:n.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),E=o(62303);const T={position:"relative",display:"inline-block",margin:20,width:50,height:50,borderRadius:"50%",overflow:"hidden",cursor:"pointer"},I={position:"absolute",top:0,left:0,width:"100%",height:"100%",zIndex:0},N={fontSize:24,position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1,color:"#1890FF"},R=({icon:e,isActive:t,onClick:o,duration:r,onComplete:s})=>{const[a,i]=(0,l.useState)(0),n=window.localStorage.getItem(v.V0.em_color_scheme),d=matchMedia(v.F3).matches?v.nd:v.T,c=n||d;return(0,l.useEffect)((()=>{if(t){let e=Date.now();const t=setInterval((()=>{const o=Date.now()-e,l=Math.min(o/r*100,100);i(l),100===l&&(clearInterval(t),s())}),10);return()=>clearInterval(t)}i(0)}),[t,r,s]),(0,h.jsxs)("div",{style:{...T,backgroundColor:"dark"===c?"#1e1e1f":"#edeff1"},onClick:o,children:[(0,h.jsx)(C.A,{type:"circle",percent:a,strokeColor:"#1890ff",strokeWidth:4,trailColor:"transparent",size:50,format:()=>null,style:I}),(0,h.jsx)(E.A,{icon:e,style:N})]})},B=({carouselRef:e})=>{const[t,o]=(0,l.useState)(0),[r,s]=(0,l.useState)(!0),a=8e3,i=(0,l.useRef)(null),n=["SliderGroup","SliderTemplates","SliderBlocks","SliderAdaptive","SliderMagic"];(0,l.useEffect)((()=>{var o;null===(o=e.current)||void 0===o||o.goTo(t)}),[t,e]);const d=()=>{var l;null===(l=e.current)||void 0===l||l.goTo((t+1)%n.length),o((e=>(e+1)%n.length))};return(0,l.useEffect)((()=>{if(r)return i.current&&clearTimeout(i.current),i.current=setTimeout((()=>{o((e=>e%n.length))}),a),()=>clearTimeout(i.current)}),[r,a,n.length]),(0,l.useEffect)((()=>{s(!0)}),[]),(0,h.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",paddingTop:10},children:n.map(((e,l)=>(0,h.jsx)(R,{icon:e,isActive:t===l,onClick:()=>(e=>{o(e),s(!1)})(l),duration:a,onComplete:d},l)))})},L=(0,l.forwardRef)((({data:e=[],sliderStyle:t,customDots:o=!1,...r},s)=>{const a=(0,l.useRef)(null);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(B,{carouselRef:a}),(0,h.jsx)(w,{data:e,carouselRef:a,dots:!1,header:!0,...r})]})}));var P=o(84093),F=o(42854),M=o(81871),D=o(39024),z=o(35929);o(50195),o(59142),o(27544),o(59045),o(97970);const O=[{id:"1",textHeader:"\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432 \u0432\u0430\u0448\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b",content:(0,h.jsx)("img",{src:P,alt:"login1stSlide"})},{id:"2",textHeader:"\u0411\u043e\u043b\u0435\u0435 100 \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u0434\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b",content:(0,h.jsx)("img",{src:F,alt:"login2stSlide"})},{id:"3",textHeader:"\u0421\u043e\u0437\u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0438\u0441\u044c\u043c\u0430 \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0431\u043b\u043e\u043a\u0438",content:(0,h.jsx)("img",{src:M,alt:"login3stSlide"})},{id:"4",textHeader:"\u0410\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u044b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u043f\u0438\u0441\u0435\u043c \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432",content:(0,h.jsx)("img",{src:D,alt:"login4stSlide"})},{id:"5",textHeader:"\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 AI \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0430 \u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439",content:(0,h.jsx)("img",{src:z,alt:"login5stSlide"})}],{Content:q}=r.A,{useToken:H}=s.A,$=({children:e})=>{var t,o;const{__:s}=(0,c.s9)(),{token:u}=H(),p=(0,n.Zp)(),[g,_]=(0,l.useState)(!1),A=(0,x.p6)(),[,j]=(0,d.ok)(),[k]=(0,m.UH)(),S=(0,n.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,l.useEffect)((()=>{w&&j(w)}),[w,j]),(0,l.useEffect)((()=>{(0,y.FN)(u)}),[u]),(0,l.useEffect)((()=>{A.get(v.A9.em_token)?k().then((e=>{if(e.error)return A.remove(v.A9.em_token),void _(!0);p("/projects",{replace:!0})})):_(!0)}),[p,k,A]),(0,h.jsx)(r.A,{className:"auth-page-layout",children:g?(0,h.jsx)(q,{className:"auth-page-layout__container container",children:(0,h.jsxs)(a.A,{justify:"center",align:"middle",style:{minHeight:"100vh",flexFlow:"nowrap"},children:[(0,h.jsx)(i.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)(b,{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:s("Email builder for your teamwork")})]}),e]})}),(0,h.jsx)(i.A,{className:"generel-col",flex:1,children:(0,h.jsx)(a.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)(L,{data:O})})})})]})}):(0,h.jsx)(f.A,{})})}},92267:(e,t,o)=>{o.d(t,{A:()=>A});var l=o(92810),r=o(38883),s=o.n(r),a=o(81662),i=o(12280),n=o(29234),d=o(55039),c=o(28372),m=o(45934),u=o(23287),p=o(85163),h=o(7760),g=o(45695),b=o(70082);const{Option:f}=a.A,{width:v,widthDim:y}={width:"width",widthDim:"widthDim"},x={[v]:"",[y]:""},_=({className:e})=>{const{__:t}=(0,u.s9)(),o=(0,m.d4)(h.JV),r=(0,m.d4)(h.iy),[y]=i.A.useForm(),_=(0,g.XW)(),A=t("Block not yet loaded or global container not found.");(0,l.useEffect)((()=>{y.setFieldsValue({width:o.width.value,widthDim:o.width.dim})}),[o,y]);return(0,b.jsx)("div",{className:s()("block-appearance-panel",{[e]:e}),children:(0,b.jsxs)(i.A,{form:y,layout:"vertical",name:"block_appearance_panel_form",initialValues:{remember:!1,...x},onValuesChange:e=>{const t=y.getFieldsValue(!0),o=Object.keys(e)[0];let l;switch(o){case"width":l={[o]:{value:e[o],dim:t.widthDim}};break;case"widthDim":l={width:{value:t.width,dim:e[o]}};break;default:return}_({operation:p.Ru.SANDBOX_BLOCK_SETTINGS_SET,settings:l})},autoComplete:"off",children:[r?(0,b.jsx)(n.A,{style:{marginBottom:"24px"},message:A,type:"error"}):null,(0,b.jsx)(i.A.Item,{label:t("Container width"),name:v,tooltip:{title:t("Specifies the block width."),icon:(0,b.jsx)(c.A,{})},rules:[{message:t("Please input container width")}],children:(0,b.jsx)(d.A,{disabled:r,placeholder:t("Container width"),addonAfter:(0,b.jsx)(i.A.Item,{name:"widthDim",noStyle:!0,children:(0,b.jsxs)(a.A,{className:"select-after",getPopupContainer:e=>e.parentNode,children:[(0,b.jsx)(f,{value:"px",children:"px"}),(0,b.jsx)(f,{value:"%",children:"%"})]})})})})]})})};_.defaultProps={className:""};const A=_},98519:(e,t,o)=>{o.d(t,{A:()=>M});var l=o(92810),r=o(95838),s=o(12280),a=o(33206),i=o(55039),n=o(29234),d=o(4800),c=o(49246),m=o(71086),u=o(71157),p=o(9452),h=o(85677),g=o(77406),b=o(64617),f=o(45934),v=o(23287),y=o(38883),x=o.n(y),_=o(90854),A=o(84007),j=o(84568),k=o(55701),S=o(47358),w=o(85163),C=o(32269),E=o(42068),T=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:N,type:R,tags:B}={name:"name",type:"type",tags:"tags"},L={[N]:"",[R]:[],[B]:[]},P={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:F}=r.A,M=({parentEmailId:e=w.iU,blocksTab:t,search:o,reloadBlockScreens:r,email:y})=>{const{projectId:M}=(0,b.g)(),D=(0,C.sh)(),z=(0,C._9)(),[O]=s.A.useForm(),{data:q}=(0,k.h1)(),{token:H}=F(),{__:$,_x:V}=(0,v.s9)(),W=(0,u.hN)(),{modal:G}=a.A.useApp(),{confirm:U}=G;let X=(0,b.zy)();const Y=(0,f.d4)(S.V$),K=(0,l.useRef)(null),Z=(0,l.useRef)(null),J="string"===typeof(null===y||void 0===y?void 0:y.common_styles)&&null!==y&&void 0!==y&&y.common_styles.startsWith("{")?JSON.parse(y.common_styles):{},Q=(0,l.useRef)(null),ee=(0,l.useRef)(null),te=(0,l.useRef)(null),oe=(0,f.Pj)();(0,l.useEffect)((()=>{var e;null===(e=Z.current)||void 0===e||e.scrollTo({top:0})}),[t,o]);const{data:le}=j.Nq.endpoints.getProject.select(+M)(oe.getState()),[re,se]=(0,l.useState)({projectId:M,pageSize:1e3,page:1,tags:null,name:null,type:null,notEmbed:!0,order:"asc",orderby:"title"});(0,l.useEffect)((()=>{o||(O.setFieldsValue(L),Fe({type:null,name:null}),r())}),[o,O,r]),(0,l.useEffect)((()=>{if(q){const e=q.schema.properties.acf.properties.type.items.enum;let t=[];for(let o in e)t.push({label:$(w.jg[e[o]]),value:e[o]})}}),[q,$]);const{isSuccess:ae,isError:ie,isLoading:ne,isFetching:de,data:ce,refetch:me,error:ue}=(0,k.SB)({...re,page:1}),pe=(0,l.useMemo)((()=>{if(ae&&ce)return[...ce].sort(((e,t)=>P[e.type]-P[t.type]))}),[ae,ce]),[he,ge]=(0,l.useState)([]);(0,E.Z)((e=>{e!==ie&&W.fromError("BLOCK_GET_ERROR",{},ue,!0)}),[ie,ue,W]);const[be,fe]=(0,l.useState)({emailId:e,pageSize:1e3,page:1,projectId:w.p5,notEmbed:!0,name:null,type:null}),{isSuccess:ve,isError:ye,isLoading:xe,isFetching:_e}=(0,k.OD)({...be,emailId:e,page:1},{skip:!e||Y.length}),Ae=(0,l.useMemo)((()=>{if(ve||Y.length)return[...Y].sort(((e,t)=>P[e.type]-P[t.type]))}),[ve,Y]),[je,ke]=(0,l.useState)([]);(0,l.useEffect)((()=>{const e=new Set;if(Y.length&&Ae){for(const t of Ae)t.type&&e.add(t.type);ke(Array.from(e))}else ke([])}),[Y,Ae]);const[Se,we]=(0,l.useState)({pageSize:1e3,page:1,notEmbed:!0,name:null,type:null}),{isSuccess:Ce,isError:Ee,isLoading:Te,isFetching:Ie,data:Ne=[]}=(0,k.kz)({...Se,page:1}),Re=(0,l.useMemo)((()=>{if(Ne.length)return[...Ne].sort(((e,t)=>P[e.type]-P[t.type]))}),[Ne]),[Be,Le]=(0,l.useState)([]);(0,l.useEffect)((()=>{const e=new Set;if(Re&&Ne.length){for(const t of Re)t.type&&e.add(t.type);Le(Array.from(e))}}),[Ne.length,Re]);const Pe=(0,l.useMemo)((()=>{const e=new Set;for(const t of he)e.add(t);for(const t of je)e.add(t);for(const t of Be)e.add(t);return Array.from(e)}),[Be,je,he]),Fe=e=>{se((t=>({...t,...e,page:1}))),fe((t=>({...t,...e,page:1}))),we((t=>({...t,...e,page:1})))},Me=(0,l.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/660+"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,l.useEffect)((()=>{Ie||Te||!Ce||"template"===t||(o?Me():r())}),[Ie,Te,Ce,Me,re.name,r,o,t]),(0,l.useEffect)((()=>{const e=new Set;if(ae&&pe){for(const t of pe)t.type&&e.add(t.type);ge(Array.from(e))}}),[ae,pe]);const De=e=>{r(),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 ze=null;const Oe=e=>{clearTimeout(ze);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,l=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"),l=document.createElement("div"),l.classList.add("block-search__preview-content"),t.append(l),t.append(o),document.querySelector(".email-pane__col_settings-inner").append(t)),o.innerHTML="",l.innerHTML="",o.innerHTML=e.title;let r=e.html.replaceAll(/<style((.|\n|\r)*?)<\/style>/gi,"").trim();l.innerHTML=I('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+r+"</table>"),"1"!==t.style.opacity&&setTimeout((function(){t.style.opacity="1",t.style.transform="translateX(-100%)"}),10)},qe=()=>{let e=document.querySelector(".block-search__preview");e&&(ze=setTimeout((()=>{e.style.opacity="0",e.style.transform="translateX(-99%)",setTimeout((function(){e.remove()}),300)}),300))};(0,l.useEffect)((()=>{document.querySelectorAll(".blocks-search__result").forEach((e=>{e.style.display="block"}))}),[t]);const He=!(null!==ce&&void 0!==ce&&ce.length)&&(!e||!(null!==Y&&void 0!==Y&&Y.length))&&!(null!==Ne&&void 0!==Ne&&Ne.length)&&(re.tags||re.name||re.type)&&!(ne||de);(0,l.useEffect)((()=>{ne||de||r()}),[ne,de,r]),(0,l.useEffect)((()=>{("common"===t||o)&&setTimeout(r,50)}),[ce,r,t,o]);const $e=e=>{U({maskClosable:!0,centered:!0,title:V("Are you sure you want to delete the \u201c","block")+e.title+$("\u201d block?"),icon:(0,T.jsx)(p.A,{}),okText:$("Yes"),cancelText:$("No"),onOk:()=>(e=>oe.dispatch(k.VM.endpoints.deleteBlock.initiate(e.id)).then((t=>{t.error&&W.fromError("BLOCK_REMOVING_ERROR",(0,u.x_)(e),t.error),W.success({id:"BLOCK_REMOVING_SUCCESS",data:(0,u.x_)(e),message:$("The block \u201c")+t.data.title+V("\u201d was successfully removed.","block")}),me()})))(e)})},Ve=(e,t)=>`${e.pathname.split("emails")[0]}blocks/${t.id}`,We=e=>{let t=[{key:"Delete block",className:"blocks-search__result__menu-item",icon:(0,T.jsx)(p.A,{style:{fontSize:"16px",margin:0}}),style:{color:H.colorError},onClick:()=>$e(e)}];return!w.EW.isPlugin&&t.unshift({key:"Edit block",className:"blocks-search__result__menu-item",icon:(0,T.jsx)(h.A,{style:{fontSize:"16px",margin:0}}),label:(0,T.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:Ve(X,e),children:" "})}),t},Ge=e=>{let t="<tr"===e.html.substring(0,3)?document.createElement("table"):document.createElement("div");if(t.replaceChildren(...(0,A.$$)(e.html)),0!==Object.keys(J).length&&(t.querySelectorAll(".em-contrast-card").forEach((e=>{var t,o;null!==(t=J.cards)&&void 0!==t&&t.contrastBackgroundColor&&(e.getAttribute("bgcolor")?J.cards.contrastBackgroundColor?e.setAttribute("bgcolor",J.cards.contrastBackgroundColor):e.removeAttribute("bgcolor"):J.cards.contrastBackgroundColor?e.style.backgroundColor=J.cards.contrastBackgroundColor:e.style.removeProperty("background-color")),null!==(o=J.cards)&&void 0!==o&&o.contrastTextColor&&e.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach((e=>{if("#ffffff"!==Xe(e.style.color).toLowerCase()){let t=e.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${J.cards.contrastTextColor};`);e.setAttribute("style",t)}}))})),t.querySelectorAll(".em-card").forEach((e=>{var t,o;null!==(t=J.cards)&&void 0!==t&&t.baseBackgroundColor&&(e.getAttribute("bgcolor")?J.cards.baseBackgroundColor?e.setAttribute("bgcolor",J.cards.baseBackgroundColor):e.removeAttribute("bgcolor"):J.cards.baseBackgroundColor?e.style.backgroundColor=J.cards.baseBackgroundColor:e.style.removeProperty("background-color")),null!==(o=J.cards)&&void 0!==o&&o.baseTextColor&&e.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach((e=>{if("#ffffff"!==Xe(e.style.color).toLowerCase()){let t=e.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${J.cards.baseTextColor};`);e.setAttribute("style",t)}}))})),t.querySelectorAll(".em-card, .em-contrast-card").forEach((e=>{var t,o,l,r,s,a;null!==(t=J.cards)&&void 0!==t&&t.border&&Ke({settings:{border:null===(a=J.cards)||void 0===a?void 0:a.border},elem:e});if(null!==(o=J.cards)&&void 0!==o&&null!==(l=o.borderRadius)&&void 0!==l&&l.all){var i,n,d,c;if(e.style.borderBottomLeftRadius&&"0px"!==e.style.borderBottomLeftRadius)e.style.borderBottomLeftRadius=(null===(i=J.cards)||void 0===i?void 0:i.borderRadius.all)+"px";if(e.style.borderBottomRightRadius&&"0px"!==e.style.borderBottomRightRadius)e.style.borderBottomRightRadius=(null===(n=J.cards)||void 0===n?void 0:n.borderRadius.all)+"px";if(e.style.borderTopLeftRadius&&"0px"!==e.style.borderTopLeftRadius)e.style.borderTopLeftRadius=(null===(d=J.cards)||void 0===d?void 0:d.borderRadius.all)+"px";if(e.style.borderTopRightRadius&&"0px"!==e.style.borderTopRightRadius)e.style.borderTopRightRadius=(null===(c=J.cards)||void 0===c?void 0:c.borderRadius.all)+"px"}else if(""===(null===(r=J.cards)||void 0===r||null===(s=r.borderRadius)||void 0===s?void 0:s.all))e.style.removeProperty("border-radius");else{var m,u,p,h,g,b,f,v,y,x,_,A,j,k,S,w,C,E,T,I;if(null!==(m=J.cards)&&void 0!==m&&null!==(u=m.borderRadius)&&void 0!==u&&u.topLeft&&e.style.borderTopLeftRadius&&"0px"!==e.style.borderTopLeftRadius)e.style.borderTopLeftRadius=(null===(C=J.cards)||void 0===C?void 0:C.borderRadius.topLeft)+"px";else""===(null===(p=J.cards)||void 0===p||null===(h=p.borderRadius)||void 0===h?void 0:h.topLeft)&&e.style.removeProperty("border-top-left-radius");if(null!==(g=J.cards)&&void 0!==g&&null!==(b=g.borderRadius)&&void 0!==b&&b.topRight&&e.style.borderTopRightRadius&&"0px"!==e.style.borderTopRightRadius)e.style.borderTopRightRadius=(null===(E=J.cards)||void 0===E?void 0:E.borderRadius.topRight)+"px";else""===(null===(f=J.cards)||void 0===f||null===(v=f.borderRadius)||void 0===v?void 0:v.topRight)&&e.style.removeProperty("border-top-right-radius");if(null!==(y=J.cards)&&void 0!==y&&null!==(x=y.borderRadius)&&void 0!==x&&x.bottomRight&&e.style.borderBottomRightRadius&&"0px"!==e.style.borderBottomRightRadius)e.style.borderBottomRightRadius=(null===(T=J.cards)||void 0===T?void 0:T.borderRadius.bottomRight)+"px";else""===(null===(_=J.cards)||void 0===_||null===(A=_.borderRadius)||void 0===A?void 0:A.bottomRight)&&e.style.removeProperty("border-bottom-right-radius");if(null!==(j=J.cards)&&void 0!==j&&null!==(k=j.borderRadius)&&void 0!==k&&k.bottomLeft&&e.style.borderBottomLeftRadius&&"0px"!==e.style.borderBottomLeftRadius)e.style.borderBottomLeftRadius=(null===(I=J.cards)||void 0===I?void 0:I.borderRadius.bottomLeft)+"px";else""===(null===(S=J.cards)||void 0===S||null===(w=S.borderRadius)||void 0===w?void 0:w.bottomLeft)&&e.style.removeProperty("border-bottom-left-radius")}})),t.querySelectorAll('div[style*="font-family"], span[style*="font-family"]').forEach((e=>{if(!e.style.display&&parseFloat(e.style.fontSize)<=20){let l="",r=J.text.fontFamily;if(parseFloat(e.style.fontSize)>14&&(l=e.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${J.text.fontSize}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${J.text.lineHeight}px`),e.setAttribute("style",l)),e.closest(".em-contrast-card, .em-card")||"#ffffff"===Xe(e.style.color).toLowerCase()||(l=e.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${J.text.color};`),e.setAttribute("style",l)),e.closest(".em-contrast-block")&&!e.closest(".em-contrast-card, .em-card")&&(l=e.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${J.text.contrastColor};`),e.setAttribute("style",l)),"Safe Fonts"===r[0]?(e.style.fontFamily=r[1],Ue({elem:t})):"Google Fonts"===r[0]&&("Sans Serif"===r[1]?e.style.fontFamily="Helvetica, Arial, sans-serif":"Serif"===r[1]&&(e.style.fontFamily='"Times New Roman", Times, serif'),e.classList.remove(...[...e.classList].filter((e=>e.startsWith("em-font")))),e.classList.add(`em-font-${r[2].replace(/\s/g,"")}-${r[3].replace(/\s/g,"")}`),Ye({elem:t,fontFamilyArray:r})),e.closest('[em="atom"] > tr > td')&&e.closest('[em="atom"] > tr > td').style.paddingBottom)e.closest('[em="atom"] > tr > td').style.paddingBottom=J.text.paddingBottom+"px";else if(e.nextElementSibling||e.closest("table")&&e.closest("table").nextElementSibling){var o;let t=null!==(o=e.nextElementSibling)&&void 0!==o?o:e.closest("table").nextElementSibling;t&&"TABLE"===t.tagName&&(t.classList.contains("em-vindent-table")||""===t.querySelector("td").innerHTML)&&t.querySelector("td").setAttribute("height",J.text.paddingBottom)}}else if(!e.style.display&&parseFloat(e.style.fontSize)>=20&&"#eb3737"!==Xe(e.style.color).toLowerCase()){let o="",l=J.headings.fontFamily;parseFloat(e.style.fontSize)<40&&(o=e.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${J.headings.fontSize}px`).replace(/line-height:(\s+)?.*?px/,`line-height: ${J.headings.lineHeight}px`),e.setAttribute("style",o)),e.closest(".em-contrast-card, .em-card")||"#ffffff"===Xe(e.style.color).toLowerCase()||(o=e.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${J.headings.color};`),e.setAttribute("style",o)),e.closest(".em-contrast-block")&&!e.closest(".em-contrast-card, .em-card")&&(o=e.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${J.headings.contrastColor};`),e.setAttribute("style",o)),"Safe Fonts"===l[0]?(e.style.fontFamily=l[1],Ue({elem:t})):"Google Fonts"===l[0]&&("Sans Serif"===l[1]?e.style.fontFamily="Helvetica, Arial, sans-serif":"Serif"===l[1]&&(e.style.fontFamily='"Times New Roman", Times, serif'),e.classList.remove(...[...e.classList].filter((e=>e.startsWith("em-font")))),e.classList.add(`em-font-${l[2].replace(/\s/g,"")}-${l[3].replace(/\s/g,"")}`),Ye({elem:t,fontFamilyArray:l}));let r="";if(r=J.headings.letterSpacing>0?e.style.letterSpacing?e.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${J.headings.letterSpacing}px`):e.getAttribute("style")+` letter-spacing: ${J.headings.letterSpacing}px;`:e.getAttribute("style").replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,""),e.setAttribute("style",r),J.headings.bold?e.querySelector("b")?e.querySelector("b").replaceWith(...e.querySelector("b").childNodes):e.querySelector("strong")||(e.innerHTML="<strong>"+e.innerHTML+"</strong>"):e.querySelector("strong")?e.querySelector("strong").replaceWith(...e.querySelector("strong").childNodes):e.querySelector("b")&&e.querySelector("b").replaceWith(...e.querySelector("b").childNodes),e.style.fontWeight){let t=e.getAttribute("style").replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"");e.setAttribute("style",t)}if(J.headings.italic?e.querySelector("i")?e.querySelector("i").replaceWith(...e.querySelector("i").childNodes):e.querySelector("em")||(e.innerHTML="<em>"+e.innerHTML+"</em>"):e.querySelector("em")?e.querySelector("em").replaceWith(...e.querySelector("em").childNodes):e.querySelector("i")&&e.querySelector("i").replaceWith(...e.querySelector("i").childNodes),e.style.fontStyle){let t=e.getAttribute("style").replace(/(\s+)?font-style:(\s+)?.*?;/,"");e.setAttribute("style",t)}if(e.closest('[em="atom"] > tr > td')&&e.closest('[em="atom"] > tr > td').style.paddingTop)e.closest('[em="atom"] > tr > td').style.paddingTop=J.headings.paddingTop+"px";else if(e.previousElementSibling){let t=e.previousElementSibling;t&&"TABLE"===t.tagName&&(t.classList.contains("em-vindent-table")||""===t.querySelector("td").innerHTML)&&t.querySelector("td").setAttribute("height",J.headings.paddingTop)}if(e.closest('[em="atom"] > tr > td')&&e.closest('[em="atom"] > tr > td').style.paddingBottom)e.closest('[em="atom"] > tr > td').style.paddingBottom=J.headings.paddingBottom+"px";else if(e.nextElementSibling){let t=e.nextElementSibling;t&&"TABLE"===t.tagName&&(t.classList.contains("em-vindent-table")||""===t.querySelector("td").innerHTML)&&t.querySelector("td").setAttribute("height",J.headings.paddingBottom)}}})),t.querySelectorAll('a[style*="color"]').forEach((e=>{if(e.style.display){if(e.style.display&&"block"===e.style.display){let o="";if(o=e.getAttribute("style").replace(/font-size:(\s+)?.*?px/,`font-size: ${J.buttons.fontSize}px`),e.setAttribute("style",o),!e.closest("td").style.backgroundColor||e.closest("td").style.borderWidth||e.closest(".em-contrast-card"))if(e.closest("td").style.borderWidth)if(Object.values(J.buttons.border).every((e=>null===e))){if(e.closest(".em-contrast-block")){if(J.buttons.contrastBackgroundColor){let t=e.closest("td").getAttribute("style").replace(/border:\s*\d+px\s+solid\s+#[A-Fa-f0-9]{6}/,(e=>e.replace(/#[A-Fa-f0-9]{6}/,`${J.buttons.contrastBackgroundColor}`)));e.closest("td").setAttribute("style",t),o=e.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${J.buttons.contrastBackgroundColor};`),e.setAttribute("style",o)}}else if(J.buttons.backgroundColor){let t=e.closest("td").getAttribute("style").replace(/border:\s*\d+px\s+solid\s+#[A-Fa-f0-9]{6}/,(e=>e.replace(/#[A-Fa-f0-9]{6}/,`${J.buttons.backgroundColor}`)));e.closest("td").setAttribute("style",t),o=e.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${J.buttons.backgroundColor};`),e.setAttribute("style",o)}}else for(const t in J.buttons.border)J.buttons.border[t]&&void 0!==J.buttons.border[t].color&&(o=e.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${J.buttons.border[t].color};`),e.setAttribute("style",o));else e.closest(".em-contrast-block")?J.buttons.contrastBackgroundColor&&(o=e.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${J.buttons.contrastBackgroundColor};`),e.setAttribute("style",o)):J.buttons.backgroundColor&&(o=e.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${J.buttons.backgroundColor};`),e.setAttribute("style",o));else if(o=e.closest(".em-contrast-block")?e.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${J.buttons.contrastColor};`):e.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${J.buttons.color};`),e.setAttribute("style",o),e.closest(".em-contrast-block"))if(J.buttons.contrastBackgroundColor){let t=e.closest("td").getAttribute("style").replace(/background-color:(\s+)?.*?;/,`background-color: ${J.buttons.contrastBackgroundColor};`);e.closest("td").setAttribute("style",t)}else e.closest("td").style.removeProperty("background-color");else if(J.buttons.backgroundColor){let t=e.closest("td").getAttribute("style").replace(/background-color:(\s+)?.*?;/,`background-color: ${J.buttons.backgroundColor};`);e.closest("td").setAttribute("style",t)}else e.closest("td").style.removeProperty("background-color");let l=J.buttons.fontFamily;"Safe Fonts"===l[0]?(e.style.fontFamily=l[1],Ue({elem:t})):"Google Fonts"===l[0]&&("Sans Serif"===l[1]?e.style.fontFamily="Helvetica, Arial, sans-serif":"Serif"===l[1]&&(e.style.fontFamily='"Times New Roman", Times, serif'),e.classList.remove(...[...e.classList].filter((e=>e.startsWith("em-font")))),e.classList.add(`em-font-${l[2].replace(/\s/g,"")}-${l[3].replace(/\s/g,"")}`),Ye({elem:t,fontFamilyArray:l})),e.closest("td").setAttribute("align",J.buttons.textAlign);let r="";if(r=J.buttons.letterSpacing>0?e.style.letterSpacing?e.getAttribute("style").replace(/letter-spacing:(\s+)?.*?px/,`letter-spacing: ${J.buttons.letterSpacing}px`):e.getAttribute("style")+` letter-spacing: ${J.buttons.letterSpacing}px;`:e.getAttribute("style").replace(/(\s+)?letter-spacing:(\s+)?.*?px(;)?/,""),e.setAttribute("style",r),J.buttons.bold?e.querySelector("b")?e.querySelector("b").replaceWith(...e.querySelector("b").childNodes):e.querySelector("strong")||(e.innerHTML="<strong>"+e.innerHTML+"</strong>"):e.querySelector("strong")?e.querySelector("strong").replaceWith(...e.querySelector("strong").childNodes):e.querySelector("b")&&e.querySelector("b").replaceWith(...e.querySelector("b").childNodes),e.style.fontWeight){let t=e.getAttribute("style").replace(/(\s+)?font-weight:(\s+)?(bold|[0-9]*)(;)?/,"");e.setAttribute("style",t)}if(J.buttons.italic?e.querySelector("i")?e.querySelector("i").replaceWith(...e.querySelector("i").childNodes):e.querySelector("em")||(e.innerHTML="<em>"+e.innerHTML+"</em>"):e.querySelector("em")?e.querySelector("em").replaceWith(...e.querySelector("em").childNodes):e.querySelector("i")&&e.querySelector("i").replaceWith(...e.querySelector("i").childNodes),e.style.fontStyle){let t=e.getAttribute("style").replace(/(\s+)?font-style:(\s+)?.*?;/,"");e.setAttribute("style",t)}if(e.closest('[em="atom"] > tr > td')&&e.closest('[em="atom"] > tr > td').style.paddingTop)e.closest('[em="atom"] > tr > td').style.paddingTop=J.buttons.marginTop+"px";else if(e.closest("table").previousElementSibling){let t=e.closest("table").previousElementSibling;t&&"TABLE"===t.tagName&&(t.classList.contains("em-vindent-table")||""===t.querySelector("td").innerHTML)&&t.querySelector("td").setAttribute("height",J.buttons.marginTop)}if(e.closest('[em="atom"] > tr > td')&&e.closest('[em="atom"] > tr > td').style.paddingBottom)e.closest('[em="atom"] > tr > td').style.paddingBottom=J.buttons.marginBottom+"px";else if(e.closest("table").previousElementSibling){let t=e.closest("table").nextElementSibling;t&&"TABLE"===t.tagName&&(t.classList.contains("em-vindent-table")||""===t.querySelector("td").innerHTML)&&t.querySelector("td").setAttribute("height",J.buttons.marginBottom)}J.buttons.padding.all&&(e.style.padding=J.buttons.padding.all+"px"),J.buttons.padding.top&&(e.style.paddingTop=J.buttons.padding.top+"px"),J.buttons.padding.right&&(e.style.paddingRight=J.buttons.padding.right+"px"),J.buttons.padding.bottom&&(e.style.paddingBottom=J.buttons.padding.bottom+"px"),J.buttons.padding.left&&(e.style.paddingLeft=J.buttons.padding.left+"px"),Ke({settings:{border:J.buttons.border},elem:e.closest("td")}),Ze({settings:{borderRadius:J.buttons.borderRadius},elem:e.closest("td")})}}else{let o=J.text.fontFamily;if("#1c52dc"===Xe(e.style.color).toLowerCase()){let t=e.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${J.links.color};`);e.setAttribute("style",t)}else{let t=e.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${J.text.color};`);e.setAttribute("style",t)}if(e.closest(".em-contrast-block")){let t=e.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${J.links.contrastColor};`);e.setAttribute("style",t)}let l="";l=J.links.underline?e.style.textDecoration?e.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: underline;"):e.getAttribute("style")+" text-decoration: underline;":e.style.textDecoration?e.getAttribute("style").replace(/(\s+)?text-decoration:(\s+)?.*?;/,"text-decoration: none;"):e.getAttribute("style")+" text-decoration: none;",e.setAttribute("style",l),"Safe Fonts"===o[0]?(e.style.fontFamily=o[1],Ue({elem:t})):"Google Fonts"===o[0]&&("Sans Serif"===o[1]?e.style.fontFamily="Helvetica, Arial, sans-serif":"Serif"===o[1]&&(e.style.fontFamily='"Times New Roman", Times, serif'),e.classList.remove(...[...e.classList].filter((e=>e.startsWith("em-font")))),e.classList.add(`em-font-${o[2].replace(/\s/g,"")}-${o[3].replace(/\s/g,"")}`),Ye({elem:t,fontFamilyArray:o}))}})),t.querySelector('[em="block"]'))){var o,l;const e=t.querySelectorAll('[em="block"]');null!==(o=J.block)&&void 0!==o&&o.backgroundColor&&e.forEach((e=>{e.querySelectorAll(":scope > td").forEach((e=>{e.setAttribute("bgcolor",J.block.backgroundColor)}))})),null!==(l=J.block)&&void 0!==l&&l.padding&&e.forEach((e=>{e.querySelectorAll(":scope > td").forEach((e=>{e.style.paddingTop=J.block.padding.top+"px",e.style.paddingRight=J.block.padding.right+"px",e.style.paddingBottom=J.block.padding.bottom+"px",e.style.paddingLeft=J.block.padding.left+"px"}))}))}return"DIV"===t.tagName?(0,_.uL)(t):(0,_.uL)(t.querySelector("tbody"))},Ue=e=>{e.elem.querySelectorAll("link[em-class]").forEach((t=>{e.elem.querySelector("."+t.getAttribute("em-class"))||t.remove()}))};function Xe(e){if(e&&"r"===e.charAt(0)){if("a"===e.charAt(3))return(e=e.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i))&&4===e.length?"#"+("0"+parseInt(e[1],10).toString(16)).slice(-2)+("0"+parseInt(e[2],10).toString(16)).slice(-2)+("0"+parseInt(e[3],10).toString(16)).slice(-2):"";{e=e.replace("rgb(","").replace(")","").split(",");let t=parseInt(e[0],10).toString(16),o=parseInt(e[1],10).toString(16),l=parseInt(e[2],10).toString(16);return t=1===t.length?"0"+t:t,o=1===o.length?"0"+o:o,l=1===l.length?"0"+l:l,"#"+t+o+l}}if(e&&"#"===e.charAt(0))return e}const Ye=e=>{var t;const o=e.elem.querySelectorAll("link"),l=`em-font-${e.fontFamilyArray[2].replace(/\s/g,"")}-${e.fontFamilyArray[3].replace(/\s/g,"")}`;if(!!(null===(t=Array.from(o))||void 0===t||!t.find((e=>e.getAttribute("em-class")===l)))){let t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href",`https://fonts.googleapis.com/css2?family=${e.fontFamilyArray[2]}:ital,wght@${Je[e.fontFamilyArray[3]].indexOf("i")>-1?"1":"0"},${Je[e.fontFamilyArray[3]].replaceAll("i","")}&display=swap`),t.setAttribute("em-class",l),e.elem.insertAdjacentElement("afterbegin",t)}!function(e){if(!e.elem.querySelector('style[em="styles"]')){let t=document.createElement("style");t.setAttribute("em","styles"),e.elem.append(t)}}({elem:e.elem});let r=`font-family: '${e.fontFamilyArray[2]}', ${Qe[e.fontFamilyArray[1]]}!important;`;r+=` font-weight: ${Je[e.fontFamilyArray[3]].replaceAll("i","")}!important;`,Je[e.fontFamilyArray[3]].indexOf("i")>-1&&(r+=" font-style: italic!important;"),e.elem.querySelector('style[em="styles"]').insertAdjacentHTML("beforeend",`\n.em-font-${e.fontFamilyArray[2].replace(/\s/g,"")}-${e.fontFamilyArray[3].replace(/\s/g,"")} { ${r} }`),setTimeout((()=>Ue({elem:e.elem})),0)},Ke=e=>{e.settings.border.all?(null!==e.settings.border.all.width?e.elem.style.borderWidth=e.settings.border.all.width+"px":e.elem.style.removeProperty("border-width"),e.elem.style.borderStyle=e.settings.border.all.style,e.elem.style.borderColor=e.settings.border.all.color):(e.settings.border.top&&(null!==e.settings.border.top.width?e.elem.style.borderTopWidth=e.settings.border.top.width+"px":e.elem.style.removeProperty("border-top-width"),e.elem.style.borderTopStyle=e.settings.border.top.style,e.elem.style.borderTopColor=e.settings.border.top.color),e.settings.border.right&&(null!==e.settings.border.right.width?e.elem.style.borderRightWidth=e.settings.border.right.width+"px":e.elem.style.removeProperty("border-right-width"),e.elem.style.borderRightStyle=e.settings.border.right.style,e.elem.style.borderRightColor=e.settings.border.right.color),e.settings.border.bottom&&(null!==e.settings.border.bottom.width?e.elem.style.borderBottomWidth=e.settings.border.bottom.width+"px":e.elem.style.removeProperty("border-bottom-width"),e.elem.style.borderBottomStyle=e.settings.border.bottom.style,e.elem.style.borderBottomColor=e.settings.border.bottom.color),e.settings.border.left&&(null!==e.settings.border.left.width?e.elem.style.borderLeftWidth=e.settings.border.left.width+"px":e.elem.style.removeProperty("border-left-width"),e.elem.style.borderLeftStyle=e.settings.border.left.style,e.elem.style.borderLeftColor=e.settings.border.left.color))},Ze=e=>{e.settings.borderRadius.all?e.elem.style.borderRadius=e.settings.borderRadius.all+"px":""===e.settings.borderRadius.all?e.elem.style.removeProperty("border-radius"):(e.settings.borderRadius.topLeft?e.elem.style.borderTopLeftRadius=e.settings.borderRadius.topLeft+"px":""===e.settings.borderRadius.topLeft&&e.elem.style.removeProperty("border-top-left-radius"),e.settings.borderRadius.topRight?e.elem.style.borderTopRightRadius=e.settings.borderRadius.topRight+"px":""===e.settings.borderRadius.topRight&&e.elem.style.removeProperty("border-top-right-radius"),e.settings.borderRadius.bottomRight?e.elem.style.borderBottomRightRadius=e.settings.borderRadius.bottomRight+"px":""===e.settings.borderRadius.bottomRight&&e.elem.style.removeProperty("border-bottom-right-radius"),e.settings.borderRadius.bottomLeft?e.elem.style.borderBottomLeftRadius=e.settings.borderRadius.bottomLeft+"px":""===e.settings.borderRadius.bottomLeft&&e.elem.style.removeProperty("border-bottom-left-radius"))},Je={Thin:"100","Thin Italic":"100i",ExtraLight:"200","ExtraLight Italic":"200i",Light:"300","Light Italic":"300i",Regular:"400","Regular Italic":"400i",Medium:"500","Medium Italic":"500i",SemiBold:"600","SemiBold Italic":"600i",Bold:"700","Bold Italic":"700i",ExtraBold:"800","ExtraBold Italic":"800i",Black:"900","Black Italic":"900i"},Qe={"Sans Serif":"sans-serif",Serif:"serif"};return(0,T.jsxs)("div",{className:x()("blocks-search",{is_search:o}),children:[(0,T.jsx)(s.A,{className:x()("blocks-search__form",{is_search:o}),form:O,layout:"vertical",name:"blocks_search_form",initialValues:{...L},onValuesChange:e=>{const t=Object.keys(e)[0],o=O.getFieldsValue(!0);switch(t){case B:const l=(0,C._q)(le,w.YY).filter((o=>e[t].includes(o.name))).map((e=>e.id))||null;Fe({tags:l});break;case R:Fe({type:o.type||null});break;case N:K.current&&window.clearTimeout(K.current),K.current=window.setTimeout((function(){Fe({name:o.name||null})}),300)}},autoComplete:"off",children:(0,T.jsx)(s.A.Item,{name:N,children:(0,T.jsx)(i.A,{placeholder:$("Search by title"),allowClear:!0,suffix:(0,T.jsx)(g.A,{className:"cards-search__search-icon, input-icon",style:{fontSize:"16px",cursor:"pointer"}})})})}),(ie||ye||Ee)&&(0,T.jsx)(n.A,{message:$("Error"),description:$("Error when receiving data. Try again (reload page) or contact support."),type:"error",showIcon:!0}),o&&!He&&(0,T.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,T.jsxs)("ul",{children:[(0,T.jsx)("li",{"data-type":"",className:"active",onClick:De,children:$("All")},"search_All"),Pe.map((e=>(0,T.jsx)("li",{"data-type":e,onClick:De,children:$(w.jg[e])},"search_"+e)))]})}),(0,T.jsxs)("div",{ref:Z,className:x()("blocks-search__result-wrapper",{is_search:o}),children:[("project"===t||o)&&(0,T.jsxs)(T.Fragment,{children:[!!he.length&&!o&&(0,T.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,T.jsxs)("ul",{children:[(0,T.jsx)("li",{"data-type":"",className:"active",onClick:De,children:$("All")},"blocksSections_All"),he.map((e=>(0,T.jsx)("li",{"data-type":e,onClick:De,children:$(w.jg[e])},"blocksSections_"+e)))]})}),(0,T.jsxs)("div",{className:x()("blocks-search__blocks-wrapper",{is_search:o}),ref:Q,children:[(0,T.jsx)("div",{className:"blocks-search__result-holder project",children:!(ne||de)&&(null!==pe&&void 0!==pe&&pe.length?pe.map(((e,t)=>{const o=I('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+e.html+"</table>");return(0,T.jsx)("div",{className:"blocks-search__result","data-type":e.type,children:(0,T.jsx)(d.A,{placement:"leftTop",menu:{items:We(e)},overlayStyle:{minWidth:"auto",paddingRight:6},children:(0,T.jsx)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:t=>D(t,e.html),onDragStart:t=>z(t,e.html,"project"),onMouseEnter:()=>Oe({html:e.html,title:e.title}),onMouseLeave:qe,children:(0,T.jsx)("div",{className:"blocks-search__result-html",dangerouslySetInnerHTML:{__html:o},style:{transform:"scale("+207/660+")"}})})},"commenMenu")},e.id+t.toString())})):!(re.tags||re.name||re.type)&&ae&&!(ne||de)&&!o&&(0,T.jsxs)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:[$("You don`t have any saved blocks yet."),(0,T.jsx)("br",{}),(0,T.jsx)("br",{}),$("To add a block from the dashboard click the"),(0,T.jsx)("br",{}),(0,T.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,T.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"})})," ",$("Save to Blocks button.")]}))}),(ne||de)&&(0,T.jsx)(c.A,{active:!0})]})]}),o&&(null===ce||void 0===ce?void 0:ce.length)>0&&(null===Y||void 0===Y?void 0:Y.length)>0&&(0,T.jsx)(m.A,{className:"blocks-search__result-divider"}),("template"===t||o)&&(0,T.jsxs)(T.Fragment,{children:[!!je.length&&!o&&(0,T.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,T.jsxs)("ul",{children:[(0,T.jsx)("li",{"data-type":"",className:"active",onClick:De,children:$("All")},"templateBlocksSections_All"),je.map((e=>(0,T.jsx)("li",{"data-type":e,onClick:De,children:$(w.jg[e])},"templateBlocksSections_"+e)))]})}),(0,T.jsxs)("div",{className:x()("blocks-search__blocks-wrapper",{is_search:o}),ref:ee,children:[(0,T.jsxs)("div",{className:"blocks-search__result-holder template",children:[Y&&!xe&&!_e&&null!==Ae&&void 0!==Ae&&Ae.length?(0,T.jsx)(T.Fragment,{children:Ae.map(((e,t)=>{const o=I('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+e.html+"</table>");return(0,T.jsx)("div",{className:"blocks-search__result","data-type":e.type,children:(0,T.jsx)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:t=>D(t,e.html),onDragStart:t=>z(t,e.html,"template"),onMouseEnter:()=>Oe({html:e.html,title:e.title}),onMouseLeave:()=>qe(),children:(0,T.jsx)("div",{className:"blocks-search__result-html",dangerouslySetInnerHTML:{__html:o},style:{transform:"scale("+207/660+")"}})})},e.id+t.toString())}))}):!o&&!Te&&!_e&&(0,T.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:$("No related blocks found.")})," "]}),(xe||_e)&&(0,T.jsx)(c.A,{active:!0})]})]}),o&&(null===Y||void 0===Y?void 0:Y.length)>0&&(null===Ne||void 0===Ne?void 0:Ne.length)>0&&(0,T.jsx)(m.A,{className:"blocks-search__result-divider"}),("common"===t||o)&&(0,T.jsxs)(T.Fragment,{children:[!(null===Be||void 0===Be||!Be.length)&&!o&&(0,T.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,T.jsxs)("ul",{children:[(0,T.jsx)("li",{"data-type":"",className:"active",onClick:De,children:$("All")},"commonBlocksSections_All"),Be.map((e=>(0,T.jsx)("li",{"data-type":e,onClick:De,children:$(w.jg[e])},"commonBlocksSections_"+e)))]})}),(0,T.jsxs)("div",{className:x()("blocks-search__blocks-wrapper",{is_search:o}),ref:te,children:[(0,T.jsxs)("div",{className:"blocks-search__result-holder common",children:[Ce&&!(null===Re||void 0===Re||!Re.length)&&!(Ie||Te)&&(0,T.jsx)(T.Fragment,{children:Re.map(((e,t)=>{const o=Ge({html:I('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+e.html+"</table>")});return(0,T.jsx)("div",{className:"blocks-search__result","data-type":e.type,children:(0,T.jsx)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:t=>D(t,Ge({html:e.html})),onDragStart:t=>z(t,Ge({html:e.html}),"common"),onMouseEnter:()=>Oe({html:Ge({html:I('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+e.html+"</table>")}),title:e.title}),onMouseLeave:()=>qe(),children:(0,T.jsx)("div",{className:"blocks-search__result-html",dangerouslySetInnerHTML:{__html:o},style:{transform:"scale("+207/660+")"}})})},e.id+t.toString())}))})," "]}),(Te||Ie)&&(0,T.jsx)(c.A,{active:!0})]})]}),He&&(0,T.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:$("There are no blocks for this request.")})]})]})}},29067:(e,t,o)=>{o.d(t,{A:()=>$});var l=o(92810),r=o(95838),s=o(33206),a=o(81e3),i=o(66522),n=o(4800),d=o(49246),c=o(29234),m=o(21349),u=o(33151),p=o(71157),h=o(9452),g=o(82013),b=o(9588),f=o(79612),v=o(10900),y=o(85677),x=o(20350),_=o(64586),A=o(8114),j=o(74267),k=o(64617),S=o(94822),w=o(45934),C=o(23287),E=o(38883),T=o.n(E),I=o(57903),N=o(43063),R=o(72981),B=o(55701),L=o(34524),P=o(7760),F=o(86286),M=o(32269),D=o(31844),z=o(85163),O=o(70082);const{useToken:q}=r.A,H=(e,t)=>`${e.pathname}/${t.id}`,$=({projectId:e,emailsView:t,createPage:o=!1,currentFolderId:r,foldersList:E,refetchProjectFolders:$,projectTags:V=[],activeTagId:W,setActiveTagHandler:G,projectEmailsCounter:U=0})=>{var X,Y,K,Z,J,Q,ee,te;const{__:oe,_x:le}=(0,C.s9)(),re=(0,w.wA)(),se=(0,w.d4)(L.D2),ae=(0,w.d4)(L.dV),ie=(0,w.d4)(F.C1),ne=(0,w.d4)(L.NP),de=(0,w.d4)(L.qM),ce=(0,w.d4)(L.ux),me=(0,w.d4)(P.b9);let ue=(0,k.zy)();const{owner:pe,admin:he}=(0,D.A)(),ge=(0,k.Zp)(),{token:be}=q(),{modal:fe}=s.A.useApp(),ve=(0,p.hN)(),{confirm:ye}=fe,xe=(0,w.Pj)(),[_e,Ae]=(0,S.ok)(),{refetch:je}=(0,k.KC)(),ke=+_e.get("page"),Se=_e.get("folder"),we=+_e.get("tag"),[Ce,Ee]=(0,B.pP)(),[Te]=(0,B.R2)(),[Ie]=(0,B.OZ)(),[Ne,Re]=(0,l.useState)(!1),Be=r&&r===z.UW,Le=r===z.y2&&!we;(0,l.useEffect)((()=>{re((0,L.FC)())}),[re]);const[Pe,Fe]=(0,l.useState)({projectId:e,page:Le?ke:1,pageSize:z.mU,notEmbed:!0,tags:null,folderTag:null}),{isLoading:Me,isSuccess:De,isError:ze,isFetching:Oe,refetch:qe,error:He}=(0,B.SB)({...Pe,folderTag:null,tags:null,status:"main"},{skip:o||!(null===(X=Pe.name)||void 0===X||!X.length)&&r!==z.y2}),[$e,Ve]=(0,l.useState)({page:ke||1,pageSize:z.mU,folderTag:null,tags:[]}),{isLoading:We,isSuccess:Ge,isError:Ue,isFetching:Xe,data:Ye=[],refetch:Ke,error:Ze}=(0,B.kz)($e,{skip:!o||(Math.ceil(se/z.mU)||1)<$e.page}),[Je,Qe]=(0,l.useState)({projectId:e,page:1,pageSize:z.mU,notEmbed:!0,tags:we&&[we],folderTag:r}),{isLoading:et,isSuccess:tt,isError:ot,isFetching:lt,error:rt}=(0,B.SB)({...Je,tags:r&&Je.folderTag?null:Je.tags,status:"custom"},{skip:o||Be||r===z.y2||Je.folderTag!==r||!(null===(Y=Je.name)||void 0===Y||!Y.length)&&(Be||r===z.y2)}),[st,at]=(0,l.useState)({projectId:e,page:Be?ke:1,pageSize:z.mU,notEmbed:!0,tags:we&&[we],folderTag:null,status:"trash"}),[it,nt]=(0,l.useState)(!1),{isLoading:dt,isSuccess:ct,isError:mt,isFetching:ut,data:pt,refetch:ht,error:gt}=(0,B.SB)({...st,status:"trash",folderTag:null,page:it?st.page:1},{skip:o||(Math.ceil(ae/z.mU)||1)<st.page||!(null===(K=st.name)||void 0===K||!K.length)&&!Be||!(null===(Z=st.tags)||void 0===Z||!Z[0])&&ce>0});(0,l.useEffect)((()=>{nt(!!pt||Math.ceil(ae/z.mU)>=st.page)}),[pt,st.page,ae]);const bt=o?$e:Be?st:Le?Pe:Je,ft=o?Ge:Be?ct:Le?De:tt,vt=o?We:Be?dt:Le?Me:et,yt=o?Ue:Be?mt:Le?ze:ot,xt=o?Xe:Be?ut:Le?Oe:lt,_t=o?Ke:Be?ht:Le?qe:()=>{var e;return re(B.VM.endpoints.getBlocks.initiate({...bt,folderTag:r||(null===(e=bt.tags)||void 0===e?void 0:e[0])||!1}))},At=o?Ze:Be?gt:Le?He:rt,jt=(o?se:Be?ae:Le?se:null===ne||void 0===ne||null===(J=ne[r||(null===(Q=Je.tags)||void 0===Q?void 0:Q[0])])||void 0===J?void 0:J.total)||0,kt=o?Ye:Be?ce:Le?de:null===ne||void 0===ne||null===(ee=ne[r||(null===(te=Je.tags)||void 0===te?void 0:te[0])])||void 0===ee?void 0:ee.list,St=(0,l.useCallback)((e=>{o?Ve((t=>({...t,...e}))):Be?at((t=>({...t,...e}))):Le?Fe((t=>({...t,...e}))):Qe((t=>({...t,...e})))}),[o,Be,Le]);(0,l.useEffect)((()=>{var e;"rest_post_invalid_page_number"===(null===At||void 0===At||null===(e=At.data)||void 0===e?void 0:e.code)&&St({page:1})}),[At,St]),(0,l.useEffect)((()=>{if(!o){(Se&&Se!==r||W&&we!==W)&&St({folderTag:r,page:1});let e={page:Se===r&&bt.page?bt.page:1};r&&!we&&(e.blockfolder=r),W&&(e.tag=W),Ae(e,{replace:!0})}}),[bt.page,ge,o,Se,r,W,we,St,Ae]);const wt=e=>{ye({maskClosable:!0,centered:!0,title:le(Be?"Are you sure to irrevocably delete the \u201c":"Are you sure you want to delete the \u201c","block")+e.title+oe("\u201d block?"),icon:(0,O.jsx)(h.A,{style:{color:"#ff4d4f"}}),okText:oe("Yes"),cancelText:oe("No"),onOk:()=>(e=>xe.dispatch(B.VM.endpoints.deleteBlock.initiate({id:e.id,force:Be})).then((e=>{e.error?(0,M.p6)(e,ve):e.data&&((0,M.wB)(oe("The block \u201c")+e.data.title+le("\u201d was successfully removed.","block"),ve),_t(),$(),ht(),je())})))(e)})},Ct=e=>{Re(!0),Ie({blockId:null===e||void 0===e?void 0:e.id,status:"publish"}).then((t=>{t.error?ve.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]?_t():qe(),$(),ht(),je(),ve.success({message:oe("The block \u201c")+e.title+le("\u201d was successfully recovered.","recovery"),placement:"bottomRight"})),Re(!1)}))},Et=e=>{Re(!0),Te(null===e||void 0===e?void 0:e.id).then((e=>{const t=e.data;Ce({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?ve.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"}):(qe(),ve.success({message:oe("The copy of block \u201c")+t.title+le("\u201d was successfully created.","block"),placement:"bottomRight"})),Re(!1)}))}))},Tt=(e,t)=>{Ie({blockId:t.id,blockfolder:e.key===z.y2?[]:[e.key]}).then((e=>{var o,l;(null===e||void 0===e||null===(o=e.data)||void 0===o?void 0:o.blockfolder[0])&&re(B.VM.endpoints.getBlocks.initiate({...bt,folderTag:(null===e||void 0===e||null===(l=e.data)||void 0===l?void 0:l.blockfolder[0])||null})),r!==z.y2&&(re((0,L.wK)({blockfolder:r,blockId:t.id})),re(B.VM.endpoints.getBlocks.initiate({...bt,folderTag:r||null}))),qe(),$()})).catch((e=>console.warn("err",e)))},It=[{width:"26%",title:oe("Block"),dataIndex:"title",render:(e,t,o)=>(0,O.jsx)(S.N_,{to:H(ue,t),children:e})},{width:"14%",title:oe("Type"),dataIndex:"type",render:(e,t,o)=>e},{width:"20%",title:oe("Tags"),dataIndex:"blocktags",render:(e,t,o)=>(0,O.jsx)(a.A,{wrap:!0,size:10,children:e&&e.map((e=>{const t=null===V||void 0===V?void 0:V.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)(i.A,{color:be.colorPrimary,style:{cursor:"pointer",borderRadius:6,marginRight:0},onClick:()=>G(null,t.id),children:t.name},t.id)||null}))})},{width:"3%",title:"",dataIndex:"lock",render:(e,t,o)=>{var l,r;return e&&(0,O.jsx)(g.A,{className:T()("lock-icon",{"lock-icon__disabled":!(pe||he||(null===(l=ie.id)||void 0===l?void 0:l.toString())===(null===(r=t.author)||void 0===r?void 0:r.toString()))})})}},{width:"16%",title:oe("Creator"),dataIndex:["_embedded","author"],render:(e,t,o)=>{var l;return(null===e||void 0===e||null===(l=e[0])||void 0===l?void 0:l.name)||""}},{width:"9%",title:le("Created","block"),className:"nobr",dataIndex:"date",render:(e,t,o)=>(0,M.Yq)((0,j.A)(e),oe),sorter:!0,sortOrder:(0,M.Np)(bt.order)},{width:"3%",title:"",dataIndex:"",key:"x",onCell:()=>({style:{padding:0}}),render:(e,t)=>{var o,l,r,s,a,i,d,c;const m=t.blockfolder[0]||null,u={icon:(0,O.jsx)(b.A,{style:{fontSize:18}}),label:oe("New blocks"),key:z.y2,onClick:e=>Tt(e,t)},p=null===E||void 0===E?void 0:E.map((e=>({icon:(0,O.jsx)(f.A,{style:{fontSize:18}}),label:e.name,key:e.id,className:e.id,onClick:e=>Tt(e,t)}))),j=(null===p||void 0===p?void 0:p.filter((e=>!m||e.key!==m)))||[];m&&(null===j||void 0===j||j.unshift(u));let k=[];return(pe||he||(null===(o=ie.id)||void 0===o?void 0:o.toString())===(null===(l=t.author)||void 0===l?void 0:l.toString()))&&!Be&&k.push({label:(0,O.jsx)(I.A,{element:t},"Lock"),icon:t.lock?(0,O.jsx)(v.A,{style:{fontSize:"16px"}}):(0,O.jsx)(g.A,{style:{fontSize:"16px"}})}),(pe||he||(null===(r=ie.id)||void 0===r?void 0:r.toString())===(null===(s=t.author)||void 0===s?void 0:s.toString()))&&!Be&&j.length>0&&k.push({label:oe("Transfer to folder"),icon:(0,O.jsx)(f.A,{style:{fontSize:"16px"}}),children:j}),!Be&&k.push({label:(0,O.jsx)(S.N_,{to:H(ue,t),children:oe("Edit")}),icon:(0,O.jsx)(y.A,{style:{fontSize:"16px"}}),key:"Export",className:"em-analytics__block-enter"},{label:oe("Clone"),key:"Clone",icon:(0,O.jsx)(x.A,{style:{fontSize:"16px"}}),className:"em-analytics__block-clone",disabled:Ee.isLoading,onClick:()=>Et(t)}),(pe||he||(null===(a=ie.id)||void 0===a?void 0:a.toString())===(null===(i=t.author)||void 0===i?void 0:i.toString()))&&Be&&k.push({label:oe("Recover"),icon:(0,O.jsx)(_.A,{style:{fontSize:"16px"}}),key:"Recover",onClick:()=>Ct(t)}),(pe||he||(null===(d=ie.id)||void 0===d?void 0:d.toString())===(null===(c=t.author)||void 0===c?void 0:c.toString()))&&k.push({label:oe("Remove"),icon:(0,O.jsx)(h.A,{style:{fontSize:"16px"}}),key:"Remove",className:"em-analytics__block-remove",style:{color:"#ff4d4f"},onClick:()=>wt(t)}),(0,O.jsx)(n.A,{arrow:"true",placement:"bottomRight",menu:{items:k},trigger:["hover"],children:(0,O.jsx)("span",{className:"projects-table__actions",children:(0,O.jsx)(A.A,{})})})}}],[Nt,Rt]=(0,l.useState)(!1);return(0,l.useEffect)((()=>{var e;for(let t in me)if(t||""===t||0===t.length){Rt(!0),St({...me,folderTag:r,page:1});break}(null!==(e=me.tags)&&void 0!==e&&e.length||me.name)&&St({...me,folderTag:r,page:1})}),[me,re,r,Be,St,o]),(0,O.jsxs)("div",{className:"project-blocks-page__list",children:[vt&&!(null!==kt&&void 0!==kt&&kt.length)&&(0,O.jsx)(d.A,{active:!0}),yt&&(0,O.jsx)(c.A,{message:oe("Error"),description:oe("Error when receiving data. Try again (reload page) or contact support."),type:"error",showIcon:!0}),!vt&&!xt&&0===(null===kt||void 0===kt?void 0:kt.length)&&(Nt||U>0?(0,O.jsx)(c.A,{message:oe("Blocks not found"),description:"",type:"info",showIcon:!0}):r!==z.y2?(0,O.jsx)(c.A,{message:oe("You don't have any blocks in this folder."),description:oe("Add your first block to the folder..."),type:"info",showIcon:!0}):(0,O.jsx)(c.A,{message:oe("You don't have any blocks yet."),description:oe("Add your first block by clicking the Create a new block button."),type:"info",showIcon:!0})),(null===kt||void 0===kt?void 0:kt.length)>0&&t===z.rl&&(0,O.jsx)(m.A,{rowKey:e=>e.id,bordered:!0,dataSource:kt,columns:It,loading:xt||Ne,onChange:(e,t,{order:o,field:l},{action:r})=>{"sort"===r&&St(o?{page:bt.page||1,order:(0,M.gq)(o),orderby:l,pageSize:z.mU}:{page:bt.page||1,pageSize:z.mU})},showSizeChanger:!1,pageSize:z.mU,pagination:{current:bt.page||1,total:jt,hideOnSinglePage:!0,showSizeChanger:!1,pageSize:z.mU,position:["bottomLeft"],onChange:(t,o)=>St({projectId:e,page:t,pageSize:o})}}),((null===kt||void 0===kt?void 0:kt.length)>0||ft)&&t===z.Y$&&(0,O.jsxs)(O.Fragment,{children:[Me&&(0,O.jsx)(d.A,{active:!0}),(xt||Ne)&&(0,O.jsx)("div",{className:"project-blocks-page__loader",children:(0,O.jsx)(R.A,{small:!0})}),(0,O.jsx)("div",{className:"project-blocks-page__cards-grid",children:kt&&kt.map((e=>(0,O.jsx)(N.A,{element:e,setSearchFilters:G,isTrash:Be,foldersList:E,refetch:qe,projectTags:V,foldersHandlers:{handleRemove:wt,handleRecover:Ct,handleClone:Et,handlerChangeFolder:Tt}},e.id)))}),(0,O.jsx)(u.A,{current:bt.page||1,total:jt,hideOnSinglePage:!0,showSizeChanger:!1,pageSize:z.mU,onChange:(t,o)=>St({projectId:e,page:t,pageSize:o})})]})]})}},21731:(e,t,o)=>{o.d(t,{A:()=>re});o(92810);var l=o(33206),r=o(81e3),s=o(4800),a=o(43005),i=o(66726),n=o(64617),d=o(45934),c=o(81304),m=o(44335),u=o(9452),p=o(20350),h=o(3625),g=o(10900),b=o(82013),f=o(65953),v=o(80925),y=o(55348),x=o(27071),_=o(60015),A=o(73259),j=o(66282),k=o(4907),S=o(76207),w=o(26453),C=o(90854),E=(o(7205),o(59287)),T=o(83953),I=o(57903),N=o(62303),R=o(86286),B=o(36404),L=o(47358),P=o(64936),F=o(86739),M=o(4115),D=o(93563),z=o(62677),O=o(48426),q=o(46312),H=o(63531),$=o(31844),V=o(32269),W=o(58689),G=o(71157),U=o(14598),X=o(44824),Y=o(93982),K=o(90070),Z=o(47381),J=o(56991),Q=o(23287),ee=o(32411),te=o(85163),oe=o(13522),le=o(70082);const re=({email:e,autoSaveEmailResult:t,autoSaveBlockResult:o})=>{var re,se,ae,ie,ne,de,ce,me;const{__:ue,_x:pe}=(0,Q.s9)(),he=(0,d.wA)(),[ge]=(0,q.mI)(),[be]=(0,H.dS)();let fe=(0,n.Zp)();const{owner:ve,admin:ye}=(0,$.A)(),xe=(0,d.d4)(R.C1),_e=(0,d.d4)(B.yN),{modal:Ae}=l.A.useApp(),je=(0,G.hN)(),{confirm:ke}=Ae,Se=(0,d.Pj)(),we=(0,K.p6)(),Ce=(0,J.rD)(),{projectId:Ee}=(0,n.g)(),Te=(0,Y.ml)(oe.A.ON_EMAIL_CLONE_ID),[Ie]=(0,z.N)(),Ne=(0,Z.u)(),[Re,Be]=(0,F.Kh)(),[Le]=(0,M.ri)(),[Pe]=(0,M.cA)(),[Fe]=(0,O.m)(),{data:Me}=(0,n.KC)(),{data:De,refetch:ze}=(0,D.Jz)({parent:null===(re=Me.folder)||void 0===re?void 0:re[0]},{skip:!(null!==(se=Me.folder)&&void 0!==se&&se[0])}),Oe=()=>null===e.title?ue("New email title"):e.title,qe=(0,ee.fn)(),He=(e,t=(null===qe||void 0===qe?void 0:qe.getValue())||"")=>Le({file:t,title:Oe(),notification:je}).then((t=>{if(t.error)return je.error({message:(0,le.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.code}}),description:(0,le.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.message}}),placement:"bottomRight"}),Promise.reject();{let o=t.data;const l={id:o._id,...o};return e(l,(()=>Pe({id:l.id,notification:je})))}})),$e=(e=1)=>((e=1)=>He(((t,o)=>({href:(0,E.QG)(t.id,void 0,!1,e),dispose:o}))))(e).then((({href:e,dispose:t})=>(0,W.SR)(e).finally(t))),Ve=async e=>{const t=e.querySelectorAll("[em-operation=exportAsPicture]"),o=new Map;for(let r=0,s=t.length;r<s;r++){const e=t[r];e.setAttribute("em-export-id",r),o.set(`[em-export-id='${r}']`,e)}if(o.size)try{const{data:t,dispose:r}=await((e,t,o=2)=>He(((t,l)=>({data:e.map((e=>({selector:e,href:(0,E.QG)(t.id,void 0,!1,o,e)}))),dispose:l})),t))([...o.keys()],(0,C.b6)(e),2);try{const l=t.map((async({href:t,selector:l},r)=>{const s=o.get(l);if("TD"===s.tagName){s.removeAttribute("style");for(const e of[...s.classList])e.startsWith("em-mob-")&&s.classList.remove(e)}const a=await(async(e,t)=>{var o;const l="string"===typeof e?null===(o=await ge({url:e}))||void 0===o?void 0:o.data:e;if(t.split(".").length<2){const e=m.extension(l.type);e&&(t=`${t}.${e}`)}const r=new File([l],t.toLowerCase()),s=await be({user_id:xe.id,folder:Me.id,file:r});var a,i,n;return s.error||400===(null===(a=s.data.data)||void 0===a?void 0:a.status)?"string"===typeof e?e:"":null===(i=s.data)||void 0===i||null===(n=i[0])||void 0===n?void 0:n.file_url})(t,`${r}-${s.tagName.toLowerCase()}.png`),i=parseInt(getComputedStyle(s).width);let n=new Image(i);n.setAttribute("border","0"),n.setAttribute("style",`display: block; width: 100%; max-width: ${i}px;`),n.alt="",n.src=a;const d=s.querySelector("a");if(d){const t=e.createElement("a");t.setAttribute("target","_blank"),t.setAttribute("href",d.getAttribute("href")),t.appendChild(n),n=t}if("TD"===s.tagName){const e=s.cloneNode();e.removeAttribute("em-operation"),e.appendChild(n),n=e}s.replaceWith(n)}));await Promise.all(l)}catch(l){console.log(l)}finally{r()}}catch(l){console.log(l)}},We=t=>{var o,l;if("0"===(null===Me||void 0===Me||null===(o=Me.limits)||void 0===o?void 0:o.preview_limit)&&Ee&&(null===xe||void 0===xe||null===(l=xe.counters)||void 0===l?void 0:l.emails_counter)>2&&!t.querySelector(".em-powered-logo")){const o="https://emcdn.ru/emailmaker/powered.png",l="https%3A%2F%2Femailmaker.ru",r=`<a href="${`https://racs.rest/v3/link?app=emailmaker&project=${Ee}&email=${e.id}&link=${l}`}" target="_blank"><img src="https://racs.rest/v3/pixel/123.png?image=${o}&project=${Ee}&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">${r}</td>\n </tr>`)}return t},Ge=t=>{Ne({event:"click",action:"export_email",export_type:"HTML"});const o=document.querySelector(".email-preview"),l=getComputedStyle(o);(0,W.PJ)(null===qe||void 0===qe?void 0:qe.getValue(),[l.width],e.utm_parameters,(async e=>{await Ve(e),We(e),await(0,X.e)(e,t)})).then((e=>{const t=new Blob([e],{type:"text/html;charset=utf-8"});(0,S.saveAs)(t,`${Oe()}.html`)})).catch((e=>console.log(e)))},Ue=t=>{Ne({event:"click",action:"export_email",export_type:"Clipboard"});const o=document.querySelector(".email-preview"),l=getComputedStyle(o);(0,W.PJ)(null===qe||void 0===qe?void 0:qe.getValue(),[l.width],e.utm_parameters,(async e=>{await Ve(e),We(e),await(0,X.e)(e,t)})).then((e=>navigator.clipboard.writeText(e).then((function(){(0,V.wB)(ue("The email has been copied to the clipboard."),je)})))).catch((e=>console.log(e)))},Xe=e=>new Promise(((t,o)=>{fetch(e).then((e=>t(e.blob())),(()=>(e=>{const t=we.get(te.A9.em_token);return fetch(`https://app.emailmaker.ru/api/wp-json/cors-proxy/v1/get?url=${encodeURIComponent(e)}`,{headers:{authorization:`Bearer ${t}`}}).then((e=>e.blob()))})(e).then(t,o))).catch((()=>{}))})),Ye=t=>{Ne({event:"click",action:"export_email",export_type:"ZIP"});const o=document.querySelector(".email-preview"),l=getComputedStyle(o);(0,W.Mp)(null===qe||void 0===qe?void 0:qe.getValue(),[l.width],e.utm_parameters,Xe,(async e=>{await Ve(e),We(e),await(0,X.e)(e,t)})).then((e=>(0,S.saveAs)(e,`${Oe()}.zip`))).catch((e=>console.log(e)))},Ke=()=>{e.isNew?(te.EW.isPlugin||fe(`/projects/${Me.id}/emails`),(0,V.wB)(ue("The draft of the email has been deleted."),je)):Ze(e,fe)},Ze=(e,t)=>{ke({maskClosable:!0,centered:!0,title:pe("Are you sure to delete \u201c","email")+e.title+ue("\u201d email?"),icon:(0,le.jsx)(u.A,{style:{color:"#ff4d4f"}}),okText:ue("Yes"),cancelText:ue("No"),onOk:()=>((e,t)=>Se.dispatch(F.GY.endpoints.deleteEmail.initiate(e.id)).then((o=>{o.error&&(0,V.p6)(o,je),e.project&&!te.EW.isPlugin&&t(`/projects/${e.project}/emails`),(0,V.wB)(ue("The email \u201c")+o.data.title+pe("\u201d was successfully removed.","email"),je)})))(e,t)})},Je=()=>{(0,U.QM)("application/zip, message/rfc822, text/html",Qe)},Qe=async e=>{const t=e[0];try{he((0,L.M7)(!0));const e=await(0,U.q2)(t,(async(e,t)=>{try{const o=await(0,U.zn)(e,ge);if(!o)return console.warn(`No file data retrieved for url: ${e}`),"string"===typeof e?e:"";const l=(0,U.Qm)(t,o.type,m),r=new File([o],l.toLowerCase()),s=await be({user_id:xe.id,folder:Me.id,file:r});return(0,U.$K)(s,e)}catch(o){return console.error(`Error processing file upload for url: ${e}`,o),"string"===typeof e?e:""}}),(e=>{e.title=e.title||(0,W.Ay)(t.name)[0]}));qe.setValue(e),he((0,L.M7)(!1))}catch(o){he((0,L.M7)(!1));const e=o instanceof Error?o.message:o;je.error({message:(0,le.jsx)("div",{dangerouslySetInnerHTML:{__html:e}}),placement:"bottomRight"})}Ne({event:"upload_file",action:"import_email"})};let et=[];Ce.emailDropdownMenuClone&&et.push({label:ue("Clone"),icon:(0,le.jsx)(p.A,{style:{fontSize:"16px"}}),key:"Clone",className:"em-analytics__email-clone",disabled:Be.isLoading,onClick:async()=>{if(e.isNew)je.warning({message:ue("To create a copy, you need to save the email."),placement:"bottomRight"});else{var t,o,l,r,s;if((await Te.fire(e)).some((e=>!1===e)))return;Re({title:(0,V.fq)(e.title),project:null===Me||void 0===Me?void 0:Me.id,description:e.description,html:(0,V.el)((null===qe||void 0===qe?void 0:qe.getValue())||"",e.title),parent_email:e.parent_email||te.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===(l=e.utm_parameters)||void 0===l?void 0:l.utm_campaign,utm_term:null===(r=e.utm_parameters)||void 0===r?void 0:r.utm_term,utm_content:null===(s=e.utm_parameters)||void 0===s?void 0:s.utm_content},emailtags:e.emailtags,folder:e.folder}).then((t=>{t.error?je.error({message:(0,le.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.code}}),description:(0,le.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.message}}),placement:"bottomRight"}):(fe(`/projects/${Me.id}/emails/${t.data.id}`),je.success({message:ue("The copy of email \u201c")+e.title+ue("\u201d was successfully created."),placement:"bottomRight"}),De&&ze())}))}}}),Ce.emailDropdownMenuImport&&et.push({label:pe("Import","verb"),icon:(0,le.jsx)(h.A,{style:{fontSize:"16px"}}),key:"Import",className:"em-analytics__editor-page__import",onClick:()=>{Ne({event:"click",action:"import_email"}),Je()}}),(ve||ye||(null===(ae=xe.id)||void 0===ae?void 0:ae.toString())===(null===(ie=e.author)||void 0===ie?void 0:ie.toString()))&&(Ce.emailDropdownMenuLock&&et.push({label:(0,le.jsx)(I.A,{element:e},"Lock"),icon:e.lock?(0,le.jsx)(g.A,{style:{fontSize:"16px"}}):(0,le.jsx)(b.A,{style:{fontSize:"16px"}}),disabled:e.isNew}),Ce.emailDropdownMenuRemove&&et.push({label:ue("Remove"),icon:(0,le.jsx)(u.A,{style:{fontSize:"16px"}}),key:"Remove",className:"em-analytics__email-remove",style:{color:"#ff4d4f"},onClick:Ke}));const tt=e.isAmp;let ot=[];return Ce.exportHtmlEnabled&&ot.push({key:"html",label:ue("Code"),icon:(0,le.jsx)(f.A,{style:{fontSize:"16px"}}),...tt?{children:[{key:"\u0441ode_html",label:ue("AMP"),onClick:()=>Ge("amp")},{key:"html_amp",label:ue("HTML"),onClick:()=>Ge("html")}]}:{onClick:()=>Ge()}}),Ce.exportZipEnabled&&ot.push({key:"zip",label:ue("ZIP"),icon:(0,le.jsx)(v.A,{style:{fontSize:"16px"}}),...tt?{children:[{key:"zip_html",label:ue("AMP"),onClick:()=>Ye("amp")},{key:"zip_amp",label:ue("HTML"),onClick:()=>Ye("html")}]}:{onClick:()=>Ye()}}),Ce.exportClipboardEnabled&&ot.push({key:"clipboard",label:ue("Clipboard"),icon:(0,le.jsx)(y.A,{style:{fontSize:"16px"}}),...tt?{children:[{key:"clipboard_html",label:ue("AMP"),onClick:()=>Ue("amp")},{key:"clipboard_amp",label:ue("HTML"),onClick:()=>Ue("html")}]}:{onClick:()=>Ue()}}),!te.EW.isPlugin&&Ce.exportWebHookEnabled&&ot.push({key:"webhook",icon:(0,le.jsx)(N.A,{icon:"WebHook",style:{fontSize:"16px"}}),label:ue("WebHook"),onClick:()=>{_e.webhook?(Ne({event:"click",action:"export_email",export_type:"webhook"}),Ie({url:_e.webhook,body:(0,c.E)(e,Se)}).then((e=>{e.error?200===e.error.originalStatus?je.success({message:ue("Success!"),description:ue("WebHook successfully sent!"),placement:"bottomRight"}):je.error({message:(0,le.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.status}}),description:(0,le.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.error}}),placement:"bottomRight"}):je.success({message:ue("Success!"),description:ue("WebHook successfully sent!"),placement:"bottomRight"})}))):(he((0,P.YF)("webhooksettings")),he((0,P.qf)(te.lx.EDIT_PROJECT_MODAL)))}}),Ce.exportOutlookEnabled&&ot.push({key:"outlook",icon:(0,le.jsx)(x.A,{style:{fontSize:"16px"}}),label:ue("Outlook"),onClick:()=>(t=>{Ne({event:"click",action:"export_email",export_type:"Outlook"});const o=document.querySelector(".email-preview"),l=getComputedStyle(o),r=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 Ve(e),We(e)};(0,W.pH)(e.title,null===qe||void 0===qe?void 0:qe.getValue(),[l.width,l.height],e.utm_parameters,t?{"text/html;charset=utf-8":e=>r(e,"amp"),"text/x-amp-html;charset=utf-8":e=>r(e,"html")}:r).then((e=>{const t=new Blob([e],{type:"text/html;charset=utf-8"});(0,S.saveAs)(t,`${Oe()}.eml`)})).catch((e=>console.log(e)))})(tt)}),Ce.exportPdfEnabled&&ot.push({key:"pdf",icon:(0,le.jsx)(_.A,{style:{fontSize:"16px"}}),label:ue("PDF"),onClick:async()=>{const t=null===e||void 0===e?void 0:e.html;try{const e=await Fe({htmlContent:t,notification:je}).unwrap(),o=window.URL.createObjectURL(new Blob([e],{type:"application/pdf"})),l=document.createElement("a");l.href=o,l.setAttribute("download",`${Oe()}.pdf`),document.body.appendChild(l),l.click(),document.body.removeChild(l),window.URL.revokeObjectURL(o)}catch(o){console.error("\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 PDF:",o)}}}),Ce.exportPngEnabled&&ot.push({key:"img",icon:(0,le.jsx)(A.A,{style:{fontSize:"16px"}}),label:ue("PNG"),onClick:()=>$e(1).then(W.gZ).then((e=>(0,S.saveAs)(e,`${Oe()}.png`))).then(Ne({event:"click",action:"export_email",export_type:"Image"}))}),(0,le.jsxs)(r.A,{children:[Ce.emailDropdownMenuEnabled?(0,le.jsx)(s.A,{arrow:{pointAtCenter:!0},placement:"bottom",menu:{items:et},children:(0,le.jsx)(a.Ay,{type:"default",block:!1,className:"email-page-header__btn email-page-header__btn_extra",onClick:()=>{},children:(0,le.jsx)(j.A,{})})},"Actions"):Ce.emailDropdownMenuImport&&(0,le.jsx)(i.A,{title:pe("Import","verb"),placement:"bottom",children:(0,le.jsx)(a.Ay,{className:"em-analytics__editor-page__import",type:"text",icon:(0,le.jsx)(h.A,{style:{fontSize:20}}),onClick:()=>{Ne({event:"click",action:"import_email"}),Je()}})}),Ce.emailExportEnabled&&(0,le.jsx)(s.A,{arrow:{pointAtCenter:!0},placement:"bottom",menu:{items:ot},children:(0,le.jsx)(a.Ay,{className:"em-analytics__email-page__export",type:"default",icon:(0,le.jsx)(k.A,{}),children:ue("Export")},"Export")},"Export"),!e.hasOwnProperty("type")&&(0,le.jsx)(E.Ay,{autoSaveEmailResult:t,email:e,isEditableRights:ve||ye||(null===(ne=xe.id)||void 0===ne?void 0:ne.toString())===(null===(de=e.author)||void 0===de?void 0:de.toString())},"Save"),!!e.hasOwnProperty("type")&&(0,le.jsx)(T.A,{block:e,isEditableRights:ve||ye||(null===(ce=xe.id)||void 0===ce?void 0:ce.toString())===(null===(me=e.author)||void 0===me?void 0:me.toString()),autoSaveBlockResult:o},"Save")]})}},30961:(e,t,o)=>{o.d(t,{A:()=>T});var l=o(92810),r=o(95838),s=o(12280),a=o(2018),i=o(55039),n=o(81662),d=o(77406),c=o(81500),m=o(45934),u=o(64617),p=o(23287),h=o(84568),g=o(86739),b=o(55701),f=o(7760),v=o(65983),y=o(32269),x=o(85163),_=o(36404),A=o(70082);const{useToken:j}=r.A,{name:k,type:S,tags:w,group:C}={name:"name",type:"type",tags:"tags",group:"group"},E={[k]:"",[S]:[],[w]:[],[C]:[]},T=({isBlocks:e=!1,templateEmailId:t=!1})=>{const{__:o}=(0,p.s9)(),{projectId:r}=(0,u.g)(),[T]=s.A.useForm(),{data:I}=(0,b.h1)(),N=(0,m.wA)(),R=(0,m.d4)(f.b9),B=(0,m.d4)(v.CT),L=(0,m.d4)(_.GD),{token:P}=j(),F=(0,m.Pj)(),M=e?R:B,{isSuccess:D,data:z}=h.Nq.endpoints.getProject.select(+r)(F.getState(),{skip:t}),{isSuccess:O,data:q}=(0,g.sl)(+t,{skip:!t}),H=(0,l.useCallback)((()=>{N(e?(0,f.om)({}):(0,v.om)({}))}),[N,e]);(0,l.useEffect)((()=>{H()}),[H]),(0,l.useEffect)((()=>{}),[O,q,t]),(0,l.useEffect)((()=>{}),[D,z,e,t]);const[$,V]=(0,l.useState)([]);let W;(0,l.useEffect)((()=>{if(I){const e=I.schema.properties.acf.properties.type.items.enum;let t=[];for(let l in e)t.push({label:o(x.jg[e[l]]),value:e[l]});V(t)}}),[I,o]);const[G,U]=(0,l.useState)(!1);return(0,l.useEffect)((()=>{const o=t?O&&(0,y._q)(q,x.zh).filter((e=>{var t;return null===M||void 0===M||null===(t=M.tags)||void 0===t?void 0:t.includes(e.id)})).map((e=>e.name))||[]:D&&(0,y._q)(z,e?x.YY:x.zh).filter((e=>{var t;return null===M||void 0===M||null===(t=M.tags)||void 0===t?void 0:t.includes(e.id)})).map((e=>e.name))||[];T.setFieldsValue({tags:o})}),[D,M,e,T,z,O,q,t]),(0,l.useEffect)((()=>{T.setFieldsValue({group:L})}),[T,L]),(0,A.jsx)("div",{className:"cards-search",children:(0,A.jsx)(s.A,{form:T,name:"cards_search_form",initialValues:{...E},onValuesChange:o=>{const l=Object.keys(o)[0],r=T.getFieldsValue(!0);switch(l){case w:const s=t?(0,y._q)(q,x.zh).filter((e=>o[l].includes(e.name))).map((e=>e.id))||null:(0,y._q)(z,e?x.YY:x.zh).filter((e=>o[l].includes(e.name))).map((e=>e.id))||null;N(e?(0,f.om)({...M,tags:s}):(0,v.om)({...M,tags:s}));break;case S:N(e?(0,f.om)({...M,type:r.type||null}):(0,v.om)({...M,type:r.type||null}));break;case k:W&&window.clearTimeout(W),W=window.setTimeout((function(){N(e?(0,f.om)({...M,name:r.name}):(0,v.om)({...M,name:r.name}))}),100);break;case C:N(e?(0,f.om)({...M,group:r.group||null}):(0,v.om)({...M,group:r.group||null}))}},autoComplete:"off",children:(0,A.jsxs)(a.A,{wrap:!1,gutter:0,children:[(0,A.jsx)(s.A.Item,{className:"cards-search__by-title",name:k,children:(0,A.jsx)(i.A,{placeholder:o("Search by title"),allowClear:!0,bordered:!1,size:"large",prefix:(0,A.jsx)(d.A,{className:"cards-search__search-icon, input-icon",style:{cursor:"pointer",fontSize:20}})})}),e&&(0,A.jsx)(s.A.Item,{className:"cards-search__type-select",name:S,rules:[{message:o("Please choose the block type")}],children:(0,A.jsx)(n.A,{placeholder:o("Filter by type"),options:$,getPopupContainer:e=>e.parentNode,suffixIcon:(0,A.jsx)(c.A,{style:{fontSize:"16px",color:P.colorText},onClick:()=>U(!G),className:"input-icon"}),allowClear:!0,open:G,onDropdownVisibleChange:e=>{U(e)}})})]})})})}},92756:(e,t,o)=>{o.d(t,{COLLABORATION_EDITOR_WARNING_TEXT:()=>v,CollaboratorList:()=>S,DISCONNECT_WARNING_TEXT:()=>y,useCollaborateEditor:()=>A});var l=o(60382);const r=(e,t)=>(a(),i(e.user.color,t),e.cursor?[{range:new l.Range(e.cursor.lineNumber,e.cursor.column,e.cursor.lineNumber,e.cursor.column),options:{className:`applyColorToThis backgroundPrefix-${e.user.color.slice(1)}`,afterContentClassName:"cursor-hover",beforeContentClassName:"",style:`--cursor-color: ${e.user.color};`}}]:[]),s=e=>e.selection?[{range:new l.Range(e.selection.startLineNumber,e.selection.startColumn,e.selection.endLineNumber,e.selection.endColumn),options:{className:"user-selection-decoration"}}]:[],a=()=>{const e=document.styleSheets[0];Array.from(e.cssRules).some((e=>e.cssText.includes(".applyColorToThis")))||e.insertRule(".applyColorToThis {\n border-left: 2px solid var(--cursor-color, #000);\n color: var(--cursor-color, #000);\n }",e.cssRules.length)},i=(e,t)=>{const o=`backgroundPrefix-${e.slice(1)}`,l=document.styleSheets[0];Array.from(l.cssRules).some((e=>e.cssText.includes(`.${o}`)))||l.insertRule(`.${o} { --cursor-color: ${e===t.color?"#000000":e}; }`,l.cssRules.length)},n=(e,t,o)=>{if(!e.textContent){const l=document.createElement("div");l.style.background=t,l.style.color="#fff",l.textContent=o,l.className="cursor-hover",e.appendChild(l)}},d=(e,t,o,l,a,i)=>{if(l)return;a(!0);const d=e.flatMap((e=>[...r(e,i),...s(e)]));o.current=t.deltaDecorations(o.current,d.map((e=>({range:e.range,options:e.options}))));((e,t,o,l,r)=>{for(let u=0;u<e.length;u++){const p=e[u],h=p.className.split(" ");for(const e of h)if(e.startsWith(t)){const u=`#${e.replace(t,"")}`,h=l.find((e=>e.user.color===u));var s,a,i,d,c,m;h&&(o&&u!==(null===r||void 0===r?void 0:r.color)?n(p,u,null!==h&&void 0!==h&&null!==(s=h.user)&&void 0!==s&&null!==(a=s.name)&&void 0!==a&&a.first_name?`${null===h||void 0===h||null===(i=h.user)||void 0===i||null===(d=i.name)||void 0===d?void 0:d.first_name} ${null===h||void 0===h||null===(c=h.user)||void 0===c||null===(m=c.name)||void 0===m?void 0:m.last_name}`.replace(/[\n\r]/g,""):h.user.name.email.split("@")[0]):p.style.backgroundColor=u)}}})(document.getElementsByClassName("applyColorToThis"),"backgroundPrefix-",!0,e,i),a(!1)},c=()=>{const e=50,t=(e,t,o)=>{const l=e=>{const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)};return.2126*l(e)+.7152*l(t)+.0722*l(o)},o=(e,o,l)=>(t(255,255,255)+.05)/(t(e,o,l)+.05)>=4.5;let l;do{const t=Math.floor(206*Math.random()+e),a=Math.floor(206*Math.random()+e),i=Math.floor(206*Math.random()+e);t+a+i>=400&&(r=a,s=i,!(t>100&&r>50&&r<150&&s<100))&&o(t,a,i)&&(l=`#${(t<<16|a<<8|i).toString(16).padStart(6,"0")}`)}while(!l);var r,s;return l};var m=o(92810),u=o(45934),p=o(63040),h=o(88785),g=o(5277),b=o(86286),f=o(86739);const v="Not available for collaborative editing",y="Problem with internet connection";var x=o(85163),_=o(32411);const A=({email:e,editorRef:t,setIsSpin:o,newEmailAiGeneratorRef:l})=>{const r=(0,m.useMemo)((()=>new p.JA),[]),s=(0,_.fn)(),a=(0,m.useRef)([]),i=(0,m.useRef)([]),n=(0,m.useRef)(!1),v=(0,m.useRef)(0),y=(0,m.useRef)(""),[A,j]=(0,m.useState)(null),[k,S]=(0,m.useState)(null),[w,C]=(0,m.useState)(!1),[E,T]=(0,m.useState)([]),[I,N]=(0,m.useState)(!1),[R,B]=(0,m.useState)(!1),L=(0,_.aD)(s),P=(0,u.d4)(b.C1),{saveEmailFromEditor:F}=function(e,t){const[o]=(0,f.LX)();return{saveEmailFromEditor:(0,m.useCallback)((()=>{const l=(new Date).toISOString().slice(0,19).replace("T"," "),r={parent:null===e||void 0===e?void 0:e.id,title:e.title,author:e.author,project:e.project,html:(null===t||void 0===t?void 0:t.getValue())||"",excerpt:l,subject:e.subject,preheader:e.preheader,common_styles:e.common_styles,parent_email:e.parent_email};o({emailId:null===e||void 0===e?void 0:e.id,body:r}).catch((e=>{console.log(e)}))}),[t,e])}}(e,A),M=(0,m.useRef)(null),[D,z]=(0,m.useState)(!1),[O]=(0,f.dN)(),q=null===e||void 0===e?void 0:e.id,H=!("3769995"!==q&&!x.EW.isPlugin),$=(0,m.useMemo)((()=>({name:{first_name:H?null===P||void 0===P?void 0:P.username:null===P||void 0===P?void 0:P.first_name,last_name:H?"":null===P||void 0===P?void 0:P.last_name,email:null===P||void 0===P?void 0:P.email},color:c()})),[P,H]),V=(0,m.useMemo)((()=>((e,t)=>e.filter((e=>e.user.color!==t.color)))(E,$)),[$,E]),W=(0,m.useCallback)((()=>{k&&(null===k||void 0===k||k.destroy(),S(null))}),[k]),G=(0,m.useCallback)((()=>{try{F()}catch(e){console.error(e)}}),[F]),U=(0,m.useCallback)((async e=>{try{const t={emailId:q,source:"editor",html:e};return await O(t).unwrap(),!0}catch(t){return console.error("Failed to save email:",t),!1}}),[q,O]),X=(0,m.useCallback)((async e=>{if(await U(e)&&D){const e=setTimeout((()=>{z(!1)}),0);return()=>clearTimeout(e)}}),[U,z,D]);(0,m.useEffect)((()=>{q&&x._P.isEditor&&(1===E.length&&v.current>1&&k&&G(),v.current=E.length)}),[E.length,k,G]),(0,m.useEffect)((()=>{if(!q||!x._P.isEditor||D)return;const e=H?`${q}-plugin`:`${q}-collaborate`,t=new h.$R("wss://yjs.emailmaker.ru",e,r);return S(t),t.awareness.setLocalStateField("user",$),()=>{null===t||void 0===t||t.destroy(),null===r||void 0===r||r.destroy()}}),[r,$,H,q,D]);const Y=(0,m.useCallback)((e=>{if(!n.current){n.current=!0;try{const t=i.current,o=Array.from(e.getStates().values());(o.length>1||o.length!==t.length)&&(T(o),requestAnimationFrame((()=>{d(o,A,a,w,C,$)}))),i.current=o}finally{n.current=!1}}}),[A,a,w,C,$]);if((0,m.useEffect)((()=>{if(!k||!A||!x._P.isEditor||!t.current||!A.getModel()||D)return;let e=null;const l=k.awareness,s=r.getText("monaco"),a=async r=>{const a=Array.from(l.getStates().values());if(r){if(s._length>0&&a.length>1&&!M.current){var i,n;const e=e=>e.replace(/\s+/g," ").trim();e((null===A||void 0===A||null===(i=A.getModel())||void 0===i||null===(n=i.getValue())||void 0===n?void 0:n.toString())||"")!==e(s.toString())&&(await async function(e,t){await new Promise((o=>{const l=()=>{var r,s,a;null===t||void 0===t||t(!0);((null===(r=e.current)||void 0===r||null===(s=r.getModel())||void 0===s||null===(a=s.getValue())||void 0===a?void 0:a.length)||0)>0?o():setTimeout(l,100)};l()}))}(t,o),null===o||void 0===o||o(!1),A.executeEdits("collaboration",[{range:A.getModel().getFullModelRange(),text:s.toString(),forceMoveMarkers:!0}]))}var d,c;if(s._length>0&&1===a.length&&!M.current)s.applyDelta([{delete:s._length},{insert:null===(d=t.current)||void 0===d?void 0:d.getModel().getValue()}]);if(0===s._length)s.insert(0,null===(c=t.current)||void 0===c?void 0:c.getModel().getValue());M.current&&s.applyDelta([{delete:s._length},{insert:M.current}]),e=new g.h(s,null===A||void 0===A?void 0:A.getModel(),new Set([A]),l),null===A||void 0===A||A.onDidChangeCursorPosition((e=>((e,t)=>{t.setLocalStateField("cursor",e.position)})(e,l))),null===A||void 0===A||A.onDidChangeCursorSelection((e=>((e,t)=>{const o=e.selection;t.setLocalStateField("selection",{startLineNumber:o.startLineNumber,startColumn:o.startColumn,endLineNumber:o.endLineNumber,endColumn:o.endColumn})})(e,l))),l.on("change",(()=>Y(l))),M.current=null}};return k.on("sync",a),()=>{e&&e.destroy(),k.off("sync",a)}}),[A,k,r,t,Y,o,D]),(0,m.useEffect)((()=>{if(!k||!A||!x._P.isEditor||!t.current||D)return;const e=null===k||void 0===k?void 0:k.awareness,o=setInterval((()=>{Y(e)}),500);return()=>clearInterval(o)}),[k,A,w,t,I,Y,W,D]),(0,m.useEffect)((()=>{if(!q||!x._P.isEditor)return;if(I)return;const e=(({CHECK_INTERVAL:e,SLEEP_THRESHOLD:t,provider:o,handleOfflineCollaboration:l,isNewEmailGeneration:r,saveEmailFromEditor:s})=>{let a=Date.now();return setInterval((()=>{const e=Date.now(),l=e-a;l>t&&o&&(s(),window.location.reload(),window.location.reload()),l<t&&!o&&document.visibilityState,a=e}),e)})({CHECK_INTERVAL:5e3,SLEEP_THRESHOLD:2e4,provider:k,handleOfflineCollaboration:W,isNewEmailGeneration:D,saveEmailFromEditor:F});return()=>{clearInterval(e)}}),[q,k,I,W,N,D]),A&&V.length>0){var K,Z;const e=(null===A||void 0===A||null===(K=A.getModel())||void 0===K||null===(Z=K.getValue())||void 0===Z?void 0:Z.toString())||"";y.current!==e&&"clear"in L&&L.clear(),y.current=e}const J=(()=>{const[e,t]=(0,m.useState)(!1);return(0,m.useEffect)((()=>{const e=navigator.platform.toUpperCase().includes("MAC"),o=o=>{const l=(e?o.metaKey:o.ctrlKey)&&"KeyZ"===o.code,r=l&&o.shiftKey;(l||r)&&(t(!0),o.preventDefault())},l=()=>{t(!1)},r=e=>{var o;"application_action"===(null===(o=e.data)||void 0===o?void 0:o.operation)&&("undo"!==e.data.action&&"redo"!==e.data.action||(t(!0),setTimeout((()=>t(!1)),500)))};return document.addEventListener("keydown",o,!0),document.addEventListener("keyup",l,!0),window.addEventListener("message",r),()=>{document.removeEventListener("keydown",o,!0),document.removeEventListener("keyup",l,!0),window.removeEventListener("message",r)}}),[]),e})()&&V.length>0;return(0,m.useEffect)((()=>{if(!q||!x._P.isEditor)return;const e=setInterval((()=>{if(null!==l&&void 0!==l&&l.current&&!D&&(W(),z(!0)),(null===l||void 0===l||!l.current)&&D){const e=null===s||void 0===s?void 0:s.getValue();M.current=e,X(e)}}),300);return()=>clearInterval(e)}),[D,k,q,x._P.isEditor]),(0,m.useEffect)((()=>{if(!q||!x._P.isEditor)return;const e=()=>{"hidden"===document.visibilityState&&F()};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}}),[e,q,x._P.isEditor]),[A,V,j,I,J]};var j=o(66726),k=o(70082);const S=({users:e,isEditor:t,isPlugin:o,token:l})=>{const[r,s]=(0,m.useState)(!1),a=window.localStorage.getItem(x.V0.em_color_scheme),i=e=>{const{first_name:t,last_name:o,email:l}=e.user.name;if(t){return`${t.split("")[0]}${o?`${o.split("")[0]}`:""}`}return(null===l||void 0===l?void 0:l.split("")[0].toUpperCase())||" "},n=e=>{const t=(e=>{const{first_name:t,last_name:o,email:l}=e.user.name;return t&&o?`${t} ${o}`:t||l})(e);return(0,k.jsx)("span",{children:t})};return(0,k.jsx)(k.Fragment,{children:e.length>0&&t&&(0,k.jsx)("div",{className:"user-list "+(r?"open":""),style:o?{left:"60px",bottom:"10px"}:{},onMouseOver:()=>s(!0),onMouseOut:()=>s(!1),children:e.map((e=>(0,k.jsx)("div",{className:"user",style:{"--user-color":e.user.color,"--border-color":null===l||void 0===l?void 0:l.colorBgContainer,"--text-color":"dark"===a?null===l||void 0===l?void 0:l.colorIconHover:null===l||void 0===l?void 0:l.colorWhite},children:(0,k.jsx)(j.A,{title:n(e),placement:"topLeft",trigger:"hover",color:null===l||void 0===l?void 0:l.colorBgSpotlight,children:(0,k.jsx)("div",{children:i(e)})})},e.user.color)))})})}},26238:(e,t,o)=>{o.d(t,{A:()=>f});var l=o(92810),r=o(2018),s=o(7744),a=o(43005),i=o(71086),n=o(64588),d=o(55039),c=o(38883),m=o.n(c),u=o(45934),p=o(23287),h=o(62303),g=o(65983),b=(o(23081),o(70082));const f=({id:e,onChange:t,value:o,alignRight:c,placeholder:f,isDisabled:v=!1,usedColors:y=[],codeMode:x=!1})=>{const{__:_}=(0,p.s9)(),A=(0,u.d4)(g.iy),[j,k]=(0,l.useState)(!0),S=(0,l.useRef)(null),w=(0,l.useRef)(null),C=(0,l.useRef)(t);(0,l.useEffect)((()=>{"undefined"===typeof EyeDropper&&k(!1)}),[o]);const E=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,b.jsx)("div",{className:"color-picker-input",children:(0,b.jsxs)("div",{className:m()("color-picker-input__control-wrap",{"color-picker-input__empty":!o}),children:[(0,b.jsx)(n.A,{disabledAlpha:!0,format:"hex",defaultFormat:"hex",getPopupContainer:e=>e.closest(x?".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,b.jsxs)(r.A,{justify:"space-between",wrap:!1,children:[(0,b.jsxs)(s.A,{flex:"auto",children:[(0,b.jsx)(t,{}),j&&(0,b.jsx)(a.Ay,{onClick:E,size:"small",style:{position:"absolute",top:215,left:179,height:28,width:28,padding:0,zIndex:2,minWidth:"auto",fontSize:18},children:(0,b.jsx)(h.A,{icon:"Colorize",style:{position:"relative",top:-2}})})]}),(0,b.jsx)(i.A,{type:"vertical",style:{height:"auto"}}),(0,b.jsx)(s.A,{span:8,children:(0,b.jsx)(o,{})})]}),presets:[{label:_("Used"),colors:y},{label:_("Recommended"),colors:["#000000","#595959","#BFBFBF","#E5E5E5","#F5F5F5","#F5222D","#FA8C16","#FADB14","#8BBB11","#52C41A","#13A8A8","#1677FF","#2F54EB"]}]}),""===o&&(0,b.jsx)("div",{className:"color-picker-input__empty-bg"}),(0,b.jsx)(d.A,{allowClear:!0,id:e,disabled:A||v,className:"color-picker-input__control",placeholder:f||_("Select color"),value:o,ref:w,onChange:t})]})})}},26254:(e,t,o)=>{o.d(t,{A:()=>kt});var l=o(92810),r=o(95838),s=o(20648),a=o(33206),i=o(45934),n=o(49497),d=o(64617),c=o(19817),m=o(59297),u=o(12280),p=o(71086),h=o(55039),g=o(43005),b=o(81e3),f=o(96492),v=o(86889),y=o(71157),x=o(82013),_=o(9588),A=o(94822),j=o(38883),k=o.n(j),S=o(23287),w=o(29993);o(86524);const C={view:"button",parentId:"buttonContainerId",buttonSize:"s",buttonView:"main",buttonTheme:"dark",buttonBorderRadius:"15",buttonIcon:"ya"};var E=o(70082);const T=({yandexHandler:e})=>((0,l.useEffect)((()=>{window.YaAuthSuggest.init({client_id:"6456dd7eb0db47bcbcb2329c614723b5",response_type:"token",redirect_uri:`https://${document.location.host}/yandex-login`},`https://${document.location.host}`,C).then((({handler:e})=>e())).then((t=>e(t))).catch((e=>{}))}),[]),(0,E.jsx)("div",{style:{cursor:"pointer"},id:"buttonContainerId"}));var I=o(83351),N=o(15865),R=o(39990),B=o(1779),L=o(141),P=o(85163),F=o(47381),M=o(90070);const D="sign_in_form",z="sign_up_form",O=({className:e})=>{const{__:t}=(0,S.s9)(),o=(0,d.Zp)(),r=(0,i.wA)(),{search:s}=(0,d.zy)(),[a]=(0,R.Lj)(),[n]=(0,I.uX)(),[c,m]=(0,l.useState)(D),j=(0,y.hN)(),C=(0,M.p6)(),[O]=(0,B.p)(),[q]=(0,L.x)(),H=(0,F.u)(),$={name:"password",rules:[{required:!0,message:t("Please enter your password")}],placeholderForCreate:t("Create a password"),placeholderForSignIn:t("Enter your password"),prefix:(0,E.jsx)(x.A,{style:{fontSize:16,color:"#1890FF"}})},V={name:"email",rules:[{required:!0,message:t("Please enter your email address"),type:"email"}],placeholder:t("Enter your email"),prefix:(0,E.jsx)(_.A,{style:{fontSize:16,color:"#1890FF"}})},W=[{name:D,tabTitle:t("Sign In"),fields:[V,$],initialValues:{remember:!1,email:"",password:"",rememberMe:{valuePropName:"checked"}}},{name:z,tabTitle:t("Sign Up"),fields:[V],initialValues:{remember:!1,email:"",password:"",privacyPolicy:!1,newsletterConsent:!1}}];(0,l.useEffect)((()=>{null!==s&&void 0!==s&&s.startsWith("?signup")&&m(z)}),[s]);const[G,U]=(0,l.useState)(""),X={[D]:{onFinish:(e,t=!1)=>{U(P.F5),r(R.Q2.util.resetApiState());(t?O({code:e.access_token}):n({username:e.email,password:e.password})).then((t=>{var o;if(t.error)throw j.error({message:(0,E.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.code}}),description:(0,E.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.message}}),placement:"bottomRight"}),U(P.ff),w.wd("Something went wrong in auth 1",{extra:t.error.data}),new Error(P.ff);if(401===(null===(o=t.data.data)||void 0===o?void 0:o.status))throw j.error({message:(0,E.jsx)("div",{dangerouslySetInnerHTML:{__html:t.data.code}}),description:(0,E.jsx)("div",{dangerouslySetInnerHTML:{__html:t.data.message}}),placement:"bottomRight"}),U(P.ff),w.wd("Something went wrong in auth 1 because of no email in yan or gmail",{extra:t.data}),new Error(P.ff);C.set(P.A9.em_token,t.data.token,{expires:e.rememberMe?30:1});let l=t;return r(R.Q2.endpoints.getMe.initiate()).then((e=>({result:e,tokenData:l})))})).then((e=>{var l,s,a,i,n,d;let{result:c,tokenData:m}=e;var u;if(c.error)throw j.error({message:(0,E.jsx)("div",{dangerouslySetInnerHTML:{__html:c.error.data.code}}),description:(0,E.jsx)("div",{dangerouslySetInnerHTML:{__html:c.error.data.message}}),placement:"bottomRight"}),U(P.ff),w.wd("Something went wrong in auth 2",{extra:null===(u=c.error)||void 0===u?void 0:u.data}),new Error(P.ff);const p=C.get(P.A9.promocode);p&&(C.remove(P.A9.promocode),r(N.So.endpoints.checkPromo.initiate({code:p,type:"by_link"})));const h=c.data.last_used_project?`/projects/${c.data.last_used_project}/emails`:"/projects",g=t&&null!==(l=m.data)&&void 0!==l&&l.is_reg?"/projects?status=newbie":h;o(g,{replace:!0}),H({type:t?"Yandex":"Default",event:"submit_form",action:t&&null!==(s=m.data)&&void 0!==s&&s.is_reg?"registration":"authorization",user_email:null===c||void 0===c||null===(a=c.data)||void 0===a?void 0:a.email,carrotquest_hash:null===c||void 0===c||null===(i=c.data)||void 0===i?void 0:i.carrotquest_hash,user_id:null===c||void 0===c||null===(n=c.data)||void 0===n?void 0:n.id,email_subscription_consent:null===c||void 0===c||null===(d=c.data)||void 0===d?void 0:d.email_subscription_consent})})).catch((e=>{var t;U(P.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})}},[z]:{onFinish:e=>{U(P.F5),r(R.Q2.util.resetApiState()),a({email:e.email,username:e.email,reg_type:"simple"}).then((e=>{if(e.error)throw j.error({message:(0,E.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.code}}),description:(0,E.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.message}}),placement:"bottomRight"}),U(P.ff),w.wd("onFinishFailed SIGN_UP",{extra:e.error}),new Error(P.ff);return 200===e.data.code&&j.success({message:(0,E.jsx)("div",{dangerouslySetInnerHTML:{__html:e.data.message}}),description:(0,E.jsx)("div",{dangerouslySetInnerHTML:{__html:e.data.is_simple_reg_message}}),placement:"bottomRight"}),e})).then((t=>{var o;if(t.error)throw j.error({message:(0,E.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.code}}),description:(0,E.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.message}}),placement:"bottomRight"}),U(P.ff),w.wd("Something went wrong in auth 4",{extra:null===(o=t.error)||void 0===o?void 0:o.data}),new Error(P.ff);return C.set(P.A9.em_token,t.data.token,{expires:1}),r(R.Q2.endpoints.editMe.initiate({privacy_policy_agreement:e.privacyPolicy,newsletter_consent:e.newsletterConsent}))})).then((e=>{var t,l,r,s,a;if(e.error)throw j.error({message:(0,E.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.code}}),description:(0,E.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.message}}),placement:"bottomRight"}),w.wd("Something went wrong in auth 5",{extra:null===(a=e.error)||void 0===a?void 0:a.data}),new Error(P.ff);o("/projects?status=newbie",{replace:!0}),H({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===(l=e.data)||void 0===l?void 0:l.carrotquest_hash,user_id:null===e||void 0===e||null===(r=e.data)||void 0===r?void 0:r.id,email_subscription_consent:null===e||void 0===e||null===(s=e.data)||void 0===s?void 0:s.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(P.ff)}))},onFinishFailed:e=>{w.wd("onFinishFailed SIGN_UP",{extra:e})}}};let Y=[];return W.map((e=>Y.push({label:e.tabTitle,key:e.name,className:"dfsdfsdf",children:(0,E.jsxs)(u.A,{name:e.name,initialValues:e.initialValues,onFinish:X[e.name].onFinish,onFinishFailed:X[e.name].onFinishFailed,autoComplete:"off",children:[(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(u.A.Item,{children:(0,E.jsx)(E.Fragment,{})}),(0,E.jsx)(p.A,{plain:!0,children:t("or")})]}),e.fields.map((o=>(0,E.jsx)(u.A.Item,{style:{marginBottom:10},name:o.name,extra:e.name===z&&"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===z?[{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,E.jsx)(h.A.Password,{style:{border:"none",borderRadius:5,height:39,marginBottom:10},variant:"borderless",size:"large",disabled:G===P.F5,type:o.name,placeholder:e.name===D?o.placeholderForSignIn:o.placeholderForCreate,prefix:o.prefix,autoComplete:e.name===D?"":"new-password"}):(0,E.jsx)(h.A,{style:{border:"none",borderRadius:5,height:39},variant:"borderless",size:"large",disabled:G===P.F5,placeholder:o.placeholder,prefix:o.prefix,autoComplete:"off"})},o.name))),(0,E.jsx)(u.A.Item,{children:(0,E.jsx)(g.Ay,{style:{height:44,borderRadius:5,marginTop:10,marginBottom:16,fontSize:18},size:"large",loading:G===P.F5,block:!0,type:"primary",htmlType:"submit",className:e.name===D?"em-analytics__sign-in":"em-analytics__sign-up",children:e.tabTitle})}),e.name===D&&(0,E.jsx)(u.A.Item,{children:(0,E.jsxs)(b.A,{style:{display:"flex"},className:"auth-form__space",children:[(0,E.jsx)(u.A.Item,{name:"rememberMe",valuePropName:"checked",noStyle:!0,children:(0,E.jsx)(f.A,{disabled:G===P.F5,children:t("Remember me")})}),(0,E.jsx)(A.N_,{to:"/recover-password",children:t("Forgot your password?")})]})}),e.name===z&&(0,E.jsxs)(E.Fragment,{children:[(0,E.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,E.jsxs)(f.A,{disabled:G===P.F5,children:[t("I agree to the")," ",(0,E.jsx)("a",{href:"https://emailmaker.ru/terms/",target:"_blank",rel:"noopener noreferrer",children:t("Terms")})," ",t("and"),"\xa0",(0,E.jsx)("a",{href:"https://emailmaker.ru/privacy-policy/",target:"_blank",rel:"noopener noreferrer",children:t("Privacy Policy.")})]})}),(0,E.jsx)(u.A.Item,{name:"newsletterConsent",valuePropName:"checked",className:"auth-form__checkbox",children:(0,E.jsx)(f.A,{disabled:G===P.F5,className:"em-analytics__receive-updates-emailmaker",children:t("I would like to receive updates from EmailMaker.")})})]})]})}))),(0,E.jsxs)("div",{className:k()("auth-form",{[e]:e}),children:[(0,E.jsx)("div",{className:"yandex-button",children:(0,E.jsx)(T,{yandexHandler:e=>{X[D].onFinish(e,!0)}})}),(0,E.jsx)(v.A,{activeKey:c,className:"auth-form__tabs",defaultActiveKey:c,onChange:e=>m(e),items:Y})]})},q=()=>(0,E.jsx)(m.A,{className:"auth-page",children:(0,E.jsx)(O,{className:"auth-page__form"})}),H=()=>((0,l.useEffect)((()=>{window.YaSendSuggestToken(`https://${document.location.host}/auth`,{flag:!0})}),[]),(0,E.jsx)(E.Fragment,{}));var $=o(79381),V=o(36852),W=o(24420),G=o(44338),U=o(32983),X=o(21999),Y=o(4519),K=o(41919),Z=o(76662),J=o(66726),Q=o(37005),ee=o(58013),te=o(29718),oe=o(30961),le=o(20757),re=o(50197),se=o(93563),ae=o(36404),ie=o(65983),ne=o(32269);const{Content:de}=K.A,{Paragraph:ce}=Z.A,me=()=>{var e,t,o;const{__:r,_x:s}=(0,S.s9)(),{projectId:a,emailId:n}=(0,d.g)(),c=(0,M.p6)();let m=(0,d.Zp)();const u=(0,i.wA)(),h=(0,i.d4)(ie.UI),f=(0,i.d4)(ae.yN),v={all:s("All","group"),standard:s("Standard","group"),project:s("Project","group")},{data:y}=(0,se.Oo)({}),{data:x,refetch:_,isUninitialized:A}=(0,se.Oo)({parent:null===(e=f.group)||void 0===e?void 0:e[0]},{skip:!(null!==(t=f.group)&&void 0!==t&&t[0])});(0,l.useEffect)((()=>{!A&&_()}),[A,_]);const j=c.get(P.A9.em_template_email)||n;(0,l.useEffect)((()=>{document.body.classList.remove("editor")}),[]);const k=(0,E.jsx)(E.Fragment,{children:(0,E.jsxs)(b.A,{size:10,children:[(0,E.jsx)(J.A,{title:r("To emails"),placement:"left",children:(0,E.jsx)(g.Ay,{type:"text",icon:(0,E.jsx)(ee.A,{}),onClick:()=>(0,ne.XZ)(m,`/projects/${a}`),shape:"circle"})}),(0,E.jsx)(ce,{className:"ant-page-header-heading-title",children:r("Create email")}),(0,E.jsx)(oe.A,{isBlocks:!1,templateEmailId:j})]})}),w=(0,E.jsx)(E.Fragment,{}),[C,T]=(0,l.useState)(P.ti.ALL);(0,l.useEffect)((()=>{C===P.ti.STANDARD?(u((0,ae.BN)([])),u((0,ie.ry)({projectGroup:[]}))):C===P.ti.PROJECT&&(u((0,ae.es)([])),u((0,ie.ry)({group:[]})))}),[u,C]);const I=[{label:v.all,value:P.ti.ALL},{label:v.standard,value:P.ti.STANDARD},{label:v.project,value:P.ti.PROJECT}];return(0,E.jsxs)(K.A,{className:"template-page",children:[(0,E.jsx)(le.A,{leftBlock:k,rightBlock:w}),(0,E.jsx)(de,{className:"template-page__container",children:(0,E.jsxs)("div",{className:"template-page__content container",children:[(0,E.jsx)("div",{className:"template-page__menu-wrapper",children:(0,E.jsxs)("div",{style:{position:"sticky",top:0},children:[C!==P.ti.PROJECT&&(0,E.jsx)(re.A,{className:"template-page__menu",groups:y,isProjectGroups:!1}),!(null===x||void 0===x||null===(o=x.filter((e=>(null===e||void 0===e?void 0:e.children.reduce(((e,t)=>e+t.count_template),0))>0)))||void 0===o||!o.length)&&(0,E.jsxs)(E.Fragment,{children:[C===P.ti.ALL&&(0,E.jsx)(p.A,{}),C!==P.ti.STANDARD&&(0,E.jsx)(re.A,{className:"template-page__menu",groups:x,isProjectGroups:!0})]}),!!h.length&&(0,E.jsx)(Q.A,{className:"template-page__segment",onChange:T,options:I})]})}),(0,E.jsx)(te.A,{projectId:a,emailsView:P.Y$,createPage:!0,groupType:C})]})})]})};var ue=o(19263),pe=o(24239),he=o(85879),ge=o(25072),be=o(72981),fe=o(77242),ve=o(4800),ye=o(9452),xe=o(20350),_e=o(10900),Ae=o(85677),je=o(66282),ke=o(83953),Se=o(57903),we=o(2491),Ce=o(55701),Ee=o(7760),Te=o(47358),Ie=o(87790),Ne=o(86286),Re=o(32411),Be=o(31844),Le=o(22197);const{Paragraph:Pe}=Z.A,{useToken:Fe}=r.A,Me=({block:e,autoSaveBlockResult:t})=>{var o,l,r,s,n,c;const{__:m,_x:u}=(0,S.s9)();let p=(0,i.wA)(),h=(0,d.Zp)();const f=(0,i.d4)(Ne.C1),{modal:v}=a.A.useApp(),_=(0,y.hN)(),{confirm:A}=v,{token:j}=Fe(),w=(0,i.d4)(Te.yy),C=e.hasOwnProperty("type")?P.IE:P.Tm,T=(0,i.d4)(ie.qX),I=(0,i.d4)(Ee.qX),N=C===P.Tm?T:I,R=(0,i.d4)(Te.Fv),{data:B}=(0,d.KC)(),{owner:L,admin:F}=(0,Be.A)(),M=(0,i.Pj)(),D=(e,t)=>{A({maskClosable:!0,centered:!0,title:u("Are you sure you want to delete the \u201c","block")+e.title+m("\u201d block?"),icon:(0,E.jsx)(ye.A,{}),okText:m("Yes"),cancelText:m("No"),onOk:()=>((e,t)=>M.dispatch(Ce.VM.endpoints.deleteBlock.initiate(e.id)).then((o=>{o.error&&_.fromError("BLOCK_REMOVING_ERROR",(0,y.x_)(e),o.error),t(`/projects/${e.project}/blocks`),_.success({id:"BLOCK_REMOVING_SUCCESS",message:m("The block \u201c")+o.data.title+u("\u201d was successfully removed.","block"),data:(0,y.x_)(e)})})))(e,t)})},[z,O]=(0,Ce.pP)(),q=(0,Re.fn)();let H=[];H.push({label:m("Clone"),icon:(0,E.jsx)(xe.A,{style:{fontSize:"16px"}}),key:"Clone",className:"em-analytics__block-clone",disabled:O.isLoading,onClick:()=>{e.isNew?_.warning({id:"COPY_NOT_SAVED",payload:e,message:m("To create a copy, you need to save the block."),placement:"bottomRight"}):z({title:(0,ne.fq)(e.title),blocktags:e.blocktags,project:B.id,subject:e.subject,description:e.description,html:(null===q||void 0===q?void 0:q.getValue())||"",type:e.type?e.type:"Other"}).then((t=>{t.error?_.error({id:"BLOCK_CLONING_ERROR",data:(0,y.x_)(e),innerException:t.error,message:(0,E.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.code}}),description:(0,E.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.message}}),placement:"bottomRight"}):(h(`/projects/${B.id}/blocks/${t.data.id}`),_.success({id:"BLOCK_CLONING_SUCCESS",data:(0,y.x_)(e),message:m("The copy of block \u201c")+e.title+u("\u201d was successfully created.","block"),placement:"bottomRight"}))}))}}),(L||F||(null===(o=f.id)||void 0===o?void 0:o.toString())===(null===(l=e.author)||void 0===l?void 0:l.toString()))&&H.push({label:(0,E.jsx)(Se.A,{element:e},"Lock"),icon:e.lock?(0,E.jsx)(_e.A,{style:{fontSize:"16px"}}):(0,E.jsx)(x.A,{style:{fontSize:"16px"}}),disabled:e.isNew},{label:m("Remove"),icon:(0,E.jsx)(ye.A,{style:{fontSize:"16px"}}),key:"Remove",className:"em-analytics__block-remove",onClick:()=>{e.isNew?(h(`/projects/${B.id}/blocks`),_.success({id:"BLOCK_REMOVING_SUCCESS",message:m("The draft of the block has been deleted."),data:(0,y.x_)(e)})):D(e,h)},style:{color:"#ff4d4f"}}),(0,Le.A)(null===e.title?m("New block title"):e.title);const $=(0,E.jsx)(E.Fragment,{children:(0,E.jsxs)(b.A,{size:10,children:[(0,E.jsx)(J.A,{title:m("To emails"),placement:"left",children:(0,E.jsx)(g.Ay,{type:"text",icon:(0,E.jsx)(ee.A,{}),onClick:()=>{h(`/projects/${B.id}/blocks`)},shape:"circle"})}),(0,E.jsx)(Pe,{className:"ant-page-header-heading-title",editable:{triggerType:["text","icon"],icon:(0,E.jsx)(Ae.A,{className:"email-page-header__icon-edit"}),onChange:t=>{e.isNew?p((0,Ie.qT)(t)):p(Ce.VM.util.updateQueryData("getBlock",e.id,(e=>{Object.assign(e,{title:t})})))}},children:null===e.title?m("New block title"):e.title})]})}),V=(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(we.A,{emailElement:e}),e.lock?(0,E.jsx)(x.A,{className:k()("lock-icon",{"lock-icon__disabled":!(L||F||(null===(r=f.id)||void 0===r?void 0:r.toString())===(null===(s=e.author)||void 0===s?void 0:s.toString()))}),style:{color:j.colorPrimary,fontSize:"16px"}},"Lock"):null,(0,E.jsx)(ve.A,{arrow:"true",menu:{items:H},children:(0,E.jsx)(g.Ay,{className:"block-page-header__btn block-page-header__btn_extra",onClick:()=>{},children:(0,E.jsx)(je.A,{})})},"Actions"),(0,E.jsx)(ke.A,{className:"em-analytics__block-save",block:e,isEditableRights:L||F||(null===(n=f.id)||void 0===n?void 0:n.toString())===(null===(c=e.author)||void 0===c?void 0:c.toString()),autoSaveBlockResult:t},"Save")]});return(0,E.jsx)(le.A,{leftBlock:$,rightBlock:V,className:"header_blocks",isHeaderCodeMenuOpen:((null===N||void 0===N?void 0:N.type)===P.bV.TEXT||(null===N||void 0===N?void 0:N.type)===P.bV.LINK||N.type===P.bV.BUTTON)&&R&&"bottom"!==w})};var De=o(53204),ze=o(39738),Oe=o(64037),qe=o(45695),He=o(9653);const{Content:$e}=K.A,Ve=()=>{const{__:e}=(0,S.s9)(),t=(0,qe.XW)(),{blockId:o,projectId:r}=(0,d.g)(),s=(0,i.wA)();let a=(0,d.Zp)();const n=(0,Re.fn)(),c=(0,M.p6)(),m=(0,i.d4)(Ee.gm),u=(0,i.d4)(Ie.ah),p=(0,i.d4)(Ne.C1),h=(0,i.d4)(De.M),b=(0,i.d4)(Te.Wm),f=(0,i.d4)(ze.p1),[v]=(0,Ce.yW)(),y=c.get(P.A9.em_new_block),{isSuccess:x,data:_}=(0,Ce.bg)(+y,{skip:!y}),[A,j]=(0,l.useState)(!1);(0,l.useEffect)((()=>{y&&x&&(s((0,Ie.Bp)(_)),j(!0))}),[y,x,s,_]);const{isLoading:k,isSuccess:w,isError:C,error:T}=(0,Ce.bg)(o,{skip:!o}),I=y?x:w,N=w&&null!==m&&void 0!==m&&m.id?m:x&&u,R=(0,l.useRef)(0),{isSuccess:B,isLoading:L}=(0,Ce.J4)({blockId:+o},{skip:!o}),[F,D]=(0,l.useState)(null);(0,l.useEffect)((()=>{if(B&&!L&&null!==f&&void 0!==f&&f.length){var e;const l=f[0];if((null===F||void 0===F?void 0:F.toString())!==(null===(e=N.id)||void 0===e?void 0:e.toString())){var t;if(null!==(t=l.slug)&&void 0!==t&&t.includes("autosave")&&n){var o;const e=null===(o=l.html)||void 0===o?void 0:o.replaceAll("\r\n","\n");s((0,Ee.DL)(e))}D(N.id)}}}),[s,f,B,L,N,F,n,o]),(0,He.U)(N);const z=(0,l.useCallback)((()=>{const e=()=>{v({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===n||void 0===n?void 0:n.getValue(),excerpt:null===m||void 0===m?void 0:m.date_gmt}}).then((e=>{})).catch((e=>{console.log(e)}))};if(f&&f.length>0){const t=[...f].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&&b&&!h&&e()}else b&&!h&&e()}),[f,v,m,h,b,n]);(0,l.useEffect)((()=>{m&&null!==p&&void 0!==p&&p.autosaves&&!h&&(clearTimeout(R.current),R.current=setTimeout(z,1e4))}),[m,z,p,h]);const O=(0,Re.aD)(n),q=(0,l.useCallback)((()=>{O.undo()}),[O]),H=(0,l.useCallback)((()=>{O.redo()}),[O]),$=(0,l.useRef)();(0,l.useEffect)((()=>{$.current!==(null===N||void 0===N?void 0:N.id)&&(O.clear(),$.current=null===N||void 0===N?void 0:N.id)}),[N,O]);const V=(0,l.useCallback)((e=>{(window.navigator.appVersion.indexOf("Mac")&&e.metaKey||e.ctrlKey)&&"KeyZ"===e.code&&(e.preventDefault(),e.shiftKey?H():q())}),[q,H]);(0,l.useEffect)((()=>(document.body.classList.add("editor"),()=>{s((0,De.rI)()),s((0,ze.qX)()),s((0,Te.PM)(P.Bv))})),[s]);(0,Oe.A)((e=>{const t=e.data.operation,o=e.data.action,l=document.getElementById("iframe-scroll-top"),r=document.getElementById("iframe-scroll-bottom");if(t===P.Ru.APPLICATION_ACTION&&("undo"===o?q():"redo"===o&&H()),t===P.Ru.APPLICATION_SCROLL_BLOCK_SHOW){const e=document.getElementById("iframe-scroll-top"),t=document.getElementById("iframe-scroll-bottom"),o=document.getElementById("email_iframe"),l=document.body.getBoundingClientRect().height,r=o.getClientRects()[0];r.top<0&&(e.style.display="block"),r.top+r.height>l&&(t.style.display="block")}t===P.Ru.APPLICATION_SCROLL_BLOCK_HIDE&&(l.style.display="none",r.style.display="none")}));const W=e=>{e.preventDefault(),e.target&&t({operation:P.Ru.SANDBOX_DRAG_CANCEL})},G=()=>{},U=e=>{e.preventDefault();const t=document.getElementById("iframe-scroll-top"),o=document.getElementById("iframe-scroll-bottom"),l=document.getElementById("pane-content-iframe"),r=document.getElementById("email_iframe"),{height:s,top:a}=r.getBoundingClientRect(),i=document.body.getBoundingClientRect().height;a>1?"block"===t.style.display&&(t.style.display="none"):"none"===t.style.display&&(t.style.display="block"),s-i+a<1?"block"===o.style.display&&(o.style.display="none"):"none"===o.style.display&&(o.style.display="block"),e.target===t&&l.scrollBy(0,-20),e.target===o&&l.scrollBy(0,20)},X=()=>{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,l.useEffect)((()=>(window.addEventListener("dragstart",G),window.addEventListener("drop",W),window.addEventListener("dragend",X),window.addEventListener("dragover",U),window.addEventListener("keydown",V),window.addEventListener("dragenter dragleave",(e=>{e.preventDefault()})),()=>{window.removeEventListener("dragstart",G),window.removeEventListener("drop",W),window.removeEventListener("dragover",U),window.removeEventListener("dragend",X),window.removeEventListener("keydown",V),window.removeEventListener("dragenter dragleave",(e=>{e.preventDefault()}))}))),(0,E.jsxs)(K.A,{className:"block-page",children:[N&&(0,E.jsx)(Me,{block:N}),k&&(0,E.jsx)(be.A,{}),C&&T&&(0,E.jsx)(K.A,{children:(0,E.jsx)($e,{style:{paddingTop:"40px"},children:(0,E.jsx)("div",{className:"container",children:(0,E.jsx)(ge.Ay,{status:T.status,title:T.status,subTitle:T.data.message,extra:(0,E.jsx)(g.Ay,{type:"primary",onClick:()=>{a(`/projects/${r}/blocks`)},children:e("Back To Project")})})})})}),(!o&&(!y||A&&u)||w&&m)&&(0,E.jsx)(fe.A,{emailElement:N,isSuccess:I})]})};var We=o(6099),Ge=o(24495),Ue=o(17445),Xe=o(24293),Ye=o(49246),Ke=o(20984),Ze=o(69417),Je=o(8701),Qe=o(13338),et=o(79716),tt=o(41564),ot=o(90775),lt=o(64936),rt=o(76793),st=o(843),at=o(35317);const{Paragraph:it}=Z.A,{Content:nt}=K.A,dt="Early",ct="Monthly",mt=(e,t)=>t?e>100?"#FF4D4F":e<100?"#52c41a":100===e?"rgba(0, 0, 0, 0.25)":void 0:"transparent",ut=()=>{const{__:e,_n:t}=(0,S.s9)();let o=(0,d.Zp)();const r=(0,i.wA)(),s=(0,i.d4)(Ne.C1),a=(0,i.d4)(lt.cL),[n,c]=(0,rt.Cl)(),[m,p]=(0,st.IJ)(),[f,v]=(0,at.O)(),{isSuccess:x,isLoading:_,data:A}=(0,R.W5)(),[j]=(0,R.on)(),w=(0,y.hN)(),[C,T]=(0,l.useState)(!1),[I]=u.A.useForm(),B=(0,M.p6)(),[L,F]=(0,l.useState)({discount:null,promocode:null,expiration:null}),{counters:{emails_counter:D,projects_counter:z,users_counter:O,preview_counter:q,payments_counter:H,optimization_counter:$},subscription:V,subscription_end:W,recurring_payments:G,subscription_id:U,promocode:X,subscription_amount:Y,enterprise_users_limit:Z,enterprise_price:Q,enterprise_12_price:te,email:oe,name:re}=s,[se,ae]=(0,l.useState)(dt);(0,l.useEffect)((()=>{var e,t;(null===V||void 0===V||null===(e=V.post_title)||void 0===e?void 0:e.split(" ").length)>1?ae(dt):1===(null===V||void 0===V||null===(t=V.post_title)||void 0===t?void 0:t.split(" ").length)&&ae(ct)}),[null===V||void 0===V?void 0:V.post_title]);const[ie,de]=(0,l.useState)([]);(0,l.useEffect)((()=>{de([3891,se===ct?13719:13720,se===ct?3892:5295,se===ct?3893:5294,se===ct?3894:5296])}),[se]);const[ce,me]=(0,l.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,l.useEffect)((()=>{x&&A&&me(A.find((e=>{var t,o;return(null===(t=e.id)||void 0===t?void 0:t.toString())===(null===V||void 0===V||null===(o=V.ID)||void 0===o?void 0:o.toString())})))}),[A,x,V]),(0,l.useEffect)((()=>{{const e=document.createElement("script");e.src="https://widget.cloudpayments.ru/bundles/cloudpayments.js",e.async=!0,document.body.appendChild(e)}}),[]);const[he,ge]=(0,l.useState)(""),be=(e,t,o,l)=>{ge(e);const a=B.get(P.A9.em_token);if("Personal"!==t&&"Advanced"!==t&&"Pro"!==t&&!l||"Community"!==pe&&"Free"!==pe)document.body.classList.remove("editor"),r((0,lt.qf)(P.lx.SWITCH_TO_PLAN_MODAL));else{{const l=new cp.CloudPayments,r={},i=new Date;i.setMonth(i.getMonth()+(se===dt?12:1)),i.setDate(i.getDate()-1);const n=`\u041e\u043f\u043b\u0430\u0442\u0430 ${se===dt?"\u0433\u043e\u0434\u043e\u0432\u043e\u0439":"\u043c\u0435\u0441\u044f\u0447\u043d\u043e\u0439"} \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438 ${t}${se===dt?` (${Ae(o)}\u20bd\xa0x\xa012)`:""}${L.promocode?" \u043f\u043e\xa0\u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434\u0443 "+L.promocode:" "}`,d=se===dt?12*o:+o,c={Items:[{label:n,price:d,quantity:1,amount:Ae(d),vat:0}],calculationPlace:"https://emailmaker.ru",taxationSystem:1,email:s.email,amounts:{electronic:Ae(d)}},m={Items:[{label:n,price:d,quantity:1,amount:d,vat:0}],calculationPlace:"https://emailmaker.ru",taxationSystem:1,email:s.email,amounts:{electronic:d}},u={interval:"Month",period:se===dt?12:1,customerReceipt:m,PersonalDate:i};r.CloudPayments={CustomerReceipt:c,recurrent:u,subscription:e,token:a,promocode:L.promocode?L.promocode:""},r.CloudPayments.CustomerReceipt.Items[0].amount=d,l.pay("charge",{publicId:"pk_e8c7c303759283dc35cf4ad7b396c",description:n,amount:Ae(d),currency:"RUB",accountId:s.email,email:s.email,data:r,promocode:L.promocode||null},{onSuccess:function(e){},onFail:function(e,t){},onComplete:function(e,t){e.success&&setTimeout((()=>j()),3e3)}})}0}},[fe,ve]=(0,l.useState)(!1);(0,l.useEffect)((()=>{ve(G)}),[G]);(0,l.useEffect)((()=>{const e=setInterval((()=>{j()}),1e4);return()=>clearInterval(e)}),[j]);const ye=(0,E.jsxs)(b.A,{size:10,children:[(0,E.jsx)(g.Ay,{type:"text",icon:(0,E.jsx)(ee.A,{}),onClick:()=>(0,ne.XZ)(o,"/projects"),shape:"circle"}),(0,E.jsx)(it,{className:"ant-page-header-heading-title",children:e("Billing")})]}),xe=(0,E.jsx)(E.Fragment,{}),_e=(0,l.useCallback)((e=>{T(!0),r(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?r(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,ne.p6)(e,w),null!==e&&void 0!==e&&e.data){let t={...e.data};const r=new Date(e.data.expiration),s=new Date;var o,l;if(t.promocode=e.data.promocode.toUpperCase(),r>s)F(t),(null===e||void 0===e||null===(o=e.data)||void 0===o?void 0:o.message)&&(0,ne.wB)(null===e||void 0===e||null===(l=e.data)||void 0===l?void 0:l.message,w)}else L.promocode||F({...L,promocode:""})})).catch((e=>{(0,ne.p6)(e,w),console.warn("error",e)})).finally((()=>{T(!1)}))}),[r,L,w]),Ae=e=>{return L.discount&&e?(t=e-e*L.discount/100,"emailmaker"===P.oy?Math.round(t):10*Math.floor(t/10)):e;var t};(0,l.useEffect)((()=>{!+H&&X&&"Free"===pe&&null===L.promocode&&_e(X)}),[_e,H,X,pe,L.promocode]);const je=(0,E.jsx)(et.A,{style:{fontSize:48},spin:!0});return(0,E.jsxs)(K.A,{className:"billing-page",children:[(0,E.jsx)(le.A,{leftBlock:ye,rightBlock:xe}),(v.isLoading||v.isSuccess)&&(0,E.jsx)("div",{style:{position:"fixed",height:"100%",width:"100%",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--colorBgLayout)",zIndex:10,opacity:.5},children:(0,E.jsx)(Xe.A,{size:"large",indicator:je})}),(0,E.jsx)(nt,{className:"billing-page__container",children:(0,E.jsxs)("div",{className:"billing-page__content container",children:[_&&(0,E.jsx)(Ye.A,{active:!0}),ue&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(Ke.Ay.Group,{defaultValue:dt,value:se,style:{marginBottom:32,marginRight:25},onChange:e=>{ae(e.target.value)},children:[(0,E.jsx)(Ke.Ay.Button,{value:dt,children:e("Bill yearly (-15%)")}),(0,E.jsx)(Ke.Ay.Button,{value:ct,children:e("Bill monthly")})]}),"Free"===pe&&!+H&&(0,E.jsxs)(u.A,{form:I,layout:"inline",name:"promo_code_form",autoComplete:"off",initialValues:{promocode:""},onFinish:({promocode:e})=>{I.resetFields(),e&&_e(e)},className:"billing-page__form",children:[(0,E.jsx)(u.A.Item,{name:"promocode",className:"billing-page__form-input",children:(0,E.jsx)(h.A,{placeholder:e("Use promocode")})}),(0,E.jsx)(u.A.Item,{className:"billing-page__form-submit",children:(0,E.jsx)(g.Ay,{type:"primary",htmlType:"submit",children:C?(0,E.jsx)(et.A,{}):(0,E.jsx)(tt.A,{})})})]}),(0,E.jsx)("div",{className:"billing-page__cards-list",children:ie.map((o=>{const{title:l,limits:{emails_limit:r,projects_limit:s,users_limit:a},price:i}=null===A||void 0===A?void 0:A.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())})),n=r&&D>r||s&&z>s||a&&O>a,d=l.split(" ")[0];let c=null,m=null;return Z&&Q&&"Enterprise"===l&&(c=!0),Z&&te&&"Enterprise 12"===l&&(m=!0),(0,E.jsxs)(Ze.A,{hoverable:!0,style:{width:240},"data-name":l,children:[(0,E.jsx)("p",{className:"billing-page__card-title",children:d}),(("Enterprise"!==d||c||m)&&"Free"!==d&&L.discount&&!+H||l===ce.title&&!!+Y&&+Y<+i)&&(0,E.jsx)("span",{className:"billing-page__card-price_old",children:(0,E.jsxs)("s",{children:["\xa0","Enterprise"!==d?i:c?Q:m,"emailmaker"===P.oy?"$":"\u20bd","\xa0"]})}),(0,E.jsxs)("p",{className:"billing-page__card-price",children:["Enterprise"!==d||c||m?"emailmaker"===P.oy&&"$":"",l===ce.title&&"Free"!==ce.title&&+Y?Y:"Enterprise"!==d?Ae(i):c?Ae(Q):m?Ae(te):e("By request"),("Community"===d||"Free"===d)&&"0","Enterprise"!==d||c||m?"emailmaker"!==P.oy&&"\u20bd":"",(0,E.jsx)("span",{className:"billing-page__card-price_sub",children:("Personal"===d||"Advanced"===d||"Pro"===d)&&e("/ month")})]}),(0,E.jsxs)("ul",{className:"billing-page__card-list",children:[(0,E.jsxs)("li",{children:["\u2022 ",r||"\u221e"," ",t(" email"," emails",r)]}),(0,E.jsxs)("li",{children:["\u2022 ",s||"\u221e"," ",t(" project"," projects",s)]}),(0,E.jsxs)("li",{children:["\u2022"," ","Enterprise"===d&&(c||m)&&Z||a||"\u221e"," ",t(" member"," members",a)]})]}),(0,E.jsx)(J.A,{className:"billing-page__tooltip",placement:"topLeft",title:"Community"!==pe&&"Free"!==pe||!n?"":e("Switching is not possible due to exceeding the limit"),children:(0,E.jsx)(g.Ay,{className:k()("billing-page__card-button",{"billing-page__card-button_current":l===ce.title}),type:l===ce.title?"default":"primary",size:"large",onClick:()=>be(l,d,i||c&&Q||m&&te,c||m),disabled:("Community"===pe||"Free"===pe)&&n,title:"Community"!==pe&&"Free"!==pe||!n?"":e("Switching is not possible due to exceeding the limit"),children:l===ce.title?e("Current plan"):e("Enterprise"!==d||c||m?"Switch to this plan":"Contact us")})})]},l)}))}),L.promocode&&L.discount&&!+H&&"Free"===pe&&(0,E.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,E.jsxs)("div",{className:"billing-page__promo-data",children:[e("Discount with promo code: ")," ",L.promocode]}),L.description&&(0,E.jsx)("div",{style:{marginBottom:"-45px"},dangerouslySetInnerHTML:{__html:L.description}})]}),"Community"!==pe&&"Free"!==pe&&W&&(0,E.jsxs)("div",{className:"billing-page__paid-block",children:[(0,E.jsxs)("div",{className:"billing-page__paid-data",children:[e("Paid until: "),W]}),U&&(0,E.jsxs)("div",{className:"billing-page__recurring-switch-wrapper",children:[(0,E.jsx)(Je.A,{className:"billing-page__recurring-switch",checked:fe,onChange:(e,t)=>{t.preventDefault(),e?(()=>{const e={sid:U,uid:s.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)?(ve(!0),j().then((t=>{var o;t.data&&(0,ne.wB)(null===e||void 0===e||null===(o=e.data)||void 0===o?void 0:o.message,w)}))):(ve(!1),(0,ne.p6)(e,w))}))})():(()=>{const e={sid:U,uid:s.id};n(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)?(ve(!1),j().then((t=>{var o;t.data&&(0,ne.wB)(null===e||void 0===e||null===(o=e.data)||void 0===o?void 0:o.message,w)}))):(ve(!0),(0,ne.p6)(e,w))}))})()},disabled:c.isLoading||c.isFetching||p.isLoading||p.isFetching}),(0,E.jsx)("span",{className:"billing-page__recurring-switch-text",children:e("Recurring payments")})]})]}),(0,E.jsx)("p",{className:"billing-page__title",children:e("Usage")}),(0,E.jsxs)("div",{className:"billing-page__progress-block",children:[(0,E.jsx)(Qe.A,{percent:D/ue.emails_limit*100,format:()=>(0,E.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:mt(D/ue.emails_limit*100,ue.emails_limit)}),(0,E.jsx)(Qe.A,{percent:z/ue.projects_limit*100,format:()=>(0,E.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:mt(z/ue.projects_limit*100,ue.projects_limit)}),(0,E.jsx)(Qe.A,{percent:O/("Enterprise"===pe&&Z||ue.users_limit)*100,format:()=>(0,E.jsx)("span",{className:"billing-page__progress-block-counts",children:`${O} ${e("of")} ${"Enterprise"===pe&&Z||ue.users_limit||"\u221e"} ${t(" member"," members",ue.users_limit)}`}),size:"medium",strokeColor:mt(O/(ue.users_limit||"Enterprise"===pe&&Z)*100,ue.users_limit||"Enterprise"===pe&&Z)}),(0,E.jsx)(Qe.A,{percent:q/ue.preview_limit*100,format:()=>(0,E.jsx)("span",{className:"billing-page__progress-block-counts",children:`${q} ${e("of")} ${ue.preview_limit} ${t(" preview"," previews",ue.preview_limit)}`}),size:"medium",strokeColor:mt(q/ue.preview_limit*100,ue.preview_limit)}),(0,E.jsx)(Qe.A,{percent:$/ue.optimization_limit*100,format:()=>(0,E.jsx)("span",{className:"billing-page__progress-block-counts",children:`${$} ${e("of")} ${ue.optimization_limit>0?ue.optimization_limit:"\u221e"} ${t(" optimisation"," optimisations",ue.optimization_limit)}`}),size:"medium",strokeColor:mt($/ue.optimization_limit*100,ue.optimization_limit)})]})]})]})}),(0,E.jsx)(ot.A,{isModalVisible:a===P.lx.SWITCH_TO_PLAN_MODAL,userEmail:oe,subscriptionRequest:he,userName:re,currentPlane:null===ce||void 0===ce?void 0:ce.title})]})};var pt=o(84568),ht=o(18398),gt=o(56991),bt=o(47271);d.BV.propTypes={};const ft=()=>{const e=(0,i.wA)(),t=(0,M.p6)(),o=(0,i.d4)(Ne.C1);(0,l.useEffect)((()=>{const t=null===o||void 0===o?void 0:o.code_editor;t&&e((0,Ne.ww)(t))}),[o,e]),(0,l.useEffect)((()=>{const o=t.get(P.A9.em_token),l=t.get(P.A9.promocode);o&&l&&(e(N.So.endpoints.checkPromo.initiate({code:l,type:"by_link"})),t.remove(P.A9.promocode))}),[e,t]),(0,l.useEffect)((()=>{if(!P.EW.isPlugin){const o=t.get(P.A9.em_token);if(o){const l=(new Date).getTime()/1e3,r=(0,bt.iU)(o),s=r.exp,a=r.iat;s&&s-l<86400?(t.remove(P.A9.em_token),e(R.Q2.util.resetApiState())):l-a>216e4&&t.set(P.A9.em_token,o,{expires:30})}}}),[e,t]);const[r,s]=(0,l.useState)(null),a=(0,i.d4)(ht.s0),n=a.project?(0,gt.Mu)(a):void 0;return(0,l.useEffect)((()=>{if(!P.EW.isPlugin){const l=t.get(P.A9.em_token);null!==o&&void 0!==o&&o.last_used_project?s(null===o||void 0===o?void 0:o.last_used_project):o&&l&&e(pt.Nq.endpoints.getProjects.initiate()).then((e=>{var t;s((null===(t=e.data)||void 0===t?void 0:t[0].id)||!1)})).catch((()=>s(!1)))}}),[o,e,t]),(0,y.O5)(),P.EW.isPlugin&&void 0===n?(0,E.jsx)(E.Fragment,{}):(0,E.jsxs)(d.BV,{children:[(0,E.jsx)(d.qh,{path:"/auth",element:(0,E.jsx)(c.A,{children:(0,E.jsx)(q,{})})}),(0,E.jsx)(d.qh,{path:"/yandex-login",element:(0,E.jsx)(H,{})}),(0,E.jsx)(d.qh,{path:"/recover-password",element:(0,E.jsx)(V.A,{})}),(0,E.jsx)(d.qh,{path:"/email/:emailId/raw",element:(0,E.jsx)(Ue.A,{})}),(0,E.jsxs)(d.qh,{path:"/",element:(0,E.jsx)(c.A,{children:(0,E.jsx)($.A,{})}),children:[(0,E.jsx)(d.qh,{path:"/billing",element:(0,E.jsx)(ut,{})}),(0,E.jsx)(d.qh,{index:!0,element:(0,E.jsx)(U.A,{to:n||"projects"})}),(0,E.jsxs)(d.qh,{path:"emails",children:[(0,E.jsx)(d.qh,{index:!0,element:(0,E.jsx)(X.A,{lastProjectId:r})}),(0,E.jsx)(d.qh,{path:"new",element:(0,E.jsx)(X.A,{lastProjectId:r})})]}),(0,E.jsxs)(d.qh,{path:"projects",children:[(0,E.jsx)(d.qh,{index:!0,element:(0,E.jsx)(W.A,{})}),(0,E.jsxs)(d.qh,{path:":projectId",element:(0,E.jsx)(We.A,{}),children:[(0,E.jsxs)(d.qh,{path:"emails",children:[(0,E.jsx)(d.qh,{index:!0,element:(0,E.jsx)(G.A,{})}),(0,E.jsx)(d.qh,{path:":emailId",element:(0,E.jsx)(he.A,{}),children:(0,E.jsx)(d.qh,{path:":preview",element:(0,E.jsx)(he.A,{})})}),(0,E.jsx)(d.qh,{path:"new",element:(0,E.jsx)(he.A,{})}),(0,E.jsxs)(d.qh,{path:"new_from",children:[(0,E.jsx)(d.qh,{index:!0,element:(0,E.jsx)(W.A,{})}),(0,E.jsx)(d.qh,{path:":emailId",element:(0,E.jsx)(Y.A,{})})]}),(0,E.jsx)(d.qh,{path:"create",children:(0,E.jsx)(d.qh,{index:!0,element:(0,E.jsx)(me,{})})})]}),(0,E.jsxs)(d.qh,{path:"blocks",children:[(0,E.jsx)(d.qh,{index:!0,element:(0,E.jsx)(ue.A,{})}),(0,E.jsx)(d.qh,{path:":blockId",element:(0,E.jsx)(Ve,{})}),(0,E.jsx)(d.qh,{path:"new",element:(0,E.jsx)(Ve,{})})]}),(0,E.jsx)(d.qh,{path:"members",element:(0,E.jsx)(Ge.A,{})})]})]}),(0,E.jsx)(d.qh,{path:"*",element:(0,E.jsx)(pe.A,{})})]})]})};var vt=o(69156),yt=o(4701),xt=o(17126);const _t=(0,o(84869).A)(),At={hashed:!1,algorithm:r.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}}},jt={hashed:!1,algorithm:r.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 kt=function(){const e=(0,i.d4)(ie.Up),t=(0,i.d4)(Ne.C1),o=window.localStorage.getItem(P.V0.em_color_scheme),r=matchMedia(P.F3).matches?P.nd:P.T,[d,c]=(0,l.useState)(o||r),m=(0,gt.rD)(),u=(0,i.wA)(),p=(0,vt.c8)();(0,l.useEffect)((()=>{const e=P.EW.isPlugin?null===t||void 0===t?void 0:t.theme:o||r;c(e),(0,vt.A5)(e),u((0,ie.eX)(e===P.nd?`vs-${e}`:P.T)),p()}),[o,e,r,null===t||void 0===t?void 0:t.theme,m.pathEnabled,u,p]);const h=(0,l.useCallback)((e=>{e&&e!==P.IJ?((0,vt.Hk)(e),localStorage.setItem(P.V0.em_color_scheme,e)):localStorage.removeItem(P.V0.em_color_scheme)}),[]);(0,l.useEffect)((()=>{const e=null===t||void 0===t?void 0:t.theme,o=localStorage.getItem(P.V0.em_color_scheme);e&&e!==o&&h(e)}),[t,h]);const g=(0,l.useCallback)((()=>{const e=localStorage.getItem(P.V0.em_color_scheme);h(e)}),[h]);(0,l.useEffect)((()=>{g()}),[g]);const b=(0,i.d4)(ht.RP),[f,v]=(0,l.useState)("light"===d?At:jt),[y]=(0,l.useState)(1);(0,l.useEffect)((()=>{const e="light"===d?At:jt,t=b[d],o=t?(0,yt.TJ)(e,t):e;v({...o,token:{...o.token,appZoom:y}})}),[v,d,b,y]);const x=(0,xt.LG)(),_=(0,l.useCallback)((()=>x),[x]);return(0,E.jsx)(s.Ay,{theme:f,getPopupContainer:_,children:(0,E.jsx)(n.N7,{transformers:[_t],children:(0,E.jsx)(a.A,{children:(0,E.jsx)(ft,{})})})})}},45927:(e,t,o)=>{o.d(t,{A:()=>H});var l=o(92810),r=o(38883),s=o.n(r),a=o(95838),i=o(12280),n=o(29234),d=o(2018),c=o(7744),m=o(66726),u=o(43005),p=o(71086),h=o(81e3),g=o(7166),b=o(28348),f=o(62767),v=o(6391),y=o(69372),x=o(14461),_=o(23287),A=o(45934),j=o(88296),k=o(26238),S=o(68031),w=o(21519),C=o(71495),E=o(44997),T=o(62303),I=o(65983),N=o(47358),R=o(45695),B=o(56991),L=o(85163),P=o(47520),F=o(70082);const{useToken:M}=a.A,D=e=>{var t,o,l,r,s,a,i,n,d,c,m;return{textFontFamily:e.text.fontFamily,textFontSize:e.text.fontSize,textFontSizeDim:e.text.fontSizeDim,textLineHeight:e.text.lineHeight,textLineHeightDim:e.text.lineHeightDim,textColor:e.text.color,textContrastColor:e.text.contrastColor||"#FFFFFF",textAlign:e.text.textAlign,textPaddingBottom:e.text.paddingBottom,textPaddingBottomDim:e.text.paddingBottomDim,headingFontFamily:e.headings.fontFamily,headingFontSize:e.headings.fontSize,headingFontSizeDim:e.headings.fontSizeDim,headingLineHeight:e.headings.lineHeight,headingLineHeightDim:e.headings.lineHeightDim,headingColor:e.headings.color,headingContrastColor:e.headings.contrastColor||"#FFFFFF",headingAlign:e.headings.textAlign,headingPaddingTop:e.headings.paddingTop,headingPaddingTopDim:e.headings.paddingTopDim,headingPaddingBottom:e.headings.paddingBottom,headingPaddingBottomDim:e.headings.paddingBottomDim,headingLetterSpacing:e.headings.letterSpacing,headingLetterSpacingDim:e.headings.letterSpacingDim,headingBold:e.headings.bold,headingItalic:e.headings.italic,linkColor:e.links.color,linkContrastColor:e.links.contrastColor||"#FFFFFF",linkUnderline:e.links.underline,buttonsFontFamily:e.buttons.fontFamily,buttonsFontSize:e.buttons.fontSize,buttonsFontSizeDim:e.buttons.fontSizeDim,buttonsLetterSpacing:e.buttons.letterSpacing,buttonsLetterSpacingDim:e.buttons.letterSpacingDim,buttonsColor:e.buttons.color,buttonsContrastColor:e.buttons.contrastColor||"#1C52DC",buttonsBold:e.buttons.bold,buttonsItalic:e.buttons.italic,buttonsBackgroundColor:e.buttons.backgroundColor,buttonsContrastBackgroundColor:e.buttons.contrastBackgroundColor||"#FFFFFF",buttonsMarginTop:e.buttons.marginTop,buttonsMarginTopDim:e.buttons.marginTopDim,buttonsMarginBottom:e.buttons.marginBottom,buttonsMarginBottomDim:e.buttons.marginBottomDim,buttonsBorder:e.buttons.border,buttonsAlign:e.buttons.textAlign,buttonsBorderRadius:e.buttons.borderRadius,buttonsPadding:e.buttons.padding,cardsContrastBackgroundColor:(null===(t=e.cards)||void 0===t?void 0:t.contrastBackgroundColor)||"#1C52DC",cardsBaseBackgroundColor:(null===(o=e.cards)||void 0===o?void 0:o.baseBackgroundColor)||"#F8F8F8",cardsContrastTextColor:(null===(l=e.cards)||void 0===l?void 0:l.contrastTextColor)||"#FFFFFF",cardsBaseTextColor:(null===(r=e.cards)||void 0===r?void 0:r.baseTextColor)||"#5A5A5A",cardsBorder:(null===(s=e.cards)||void 0===s?void 0:s.border)||{all:null,top:null,right:null,bottom:null,left:null},cardsBorderRadius:(null===(a=e.cards)||void 0===a?void 0:a.borderRadius)||{all:10,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},blockBackgroundColor:e.block.backgroundColor||"",blockContrastBackgroundColor:e.block.contrastBackgroundColor||"#1C52DC",blockPaddingAll:null===(i=e.block.padding)||void 0===i?void 0:i.all,blockPaddingTop:null===(n=e.block.padding)||void 0===n?void 0:n.top,blockPaddingRight:null===(d=e.block.padding)||void 0===d?void 0:d.right,blockPaddingBottom:null===(c=e.block.padding)||void 0===c?void 0:c.bottom,blockPaddingLeft:null===(m=e.block.padding)||void 0===m?void 0:m.left}},z={buttons_borderRadiusAll:"all",buttons_borderRadiusTopLeft:"topLeft",buttons_borderRadiusBottomLeft:"bottomLeft",buttons_borderRadiusTopRight:"topRight",buttons_borderRadiusBottomRight:"bottomRight"},O={cards_borderRadiusAll:"all",cards_borderRadiusTopLeft:"topLeft",cards_borderRadiusBottomLeft:"bottomLeft",cards_borderRadiusTopRight:"topRight",cards_borderRadiusBottomRight:"bottomRight"},q=({className:e,email:t})=>{const{__:o}=(0,_.s9)(),r=(0,A.wA)(),a=(0,R.XW)(),[q]=i.A.useForm(),H=(0,A.d4)(I.uJ),$=(0,A.d4)(I.dH),V=(0,B.rD)(),{token:W}=M(),[G,U]=(0,l.useState)({}),[X,Y]=(0,l.useState)({}),[K,Z]=(0,l.useState)(!0),[J,Q]=(0,l.useState)(!0),[ee,te]=(0,l.useState)(!1),[oe,le]=(0,l.useState)(!1),re={buttonsPaddingTop:"top",buttonsPaddingLeft:"left",buttonsPaddingRight:"right",buttonsPaddingBottom:"bottom"},se=t.common_styles&&"{}"!==t.common_styles?JSON.parse(t.common_styles):L.BD,[ae,ie]=(0,l.useState)(null),ne=!!t.common_styles&&"{}"!==t.common_styles,de=(0,A.d4)(N.Wm);(0,l.useEffect)((()=>{de||ie(null)}),[se,ie,de]),(0,l.useEffect)((()=>{de&&!ae&&ie(D(se))}),[se,ae,de]),(0,l.useEffect)((()=>{$&&(r((0,I.RC)(!1)),q.setFieldsValue(D(se)))}),[q,$,r,se]);const[ce,me]=(0,l.useState)(Math.min(se.headings.fontSize-1,19)),[ue,pe]=(0,l.useState)(Math.max(se.text.fontSize+1,20));(0,l.useEffect)((()=>{if(ae){var e,t,o,l,r,s,a,i,n,d,c,m,u;const p=ae.buttonsBorder;U(p);const h=Object.keys(p).find((e=>{var t,o,l;return(null===(t=p[e])||void 0===t?void 0:t.width)||(null===(o=p[e])||void 0===o?void 0:o.style)||(null===(l=p[e])||void 0===l?void 0:l.color)})),g=ae.cardsBorder;Y(g);const b=Object.keys(g).find((e=>{var t,o,l;return(null===(t=g[e])||void 0===t?void 0:t.width)||(null===(o=g[e])||void 0===o?void 0:o.style)||(null===(l=g[e])||void 0===l?void 0:l.color)}));q.setFieldsValue({buttons_borderPosition:h||"all",buttons_borderWidth:null!==(null===(e=p[h])||void 0===e?void 0:e.width)?null===(t=p[h])||void 0===t?void 0:t.width:"",buttons_borderColor:(null===(o=p[h])||void 0===o?void 0:o.color)||"",buttons_borderStyle:(null===(l=p[h])||void 0===l?void 0:l.style)||"",cards_borderPosition:b||"all",cards_borderWidth:null!==(null===(r=g[b])||void 0===r?void 0:r.width)?null===(s=g[b])||void 0===s?void 0:s.width:"",cards_borderColor:(null===(a=g[b])||void 0===a?void 0:a.color)||"",cards_borderStyle:(null===(i=g[b])||void 0===i?void 0:i.style)||"",buttons_borderRadiusAll:(0,P.ok)(ae.buttonsBorderRadius.all),buttons_borderRadiusTopLeft:(0,P.ok)(ae.buttonsBorderRadius.topLeft),buttons_borderRadiusBottomLeft:(0,P.ok)(ae.buttonsBorderRadius.bottomLeft),buttons_borderRadiusTopRight:(0,P.ok)(ae.buttonsBorderRadius.topRight),buttons_borderRadiusBottomRight:(0,P.ok)(ae.buttonsBorderRadius.bottomRight),cards_borderRadiusAll:(0,P.ok)(ae.cardsBorderRadius.all),cards_borderRadiusTopLeft:(0,P.ok)(ae.cardsBorderRadius.topLeft),cards_borderRadiusBottomLeft:(0,P.ok)(ae.cardsBorderRadius.bottomLeft),cards_borderRadiusTopRight:(0,P.ok)(ae.cardsBorderRadius.topRight),cards_borderRadiusBottomRight:(0,P.ok)(ae.cardsBorderRadius.bottomRight),blockPaddingAll:(0,P.ok)(ae.blockPaddingAll),blockPaddingTop:(0,P.ok)(ae.blockPaddingTop),blockPaddingRight:(0,P.ok)(ae.blockPaddingRight),blockPaddingBottom:(0,P.ok)(ae.blockPaddingBottom),blockPaddingLeft:(0,P.ok)(ae.blockPaddingLeft),blockPaddingLeftRight:(0,P.ok)(ae.blockPaddingRight)||(0,P.ok)(ae.blockPaddingLeft),blockPaddingTopBottom:(0,P.ok)(ae.blockPaddingTop)||(0,P.ok)(ae.blockPaddingBottom)}),(0,P.ok)(ae.blockPaddingAll)||!((0,P.ok)(ae.blockPaddingTop)||(0,P.ok)(ae.blockPaddingRight)||(0,P.ok)(ae.blockPaddingBottom)||(0,P.ok)(ae.blockPaddingLeft))||ae.blockPaddingTop===ae.blockPaddingBottom&&ae.blockPaddingRight===ae.blockPaddingLeft?le(!0):le(!1),!(0,P.ok)(ae.buttonsBorderRadius.all)&&((0,P.ok)(ae.buttonsBorderRadius.topLeft)||(0,P.ok)(ae.buttonsBorderRadius.bottomLeft)||(0,P.ok)(ae.buttonsBorderRadius.topRight)||(0,P.ok)(ae.buttonsBorderRadius.bottomRight))?Z(!1):Z(!0),ae.buttonsPadding&&!(0,P.ok)(ae.buttonsPadding.all)&&((0,P.ok)(ae.buttonsPadding.bottom)||(0,P.ok)(ae.buttonsPadding.right)||(0,P.ok)(ae.buttonsPadding.left)||(0,P.ok)(ae.buttonsPadding.top))&&te(!1),!(0,P.ok)(null===(n=ae.cardsBorderRadius)||void 0===n?void 0:n.all)&&((0,P.ok)(null===(d=ae.cardsBorderRadius)||void 0===d?void 0:d.topLeft)||(0,P.ok)(null===(c=ae.cardsBorderRadius)||void 0===c?void 0:c.bottomLeft)||(0,P.ok)(null===(m=ae.cardsBorderRadius)||void 0===m?void 0:m.topRight)||(0,P.ok)(null===(u=ae.cardsBorderRadius)||void 0===u?void 0:u.bottomRight))?Q(!1):Q(!0)}}),[q,ae]);const he=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:L.Ru.SANDBOX_EMAIL_SETTINGS_SET,settings:{[o]:t.classList.contains("selected-td-form__button--active")}})};return ae&&(0,F.jsx)("div",{className:s()("appearance-panel",{[e]:e}),children:(0,F.jsxs)(i.A,{form:q,layout:"vertical",name:"content_appearance_panel_form",initialValues:ae,onValuesChange:e=>{var t,o,l,r,s,i;const n=q.getFieldsValue(!0),d=Object.keys(e)[0];let c={};switch(d){case"headingFontSize":me(Math.min(n.headingFontSize-1,19)),c=e;break;case"textFontSize":pe(Math.max(n.textFontSize+1,20)),c=e;break;case"buttons_borderStyle":c={buttonsBorder:{[n.buttons_borderPosition]:{...G[n.buttons_borderPosition],style:e[d]}}},"all"===n.buttons_borderPosition?U((t=>({...L.iV,[n.buttons_borderPosition]:{...t[n.buttons_borderPosition],style:e[d]}}))):U((t=>({...t,[n.buttons_borderPosition]:{...t[n.buttons_borderPosition],style:e[d]}})));break;case"buttons_borderColor":c={buttonsBorder:{[n.buttons_borderPosition]:{...G[n.buttonsBorderPosition],color:e[d]}}},"all"===n.buttons_borderPosition?U((t=>({...L.iV,[n.buttons_borderPosition]:{...t[n.buttons_borderPosition],color:e[d]}}))):U((t=>({...t,[n.buttons_borderPosition]:{...t[n.buttons_borderPosition],color:e[d]}})));break;case"buttons_borderWidth":c={buttonsBorder:{[n.buttons_borderPosition]:{...G[n.buttons_borderPosition],width:e[d]}}},"all"===n.buttonsBorderPosition?U((t=>({...L.iV,[n.buttons_borderPosition]:{...t[n.buttons_borderPosition],width:e[d]}}))):U((t=>({...t,[n.buttons_borderPosition]:{...t[n.buttons_borderPosition],width:e[d]}})));break;case"buttons_borderPosition":q.setFieldsValue({buttons_borderWidth:(null===(t=G[e[d]])||void 0===t?void 0:t.width)||"",buttons_borderColor:(null===(o=G[e[d]])||void 0===o?void 0:o.color)||"",buttons_borderStyle:(null===(l=G[e[d]])||void 0===l?void 0:l.style)||""});break;case"cards_borderStyle":c={cardsBorder:{[n.cards_borderPosition]:{...X[n.cards_borderPosition],style:e[d]}}},"all"===n.cards_borderPosition?Y((t=>({...L.iV,[n.cards_borderPosition]:{...t[n.cards_borderPosition],style:e[d]}}))):Y((t=>({...t,[n.cards_borderPosition]:{...t[n.cards_borderPosition],style:e[d]}})));break;case"cards_borderColor":c={cardsBorder:{[n.cards_borderPosition]:{...X[n.cardsBorderPosition],color:e[d]}}},"all"===n.cards_borderPosition?Y((t=>({...L.iV,[n.cards_borderPosition]:{...t[n.cards_borderPosition],color:e[d]}}))):Y((t=>({...t,[n.cards_borderPosition]:{...t[n.cards_borderPosition],color:e[d]}})));break;case"cards_borderWidth":c={cardsBorder:{[n.cards_borderPosition]:{...X[n.cards_borderPosition],width:e[d]}}},"all"===n.cardsBorderPosition?Y((t=>({...L.iV,[n.cards_borderPosition]:{...t[n.cards_borderPosition],width:e[d]}}))):Y((t=>({...t,[n.cards_borderPosition]:{...t[n.cards_borderPosition],width:e[d]}})));break;case"cards_borderPosition":q.setFieldsValue({cards_borderWidth:(null===(r=X[e[d]])||void 0===r?void 0:r.width)||"",cards_borderColor:(null===(s=X[e[d]])||void 0===s?void 0:s.color)||"",cards_borderStyle:(null===(i=X[e[d]])||void 0===i?void 0:i.style)||""});break;case"buttons_borderRadiusAll":case"buttons_borderRadiusTopLeft":case"buttons_borderRadiusBottomLeft":case"buttons_borderRadiusTopRight":case"buttons_borderRadiusBottomRight":c={buttonsBorderRadius:{[z[d]]:+e[d]}};break;case"cards_borderRadiusAll":case"cards_borderRadiusTopLeft":case"cards_borderRadiusBottomLeft":case"cards_borderRadiusTopRight":case"cards_borderRadiusBottomRight":c={cardsBorderRadius:{[O[d]]:+e[d]}};break;case"buttonsPaddingTop":case"buttonsPaddingLeft":case"buttonsPaddingRight":case"buttonsPaddingBottom":ee?(c={padding:{all:+e[d]}},q.setFieldsValue({paddingTop:e[d],paddingLeft:e[d],paddingRight:e[d],paddingBottom:e[d]})):c={buttonsPadding:{[re[d]]:+e[d]}};break;case"blockPaddingTop":case"blockPaddingLeft":case"blockPaddingRight":case"blockPaddingBottom":c={blockPadding:{left:n.blockPaddingLeft||0,right:n.blockPaddingRight||0,top:n.blockPaddingTop||0,bottom:n.blockPaddingBottom||0,[re[d]]:+e[d]}};break;case"blockPaddingTopBottom":c={blockPadding:{left:n.blockPaddingLeft||0,right:n.blockPaddingRight||0,top:+e[d],bottom:+e[d]}},n.blockPaddingTop=n.blockPaddingBottom=+e[d];break;case"blockPaddingLeftRight":c={blockPadding:{top:n.blockPaddingTop||0,bottom:n.blockPaddingBottom||0,left:+e[d],right:+e[d]}},n.blockPaddingLeft=n.blockPaddingRight=+e[d];break;default:c=e}"buttons_borderPosition"!==d&&a({operation:L.Ru.SANDBOX_EMAIL_SETTINGS_SET,settings:c})},autoComplete:"off",className:"element-controls",children:[ne?null:(0,F.jsx)(n.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,F.jsx)("div",{className:"form-group-title",style:{paddingTop:0},children:o("Blocks")}),(0,F.jsxs)(d.A,{gutter:10,children:[(0,F.jsx)(c.A,{span:12,children:(0,F.jsx)(m.A,{trigger:["hover"],title:o("Blocks background color"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"blockBackgroundColor",style:{marginBottom:W.formItemMarginBottomMD+4},rules:[{message:o("Please set the background color")}],children:(0,F.jsx)(k.A,{placeholder:o("Background color"),usedColors:H.usedColors})})})}),(0,F.jsx)(c.A,{span:12,children:(0,F.jsx)(m.A,{trigger:["hover"],title:o("Background color of the contrast blocks"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"blockContrastBackgroundColor",style:{marginBottom:W.formItemMarginBottomMD+4},rules:[{message:o("Please set the background color")}],children:(0,F.jsx)(k.A,{placeholder:o("Background color"),usedColors:H.usedColors})})})})]}),(0,F.jsx)(d.A,{gutter:10,style:{paddingBottom:4},children:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(c.A,{span:10,style:{width:156,flex:"auto",maxWidth:"none"},children:[(0,F.jsx)("div",{className:"padding-collapsed",style:{display:oe?"block":"none"},children:(0,F.jsx)(m.A,{title:o("Horizontal padding"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"blockPaddingLeftRight",children:(0,F.jsx)(E.A,{min:0,placeholder:o("Horizontal"),prefix:(0,F.jsx)(T.A,{icon:"PaddingLeftRight"}),addonAfter:"px"})})})}),(0,F.jsxs)("div",{className:"padding-extended",style:{display:oe?"none":"block"},children:[(0,F.jsx)(m.A,{trigger:["hover"],title:o("Left padding"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"blockPaddingLeft",style:{marginBottom:W.formItemMarginBottomXS},children:(0,F.jsx)(E.A,{min:0,placeholder:o("Left"),prefix:(0,F.jsx)(T.A,{icon:"PaddingLeft"}),addonAfter:"px"})})}),(0,F.jsx)(m.A,{trigger:["hover"],title:o("Right padding"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"blockPaddingRight",children:(0,F.jsx)(E.A,{min:0,placeholder:o("Right"),prefix:(0,F.jsx)(T.A,{icon:"PaddingRight"}),addonAfter:"px"})})})]})]}),(0,F.jsxs)(c.A,{span:10,style:{width:156,flex:"auto",maxWidth:"none"},children:[(0,F.jsx)("div",{className:"padding-collapsed",style:{display:oe?"block":"none"},children:(0,F.jsx)(m.A,{title:o("Vertical padding"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"blockPaddingTopBottom",children:(0,F.jsx)(E.A,{min:0,placeholder:o("Vertical"),prefix:(0,F.jsx)(T.A,{icon:"PaddingTopBottom"}),addonAfter:"px"})})})}),(0,F.jsxs)("div",{className:"padding-extended",style:{display:oe?"none":"block"},children:[(0,F.jsx)(m.A,{trigger:["hover"],title:o("Top padding"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"blockPaddingTop",style:{marginBottom:W.formItemMarginBottomXS},children:(0,F.jsx)(E.A,{min:0,placeholder:o("Top"),prefix:(0,F.jsx)(T.A,{icon:"PaddingTop"}),addonAfter:"px"})})}),(0,F.jsx)(m.A,{trigger:["hover"],title:o("Bottom padding"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"blockPaddingBottom",children:(0,F.jsx)(E.A,{min:0,placeholder:o("Bottom"),prefix:(0,F.jsx)(T.A,{icon:"PaddingBottom"}),addonAfter:"px"})})})]})]}),(0,F.jsx)(c.A,{span:4,style:{width:45,flex:"auto",maxWidth:"none"},children:(0,F.jsx)(m.A,{title:o("Individual padding"),placement:"bottom",children:(0,F.jsx)(u.Ay,{className:s()("selected-td-form__button",{"selected-td-form__button--active":!oe}),onClick:()=>{le((e=>!e));const e=q.getFieldsValue(!0);oe||(e.blockPaddingLeftRight=e.blockPaddingLeft,e.blockPaddingTopBottom=e.blockPaddingTop,e.blockPaddingRight=e.blockPaddingLeft,e.blockPaddingBottom=e.blockPaddingTop,a({operation:L.Ru.SANDBOX_EMAIL_SETTINGS_SET,settings:{blockPadding:{top:e.blockPaddingTopBottom,bottom:e.blockPaddingTopBottom,left:e.blockPaddingLeftRight,right:e.blockPaddingLeftRight}}}))},children:(0,F.jsx)(T.A,{icon:"PaddingSwitcher"})})})})]})}),(0,F.jsx)(p.A,{className:"selected-td-form__divider"}),(0,F.jsx)("div",{className:"form-group-title",children:o("General text")}),(0,F.jsx)(m.A,{trigger:["hover"],title:o("Font of the general text"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"textFontFamily",style:{marginBottom:W.formItemMarginBottomXS},children:(0,F.jsx)(j.A,{value:ae.textFontFamily})})}),(0,F.jsxs)(d.A,{gutter:10,children:[(0,F.jsx)(c.A,{span:12,children:(0,F.jsx)(m.A,{trigger:["hover"],title:o("Font size of the general text"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"textFontSize",children:(0,F.jsx)(E.A,{min:15,max:ce,placeholder:o("Font size"),prefix:(0,F.jsx)(g.A,{}),addonAfter:"px"})})})}),(0,F.jsx)(c.A,{span:12,children:(0,F.jsx)(m.A,{trigger:["hover"],title:o("Line height of the general text"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"textLineHeight",children:(0,F.jsx)(E.A,{min:0,placeholder:o("Line height"),prefix:(0,F.jsx)(b.A,{}),addonAfter:"px"})})})})]}),(0,F.jsxs)(d.A,{gutter:10,style:{paddingBottom:4},children:[(0,F.jsx)(c.A,{span:12,children:(0,F.jsx)(m.A,{trigger:["hover"],title:o("Color of the general text"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"textColor",children:(0,F.jsx)(k.A,{placeholder:o("Text color"),usedColors:H.usedColors})})})}),(0,F.jsx)(c.A,{span:12,children:(0,F.jsx)(m.A,{trigger:["hover"],title:o("Contrast block text color"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"textContrastColor",children:(0,F.jsx)(k.A,{placeholder:o("Text color"),usedColors:H.usedColors})})})})]}),(0,F.jsx)(d.A,{gutter:10,style:{paddingBottom:4},children:(0,F.jsx)(c.A,{span:12,children:(0,F.jsx)(m.A,{trigger:["hover"],title:o("Bottom padding of the general text"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"textPaddingBottom",children:(0,F.jsx)(E.A,{min:0,placeholder:o("Bottom padding"),prefix:(0,F.jsx)(T.A,{icon:"PaddingBottom"}),addonAfter:"px"})})})})}),(0,F.jsx)(p.A,{className:"selected-td-form__divider"}),(0,F.jsx)("div",{className:"form-group-title",children:o("Headings")}),(0,F.jsx)(m.A,{trigger:["hover"],title:o("Heading font"),placement:"left",children:(0,F.jsx)(i.A.Item,{name:"headingFontFamily",style:{marginBottom:W.formItemMarginBottomXS},children:(0,F.jsx)(j.A,{})})}),(0,F.jsxs)(d.A,{gutter:10,children:[(0,F.jsx)(c.A,{span:12,children:(0,F.jsx)(m.A,{trigger:["hover"],title:o("Heading font size"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"headingFontSize",style:{marginBottom:W.formItemMarginBottomXS},children:(0,F.jsx)(E.A,{min:ue,max:40,placeholder:o("Font size"),prefix:(0,F.jsx)(g.A,{}),addonAfter:"px"})})})}),(0,F.jsx)(c.A,{span:12,children:(0,F.jsx)(m.A,{trigger:["hover"],title:o("Heading line height"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"headingLineHeight",style:{marginBottom:W.formItemMarginBottomXS},children:(0,F.jsx)(E.A,{min:0,placeholder:o("Line height"),prefix:(0,F.jsx)(b.A,{}),addonAfter:"px"})})})})]}),(0,F.jsxs)(d.A,{gutter:10,children:[(0,F.jsx)(c.A,{span:12,children:(0,F.jsx)(m.A,{trigger:["hover"],title:o("Heading letter spacing"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"headingLetterSpacing",children:(0,F.jsx)(E.A,{min:0,placeholder:o("Letter spacing"),prefix:(0,F.jsx)(f.A,{}),addonAfter:"px"})})})}),(0,F.jsx)(c.A,{span:12,children:(0,F.jsxs)(h.A,{children:[(0,F.jsx)(m.A,{placement:"bottom",title:o("Strong"),children:(0,F.jsx)(u.Ay,{className:s()({"selected-td-form__button--active":ae.headingBold}),type:"default",name:"headingBold",onClick:he,children:(0,F.jsx)(v.A,{})})}),(0,F.jsx)(m.A,{placement:"bottom",title:o("Italic"),children:(0,F.jsx)(u.Ay,{className:s()({"selected-td-form__button--active":ae.headingItalic}),type:"default",name:"headingItalic",onClick:he,children:(0,F.jsx)(y.A,{})})})]})})]}),(0,F.jsxs)(d.A,{gutter:10,children:[(0,F.jsx)(c.A,{span:12,children:(0,F.jsx)(m.A,{trigger:["hover"],title:o("Heading color"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"headingColor",children:(0,F.jsx)(k.A,{placeholder:o("Heading color"),usedColors:H.usedColors})})})}),(0,F.jsx)(c.A,{span:12,children:(0,F.jsx)(m.A,{trigger:["hover"],title:o("Contrast block header color"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"headingContrastColor",children:(0,F.jsx)(k.A,{placeholder:o("Heading color"),usedColors:H.usedColors})})})})]}),(0,F.jsxs)(d.A,{gutter:10,style:{paddingBottom:4},children:[(0,F.jsx)(c.A,{span:12,children:(0,F.jsx)(m.A,{trigger:["hover"],title:o("Top padding"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"headingPaddingTop",children:(0,F.jsx)(E.A,{min:0,placeholder:o("Top padding"),prefix:(0,F.jsx)(T.A,{icon:"PaddingTop"}),addonAfter:"px"})})})}),(0,F.jsx)(c.A,{span:12,children:(0,F.jsx)(m.A,{trigger:["hover"],title:o("Bottom padding"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"headingPaddingBottom",children:(0,F.jsx)(E.A,{min:0,placeholder:o("Bottom padding"),prefix:(0,F.jsx)(T.A,{icon:"PaddingBottom"}),addonAfter:"px"})})})})]}),(0,F.jsx)(p.A,{className:"selected-td-form__divider"}),(0,F.jsx)("div",{className:"form-group-title",children:o("Links")}),(0,F.jsxs)(d.A,{gutter:10,children:[(0,F.jsx)(c.A,{span:12,children:(0,F.jsx)(m.A,{trigger:["hover"],title:o("Link color"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"linkColor",style:{marginBottom:W.formItemMarginBottomXS},children:(0,F.jsx)(k.A,{placeholder:o("Link color"),usedColors:H.usedColors})})})}),(0,F.jsx)(c.A,{span:12,children:(0,F.jsx)(m.A,{placement:"bottom",title:o("Underline"),children:(0,F.jsx)(u.Ay,{className:s()({"selected-td-form__button--active":ae.linkUnderline}),type:"default",name:"linkUnderline",onClick:he,children:(0,F.jsx)(x.A,{})})})})]}),(0,F.jsx)(d.A,{gutter:10,style:{paddingBottom:4},children:(0,F.jsx)(c.A,{span:12,children:(0,F.jsx)(m.A,{trigger:["hover"],title:o("Link color in contrasting blocks"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"linkContrastColor",children:(0,F.jsx)(k.A,{placeholder:o("Link color"),usedColors:H.usedColors})})})})}),(0,F.jsx)(p.A,{className:"selected-td-form__divider"}),(0,F.jsxs)("div",{className:"form-group-title",children:[o("Buttons")," ",(0,F.jsx)("span",{className:"form-group-title__bull",children:"\u2022"})," ",o("Text & background")]}),(0,F.jsx)(m.A,{trigger:["hover"],title:o("Buttons font"),placement:"left",children:(0,F.jsx)(i.A.Item,{name:"buttonsFontFamily",style:{marginBottom:W.formItemMarginBottomXS},children:(0,F.jsx)(j.A,{})})}),(0,F.jsxs)(d.A,{gutter:10,children:[(0,F.jsx)(c.A,{span:12,children:(0,F.jsx)(m.A,{trigger:["hover"],title:o("Buttons font size"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"buttonsFontSize",style:{marginBottom:W.formItemMarginBottomXS},children:(0,F.jsx)(E.A,{min:0,placeholder:o("Font size"),prefix:(0,F.jsx)(g.A,{}),addonAfter:"px"})})})}),(0,F.jsx)(c.A,{span:12,children:(0,F.jsx)(m.A,{trigger:["hover"],title:o("Buttons letter spacing"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"buttonsLetterSpacing",style:{marginBottom:W.formItemMarginBottomXS},children:(0,F.jsx)(E.A,{min:0,placeholder:o("Letter spacing"),prefix:(0,F.jsx)(f.A,{}),addonAfter:"px"})})})})]}),(0,F.jsxs)(d.A,{gutter:10,style:{paddingBottom:4},children:[(0,F.jsx)(c.A,{span:12,children:(0,F.jsx)(m.A,{trigger:["hover"],title:o("Buttons text color"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"buttonsColor",style:{marginBottom:W.formItemMarginBottomXS},children:(0,F.jsx)(k.A,{placeholder:o("Buttons text color"),usedColors:H.usedColors})})})}),(0,F.jsx)(c.A,{span:12,children:(0,F.jsx)(m.A,{trigger:["hover"],title:o("Button text color in contrasting blocks"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"buttonsContrastColor",style:{marginBottom:W.formItemMarginBottomXS},children:(0,F.jsx)(k.A,{placeholder:o("Buttons text color"),usedColors:H.usedColors})})})}),(0,F.jsx)(c.A,{span:12,children:(0,F.jsx)(m.A,{trigger:["hover"],title:o("Buttons background color"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"buttonsBackgroundColor",children:(0,F.jsx)(k.A,{placeholder:o("Background color"),usedColors:H.usedColors})})})}),(0,F.jsx)(c.A,{span:12,children:(0,F.jsx)(m.A,{trigger:["hover"],title:o("Button background color in contrasting blocks"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"buttonsContrastBackgroundColor",children:(0,F.jsx)(k.A,{placeholder:o("Background color"),usedColors:H.usedColors})})})}),V.formButtonFieldTextAlignEnabled&&(0,F.jsx)(c.A,{span:12,children:(0,F.jsx)(S.A,{form:q,elementSettings:{textAlign:"",type:"email"},imgParent:!1,name:"buttonsAlign",withHotKeys:!1})}),(0,F.jsx)(c.A,{span:12,children:(0,F.jsxs)(h.A,{children:[(0,F.jsx)(m.A,{placement:"bottom",title:o("Strong"),children:(0,F.jsx)(u.Ay,{className:s()({"selected-td-form__button--active":ae.buttonsBold}),type:"default",name:"buttonsBold",onClick:he,children:(0,F.jsx)(v.A,{})})}),(0,F.jsx)(m.A,{placement:"bottom",title:o("Italic"),children:(0,F.jsx)(u.Ay,{className:s()({"selected-td-form__button--active":ae.buttonsItalic}),type:"default",name:"buttonsItalic",onClick:he,children:(0,F.jsx)(y.A,{})})})]})})]}),V.formFieldBorderEnabled&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(p.A,{className:"selected-td-form__divider"}),(0,F.jsxs)("div",{className:"form-group-title",children:[o("Buttons")," ",(0,F.jsx)("span",{className:"form-group-title__bull",children:"\u2022"})," ",o("Borders")]}),(0,F.jsx)("div",{style:{paddingBottom:4},children:(0,F.jsx)(w.A,{borders:G,namePrefix:"buttons_"})})]}),V.formFieldBorderRadiusEnabled&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(p.A,{className:"selected-td-form__divider"}),(0,F.jsxs)("div",{className:"form-group-title",children:[o("Buttons")," ",(0,F.jsx)("span",{className:"form-group-title__bull",children:"\u2022"})," ",o("Border radius")]}),(0,F.jsx)("div",{style:{paddingBottom:4},children:(0,F.jsx)(C.A,{form:q,oneBorderRadiusValue:K,setOneBorderRadiusValue:Z,elementSettings:ae,namePrefix:"buttons_"})})]}),(0,F.jsx)(p.A,{className:"selected-td-form__divider"}),(0,F.jsxs)("div",{className:"form-group-title",children:[o("Buttons")," ",(0,F.jsx)("span",{className:"form-group-title__bull",children:"\u2022"})," ",o("Margins")]}),(0,F.jsxs)(d.A,{gutter:10,style:{paddingBottom:4},children:[(0,F.jsx)(c.A,{span:12,children:(0,F.jsx)(m.A,{trigger:["hover"],title:o("Top margin"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"buttonsMarginTop",children:(0,F.jsx)(E.A,{min:0,placeholder:o("Top margin"),prefix:(0,F.jsx)(T.A,{icon:"PaddingTop"}),addonAfter:"px"})})})}),(0,F.jsx)(c.A,{span:12,children:(0,F.jsx)(m.A,{trigger:["hover"],title:o("Bottom margin"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"buttonsMarginBottom",children:(0,F.jsx)(E.A,{min:0,placeholder:o("Bottom margin"),prefix:(0,F.jsx)(T.A,{icon:"PaddingBottom"}),addonAfter:"px"})})})})]}),(0,F.jsx)(p.A,{className:"selected-td-form__divider"}),(0,F.jsxs)("div",{className:"form-group-title",children:[o("Cards")," ",(0,F.jsx)("span",{className:"form-group-title__bull",children:"\u2022"})," ",o("Colors")]}),(0,F.jsxs)(d.A,{gutter:10,children:[(0,F.jsxs)(c.A,{span:12,children:[(0,F.jsx)("div",{className:"form-group-title",style:{paddingTop:0,paddingBottom:W.formItemMarginBottomXS},children:o("Base colors")}),(0,F.jsx)(m.A,{trigger:["hover"],title:o("Base background color"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"cardsBaseBackgroundColor",style:{marginBottom:W.formItemMarginBottomXS},children:(0,F.jsx)(k.A,{placeholder:o("Base background color"),usedColors:H.usedColors})})})]}),(0,F.jsxs)(c.A,{span:12,children:[(0,F.jsx)("div",{className:"form-group-title",style:{paddingTop:0,paddingBottom:W.formItemMarginBottomXS},children:o("Contrasting colors")}),(0,F.jsx)(m.A,{trigger:["hover"],title:o("Contrasting background color"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"cardsContrastBackgroundColor",style:{marginBottom:W.formItemMarginBottomXS},children:(0,F.jsx)(k.A,{placeholder:o("Contrasting background color"),usedColors:H.usedColors})})})]})]}),(0,F.jsxs)(d.A,{gutter:10,style:{paddingBottom:4},children:[(0,F.jsx)(c.A,{span:12,children:(0,F.jsx)(m.A,{trigger:["hover"],title:o("Base text color"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"cardsBaseTextColor",children:(0,F.jsx)(k.A,{placeholder:o("Base text color"),usedColors:H.usedColors})})})}),(0,F.jsx)(c.A,{span:12,children:(0,F.jsx)(m.A,{trigger:["hover"],title:o("Contrasting text color"),placement:"bottom",children:(0,F.jsx)(i.A.Item,{name:"cardsContrastTextColor",children:(0,F.jsx)(k.A,{placeholder:o("Contrasting text color"),usedColors:H.usedColors})})})})]}),V.formFieldBorderEnabled&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(p.A,{className:"selected-td-form__divider"}),(0,F.jsxs)("div",{className:"form-group-title",children:[o("Cards")," ",(0,F.jsx)("span",{className:"form-group-title__bull",children:"\u2022"})," ",o("Borders")]}),(0,F.jsx)("div",{style:{paddingBottom:4},children:(0,F.jsx)(w.A,{borders:X,namePrefix:"cards_"})})]}),V.formFieldBorderRadiusEnabled&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(p.A,{className:"selected-td-form__divider"}),(0,F.jsxs)("div",{className:"form-group-title",children:[o("Cards")," ",(0,F.jsx)("span",{className:"form-group-title__bull",children:"\u2022"})," ",o("Border radius")]}),(0,F.jsx)("div",{style:{paddingBottom:4},children:(0,F.jsx)(C.A,{form:q,oneBorderRadiusValue:J,setOneBorderRadiusValue:Q,elementSettings:ae,namePrefix:"cards_"})})]})]})})};q.defaultProps={className:""};const H=q},88296:(e,t,o)=>{o.d(t,{A:()=>c});var l=o(92810),r=o(79579),s=o(23287),a=o(42642),i=o(70082);const n=[{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,s.s9)(),u=[],p=[],[h,g]=(0,l.useState)(),[b,f]=(0,l.useState)(e),v=a.Mz.filter((e=>e.subsets.includes("cyrillic")&&"Sans Serif"===e.category&&e.popularity<100));v.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 y=a.Mz.filter((e=>e.subsets.includes("cyrillic")&&"Serif"===e.category&&e.popularity<100));return y.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,l.useEffect)((()=>{if(o&&e!==b)if(e)if("Sans Serif"===e[1]){var t;g(["Google Fonts","Sans Serif",null===(t=v.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 l;g(["Google Fonts","Serif",null===(l=y.find((t=>(null===t||void 0===t?void 0:t.family.replace(/\s/g,""))===e[2].replace(/\s/g,""))))||void 0===l?void 0:l.family,e[3].replace(/Italic/g," Italic")])}else"Safe Fonts"!==e[0]&&void 0!==h||g(e);else g([""]);else void 0===h&&b&&g(e);o||g(e),f(e)}),[e,v,y,h,o,b]),(0,i.jsx)(r.A,{allowClear:!1,showSearch:!0,value:h,placement:"bottomRight",options:[{label:m("Safe Fonts"),value:"Safe Fonts",children:n},{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 l=o(92810),r=o(95838),s=o(55039),a=o(33206),i=o(57806),n=o(29234),d=o(4800),c=o(12280),m=o(81e3),u=o(92328),p=o(43005),h=o(66726),g=o(28964),b=o(45934),f=o(37792),v=o(66170),y=o(64586),x=o(85677),_=o(9452),A=o(23287),j=o(85163),k=o(86286),S=o(64037),w=o(62303),C=o(18777),E=o(86739),T=o(55701),I=o(45695),N=o(32269),R=o(32411),B=o(38883),L=o.n(B),P=o(70082);const{useToken:F}=r.A,{TextArea:M}=s.A,D=({comments:e,subjectId:t,isLoggedIn:o,projectTitle:r="",emailElementType:B,email:D})=>{const{__:z,_n:O}=(0,A.s9)(),q=(0,I.XW)(),{modal:H}=a.A.useApp(),{error:$,notification:V}=H,{token:W}=F(),G=(0,l.useRef)(null),[U,X]=(0,l.useState)(""),[Y,K]=(0,l.useState)("ADD"),[Z,J]=(0,l.useState)(!1),[Q,ee]=(0,l.useState)(null),[te,oe]=(0,l.useState)(null),[le,re]=(0,l.useState)(""),[se,ae]=(0,l.useState)(""),[ie,ne]=(0,l.useState)(!1),[de,ce]=(0,l.useState)(""),[me,ue]=(0,C.z2)(),[pe,he]=(0,C.HI)(),[ge,be]=(0,C.kk)(),[fe,ve]=(0,C.vn)(),[ye]=(0,E.LX)(),[xe]=(0,T.yW)(),_e=(0,b.d4)(k.C1),Ae=(0,R.fn)(),je=()=>{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===Ae||void 0===Ae?void 0:Ae.getValue(),excerpt:null===D||void 0===D?void 0:D.date_gmt};"email"===B?ye({emailId:null===D||void 0===D?void 0:D.id,body:e}).catch((e=>{console.log(e)})):xe({blockId:null===D||void 0===D?void 0:D.id,body:e}).catch((e=>{console.log(e)}))};function ke(e){oe(Q),re(""),K("REPLY")}const Se=()=>{$({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 ")+`${r}.`,okText:z("Okay. I'll log in.")})};async function we(){o?(await ge({commentId:te,content:se,targetId:de}).unwrap(),K("ADD"),ae(""),oe(0),ne(!1),J(!1),ce(""),q({operation:j.Ru.SANDBOX_DISCUSS_RESET})):Se()}const Ce=e=>{K("ADD"),ae(""),oe(0),ne(!1),J(!1),ce(""),q({operation:j.Ru.SANDBOX_DISCUSS_RESET})},Ee=async()=>{o?((U||le)&&await me({subjectId:t,author:_e.id,parent:"ADD"===Y?"0":te,content:U||le,author_name:_e.name,author_email:_e.email,targetId:de}).then((e=>{e.error&&V.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"),re(""),X(""),oe(0),ne(!1),J(!1),q({operation:j.Ru.SANDBOX_DISCUSS_RESET})):Se()};function Te(){ie?(J(!1),ne(!1),q({operation:j.Ru.SANDBOX_DISCUSS_REMOVE_TARGET,value:de})):(J(!Z),q({operation:j.Ru.SANDBOX_DISCUSS_SET_TARGET,value:!Z}),Z&&ne(!1))}(0,S.A)((e=>{const t=e.data.operation;if(t===j.Ru.APPLICATION_DISCUSS_SET_ID&&(ce(e.data.settings.value),""!==e.data.settings.value?(ne(!0),J(!1)):(ne(!1),J(!0))),t===j.Ru.APPLICATION_DISCUSS_SAVE_TARGET&&je(),t===j.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 q({operation:j.Ru.SANDBOX_DISCUSS_REMOVE_TARGET,value:e.data.settings.targetId}),V.error({message:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:z("There's no such comment.")}}),placement:"bottomRight"});t===j.Ru.APPLICATION_DISCUSS_NO_COMMENT&&V.error({message:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:z("There's no such element in the email.")}}),placement:"bottomRight"})}));const Ie=e=>{q({operation:j.Ru.SANDBOX_DISCUSS_GET_TARGET,value:e})},Ne=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)(i.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)(n.A,{description:z("Comment was removed."),type:"info"}),children:Ne(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:L()(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===_e.id?Le: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,N.Yq)((0,N.Cl)(e.date),O,!0)}}),e.target_id&&(0,P.jsx)("span",{className:"comment-icon-target","target-id":e.target_id,onClick:()=>Ie(e.target_id),children:(0,P.jsx)(f.A,{style:{color:W.colorInfo,top:-2,position:"relative"}})})]}),children:(0,P.jsxs)(P.Fragment,{children:["REPLY"===Y&&te===e.id&&Be,"EDIT"===Y&&te===e.id&&Re,Ne(e.children)]})})})]})})})})})),Re=(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:se,onChange:e=>ae(e.target.value),rows:4,placeholder:z("Editing comments"),onKeyDown:e=>"Escape"===e.key&&Ce(),onPressEnter:e=>"Enter"===e.key&&e.ctrlKey&&we(),ref:G})}),(0,P.jsx)(c.A.Item,{className:"buttons",children:(0,P.jsxs)(m.A,{children:[ie?(0,P.jsx)(u.A,{title:z("Are you sure?"),okText:z("Yes"),cancelText:z("No"),onConfirm:function(e){fe(te),ne(!1),ce(""),q({operation:j.Ru.SANDBOX_DISCUSS_REMOVE_TARGET,value:de})},children:(0,P.jsx)(p.Ay,{loading:ve.isLoading,type:Z||ie&&"EDIT"===Y&&""!==de?"primary":"default",className:"button-target "+(Z&&!ie?"button-target_choose":""),style:ie&&"EDIT"===Y&&""!==de?{background:W.colorInfo}:{},children:(0,P.jsx)(f.A,{className:"icon-target"})})}):(0,P.jsx)(p.Ay,{onClick:Te,loading:ve.isLoading,type:Z||ie&&"EDIT"===Y&&""!==de?"primary":"default",className:"button-target "+(Z&&!ie?"button-target_choose":""),style:ie&&"EDIT"===Y&&""!==de?{background:W.colorInfo}:{},children:(0,P.jsx)(f.A,{className:"icon-target"})}),(0,P.jsxs)(p.Ay,{className:"button-reply",type:"primary",loading:be.isLoading,htmlType:"submit",children:[z("Save")," ",(0,P.jsx)(v.A,{})]}),(0,P.jsx)(p.Ay,{onClick:Ce,className:"button-reply",children:z("Cancel")})]})})]}),Be=(0,P.jsxs)(c.A,{name:"reply",className:"commentForm",onFinish:Ee,children:[(0,P.jsx)(c.A.Item,{style:{marginBottom:10},children:(0,P.jsx)(M,{className:"textarea-reply",value:le,onChange:e=>re(e.target.value),rows:4,placeholder:z("Reply to the comment"),onKeyDown:e=>"Escape"===e.key&&Ce(),onPressEnter:e=>"Enter"===e.key&&e.ctrlKey&&Ee(),ref:G})}),(0,P.jsx)(c.A.Item,{hidden:!0,name:"targetId",children:(0,P.jsx)(s.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:Te,type:Z||ie&&"REPLY"===Y&&""!==de?"primary":"default",className:"button-target "+(Z&&!ie?"button-target_choose":""),style:ie&&"REPLY"===Y&&""!==de?{background:W.colorInfo}:{},children:(0,P.jsx)(f.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,l.useEffect)((()=>{"REPLY"===Y&&G.current.focus({cursor:"start"}),"EDIT"===Y&&G.current.focus({cursor:"end"})}),[Y]);let Le=[];Le.push({key:"Reply to comment",icon:(0,P.jsx)(y.A,{style:{fontSize:"16px"}}),label:z("Reply"),onClick:ke},{key:"Edit comment",icon:(0,P.jsx)(x.A,{style:{fontSize:"16px"}}),label:z("Edit"),onClick:function(t){var o,l,r,s,a;oe(Q),ne(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===(l=o.target_id)||void 0===l?void 0:l.toString())),ae(null===(r=e.find((e=>{var t;return(null===(t=e.id)||void 0===t?void 0:t.toString())===Q})))||void 0===r||null===(s=r.content)||void 0===s||null===(a=s.slice(3,-5))||void 0===a?void 0:a.toString()),K("EDIT")}},{key:"Delete comment",icon:(0,P.jsx)(_.A,{style:{fontSize:"16px"}}),label:z("Delete"),style:{color:W.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"))&&q({operation:j.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")}),je(),ce("")}});let Pe=[];return Pe.push({key:"Reply to comment",icon:(0,P.jsx)(y.A,{style:{fontSize:"16px"}}),label:z("Reply"),onClick:ke}),(0,P.jsxs)("div",{className:"discuss-main",children:[e.length>0&&(0,P.jsx)(i.A,{className:"comment-list",itemLayout:"horizontal",dataSource:function(e){let t=JSON.parse(JSON.stringify(e));if(!t||!t.length)return[];let o=[],l=new Map;for(let r=0,s=t.length;r<s;++r){let e=t[r],s=l.get(e.id);if(s&&!Array.isArray(s)||(s&&(e.children=s),l.set(e.id,e)),"0"===String(e.parent))o.push(e);else{let t=l.get(e.parent);if(t){(Array.isArray(t)?t:t.children=t.children||[]).push(e)}else l.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)(n.A,{description:z("Comment was removed."),type:"info"}),children:Ne(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:L()(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===_e.id?Le: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,N.Yq)((0,N.Cl)(e.date),O,!0)}}),e.target_id&&(0,P.jsx)("span",{className:"comment-icon-target","target-id":e.target_id,onClick:()=>Ie(e.target_id),children:(0,P.jsx)(f.A,{style:{color:W.colorInfo,top:-2,position:"relative"}})})]}),children:(0,P.jsxs)(P.Fragment,{children:["REPLY"===Y&&te===e.id&&Be,"EDIT"===Y&&te===e.id&&Re,Ne(e.children)]})})})]})}),(0,P.jsxs)(c.A,{onFinish:Ee,className:"ADD"===Y?"addMode":"replyEditMode",children:[(0,P.jsx)(c.A.Item,{style:{marginBottom:10},children:(0,P.jsx)(M,{value:U,onChange:e=>X(e.target.value),rows:4,placeholder:z("Leave your comment"),className:"textarea-comment",onPressEnter:e=>"Enter"===e.key&&e.ctrlKey&&Ee()})}),(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:Te,type:Z||ie&&"ADD"===Y&&""!==de?"primary":"default",className:"button-target "+(Z&&!ie?"button-target_choose":""),style:ie&&"ADD"===Y&&""!==de?{background:W.colorInfo}:{},children:(0,P.jsx)(f.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:()=>D});var l=o(92810),r=o(55039),s=o(66726),a=o(57806),i=o(12280),n=o(43005),d=o(4800),c=o(14852),m=o(74267),u=o(64617),p=o(25984),h=o(45934),g=o(62303),b=o(81325),f=o(79716),v=o(46950),y=o(28964),x=o(84612),_=o(58819),A=o(86286),j=o(65983),k=o(32269),S=o(23287),w=o(56991),C=o(47381),E=o(93982),T=o(71157),I=o(45695),N=o(32411),R=o(58689),B=o(85163),L=o(13522),P=o(70082);const F=e=>{const{__:t}=(0,S.s9)();return[{key:"\ud83d\udce7",label:(0,P.jsxs)("div",{onClick:()=>{e("theme-and-preheader-generator")},children:["\ud83d\udce7 ",t("Subject line & preheader generator")]})},{key:"\ud83c\udf0e",label:(0,P.jsxs)("div",{onClick:()=>{e("translator")},children:["\ud83c\udf0e ",t("Translator")]})},{key:"\ud83d\udcc4",label:(0,P.jsxs)("div",{onClick:()=>{e("writer")},children:["\ud83d\udcc4 ",t("Copywriter")]})},{key:"\ud83d\udd0e",label:(0,P.jsxs)("div",{onClick:()=>{e("corrector")},children:["\ud83d\udd0e ",t("Proofreader")]})},{key:"\ud83e\udde0",label:(0,P.jsxs)("div",{onClick:()=>{e("psychologist")},children:["\ud83e\udde0 ",t("Psychologist")]})},{key:"\ud83d\udcc8",label:(0,P.jsxs)("div",{onClick:()=>{e("marketolog")},children:["\ud83d\udcc8 ",t("Marketer")]})},{key:"\u2728",label:(0,P.jsxs)("div",{onClick:()=>{e("email-generator")},children:["\u2728 ",t("Email generator")]})}]},{TextArea:M}=r.A,D=({messages:e,newEmailAiGeneratorRef:t})=>{const o=(0,N.fn)(),{__:r,_n:D}=(0,S.s9)(),z=(0,h.wA)(),O=(0,l.useRef)(null),q=(0,w.rD)(),H=(0,T.hN)(),{projectId:$,emailId:V}=(0,u.g)(),W=(0,C.u)(),G=(0,E.ml)(L.A.ON_LIMIT_ID),[U,X]=(0,l.useState)(null),[Y,K]=(0,l.useState)(0),[Z,J]=(0,l.useState)(!1),[Q,ee]=(0,l.useState)(""),[te,oe]=(0,l.useState)([]),[le,re]=(0,l.useState)(!1),[se,ae]=(0,l.useState)(!1),[ie,ne]=(0,l.useState)(null),[de,ce]=(0,l.useState)(0),[me,ue]=(0,l.useState)(null),pe=(0,h.d4)(j.Hs),he=(0,h.d4)(A.C1),ge=(0,I.QC)(),[be]=(0,x.YG)(),fe=(0,I.XW)(),[ve,ye]=(0,x.EQ)(),[xe,{reset:_e}]=(0,_.MN)(),[Ae,{data:je=[]}]=(0,_.y4)(),ke={cursor:Z?"not-allowed":"default",pointerEvents:Z?"none":"auto"};(0,l.useEffect)((()=>{me&&le&&(t.current=!0),le||(t.current=!1)}),[me,le]);const Se=!(!q.limits||!q.counters)&&B.EW.isPlugin,{limits:we}=B.EW.isPlugin&&q.limits?q:{limits:{ai_limit:0,ai_generator_limit:0}},{ai_limit:Ce,ai_generator_limit:Ee}=we,Te=Se&&Y>=Ce&&Ce>0,Ie=Se&&de>=Ee&&Ee>0,Ne=(0,l.useCallback)((()=>{G.fire({name:"AiChatCount",count:Y+1})}),[G,Y]),Re=(0,l.useCallback)((()=>{G.fire({name:"AiGeneratorCount",count:de+1})}),[G,de]);(0,l.useEffect)((()=>{var e,t;Se&&(K((null===q||void 0===q||null===(e=q.counters)||void 0===e?void 0:e.ai_counter)||0),ce((null===q||void 0===q||null===(t=q.counters)||void 0===t?void 0:t.ai_generator_counter)||0))}),[q,Se]),(0,l.useEffect)((()=>{ue((()=>{var e;if(te.length<=0)return!1;return"email-generator"===(null===(e=te.toReversed().find((e=>{var t;return null===(t=e.data)||void 0===t?void 0:t.context})))||void 0===e?void 0:e.data.context)})())}),[te]);const Be=(0,l.useCallback)((async()=>await ge.sendAsync(B.Ru.SANDBOX_IS_EMAIL_EMPTY)),[ge]),Le=(0,l.useCallback)((()=>{var e;const t=null===(e=O.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)}),[O]),Pe=(0,l.useCallback)((()=>{be({entity_id:V}).then((e=>{oe(e.data.documents),Le()}))}),[V,be,oe,Le]),Fe=(0,l.useCallback)((()=>{re(!0),J(!0),xe({task_id:U,entity_id:V,status:"started"}).then((()=>{Pe()}))}),[V,xe,U,Pe]),Me=(0,l.useCallback)((()=>{xe({task_id:U,entity_id:V,status:"completed"}).then((e=>{403===e.data.status&&_e(),Pe()})).catch((e=>{console.log("err",e)})),J(!1),re(!1)}),[V,xe,U,Pe,_e]);(0,l.useEffect)((()=>{let e;if(le){var t,l;const r=null===(t=je[je.length-1])||void 0===t||null===(l=t.processing)||void 0===l?void 0:l.email;if(r){let t=je[je.length-1].status;e=setInterval(o.setValue(r),500),0===t&&Me()}ie&&(clearInterval(e),z((0,j.AJ)(r)),re(!1),ne(!1))}return()=>{clearInterval(e)}}),[o,ie,z,je,le,pe,V,U,Pe,xe,ye,Me]),(0,l.useEffect)(Le,[Le]),(0,l.useEffect)((()=>{(null===e||void 0===e?void 0:e.length)>0&&oe(e),fe({operation:B.Ru.SANDBOX_EMAIL_CONTENT_GET})}),[e,fe]),(0,l.useEffect)((()=>{const e=ge.onInit((()=>{ge.send({operation:B.Ru.SANDBOX_LOCK_EDIT,data:Z}),ge.send({operation:B.Ru.SANDBOX_LOCK_DISCUSS,value:Z})}));return()=>e.dispose()}),[Z,ge]);const De=async()=>{if(Q){const e=Q.replaceAll(/\n/g,"<br>"),t={project_id:$,connection:"chat",entity_id:V,message:e,locale:he.locale.slice(0,2),subject:pe.subject||"",preheader:pe.preheader||"",textContent:(0,R.T5)(o.getValue())};if(me&&Ie||Te){H.error({message:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:r(me?"You have reached the limit of AI generator usage.":"You have reached the limit of AI chat usage.")}}),description:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:r("Please upgrade your plan.")}}),placement:"bottomRight"});const e={data:{role:"assistant",message:r(me?"You have reached the limit of AI generator usage.":"You have reached the limit of AI chat usage.")}};oe((t=>[...t,e]))}else{Se&&(me&&de!==Ee?(Re(),ce((e=>e+1))):Y!==Ce&&(Ne(),K((e=>e+1)))),W({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:he.first_name+" "+he.last_name,avatar_url:he.avatar_urls[24]}}},{data:{role:"assistant",message:"\u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442",isLoading:!0}}];oe((e=>[...e,...o])),ve({body:t}).then((e=>{if(401===e.data.status)throw new Error(B.ff);if(e.data.task_id){let t=e.data.task_id;X(t),Ae({id:t,setError:ne}),Be().then((e=>{e?Fe():ae(!0)}))}Pe()})).catch((e=>{var t,o;H.error({message:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:(null===e||void 0===e||null===(t=e.data)||void 0===t?void 0:t.code)||r("Error")}}),description:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:(null===e||void 0===e||null===(o=e.data)||void 0===o?void 0:o.message)||r("Something went wrong.")}}),placement:"bottomRight"})}))}ee("")}},ze=e=>{const t={data:{role:"assistant",message:"\u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442",isLoading:!0}};oe((e=>[...e,t]));const l={project_id:$,connection:"chat",entity_id:V,context:e,locale:he.locale.slice(0,2),subject:pe.subject||"",preheader:pe.preheader||"",textContent:(0,R.T5)(o.getValue())};if(Se&&(me&&de!==Ee?(Re(),ce((e=>e+1))):Y!==Ce&&(Ne(),K((e=>e+1)))),Te){H.error({message:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:r("You have reached the limit of AI chat usage.")}}),description:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:r("Please upgrade your plan.")}}),placement:"bottomRight"});const e={data:{role:"assistant",message:r("You have reached the limit of AI chat usage.")}};oe((t=>[...t,e]))}else W({event:"select",action:"select_ai_assistant_role",context:l.context,entity_id:l.entity_id,project_id:l.project_id}),ve({body:l}).then((e=>{if(401===e.data.status)throw new Error(B.ff);Pe()})).catch((e=>{var t,o;H.error({message:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:(null===e||void 0===e||null===(t=e.data)||void 0===t?void 0:t.code)||"Error"}}),description:(0,P.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"})}))},Oe=(0,l.useCallback)((e=>{const t={data:{role:"user",message:e,userInfo:{display_name:he.first_name+" "+he.last_name,avatar_url:he.avatar_urls[24]}}},l={data:{role:"assistant",message:"\u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442",isLoading:!0}};oe((e=>[...e,t,l]));const s={project_id:$,connection:"chat",entity_id:V,message:e,locale:he.locale.slice(0,2),subject:pe.subject||"",preheader:pe.preheader||"",textContent:(0,R.T5)(o.getValue())};if(Ie){H.error({message:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:r("You have reached the limit of AI generator usage.")}}),description:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:r("Please upgrade your plan.")}}),placement:"bottomRight"});const e={data:{role:"assistant",message:r("You have reached the limit of AI chat usage.")}};oe((t=>[...t,e]))}else ve({body:s}).then((e=>{if(401===e.data.status)throw new Error(B.ff);if(e.data.task_id){let t=e.data.task_id;X(t),Ae({id:t,setError:ne}),Be().then((e=>{e?Fe():ae(!0)}))}Se&&(me&&de!==Ee?(Re(),ce((e=>e+1))):Y!==Ce&&(Ne(),K((e=>e+1)))),Pe()})).catch((e=>{var t,o;H.error({message:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:(null===e||void 0===e||null===(t=e.data)||void 0===t?void 0:t.code)||"Error"}}),description:(0,P.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"})}))}),[r,Y,de,Be,Fe,Ce,Ee,he,pe,V,me,Ie,Ne,Re,Se,o,H,$,ve,Ae,Pe]);(0,l.useEffect)((()=>{const e=window.localStorage.getItem(B.V0.em_ai_settings);if(1===te.length&&"assistant"===te[0].data.role&&e&&V){const t=new k.jG,o={project_id:$,connection:"chat",entity_id:V,context:"email-generator",locale:he.locale.slice(0,2)};window.localStorage.removeItem(B.V0.em_ai_settings),ve({body:o}).then((({data:o})=>{t.isDisposed()||Oe(e)}))}}),[te,Oe,V,he.locale,$,ve]);const qe={replace:e=>{var t,o,l,a,i,n,d,c;if(null!==(t=e.attribs)&&void 0!==t&&null!==(o=t.class)&&void 0!==o&&o.split(" ").includes("ai-response-title"))return(0,P.jsx)(s.A,{placement:"left",title:r("Replace the title"),children:(0,P.jsx)("div",{onClick:()=>(e=>{const t=e.children[0].data;ge.send(B.Ru.SANDBOX_SUBJECT_UPDATE,{value:e.children[0].data,guid:pe.renderGuid,fromAI:!0}),H.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",message:r("Title copied to email settings"),placement:"bottomRight",data:t})})(e),children:(0,P.jsx)("span",{className:"ai-response-title",children:(0,p.zd)(e.children,qe)})})});if(null!==(l=e.attribs)&&void 0!==l&&null!==(a=l.class)&&void 0!==a&&a.split(" ").includes("ai-response-preheader"))return(0,P.jsx)(s.A,{placement:"left",title:r("Replace the preheader"),children:(0,P.jsx)("div",{onClick:()=>(e=>{const t=e.children[0].data;ge.send(B.Ru.SANDBOX_PREHEADER_UPDATE,{value:e.children[0].data,guid:pe.renderGuid,fromAI:!0}),H.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",message:r("Preheader copied to email settings"),placement:"bottomRight",data:t,duration:300})})(e),children:(0,P.jsx)("span",{className:"ai-response-preheader",children:(0,p.zd)(e.children,qe)})})});if(null!==(i=e.attribs)&&void 0!==i&&null!==(n=i.class)&&void 0!==n&&n.split(" ").includes("ai-response-copy"))return(0,P.jsx)(s.A,{placement:"left",title:r("Copy to clipboard"),children:(0,P.jsx)("div",{onClick:()=>(e=>{const t=e.children[0].data;navigator.clipboard.writeText(t).then((()=>{H.success({id:"TEXT_COPIED_TO_CLIPBOARD",message:r("Text copied to clipboard"),placement:"bottomRight",data:t})})).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,P.jsx)("span",{className:"ai-response-copy",children:(0,p.zd)(e.children,qe)})})});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,h,g,b;const t=(null===(m=e.attribs)||void 0===m?void 0:m.data)||(null===(u=e.children)||void 0===u||null===(h=u[0])||void 0===h?void 0:h.data);return(0,P.jsx)("li",{className:null===(g=e.attribs)||void 0===g?void 0:g.class,data:null===(b=e.attribs)||void 0===b?void 0:b.data,onClick:()=>Oe(t),children:(0,p.zd)(e.children,qe)})}}};return(0,P.jsxs)("div",{ref:O,className:"discuss-main",children:[te.length>0&&(0,P.jsx)(a.A,{onClick:e=>{"string"===typeof e.target.className&&e.target.className.includes("ai-response-change-context")&&(ye.isLoading||ze(e.target.role))},className:"comment-list",itemLayout:"horizontal",dataSource:te,renderItem:e=>{var t,o,l;return(0,P.jsx)("li",{id:e._id,children:(0,P.jsx)(y.A,{className:e.data.userInfo?"":"ai-comment",avatar:"assistant"===e.data.role?(0,P.jsx)(g.A,{icon:"ChatGpt",className:"anticon-robot",style:{color:"#ffffff",width:24,height:24,borderRadius:"50%",justifyContent:"center"}}):!e.data.userInfo||!e.data._modified&&B.EW.isPlugin?he.avatar_urls[24]||(0,P.jsx)(b.A,{style:{color:"#ffffff",width:24,height:24,borderRadius:"50%",justifyContent:"center"}}):e.data.userInfo.avatar_url,author:(0,P.jsx)("div",{style:ke,children:"user"===(null===e||void 0===e||null===(t=e.data)||void 0===t?void 0:t.role)?B.EW.isPlugin?(null===he||void 0===he?void 0:he.username)||r("User"):null===(o=e.data)||void 0===o||null===(l=o.userInfo)||void 0===l?void 0:l.display_name:r("AI Assistant")}),datetime:e._created?(0,P.jsx)("span",{dangerouslySetInnerHTML:{__html:(0,k.Yq)((0,m.A)(e._created),D,!0)}}):null,content:e.data.isLoading?(0,P.jsx)("div",{className:"spin",children:(0,P.jsx)(f.A,{style:{fontSize:24},spin:!0})}):(0,P.jsx)("div",{style:ke,children:(0,p.Ay)(e.data.message,qe)})})},e._id)}}),Se&&(me?(0,P.jsx)(v.A,{text:r("mail generator"),counter:de,limits:Ee,wrapperStyles:{marginTop:-25}}):(0,P.jsx)(v.A,{text:r("messeges"),counter:Y,limits:Ce,wrapperStyles:{marginTop:-25}})),(0,P.jsxs)(i.A,{onFinish:De,className:"addMode",children:[(0,P.jsx)(i.A.Item,{style:{marginBottom:10},children:(0,P.jsx)(M,{disabled:Z,value:Q,onChange:e=>ee(e.target.value),rows:4,placeholder:r("Type your request"),className:"textarea-comment",onPressEnter:e=>"Enter"===e.key&&e.ctrlKey&&De(),spellCheck:"false"})}),(0,P.jsxs)(i.A.Item,{children:[(0,P.jsx)(n.Ay,{disabled:ye.isLoading||Z,type:"default",style:{background:"var(--colorInfo)",color:"#ffffff"},className:"button-target",children:(0,P.jsx)(d.A,{placement:"top",disabled:Z,arrow:{pointAtCenter:!0},menu:{items:F(ze)},children:(0,P.jsxs)("div",{disabled:Z,style:{margin:0,padding:0},children:[(0,P.jsx)(g.A,{icon:"ChatGpt"}),r("Role")]})},"Export")}),(0,P.jsxs)(n.Ay,{disabled:ye.isLoading||Z,className:"button-add",type:"primary",htmlType:"submit",children:[r("Send")," ",(0,P.jsx)(g.A,{icon:"SendOutlined"})]})]})]}),(0,P.jsx)(c.A,{title:r("Warning"),centered:!0,open:se,onOk:()=>{Fe(),ae(!1)},onCancel:()=>{Me(),ae(!1)},children:(0,P.jsx)("p",{children:r("The current template will be changed to the generated one, are you sure about this?")})})]})}},44997:(e,t,o)=>{o.d(t,{A:()=>i});var l=o(92810),r=o(78159),s=o(70082);const a=l.forwardRef(((e,t)=>{const[o,a]=(0,l.useState)(!1),[i,n]=(0,l.useState)(0),[d,c]=(0,l.useState)(e.value||e.defaultValue),[m,u]=(0,l.useState)(e.value||e.defaultValue),p=()=>a(!1),h=(0,l.useCallback)((t=>{if(o){const o=t.clientX-i;let l=(d||0)+o*e.dragspeed;l=Math.max(0,Math.round(l)),e.max&&(l=Math.min(l,e.max)),u(l),e.onChange&&e.onChange(l)}}),[o,e,d,i]);return(0,l.useEffect)((()=>{e.value||0===e.value?u(e.value):e.defaultValue||0===e.defaultValue?u(e.defaultValue):u(null)}),[e.value,e.defaultValue]),(0,l.useEffect)((()=>(document.addEventListener("mouseup",p),document.addEventListener("mousemove",h),()=>{document.removeEventListener("mouseup",p),document.removeEventListener("mousemove",h)})),[o,i,d,h]),(0,s.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")&&(a(!0),n(e.clientX),c(m))},children:[(0,s.jsx)(r.A,{...e,ref:t,value:m,className:"input-draggable"}),o&&(0,s.jsx)("div",{style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",cursor:"ew-resize"},onMouseUp:p})]})}));a.defaultProps={dragspeed:1};const i=a},65052:(e,t,o)=>{o.d(t,{A:()=>B});var l=o(92810),r=o(45934),s=o(81662),a=o(12280),i=o(2018),n=o(7744),d=o(55039),c=o(8701),m=o(14852),u=o(43005),p=o(86889),h=o(71157),g=o(39110),b=o(55782),f=o(28372),v=o(5031),y=o(81325),x=o(23287),_=o(64936),A=o(86286),j=o(65983),k=o(39990),S=o(44997),w=o(32269),C=o(69156),E=o(45695),T=o(85163),I=o(70082);const{Option:N}=s.A,R="profile",B=({isModalVisible:e})=>{const{__:t}=(0,x.s9)(),o=(0,r.d4)(A.C1),B=(0,r.d4)(A.yf),L=(0,h.hN)(),P=(0,E.XW)(),F=(0,r.wA)(),[M]=a.A.useForm(),[D,z]=(0,k.b9)(),[O,q]=(0,k.hZ)(),[H,$]=(0,l.useState)([]),[V,W]=(0,l.useState)([]),[G,U]=(0,l.useState)(R),[X,Y]=(0,l.useState)({currentPassword:!1,newPassword:!1,confirmPassword:!1}),[K,Z]=(0,l.useState)((()=>o.locale)),J=(0,l.useRef)(null),Q=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,l.useEffect)((()=>{if(M&&e){U(R),O(void 0,!0);const e=o.code_editor;Z(o.locale),M.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,M,e,O,Z]),(0,l.useEffect)((()=>{if(M&&e){if(q.isSuccess){var t,o,l,r;let e=null===(t=(0,w.EU)(B,["acf","theme"]))||void 0===t||null===(o=t.items)||void 0===o?void 0:o.enum;const s=null===(l=(0,w.EU)(B,["acf","code_editor","font_family"]))||void 0===l||null===(r=l.items)||void 0===r?void 0:r.enum;$((0,w.d_)(e)),W((0,w.d_)(s))}q.isError&&(0,w.p6)(q,L)}}),[q,M,e,B,L]);const ee=()=>{const e=window.localStorage.getItem(T.V0.em_color_scheme),t=matchMedia(T.F3).matches?T.nd:T.T;P({operation:T.Ru.UPDATE_PREVIEW,theme:e||t}),M.validateFields().then((e=>{const t=e.codeEditor;e.currentPassword&&e.newPassword?D({password:e.newPassword,old_password:e.currentPassword}):D({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:t?{font_size:t.fontSize,font_family:t.fontFamily,tab_size:t.tabSize,word_wrap:t.wordWrap,minimap:t.minimap,insert_spaces:t.insertSpaces}:null})}))};(0,l.useEffect)((()=>{z.isError&&(0,w.p6)(z,L)}),[z,L]),(0,l.useEffect)((()=>{z.isSuccess&&((0,w.wB)(t("Your profile was successfully updated."),L),F((0,_.Oo)()))}),[F,z,t,L]);const[te,oe]=(0,l.useState)("");(0,l.useEffect)((()=>{const t=window.localStorage.getItem(T.V0.em_color_scheme);e&&(M.setFieldsValue({theme:null!==t?t:T.IJ}),oe(null!==t?t:T.IJ))}),[M,e]);const le=(0,l.useCallback)((e=>{let t;if((0,C.Hk)(e),e===T.IJ){const e=matchMedia(T.F3).matches?T.nd:T.T;localStorage.removeItem(T.V0.em_color_scheme),t=e}else localStorage.setItem(T.V0.em_color_scheme,e),t=e;F((0,j.eX)(t===T.nd?`vs-${t}`:T.T)),(0,C.A5)(t)}),[F]),re=(0,l.useCallback)((()=>{te!==M.getFieldValue("theme")&&le(te),F((0,A.ww)(o.code_editor)),F((0,A.ko)(K)),F((0,_.Oo)())}),[o.code_editor,F,M,te,le,K]);let se=[{label:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(g.A,{}),t("Profile")]}),key:R,className:"em-analytics__profile-user",children:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(i.A,{gutter:16,children:[(0,I.jsxs)(n.A,{span:12,children:[" ",(0,I.jsx)(a.A.Item,{label:t("First name"),name:"firstName",children:(0,I.jsx)(d.A,{placeholder:t("Enter your first name")})})]}),(0,I.jsx)(n.A,{span:12,children:(0,I.jsx)(a.A.Item,{label:t("Last name"),name:"lastName",children:(0,I.jsx)(d.A,{placeholder:t("Enter your last name")})})})]}),(0,I.jsxs)(i.A,{gutter:16,children:[(0,I.jsx)(n.A,{span:12,children:(0,I.jsx)(a.A.Item,{label:t("Email"),name:"email",children:(0,I.jsx)(d.A,{disabled:!0,placeholder:t("Enter your email")})})}),(0,I.jsx)(n.A,{span:12,children:(0,I.jsx)(a.A.Item,{label:t("Theme"),name:"theme",children:(0,I.jsx)(s.A,{placeholder:t("Select a theme"),children:H.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,I.jsx)(N,{value:e.value,children:o},e.value)}))})})})]}),(0,I.jsxs)(i.A,{gutter:16,children:[(0,I.jsx)(n.A,{span:12,children:(0,I.jsx)(a.A.Item,{label:t("Newsletter Subscription"),valuePropName:"checked",name:["newsLetterConsent"],children:(0,I.jsx)(c.A,{})})}),(0,I.jsx)(n.A,{span:12,children:(0,I.jsx)(a.A.Item,{label:t("Autosave in editor"),valuePropName:"checked",name:["autosaves"],children:(0,I.jsx)(c.A,{})})})]})]})},{label:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(b.A,{}),t("Code editor")]}),key:"editor",className:"account-settings-codeiditor-tab-content em-analytics__profile-code-editor",children:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(i.A,{gutter:16,children:[(0,I.jsx)(n.A,{span:8,children:(0,I.jsx)(a.A.Item,{label:t("Font size"),name:["codeEditor","fontSize"],children:(0,I.jsx)(S.A,{min:6,max:100})})}),(0,I.jsx)(n.A,{span:8,children:(0,I.jsx)(a.A.Item,{label:t("Tab size"),name:["codeEditor","tabSize"],children:(0,I.jsx)(S.A,{min:1,max:10})})}),(0,I.jsx)(n.A,{span:8,children:(0,I.jsx)(a.A.Item,{label:t("Font family"),name:["codeEditor","fontFamily"],children:(0,I.jsx)(s.A,{placeholder:t("Select a font family"),children:V.map((e=>(0,I.jsx)(N,{value:e.value,children:e.label},e.value)))})})})]}),(0,I.jsxs)(i.A,{gutter:16,children:[(0,I.jsx)(n.A,{span:8,children:(0,I.jsx)(a.A.Item,{label:t("Line wrap"),valuePropName:"checked",name:["codeEditor","wordWrap"],tooltip:{title:Q,icon:(0,I.jsx)(f.A,{})},children:(0,I.jsx)(c.A,{})})}),(0,I.jsx)(n.A,{span:8,children:(0,I.jsx)(a.A.Item,{label:t("Minimap"),valuePropName:"checked",name:["codeEditor","minimap"],tooltip:{title:t("Display the minimap."),icon:(0,I.jsx)(f.A,{})},children:(0,I.jsx)(c.A,{})})}),(0,I.jsx)(n.A,{span:8,children:(0,I.jsx)(a.A.Item,{label:t("Insert spaces"),valuePropName:"checked",name:["codeEditor","insertSpaces"],tooltip:{title:t("Prefer spaces over tabs."),icon:(0,I.jsx)(f.A,{})},children:(0,I.jsx)(c.A,{})})})]})]})},{label:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(v.A,{}),t("Security")]}),key:"security",className:"account-settings-security-tab-content em-analytics__profile-code-editor",children:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(i.A,{gutter:16,children:(0,I.jsx)(n.A,{span:12,children:(0,I.jsx)(a.A.Item,{label:t("Current password"),name:"currentPassword",children:(0,I.jsx)(d.A.Password,{readOnly:!X.currentPassword,onFocus:()=>Y((e=>({...e,currentPassword:!0}))),ref:J,placeholder:t("Enter your current password")})})})}),(0,I.jsxs)(i.A,{gutter:16,children:[(0,I.jsx)(n.A,{span:12,children:(0,I.jsx)(a.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,l){if("security"===G){return e("currentPassword")?l.length>=8&&/[0-9]/.test(l)&&/[a-z]/.test(l)&&/[A-Z]/.test(l)&&/\W+|_/g.test(l)?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,I.jsx)(d.A.Password,{readOnly:!X.newPassword,onFocus:()=>Y((e=>({...e,newPassword:!0}))),placeholder:t("Enter your new password")})})}),(0,I.jsx)(n.A,{span:12,children:(0,I.jsx)(a.A.Item,{label:t("Confirmation"),name:"confirmPassword",validateTrigger:["onSubmit"],rules:[{required:"security"===G,message:t("Repeat the new password")},({getFieldValue:e})=>({validator:(o,l)=>l&&e("newPassword")!==l?Promise.reject(new Error(t("The two passwords that you entered do not match!"))):Promise.resolve()})],children:(0,I.jsx)(d.A.Password,{readOnly:!X.confirmPassword,onFocus:()=>Y((e=>({...e,confirmPassword:!0}))),placeholder:t("Repeat the new password")})})})]})]})}];return(0,I.jsx)(m.A,{width:572,className:"account-settings blocks-modal",title:(0,I.jsxs)("div",{children:[(0,I.jsx)(y.A,{})," ",t("Account settings")]}),open:e,onOk:ee,onCancel:re,centered:!0,footer:[(0,I.jsx)(u.Ay,{size:"large",className:"em-analytics__profile-save",type:"primary",loading:z.isLoading,onClick:ee,children:t("Update")},"Update")],children:(0,I.jsx)(a.A,{form:M,layout:"vertical",name:"edit_profile_form",onFinish:ee,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&&F((0,A.ko)(e.language)),e.codeEditor&&F((0,A.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,I.jsx)(p.A,{activeKey:G,onChange:e=>U(e),items:se})})})}},35285:(e,t,o)=>{o.d(t,{A:()=>I});var l=o(92810),r=o(12280),s=o(2018),a=o(7744),i=o(55039),n=o(96492),d=o(14852),c=o(43005),m=o(86889),u=o(71157),p=o(45934),h=o(23287),g=o(53931),b=o(6790),f=o(31540),v=o(25273),y=o(8375),x=o(84568),_=o(64936),A=o(36404),j=o(85163),k=o(32269),S=o(70082);const w="mainsettings",C="ftpsettings",E="webhooksettings",T=({isModalVisible:e,selectedProject:t=null})=>{const{__:o}=(0,h.s9)(),T=(0,p.wA)(),[I]=r.A.useForm(),N=(0,l.useRef)(null),R=(0,l.useRef)(null),B=(0,l.useRef)(null),L=(0,p.d4)(A.yN),P=(0,p.d4)(_.gU),F=(0,u.hN)(),M=(0,p.d4)(_.cL),[D,z]=(0,l.useState)(w),[O,q]=(0,l.useState)(!1),H=t||L,$=[C,w,E].includes(P),[V,W]=(0,x.OD)();(0,l.useEffect)((()=>{if(M===j.lx.EDIT_PROJECT_MODAL){const e={mainsettings:N,ftpsettings:R,webhooksettings:B};setTimeout((()=>{var t;return null===(t=e[D].current)||void 0===t?void 0:t.focus({cursor:"end"})}),200)}}),[M,D]),(0,l.useEffect)((()=>{$&&z(P)}),[P,$,z,T]);let G=[{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)(s.A,{gutter:24,children:(0,S.jsx)(a.A,{span:24,children:(0,S.jsx)(r.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)(i.A,{ref:N,placeholder:o("Type the project name"),style:{marginBottom:5}})})})})})},{label:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(b.A,{}),o("FTP settings")]}),key:C,className:"em-analytics__ftpsettings-project",children:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(s.A,{gutter:24,children:[(0,S.jsx)(a.A,{span:12,children:(0,S.jsx)(r.A.Item,{label:o("Host"),name:["ftpSettings","host"],children:(0,S.jsx)(i.A,{ref:R,placeholder:o("Type the FTP host"),disabled:O})})}),(0,S.jsx)(a.A,{span:12,children:(0,S.jsx)(r.A.Item,{label:o("Port"),name:["ftpSettings","port"],children:(0,S.jsx)(i.A,{placeholder:o("Type the FTP port"),disabled:O})})})]}),(0,S.jsxs)(s.A,{gutter:24,children:[(0,S.jsx)(a.A,{span:12,children:(0,S.jsx)(r.A.Item,{label:o("Directory"),name:["ftpSettings","directory"],children:(0,S.jsx)(i.A,{placeholder:o("Type the file directory"),disabled:O})})}),(0,S.jsx)(a.A,{span:12,children:(0,S.jsx)(r.A.Item,{label:o("URL catalog"),name:["ftpSettings","domain"],children:(0,S.jsx)(i.A,{placeholder:o("Type the URL catalog"),disabled:O})})})]}),(0,S.jsxs)(s.A,{gutter:24,children:[(0,S.jsx)(a.A,{span:12,children:(0,S.jsx)(r.A.Item,{label:o("Login"),name:["ftpSettings","login"],children:(0,S.jsx)(i.A,{placeholder:o("Type the FTP login"),disabled:O})})}),(0,S.jsx)(a.A,{span:12,children:(0,S.jsx)(r.A.Item,{label:o("Password"),name:["ftpSettings","password"],children:(0,S.jsx)(i.A.Password,{placeholder:o("Type the FTP password"),disabled:O,iconRender:e=>e?(0,S.jsx)(f.A,{}):(0,S.jsx)(v.A,{})})})})]}),(0,S.jsx)(s.A,{gutter:24,children:(0,S.jsx)(a.A,{span:24,children:(0,S.jsx)(r.A.Item,{noStyle:!0,children:(0,S.jsx)(n.A,{checked:O,onChange:e=>q(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:E,className:"em-analytics__mainsettings-project",children:(0,S.jsx)(S.Fragment,{children:(0,S.jsx)(s.A,{gutter:24,children:(0,S.jsx)(a.A,{span:24,children:(0,S.jsx)(r.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.")},$&&{required:!0,message:o("Please type the webhook url.")}],children:(0,S.jsx)(i.A,{ref:B,placeholder:o("Type the project webHook"),style:{marginBottom:5}})})})})})}];(0,l.useEffect)((()=>{if(e&&H){const e=H.ftp_settings;q(e.use_default_cdn),I.setFieldsValue({name:H.title,webhook:H.webhook||"",ftpSettings:{host:e.host||"",port:e.port||"",directory:e.directory||"",domain:e.domain||"",login:e.login||"",password:e.password||""}})}}),[I,H,e]);const U=()=>{I.validateFields().then((e=>{const t=e.ftpSettings;H&&V({projectId:H.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!==H.title?F.success({message:o("The project \u201c")+H.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),T((0,_.YF)("")),T((0,_.Oo)())}))}))};return(0,S.jsx)(d.A,{title:(0,S.jsxs)("div",{children:[(0,S.jsx)(y.A,{})," ",o("Project settings")]}),className:"blocks-modal",open:e,onOk:U,onCancel:()=>{T((0,_.YF)("")),T((0,_.Oo)())},centered:!0,footer:[(0,S.jsx)(c.Ay,{size:"large",className:"em-analytics__project-save",type:"primary",loading:W.isLoading,onClick:U,children:o("Update")},"submit")],children:(0,S.jsx)(r.A,{form:I,layout:"vertical",name:`edit_project_form_${null===H||void 0===H?void 0:H.id}`,onFinish:U,initialValues:{remember:!1,name:""},autoComplete:"off",children:(0,S.jsx)(m.A,{activeKey:D,onChange:z,items:G})})})};T.defaultProps={selectedProject:null};const I=T},58889:e=>{e.exports=JSON.parse('{"yG":"iframe.14f8a673f34d72ec88de.html","l5":"iframe-eblock.14f8a673f34d72ec88de.html"}')}}]);
|