@emailmaker/emailmaker 1.0.59 → 1.0.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +1 -1
  2. package/asset-manifest.json +21 -21
  3. package/emailmaker-esm.js +1 -1
  4. package/emailmaker.d.ts +6 -10
  5. package/emailmaker.js +1 -1
  6. package/iframe/css/sandbox.css +1 -1
  7. package/iframe/{iframe-eblock.4a0a16b398aec444ac01.html → iframe-eblock.1ef394c83ed0138fa7e1.html} +1 -1
  8. package/iframe/{iframe.4a0a16b398aec444ac01.html → iframe.1ef394c83ed0138fa7e1.html} +1 -1
  9. package/iframe/js/cssbeautify.js +1 -1
  10. package/iframe/sandbox-eblock.js +1 -1
  11. package/iframe/sandbox.js +1 -1
  12. package/package.json +1 -1
  13. package/plugin.html +1 -1
  14. package/plugin_blocks_test.html +1 -1
  15. package/plugin_default.html +1 -1
  16. package/plugin_idigital.html +1 -1
  17. package/plugin_s.html +1 -1
  18. package/static/css/2574.1bf580ef.css +1 -0
  19. package/static/js/{3142.506128bd.js → 1122.f394e510.js} +1 -1
  20. package/static/js/1729.a0be903e.chunk.js +1 -0
  21. package/static/js/189.d4e5c06f.js +1 -0
  22. package/static/js/2574.2f48eb7a.js +1 -0
  23. package/static/js/4529.2f2fc56b.js +1 -0
  24. package/static/js/5211.e473201c.js +1 -0
  25. package/static/js/7291.37dee66e.js +1 -0
  26. package/static/js/7967.28137472.js +1 -0
  27. package/static/js/8995.410bef51.js +1 -0
  28. package/static/js/{emailmaker_core.2b09d5b0.js → emailmaker_core.f09929d2.js} +1 -1
  29. package/translations.pot +505 -426
  30. package/static/css/2055.377300a1.css +0 -1
  31. package/static/js/1729.48808a7e.chunk.js +0 -1
  32. package/static/js/189.367ef47a.js +0 -1
  33. package/static/js/2055.3cf7335a.js +0 -1
  34. package/static/js/4529.d148edfe.js +0 -1
  35. package/static/js/5211.638a9803.js +0 -1
  36. package/static/js/7291.e86fd181.js +0 -1
  37. package/static/js/7967.d71d72d8.js +0 -1
  38. package/static/js/8995.1e4e2d7e.js +0 -1
@@ -1 +0,0 @@
1
- "use strict";(globalThis.webpackChunkemail_maker=globalThis.webpackChunkemail_maker||[]).push([[2055],{78451:(e,t,o)=>{o.d(t,{A:()=>n});var s=o(92810),r=o(45934),l=o(64617),a=o(86739),i=o(65983);const n=()=>{const e=(0,r.wA)(),t=(0,r.d4)(i.zn);let o=(0,l.zy)();(0,s.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:()=>l});var s=o(92810),r=o(45695);function l(e,t){const o=(0,r.QC)();(0,s.useEffect)((()=>{const s=o.addListener(e,t);return()=>{s.dispose()}}),[o,e,t])}},31844:(e,t,o)=>{o.d(t,{A:()=>n});var s=o(92810),r=o(64617),l=o(45934),a=o(86286),i=o(84568);const n=e=>{const t=(0,l.d4)(a.C1),[o,n]=(0,s.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,s.useEffect)((()=>{if(m){var e,o;const{owner:s,admins:r,users:l}=m.members,a=r?r.map((e=>e.ID)):r,i=l?l.map((e=>e.ID)):l;n({owner:(null===(e=s.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 s=o(92810),r=o(45934),l=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,l.zy)();(0,s.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 s=o(92810),r=o(45934),l=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,l.zy)();(0,s.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 s=o(85163);const r=e=>{if(!s.EW.isPlugin){let t="";t="EmailMaker",document.title=e+" - "+t}}},46950:(e,t,o)=>{o.d(t,{A:()=>c});o(92810);var s=o(95838),r=o(64617),l=o(66522),a=o(70082);const i=({className:e,style:t,color:o,text:s,bordered:r,...i})=>{const n=s||"";return(0,a.jsx)(l.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:l})=>{const{__:c,_n:m}=(0,n.s9)(),u=(0,r.Zp)(),p=(0,d.rD)(),{token:h}=s.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:l,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 s=o(92810),r=o(12280),l=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,s.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)(),j=(0,s.useCallback)((()=>{o.resetFields(),setTimeout((()=>{var e;return null===(e=f.current)||void 0===e?void 0:e.focus()}),0)}),[o]);(0,s.useEffect)((()=>{v&&j()}),[v,j]);const A=()=>t((0,u.Oo)()),S=()=>{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),A()}))};return(0,g.jsx)(l.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:S,onCancel:A,className:"new-folder-modal",centered:!0,footer:[(0,g.jsx)(a.Ay,{type:"primary",size:"large",onClick:S,children:e("Generate Email")},"submit")],children:(0,g.jsx)(r.A,{form:o,layout:"vertical",name:"add_new_folder_form",onFinish:S,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:()=>k});var s=o(92810),r=o(12280),l=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),j=o(56991),A=o(85163),S=o(70082);const k=({isModalVisible:e,htmlContent:t,projectId:o})=>{const{__:k}=(0,g.s9)(),w=(0,h.wA)(),[C]=r.A.useForm(),[E,I]=(0,s.useState)([]),[T,N]=(0,f.pP)(),{data:R}=(0,f.h1)(),L=(0,m.hN)(),B=(0,j.rD)(),[P,F]=(0,s.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,A.YY).find((e=>e.name===O)),H=(0,_._q)(M,A.YY)||[],V=null===H||void 0===H?void 0:H.map((e=>e.id)),[$,W]=(0,f.Gr)(),[U,G]=(0,v.OD)();(0,s.useEffect)((()=>{F((0,_._q)(M,A.YY).map((e=>({value:e.name}))))}),[M]),(0,s.useEffect)((()=>{if(R){const e=R.schema.properties.acf.properties.type.items.enum;let t=[];for(let o in e)t.push({label:k(A.jg[e[o]]),value:e[o]});I(t)}}),[R,k]);const X=()=>{C.validateFields().then((e=>{const s=e.tags;if((null===s||void 0===s?void 0:s.length)>10)return void L.error({id:"BLOCK_TOO_MANY_TAGS_ERROR",data:(0,m.x_)(e),message:k("Maximum 10 tags available."),placement:"bottomRight"});const r=r=>{const l=null===s||void 0===s?void 0:s.map((e=>{const t=null===H||void 0===H?void 0:H.find((t=>t.name===e));return t?t.id:$({name:e,parent:r}).then((({error:t,data:o})=>{var s,r;return 400===(null===t||void 0===t?void 0:t.status)?null===t||void 0===t||null===(s=t.data)||void 0===s||null===(r=s.data)||void 0===r?void 0:r.term_id:o?o.id:void(t&&L.fromError("TAG_CREATING_ERROR",e,t))}))})),a=(e,s=[])=>{T({title:e.title,project:o,html:t,type:e.type?e.type:"Other",blocktags:s.join(",")}).then((r=>{if(r.error)return L.error({id:"BLOCK_CREATING_ERROR",data:{title:e.title,html:t},innerException:r.error,message:(0,S.jsx)("div",{dangerouslySetInnerHTML:{__html:r.error.data.code}}),description:(0,S.jsx)("div",{dangerouslySetInnerHTML:{__html:r.error.data.message}}),placement:"bottomRight"}),C.resetFields(),void Y();C.resetFields(),Y();let l=new Set([...V,...s]);D(),U({projectId:o,blocktags:[...l].join(",")}).then((e=>{e.error&&L.error({message:(0,S.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.code}}),description:(0,S.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.message}}),placement:"bottomRight"}),L.success({id:"BLOCK_CREATING_SUCCESS",data:(0,m.x_)(r.data),message:k("The block \u201c")+r.data.title+k("\u201d was successfully created."),placement:"bottomRight"}),z()}))}))};l?Promise.all(l).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):$({name:O}).then((async({data:e,error:t})=>{if(t)L.fromError("FOLDER_CREATING_ERROR",O,t);else{const{data:t,error:s}=await U({projectId:o,blocktags:e.id});s?L.fromError("BLOCK_CLONING_ERROR",(0,m.x_)(e),s):t&&r(t.blocktags&&t.blocktags[0])}})).catch((e=>console.error(e)))}))},Y=()=>{w((0,x.Oo)())};return(0,S.jsx)(l.A,{title:(0,S.jsxs)("div",{children:[(0,S.jsx)(u.A,{})," ",k("Add new block")]}),className:"blocks-modal",open:e,onOk:X,onCancel:Y,centered:!0,footer:[(0,S.jsxs)(a.Ay,{size:"large",type:"primary",loading:N.isLoading,onClick:X,children:[(0,S.jsx)(y.h,{className:"modal-new-block__icon-create"}),k("Create block")]},"submit")],children:(0,S.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,S.jsxs)(i.A,{gutter:16,children:[(0,S.jsxs)(n.A,{span:12,children:[" ",(0,S.jsx)(r.A.Item,{label:k("Block name"),name:"title",rules:[{required:!0,message:k("Please input block name")}],style:{marginBottom:15},children:(0,S.jsx)(d.A,{disabled:N.isLoading||W.isLoading||G.isLoading,size:"large",placeholder:k("Enter block name"),spellCheck:"false"})})]}),(0,S.jsx)(n.A,{span:12,children:(0,S.jsx)(r.A.Item,{label:k("Type"),name:"type",rules:[{required:!0,message:k("Please choose block type")}],style:{marginBottom:15},children:(0,S.jsx)(c.A,{disabled:N.isLoading||W.isLoading||G.isLoading,size:"large",placeholder:k("Choose block type"),options:E})})})]}),B.tagsEnabled&&(0,S.jsx)(r.A.Item,{label:k("Tags"),name:"tags",children:(0,S.jsx)(c.A,{size:"large",mode:"tags",placeholder:k("Add some tags"),tooltip:{title:k("Tags help you find the block in the list."),icon:(0,S.jsx)(p.A,{})},disabled:N.isLoading||W.isLoading||G.isLoading,options:P})})]})})}},28288:(e,t,o)=>{o.d(t,{A:()=>v});var s=o(92810),r=o(14852),l=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,s.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)(l.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 s=o(92810),r=o(12280),l=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,s.useRef)(null),j=(0,d.d4)(p.cL)===h.lx.ADD_NEW_FOLDER_MODAL,A=(0,n.hN)(),S=`project_${e.id}`,[k]=(0,m.OD)(),[w]=(0,u.f1)(),C=(0,s.useCallback)((()=>{x.resetFields(),setTimeout((()=>{var e;return null===(e=_.current)||void 0===e?void 0:e.focus({cursor:"start"})}),0)}),[x]);(0,s.useEffect)((()=>{j&&C()}),[j,C]);const E=()=>y((0,p.Oo)()),[I,T]=(0,u.Yb)(),[N,R]=(0,s.useState)(!1),[L,B]=(0,s.useState)(t),P=()=>{x.validateFields().then((({name:t})=>(R(!0),L?I({name:t,parent:L}).then((({data:e,error:t})=>{t?(0,g.p6)({error:t},A):(A.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:L}))})):I({name:S}).then((({data:s,error:r})=>{if(!r)return k({projectId:e.id,[o]:s.id||L}).then((({data:e,error:s})=>{if(r)(0,g.p6)({error:r},A);else if(e)return I({name:t,parent:e[o][0]}).then((({data:t,error:s})=>{if(!s)return A.success({message:f("The folder \u201c")+t.name+v("\u201d was successfully created.","folder"),placement:"bottomRight"}),B(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},A)}));(0,g.p6)({error:s},A)}))}));(0,g.p6)({error:r},A)})).catch((e=>console.error(e))).finally((()=>R(!1)))))).catch((e=>console.error(e))).finally((()=>R(!1)))};return(0,b.jsx)(l.A,{title:f("Add a new folder"),open:j,onOk:P,onCancel:E,className:"new-folder-modal",centered:!0,footer:[(0,b.jsx)(a.Ay,{type:"primary",size:"large",loading:T.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:T.isLoading,size:"large",placeholder:f("Enter the folder name"),ref:_,style:{marginBottom:5}})})})})}},58353:(e,t,o)=>{o.d(t,{A:()=>v});var s=o(92810),r=o(12280),l=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,s.useRef)(null),j=(0,d.d4)(p.cL)===g.lx.ADD_NEW_GROUP_MODAL,A=(0,n.hN)();let S;({data:S}=(0,b.KC)());const k=`project_${S.id}`,w=null===(t=S[g.bV.GROUP])||void 0===t?void 0:t[0],[C]=(0,m.OD)(),[E]=(0,u.y$)(),I=(0,s.useCallback)((()=>{x.resetFields(),setTimeout((()=>{var e;return null===(e=_.current)||void 0===e?void 0:e.focus({cursor:"start"})}),0)}),[x]);(0,s.useEffect)((()=>{j&&I()}),[j,I]);const T=()=>y((0,p.Oo)()),[N,R]=(0,u.JI)(),[L,B]=(0,s.useState)(!1),[P,F]=(0,s.useState)(w),M=()=>{const t=(t,s)=>C({projectId:S.id,[e]:s||P}).then((async s=>{if("error"in s)(0,h.p6)(s,A);else if("data"in s){let r=s.data;const l=await N({name:t,parent:r[e][0]});if(!("error"in l))return A.success({message:o("The group \u201c")+l.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?T():t&&(0,h.p6)({error:t},A)}));(0,h.p6)(l,A)}}));x.validateFields().then((({name:s})=>(B(!0),console.log("currentParentGroupId",P),P?N({name:s,parent:P}).then((t=>{"error"in t?(0,h.p6)(t,A):(A.success({message:o("The group \u201c")+t.data.name+v("\u201d was successfully created.",e),placement:"bottomRight"}),T(),E({parent:P}))})):N({name:k}).then((e=>{if(!("error"in e))return t(s,e.data.id);{console.log("res",e);const{data:o}=e.error;if("term_exists"===o.code&&o.data.term_id)return t(s,o.data.term_id);(0,h.p6)(e,A)}})).catch((e=>console.error(e))).finally((()=>B(!1)))))).catch((e=>console.error(e))).finally((()=>B(!1)))};return(0,f.jsx)(l.A,{title:o("Add a new group"),open:j,onOk:M,onCancel:T,className:"new-group-modal",centered:!0,footer:[(0,f.jsx)(a.Ay,{type:"primary",size:"large",loading:R.isLoading||L,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 s=o(92810),r=o(12280),l=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,s.useRef)(null),x=(0,d.Zp)(),_=(0,n.hN)(),j=(0,c.d4)(h.C1),A=(0,b.u)(),[S,k]=(0,u.lD)();(0,s.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=>(A({event:"submit_form",action:"create_new_project",label:e.name}),S({title:e.name,members:{owner:j.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)(l.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:k.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:k.isLoading,size:"large",placeholder:t("Enter the project name"),ref:y,style:{marginBottom:5}})})})})}},43319:(e,t,o)=>{o.d(t,{A:()=>H});var s=o(92810),r=o(38883),l=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),j=o(49343),A=o(62303),S=o(85163),k=o(65983),w=o(47358),C=o(45695),E=o(56991),I=o(70082);const{backgroundColor:T,backgroundImage:N,backgroundPositionX:R,backgroundPositionY:L,backgroundRepeat:B,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={[T]:"",[N]:"",[R]:"",[L]:"",[B]:"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)(),[V]=i.A.useForm(),$=(0,C.XW)(),W=(0,y.d4)(k.uJ),U=(0,y.d4)(k.iy),G=(0,y.d4)(w.B),X=(0,y.d4)(k.mD),[Y,K]=(0,s.useState)(!0),Z=M("Email not yet loaded or global container not found.");(0,s.useEffect)((()=>{X&&(q((0,k.S_)(!1)),$({operation:S.Ru.INIT_PREVIEW}))}),[V,X,q,$,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,s.useEffect)((()=>{var e,t,o,s;V.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[B]?"repeat":W[B],backgroundSize:W[P],responsive:null===(s=W.responsive)||void 0===s?void 0:s.shutdown}),K(!W.backgroundImage)}),[W,V]);return(0,I.jsx)("div",{className:l()("appearance-panel",{[e]:e}),children:(0,I.jsxs)(i.A,{form:V,layout:"vertical",name:"appearance_panel_form",initialValues:{remember:!1,...z},onValuesChange:e=>{var t;const o=V.getFieldsValue(!0),s=Object.keys(e)[0];switch(s){case R:case L:$({operation:S.Ru.SANDBOX_EMAIL_SETTINGS_SET,settings:{[s]:""===e[s]?"none":e[s]}});break;case N:K(""===e[s]),$({operation:S.Ru.SANDBOX_EMAIL_SETTINGS_SET,settings:{[s]:[{...null===W||void 0===W||null===(t=W.backgroundImage)||void 0===t?void 0:t[0],type:"url",value:e[s]}],backgroundSize:"cover"}});break;case F:$({operation:S.Ru.SANDBOX_EMAIL_SETTINGS_SET,settings:{responsive:{shutdown:e[s],styles:e[s]},width:o.width}});break;default:$({operation:S.Ru.SANDBOX_EMAIL_SETTINGS_SET,settings:e})}},autoComplete:"off",className:"element-controls",children:[U?(0,I.jsx)(n.A,{style:{marginBottom:"24px"},message:Z,type:"error"}):null,(0,I.jsxs)(i.A.Item,{style:{marginBottom:"0"},children:[(0,I.jsx)("div",{className:"form-group-title",style:{paddingTop:0},children:M("Email layout width")}),(0,I.jsx)(d.A,{gutter:10,children:(0,I.jsx)(c.A,{span:12,children:(0,I.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,I.jsx)(i.A.Item,{name:"width",style:{marginBottom:D.formItemMarginBottomXS},children:(0,I.jsx)(u.A,{min:0,placeholder:M("Width"),prefix:(0,I.jsx)(v.A,{}),disabled:!(null!==(r=W.width)&&void 0!==r&&r.value),addonAfter:"px"})})})})}),(0,I.jsx)(d.A,{gutter:20,children:(0,I.jsx)(c.A,{span:24,children:(0,I.jsxs)(p.A,{size:8,align:"baseline",children:[(0,I.jsx)(i.A.Item,{name:"responsive",valuePropName:"checked",children:(0,I.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})),$({operation:S.Ru.SANDBOX_IFRAME_SETSIZE,settings:{iframeWidth:document.querySelector(".email-pane__iframe").getBoundingClientRect().width}})}})}),(0,I.jsx)("div",{className:"ant-form-item-switch-label",children:(0,I.jsx)("label",{htmlFor:"responsive",style:{verticalAlign:"middle"},children:M("Responsive email")})})]})})})]}),(0,I.jsx)(g.A,{className:"selected-td-form__divider"}),(0,I.jsx)("div",{className:"form-group-title",children:M("Email background color")}),(0,I.jsxs)(d.A,{gutter:10,style:{paddingBottom:Y?16:4},children:[(0,I.jsx)(c.A,{span:12,children:(0,I.jsx)(m.A,{trigger:["hover"],title:M("Background color"),placement:"bottom",children:(0,I.jsx)(i.A.Item,{name:T,style:{marginBottom:D.formItemMarginBottomXS},rules:[{message:M("Please set the background color")}],children:(0,I.jsx)(_.A,{placeholder:M("Background color"),usedColors:W.usedColors})})})}),(0,I.jsx)(c.A,{span:Y?12:24,children:H.formEmailFieldBackgroundImageEnabled&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(j.A,{form:V,label:M("Background image"),name:N,tooltipTitle:M("Background image"),disabled:U||"Styles"!==G,elementSettings:W}),!Y&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(i.A.Item,{style:{marginBottom:"0"},children:(0,I.jsxs)(d.A,{gutter:10,children:[(0,I.jsx)(c.A,{span:12,children:(0,I.jsx)(m.A,{trigger:["hover"],title:M("Horizontal position"),placement:"bottom",children:(0,I.jsx)(i.A.Item,{name:R,style:{marginBottom:D.formItemMarginBottomXS},children:(0,I.jsx)(b.A,{placeholder:M("Horizontal position"),prefix:(0,I.jsx)(A.A,{icon:"BgPositionHorizontal"})})})})}),(0,I.jsx)(c.A,{span:12,children:(0,I.jsx)(m.A,{trigger:["hover"],title:M("Vertical position"),placement:"bottom",children:(0,I.jsx)(i.A.Item,{name:L,style:{marginBottom:D.formItemMarginBottomXS},children:(0,I.jsx)(b.A,{placeholder:M("Vertical position"),prefix:(0,I.jsx)(A.A,{icon:"BgPositionVertical"})})})})})]})}),(0,I.jsxs)(d.A,{gutter:10,children:[(0,I.jsx)(c.A,{span:12,children:(0,I.jsx)(m.A,{trigger:["hover"],title:M("Background image repeat"),placement:"bottom",children:(0,I.jsx)(i.A.Item,{name:B,children:(0,I.jsx)(f.A,{placeholder:M("Please select"),disabled:U,options:J,getPopupContainer:e=>e.parentNode})})})}),(0,I.jsx)(c.A,{span:12,children:(0,I.jsx)(m.A,{trigger:["hover"],title:M("Background image size"),placement:"top",children:(0,I.jsx)(i.A.Item,{name:P,children:(0,I.jsx)(f.A,{placeholder:M("Please select"),disabled:U,options:Q,getPopupContainer:e=>e.parentNode})})})})]})]})]})})]}),(0,I.jsx)(g.A,{className:"selected-td-form__divider"}),(0,I.jsx)("div",{className:"form-group-title",children:M("Content background color")}),(0,I.jsx)(m.A,{trigger:["hover"],title:M("Content background color"),placement:"bottom",children:(0,I.jsx)(i.A.Item,{name:"backgroundColorContent",style:{marginBottom:D.formItemMarginBottomMD+4},rules:[{message:M("Please set the background color")}],children:(0,I.jsx)(_.A,{placeholder:M("Background color"),isDisabled:void 0===W.backgroundColorContent,usedColors:W.usedColors})})})]})})};q.defaultProps={className:""};const H=q},16106:(e,t,o)=>{o.d(t,{A:()=>O});var s=o(92810),r=o(81e3),l=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),j=o.n(_),A=o(19032),S=o(48304),k=o.n(S),w=o(59817),C=o(79757),E=o(78588),I=o.n(E),T=o(40829),N=o.n(T),R=o(62303),L=o(92779),B=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)(B.B$),f=(0,D.d4)(B.C1),y=(0,D.d4)(B.B),_=(0,F.X7)(),S=(0,F.Qi)(),[E,T]=(0,s.useState)(!1),[O,q]=(0,s.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 V=[];m.elementImageEnabled&&V.push({title:d("Image"),icon:(0,z.jsx)(R.A,{icon:"ElementImage"}),html:i.A,className:"",name:"image"}),m.elementAIimageEnabled&&V.push({title:d("AI image"),icon:(0,z.jsx)(R.A,{icon:"ElementImageAI"}),html:n.A,className:"ai",name:"ai-image"}),m.elementTextEnabled&&V.push({title:d("Text"),icon:(0,z.jsx)(R.A,{icon:"ElementText"}),html:c()(o),className:"",name:"text"}),m.elementHeaderEnabled&&V.push({title:d("Header"),icon:(0,z.jsx)(R.A,{icon:"ElementTitle"}),html:u()(o),className:"",name:"header"}),m.elementButtonEnabled&&V.push({title:d("Button"),icon:(0,z.jsx)(R.A,{icon:"ElementButton"}),html:h()(o),className:"",name:"button"}),m.elementSpacerEnabled&&V.push({title:d("Spacer"),icon:(0,z.jsx)(R.A,{icon:"ElementSpacer"}),html:j(),className:"",name:"spacer"}),m.elementListULEnabled&&V.push({title:d("List UL"),icon:(0,z.jsx)(R.A,{icon:"ElementListUL"}),html:b()(o),className:"",name:"list-ul"}),m.elementListOLEnabled&&V.push({title:d("List OL"),icon:(0,z.jsx)(R.A,{icon:"ElementListOL"}),html:v()(o),className:"",name:"list-ol"}),m.elementDividerEnabled&&V.push({title:d("Divider"),icon:(0,z.jsx)(R.A,{icon:"ElementDivider"}),html:x(),className:"",name:"divider"}),m.elementSocialEnabled&&V.push({title:d("Social media"),icon:(0,z.jsx)(R.A,{icon:"ElementSocial"}),html:A.A,className:"",name:"social"}),m.elementTableEnabled&&V.push({title:d("Table"),icon:(0,z.jsx)(R.A,{icon:"ElementTable"}),html:k()(o),className:"",name:"table"}),m.elementCountdownEnabled&&V.push({title:d("Countdown"),icon:(0,z.jsx)(R.A,{icon:"ElementCountdown"}),html:(0,w.A)(y),className:"",name:"countdown"}),m.elementVideoEnabled&&V.push({title:d("Video"),icon:(0,z.jsx)(R.A,{icon:"ElementVideo"}),html:C.A,className:"",name:"video"}),m.elementCarouselEnabled&&V.push({title:d("Carousel"),icon:(0,z.jsx)(R.A,{icon:"ElementCarousel"}),html:I()(o),className:"amp",name:"amp-carousel"}),m.elementAccordionEnabled&&V.push({title:d("Accordion"),icon:(0,z.jsx)(R.A,{icon:"ElementAccordion"}),html:N()(o),className:"amp",name:"amp-accordion"}),m.elementFormEnabled&&V.push({title:d("Form"),icon:(0,z.jsx)(R.A,{icon:"ElementForm"}),html:null,className:"amp",name:"amp-form"});const $=e=>!H||"ai-image"!==e.name||(setTimeout((()=>{T(!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:V&&V.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=>S(t,e,$),"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)(l.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)(L.A,{open:E,onCancel:()=>T(!1),initialSlide:O})]})}},59297:(e,t,o)=>{o.d(t,{A:()=>V});var s=o(92810),r=o(41919),l=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}=l.A,b=({className:e,fontSize:t,to:o})=>{const{token:s}=g();return(0,h.jsx)(d.N_,{className:p()("app-logo",{[e]:e}),style:{fontSize:t?`${t}px`:"40px",color:s.colorText},to:o,children:(0,h.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:j}=l.A,A={},S={width:1012,color:"#fff",textAlign:"center",height:"100%"};var k;!function(e){e.fade="fade",e.scrollx="scrollx"}(k||(k={}));const w=({data:e=[],sliderStyle:t=A,coruselStyle:o=S,customDots:s=!1,carouselRef:r,effect:l=k.fade,header:a=!1,...i})=>{const{token:n}=j();return(0,h.jsxs)(h.Fragment,{children:[s&&(0,h.jsx)("div",{className:"custom-dot",children:e.length}),(0,h.jsx)(_.A,{style:o,ref:r,effect:l,...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 I={position:"relative",display:"inline-block",margin:20,width:50,height:50,borderRadius:"50%",overflow:"hidden",cursor:"pointer"},T={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:l})=>{const[a,i]=(0,s.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,s.useEffect)((()=>{if(t){let e=Date.now();const t=setInterval((()=>{const o=Date.now()-e,s=Math.min(o/r*100,100);i(s),100===s&&(clearInterval(t),l())}),10);return()=>clearInterval(t)}i(0)}),[t,r,l]),(0,h.jsxs)("div",{style:{...I,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:T}),(0,h.jsx)(E.A,{icon:e,style:N})]})},L=({carouselRef:e})=>{const[t,o]=(0,s.useState)(0),[r,l]=(0,s.useState)(!0),a=8e3,i=(0,s.useRef)(null),n=["SliderGroup","SliderTemplates","SliderBlocks","SliderAdaptive","SliderMagic"];(0,s.useEffect)((()=>{var o;null===(o=e.current)||void 0===o||o.goTo(t)}),[t,e]);const d=()=>{var s;null===(s=e.current)||void 0===s||s.goTo((t+1)%n.length),o((e=>(e+1)%n.length))};return(0,s.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,s.useEffect)((()=>{l(!0)}),[]),(0,h.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",paddingTop:10},children:n.map(((e,s)=>(0,h.jsx)(R,{icon:e,isActive:t===s,onClick:()=>(e=>{o(e),l(!1)})(s),duration:a,onComplete:d},s)))})},B=(0,s.forwardRef)((({data:e=[],sliderStyle:t,customDots:o=!1,...r},l)=>{const a=(0,s.useRef)(null);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(L,{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}=l.A,V=({children:e})=>{var t,o;const{__:l}=(0,c.s9)(),{token:u}=H(),p=(0,n.Zp)(),[g,_]=(0,s.useState)(!1),j=(0,x.p6)(),[,A]=(0,d.ok)(),[S]=(0,m.UH)(),k=(0,n.zy)(),w=null===k||void 0===k||null===(t=k.state)||void 0===t||null===(o=t.from)||void 0===o?void 0:o.search;return(0,s.useEffect)((()=>{w&&A(w)}),[w,A]),(0,s.useEffect)((()=>{(0,y.FN)(u)}),[u]),(0,s.useEffect)((()=>{j.get(v.A9.em_token)?S().then((e=>{if(e.error)return j.remove(v.A9.em_token),void _(!0);p("/projects",{replace:!0})})):_(!0)}),[p,S,j]),(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:l("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)(B,{data:O})})})})]})}):(0,h.jsx)(f.A,{})})}},92267:(e,t,o)=>{o.d(t,{A:()=>j});var s=o(92810),r=o(38883),l=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)(),j=t("Block not yet loaded or global container not found.");(0,s.useEffect)((()=>{y.setFieldsValue({width:o.width.value,widthDim:o.width.dim})}),[o,y]);return(0,b.jsx)("div",{className:l()("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 s;switch(o){case"width":s={[o]:{value:e[o],dim:t.widthDim}};break;case"widthDim":s={width:{value:t.width,dim:e[o]}};break;default:return}_({operation:p.Ru.SANDBOX_BLOCK_SETTINGS_SET,settings:s})},autoComplete:"off",children:[r?(0,b.jsx)(n.A,{style:{marginBottom:"24px"},message:j,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 j=_},98519:(e,t,o)=>{o.d(t,{A:()=>M});var s=o(92810),r=o(95838),l=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),j=o(84007),A=o(84568),S=o(55701),k=o(47358),w=o(85163),C=o(32269),E=o(42068),I=o(70082);const T=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:L}={name:"name",type:"type",tags:"tags"},B={[N]:"",[R]:[],[L]:[]},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]=l.A.useForm(),{data:q}=(0,S.h1)(),{token:H}=F(),{__:V,_x:$}=(0,v.s9)(),W=(0,u.hN)(),{modal:U}=a.A.useApp(),{confirm:G}=U;let X=(0,b.zy)();const Y=(0,f.d4)(k.V$),K=(0,s.useRef)(null),Z=(0,s.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,s.useRef)(null),ee=(0,s.useRef)(null),te=(0,s.useRef)(null),oe=(0,f.Pj)();(0,s.useEffect)((()=>{var e;null===(e=Z.current)||void 0===e||e.scrollTo({top:0})}),[t,o]);const{data:se}=A.Nq.endpoints.getProject.select(+M)(oe.getState()),[re,le]=(0,s.useState)({projectId:M,pageSize:1e3,page:1,tags:null,name:null,type:null,notEmbed:!0,order:"asc",orderby:"title"});(0,s.useEffect)((()=>{o||(O.setFieldsValue(B),Fe({type:null,name:null}),r())}),[o,O,r]),(0,s.useEffect)((()=>{if(q){const e=q.schema.properties.acf.properties.type.items.enum;let t=[];for(let o in e)t.push({label:V(w.jg[e[o]]),value:e[o]})}}),[q,V]);const{isSuccess:ae,isError:ie,isLoading:ne,isFetching:de,data:ce,refetch:me,error:ue}=(0,S.SB)({...re,page:1}),pe=(0,s.useMemo)((()=>{if(ae&&ce)return[...ce].sort(((e,t)=>P[e.type]-P[t.type]))}),[ae,ce]),[he,ge]=(0,s.useState)([]);(0,E.Z)((e=>{e!==ie&&W.fromError("BLOCK_GET_ERROR",{},ue,!0)}),[ie,ue,W]);const[be,fe]=(0,s.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,S.OD)({...be,emailId:e,page:1},{skip:!e||Y.length}),je=(0,s.useMemo)((()=>{if(ve||Y.length)return[...Y].sort(((e,t)=>P[e.type]-P[t.type]))}),[ve,Y]),[Ae,Se]=(0,s.useState)([]);(0,s.useEffect)((()=>{const e=new Set;if(Y.length&&je){for(const t of je)t.type&&e.add(t.type);Se(Array.from(e))}else Se([])}),[Y,je]);const[ke,we]=(0,s.useState)({pageSize:1e3,page:1,notEmbed:!0,name:null,type:null}),{isSuccess:Ce,isError:Ee,isLoading:Ie,isFetching:Te,data:Ne=[]}=(0,S.kz)({...ke,page:1}),Re=(0,s.useMemo)((()=>{if(Ne.length)return[...Ne].sort(((e,t)=>P[e.type]-P[t.type]))}),[Ne]),[Le,Be]=(0,s.useState)([]);(0,s.useEffect)((()=>{const e=new Set;if(Re&&Ne.length){for(const t of Re)t.type&&e.add(t.type);Be(Array.from(e))}}),[Ne.length,Re]);const Pe=(0,s.useMemo)((()=>{const e=new Set;for(const t of he)e.add(t);for(const t of Ae)e.add(t);for(const t of Le)e.add(t);return Array.from(e)}),[Le,Ae,he]),Fe=e=>{le((t=>({...t,...e,page:1}))),fe((t=>({...t,...e,page:1}))),we((t=>({...t,...e,page:1})))},Me=(0,s.useCallback)((()=>{document.querySelector(".blocks-search__result-wrapper.is_search")&&(document.querySelector(".blocks-search__result-wrapper").style.removeProperty("transition"),document.querySelector(".blocks-search__result-wrapper").style.opacity=0,document.querySelectorAll(".blocks-search__result-body").forEach((e=>e.style.removeProperty("height"))),document.querySelectorAll(".blocks-search__result-body").forEach((e=>{e.style.height=207*e.offsetHeight/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,s.useEffect)((()=>{Te||Ie||!Ce||"template"===t||(o?Me():r())}),[Te,Ie,Ce,Me,re.name,r,o,t]),(0,s.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,s=document.querySelector(".block-search__preview-content")?document.querySelector(".block-search__preview-content"):null;document.querySelector(".block-search__preview")||(t=document.createElement("div"),t.classList.add("block-search__preview"),o=document.createElement("div"),o.classList.add("block-search__preview-title"),s=document.createElement("div"),s.classList.add("block-search__preview-content"),t.append(s),t.append(o),document.querySelector(".email-pane__col_settings-inner").append(t)),o.innerHTML="",s.innerHTML="",o.innerHTML=e.title;let r=e.html.replaceAll(/<style((.|\n|\r)*?)<\/style>/gi,"").trim();s.innerHTML=T('<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,s.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,s.useEffect)((()=>{ne||de||r()}),[ne,de,r]),(0,s.useEffect)((()=>{("common"===t||o)&&setTimeout(r,50)}),[ce,r,t,o]);const Ve=e=>{G({maskClosable:!0,centered:!0,title:$("Are you sure you want to delete the \u201c","block")+e.title+V("\u201d block?"),icon:(0,I.jsx)(p.A,{}),okText:V("Yes"),cancelText:V("No"),onOk:()=>(e=>oe.dispatch(S.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:V("The block \u201c")+t.data.title+$("\u201d was successfully removed.","block")}),me()})))(e)})},$e=(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,I.jsx)(p.A,{style:{fontSize:"16px",margin:0}}),style:{color:H.colorError},onClick:()=>Ve(e)}];return!w.EW.isPlugin&&t.unshift({key:"Edit block",className:"blocks-search__result__menu-item",icon:(0,I.jsx)(h.A,{style:{fontSize:"16px",margin:0}}),label:(0,I.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:$e(X,e),children:" "})}),t},Ue=e=>{let t="<tr"===e.html.substring(0,3)?document.createElement("table"):document.createElement("div");var o;(t.replaceChildren(...(0,j.$$)(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,s,r,l,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!==(s=o.borderRadius)&&void 0!==s&&s.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===(l=r.borderRadius)||void 0===l?void 0:l.all))e.style.removeProperty("border-radius");else{var m,u,p,h,g,b,f,v,y,x,_,j,A,S,k,w,C,E,I,T;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===(I=J.cards)||void 0===I?void 0:I.borderRadius.bottomRight)+"px";else""===(null===(_=J.cards)||void 0===_||null===(j=_.borderRadius)||void 0===j?void 0:j.bottomRight)&&e.style.removeProperty("border-bottom-right-radius");if(null!==(A=J.cards)&&void 0!==A&&null!==(S=A.borderRadius)&&void 0!==S&&S.bottomLeft&&e.style.borderBottomLeftRadius&&"0px"!==e.style.borderBottomLeftRadius)e.style.borderBottomLeftRadius=(null===(T=J.cards)||void 0===T?void 0:T.borderRadius.bottomLeft)+"px";else""===(null===(k=J.cards)||void 0===k||null===(w=k.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 s="",r=J.text.fontFamily;if(parseFloat(e.style.fontSize)>14&&(s=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",s)),e.closest(".em-contrast-card, .em-card")||"#ffffff"===Xe(e.style.color).toLowerCase()||(s=e.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${J.text.color};`),e.setAttribute("style",s)),"Safe Fonts"===r[0]?(e.style.fontFamily=r[1],Ge({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="",s=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)),"Safe Fonts"===s[0]?(e.style.fontFamily=s[1],Ge({elem:t})):"Google Fonts"===s[0]&&("Sans Serif"===s[1]?e.style.fontFamily="Helvetica, Arial, sans-serif":"Serif"===s[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-${s[2].replace(/\s/g,"")}-${s[3].replace(/\s/g,"")}`),Ye({elem:t,fontFamilyArray:s}));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(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 J.buttons.backgroundColor&&(o=e.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${J.buttons.backgroundColor};`),e.setAttribute("style",o));else if(o=e.getAttribute("style").replace(/color:(\s+)?.*?;/,`color: ${J.buttons.color};`),e.setAttribute("style",o),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 s=J.buttons.fontFamily;"Safe Fonts"===s[0]?(e.style.fontFamily=s[1],Ge({elem:t})):"Google Fonts"===s[0]&&("Sans Serif"===s[1]?e.style.fontFamily="Helvetica, Arial, sans-serif":"Serif"===s[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-${s[2].replace(/\s/g,"")}-${s[3].replace(/\s/g,"")}`),Ye({elem:t,fontFamilyArray:s})),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)}let s="";s=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",s),"Safe Fonts"===o[0]?(e.style.fontFamily=o[1],Ge({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.querySelectorAll('[em="block"]')&&null!==(o=J.block)&&void 0!==o&&o.backgroundColor&&t.querySelectorAll('[em="block"]').forEach((e=>{e.querySelectorAll(":scope > td").forEach((e=>{e.setAttribute("bgcolor",J.block.backgroundColor)}))})));return"DIV"===t.tagName?(0,_.uL)(t):(0,_.uL)(t.querySelector("tbody"))},Ge=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),s=parseInt(e[2],10).toString(16);return t=1===t.length?"0"+t:t,o=1===o.length?"0"+o:o,s=1===s.length?"0"+s:s,"#"+t+o+s}}if(e&&"#"===e.charAt(0))return e}const Ye=e=>{var t;const o=e.elem.querySelectorAll("link"),s=`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")===s)))){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",s),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((()=>Ge({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,I.jsxs)("div",{className:x()("blocks-search",{is_search:o}),children:[(0,I.jsx)(l.A,{className:x()("blocks-search__form",{is_search:o}),form:O,layout:"vertical",name:"blocks_search_form",initialValues:{...B},onValuesChange:e=>{const t=Object.keys(e)[0],o=O.getFieldsValue(!0);switch(t){case L:const s=(0,C._q)(se,w.YY).filter((o=>e[t].includes(o.name))).map((e=>e.id))||null;Fe({tags:s});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,I.jsx)(l.A.Item,{name:N,children:(0,I.jsx)(i.A,{placeholder:V("Search by title"),allowClear:!0,suffix:(0,I.jsx)(g.A,{className:"cards-search__search-icon, input-icon",style:{fontSize:"16px",cursor:"pointer"}})})})}),(ie||ye||Ee)&&(0,I.jsx)(n.A,{message:V("Error"),description:V("Error when receiving data. Try again (reload page) or contact support."),type:"error",showIcon:!0}),o&&!He&&(0,I.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,I.jsxs)("ul",{children:[(0,I.jsx)("li",{"data-type":"",className:"active",onClick:De,children:V("All")},"search_All"),Pe.map((e=>(0,I.jsx)("li",{"data-type":e,onClick:De,children:V(w.jg[e])},"search_"+e)))]})}),(0,I.jsxs)("div",{ref:Z,className:x()("blocks-search__result-wrapper",{is_search:o}),children:[("project"===t||o)&&(0,I.jsxs)(I.Fragment,{children:[!!he.length&&!o&&(0,I.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,I.jsxs)("ul",{children:[(0,I.jsx)("li",{"data-type":"",className:"active",onClick:De,children:V("All")},"blocksSections_All"),he.map((e=>(0,I.jsx)("li",{"data-type":e,onClick:De,children:V(w.jg[e])},"blocksSections_"+e)))]})}),(0,I.jsxs)("div",{className:x()("blocks-search__blocks-wrapper",{is_search:o}),ref:Q,children:[(0,I.jsx)("div",{className:"blocks-search__result-holder project",children:!(ne||de)&&(null!==pe&&void 0!==pe&&pe.length?pe.map(((e,t)=>{const o=T('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+e.html+"</table>");return(0,I.jsx)("div",{className:"blocks-search__result","data-type":e.type,children:(0,I.jsx)(d.A,{placement:"leftTop",menu:{items:We(e)},overlayStyle:{minWidth:"auto",paddingRight:6},children:(0,I.jsx)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:t=>D(t,e.html),onDragStart:t=>z(t,e.html),onMouseEnter:()=>Oe({html:e.html,title:e.title}),onMouseLeave:qe,children:(0,I.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,I.jsxs)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:[V("You don`t have any saved blocks yet."),(0,I.jsx)("br",{}),(0,I.jsx)("br",{}),V("To add a block from the dashboard click the"),(0,I.jsx)("br",{}),(0,I.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,I.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"})})," ",V("Save to Blocks button.")]}))}),(ne||de)&&(0,I.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,I.jsx)(m.A,{className:"blocks-search__result-divider"}),("template"===t||o)&&(0,I.jsxs)(I.Fragment,{children:[!!Ae.length&&!o&&(0,I.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,I.jsxs)("ul",{children:[(0,I.jsx)("li",{"data-type":"",className:"active",onClick:De,children:V("All")},"templateBlocksSections_All"),Ae.map((e=>(0,I.jsx)("li",{"data-type":e,onClick:De,children:V(w.jg[e])},"templateBlocksSections_"+e)))]})}),(0,I.jsxs)("div",{className:x()("blocks-search__blocks-wrapper",{is_search:o}),ref:ee,children:[(0,I.jsxs)("div",{className:"blocks-search__result-holder template",children:[Y&&!xe&&!_e&&null!==je&&void 0!==je&&je.length?(0,I.jsx)(I.Fragment,{children:je.map(((e,t)=>{const o=T('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+e.html+"</table>");return(0,I.jsx)("div",{className:"blocks-search__result","data-type":e.type,children:(0,I.jsx)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:t=>D(t,e.html),onDragStart:t=>z(t,e.html),onMouseEnter:()=>Oe({html:e.html,title:e.title}),onMouseLeave:()=>qe(),children:(0,I.jsx)("div",{className:"blocks-search__result-html",dangerouslySetInnerHTML:{__html:o},style:{transform:"scale("+207/660+")"}})})},e.id+t.toString())}))}):!o&&!Ie&&!_e&&(0,I.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:V("No related blocks found.")})," "]}),(xe||_e)&&(0,I.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,I.jsx)(m.A,{className:"blocks-search__result-divider"}),("common"===t||o)&&(0,I.jsxs)(I.Fragment,{children:[!(null===Le||void 0===Le||!Le.length)&&!o&&(0,I.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,I.jsxs)("ul",{children:[(0,I.jsx)("li",{"data-type":"",className:"active",onClick:De,children:V("All")},"commonBlocksSections_All"),Le.map((e=>(0,I.jsx)("li",{"data-type":e,onClick:De,children:V(w.jg[e])},"commonBlocksSections_"+e)))]})}),(0,I.jsxs)("div",{className:x()("blocks-search__blocks-wrapper",{is_search:o}),ref:te,children:[(0,I.jsxs)("div",{className:"blocks-search__result-holder common",children:[Ce&&!(null===Re||void 0===Re||!Re.length)&&!(Te||Ie)&&(0,I.jsx)(I.Fragment,{children:Re.map(((e,t)=>{const o=Ue({html:T('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+e.html+"</table>")});return(0,I.jsx)("div",{className:"blocks-search__result","data-type":e.type,children:(0,I.jsx)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:t=>D(t,Ue({html:e.html})),onDragStart:t=>z(t,Ue({html:e.html})),onMouseEnter:()=>Oe({html:Ue({html:T('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+e.html+"</table>")}),title:e.title}),onMouseLeave:()=>qe(),children:(0,I.jsx)("div",{className:"blocks-search__result-html",dangerouslySetInnerHTML:{__html:o},style:{transform:"scale("+207/660+")"}})})},e.id+t.toString())}))})," "]}),(Ie||Te)&&(0,I.jsx)(c.A,{active:!0})]})]}),He&&(0,I.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:V("There are no blocks for this request.")})]})]})}},29067:(e,t,o)=>{o.d(t,{A:()=>V});var s=o(92810),r=o(95838),l=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),j=o(8114),A=o(74267),S=o(64617),k=o(94822),w=o(45934),C=o(23287),E=o(38883),I=o.n(E),T=o(57903),N=o(43063),R=o(72981),L=o(55701),B=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}`,V=({projectId:e,emailsView:t,createPage:o=!1,currentFolderId:r,foldersList:E,refetchProjectFolders:V,projectTags:$=[],activeTagId:W,setActiveTagHandler:U,projectEmailsCounter:G=0})=>{var X,Y,K,Z,J,Q,ee,te;const{__:oe,_x:se}=(0,C.s9)(),re=(0,w.wA)(),le=(0,w.d4)(B.D2),ae=(0,w.d4)(B.dV),ie=(0,w.d4)(F.C1),ne=(0,w.d4)(B.NP),de=(0,w.d4)(B.qM),ce=(0,w.d4)(B.ux),me=(0,w.d4)(P.b9);let ue=(0,S.zy)();const{owner:pe,admin:he}=(0,D.A)(),ge=(0,S.Zp)(),{token:be}=q(),{modal:fe}=l.A.useApp(),ve=(0,p.hN)(),{confirm:ye}=fe,xe=(0,w.Pj)(),[_e,je]=(0,k.ok)(),{refetch:Ae}=(0,S.KC)(),Se=+_e.get("page"),ke=_e.get("folder"),we=+_e.get("tag"),[Ce,Ee]=(0,L.pP)(),[Ie]=(0,L.R2)(),[Te]=(0,L.OZ)(),[Ne,Re]=(0,s.useState)(!1),Le=r&&r===z.UW,Be=r===z.y2&&!we;(0,s.useEffect)((()=>{re((0,B.FC)())}),[re]);const[Pe,Fe]=(0,s.useState)({projectId:e,page:Be?Se:1,pageSize:z.mU,notEmbed:!0,tags:null,folderTag:null}),{isLoading:Me,isSuccess:De,isError:ze,isFetching:Oe,refetch:qe,error:He}=(0,L.SB)({...Pe,folderTag:null,tags:null,status:"main"},{skip:o||!(null===(X=Pe.name)||void 0===X||!X.length)&&r!==z.y2}),[Ve,$e]=(0,s.useState)({page:Se||1,pageSize:z.mU,folderTag:null,tags:[]}),{isLoading:We,isSuccess:Ue,isError:Ge,isFetching:Xe,data:Ye=[],refetch:Ke,error:Ze}=(0,L.kz)(Ve,{skip:!o||(Math.ceil(le/z.mU)||1)<Ve.page}),[Je,Qe]=(0,s.useState)({projectId:e,page:1,pageSize:z.mU,notEmbed:!0,tags:we&&[we],folderTag:r}),{isLoading:et,isSuccess:tt,isError:ot,isFetching:st,error:rt}=(0,L.SB)({...Je,tags:r&&Je.folderTag?null:Je.tags,status:"custom"},{skip:o||Le||r===z.y2||Je.folderTag!==r||!(null===(Y=Je.name)||void 0===Y||!Y.length)&&(Le||r===z.y2)}),[lt,at]=(0,s.useState)({projectId:e,page:Le?Se:1,pageSize:z.mU,notEmbed:!0,tags:we&&[we],folderTag:null,status:"trash"}),[it,nt]=(0,s.useState)(!1),{isLoading:dt,isSuccess:ct,isError:mt,isFetching:ut,data:pt,refetch:ht,error:gt}=(0,L.SB)({...lt,status:"trash",folderTag:null,page:it?lt.page:1},{skip:o||(Math.ceil(ae/z.mU)||1)<lt.page||!(null===(K=lt.name)||void 0===K||!K.length)&&!Le||!(null===(Z=lt.tags)||void 0===Z||!Z[0])&&ce>0});(0,s.useEffect)((()=>{nt(!!pt||Math.ceil(ae/z.mU)>=lt.page)}),[pt,lt.page,ae]);const bt=o?Ve:Le?lt:Be?Pe:Je,ft=o?Ue:Le?ct:Be?De:tt,vt=o?We:Le?dt:Be?Me:et,yt=o?Ge:Le?mt:Be?ze:ot,xt=o?Xe:Le?ut:Be?Oe:st,_t=o?Ke:Le?ht:Be?qe:()=>{var e;return re(L.VM.endpoints.getBlocks.initiate({...bt,folderTag:r||(null===(e=bt.tags)||void 0===e?void 0:e[0])||!1}))},jt=o?Ze:Le?gt:Be?He:rt,At=(o?le:Le?ae:Be?le: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,St=o?Ye:Le?ce:Be?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,kt=(0,s.useCallback)((e=>{o?$e((t=>({...t,...e}))):Le?at((t=>({...t,...e}))):Be?Fe((t=>({...t,...e}))):Qe((t=>({...t,...e})))}),[o,Le,Be]);(0,s.useEffect)((()=>{var e;"rest_post_invalid_page_number"===(null===jt||void 0===jt||null===(e=jt.data)||void 0===e?void 0:e.code)&&kt({page:1})}),[jt,kt]),(0,s.useEffect)((()=>{if(!o){(ke&&ke!==r||W&&we!==W)&&kt({folderTag:r,page:1});let e={page:ke===r&&bt.page?bt.page:1};r&&!we&&(e.blockfolder=r),W&&(e.tag=W),je(e,{replace:!0})}}),[bt.page,ge,o,ke,r,W,we,kt,je]);const wt=e=>{ye({maskClosable:!0,centered:!0,title:se(Le?"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(L.VM.endpoints.deleteBlock.initiate({id:e.id,force:Le})).then((e=>{e.error?(0,M.p6)(e,ve):e.data&&((0,M.wB)(oe("The block \u201c")+e.data.title+se("\u201d was successfully removed.","block"),ve),_t(),V(),ht(),Ae())})))(e)})},Ct=e=>{Re(!0),Te({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(),V(),ht(),Ae(),ve.success({message:oe("The block \u201c")+e.title+se("\u201d was successfully recovered.","recovery"),placement:"bottomRight"})),Re(!1)}))},Et=e=>{Re(!0),Ie(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+se("\u201d was successfully created.","block"),placement:"bottomRight"})),Re(!1)}))}))},It=(e,t)=>{Te({blockId:t.id,blockfolder:e.key===z.y2?[]:[e.key]}).then((e=>{var o,s;(null===e||void 0===e||null===(o=e.data)||void 0===o?void 0:o.blockfolder[0])&&re(L.VM.endpoints.getBlocks.initiate({...bt,folderTag:(null===e||void 0===e||null===(s=e.data)||void 0===s?void 0:s.blockfolder[0])||null})),r!==z.y2&&(re((0,B.wK)({blockfolder:r,blockId:t.id})),re(L.VM.endpoints.getBlocks.initiate({...bt,folderTag:r||null}))),qe(),V()})).catch((e=>console.warn("err",e)))},Tt=[{width:"26%",title:oe("Block"),dataIndex:"title",render:(e,t,o)=>(0,O.jsx)(k.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===$||void 0===$?void 0:$.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:()=>U(null,t.id),children:t.name},t.id)||null}))})},{width:"3%",title:"",dataIndex:"lock",render:(e,t,o)=>{var s,r;return e&&(0,O.jsx)(g.A,{className:I()("lock-icon",{"lock-icon__disabled":!(pe||he||(null===(s=ie.id)||void 0===s?void 0:s.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 s;return(null===e||void 0===e||null===(s=e[0])||void 0===s?void 0:s.name)||""}},{width:"9%",title:se("Created","block"),className:"nobr",dataIndex:"date",render:(e,t,o)=>(0,M.Yq)((0,A.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,s,r,l,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=>It(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=>It(e,t)}))),A=(null===p||void 0===p?void 0:p.filter((e=>!m||e.key!==m)))||[];m&&(null===A||void 0===A||A.unshift(u));let S=[];return(pe||he||(null===(o=ie.id)||void 0===o?void 0:o.toString())===(null===(s=t.author)||void 0===s?void 0:s.toString()))&&!Le&&S.push({label:(0,O.jsx)(T.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===(l=t.author)||void 0===l?void 0:l.toString()))&&!Le&&A.length>0&&S.push({label:oe("Transfer to folder"),icon:(0,O.jsx)(f.A,{style:{fontSize:"16px"}}),children:A}),!Le&&S.push({label:(0,O.jsx)(k.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()))&&Le&&S.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()))&&S.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:S},trigger:["hover"],children:(0,O.jsx)("span",{className:"projects-table__actions",children:(0,O.jsx)(j.A,{})})})}}],[Nt,Rt]=(0,s.useState)(!1);return(0,s.useEffect)((()=>{var e;for(let t in me)if(t||""===t||0===t.length){Rt(!0),kt({...me,folderTag:r,page:1});break}(null!==(e=me.tags)&&void 0!==e&&e.length||me.name)&&kt({...me,folderTag:r,page:1})}),[me,re,r,Le,kt,o]),(0,O.jsxs)("div",{className:"project-blocks-page__list",children:[vt&&!(null!==St&&void 0!==St&&St.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===St||void 0===St?void 0:St.length)&&(Nt||G>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===St||void 0===St?void 0:St.length)>0&&t===z.rl&&(0,O.jsx)(m.A,{rowKey:e=>e.id,bordered:!0,dataSource:St,columns:Tt,loading:xt||Ne,onChange:(e,t,{order:o,field:s},{action:r})=>{"sort"===r&&kt(o?{page:bt.page||1,order:(0,M.gq)(o),orderby:s,pageSize:z.mU}:{page:bt.page||1,pageSize:z.mU})},showSizeChanger:!1,pageSize:z.mU,pagination:{current:bt.page||1,total:At,hideOnSinglePage:!0,showSizeChanger:!1,pageSize:z.mU,position:["bottomLeft"],onChange:(t,o)=>kt({projectId:e,page:t,pageSize:o})}}),((null===St||void 0===St?void 0:St.length)>0||ft)&&t===z.Y$&&(0,O.jsxs)(O.Fragment,{children:[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:St&&St.map((e=>(0,O.jsx)(N.A,{element:e,setSearchFilters:U,isTrash:Le,foldersList:E,refetch:qe,projectTags:$,foldersHandlers:{handleRemove:wt,handleRecover:Ct,handleClone:Et,handlerChangeFolder:It}},e.id)))}),(0,O.jsx)(u.A,{current:bt.page||1,total:At,hideOnSinglePage:!0,showSizeChanger:!1,pageSize:z.mU,onChange:(t,o)=>kt({projectId:e,page:t,pageSize:o})})]})]})}},21731:(e,t,o)=>{o.d(t,{A:()=>le});o(92810);var s=o(33206),r=o(81e3),l=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),j=o(73259),A=o(66282),S=o(4907),k=o(76207),w=o(26453),C=o(90854),E=o(7205),I=o(59287),T=o(83953),N=o(57903),R=o(62303),L=o(86286),B=o(36404),P=o(47358),F=o(64936),M=o(86739),D=o(4115),z=o(93563),O=o(62677),q=o(48426),H=o(46312),V=o(63531),$=o(31844),W=o(32269),U=o(58689),G=o(71157),X=o(14598),Y=o(44824),K=o(93982),Z=o(90070),J=o(47381),Q=o(56991),ee=o(23287),te=o(32411),oe=o(85163),se=o(13522),re=o(70082);const le=({email:e,autoSaveEmailResult:t,autoSaveBlockResult:o})=>{var le,ae,ie,ne,de,ce,me,ue;const{__:pe,_x:he}=(0,ee.s9)(),ge=(0,d.wA)(),[be]=(0,H.mI)(),[fe]=(0,V.dS)();let ve=(0,n.Zp)();const{owner:ye,admin:xe}=(0,$.A)(),_e=(0,d.d4)(L.C1),je=(0,d.d4)(B.yN),{modal:Ae}=s.A.useApp(),Se=(0,G.hN)(),{confirm:ke}=Ae,we=(0,d.Pj)(),Ce=(0,Z.p6)(),Ee=(0,Q.rD)(),{projectId:Ie}=(0,n.g)(),Te=(0,K.ml)(se.A.ON_EMAIL_CLONE_ID),[Ne]=(0,O.N)(),Re=(0,J.u)(),[Le,Be]=(0,M.Kh)(),[Pe]=(0,D.ri)(),[Fe]=(0,D.cA)(),[Me]=(0,q.m)(),{data:De}=(0,n.KC)(),{data:ze,refetch:Oe}=(0,z.Jz)({parent:null===(le=De.folder)||void 0===le?void 0:le[0]},{skip:!(null!==(ae=De.folder)&&void 0!==ae&&ae[0])}),qe=()=>null===e.title?pe("New email title"):e.title,He=(0,te.fn)(),Ve=(e,t=(null===He||void 0===He?void 0:He.getValue())||"")=>Pe({file:t,title:qe(),notification:Se}).then((t=>{if(t.error)return Se.error({message:(0,re.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.code}}),description:(0,re.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.message}}),placement:"bottomRight"}),Promise.reject();{let o=t.data;const s={id:o._id,...o};return e(s,(()=>Fe({id:s.id,notification:Se})))}})),$e=(e=1)=>((e=1)=>Ve(((t,o)=>({href:(0,I.QG)(t.id,void 0,!1,e),dispose:o}))))(e).then((({href:e,dispose:t})=>(0,U.SR)(e).finally(t))),We=async e=>{const t=e.querySelectorAll("[em-operation=exportAsPicture]"),o=new Map;for(let r=0,l=t.length;r<l;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)=>Ve(((t,s)=>({data:e.map((e=>({selector:e,href:(0,I.QG)(t.id,void 0,!1,o,e)}))),dispose:s})),t))([...o.keys()],(0,C.b6)(e),2);try{const s=t.map((async({href:t,selector:s},r)=>{const l=o.get(s);if("TD"===l.tagName){l.removeAttribute("style");for(const e of[...l.classList])e.startsWith("em-mob-")&&l.classList.remove(e)}const a=await(async(e,t)=>{var o;const s="string"===typeof e?null===(o=await be({url:e}))||void 0===o?void 0:o.data:e;if(t.split(".").length<2){const e=m.extension(s.type);e&&(t=`${t}.${e}`)}const r=new File([s],t.toLowerCase()),l=await fe({user_id:_e.id,folder:De.id,file:r});var a,i,n;return l.error||400===(null===(a=l.data.data)||void 0===a?void 0:a.status)?"string"===typeof e?e:"":null===(i=l.data)||void 0===i||null===(n=i[0])||void 0===n?void 0:n.file_url})(t,`${r}-${l.tagName.toLowerCase()}.png`),i=parseInt(getComputedStyle(l).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=l.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"===l.tagName){const e=l.cloneNode();e.removeAttribute("em-operation"),e.appendChild(n),n=e}l.replaceWith(n)}));await Promise.all(s)}catch(s){console.log(s)}finally{r()}}catch(s){console.log(s)}},Ue=t=>{var o,s;if("0"===(null===De||void 0===De||null===(o=De.limits)||void 0===o?void 0:o.preview_limit)&&Ie&&(null===_e||void 0===_e||null===(s=_e.counters)||void 0===s?void 0:s.emails_counter)>2&&!t.querySelector(".em-powered-logo")){const o="https://emcdn.ru/emailmaker/powered.png",s="https%3A%2F%2Femailmaker.ru",r=`<a href="${`https://racs.rest/v3/link?app=emailmaker&project=${Ie}&email=${e.id}&link=${s}`}" target="_blank"><img src="https://racs.rest/v3/pixel/123.png?image=${o}&project=${Ie}&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=>{Re({event:"click",action:"export_email",export_type:"HTML"});const o=document.querySelector(".email-preview"),s=getComputedStyle(o);(0,U.PJ)(null===He||void 0===He?void 0:He.getValue(),[s.width],e.utm_parameters,(async e=>{await We(e),Ue(e),await(0,Y.e)(e,t)})).then((e=>{const t=new Blob([e],{type:"text/html;charset=utf-8"});(0,k.saveAs)(t,`${qe()}.html`)})).catch((e=>console.log(e)))},Xe=t=>{Re({event:"click",action:"export_email",export_type:"Clipboard"});const o=document.querySelector(".email-preview"),s=getComputedStyle(o);(0,U.PJ)(null===He||void 0===He?void 0:He.getValue(),[s.width],e.utm_parameters,(async e=>{await We(e),Ue(e),await(0,Y.e)(e,t)})).then((e=>navigator.clipboard.writeText(e).then((function(){(0,W.wB)(pe("The email has been copied to the clipboard."),Se)})))).catch((e=>console.log(e)))},Ye=e=>new Promise(((t,o)=>{fetch(e).then((e=>t(e.blob())),(()=>(e=>{const t=Ce.get(oe.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((()=>{}))})),Ke=t=>{Re({event:"click",action:"export_email",export_type:"ZIP"});const o=document.querySelector(".email-preview"),s=getComputedStyle(o);(0,U.Mp)(null===He||void 0===He?void 0:He.getValue(),[s.width],e.utm_parameters,Ye,(async e=>{await We(e),Ue(e),await(0,Y.e)(e,t)})).then((e=>(0,k.saveAs)(e,`${qe()}.zip`))).catch((e=>console.log(e)))},Ze=()=>{e.isNew?(oe.EW.isPlugin||ve(`/projects/${De.id}/emails`),(0,W.wB)(pe("The draft of the email has been deleted."),Se)):Je(e,ve)},Je=(e,t)=>{ke({maskClosable:!0,centered:!0,title:he("Are you sure to delete \u201c","email")+e.title+pe("\u201d email?"),icon:(0,re.jsx)(u.A,{style:{color:"#ff4d4f"}}),okText:pe("Yes"),cancelText:pe("No"),onOk:()=>((e,t)=>we.dispatch(M.GY.endpoints.deleteEmail.initiate(e.id)).then((o=>{o.error&&(0,W.p6)(o,Se),e.project&&!oe.EW.isPlugin&&t(`/projects/${e.project}/emails`),(0,W.wB)(pe("The email \u201c")+o.data.title+he("\u201d was successfully removed.","email"),Se)})))(e,t)})},Qe=()=>{(0,X.QM)("application/zip, message/rfc822, text/html",et)},et=async e=>{const t=e[0];try{ge((0,P.M7)(!0));const e=await(0,X.q2)(t,(async(e,t)=>{let o;if("string"===typeof e)try{var s;e=(0,E.A)(e),o=null===(s=await be({url:e}))||void 0===s?void 0:s.data}catch(d){return e}else o=e;if(t.split(".").length<2){const e=m.extension(o.type);e&&(t=`${t}.${e}`)}const r=new File([o],t.toLowerCase()),l=await fe({user_id:_e.id,folder:De.id,file:r});var a,i,n;if(!l.error&&400!==(null===(a=l.data.data)||void 0===a?void 0:a.status))return null===(i=l.data)||void 0===i||null===(n=i[0])||void 0===n?void 0:n.file_url;return"string"===typeof e?e:""}),(e=>{e.title||(e.title=(0,U.Ay)(t.name)[0])}));He.setValue(e),ge((0,P.M7)(!1))}catch(o){ge((0,P.M7)(!1));const e=o instanceof Error?o.message:o;Se.error({message:(0,re.jsx)("div",{dangerouslySetInnerHTML:{__html:e}}),placement:"bottomRight"})}Re({event:"upload_file",action:"import_email"})};let tt=[];Ee.emailDropdownMenuClone&&tt.push({label:pe("Clone"),icon:(0,re.jsx)(p.A,{style:{fontSize:"16px"}}),key:"Clone",className:"em-analytics__email-clone",disabled:Be.isLoading,onClick:async()=>{if(e.isNew)Se.warning({message:pe("To create a copy, you need to save the email."),placement:"bottomRight"});else{var t,o,s,r,l;if((await Te.fire(e)).some((e=>!1===e)))return;Le({title:(0,W.fq)(e.title),project:null===De||void 0===De?void 0:De.id,description:e.description,html:(0,W.el)((null===He||void 0===He?void 0:He.getValue())||"",e.title),parent_email:e.parent_email||oe.iU,common_styles:e.common_styles||"",utm_parameters:{utm_source:null===(t=e.utm_parameters)||void 0===t?void 0:t.utm_source,utm_medium:null===(o=e.utm_parameters)||void 0===o?void 0:o.utm_medium,utm_campaign:null===(s=e.utm_parameters)||void 0===s?void 0:s.utm_campaign,utm_term:null===(r=e.utm_parameters)||void 0===r?void 0:r.utm_term,utm_content:null===(l=e.utm_parameters)||void 0===l?void 0:l.utm_content},emailtags:e.emailtags,folder:e.folder}).then((t=>{t.error?Se.error({message:(0,re.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.code}}),description:(0,re.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.message}}),placement:"bottomRight"}):(ve(`/projects/${De.id}/emails/${t.data.id}`),Se.success({message:pe("The copy of email \u201c")+e.title+pe("\u201d was successfully created."),placement:"bottomRight"}),ze&&Oe())}))}}}),Ee.emailDropdownMenuImport&&tt.push({label:he("Import","verb"),icon:(0,re.jsx)(h.A,{style:{fontSize:"16px"}}),key:"Import",className:"em-analytics__editor-page__import",onClick:()=>{Re({event:"click",action:"import_email"}),Qe()}}),(ye||xe||(null===(ie=_e.id)||void 0===ie?void 0:ie.toString())===(null===(ne=e.author)||void 0===ne?void 0:ne.toString()))&&(Ee.emailDropdownMenuLock&&tt.push({label:(0,re.jsx)(N.A,{element:e},"Lock"),icon:e.lock?(0,re.jsx)(g.A,{style:{fontSize:"16px"}}):(0,re.jsx)(b.A,{style:{fontSize:"16px"}}),disabled:e.isNew}),Ee.emailDropdownMenuRemove&&tt.push({label:pe("Remove"),icon:(0,re.jsx)(u.A,{style:{fontSize:"16px"}}),key:"Remove",className:"em-analytics__email-remove",style:{color:"#ff4d4f"},onClick:Ze}));const ot=e.isAmp;let st=[];return Ee.exportHtmlEnabled&&st.push({key:"html",label:pe("Code"),icon:(0,re.jsx)(f.A,{style:{fontSize:"16px"}}),...ot?{children:[{key:"\u0441ode_html",label:pe("AMP"),onClick:()=>Ge("amp")},{key:"html_amp",label:pe("HTML"),onClick:()=>Ge("html")}]}:{onClick:()=>Ge()}}),Ee.exportZipEnabled&&st.push({key:"zip",label:pe("ZIP"),icon:(0,re.jsx)(v.A,{style:{fontSize:"16px"}}),...ot?{children:[{key:"zip_html",label:pe("AMP"),onClick:()=>Ke("amp")},{key:"zip_amp",label:pe("HTML"),onClick:()=>Ke("html")}]}:{onClick:()=>Ke()}}),Ee.exportClipboardEnabled&&st.push({key:"clipboard",label:pe("Clipboard"),icon:(0,re.jsx)(y.A,{style:{fontSize:"16px"}}),...ot?{children:[{key:"clipboard_html",label:pe("AMP"),onClick:()=>Xe("amp")},{key:"clipboard_amp",label:pe("HTML"),onClick:()=>Xe("html")}]}:{onClick:()=>Xe()}}),!oe.EW.isPlugin&&Ee.exportWebHookEnabled&&st.push({key:"webhook",icon:(0,re.jsx)(R.A,{icon:"WebHook",style:{fontSize:"16px"}}),label:pe("WebHook"),onClick:()=>{je.webhook?(Re({event:"click",action:"export_email",export_type:"webhook"}),Ne({url:je.webhook,body:(0,c.E)(e,we)}).then((e=>{e.error?200===e.error.originalStatus?Se.success({message:pe("Success!"),description:pe("WebHook successfully sent!"),placement:"bottomRight"}):Se.error({message:(0,re.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.status}}),description:(0,re.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.error}}),placement:"bottomRight"}):Se.success({message:pe("Success!"),description:pe("WebHook successfully sent!"),placement:"bottomRight"})}))):(ge((0,F.YF)("webhooksettings")),ge((0,F.qf)(oe.lx.EDIT_PROJECT_MODAL)))}}),Ee.exportOutlookEnabled&&st.push({key:"outlook",icon:(0,re.jsx)(x.A,{style:{fontSize:"16px"}}),label:pe("Outlook"),onClick:()=>(t=>{Re({event:"click",action:"export_email",export_type:"Outlook"});const o=document.querySelector(".email-preview"),s=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 We(e),Ue(e)};(0,U.pH)(e.title,null===He||void 0===He?void 0:He.getValue(),[s.width,s.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,k.saveAs)(t,`${qe()}.eml`)})).catch((e=>console.log(e)))})(ot)}),Ee.exportPdfEnabled&&st.push({key:"pdf",icon:(0,re.jsx)(_.A,{style:{fontSize:"16px"}}),label:pe("PDF"),onClick:async()=>{const t=null===e||void 0===e?void 0:e.html;try{const e=await Me({htmlContent:t,notification:Se}).unwrap(),o=window.URL.createObjectURL(new Blob([e],{type:"application/pdf"})),s=document.createElement("a");s.href=o,s.setAttribute("download",`${qe()}.pdf`),document.body.appendChild(s),s.click(),document.body.removeChild(s),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)}}}),Ee.exportPngEnabled&&st.push({key:"img",icon:(0,re.jsx)(j.A,{style:{fontSize:"16px"}}),label:pe("PNG"),onClick:()=>$e(1).then(U.gZ).then((e=>(0,k.saveAs)(e,`${qe()}.png`))).then(Re({event:"click",action:"export_email",export_type:"Image"}))}),(0,re.jsxs)(r.A,{children:[Ee.emailDropdownMenuEnabled?(0,re.jsx)(l.A,{arrow:{pointAtCenter:!0},placement:"bottom",menu:{items:tt},children:(0,re.jsx)(a.Ay,{type:"default",block:!1,className:"email-page-header__btn email-page-header__btn_extra",onClick:()=>{},children:(0,re.jsx)(A.A,{})})},"Actions"):Ee.emailDropdownMenuImport&&(0,re.jsx)(i.A,{title:he("Import","verb"),placement:"bottom",children:(0,re.jsx)(a.Ay,{className:"em-analytics__editor-page__import",type:"text",icon:(0,re.jsx)(h.A,{style:{fontSize:20}}),onClick:()=>{Re({event:"click",action:"import_email"}),Qe()}})}),Ee.emailExportEnabled&&(0,re.jsx)(l.A,{arrow:{pointAtCenter:!0},placement:"bottom",menu:{items:st},children:(0,re.jsx)(a.Ay,{className:"em-analytics__email-page__export",type:"default",icon:(0,re.jsx)(S.A,{}),children:pe("Export")},"Export")},"Export"),!e.hasOwnProperty("type")&&(0,re.jsx)(I.Ay,{autoSaveEmailResult:t,email:e,isEditableRights:ye||xe||(null===(de=_e.id)||void 0===de?void 0:de.toString())===(null===(ce=e.author)||void 0===ce?void 0:ce.toString())},"Save"),!!e.hasOwnProperty("type")&&(0,re.jsx)(T.A,{block:e,isEditableRights:ye||xe||(null===(me=_e.id)||void 0===me?void 0:me.toString())===(null===(ue=e.author)||void 0===ue?void 0:ue.toString()),autoSaveBlockResult:o},"Save")]})}},30961:(e,t,o)=>{o.d(t,{A:()=>I});var s=o(92810),r=o(95838),l=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),j=o(70082);const{useToken:A}=r.A,{name:S,type:k,tags:w,group:C}={name:"name",type:"type",tags:"tags",group:"group"},E={[S]:"",[k]:[],[w]:[],[C]:[]},I=({isBlocks:e=!1,templateEmailId:t=!1})=>{const{__:o}=(0,p.s9)(),{projectId:r}=(0,u.g)(),[I]=l.A.useForm(),{data:T}=(0,b.h1)(),N=(0,m.wA)(),R=(0,m.d4)(f.b9),L=(0,m.d4)(v.CT),B=(0,m.d4)(_.GD),{token:P}=A(),F=(0,m.Pj)(),M=e?R:L,{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,s.useCallback)((()=>{N(e?(0,f.om)({}):(0,v.om)({}))}),[N,e]);(0,s.useEffect)((()=>{H()}),[H]),(0,s.useEffect)((()=>{}),[O,q,t]),(0,s.useEffect)((()=>{}),[D,z,e,t]);const[V,$]=(0,s.useState)([]);let W;(0,s.useEffect)((()=>{if(T){const e=T.schema.properties.acf.properties.type.items.enum;let t=[];for(let s in e)t.push({label:o(x.jg[e[s]]),value:e[s]});$(t)}}),[T,o]);const[U,G]=(0,s.useState)(!1);return(0,s.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))||[];I.setFieldsValue({tags:o})}),[D,M,e,I,z,O,q,t]),(0,s.useEffect)((()=>{I.setFieldsValue({group:B})}),[I,B]),(0,j.jsx)("div",{className:"cards-search",children:(0,j.jsx)(l.A,{form:I,name:"cards_search_form",initialValues:{...E},onValuesChange:o=>{const s=Object.keys(o)[0],r=I.getFieldsValue(!0);switch(s){case w:const l=t?(0,y._q)(q,x.zh).filter((e=>o[s].includes(e.name))).map((e=>e.id))||null:(0,y._q)(z,e?x.YY:x.zh).filter((e=>o[s].includes(e.name))).map((e=>e.id))||null;N(e?(0,f.om)({...M,tags:l}):(0,v.om)({...M,tags:l}));break;case k:N(e?(0,f.om)({...M,type:r.type||null}):(0,v.om)({...M,type:r.type||null}));break;case S: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,j.jsxs)(a.A,{wrap:!1,gutter:0,children:[(0,j.jsx)(l.A.Item,{className:"cards-search__by-title",name:S,children:(0,j.jsx)(i.A,{placeholder:o("Search by title"),allowClear:!0,bordered:!1,size:"large",prefix:(0,j.jsx)(d.A,{className:"cards-search__search-icon, input-icon",style:{cursor:"pointer",fontSize:20}})})}),e&&(0,j.jsx)(l.A.Item,{className:"cards-search__type-select",name:k,rules:[{message:o("Please choose the block type")}],children:(0,j.jsx)(n.A,{placeholder:o("Filter by type"),options:V,getPopupContainer:e=>e.parentNode,suffixIcon:(0,j.jsx)(c.A,{style:{fontSize:"16px",color:P.colorText},onClick:()=>G(!U),className:"input-icon"}),allowClear:!0,open:U,onDropdownVisibleChange:e=>{G(e)}})})]})})})}},19911:(e,t,o)=>{o.d(t,{CollaboratorList:()=>_,useCollaborateEditor:()=>v});var s=o(60382);const r=(e,t)=>(a(),i(e.user.color,t),e.cursor?[{range:new s.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};`}}]:[]),l=e=>e.selection?[{range:new s.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)}`,s=document.styleSheets[0];Array.from(s.cssRules).some((e=>e.cssText.includes(`.${o}`)))||s.insertRule(`.${o} { --cursor-color: ${e===t.color?"#000000":e}; }`,s.cssRules.length)},n=(e,t,o)=>{if(!e.textContent){const s=document.createElement("div");s.style.background=t,s.style.color="#fff",s.textContent=o,s.className="cursor-hover",e.appendChild(s)}},d=(e,t,o,s,a,i)=>{if(s)return;a(!0);const d=e.flatMap((e=>[...r(e,i),...l(e)]));o.current=t.deltaDecorations(o.current,d.map((e=>({range:e.range,options:e.options}))));((e,t,o,s,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=s.find((e=>e.user.color===u));var l,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!==(l=h.user)&&void 0!==l&&null!==(a=l.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 s=e=>{const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)};return.2126*s(e)+.7152*s(t)+.0722*s(o)},o=(e,o,s)=>(t(255,255,255)+.05)/(t(e,o,s)+.05)>=4.5;let s;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,l=i,!(t>100&&r>50&&r<150&&l<100))&&o(t,a,i)&&(s=`#${(t<<16|a<<8|i).toString(16).padStart(6,"0")}`)}while(!s);var r,l;return s};var m=o(92810),u=o(45934),p=o(63040),h=o(88785),g=o(5277),b=o(86286);var f=o(85163);const v=({emailId:e,editorRef:t,setIsSpin:o})=>{const s=(0,m.useMemo)((()=>new p.JA),[]),[r,l]=(0,m.useState)(null),[a,i]=(0,m.useState)(null),[n,v]=(0,m.useState)(!1),[y,x]=(0,m.useState)([]),_=(0,m.useRef)([]),j=(0,m.useRef)([]),A=(0,m.useRef)(!1),S=(0,u.d4)(b.C1),k=!("3769995"!==e&&!f.EW.isPlugin),w=(0,m.useMemo)((()=>({name:{first_name:k?null===S||void 0===S?void 0:S.username:null===S||void 0===S?void 0:S.first_name,last_name:k?"":null===S||void 0===S?void 0:S.last_name,email:null===S||void 0===S?void 0:S.email},color:c()})),[S,k]),C=(0,m.useMemo)((()=>((e,t)=>e.filter((e=>e.user.color!==t.color)))(y,w)),[w,y]);(0,m.useEffect)((()=>{if(!e||!f._P.isEditor)return;const t=(new Date).toLocaleDateString("en-GB").replace(/\//g,"-"),o=k?`${e}-plugin-${t}`:`${e}--${t}`,r=new h.$R("wss://yjs.emailmaker.ru",o,s);return i(r),r.awareness.setLocalStateField("user",w),()=>{null===r||void 0===r||r.destroy(),null===s||void 0===s||s.destroy()}}),[s,w,k,e]);const E=(0,m.useCallback)((e=>{if(!A.current){A.current=!0;try{const t=j.current,o=Array.from(e.getStates().values());(o.length>1||o.length!==t.length)&&(x(o),requestAnimationFrame((()=>{d(o,r,_,n,v,w)}))),j.current=o}finally{A.current=!1}}}),[r,_,n,v,w]);return(0,m.useEffect)((()=>{if(!a||!r||!f._P.isEditor||!t.current||!r.getModel())return;let e=null;const l=a.awareness,i=s.getText("monaco"),n=async s=>{if(s){if(i._length>0){var a,n;const e=e=>e.replace(/\s+/g," ").trim();e((null===r||void 0===r||null===(a=r.getModel())||void 0===a||null===(n=a.getValue())||void 0===n?void 0:n.toString())||"")!==e(i.toString())&&(await async function(e,t){await new Promise((o=>{const s=()=>{var r,l,a;null===t||void 0===t||t(!0);((null===(r=e.current)||void 0===r||null===(l=r.getModel())||void 0===l||null===(a=l.getValue())||void 0===a?void 0:a.length)||0)>0?o():setTimeout(s,100)};s()}))}(t,o),null===o||void 0===o||o(!1),r.executeEdits("collaboration",[{range:r.getModel().getFullModelRange(),text:i.toString(),forceMoveMarkers:!0}]))}else{var d;i.insert(0,null===(d=t.current)||void 0===d?void 0:d.getModel().getValue())}e=new g.h(i,null===r||void 0===r?void 0:r.getModel(),new Set([r]),l),null===r||void 0===r||r.onDidChangeCursorPosition((e=>((e,t)=>{t.setLocalStateField("cursor",e.position)})(e,l))),null===r||void 0===r||r.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",(()=>E(l)))}};return a.on("sync",n),()=>{e&&e.destroy(),a.off("sync",n)}}),[r,a,s,t,E,o]),(0,m.useEffect)((()=>{if(!a||!r||!f._P.isEditor||!t.current)return;const e=null===a||void 0===a?void 0:a.awareness,o=setInterval((()=>{E(e)}),500);return()=>clearInterval(o)}),[a,r,y,n,t,E]),[r,C,l]};var y=o(66726),x=o(70082);const _=({users:e,isEditor:t,isPlugin:o,token:s})=>{const[r,l]=(0,m.useState)(!1),a=window.localStorage.getItem(f.V0.em_color_scheme),i=e=>{const{first_name:t,last_name:o,email:s}=e.user.name;if(t){return`${t.split("")[0]}${o?`${o.split("")[0]}`:""}`}return s.split("")[0].toUpperCase()},n=e=>{const t=(e=>{const{first_name:t,last_name:o,email:s}=e.user.name;return t&&o?`${t} ${o}`:t||s})(e);return(0,x.jsx)("span",{children:t})};return(0,x.jsx)(x.Fragment,{children:e.length>0&&t&&(0,x.jsx)("div",{className:"user-list "+(r?"open":""),style:o?{left:"60px",bottom:"10px"}:{},onMouseOver:()=>l(!0),onMouseOut:()=>l(!1),children:e.map((e=>(0,x.jsx)("div",{className:"user",style:{"--user-color":e.user.color,"--border-color":null===s||void 0===s?void 0:s.colorBgContainer,"--text-color":"dark"===a?null===s||void 0===s?void 0:s.colorIconHover:null===s||void 0===s?void 0:s.colorWhite},children:(0,x.jsx)(y.A,{title:n(e),placement:"topLeft",trigger:"hover",color:null===s||void 0===s?void 0:s.colorBgSpotlight,children:(0,x.jsx)("div",{children:i(e)})})},e.user.color)))})})}},26238:(e,t,o)=>{o.d(t,{A:()=>f});var s=o(92810),r=o(2018),l=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)(),j=(0,u.d4)(g.iy),[A,S]=(0,s.useState)(!0),k=(0,s.useRef)(null),w=(0,s.useRef)(null),C=(0,s.useRef)(t);(0,s.useEffect)((()=>{"undefined"===typeof EyeDropper&&S(!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),k.current&&(k.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),k.current&&(k.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)(l.A,{flex:"auto",children:[(0,b.jsx)(t,{}),A&&(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)(l.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:j||v,className:"color-picker-input__control",placeholder:f||_("Select color"),value:o,ref:w,onChange:t})]})})}},26254:(e,t,o)=>{o.d(t,{A:()=>St});var s=o(92810),r=o(95838),l=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),j=o(94822),A=o(38883),S=o.n(A),k=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 I=({yandexHandler:e})=>((0,s.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 T=o(83351),N=o(15865),R=o(39990),L=o(1779),B=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,k.s9)(),o=(0,d.Zp)(),r=(0,i.wA)(),{search:l}=(0,d.zy)(),[a]=(0,R.Lj)(),[n]=(0,T.uX)(),[c,m]=(0,s.useState)(D),A=(0,y.hN)(),C=(0,M.p6)(),[O]=(0,L.p)(),[q]=(0,B.x)(),H=(0,F.u)(),V={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"}})},$={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:[$],initialValues:{remember:!1,email:"",password:"",privacyPolicy:!1,newsletterConsent:!1}}];(0,s.useEffect)((()=>{null!==l&&void 0!==l&&l.startsWith("?signup")&&m(z)}),[l]);const[U,G]=(0,s.useState)(""),X={[D]:{onFinish:(e,t=!1)=>{G(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 A.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"}),G(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 A.error({message:(0,E.jsx)("div",{dangerouslySetInnerHTML:{__html:t.data.code}}),description:(0,E.jsx)("div",{dangerouslySetInnerHTML:{__html:t.data.message}}),placement:"bottomRight"}),G(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 s=t;return r(R.Q2.endpoints.getMe.initiate()).then((e=>({result:e,tokenData:s})))})).then((e=>{var s,l,a,i,n,d;let{result:c,tokenData:m}=e;var u;if(c.error)throw A.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"}),G(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!==(s=m.data)&&void 0!==s&&s.is_reg?"/projects?status=newbie":h;o(g,{replace:!0}),H({type:t?"Yandex":"Default",event:"submit_form",action:t&&null!==(l=m.data)&&void 0!==l&&l.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;G(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=>{G(P.F5),r(R.Q2.util.resetApiState()),a({email:e.email,username:e.email,reg_type:"simple"}).then((e=>{if(e.error)throw A.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"}),G(P.ff),w.wd("onFinishFailed SIGN_UP",{extra:e.error}),new Error(P.ff);return 200===e.data.code&&A.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 A.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"}),G(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,s,r,l,a;if(e.error)throw A.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===(s=e.data)||void 0===s?void 0:s.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===(l=e.data)||void 0===l?void 0:l.email_subscription_consent})})).catch((e=>{var t;w.wd("Something went wrong in auth 6",{extra:null===(t=e.error)||void 0===t?void 0:t.data}),G(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:U===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:U===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:U===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:U===P.F5,children:t("Remember me")})}),(0,E.jsx)(j.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:U===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:U===P.F5,className:"em-analytics__receive-updates-emailmaker",children:t("I would like to receive updates from EmailMaker.")})})]})]})}))),(0,E.jsxs)("div",{className:S()("auth-form",{[e]:e}),children:[(0,E.jsx)("div",{className:"yandex-button",children:(0,E.jsx)(I,{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,s.useEffect)((()=>{window.YaSendSuggestToken(`https://${document.location.host}/auth`,{flag:!0})}),[]),(0,E.jsx)(E.Fragment,{}));var V=o(79381),$=o(36852),W=o(24420),U=o(44338),G=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),se=o(20757),re=o(50197),le=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:l}=(0,k.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),{data:v}=(0,le.Oo)({}),{data:y,refetch:x,isUninitialized:_}=(0,le.Oo)({parent:null===(e=f.group)||void 0===e?void 0:e[0]},{skip:!(null!==(t=f.group)&&void 0!==t&&t[0])});(0,s.useEffect)((()=>{!_&&x()}),[_,x]);const j=c.get(P.A9.em_template_email)||n;(0,s.useEffect)((()=>{document.body.classList.remove("editor")}),[]);const A=(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})]})}),S=(0,E.jsx)(E.Fragment,{}),[w,C]=(0,s.useState)(P.ti.ALL);(0,s.useEffect)((()=>{w===P.ti.STANDARD?(u((0,ae.BN)([])),u((0,ie.ry)({projectGroup:[]}))):w===P.ti.PROJECT&&(u((0,ae.es)([])),u((0,ie.ry)({group:[]})))}),[u,w]);const I=[l(P.ti.ALL,P.bV.GROUP),l(P.ti.STANDARD,P.bV.GROUP),l(P.ti.PROJECT,P.bV.GROUP)];return(0,E.jsxs)(K.A,{className:"template-page",children:[(0,E.jsx)(se.A,{leftBlock:A,rightBlock:S}),(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:[w!==P.ti.PROJECT&&(0,E.jsx)(re.A,{className:"template-page__menu",groups:v,isProjectGroups:!1}),!(null===y||void 0===y||null===(o=y.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:[w===P.ti.ALL&&(0,E.jsx)(p.A,{}),w!==P.ti.STANDARD&&(0,E.jsx)(re.A,{className:"template-page__menu",groups:y,isProjectGroups:!0})]}),!!h.length&&(0,E.jsx)(Q.A,{className:"template-page__segment",onChange:C,options:I})]})}),(0,E.jsx)(te.A,{projectId:a,emailsView:P.Y$,createPage:!0,groupType:w})]})})]})};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),je=o(85677),Ae=o(66282),Se=o(83953),ke=o(57903),we=o(2491),Ce=o(55701),Ee=o(7760),Ie=o(47358),Te=o(87790),Ne=o(86286),Re=o(32411),Le=o(31844),Be=o(22197);const{Paragraph:Pe}=Z.A,{useToken:Fe}=r.A,Me=({block:e,autoSaveBlockResult:t})=>{var o,s,r,l,n,c;const{__:m,_x:u}=(0,k.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:j}=v,{token:A}=Fe(),w=(0,i.d4)(Ie.yy),C=e.hasOwnProperty("type")?P.IE:P.Tm,I=(0,i.d4)(ie.qX),T=(0,i.d4)(Ee.qX),N=C===P.Tm?I:T,R=(0,i.d4)(Ie.Fv),{data:L}=(0,d.KC)(),{owner:B,admin:F}=(0,Le.A)(),M=(0,i.Pj)(),D=(e,t)=>{j({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:L.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/${L.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"}))}))}}),(B||F||(null===(o=f.id)||void 0===o?void 0:o.toString())===(null===(s=e.author)||void 0===s?void 0:s.toString()))&&H.push({label:(0,E.jsx)(ke.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/${L.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,Be.A)(null===e.title?m("New block title"):e.title);const V=(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/${L.id}/blocks`)},shape:"circle"})}),(0,E.jsx)(Pe,{className:"ant-page-header-heading-title",editable:{triggerType:["text","icon"],icon:(0,E.jsx)(je.A,{className:"email-page-header__icon-edit"}),onChange:t=>{e.isNew?p((0,Te.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})]})}),$=(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(we.A,{emailElement:e}),e.lock?(0,E.jsx)(x.A,{className:S()("lock-icon",{"lock-icon__disabled":!(B||F||(null===(r=f.id)||void 0===r?void 0:r.toString())===(null===(l=e.author)||void 0===l?void 0:l.toString()))}),style:{color:A.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)(Ae.A,{})})},"Actions"),(0,E.jsx)(Se.A,{className:"em-analytics__block-save",block:e,isEditableRights:B||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)(se.A,{leftBlock:V,rightBlock:$,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:Ve}=K.A,$e=()=>{const{__:e}=(0,k.s9)(),t=(0,qe.XW)(),{blockId:o,projectId:r}=(0,d.g)(),l=(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)(Te.ah),p=(0,i.d4)(Ne.C1),h=(0,i.d4)(De.M),b=(0,i.d4)(Ie.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}),[j,A]=(0,s.useState)(!1);(0,s.useEffect)((()=>{y&&x&&(l((0,Te.Bp)(_)),A(!0))}),[y,x,l,_]);const{isLoading:S,isSuccess:w,isError:C,error:I}=(0,Ce.bg)(o,{skip:!o}),T=y?x:w,N=w&&null!==m&&void 0!==m&&m.id?m:x&&u,R=(0,s.useRef)(0),{isSuccess:L,isLoading:B}=(0,Ce.J4)({blockId:+o},{skip:!o}),[F,D]=(0,s.useState)(null);(0,s.useEffect)((()=>{if(L&&!B&&null!==f&&void 0!==f&&f.length){var e;const s=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=s.slug)&&void 0!==t&&t.includes("autosave")&&n){var o;const e=null===(o=s.html)||void 0===o?void 0:o.replaceAll("\r\n","\n");l((0,Ee.DL)(e))}D(N.id)}}}),[l,f,L,B,N,F,n,o]),(0,He.U)(N);const z=(0,s.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,s.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,s.useCallback)((()=>{O.undo()}),[O]),H=(0,s.useCallback)((()=>{O.redo()}),[O]),V=(0,s.useRef)();(0,s.useEffect)((()=>{V.current!==(null===N||void 0===N?void 0:N.id)&&(O.clear(),V.current=null===N||void 0===N?void 0:N.id)}),[N,O]);const $=(0,s.useCallback)((e=>{(window.navigator.appVersion.indexOf("Mac")&&e.metaKey||e.ctrlKey)&&"KeyZ"===e.code&&(e.preventDefault(),e.shiftKey?H():q())}),[q,H]);(0,s.useEffect)((()=>(document.body.classList.add("editor"),()=>{l((0,De.rI)()),l((0,ze.qX)()),l((0,Ie.PM)(P.Bv))})),[l]);(0,Oe.A)((e=>{const t=e.data.operation,o=e.data.action,s=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"),s=document.body.getBoundingClientRect().height,r=o.getClientRects()[0];r.top<0&&(e.style.display="block"),r.top+r.height>s&&(t.style.display="block")}t===P.Ru.APPLICATION_SCROLL_BLOCK_HIDE&&(s.style.display="none",r.style.display="none")}));const W=e=>{e.preventDefault(),e.target&&t({operation:P.Ru.SANDBOX_DRAG_CANCEL})},U=()=>{},G=e=>{e.preventDefault();const t=document.getElementById("iframe-scroll-top"),o=document.getElementById("iframe-scroll-bottom"),s=document.getElementById("pane-content-iframe"),r=document.getElementById("email_iframe"),{height:l,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"),l-i+a<1?"block"===o.style.display&&(o.style.display="none"):"none"===o.style.display&&(o.style.display="block"),e.target===t&&s.scrollBy(0,-20),e.target===o&&s.scrollBy(0,20)},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,s.useEffect)((()=>(window.addEventListener("dragstart",U),window.addEventListener("drop",W),window.addEventListener("dragend",X),window.addEventListener("dragover",G),window.addEventListener("keydown",$),window.addEventListener("dragenter dragleave",(e=>{e.preventDefault()})),()=>{window.removeEventListener("dragstart",U),window.removeEventListener("drop",W),window.removeEventListener("dragover",G),window.removeEventListener("dragend",X),window.removeEventListener("keydown",$),window.removeEventListener("dragenter dragleave",(e=>{e.preventDefault()}))}))),(0,E.jsxs)(K.A,{className:"block-page",children:[N&&(0,E.jsx)(Me,{block:N}),S&&(0,E.jsx)(be.A,{}),C&&I&&(0,E.jsx)(K.A,{children:(0,E.jsx)(Ve,{style:{paddingTop:"40px"},children:(0,E.jsx)("div",{className:"container",children:(0,E.jsx)(ge.Ay,{status:I.status,title:I.status,subTitle:I.data.message,extra:(0,E.jsx)(g.Ay,{type:"primary",onClick:()=>{a(`/projects/${r}/blocks`)},children:e("Back To Project")})})})})}),(!o&&(!y||j&&u)||w&&m)&&(0,E.jsx)(fe.A,{emailElement:N,isSuccess:T})]})};var We=o(6099),Ue=o(24495),Ge=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),st=o(64936),rt=o(76793),lt=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,k.s9)();let o=(0,d.Zp)();const r=(0,i.wA)(),l=(0,i.d4)(Ne.C1),a=(0,i.d4)(st.cL),[n,c]=(0,rt.Cl)(),[m,p]=(0,lt.IJ)(),[f,v]=(0,at.O)(),{isSuccess:x,isLoading:_,data:j}=(0,R.W5)(),[A]=(0,R.on)(),w=(0,y.hN)(),[C,I]=(0,s.useState)(!1),[T]=u.A.useForm(),L=(0,M.p6)(),[B,F]=(0,s.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:V},subscription:$,subscription_end:W,recurring_payments:U,subscription_id:G,promocode:X,subscription_amount:Y,enterprise_users_limit:Z,enterprise_price:Q,enterprise_12_price:te,email:oe,name:re}=l,[le,ae]=(0,s.useState)(dt);(0,s.useEffect)((()=>{var e,t;(null===$||void 0===$||null===(e=$.post_title)||void 0===e?void 0:e.split(" ").length)>1?ae(dt):1===(null===$||void 0===$||null===(t=$.post_title)||void 0===t?void 0:t.split(" ").length)&&ae(ct)}),[null===$||void 0===$?void 0:$.post_title]);const[ie,de]=(0,s.useState)([]);(0,s.useEffect)((()=>{de([3891,le===ct?13719:13720,le===ct?3892:5295,le===ct?3893:5294,le===ct?3894:5296])}),[le]);const[ce,me]=(0,s.useState)(null),ue=null===ce||void 0===ce?void 0:ce.limits,pe=null===ce||void 0===ce?void 0:ce.title.split(" ")[0];(0,s.useEffect)((()=>{x&&j&&me(j.find((e=>{var t,o;return(null===(t=e.id)||void 0===t?void 0:t.toString())===(null===$||void 0===$||null===(o=$.ID)||void 0===o?void 0:o.toString())})))}),[j,x,$]),(0,s.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,s.useState)(""),be=(e,t,o,s)=>{ge(e);const a=L.get(P.A9.em_token);if("Personal"!==t&&"Advanced"!==t&&"Pro"!==t&&!s||"Community"!==pe&&"Free"!==pe)document.body.classList.remove("editor"),r((0,st.qf)(P.lx.SWITCH_TO_PLAN_MODAL));else{{const s=new cp.CloudPayments,r={},i=new Date;i.setMonth(i.getMonth()+(le===dt?12:1)),i.setDate(i.getDate()-1);const n=`\u041e\u043f\u043b\u0430\u0442\u0430 ${le===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}${le===dt?` (${je(o)}\u20bd\xa0x\xa012)`:""}${B.promocode?" \u043f\u043e\xa0\u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434\u0443 "+B.promocode:" "}`,d=le===dt?12*o:+o,c={Items:[{label:n,price:d,quantity:1,amount:je(d),vat:0}],calculationPlace:"https://emailmaker.ru",taxationSystem:1,email:l.email,amounts:{electronic:je(d)}},m={Items:[{label:n,price:d,quantity:1,amount:d,vat:0}],calculationPlace:"https://emailmaker.ru",taxationSystem:1,email:l.email,amounts:{electronic:d}},u={interval:"Month",period:le===dt?12:1,customerReceipt:m,PersonalDate:i};r.CloudPayments={CustomerReceipt:c,recurrent:u,subscription:e,token:a,promocode:B.promocode?B.promocode:""},r.CloudPayments.CustomerReceipt.Items[0].amount=d,s.pay("charge",{publicId:"pk_e8c7c303759283dc35cf4ad7b396c",description:n,amount:je(d),currency:"RUB",accountId:l.email,email:l.email,data:r,promocode:B.promocode||null},{onSuccess:function(e){},onFail:function(e,t){},onComplete:function(e,t){e.success&&setTimeout((()=>A()),3e3)}})}0}},[fe,ve]=(0,s.useState)(!1);(0,s.useEffect)((()=>{ve(U)}),[U]);(0,s.useEffect)((()=>{const e=setInterval((()=>{A()}),1e4);return()=>clearInterval(e)}),[A]);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,s.useCallback)((e=>{I(!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),l=new Date;var o,s;if(t.promocode=e.data.promocode.toUpperCase(),r>l)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===(s=e.data)||void 0===s?void 0:s.message,w)}else B.promocode||F({...B,promocode:""})})).catch((e=>{(0,ne.p6)(e,w),console.warn("error",e)})).finally((()=>{I(!1)}))}),[r,B,w]),je=e=>{return B.discount&&e?(t=e-e*B.discount/100,"emailmaker"===P.oy?Math.round(t):10*Math.floor(t/10)):e;var t};(0,s.useEffect)((()=>{!+H&&X&&"Free"===pe&&null===B.promocode&&_e(X)}),[_e,H,X,pe,B.promocode]);const Ae=(0,E.jsx)(et.A,{style:{fontSize:48},spin:!0});return(0,E.jsxs)(K.A,{className:"billing-page",children:[(0,E.jsx)(se.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:Ae})}),(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:le,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:T,layout:"inline",name:"promo_code_form",autoComplete:"off",initialValues:{promocode:""},onFinish:({promocode:e})=>{T.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:s,limits:{emails_limit:r,projects_limit:l,users_limit:a},price:i}=null===j||void 0===j?void 0:j.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||l&&z>l||a&&O>a,d=s.split(" ")[0];let c=null,m=null;return Z&&Q&&"Enterprise"===s&&(c=!0),Z&&te&&"Enterprise 12"===s&&(m=!0),(0,E.jsxs)(Ze.A,{hoverable:!0,style:{width:240},"data-name":s,children:[(0,E.jsx)("p",{className:"billing-page__card-title",children:d}),(("Enterprise"!==d||c||m)&&"Free"!==d&&B.discount&&!+H||s===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&&"$":"",s===ce.title&&"Free"!==ce.title&&+Y?Y:"Enterprise"!==d?je(i):c?je(Q):m?je(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 ",l||"\u221e"," ",t(" project"," projects",l)]}),(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:S()("billing-page__card-button",{"billing-page__card-button_current":s===ce.title}),type:s===ce.title?"default":"primary",size:"large",onClick:()=>be(s,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:s===ce.title?e("Current plan"):e("Enterprise"!==d||c||m?"Switch to this plan":"Contact us")})})]},s)}))}),B.promocode&&B.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: ")," ",B.promocode]}),B.description&&(0,E.jsx)("div",{style:{marginBottom:"-45px"},dangerouslySetInnerHTML:{__html:B.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]}),G&&(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:G,uid:l.id};m(e).then((e=>{var t,o;e.isSuccess&&200===(null===e||void 0===e||null===(t=e.data)||void 0===t||null===(o=t.data)||void 0===o?void 0:o.status)?(ve(!0),A().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:G,uid:l.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),A().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:V/ue.optimization_limit*100,format:()=>(0,E.jsx)("span",{className:"billing-page__progress-block-counts",children:`${V} ${e("of")} ${ue.optimization_limit>0?ue.optimization_limit:"\u221e"} ${t(" optimisation"," optimisations",ue.optimization_limit)}`}),size:"medium",strokeColor:mt(V/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,s.useEffect)((()=>{const t=null===o||void 0===o?void 0:o.code_editor;t&&e((0,Ne.ww)(t))}),[o,e]),(0,s.useEffect)((()=>{const o=t.get(P.A9.em_token),s=t.get(P.A9.promocode);o&&s&&(e(N.So.endpoints.checkPromo.initiate({code:s,type:"by_link"})),t.remove(P.A9.promocode))}),[e,t]),(0,s.useEffect)((()=>{if(!P.EW.isPlugin){const o=t.get(P.A9.em_token);if(o){const s=(new Date).getTime()/1e3,r=(0,bt.iU)(o),l=r.exp,a=r.iat;l&&l-s<86400?(t.remove(P.A9.em_token),e(R.Q2.util.resetApiState())):s-a>216e4&&t.set(P.A9.em_token,o,{expires:30})}}}),[e,t]);const[r,l]=(0,s.useState)(null),a=(0,i.d4)(ht.s0),n=a.project?(0,gt.Mu)(a):void 0;return(0,s.useEffect)((()=>{if(!P.EW.isPlugin){const s=t.get(P.A9.em_token);null!==o&&void 0!==o&&o.last_used_project?l(null===o||void 0===o?void 0:o.last_used_project):o&&s&&e(pt.Nq.endpoints.getProjects.initiate()).then((e=>{var t;l((null===(t=e.data)||void 0===t?void 0:t[0].id)||!1)})).catch((()=>l(!1)))}}),[o,e,t]),(0,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)($.A,{})}),(0,E.jsx)(d.qh,{path:"/email/:emailId/raw",element:(0,E.jsx)(Ge.A,{})}),(0,E.jsxs)(d.qh,{path:"/",element:(0,E.jsx)(c.A,{children:(0,E.jsx)(V.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)(G.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)(U.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)($e,{})}),(0,E.jsx)(d.qh,{path:"new",element:(0,E.jsx)($e,{})})]}),(0,E.jsx)(d.qh,{path:"members",element:(0,E.jsx)(Ue.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)(),jt={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}}},At={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 St=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,s.useState)(o||r),m=(0,gt.rD)(),u=(0,i.wA)(),p=(0,vt.c8)();(0,s.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,s.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,s.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,s.useCallback)((()=>{const e=localStorage.getItem(P.V0.em_color_scheme);h(e)}),[h]);(0,s.useEffect)((()=>{g()}),[g]);const b=(0,i.d4)(ht.RP),[f,v]=(0,s.useState)("light"===d?jt:At),[y]=(0,s.useState)(1);(0,s.useEffect)((()=>{const e="light"===d?jt:At,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,s.useCallback)((()=>x),[x]);return(0,E.jsx)(l.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:()=>V});var s=o(92810),r=o(38883),l=o.n(r),a=o(95838),i=o(12280),n=o(29234),d=o(66726),c=o(2018),m=o(7744),u=o(71086),p=o(81e3),h=o(43005),g=o(7166),b=o(28348),f=o(29756),v=o(62767),y=o(6391),x=o(69372),_=o(62342),j=o(14461),A=o(23287),S=o(45934),k=o(88296),w=o(26238),C=o(68031),E=o(21519),I=o(71495),T=o(44997),N=o(65983),R=o(47358),L=o(45695),B=o(56991),P=o(85163),F=o(47520),M=o(70082);const{useToken:D}=a.A,z=e=>{var t,o,s,r,l,a;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,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,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,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,buttonsBold:e.buttons.bold,buttonsItalic:e.buttons.italic,buttonsBackgroundColor:e.buttons.backgroundColor,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===(s=e.cards)||void 0===s?void 0:s.contrastTextColor)||"#FFFFFF",cardsBaseTextColor:(null===(r=e.cards)||void 0===r?void 0:r.baseTextColor)||"#5A5A5A",cardsBorder:(null===(l=e.cards)||void 0===l?void 0:l.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}}},O={buttons_borderRadiusAll:"all",buttons_borderRadiusTopLeft:"topLeft",buttons_borderRadiusBottomLeft:"bottomLeft",buttons_borderRadiusTopRight:"topRight",buttons_borderRadiusBottomRight:"bottomRight"},q={cards_borderRadiusAll:"all",cards_borderRadiusTopLeft:"topLeft",cards_borderRadiusBottomLeft:"bottomLeft",cards_borderRadiusTopRight:"topRight",cards_borderRadiusBottomRight:"bottomRight"},H=({className:e,email:t})=>{const{__:o}=(0,A.s9)(),r=(0,S.wA)(),a=(0,L.XW)(),[H]=i.A.useForm(),V=(0,S.d4)(N.uJ),$=(0,S.d4)(N.dH),W=(0,B.rD)(),{token:U}=D(),[G,X]=(0,s.useState)({}),[Y,K]=(0,s.useState)({}),[Z,J]=(0,s.useState)(!0),[Q,ee]=(0,s.useState)(!0),[te,oe]=(0,s.useState)(!1),se={buttonsPaddingTop:"top",buttonsPaddingLeft:"left",buttonsPaddingRight:"right",buttonsPaddingBottom:"bottom"},re=t.common_styles&&"{}"!==t.common_styles?JSON.parse(t.common_styles):P.BD,[le,ae]=(0,s.useState)(null),ie=!!t.common_styles&&"{}"!==t.common_styles,ne=(0,S.d4)(R.Wm);(0,s.useEffect)((()=>{ne||ae(null)}),[re,ae,ne]),(0,s.useEffect)((()=>{ne&&!le&&ae(z(re))}),[re,le,ne]),(0,s.useEffect)((()=>{$&&(r((0,N.RC)(!1)),H.setFieldsValue(z(re)))}),[H,$,r,re]);const[de,ce]=(0,s.useState)(Math.min(re.headings.fontSize-1,19)),[me,ue]=(0,s.useState)(Math.max(re.text.fontSize+1,20));(0,s.useEffect)((()=>{if(le){var e,t,o,s,r,l,a,i,n,d,c,m,u;const p=le.buttonsBorder;X(p);const h=Object.keys(p).find((e=>{var t,o,s;return(null===(t=p[e])||void 0===t?void 0:t.width)||(null===(o=p[e])||void 0===o?void 0:o.style)||(null===(s=p[e])||void 0===s?void 0:s.color)})),g=le.cardsBorder;K(g);const b=Object.keys(g).find((e=>{var t,o,s;return(null===(t=g[e])||void 0===t?void 0:t.width)||(null===(o=g[e])||void 0===o?void 0:o.style)||(null===(s=g[e])||void 0===s?void 0:s.color)}));H.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===(s=p[h])||void 0===s?void 0:s.style)||"",cards_borderPosition:b||"all",cards_borderWidth:null!==(null===(r=g[b])||void 0===r?void 0:r.width)?null===(l=g[b])||void 0===l?void 0:l.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,F.ok)(le.buttonsBorderRadius.all),buttons_borderRadiusTopLeft:(0,F.ok)(le.buttonsBorderRadius.topLeft),buttons_borderRadiusBottomLeft:(0,F.ok)(le.buttonsBorderRadius.bottomLeft),buttons_borderRadiusTopRight:(0,F.ok)(le.buttonsBorderRadius.topRight),buttons_borderRadiusBottomRight:(0,F.ok)(le.buttonsBorderRadius.bottomRight),cards_borderRadiusAll:(0,F.ok)(le.cardsBorderRadius.all),cards_borderRadiusTopLeft:(0,F.ok)(le.cardsBorderRadius.topLeft),cards_borderRadiusBottomLeft:(0,F.ok)(le.cardsBorderRadius.bottomLeft),cards_borderRadiusTopRight:(0,F.ok)(le.cardsBorderRadius.topRight),cards_borderRadiusBottomRight:(0,F.ok)(le.cardsBorderRadius.bottomRight)}),!(0,F.ok)(le.buttonsBorderRadius.all)&&((0,F.ok)(le.buttonsBorderRadius.topLeft)||(0,F.ok)(le.buttonsBorderRadius.bottomLeft)||(0,F.ok)(le.buttonsBorderRadius.topRight)||(0,F.ok)(le.buttonsBorderRadius.bottomRight))?J(!1):J(!0),le.buttonsPadding&&!(0,F.ok)(le.buttonsPadding.all)&&((0,F.ok)(le.buttonsPadding.bottom)||(0,F.ok)(le.buttonsPadding.right)||(0,F.ok)(le.buttonsPadding.left)||(0,F.ok)(le.buttonsPadding.top))&&oe(!1),!(0,F.ok)(null===(n=le.cardsBorderRadius)||void 0===n?void 0:n.all)&&((0,F.ok)(null===(d=le.cardsBorderRadius)||void 0===d?void 0:d.topLeft)||(0,F.ok)(null===(c=le.cardsBorderRadius)||void 0===c?void 0:c.bottomLeft)||(0,F.ok)(null===(m=le.cardsBorderRadius)||void 0===m?void 0:m.topRight)||(0,F.ok)(null===(u=le.cardsBorderRadius)||void 0===u?void 0:u.bottomRight))?ee(!1):ee(!0)}}),[H,le]);const pe=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:P.Ru.SANDBOX_EMAIL_SETTINGS_SET,settings:{[o]:t.classList.contains("selected-td-form__button--active")}})};return le&&(0,M.jsx)("div",{className:l()("appearance-panel",{[e]:e}),children:(0,M.jsxs)(i.A,{form:H,layout:"vertical",name:"content_appearance_panel_form",initialValues:le,onValuesChange:e=>{var t,o,s,r,l,i;const n=H.getFieldsValue(!0),d=Object.keys(e)[0];let c={};switch(d){case"headingFontSize":ce(Math.min(n.headingFontSize-1,19)),c=e;break;case"textFontSize":ue(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?X((t=>({...P.iV,[n.buttons_borderPosition]:{...t[n.buttons_borderPosition],style:e[d]}}))):X((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?X((t=>({...P.iV,[n.buttons_borderPosition]:{...t[n.buttons_borderPosition],color:e[d]}}))):X((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?X((t=>({...P.iV,[n.buttons_borderPosition]:{...t[n.buttons_borderPosition],width:e[d]}}))):X((t=>({...t,[n.buttons_borderPosition]:{...t[n.buttons_borderPosition],width:e[d]}})));break;case"buttons_borderPosition":H.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===(s=G[e[d]])||void 0===s?void 0:s.style)||""});break;case"cards_borderStyle":c={cardsBorder:{[n.cards_borderPosition]:{...Y[n.cards_borderPosition],style:e[d]}}},"all"===n.cards_borderPosition?K((t=>({...P.iV,[n.cards_borderPosition]:{...t[n.cards_borderPosition],style:e[d]}}))):K((t=>({...t,[n.cards_borderPosition]:{...t[n.cards_borderPosition],style:e[d]}})));break;case"cards_borderColor":c={cardsBorder:{[n.cards_borderPosition]:{...Y[n.cardsBorderPosition],color:e[d]}}},"all"===n.cards_borderPosition?K((t=>({...P.iV,[n.cards_borderPosition]:{...t[n.cards_borderPosition],color:e[d]}}))):K((t=>({...t,[n.cards_borderPosition]:{...t[n.cards_borderPosition],color:e[d]}})));break;case"cards_borderWidth":c={cardsBorder:{[n.cards_borderPosition]:{...Y[n.cards_borderPosition],width:e[d]}}},"all"===n.cardsBorderPosition?K((t=>({...P.iV,[n.cards_borderPosition]:{...t[n.cards_borderPosition],width:e[d]}}))):K((t=>({...t,[n.cards_borderPosition]:{...t[n.cards_borderPosition],width:e[d]}})));break;case"cards_borderPosition":H.setFieldsValue({cards_borderWidth:(null===(r=Y[e[d]])||void 0===r?void 0:r.width)||"",cards_borderColor:(null===(l=Y[e[d]])||void 0===l?void 0:l.color)||"",cards_borderStyle:(null===(i=Y[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:{[O[d]]:+e[d]}};break;case"cards_borderRadiusAll":case"cards_borderRadiusTopLeft":case"cards_borderRadiusBottomLeft":case"cards_borderRadiusTopRight":case"cards_borderRadiusBottomRight":c={cardsBorderRadius:{[q[d]]:+e[d]}};break;case"buttonsPaddingTop":case"buttonsPaddingLeft":case"buttonsPaddingRight":case"buttonsPaddingBottom":te?(c={padding:{all:+e[d]}},H.setFieldsValue({paddingTop:e[d],paddingLeft:e[d],paddingRight:e[d],paddingBottom:e[d]})):c={buttonsPadding:{[se[d]]:+e[d]}};break;default:c=e}"buttons_borderPosition"!==d&&a({operation:P.Ru.SANDBOX_EMAIL_SETTINGS_SET,settings:c})},autoComplete:"off",className:"element-controls",children:[ie?null:(0,M.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,M.jsx)("div",{className:"form-group-title",style:{paddingTop:0},children:o("General text")}),(0,M.jsx)(d.A,{trigger:["hover"],title:o("Font of the general text"),placement:"bottom",children:(0,M.jsx)(i.A.Item,{name:"textFontFamily",style:{marginBottom:U.formItemMarginBottomXS},children:(0,M.jsx)(k.A,{value:le.textFontFamily})})}),(0,M.jsxs)(c.A,{gutter:10,children:[(0,M.jsx)(m.A,{span:12,children:(0,M.jsx)(d.A,{trigger:["hover"],title:o("Font size of the general text"),placement:"bottom",children:(0,M.jsx)(i.A.Item,{name:"textFontSize",children:(0,M.jsx)(T.A,{min:15,max:de,placeholder:o("Font size"),prefix:(0,M.jsx)(g.A,{}),addonAfter:"px"})})})}),(0,M.jsx)(m.A,{span:12,children:(0,M.jsx)(d.A,{trigger:["hover"],title:o("Line height of the general text"),placement:"bottom",children:(0,M.jsx)(i.A.Item,{name:"textLineHeight",children:(0,M.jsx)(T.A,{min:0,placeholder:o("Line height"),prefix:(0,M.jsx)(b.A,{}),addonAfter:"px"})})})})]}),(0,M.jsxs)(c.A,{gutter:10,style:{paddingBottom:4},children:[(0,M.jsx)(m.A,{span:12,children:(0,M.jsx)(d.A,{trigger:["hover"],title:o("Color of the general text"),placement:"bottom",children:(0,M.jsx)(i.A.Item,{name:"textColor",children:(0,M.jsx)(w.A,{placeholder:o("Text color"),usedColors:V.usedColors})})})}),(0,M.jsx)(m.A,{span:12,children:(0,M.jsx)(d.A,{trigger:["hover"],title:o("Bottom padding of the general text"),placement:"bottom",children:(0,M.jsx)(i.A.Item,{name:"textPaddingBottom",children:(0,M.jsx)(T.A,{min:0,placeholder:o("Bottom padding"),prefix:(0,M.jsx)(f.A,{}),addonAfter:"px"})})})})]}),(0,M.jsx)(u.A,{className:"selected-td-form__divider"}),(0,M.jsx)("div",{className:"form-group-title",children:o("Headings")}),(0,M.jsx)(d.A,{trigger:["hover"],title:o("Heading font"),placement:"left",children:(0,M.jsx)(i.A.Item,{name:"headingFontFamily",style:{marginBottom:U.formItemMarginBottomXS},children:(0,M.jsx)(k.A,{})})}),(0,M.jsxs)(c.A,{gutter:10,children:[(0,M.jsx)(m.A,{span:12,children:(0,M.jsx)(d.A,{trigger:["hover"],title:o("Heading font size"),placement:"bottom",children:(0,M.jsx)(i.A.Item,{name:"headingFontSize",style:{marginBottom:U.formItemMarginBottomXS},children:(0,M.jsx)(T.A,{min:me,max:90,placeholder:o("Font size"),prefix:(0,M.jsx)(g.A,{}),addonAfter:"px"})})})}),(0,M.jsx)(m.A,{span:12,children:(0,M.jsx)(d.A,{trigger:["hover"],title:o("Heading line height"),placement:"bottom",children:(0,M.jsx)(i.A.Item,{name:"headingLineHeight",style:{marginBottom:U.formItemMarginBottomXS},children:(0,M.jsx)(T.A,{min:0,placeholder:o("Line height"),prefix:(0,M.jsx)(b.A,{}),addonAfter:"px"})})})})]}),(0,M.jsxs)(c.A,{gutter:10,children:[(0,M.jsx)(m.A,{span:12,children:(0,M.jsx)(d.A,{trigger:["hover"],title:o("Heading letter spacing"),placement:"bottom",children:(0,M.jsx)(i.A.Item,{name:"headingLetterSpacing",children:(0,M.jsx)(T.A,{min:0,placeholder:o("Letter spacing"),prefix:(0,M.jsx)(v.A,{}),addonAfter:"px"})})})}),(0,M.jsx)(m.A,{span:12,children:(0,M.jsxs)(p.A,{children:[(0,M.jsx)(h.Ay,{className:l()({"selected-td-form__button--active":le.headingBold}),type:"default",name:"headingBold",onClick:pe,children:(0,M.jsx)(y.A,{})}),(0,M.jsx)(h.Ay,{className:l()({"selected-td-form__button--active":le.headingItalic}),type:"default",name:"headingItalic",onClick:pe,children:(0,M.jsx)(x.A,{})})]})})]}),(0,M.jsxs)(c.A,{gutter:10,children:[(0,M.jsx)(m.A,{span:12,children:(0,M.jsx)(d.A,{trigger:["hover"],title:o("Heading color"),placement:"bottom",children:(0,M.jsx)(i.A.Item,{name:"headingColor",children:(0,M.jsx)(w.A,{placeholder:o("Heading color"),usedColors:V.usedColors})})})}),(0,M.jsx)(m.A,{span:12})]}),(0,M.jsxs)(c.A,{gutter:10,style:{paddingBottom:4},children:[(0,M.jsx)(m.A,{span:12,children:(0,M.jsx)(d.A,{trigger:["hover"],title:o("Top padding"),placement:"bottom",children:(0,M.jsx)(i.A.Item,{name:"headingPaddingTop",children:(0,M.jsx)(T.A,{min:0,placeholder:o("Top padding"),prefix:(0,M.jsx)(_.A,{}),addonAfter:"px"})})})}),(0,M.jsx)(m.A,{span:12,children:(0,M.jsx)(d.A,{trigger:["hover"],title:o("Bottom padding"),placement:"bottom",children:(0,M.jsx)(i.A.Item,{name:"headingPaddingBottom",children:(0,M.jsx)(T.A,{min:0,placeholder:o("Bottom padding"),prefix:(0,M.jsx)(f.A,{}),addonAfter:"px"})})})})]}),(0,M.jsx)(u.A,{className:"selected-td-form__divider"}),(0,M.jsx)("div",{className:"form-group-title",children:o("Links")}),(0,M.jsxs)(c.A,{gutter:10,style:{paddingBottom:4},children:[(0,M.jsx)(m.A,{span:12,children:(0,M.jsx)(d.A,{trigger:["hover"],title:o("Link color"),placement:"bottom",children:(0,M.jsx)(i.A.Item,{name:"linkColor",children:(0,M.jsx)(w.A,{placeholder:o("Link color"),usedColors:V.usedColors})})})}),(0,M.jsx)(m.A,{span:12,children:(0,M.jsx)(h.Ay,{className:l()({"selected-td-form__button--active":le.linkUnderline}),type:"default",name:"linkUnderline",onClick:pe,children:(0,M.jsx)(j.A,{})})})]}),(0,M.jsx)(u.A,{className:"selected-td-form__divider"}),(0,M.jsxs)("div",{className:"form-group-title",children:[o("Buttons")," ",(0,M.jsx)("span",{className:"form-group-title__bull",children:"\u2022"})," ",o("Text & background")]}),(0,M.jsx)(d.A,{trigger:["hover"],title:o("Buttons font"),placement:"left",children:(0,M.jsx)(i.A.Item,{name:"buttonsFontFamily",style:{marginBottom:U.formItemMarginBottomXS},children:(0,M.jsx)(k.A,{})})}),(0,M.jsxs)(c.A,{gutter:10,children:[(0,M.jsx)(m.A,{span:12,children:(0,M.jsx)(d.A,{trigger:["hover"],title:o("Buttons font size"),placement:"bottom",children:(0,M.jsx)(i.A.Item,{name:"buttonsFontSize",style:{marginBottom:U.formItemMarginBottomXS},children:(0,M.jsx)(T.A,{min:0,placeholder:o("Font size"),prefix:(0,M.jsx)(g.A,{}),addonAfter:"px"})})})}),(0,M.jsx)(m.A,{span:12,children:(0,M.jsx)(d.A,{trigger:["hover"],title:o("Buttons letter spacing"),placement:"bottom",children:(0,M.jsx)(i.A.Item,{name:"buttonsLetterSpacing",style:{marginBottom:U.formItemMarginBottomXS},children:(0,M.jsx)(T.A,{min:0,placeholder:o("Letter spacing"),prefix:(0,M.jsx)(v.A,{}),addonAfter:"px"})})})})]}),(0,M.jsxs)(c.A,{gutter:10,style:{paddingBottom:4},children:[(0,M.jsx)(m.A,{span:12,children:(0,M.jsx)(d.A,{trigger:["hover"],title:o("Buttons text color"),placement:"bottom",children:(0,M.jsx)(i.A.Item,{name:"buttonsColor",children:(0,M.jsx)(w.A,{placeholder:o("Buttons text color"),usedColors:V.usedColors})})})}),(0,M.jsx)(m.A,{span:12,children:(0,M.jsxs)(p.A,{children:[(0,M.jsx)(h.Ay,{className:l()({"selected-td-form__button--active":le.buttonsBold}),type:"default",name:"buttonsBold",onClick:pe,children:(0,M.jsx)(y.A,{})}),(0,M.jsx)(h.Ay,{className:l()({"selected-td-form__button--active":le.buttonsItalic}),type:"default",name:"buttonsItalic",onClick:pe,children:(0,M.jsx)(x.A,{})})]})}),W.formButtonFieldTextAlignEnabled&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(m.A,{span:12,children:(0,M.jsx)(C.A,{form:H,elementSettings:{textAlign:"",type:"email"},imgParent:!1,name:"buttonsAlign"})}),(0,M.jsx)(m.A,{span:12,children:(0,M.jsx)(d.A,{trigger:["hover"],title:o("Buttons background color"),placement:"bottom",children:(0,M.jsx)(i.A.Item,{name:"buttonsBackgroundColor",children:(0,M.jsx)(w.A,{placeholder:o("Background color"),usedColors:V.usedColors})})})})]})]}),W.formFieldBorderEnabled&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(u.A,{className:"selected-td-form__divider"}),(0,M.jsxs)("div",{className:"form-group-title",children:[o("Buttons")," ",(0,M.jsx)("span",{className:"form-group-title__bull",children:"\u2022"})," ",o("Borders")]}),(0,M.jsx)("div",{style:{paddingBottom:4},children:(0,M.jsx)(E.A,{borders:G,namePrefix:"buttons_"})})]}),W.formFieldBorderRadiusEnabled&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(u.A,{className:"selected-td-form__divider"}),(0,M.jsxs)("div",{className:"form-group-title",children:[o("Buttons")," ",(0,M.jsx)("span",{className:"form-group-title__bull",children:"\u2022"})," ",o("Border radius")]}),(0,M.jsx)("div",{style:{paddingBottom:4},children:(0,M.jsx)(I.A,{form:H,oneBorderRadiusValue:Z,setOneBorderRadiusValue:J,elementSettings:le,namePrefix:"buttons_"})})]}),(0,M.jsx)(u.A,{className:"selected-td-form__divider"}),(0,M.jsxs)("div",{className:"form-group-title",children:[o("Buttons")," ",(0,M.jsx)("span",{className:"form-group-title__bull",children:"\u2022"})," ",o("Margins")]}),(0,M.jsxs)(c.A,{gutter:10,style:{paddingBottom:4},children:[(0,M.jsx)(m.A,{span:12,children:(0,M.jsx)(d.A,{trigger:["hover"],title:o("Top margin"),placement:"top",children:(0,M.jsx)(i.A.Item,{name:"buttonsMarginTop",children:(0,M.jsx)(T.A,{min:0,placeholder:o("Top margin"),prefix:(0,M.jsx)(_.A,{}),addonAfter:"px"})})})}),(0,M.jsx)(m.A,{span:12,children:(0,M.jsx)(d.A,{trigger:["hover"],title:o("Bottom margin"),placement:"top",children:(0,M.jsx)(i.A.Item,{name:"buttonsMarginBottom",children:(0,M.jsx)(T.A,{min:0,placeholder:o("Bottom margin"),prefix:(0,M.jsx)(f.A,{}),addonAfter:"px"})})})})]}),(0,M.jsx)(u.A,{className:"selected-td-form__divider"}),(0,M.jsxs)("div",{className:"form-group-title",children:[o("Cards")," ",(0,M.jsx)("span",{className:"form-group-title__bull",children:"\u2022"})," ",o("Colors")]}),(0,M.jsxs)(c.A,{gutter:10,children:[(0,M.jsxs)(m.A,{span:12,children:[(0,M.jsx)("div",{className:"form-group-title",style:{paddingTop:0,paddingBottom:U.formItemMarginBottomXS},children:o("Base colors")}),(0,M.jsx)(d.A,{trigger:["hover"],title:o("Base background color"),placement:"bottom",children:(0,M.jsx)(i.A.Item,{name:"cardsBaseBackgroundColor",style:{marginBottom:U.formItemMarginBottomXS},children:(0,M.jsx)(w.A,{placeholder:o("Base background color"),usedColors:V.usedColors})})})]}),(0,M.jsxs)(m.A,{span:12,children:[(0,M.jsx)("div",{className:"form-group-title",style:{paddingTop:0,paddingBottom:U.formItemMarginBottomXS},children:o("Contrasting colors")}),(0,M.jsx)(d.A,{trigger:["hover"],title:o("Contrasting background color"),placement:"bottom",children:(0,M.jsx)(i.A.Item,{name:"cardsContrastBackgroundColor",style:{marginBottom:U.formItemMarginBottomXS},children:(0,M.jsx)(w.A,{placeholder:o("Contrasting background color"),usedColors:V.usedColors})})})]})]}),(0,M.jsxs)(c.A,{gutter:10,style:{paddingBottom:4},children:[(0,M.jsx)(m.A,{span:12,children:(0,M.jsx)(d.A,{trigger:["hover"],title:o("Base text color"),placement:"bottom",children:(0,M.jsx)(i.A.Item,{name:"cardsBaseTextColor",children:(0,M.jsx)(w.A,{placeholder:o("Base text color"),usedColors:V.usedColors})})})}),(0,M.jsx)(m.A,{span:12,children:(0,M.jsx)(d.A,{trigger:["hover"],title:o("Contrasting text color"),placement:"bottom",children:(0,M.jsx)(i.A.Item,{name:"cardsContrastTextColor",children:(0,M.jsx)(w.A,{placeholder:o("Contrasting text color"),usedColors:V.usedColors})})})})]}),W.formFieldBorderEnabled&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(u.A,{className:"selected-td-form__divider"}),(0,M.jsxs)("div",{className:"form-group-title",children:[o("Cards")," ",(0,M.jsx)("span",{className:"form-group-title__bull",children:"\u2022"})," ",o("Borders")]}),(0,M.jsx)("div",{style:{paddingBottom:4},children:(0,M.jsx)(E.A,{borders:Y,namePrefix:"cards_"})})]}),W.formFieldBorderRadiusEnabled&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(u.A,{className:"selected-td-form__divider"}),(0,M.jsxs)("div",{className:"form-group-title",children:[o("Cards")," ",(0,M.jsx)("span",{className:"form-group-title__bull",children:"\u2022"})," ",o("Border radius")]}),(0,M.jsx)("div",{style:{paddingBottom:4},children:(0,M.jsx)(I.A,{form:H,oneBorderRadiusValue:Q,setOneBorderRadiusValue:ee,elementSettings:le,namePrefix:"cards_"})})]})]})})};H.defaultProps={className:""};const V=H},88296:(e,t,o)=>{o.d(t,{A:()=>c});var s=o(92810),r=o(79579),l=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,l.s9)(),u=[],p=[],[h,g]=(0,s.useState)(),[b,f]=(0,s.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,s.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 s;g(["Google Fonts","Serif",null===(s=y.find((t=>(null===t||void 0===t?void 0:t.family.replace(/\s/g,""))===e[2].replace(/\s/g,""))))||void 0===s?void 0:s.family,e[3].replace(/Italic/g," Italic")])}else"Safe Fonts"!==e[0]&&void 0!==h||g(e);else g([""]);else void 0===h&&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 s=o(92810),r=o(95838),l=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),j=o(23287),A=o(85163),S=o(86286),k=o(64037),w=o(62303),C=o(18777),E=o(86739),I=o(55701),T=o(45695),N=o(32269),R=o(32411),L=o(38883),B=o.n(L),P=o(70082);const{useToken:F}=r.A,{TextArea:M}=l.A,D=({comments:e,subjectId:t,isLoggedIn:o,projectTitle:r="",emailElementType:L,email:D})=>{const{__:z,_n:O}=(0,j.s9)(),q=(0,T.XW)(),{modal:H}=a.A.useApp(),{error:V,notification:$}=H,{token:W}=F(),U=(0,s.useRef)(null),[G,X]=(0,s.useState)(""),[Y,K]=(0,s.useState)("ADD"),[Z,J]=(0,s.useState)(!1),[Q,ee]=(0,s.useState)(null),[te,oe]=(0,s.useState)(null),[se,re]=(0,s.useState)(""),[le,ae]=(0,s.useState)(""),[ie,ne]=(0,s.useState)(!1),[de,ce]=(0,s.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,I.yW)(),_e=(0,b.d4)(S.C1),je=(0,R.fn)(),Ae=()=>{const e={title:null===D||void 0===D?void 0:D.title,emailId:null===D||void 0===D?void 0:D.id,project:null===D||void 0===D?void 0:D.project,html:null===je||void 0===je?void 0:je.getValue(),excerpt:null===D||void 0===D?void 0:D.date_gmt};"email"===L?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 Se(e){oe(Q),re(""),K("REPLY")}const ke=()=>{V({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:le,targetId:de}).unwrap(),K("ADD"),ae(""),oe(0),ne(!1),J(!1),ce(""),q({operation:A.Ru.SANDBOX_DISCUSS_RESET})):ke()}const Ce=e=>{K("ADD"),ae(""),oe(0),ne(!1),J(!1),ce(""),q({operation:A.Ru.SANDBOX_DISCUSS_RESET})},Ee=async()=>{o?((G||se)&&await me({subjectId:t,author:_e.id,parent:"ADD"===Y?"0":te,content:G||se,author_name:_e.name,author_email:_e.email,targetId:de}).then((e=>{e.error&&$.error({message:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.code}}),description:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.message}}),placement:"bottomRight"})})),ce(""),K("ADD"),re(""),X(""),oe(0),ne(!1),J(!1),q({operation:A.Ru.SANDBOX_DISCUSS_RESET})):ke()};function Ie(){ie?(J(!1),ne(!1),q({operation:A.Ru.SANDBOX_DISCUSS_REMOVE_TARGET,value:de})):(J(!Z),q({operation:A.Ru.SANDBOX_DISCUSS_SET_TARGET,value:!Z}),Z&&ne(!1))}(0,k.A)((e=>{const t=e.data.operation;if(t===A.Ru.APPLICATION_DISCUSS_SET_ID&&(ce(e.data.settings.value),""!==e.data.settings.value?(ne(!0),J(!1)):(ne(!1),J(!0))),t===A.Ru.APPLICATION_DISCUSS_SAVE_TARGET&&Ae(),t===A.Ru.APPLICATION_DISCUSS_GET_COMMENT)if(document.querySelector('.comment-icon-target[target-id="'+e.data.settings.targetId+'"]')){let t=document.querySelector('.comment-icon-target[target-id="'+e.data.settings.targetId+'"]').closest(".ant-comment");document.querySelector(".comment-block")?document.querySelector(".comment-block").scrollTo(0,t.offsetTop):document.querySelector(".em-analytics__email-tab-discuss .ant-tabs-content").scrollTo(0,t.offsetTop),t.classList.add("active"),setTimeout((()=>{t.classList.remove("active")}),2e3)}else q({operation:A.Ru.SANDBOX_DISCUSS_REMOVE_TARGET,value:e.data.settings.targetId}),$.error({message:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:z("There's no such comment.")}}),placement:"bottomRight"});t===A.Ru.APPLICATION_DISCUSS_NO_COMMENT&&$.error({message:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:z("There's no such element in the email.")}}),placement:"bottomRight"})}));const Te=e=>{q({operation:A.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:B()(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?Be: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:()=>Te(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&&Le,"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:le,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:U})}),(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:A.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:Ie,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")})]})})]}),Le=(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:se,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:U})}),(0,P.jsx)(c.A.Item,{hidden:!0,name:"targetId",children:(0,P.jsx)(l.A,{type:"hidden"})}),(0,P.jsx)(c.A.Item,{className:"buttons",children:(0,P.jsxs)(m.A,{children:[(0,P.jsx)(h.A,{placement:"top",title:z("Add a note"),overlayStyle:{maxWidth:"150px"},children:(0,P.jsx)(p.Ay,{onClick:Ie,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,s.useEffect)((()=>{"REPLY"===Y&&U.current.focus({cursor:"start"}),"EDIT"===Y&&U.current.focus({cursor:"end"})}),[Y]);let Be=[];Be.push({key:"Reply to comment",icon:(0,P.jsx)(y.A,{style:{fontSize:"16px"}}),label:z("Reply"),onClick:Se},{key:"Edit comment",icon:(0,P.jsx)(x.A,{style:{fontSize:"16px"}}),label:z("Edit"),onClick:function(t){var o,s,r,l,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===(s=o.target_id)||void 0===s?void 0:s.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===(l=r.content)||void 0===l||null===(a=l.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:A.Ru.SANDBOX_DISCUSS_REMOVE_TARGET,value:null===(o=document.querySelector('.discuss-main li[id="'+Q+'"] .comment-icon-target'))||void 0===o?void 0:o.getAttribute("target-id")}),Ae(),ce("")}});let Pe=[];return Pe.push({key:"Reply to comment",icon:(0,P.jsx)(y.A,{style:{fontSize:"16px"}}),label:z("Reply"),onClick:Se}),(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=[],s=new Map;for(let r=0,l=t.length;r<l;++r){let e=t[r],l=s.get(e.id);if(l&&!Array.isArray(l)||(l&&(e.children=l),s.set(e.id,e)),"0"===String(e.parent))o.push(e);else{let t=s.get(e.parent);if(t){(Array.isArray(t)?t:t.children=t.children||[]).push(e)}else s.set(e.parent,[e])}}return o.forEach((e=>{"deleted"!==e.status||e.children||!he.isUninitialized&&!he.isSuccess||pe(e.id).unwrap().catch((e=>{}))})),o}(e),renderItem:e=>(0,P.jsxs)("li",{id:e.id,children:["deleted"===e.comment_status&&(0,P.jsx)(g.A,{className:"deletedComment",content:(0,P.jsx)(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:B()(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?Be: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:()=>Te(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&&Le,"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:G,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:Ie,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 s=o(92810),r=o(55039),l=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),j=o(86286),A=o(65983),S=o(32269),k=o(23287),w=o(56991),C=o(47381),E=o(93982),I=o(71157),T=o(45695),N=o(32411),R=o(58689),L=o(85163),B=o(13522),P=o(70082);const F=e=>{const{__:t}=(0,k.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})=>{const t=(0,N.fn)(),{__:o,_n:r}=(0,k.s9)(),D=(0,h.wA)(),z=(0,s.useRef)(null),O=(0,w.rD)(),q=(0,I.hN)(),{projectId:H,emailId:V}=(0,u.g)(),$=(0,C.u)(),W=(0,E.ml)(B.A.ON_LIMIT_ID),[U,G]=(0,s.useState)(null),[X,Y]=(0,s.useState)(0),[K,Z]=(0,s.useState)(!1),[J,Q]=(0,s.useState)(""),[ee,te]=(0,s.useState)([]),[oe,se]=(0,s.useState)(!1),[re,le]=(0,s.useState)(!1),[ae,ie]=(0,s.useState)(null),[ne,de]=(0,s.useState)(0),[ce,me]=(0,s.useState)(null),ue=(0,h.d4)(A.Hs),pe=(0,h.d4)(j.C1),he=(0,T.QC)(),[ge]=(0,x.YG)(),be=(0,T.XW)(),[fe,ve]=(0,x.EQ)(),[ye,{reset:xe}]=(0,_.MN)(),[_e,{data:je=[]}]=(0,_.y4)(),Ae={cursor:K?"not-allowed":"default",pointerEvents:K?"none":"auto"},Se=!(!O.limits||!O.counters)&&L.EW.isPlugin,{limits:ke}=L.EW.isPlugin&&O.limits?O:{limits:{ai_limit:0,ai_generator_limit:0}},{ai_limit:we,ai_generator_limit:Ce}=ke,Ee=Se&&X>=we&&we>0,Ie=Se&&ne>=Ce&&Ce>0,Te=(0,s.useCallback)((()=>{W.fire({name:"AiChatCount",count:X+1})}),[W,X]),Ne=(0,s.useCallback)((()=>{W.fire({name:"AiGeneratorCount",count:ne+1})}),[W,ne]);(0,s.useEffect)((()=>{var e,t;Se&&(Y((null===O||void 0===O||null===(e=O.counters)||void 0===e?void 0:e.ai_counter)||0),de((null===O||void 0===O||null===(t=O.counters)||void 0===t?void 0:t.ai_generator_counter)||0))}),[O,Se]),(0,s.useEffect)((()=>{me((()=>{var e;if(ee.length<=0)return!1;return"email-generator"===(null===(e=ee.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)})())}),[ee]);const Re=(0,s.useCallback)((async()=>await he.sendAsync(L.Ru.SANDBOX_IS_EMAIL_EMPTY)),[he]),Le=(0,s.useCallback)((()=>{var e;const t=null===(e=z.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)}),[z]),Be=(0,s.useCallback)((()=>{ge({entity_id:V}).then((e=>{te(e.data.documents),Le()}))}),[V,ge,te,Le]),Pe=(0,s.useCallback)((()=>{se(!0),Z(!0),ye({task_id:U,entity_id:V,status:"started"}).then((()=>{Be()}))}),[V,ye,U,Be]),Fe=(0,s.useCallback)((()=>{ye({task_id:U,entity_id:V,status:"completed"}).then((e=>{403===e.data.status&&xe(),Be()})).catch((e=>{console.log("err",e)})),Z(!1),se(!1)}),[V,ye,U,Be,xe]);(0,s.useEffect)((()=>{let e;if(oe){var o,s;const r=null===(o=je[je.length-1])||void 0===o||null===(s=o.processing)||void 0===s?void 0:s.email;if(r){let o=je[je.length-1].status;e=setInterval(t.setValue(r),500),0===o&&Fe()}ae&&(clearInterval(e),D((0,A.AJ)(r)),se(!1),ie(!1))}return()=>{clearInterval(e)}}),[t,ae,D,je,oe,ue,V,U,Be,ye,ve,Fe]),(0,s.useEffect)(Le,[Le]),(0,s.useEffect)((()=>{(null===e||void 0===e?void 0:e.length)>0&&te(e),be({operation:L.Ru.SANDBOX_EMAIL_CONTENT_GET})}),[e,be]),(0,s.useEffect)((()=>{const e=he.onInit((()=>{he.send({operation:L.Ru.SANDBOX_LOCK_EDIT,data:K}),he.send({operation:L.Ru.SANDBOX_LOCK_DISCUSS,value:K})}));return()=>e.dispose()}),[K,he]);const Me=async()=>{if(J){const e=J.replaceAll(/\n/g,"<br>"),s={project_id:H,connection:"chat",entity_id:V,message:e,locale:pe.locale.slice(0,2),subject:ue.subject||"",preheader:ue.preheader||"",textContent:(0,R.T5)(t.getValue())};if(ce&&Ie||Ee){q.error({message:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:o(ce?"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:o("Please upgrade your plan.")}}),placement:"bottomRight"});const e={data:{role:"assistant",message:o(ce?"You have reached the limit of AI generator usage.":"You have reached the limit of AI chat usage.")}};te((t=>[...t,e]))}else{Se&&(ce&&ne!==Ce?(Ne(),de((e=>e+1))):X!==we&&(Te(),Y((e=>e+1)))),$({event:"submit_form",action:"chat_whit_ai_assistant",entity_id:s.entity_id,project_id:s.project_id});const t=[{data:{role:"user",message:e,userInfo:{display_name:pe.first_name+" "+pe.last_name,avatar_url:pe.avatar_urls[24]}}},{data:{role:"assistant",message:"\u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442",isLoading:!0}}];te((e=>[...e,...t])),fe({body:s}).then((e=>{if(401===e.data.status)throw new Error(L.ff);if(e.data.task_id){let t=e.data.task_id;G(t),_e({id:t,setError:ie}),Re().then((e=>{e?Pe():le(!0)}))}Be()})).catch((e=>{var t,s;q.error({message:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:(null===e||void 0===e||null===(t=e.data)||void 0===t?void 0:t.code)||o("Error")}}),description:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:(null===e||void 0===e||null===(s=e.data)||void 0===s?void 0:s.message)||o("Something went wrong.")}}),placement:"bottomRight"})}))}Q("")}},De=e=>{const s={data:{role:"assistant",message:"\u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442",isLoading:!0}};te((e=>[...e,s]));const r={project_id:H,connection:"chat",entity_id:V,context:e,locale:pe.locale.slice(0,2),subject:ue.subject||"",preheader:ue.preheader||"",textContent:(0,R.T5)(t.getValue())};if(Se&&(ce&&ne!==Ce?(Ne(),de((e=>e+1))):X!==we&&(Te(),Y((e=>e+1)))),Ee){q.error({message:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:o("You have reached the limit of AI chat usage.")}}),description:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:o("Please upgrade your plan.")}}),placement:"bottomRight"});const e={data:{role:"assistant",message:o("You have reached the limit of AI chat usage.")}};te((t=>[...t,e]))}else $({event:"select",action:"select_ai_assistant_role",context:r.context,entity_id:r.entity_id,project_id:r.project_id}),fe({body:r}).then((e=>{if(401===e.data.status)throw new Error(L.ff);Be()})).catch((e=>{var t,o;q.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"})}))},ze=(0,s.useCallback)((e=>{const s={data:{role:"user",message:e,userInfo:{display_name:pe.first_name+" "+pe.last_name,avatar_url:pe.avatar_urls[24]}}},r={data:{role:"assistant",message:"\u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442",isLoading:!0}};te((e=>[...e,s,r]));const l={project_id:H,connection:"chat",entity_id:V,message:e,locale:pe.locale.slice(0,2),subject:ue.subject||"",preheader:ue.preheader||"",textContent:(0,R.T5)(t.getValue())};if(Ie){q.error({message:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:o("You have reached the limit of AI generator usage.")}}),description:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:o("Please upgrade your plan.")}}),placement:"bottomRight"});const e={data:{role:"assistant",message:o("You have reached the limit of AI chat usage.")}};te((t=>[...t,e]))}else fe({body:l}).then((e=>{if(401===e.data.status)throw new Error(L.ff);if(e.data.task_id){let t=e.data.task_id;G(t),_e({id:t,setError:ie}),Re().then((e=>{e?Pe():le(!0)}))}Se&&(ce&&ne!==Ce?(Ne(),de((e=>e+1))):X!==we&&(Te(),Y((e=>e+1)))),Be()})).catch((e=>{var t,o;q.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"})}))}),[o,X,ne,Re,Pe,we,Ce,pe,ue,V,ce,Ie,Te,Ne,Se,t,q,H,fe,_e,Be]);(0,s.useEffect)((()=>{const e=window.localStorage.getItem(L.V0.em_ai_settings);if(1===ee.length&&"assistant"===ee[0].data.role&&e&&V){const t=new S.jG,o={project_id:H,connection:"chat",entity_id:V,context:"email-generator",locale:pe.locale.slice(0,2)};window.localStorage.removeItem(L.V0.em_ai_settings),fe({body:o}).then((({data:o})=>{t.isDisposed()||ze(e)}))}}),[ee,ze,V,pe.locale,H,fe]);const Oe={replace:e=>{var t,s,r,a,i,n,d,c;if(null!==(t=e.attribs)&&void 0!==t&&null!==(s=t.class)&&void 0!==s&&s.split(" ").includes("ai-response-title"))return(0,P.jsx)(l.A,{placement:"left",title:o("Replace the title"),children:(0,P.jsx)("div",{onClick:()=>(e=>{const t=e.children[0].data;he.send(L.Ru.SANDBOX_SUBJECT_UPDATE,{value:e.children[0].data,guid:ue.renderGuid,fromAI:!0}),q.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",message:o("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,Oe)})})});if(null!==(r=e.attribs)&&void 0!==r&&null!==(a=r.class)&&void 0!==a&&a.split(" ").includes("ai-response-preheader"))return(0,P.jsx)(l.A,{placement:"left",title:o("Replace the preheader"),children:(0,P.jsx)("div",{onClick:()=>(e=>{const t=e.children[0].data;he.send(L.Ru.SANDBOX_PREHEADER_UPDATE,{value:e.children[0].data,guid:ue.renderGuid,fromAI:!0}),q.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",message:o("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,Oe)})})});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)(l.A,{placement:"left",title:o("Copy to clipboard"),children:(0,P.jsx)("div",{onClick:()=>(e=>{const t=e.children[0].data;navigator.clipboard.writeText(t).then((()=>{q.success({id:"TEXT_COPIED_TO_CLIPBOARD",message:o("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,Oe)})})});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:()=>ze(t),children:(0,p.zd)(e.children,Oe)})}}};return(0,P.jsxs)("div",{ref:z,className:"discuss-main",children:[ee.length>0&&(0,P.jsx)(a.A,{onClick:e=>{"string"===typeof e.target.className&&e.target.className.includes("ai-response-change-context")&&(ve.isLoading||De(e.target.role))},className:"comment-list",itemLayout:"horizontal",dataSource:ee,renderItem:e=>{var t,s,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&&L.EW.isPlugin?pe.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:Ae,children:"user"===(null===e||void 0===e||null===(t=e.data)||void 0===t?void 0:t.role)?L.EW.isPlugin?(null===pe||void 0===pe?void 0:pe.username)||o("User"):null===(s=e.data)||void 0===s||null===(l=s.userInfo)||void 0===l?void 0:l.display_name:o("AI Assistant")}),datetime:e._created?(0,P.jsx)("span",{dangerouslySetInnerHTML:{__html:(0,S.Yq)((0,m.A)(e._created),r,!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:Ae,children:(0,p.Ay)(e.data.message,Oe)})})},e._id)}}),Se&&(ce?(0,P.jsx)(v.A,{text:o("mail generator"),counter:ne,limits:Ce,wrapperStyles:{marginTop:-25}}):(0,P.jsx)(v.A,{text:o("messeges"),counter:X,limits:we,wrapperStyles:{marginTop:-25}})),(0,P.jsxs)(i.A,{onFinish:Me,className:"addMode",children:[(0,P.jsx)(i.A.Item,{style:{marginBottom:10},children:(0,P.jsx)(M,{disabled:K,value:J,onChange:e=>Q(e.target.value),rows:4,placeholder:o("Type your request"),className:"textarea-comment",onPressEnter:e=>"Enter"===e.key&&e.ctrlKey&&Me(),spellCheck:"false"})}),(0,P.jsxs)(i.A.Item,{children:[(0,P.jsx)(n.Ay,{disabled:ve.isLoading||K,type:"default",style:{background:"var(--colorInfo)",color:"#ffffff"},className:"button-target",children:(0,P.jsx)(d.A,{placement:"top",disabled:K,arrow:{pointAtCenter:!0},menu:{items:F(De)},children:(0,P.jsxs)("div",{disabled:K,style:{margin:0,padding:0},children:[(0,P.jsx)(g.A,{icon:"ChatGpt"}),o("Role")]})},"Export")}),(0,P.jsxs)(n.Ay,{disabled:ve.isLoading||K,className:"button-add",type:"primary",htmlType:"submit",children:[o("Send")," ",(0,P.jsx)(g.A,{icon:"SendOutlined"})]})]})]}),(0,P.jsx)(c.A,{title:o("Warning"),centered:!0,open:re,onOk:()=>{Pe(),le(!1)},onCancel:()=>{Fe(),le(!1)},children:(0,P.jsx)("p",{children:o("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 s=o(92810),r=o(78159),l=o(70082);const a=s.forwardRef(((e,t)=>{const[o,a]=(0,s.useState)(!1),[i,n]=(0,s.useState)(0),[d,c]=(0,s.useState)(e.value||e.defaultValue),[m,u]=(0,s.useState)(e.value||e.defaultValue),p=()=>a(!1),h=(0,s.useCallback)((t=>{if(o){const o=t.clientX-i;let s=(d||0)+o*e.dragspeed;s=Math.max(0,Math.round(s)),e.max&&(s=Math.min(s,e.max)),u(s),e.onChange&&e.onChange(s)}}),[o,e,d,i]);return(0,s.useEffect)((()=>{e.value||0===e.value?u(e.value):e.defaultValue||0===e.defaultValue?u(e.defaultValue):u(null)}),[e.value,e.defaultValue]),(0,s.useEffect)((()=>(document.addEventListener("mouseup",p),document.addEventListener("mousemove",h),()=>{document.removeEventListener("mouseup",p),document.removeEventListener("mousemove",h)})),[o,i,d,h]),(0,l.jsxs)("div",{onMouseDown:e=>{var t,o;e.target.hasAttribute("class")&&null!==(t=e.target)&&void 0!==t&&null!==(o=t.className)&&void 0!==o&&o.includes("ant-input-number-affix-wrapper")&&(a(!0),n(e.clientX),c(m))},children:[(0,l.jsx)(r.A,{...e,ref:t,value:m,className:"input-draggable"}),o&&(0,l.jsx)("div",{style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",cursor:"ew-resize"},onMouseUp:p})]})}));a.defaultProps={dragspeed:1};const i=a},65052:(e,t,o)=>{o.d(t,{A:()=>P});var s=o(92810),r=o(45934),l=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),j=o(86286),A=o(65983),S=o(39990),k=o(83351),w=o(44997),C=o(32269),E=o(69156),I=o(45695),T=o(90070),N=o(85163),R=o(70082);const{Option:L}=l.A,B="profile",P=({isModalVisible:e})=>{const{__:t}=(0,x.s9)(),o=(0,r.d4)(j.C1),P=(0,r.d4)(j.yf),F=(0,h.hN)(),M=(0,I.XW)(),D=(0,r.wA)(),[z]=a.A.useForm(),O=(0,T.p6)(),[q,H]=(0,S.b9)(),[V,$]=(0,S.hZ)(),[W]=(0,k.uX)(),[U,G]=(0,s.useState)([]),[X,Y]=(0,s.useState)([]),[K,Z]=(0,s.useState)(B),[J,Q]=(0,s.useState)({currentPassword:!1,newPassword:!1,confirmPassword:!1}),[ee,te]=(0,s.useState)((()=>o.locale)),oe=(0,s.useRef)(null),se=t("If you turn the switch off, lines of code will not wrap. If you turn the switch on, lines of code will wrap at the viewport.");(0,s.useEffect)((()=>{if(z&&e){Z(B),V(void 0,!0);const e=o.code_editor;te(o.locale),z.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,z,e,V,te]),(0,s.useEffect)((()=>{if(z&&e){if($.isSuccess){var t,o,s,r;let e=null===(t=(0,C.EU)(P,["acf","theme"]))||void 0===t||null===(o=t.items)||void 0===o?void 0:o.enum;const l=null===(s=(0,C.EU)(P,["acf","code_editor","font_family"]))||void 0===s||null===(r=s.items)||void 0===r?void 0:r.enum;G((0,C.d_)(e)),Y((0,C.d_)(l))}$.isError&&(0,C.p6)($,F)}}),[$,z,e,P,F]);const re=()=>{const e=window.localStorage.getItem(N.V0.em_color_scheme),s=matchMedia(N.F3).matches?N.nd:N.T;M({operation:N.Ru.UPDATE_PREVIEW,theme:e||s}),z.validateFields().then((e=>{const s=e.codeEditor;e.currentPassword&&e.newPassword?W({username:o.email,password:e.currentPassword}).then((o=>{o.error?(z.setFieldsValue({currentPassword:"",newPassword:"",confirmPassword:""}),oe.current.focus({cursor:"start"}),F.error({message:(0,R.jsx)("div",{dangerouslySetInnerHTML:{__html:t("You entered the current password incorrectly.")}}),description:(0,R.jsx)("div",{dangerouslySetInnerHTML:{__html:t("Please, try to change your password again.")}}),placement:"bottomRight"})):(O.set(N.A9.em_token,o.data.token,{expires:30}),q({password:e.newPassword}))})):q({first_name:e.firstName,last_name:e.lastName,email:e.email,locale:e.language,autosaves:e.autosaves,hide_mergetags:e.hideMergetags,theme:e.theme,newsletter_consent:e.newsLetterConsent,code_editor:s?{font_size:s.fontSize,font_family:s.fontFamily,tab_size:s.tabSize,word_wrap:s.wordWrap,minimap:s.minimap,insert_spaces:s.insertSpaces}:null})}))};(0,s.useEffect)((()=>{H.isError&&(0,C.p6)(H,F)}),[H,F]),(0,s.useEffect)((()=>{H.isSuccess&&((0,C.wB)(t("Your profile was successfully updated."),F),D((0,_.Oo)()))}),[D,H,t,F]);const[le,ae]=(0,s.useState)("");(0,s.useEffect)((()=>{const t=window.localStorage.getItem(N.V0.em_color_scheme);e&&(z.setFieldsValue({theme:null!==t?t:N.IJ}),ae(null!==t?t:N.IJ))}),[z,e]);const ie=(0,s.useCallback)((e=>{let t;if((0,E.Hk)(e),e===N.IJ){const e=matchMedia(N.F3).matches?N.nd:N.T;localStorage.removeItem(N.V0.em_color_scheme),t=e}else localStorage.setItem(N.V0.em_color_scheme,e),t=e;D((0,A.eX)(t===N.nd?`vs-${t}`:N.T)),(0,E.A5)(t)}),[D]),ne=(0,s.useCallback)((()=>{le!==z.getFieldValue("theme")&&ie(le),D((0,j.ww)(o.code_editor)),D((0,j.ko)(ee)),D((0,_.Oo)())}),[o.code_editor,D,z,le,ie,ee]);let de=[{label:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(g.A,{}),t("Profile")]}),key:B,className:"em-analytics__profile-user",children:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(i.A,{gutter:16,children:[(0,R.jsxs)(n.A,{span:12,children:[" ",(0,R.jsx)(a.A.Item,{label:t("First name"),name:"firstName",children:(0,R.jsx)(d.A,{placeholder:t("Enter your first name")})})]}),(0,R.jsx)(n.A,{span:12,children:(0,R.jsx)(a.A.Item,{label:t("Last name"),name:"lastName",children:(0,R.jsx)(d.A,{placeholder:t("Enter your last name")})})})]}),(0,R.jsxs)(i.A,{gutter:16,children:[(0,R.jsx)(n.A,{span:12,children:(0,R.jsx)(a.A.Item,{label:t("Email"),name:"email",children:(0,R.jsx)(d.A,{disabled:!0,placeholder:t("Enter your email")})})}),(0,R.jsx)(n.A,{span:12,children:(0,R.jsx)(a.A.Item,{label:t("Theme"),name:"theme",children:(0,R.jsx)(l.A,{placeholder:t("Select a theme"),children:U.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,R.jsx)(L,{value:e.value,children:o},e.value)}))})})})]}),(0,R.jsxs)(i.A,{gutter:16,children:[(0,R.jsx)(n.A,{span:12,children:(0,R.jsx)(a.A.Item,{label:t("Newsletter Subscription"),valuePropName:"checked",name:["newsLetterConsent"],children:(0,R.jsx)(c.A,{})})}),(0,R.jsx)(n.A,{span:12,children:(0,R.jsx)(a.A.Item,{label:t("Autosave in editor"),valuePropName:"checked",name:["autosaves"],children:(0,R.jsx)(c.A,{})})})]})]})},{label:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(b.A,{}),t("Code editor")]}),key:"editor",className:"account-settings-codeiditor-tab-content em-analytics__profile-code-editor",children:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(i.A,{gutter:16,children:[(0,R.jsx)(n.A,{span:8,children:(0,R.jsx)(a.A.Item,{label:t("Font size"),name:["codeEditor","fontSize"],children:(0,R.jsx)(w.A,{min:6,max:100})})}),(0,R.jsx)(n.A,{span:8,children:(0,R.jsx)(a.A.Item,{label:t("Tab size"),name:["codeEditor","tabSize"],children:(0,R.jsx)(w.A,{min:1,max:10})})}),(0,R.jsx)(n.A,{span:8,children:(0,R.jsx)(a.A.Item,{label:t("Font family"),name:["codeEditor","fontFamily"],children:(0,R.jsx)(l.A,{placeholder:t("Select a font family"),children:X.map((e=>(0,R.jsx)(L,{value:e.value,children:e.label},e.value)))})})})]}),(0,R.jsxs)(i.A,{gutter:16,children:[(0,R.jsx)(n.A,{span:8,children:(0,R.jsx)(a.A.Item,{label:t("Line wrap"),valuePropName:"checked",name:["codeEditor","wordWrap"],tooltip:{title:se,icon:(0,R.jsx)(f.A,{})},children:(0,R.jsx)(c.A,{})})}),(0,R.jsx)(n.A,{span:8,children:(0,R.jsx)(a.A.Item,{label:t("Minimap"),valuePropName:"checked",name:["codeEditor","minimap"],tooltip:{title:t("Display the minimap."),icon:(0,R.jsx)(f.A,{})},children:(0,R.jsx)(c.A,{})})}),(0,R.jsx)(n.A,{span:8,children:(0,R.jsx)(a.A.Item,{label:t("Insert spaces"),valuePropName:"checked",name:["codeEditor","insertSpaces"],tooltip:{title:t("Prefer spaces over tabs."),icon:(0,R.jsx)(f.A,{})},children:(0,R.jsx)(c.A,{})})})]})]})},{label:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(v.A,{}),t("Security")]}),key:"security",className:"account-settings-security-tab-content em-analytics__profile-code-editor",children:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(i.A,{gutter:16,children:(0,R.jsx)(n.A,{span:12,children:(0,R.jsx)(a.A.Item,{label:t("Current password"),name:"currentPassword",children:(0,R.jsx)(d.A.Password,{readOnly:!J.currentPassword,onFocus:()=>Q((e=>({...e,currentPassword:!0}))),ref:oe,placeholder:t("Enter your current password")})})})}),(0,R.jsxs)(i.A,{gutter:16,children:[(0,R.jsx)(n.A,{span:12,children:(0,R.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,s){if("security"===K){return e("currentPassword")?s.length>=8&&/[0-9]/.test(s)&&/[a-z]/.test(s)&&/[A-Z]/.test(s)&&/\W+|_/g.test(s)?Promise.resolve():Promise.reject(new Error(t("The password is too simple."))):Promise.reject(new Error("Enter your current password"))}return Promise.resolve()}})],children:(0,R.jsx)(d.A.Password,{readOnly:!J.newPassword,onFocus:()=>Q((e=>({...e,newPassword:!0}))),placeholder:t("Enter your new password")})})}),(0,R.jsx)(n.A,{span:12,children:(0,R.jsx)(a.A.Item,{label:t("Confirmation"),name:"confirmPassword",validateTrigger:["onSubmit"],rules:[{required:"security"===K,message:t("Repeat the new password")},({getFieldValue:e})=>({validator:(o,s)=>s&&e("newPassword")!==s?Promise.reject(new Error(t("The two passwords that you entered do not match!"))):Promise.resolve()})],children:(0,R.jsx)(d.A.Password,{readOnly:!J.confirmPassword,onFocus:()=>Q((e=>({...e,confirmPassword:!0}))),placeholder:t("Repeat the new password")})})})]})]})}];return(0,R.jsx)(m.A,{width:572,className:"account-settings blocks-modal",title:(0,R.jsxs)("div",{children:[(0,R.jsx)(y.A,{})," ",t("Account settings")]}),open:e,onOk:re,onCancel:ne,centered:!0,footer:[(0,R.jsx)(u.Ay,{size:"large",className:"em-analytics__profile-save",type:"primary",loading:H.isLoading,onClick:re,children:t("Update")},"Update")],children:(0,R.jsx)(a.A,{form:z,layout:"vertical",name:"edit_profile_form",onFinish:re,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&&ie(e.theme);const t=e.codeEditor;e.language&&D((0,j.ko)(e.language)),e.codeEditor&&D((0,j.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,R.jsx)(p.A,{activeKey:K,onChange:e=>Z(e),items:de})})})}},35285:(e,t,o)=>{o.d(t,{A:()=>T});var s=o(92810),r=o(12280),l=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),j=o(36404),A=o(85163),S=o(32269),k=o(70082);const w="mainsettings",C="ftpsettings",E="webhooksettings",I=({isModalVisible:e,selectedProject:t=null})=>{const{__:o}=(0,h.s9)(),I=(0,p.wA)(),[T]=r.A.useForm(),N=(0,s.useRef)(null),R=(0,s.useRef)(null),L=(0,s.useRef)(null),B=(0,p.d4)(j.yN),P=(0,p.d4)(_.gU),F=(0,u.hN)(),M=(0,p.d4)(_.cL),[D,z]=(0,s.useState)(w),[O,q]=(0,s.useState)(!1),H=t||B,V=[C,w,E].includes(P),[$,W]=(0,x.OD)();(0,s.useEffect)((()=>{if(M===A.lx.EDIT_PROJECT_MODAL){const e={mainsettings:N,ftpsettings:R,webhooksettings:L};setTimeout((()=>{var t;return null===(t=e[D].current)||void 0===t?void 0:t.focus({cursor:"end"})}),200)}}),[M,D]),(0,s.useEffect)((()=>{V&&z(P)}),[P,V,z,I]);let U=[{label:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(g.A,{}),o("Main settings")]}),key:w,className:"em-analytics__mainsettings-project",children:(0,k.jsx)(k.Fragment,{children:(0,k.jsx)(l.A,{gutter:24,children:(0,k.jsx)(a.A,{span:24,children:(0,k.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,k.jsx)(i.A,{ref:N,placeholder:o("Type the project name"),style:{marginBottom:5}})})})})})},{label:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(b.A,{}),o("FTP settings")]}),key:C,className:"em-analytics__ftpsettings-project",children:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(l.A,{gutter:24,children:[(0,k.jsx)(a.A,{span:12,children:(0,k.jsx)(r.A.Item,{label:o("Host"),name:["ftpSettings","host"],children:(0,k.jsx)(i.A,{ref:R,placeholder:o("Type the FTP host"),disabled:O})})}),(0,k.jsx)(a.A,{span:12,children:(0,k.jsx)(r.A.Item,{label:o("Port"),name:["ftpSettings","port"],children:(0,k.jsx)(i.A,{placeholder:o("Type the FTP port"),disabled:O})})})]}),(0,k.jsxs)(l.A,{gutter:24,children:[(0,k.jsx)(a.A,{span:12,children:(0,k.jsx)(r.A.Item,{label:o("Directory"),name:["ftpSettings","directory"],children:(0,k.jsx)(i.A,{placeholder:o("Type the file directory"),disabled:O})})}),(0,k.jsx)(a.A,{span:12,children:(0,k.jsx)(r.A.Item,{label:o("URL catalog"),name:["ftpSettings","domain"],children:(0,k.jsx)(i.A,{placeholder:o("Type the URL catalog"),disabled:O})})})]}),(0,k.jsxs)(l.A,{gutter:24,children:[(0,k.jsx)(a.A,{span:12,children:(0,k.jsx)(r.A.Item,{label:o("Login"),name:["ftpSettings","login"],children:(0,k.jsx)(i.A,{placeholder:o("Type the FTP login"),disabled:O})})}),(0,k.jsx)(a.A,{span:12,children:(0,k.jsx)(r.A.Item,{label:o("Password"),name:["ftpSettings","password"],children:(0,k.jsx)(i.A.Password,{placeholder:o("Type the FTP password"),disabled:O,iconRender:e=>e?(0,k.jsx)(f.A,{}):(0,k.jsx)(v.A,{})})})})]}),(0,k.jsx)(l.A,{gutter:24,children:(0,k.jsx)(a.A,{span:24,children:(0,k.jsx)(r.A.Item,{noStyle:!0,children:(0,k.jsx)(n.A,{checked:O,onChange:e=>q(Boolean(e.target.checked)),children:o("Use default CDN")})})})})]})},{label:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(g.A,{}),o("WebHook settings")]}),key:E,className:"em-analytics__mainsettings-project",children:(0,k.jsx)(k.Fragment,{children:(0,k.jsx)(l.A,{gutter:24,children:(0,k.jsx)(a.A,{span:24,children:(0,k.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.")},V&&{required:!0,message:o("Please type the webhook url.")}],children:(0,k.jsx)(i.A,{ref:L,placeholder:o("Type the project webHook"),style:{marginBottom:5}})})})})})}];(0,s.useEffect)((()=>{if(e&&H){const e=H.ftp_settings;q(e.use_default_cdn),T.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||""}})}}),[T,H,e]);const G=()=>{T.validateFields().then((e=>{const t=e.ftpSettings;H&&$({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,S.p6)({error:t},F),I((0,_.YF)("")),I((0,_.Oo)())}))}))};return(0,k.jsx)(d.A,{title:(0,k.jsxs)("div",{children:[(0,k.jsx)(y.A,{})," ",o("Project settings")]}),className:"blocks-modal",open:e,onOk:G,onCancel:()=>{I((0,_.YF)("")),I((0,_.Oo)())},centered:!0,footer:[(0,k.jsx)(c.Ay,{size:"large",className:"em-analytics__project-save",type:"primary",loading:W.isLoading,onClick:G,children:o("Update")},"submit")],children:(0,k.jsx)(r.A,{form:T,layout:"vertical",name:`edit_project_form_${null===H||void 0===H?void 0:H.id}`,onFinish:G,initialValues:{remember:!1,name:""},autoComplete:"off",children:(0,k.jsx)(m.A,{activeKey:D,onChange:z,items:U})})})};I.defaultProps={selectedProject:null};const T=I},58889:e=>{e.exports=JSON.parse('{"yG":"iframe.4a0a16b398aec444ac01.html","l5":"iframe-eblock.4a0a16b398aec444ac01.html"}')}}]);