@emailmaker/emailmaker 1.0.42 → 1.0.45

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 (42) hide show
  1. package/README.md +1 -1
  2. package/asset-manifest.json +23 -23
  3. package/emailmaker-esm.js +1 -1
  4. package/emailmaker.d.ts +9 -2
  5. package/emailmaker.js +1 -1
  6. package/iframe/css/sandbox.css +5 -0
  7. package/iframe/{iframe-eblock.34aa3ecff050d10d81fa.html → iframe-eblock.ece95470afbe17f9b5de.html} +1 -1
  8. package/iframe/{iframe.34aa3ecff050d10d81fa.html → iframe.ece95470afbe17f9b5de.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_s.html +1 -1
  17. package/react/index.d.ts +5 -6
  18. package/react/index.js +1 -0
  19. package/react/index.mjs +1 -0
  20. package/static/js/1399.b4cd707b.js +1 -0
  21. package/static/js/1821.3ac9dc83.js +1 -0
  22. package/static/js/{3447.63d0aafa.js → 2151.0935f51b.js} +1 -1
  23. package/static/js/2208.abf96ee8.js +1 -0
  24. package/static/js/2299.03050dc1.chunk.js +1 -0
  25. package/static/js/3430.bec16278.js +1 -0
  26. package/static/js/4877.eaf2cc44.js +1 -0
  27. package/static/js/{5571.df37628f.js → 5571.58239137.js} +1 -1
  28. package/static/js/7291.50326502.js +1 -0
  29. package/static/js/78.1c16a2f0.js +1 -0
  30. package/static/js/{emailmaker_core.334285a8.js → emailmaker_core.7cf76221.js} +1 -1
  31. package/translations.pot +447 -414
  32. package/iframe/429.js +0 -1
  33. package/react/index.jsx +0 -34
  34. package/static/js/1399.f981f0f4.js +0 -1
  35. package/static/js/1821.d26ae2ec.js +0 -1
  36. package/static/js/2208.cb758bc6.js +0 -1
  37. package/static/js/2223.8a79fe8e.js +0 -1
  38. package/static/js/2299.baeb0a3e.chunk.js +0 -1
  39. package/static/js/4877.92b05fa3.js +0 -1
  40. package/static/js/7291.e2615c74.js +0 -1
  41. package/static/js/78.42d0e306.js +0 -1
  42. /package/static/css/{2223.3b54559d.css → 3430.3b54559d.css} +0 -0
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunkemail_maker=globalThis.webpackChunkemail_maker||[]).push([[2208],{35069:(e,t,o)=>{o.d(t,{A:()=>S});var s=o(92810),a=o(12280),l=o(14852),n=o(43005),i=o(2018),r=o(7744),d=o(55039),c=o(81662),m=o(71157),u=o(66170),p=o(28372),h=o(45934),g=o(23287),x=o(64617),v=o(55701),f=o(84568),b=o(79154),_=o(47358),j=o(32269),y=o(56991),A=o(85163),k=o(70082);const S=({isModalVisible:e,htmlContent:t,projectId:o})=>{const{__:S}=(0,g.s9)(),w=(0,h.wA)(),[C]=a.A.useForm(),[E,I]=(0,s.useState)([]),[N,T]=(0,v.pP)(),{data:B}=(0,v.h1)(),L=(0,m.hN)(),R=(0,y.rD)(),[P,F]=(0,s.useState)([]),{data:M,refetch:D}=(0,x.KC)(),{refetch:z}=(0,v.SB)({projectId:o,pageSize:1e3,page:1,tags:null,name:null,type:null,notEmbed:!0,order:"asc",orderby:"title"}),O=`project_${o}`,H=M&&(0,j._q)(M,A.YY).find((e=>e.name===O)),V=(0,j._q)(M,A.YY)||[],q=null===V||void 0===V?void 0:V.map((e=>e.id)),[$,X]=(0,v.Gr)(),[G,U]=(0,f.OD)();(0,s.useEffect)((()=>{F((0,j._q)(M,A.YY).map((e=>({value:e.name}))))}),[M]),(0,s.useEffect)((()=>{if(B){const e=B.schema.properties.acf.properties.type.items.enum;let t=[];for(let o in e)t.push({label:S(A.jg[e[o]]),value:e[o]});I(t)}}),[B,S]);const W=()=>{C.validateFields().then((e=>{const s=e.tags;if((null===s||void 0===s?void 0:s.length)>10)return void L.error({id:"BLOCK_TOO_MANY_TAGS_ERROR",data:(0,m.x_)(e),message:S("Maximum 10 tags available."),placement:"bottomRight"});const a=a=>{const l=null===s||void 0===s?void 0:s.map((e=>{const t=null===V||void 0===V?void 0:V.find((t=>t.name===e));return t?t.id:$({name:e,parent:a}).then((({error:t,data:o})=>{var s,a;return 400===(null===t||void 0===t?void 0:t.status)?null===t||void 0===t||null===(s=t.data)||void 0===s||null===(a=s.data)||void 0===a?void 0:a.term_id:o?o.id:void(t&&L.fromError("TAG_CREATING_ERROR",e,t))}))})),n=(e,s=[])=>{N({title:e.title,project:o,html:t,type:e.type?e.type:"Other",blocktags:s.join(",")}).then((a=>{if(a.error)return L.error({id:"BLOCK_CREATING_ERROR",data:{title:e.title,html:t},innerException:a.error,message:(0,k.jsx)("div",{dangerouslySetInnerHTML:{__html:a.error.data.code}}),description:(0,k.jsx)("div",{dangerouslySetInnerHTML:{__html:a.error.data.message}}),placement:"bottomRight"}),C.resetFields(),void Y();C.resetFields(),Y();let l=new Set([...q,...s]);D(),G({projectId:o,blocktags:[...l].join(",")}).then((e=>{e.error&&L.error({message:(0,k.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.code}}),description:(0,k.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.message}}),placement:"bottomRight"}),L.success({id:"BLOCK_CREATING_SUCCESS",data:(0,m.x_)(a.data),message:S("The block \u201c")+a.data.title+S("\u201d was successfully created."),placement:"bottomRight"}),z()}))}))};l?Promise.all(l).then((t=>{n(e,t)})):n(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))};H?a(H.id):$({name:O}).then((async({data:e,error:t})=>{if(t)L.fromError("FOLDER_CREATING_ERROR",O,t);else{const{data:t,error:s}=await G({projectId:o,blocktags:e.id});s?L.fromError("BLOCK_CLONING_ERROR",(0,m.x_)(e),s):t&&a(t.blocktags&&t.blocktags[0])}})).catch((e=>console.error(e)))}))},Y=()=>{w((0,_.Oo)())};return(0,k.jsx)(l.A,{title:(0,k.jsxs)("div",{children:[(0,k.jsx)(u.A,{})," ",S("Add new block")]}),className:"blocks-modal",open:e,onOk:W,onCancel:Y,centered:!0,footer:[(0,k.jsxs)(n.Ay,{size:"large",type:"primary",loading:T.isLoading,onClick:W,children:[(0,k.jsx)(b.h,{className:"modal-new-block__icon-create"}),S("Create block")]},"submit")],children:(0,k.jsxs)(a.A,{form:C,layout:"vertical",name:"add_new_block_form",onFinish:W,initialValues:{title:"",type:"",tags:[]},autoComplete:"off",style:{padding:"10px 24px 0"},children:[(0,k.jsxs)(i.A,{gutter:16,children:[(0,k.jsxs)(r.A,{span:12,children:[" ",(0,k.jsx)(a.A.Item,{label:S("Block name"),name:"title",rules:[{required:!0,message:S("Please input block name")}],style:{marginBottom:15},children:(0,k.jsx)(d.A,{disabled:T.isLoading||X.isLoading||U.isLoading,size:"large",placeholder:S("Enter block name"),spellCheck:"false"})})]}),(0,k.jsx)(r.A,{span:12,children:(0,k.jsx)(a.A.Item,{label:S("Type"),name:"type",rules:[{required:!0,message:S("Please choose block type")}],style:{marginBottom:15},children:(0,k.jsx)(c.A,{disabled:T.isLoading||X.isLoading||U.isLoading,size:"large",placeholder:S("Choose block type"),options:E})})})]}),R.tagsEnabled&&(0,k.jsx)(a.A.Item,{label:S("Tags"),name:"tags",children:(0,k.jsx)(c.A,{size:"large",mode:"tags",placeholder:S("Add some tags"),tooltip:{title:S("Tags help you find the block in the list."),icon:(0,k.jsx)(p.A,{})},disabled:T.isLoading||X.isLoading||U.isLoading,options:P})})]})})}},28288:(e,t,o)=>{o.d(t,{A:()=>f});var s=o(92810),a=o(14852),l=o(69417),n=o(45934),i=o(64617),r=o(38883),d=o.n(r),c=o(23287),m=o(47358),u=o(85163),p=o(32269),h=o(90070),g=o(98578),x=o(54416),v=(o(68777),o(70082));const f=({isModalVisible:e})=>{const{__:t}=(0,c.s9)(),o=(0,n.wA)(),r=(0,i.Zp)(),f=(0,h.p6)();let b=(0,i.zy)();const _=(0,s.useRef)(null);let j=[];return j.push({title:t("From scratch"),click:()=>{o((0,m.Oo)()),f.set(u.A9.em_new_email,127017),(0,p.XZ)(r,`${b.pathname}/new`)}}),j.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)()),f.set(u.A9.em_template_email,1868),(0,p.XZ)(r,`${b.pathname}/new_from/1868`)}}),j.push({title:"\u0428\u0430\u0431\u043b\u043e\u043d \u0432 \u0442\u0451\u043c\u043d\u043e\u0439 \u0442\u0435\u043c\u0435",img:x,click:()=>{o((0,m.Oo)()),f.set(u.A9.em_template_email,1869),(0,p.XZ)(r,`${b.pathname}/new_from/1869`)}}),(0,v.jsx)(a.A,{title:t("Create new email"),open:e,onCancel:()=>{o((0,m.Oo)())},centered:!0,footer:!1,width:"inherit",className:"modal-new-email blocks-modal",children:(0,v.jsx)("div",{className:"modal-new-email__cards-grid",children:j&&j.map(((e,t)=>(0,v.jsx)(l.A,{className:"element-card element-card_new-email",hoverable:!0,cover:(0,v.jsx)(v.Fragment,{children:(0,v.jsx)("div",{ref:_,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,v.jsx)("img",{className:"element-card__img",alt:e.title,src:e.img,onMouseMove:e=>(0,p.Hy)(e,_.current),onMouseLeave:p.Tr})})}),children:(0,v.jsx)("div",{className:"element-card__title-wrapper",onClick:()=>null===e||void 0===e?void 0:e.click(),children:(0,v.jsx)("span",{className:"element-card__title",children:e.title})})},e.img+t)))})})}},92851:(e,t,o)=>{o.d(t,{A:()=>v});var s=o(92810),a=o(12280),l=o(14852),n=o(43005),i=o(55039),r=o(71157),d=o(45934),c=o(23287),m=o(84568),u=o(93563),p=o(64936),h=o(85163),g=o(32269),x=o(70082);const v=({project:e,parentFolderId:t=null,folderTaxonomy:o})=>{const{__:v,_x:f}=(0,c.s9)(),b=(0,d.wA)(),[_]=a.A.useForm(),j=(0,s.useRef)(null),y=(0,d.d4)(p.cL)===h.lx.ADD_NEW_FOLDER_MODAL,A=(0,r.hN)(),k=`project_${e.id}`,[S]=(0,m.OD)(),[w]=(0,u.f1)(),C=(0,s.useCallback)((()=>{_.resetFields(),setTimeout((()=>{var e;return null===(e=j.current)||void 0===e?void 0:e.focus({cursor:"start"})}),0)}),[_]);(0,s.useEffect)((()=>{y&&C()}),[y,C]);const E=()=>b((0,p.Oo)()),[I,N]=(0,u.Yb)(),[T,B]=(0,s.useState)(!1),[L,R]=(0,s.useState)(t),P=()=>{_.validateFields().then((({name:t})=>(B(!0),L?I({name:t,parent:L}).then((({data:e,error:t})=>{t?(0,g.p6)({error:t},A):(A.success({message:v("The folder \u201c")+e.name+f("\u201d was successfully created.","folder"),placement:"bottomRight"}),window.localStorage.setItem(h.V0.em_folder_is_open,"true"),E(),w({parent:L}))})):I({name:k}).then((({data:s,error:a})=>{if(!a)return S({projectId:e.id,[o]:s.id||L}).then((({data:e,error:s})=>{if(a)(0,g.p6)({error:a},A);else if(e)return I({name:t,parent:e[o][0]}).then((({data:t,error:s})=>{if(!s)return A.success({message:v("The folder \u201c")+t.name+f("\u201d was successfully created.","folder"),placement:"bottomRight"}),R(e[o][0]),w({parent:e[o][0]}).then(((e,t)=>{e?(window.localStorage.setItem(h.V0.em_folder_is_open,"true"),E()):t&&(0,g.p6)({error:t},A)}));(0,g.p6)({error:s},A)}))}));(0,g.p6)({error:a},A)})).catch((e=>console.error(e))).finally((()=>B(!1)))))).catch((e=>console.error(e))).finally((()=>B(!1)))};return(0,x.jsx)(l.A,{title:v("Add a new folder"),open:y,onOk:P,onCancel:E,className:"new-folder-modal",centered:!0,footer:[(0,x.jsx)(n.Ay,{type:"primary",size:"large",loading:N.isLoading||T,onClick:P,children:v("Create folder")},"submit")],children:(0,x.jsx)(a.A,{form:_,layout:"vertical",name:"add_new_folder_form",onFinish:P,initialValues:{remember:!1,name:""},autoComplete:"off",style:{paddingTop:10},children:(0,x.jsx)(a.A.Item,{name:"name",rules:[{required:!0,message:v("Please enter the folder name")}],children:(0,x.jsx)(i.A,{disabled:N.isLoading,size:"large",placeholder:v("Enter the folder name"),ref:j,style:{marginBottom:5}})})})})}},68919:(e,t,o)=>{o.d(t,{A:()=>f});var s=o(92810),a=o(12280),l=o(14852),n=o(43005),i=o(55039),r=o(71157),d=o(64617),c=o(45934),m=o(23287),u=o(84568),p=o(64936),h=o(86286),g=o(85163),x=o(47381),v=o(70082);const f=({isModalVisible:e})=>{const{__:t}=(0,m.s9)(),o=(0,c.wA)(),[f]=a.A.useForm(),b=(0,s.useRef)(null),_=(0,d.Zp)(),j=(0,r.hN)(),y=(0,c.d4)(h.C1),A=(0,x.u)(),[k,S]=(0,u.lD)();(0,s.useEffect)((()=>{e&&(f.resetFields(),setTimeout((()=>{var e;return null===(e=b.current)||void 0===e?void 0:e.focus({cursor:"end"})}),400))}),[e,f]);const w=()=>{f.validateFields().then((e=>(A({event:"submit_form",action:"create_new_project",label:e.name}),k({title:e.name,members:{owner:y.id}})))).then((e=>{if(e.error)throw j.error({message:(0,v.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.code}}),description:(0,v.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.message}}),placement:"bottomRight"}),o((0,p.Oo)()),new Error(g.ff);e.data&&(j.success({message:t("The project \u201c")+e.data.title+t("\u201d was successfully created."),placement:"bottomRight"}),o((0,p.Oo)()),_(`/projects/${e.data.id}/emails?status=new_project&page=1`))})).catch((e=>{console.error("e",e)}))};return(0,v.jsx)(l.A,{title:t("Add a new project"),open:e,onOk:w,onCancel:()=>o((0,p.Oo)()),className:"blocks-modal blocks-modal_create",centered:!0,footer:[(0,v.jsx)(n.Ay,{className:"em-analytics__project-add",type:"primary",size:"large",loading:S.isLoading,onClick:w,children:t("Create project")},"submit")],styles:{mask:{backgroundColor:"var(--colorBgLayout)"}},children:(0,v.jsx)(a.A,{form:f,layout:"vertical",name:"add_new_project_form",onFinish:w,initialValues:{remember:!1,name:""},autoComplete:"off",style:{padding:"10px 24px 0"},children:(0,v.jsx)(a.A.Item,{extra:t("This can be\xa0the name of\xa0your company, department, website, project, marketing campaign, or\xa0other activity."),name:"name",rules:[{required:!0,message:t("Please enter the project name")}],children:(0,v.jsx)(i.A,{disabled:S.isLoading,size:"large",placeholder:t("Enter the project name"),ref:b,style:{marginBottom:5}})})})})}},43319:(e,t,o)=>{o.d(t,{A:()=>V});var s=o(92810),a=o(38883),l=o.n(a),n=o(95838),i=o(12280),r=o(29234),d=o(2018),c=o(7744),m=o(66726),u=o(78159),p=o(81e3),h=o(8701),g=o(71086),x=o(55039),v=o(81662),f=o(62767),b=o(45934),_=o(23287),j=o(26238),y=o(49343),A=o(62303),k=o(85163),S=o(65983),w=o(47358),C=o(45695),E=o(56991),I=o(70082);const{backgroundColor:N,backgroundImage:T,backgroundPositionX:B,backgroundPositionY:L,backgroundRepeat:R,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={[N]:"",[T]:"",[B]:"",[L]:"",[R]:"checked",[P]:"",[M]:"",[D]:""},{useToken:O}=n.A,H=({className:e})=>{var t,o,a;const{__:n}=(0,_.s9)(),M=(0,C.XW)(),D=(0,b.wA)(),H=(0,b.d4)(S.uJ),V=(0,b.d4)(S.iy),[q]=i.A.useForm(),[$,X]=(0,s.useState)(!0),G=(0,E.rD)(),U=(0,b.d4)(w.B),{token:W}=O(),Y=n("Email not yet loaded or global container not found."),K=[{label:n("Not defined"),value:"none"},{label:n("Do not repeat background (no-repeat)"),value:"no-repeat"},{label:n("Repeat background (repeat)"),value:"repeat"},{label:n("Repeat background horizontally (repeat-x)"),value:"repeat-x"},{label:n("Repeat background vertically (repeat-y)"),value:"repeat-y"}],Z=[{label:n("Not defined"),value:""},{label:n("Contain"),value:"contain"},{label:n("Cover"),value:"cover"}];(0,s.useEffect)((()=>{var e,t,o,s;q.setFieldsValue({...H,width:null===(e=H.width)||void 0===e?void 0:e.value,widthDim:null===(t=H.width)||void 0===t?void 0:t.dim,backgroundImage:H.backgroundImage?null===(o=H.backgroundImage[0])||void 0===o?void 0:o.value:"",backgroundRepeat:""===H[R]?"repeat":H[R],backgroundSize:H[P],responsive:null===(s=H.responsive)||void 0===s?void 0:s.shutdown}),X(!H.backgroundImage)}),[H,q]);return(0,I.jsx)("div",{className:l()("appearance-panel",{[e]:e}),children:(0,I.jsxs)(i.A,{form:q,layout:"vertical",name:"appearance_panel_form",initialValues:{remember:!1,...z},onValuesChange:e=>{var t;const o=q.getFieldsValue(!0),s=Object.keys(e)[0];switch(s){case B:case L:M({operation:k.Ru.SANDBOX_EMAIL_SETTINGS_SET,settings:{[s]:""===e[s]?"none":e[s]}});break;case T:X(""===e[s]),M({operation:k.Ru.SANDBOX_EMAIL_SETTINGS_SET,settings:{[s]:[{...null===H||void 0===H||null===(t=H.backgroundImage)||void 0===t?void 0:t[0],type:"url",value:e[s]}],backgroundSize:"cover"}});break;case F:M({operation:k.Ru.SANDBOX_EMAIL_SETTINGS_SET,settings:{responsive:{shutdown:e[s],styles:e[s]},width:o.width}});break;default:M({operation:k.Ru.SANDBOX_EMAIL_SETTINGS_SET,settings:e})}},autoComplete:"off",className:"element-controls",children:[V?(0,I.jsx)(r.A,{style:{marginBottom:"24px"},message:Y,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:n("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!==(t=H.width)&&void 0!==t&&t.value?n("This field sets the width of the email."):n("Couldn`t determine the email width"),placement:"right",children:(0,I.jsx)(i.A.Item,{name:"width",style:{marginBottom:W.formItemMarginBottomXS},children:(0,I.jsx)(u.A,{min:0,placeholder:n("Width"),prefix:(0,I.jsx)(f.A,{}),disabled:!(null!==(o=H.width)&&void 0!==o&&o.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=H.responsive)||void 0===a?void 0:a.shutdown),onChange:e=>{D((0,w.wW)({shutdown:e,styles:e})),M({operation:k.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:n("Responsive email")})})]})})})]}),(0,I.jsx)(g.A,{className:"selected-td-form__divider"}),(0,I.jsx)("div",{className:"form-group-title",children:n("Email background color")}),(0,I.jsxs)(d.A,{gutter:10,style:{paddingBottom:$?16:4},children:[(0,I.jsx)(c.A,{span:12,children:(0,I.jsx)(m.A,{trigger:["hover"],title:n("Background color"),placement:"bottom",children:(0,I.jsx)(i.A.Item,{name:N,style:{marginBottom:W.formItemMarginBottomXS},rules:[{message:n("Please set the background color")}],children:(0,I.jsx)(j.A,{placeholder:n("Background color"),usedColors:H.usedColors})})})}),(0,I.jsx)(c.A,{span:$?12:24,children:G.formEmailFieldBackgroundImageEnabled&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(y.A,{form:q,label:n("Background image"),name:T,tooltipTitle:n("Background image"),disabled:V||"Styles"!==U,elementSettings:H}),!$&&(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:n("Horizontal position"),placement:"bottom",children:(0,I.jsx)(i.A.Item,{name:B,style:{marginBottom:W.formItemMarginBottomXS},children:(0,I.jsx)(x.A,{placeholder:n("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:n("Vertical position"),placement:"bottom",children:(0,I.jsx)(i.A.Item,{name:L,style:{marginBottom:W.formItemMarginBottomXS},children:(0,I.jsx)(x.A,{placeholder:n("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:n("Background image repeat"),placement:"bottom",children:(0,I.jsx)(i.A.Item,{name:R,children:(0,I.jsx)(v.A,{placeholder:n("Please select"),disabled:V,options:K,getPopupContainer:e=>e.parentNode})})})}),(0,I.jsx)(c.A,{span:12,children:(0,I.jsx)(m.A,{trigger:["hover"],title:n("Background image size"),placement:"top",children:(0,I.jsx)(i.A.Item,{name:P,children:(0,I.jsx)(v.A,{placeholder:n("Please select"),disabled:V,options:Z,getPopupContainer:e=>e.parentNode})})})})]})]})]})})]}),(0,I.jsx)(g.A,{className:"selected-td-form__divider"}),(0,I.jsx)("div",{className:"form-group-title",children:n("Content background color")}),(0,I.jsx)(m.A,{trigger:["hover"],title:n("Content background color"),placement:"bottom",children:(0,I.jsx)(i.A.Item,{name:"backgroundColorContent",style:{marginBottom:W.formItemMarginBottomMD+4},rules:[{message:n("Please set the background color")}],children:(0,I.jsx)(j.A,{placeholder:n("Background color"),isDisabled:void 0===H.backgroundColorContent,usedColors:H.usedColors})})})]})})};H.defaultProps={className:""};const V=H},16106:(e,t,o)=>{o.d(t,{A:()=>O});var s=o(92810),a=o(81e3),l=o(66726),n=o(23287),i=o(74436),r=o(24358),d=o(42797),c=o.n(d),m=o(50483),u=o.n(m),p=o(95550),h=o.n(p),g=o(71811),x=o.n(g),v=o(35465),f=o.n(v),b=o(44789),_=o.n(b),j=o(77098),y=o.n(j),A=o(19032),k=o(48304),S=o.n(k),w=o(59817),C=o(79757),E=o(78588),I=o.n(E),N=o(40829),T=o.n(N),B=o(62303),L=o(92779),R=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,n.s9)(),{__:d}=o,m=(0,M.rD)(),p=(0,D.d4)(P.yN),g=(0,D.d4)(R.B$),v=(0,D.d4)(R.C1),b=(0,D.d4)(R.B),j=(0,F.X7)(),k=(0,F.Qi)(),[E,N]=(0,s.useState)(!1),[O,H]=(0,s.useState)(0);let V=!(g||(null===(e=v.id)||void 0===e?void 0:e.toString())!==(null===p||void 0===p||null===(t=p.members)||void 0===t?void 0:t.owner.ID));const q=[];m.elementImageEnabled&&q.push({title:d("Image"),icon:(0,z.jsx)(B.A,{icon:"ElementImage"}),html:i.A,className:"",name:"image"}),m.elementAIimageEnabled&&q.push({title:d("AI image"),icon:(0,z.jsx)(B.A,{icon:"ElementImageAI"}),html:r.A,className:"ai",name:"ai-image"}),m.elementTextEnabled&&q.push({title:d("Text"),icon:(0,z.jsx)(B.A,{icon:"ElementText"}),html:c()(o),className:"",name:"text"}),m.elementHeaderEnabled&&q.push({title:d("Header"),icon:(0,z.jsx)(B.A,{icon:"ElementTitle"}),html:u()(o),className:"",name:"header"}),m.elementButtonEnabled&&q.push({title:d("Button"),icon:(0,z.jsx)(B.A,{icon:"ElementButton"}),html:h()(o),className:"",name:"button"}),m.elementSpacerEnabled&&q.push({title:d("Spacer"),icon:(0,z.jsx)(B.A,{icon:"ElementSpacer"}),html:y(),className:"",name:"spacer"}),m.elementListULEnabled&&q.push({title:d("List UL"),icon:(0,z.jsx)(B.A,{icon:"ElementListUL"}),html:x()(o),className:"",name:"list-ul"}),m.elementListOLEnabled&&q.push({title:d("List OL"),icon:(0,z.jsx)(B.A,{icon:"ElementListOL"}),html:f()(o),className:"",name:"list-ol"}),m.elementDividerEnabled&&q.push({title:d("Divider"),icon:(0,z.jsx)(B.A,{icon:"ElementDivider"}),html:_(),className:"",name:"divider"}),m.elementSocialEnabled&&q.push({title:d("Social media"),icon:(0,z.jsx)(B.A,{icon:"ElementSocial"}),html:A.A,className:"",name:"social"}),m.elementTableEnabled&&q.push({title:d("Table"),icon:(0,z.jsx)(B.A,{icon:"ElementTable"}),html:S()(o),className:"",name:"table"}),m.elementCountdownEnabled&&q.push({title:d("Countdown"),icon:(0,z.jsx)(B.A,{icon:"ElementCountdown"}),html:(0,w.A)(b),className:"",name:"countdown"}),m.elementVideoEnabled&&q.push({title:d("Video"),icon:(0,z.jsx)(B.A,{icon:"ElementVideo"}),html:C.A,className:"",name:"video"}),m.elementCarouselEnabled&&q.push({title:d("Carousel"),icon:(0,z.jsx)(B.A,{icon:"ElementCarousel"}),html:I()(o),className:"amp",name:"amp-carousel"}),m.elementAccordionEnabled&&q.push({title:d("Accordion"),icon:(0,z.jsx)(B.A,{icon:"ElementAccordion"}),html:T()(o),className:"amp",name:"amp-accordion"}),m.elementFormEnabled&&q.push({title:d("Form"),icon:(0,z.jsx)(B.A,{icon:"ElementForm"}),html:null,className:"amp",name:"amp-form"});const $=e=>!V||"ai-image"!==e.name||(setTimeout((()=>{N(!0),H(2)}),1e3),!1);return(0,z.jsxs)("div",{className:"atoms",children:[(0,z.jsx)("div",{className:"atoms__list",children:(0,z.jsx)(a.A,{wrap:!0,style:{justifyContent:"space-between",rowGap:10},children:q&&q.map(((e,t)=>e.html?(0,z.jsxs)("div",{className:"ant-card-hoverable atoms__item "+e.className,draggable:!0,onClick:t=>j(t,e.html),onDragStart:t=>k(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:()=>N(!1),initialSlide:O})]})}},59297:(e,t,o)=>{o.d(t,{A:()=>q});var s=o(92810),a=o(41919),l=o(95838),n=o(2018),i=o(7744),r=o(64617),d=o(94822),c=o(23287),m=o(83351),u=o(38883),p=o.n(u),h=o(70082);const{useToken:g}=l.A,x=({className:e,fontSize:t,to:o})=>{const{token:s}=g();return(0,h.jsx)(d.N_,{className:p()("app-logo",{[e]:e}),style:{fontSize:t?`${t}px`:"40px",color:s.colorText},to:o,children:(0,h.jsxs)("span",{children:[(0,h.jsx)("b",{children:"Email"}),"Maker"]})})};var v=o(72981),f=o(85163),b=o(69156),_=o(90070),j=o(89831);const{useToken:y}=l.A,A={},k={width:1012,color:"#fff",textAlign:"center",height:"100%"};var S;!function(e){e.fade="fade",e.scrollx="scrollx"}(S||(S={}));const w=({data:e=[],sliderStyle:t=A,coruselStyle:o=k,customDots:s=!1,carouselRef:a,effect:l=S.fade,header:n=!1,...i})=>{const{token:r}=y();return(0,h.jsxs)(h.Fragment,{children:[s&&(0,h.jsx)("div",{className:"custom-dot",children:e.length}),(0,h.jsx)(j.A,{style:o,ref:a,effect:l,...i,children:e.map((e=>(0,h.jsxs)("div",{style:o,className:"slide",children:[n&&(0,h.jsx)("div",{className:"slide-title",style:{color:r.colorText,fontWeight:700,lineHeight:"1.2",textAlign:"center",marginTop:10,marginBottom:20,marginLeft:"auto",marginRight:"auto"},children:null===e||void 0===e?void 0:e.textHeader}),null===e||void 0===e?void 0:e.content]},e.id)))})]})};var C=o(13338),E=o(62303);const I={position:"relative",display:"inline-block",margin:20,width:50,height:50,borderRadius:"50%",overflow:"hidden",cursor:"pointer"},N={position:"absolute",top:0,left:0,width:"100%",height:"100%",zIndex:0},T={fontSize:24,position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1,color:"#1890FF"},B=({icon:e,isActive:t,onClick:o,duration:a,onComplete:l})=>{const[n,i]=(0,s.useState)(0),r=window.localStorage.getItem(f.V0.em_color_scheme),d=matchMedia(f.F3).matches?f.nd:f.T,c=r||d;return(0,s.useEffect)((()=>{if(t){let e=Date.now();const t=setInterval((()=>{const o=Date.now()-e,s=Math.min(o/a*100,100);i(s),100===s&&(clearInterval(t),l())}),10);return()=>clearInterval(t)}i(0)}),[t,a,l]),(0,h.jsxs)("div",{style:{...I,backgroundColor:"dark"===c?"#1e1e1f":"#edeff1"},onClick:o,children:[(0,h.jsx)(C.A,{type:"circle",percent:n,strokeColor:"#1890ff",strokeWidth:4,trailColor:"transparent",size:50,format:()=>null,style:N}),(0,h.jsx)(E.A,{icon:e,style:T})]})},L=({carouselRef:e})=>{const[t,o]=(0,s.useState)(0),[a,l]=(0,s.useState)(!0),n=8e3,i=(0,s.useRef)(null),r=["SliderGroup","SliderTemplates","SliderBlocks","SliderAdaptive","SliderMagic"];(0,s.useEffect)((()=>{var o;null===(o=e.current)||void 0===o||o.goTo(t)}),[t,e]);const d=()=>{var s;null===(s=e.current)||void 0===s||s.goTo((t+1)%r.length),o((e=>(e+1)%r.length))};return(0,s.useEffect)((()=>{if(a)return i.current&&clearTimeout(i.current),i.current=setTimeout((()=>{o((e=>e%r.length))}),n),()=>clearTimeout(i.current)}),[a,n,r.length]),(0,s.useEffect)((()=>{l(!0)}),[]),(0,h.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",paddingTop:10},children:r.map(((e,s)=>(0,h.jsx)(B,{icon:e,isActive:t===s,onClick:()=>(e=>{o(e),l(!1)})(s),duration:n,onComplete:d},s)))})},R=(0,s.forwardRef)((({data:e=[],sliderStyle:t,customDots:o=!1,...a},l)=>{const n=(0,s.useRef)(null);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(L,{carouselRef:n}),(0,h.jsx)(w,{data:e,carouselRef:n,dots:!1,header:!0,...a})]})}));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:H}=a.A,{useToken:V}=l.A,q=({children:e})=>{var t,o;const{__:l}=(0,c.s9)(),{token:u}=V(),p=(0,r.Zp)(),[g,j]=(0,s.useState)(!1),y=(0,_.p6)(),[,A]=(0,d.ok)(),[k]=(0,m.UH)(),S=(0,r.zy)(),w=null===S||void 0===S||null===(t=S.state)||void 0===t||null===(o=t.from)||void 0===o?void 0:o.search;return(0,s.useEffect)((()=>{w&&A(w)}),[w,A]),(0,s.useEffect)((()=>{(0,b.FN)(u)}),[u]),(0,s.useEffect)((()=>{y.get(f.A9.em_token)?k().then((e=>{if(e.error)return y.remove(f.A9.em_token),void j(!0);p("/projects",{replace:!0})})):j(!0)}),[p,k,y]),(0,h.jsx)(a.A,{className:"auth-page-layout",children:g?(0,h.jsx)(H,{className:"auth-page-layout__container container",children:(0,h.jsxs)(n.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)(x,{className:"auth-page-layout__logo",fontSize:30,to:"/projects"}),(0,h.jsx)("p",{className:"auth-page-layout__logo-text",style:{color:u.colorText,fontWeight:400,fontSize:14},children:l("Email builder for your teamwork")})]}),e]})}),(0,h.jsx)(i.A,{className:"generel-col",flex:1,children:(0,h.jsx)(n.A,{align:"bottom",justify:"center",style:{minHeight:"100vh"},children:(0,h.jsx)("div",{style:{display:"flex",flexDirection:"column",justifyContent:"flex-end",alignItems:"center"},children:(0,h.jsx)(R,{data:O})})})})]})}):(0,h.jsx)(v.A,{})})}},92267:(e,t,o)=>{o.d(t,{A:()=>y});var s=o(92810),a=o(38883),l=o.n(a),n=o(81662),i=o(12280),r=o(29234),d=o(55039),c=o(28372),m=o(45934),u=o(23287),p=o(85163),h=o(7760),g=o(45695),x=o(70082);const{Option:v}=n.A,{width:f,widthDim:b}={width:"width",widthDim:"widthDim"},_={[f]:"",[b]:""},j=({className:e})=>{const{__:t}=(0,u.s9)(),o=(0,m.d4)(h.JV),a=(0,m.d4)(h.iy),[b]=i.A.useForm(),j=(0,g.XW)(),y=t("Block not yet loaded or global container not found.");(0,s.useEffect)((()=>{b.setFieldsValue({width:o.width.value,widthDim:o.width.dim})}),[o,b]);return(0,x.jsx)("div",{className:l()("block-appearance-panel",{[e]:e}),children:(0,x.jsxs)(i.A,{form:b,layout:"vertical",name:"block_appearance_panel_form",initialValues:{remember:!1,..._},onValuesChange:e=>{const t=b.getFieldsValue(!0),o=Object.keys(e)[0];let s;switch(o){case"width":s={[o]:{value:e[o],dim:t.widthDim}};break;case"widthDim":s={width:{value:t.width,dim:e[o]}};break;default:return}j({operation:p.Ru.SANDBOX_BLOCK_SETTINGS_SET,settings:s})},autoComplete:"off",children:[a?(0,x.jsx)(r.A,{style:{marginBottom:"24px"},message:y,type:"error"}):null,(0,x.jsx)(i.A.Item,{label:t("Container width"),name:f,tooltip:{title:t("Specifies the block width."),icon:(0,x.jsx)(c.A,{})},rules:[{message:t("Please input container width")}],children:(0,x.jsx)(d.A,{disabled:a,placeholder:t("Container width"),addonAfter:(0,x.jsx)(i.A.Item,{name:"widthDim",noStyle:!0,children:(0,x.jsxs)(n.A,{className:"select-after",getPopupContainer:e=>e.parentNode,children:[(0,x.jsx)(v,{value:"px",children:"px"}),(0,x.jsx)(v,{value:"%",children:"%"})]})})})})]})})};j.defaultProps={className:""};const y=j},98519:(e,t,o)=>{o.d(t,{A:()=>P});var s=o(92810),a=o(95838),l=o(12280),n=o(33206),i=o(55039),r=o(29234),d=o(4800),c=o(49246),m=o(71086),u=o(71157),p=o(9452),h=o(85677),g=o(77406),x=o(64617),v=o(45934),f=o(23287),b=o(38883),_=o.n(b),j=o(84568),y=o(55701),A=o(47358),k=o(85163),S=o(32269),w=o(42068),C=o(70082);const E=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:I,type:N,tags:T}={name:"name",type:"type",tags:"tags"},B={[I]:"",[N]:[],[T]:[]},L={Header:10,Menu:20,Banners:30,Content:40,Lists:50,Buttons:60,Promocodes:70,"E-Commerce":80,Articles:90,Polls:100,Applications:110,Feature:120,Separators:130,Contacts:140,Footer:150},{useToken:R}=a.A,P=({parentEmailId:e=k.iU,blocksTab:t,search:o,reloadBlockScreens:a})=>{const{projectId:b}=(0,x.g)(),P=(0,S.sh)(),F=(0,S._9)(),[M]=l.A.useForm(),{data:D}=(0,y.h1)(),{token:z}=R(),{__:O,_x:H}=(0,f.s9)(),V=(0,u.hN)(),{modal:q}=n.A.useApp(),{confirm:$}=q;let X=(0,x.zy)();const G=(0,v.d4)(A.V$),U=(0,s.useRef)(null),W=(0,s.useRef)(null),Y=(0,s.useRef)(null),K=(0,s.useRef)(null),Z=(0,s.useRef)(null),J=(0,v.Pj)();(0,s.useEffect)((()=>{var e;null===(e=W.current)||void 0===e||e.scrollTo({top:0})}),[t,o]);const{data:Q}=j.Nq.endpoints.getProject.select(+b)(J.getState()),[ee,te]=(0,s.useState)({projectId:b,pageSize:1e3,page:1,tags:null,name:null,type:null,notEmbed:!0,order:"asc",orderby:"title"});(0,s.useEffect)((()=>{o||(M.setFieldsValue(B),Be({type:null,name:null}),a())}),[o,M,a]),(0,s.useEffect)((()=>{if(D){const e=D.schema.properties.acf.properties.type.items.enum;let t=[];for(let o in e)t.push({label:O(k.jg[e[o]]),value:e[o]})}}),[D,O]);const{isSuccess:oe,isError:se,isLoading:ae,isFetching:le,data:ne,refetch:ie,error:re}=(0,y.SB)({...ee,page:1}),de=(0,s.useMemo)((()=>{if(oe&&ne)return[...ne].sort(((e,t)=>L[e.type]-L[t.type]))}),[oe,ne]),[ce,me]=(0,s.useState)([]);(0,w.Z)((e=>{e!==se&&V.fromError("BLOCK_GET_ERROR",{},re,!0)}),[se,re,V]);const[ue,pe]=(0,s.useState)({emailId:e,pageSize:1e3,page:1,projectId:k.p5,notEmbed:!0,name:null,type:null}),{isSuccess:he,isError:ge,isLoading:xe,isFetching:ve}=(0,y.OD)({...ue,emailId:e,page:1},{skip:!e||G.length}),fe=(0,s.useMemo)((()=>{if(he||G.length)return[...G].sort(((e,t)=>L[e.type]-L[t.type]))}),[he,G]),[be,_e]=(0,s.useState)([]);(0,s.useEffect)((()=>{const e=new Set;if(G.length&&fe){for(const t of fe)t.type&&e.add(t.type);_e(Array.from(e))}}),[G.length,fe]);const[je,ye]=(0,s.useState)({pageSize:1e3,page:1,notEmbed:!0,name:null,type:null}),{isSuccess:Ae,isError:ke,isLoading:Se,isFetching:we,data:Ce=[]}=(0,y.kz)({...je,page:1}),Ee=(0,s.useMemo)((()=>{if(Ce.length)return[...Ce].sort(((e,t)=>L[e.type]-L[t.type]))}),[Ce]),[Ie,Ne]=(0,s.useState)([]);(0,s.useEffect)((()=>{const e=new Set;if(Ee&&Ce.length){for(const t of Ee)t.type&&e.add(t.type);Ne(Array.from(e))}}),[Ce.length,Ee]);const Te=(0,s.useMemo)((()=>{const e=new Set;for(const t of ce)e.add(t);for(const t of be)e.add(t);for(const t of Ie)e.add(t);return Array.from(e)}),[Ie,be,ce]),Be=e=>{te((t=>({...t,...e,page:1}))),pe((t=>({...t,...e,page:1}))),ye((t=>({...t,...e,page:1})))},Le=(0,s.useCallback)((()=>{document.querySelector(".blocks-search__result-wrapper.is_search")&&(document.querySelector(".blocks-search__result-wrapper").style.removeProperty("transition"),document.querySelector(".blocks-search__result-wrapper").style.opacity=0,document.querySelectorAll(".blocks-search__result-body").forEach((e=>e.style.removeProperty("height"))),document.querySelectorAll(".blocks-search__result-body").forEach((e=>{e.style.height=207*e.offsetHeight/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)((()=>{we||Se||!Ae||"template"===t||(o?Le():a())}),[we,Se,Ae,Le,ee.name,a,o,t]),(0,s.useEffect)((()=>{const e=new Set;if(oe&&de){for(const t of de)t.type&&e.add(t.type);me(Array.from(e))}}),[oe,de]);const Re=e=>{a(),e.target.getAttribute("data-type")?(e.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach((e=>e.style.display="none")),e.target.closest(".blocks-search").querySelectorAll(`[data-type="${e.target.getAttribute("data-type")}"]`).forEach((e=>e.style.display="block"))):e.target.closest(".blocks-search").querySelectorAll(".blocks-search__result").forEach((e=>e.style.display="block")),e.target.parentElement.querySelector(".active").classList.remove("active"),e.target.classList.add("active")};let Pe=null;const Fe=e=>{clearTimeout(Pe);let t=document.querySelector(".block-search__preview")?document.querySelector(".block-search__preview"):null,o=document.querySelector(".block-search__preview-title")?document.querySelector(".block-search__preview-title"):null,s=document.querySelector(".block-search__preview-content")?document.querySelector(".block-search__preview-content"):null;document.querySelector(".block-search__preview")||(t=document.createElement("div"),t.classList.add("block-search__preview"),o=document.createElement("div"),o.classList.add("block-search__preview-title"),s=document.createElement("div"),s.classList.add("block-search__preview-content"),t.append(s),t.append(o),document.querySelector(".email-pane__col_settings-inner").append(t)),o.innerHTML="",s.innerHTML="",o.innerHTML=e.title;let a=e.html.replaceAll(/<style((.|\n|\r)*?)<\/style>/gi,"").trim();s.innerHTML=E('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+a+"</table>"),"1"!==t.style.opacity&&setTimeout((function(){t.style.opacity="1",t.style.transform="translateX(-100%)"}),10)},Me=()=>{let e=document.querySelector(".block-search__preview");e&&(Pe=setTimeout((()=>{e.style.opacity="0",e.style.transform="translateX(-99%)",setTimeout((function(){e.remove()}),300)}),300))};(0,s.useEffect)((()=>{document.querySelectorAll(".blocks-search__result").forEach((e=>{e.style.display="block"}))}),[t]);const De=!(null!==ne&&void 0!==ne&&ne.length)&&(!e||!(null!==G&&void 0!==G&&G.length))&&!(null!==Ce&&void 0!==Ce&&Ce.length)&&(ee.tags||ee.name||ee.type)&&!(ae||le);(0,s.useEffect)((()=>{ae||le||a()}),[ae,le,a]),(0,s.useEffect)((()=>{("common"===t||o)&&setTimeout(a,50)}),[ne,a,t,o]);const ze=e=>{$({maskClosable:!0,centered:!0,title:H("Are you sure you want to delete the \u201c","block")+e.title+O("\u201d block?"),icon:(0,C.jsx)(p.A,{}),okText:O("Yes"),cancelText:O("No"),onOk:()=>(e=>J.dispatch(y.VM.endpoints.deleteBlock.initiate(e.id)).then((t=>{t.error&&V.fromError("BLOCK_REMOVING_ERROR",(0,u.x_)(e),t.error),V.success({id:"BLOCK_REMOVING_SUCCESS",data:(0,u.x_)(e),message:O("The block \u201c")+t.data.title+H("\u201d was successfully removed.","block")}),ie()})))(e)})},Oe=(e,t)=>`${e.pathname.split("emails")[0]}blocks/${t.id}`,He=e=>{let t=[{key:"Delete block",className:"blocks-search__result__menu-item",icon:(0,C.jsx)(p.A,{style:{fontSize:"16px",margin:0}}),style:{color:z.colorError},onClick:()=>ze(e)}];return!k.EW.isPlugin&&t.unshift({key:"Edit block",className:"blocks-search__result__menu-item",icon:(0,C.jsx)(h.A,{style:{fontSize:"16px",margin:0}}),label:(0,C.jsx)("a",{target:"_blank",rel:"noreferrer noopener",href:Oe(X,e),children:" "})}),t};return(0,C.jsxs)("div",{className:_()("blocks-search",{is_search:o}),children:[(0,C.jsx)(l.A,{className:_()("blocks-search__form",{is_search:o}),form:M,layout:"vertical",name:"blocks_search_form",initialValues:{...B},onValuesChange:e=>{const t=Object.keys(e)[0],o=M.getFieldsValue(!0);switch(t){case T:const s=(0,S._q)(Q,k.YY).filter((o=>e[t].includes(o.name))).map((e=>e.id))||null;Be({tags:s});break;case N:Be({type:o.type||null});break;case I:U.current&&window.clearTimeout(U.current),U.current=window.setTimeout((function(){Be({name:o.name||null})}),300)}},autoComplete:"off",children:(0,C.jsx)(l.A.Item,{name:I,children:(0,C.jsx)(i.A,{placeholder:O("Search by title"),allowClear:!0,suffix:(0,C.jsx)(g.A,{className:"cards-search__search-icon, input-icon",style:{fontSize:"16px",cursor:"pointer"}})})})}),(se||ge||ke)&&(0,C.jsx)(r.A,{message:O("Error"),description:O("Error when receiving data. Try again (reload page) or contact support."),type:"error",showIcon:!0}),o&&!De&&(0,C.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,C.jsxs)("ul",{children:[(0,C.jsx)("li",{"data-type":"",className:"active",onClick:Re,children:O("All")},"search_All"),Te.map((e=>(0,C.jsx)("li",{"data-type":e,onClick:Re,children:O(k.jg[e])},"search_"+e)))]})}),(0,C.jsxs)("div",{ref:W,className:_()("blocks-search__result-wrapper",{is_search:o}),children:[("project"===t||o)&&(0,C.jsxs)(C.Fragment,{children:[!!ce.length&&!o&&(0,C.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,C.jsxs)("ul",{children:[(0,C.jsx)("li",{"data-type":"",className:"active",onClick:Re,children:O("All")},"blocksSections_All"),ce.map((e=>(0,C.jsx)("li",{"data-type":e,onClick:Re,children:O(k.jg[e])},"blocksSections_"+e)))]})}),(0,C.jsxs)("div",{className:_()("blocks-search__blocks-wrapper",{is_search:o}),ref:Y,children:[(0,C.jsx)("div",{className:"blocks-search__result-holder",children:!(ae||le)&&(null!==de&&void 0!==de&&de.length?de.map(((e,t)=>{const o=E('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+e.html+"</table>");return(0,C.jsx)("div",{className:"blocks-search__result","data-type":e.type,children:(0,C.jsx)(d.A,{placement:"leftTop",menu:{items:He(e)},overlayStyle:{minWidth:"auto",paddingRight:6},children:(0,C.jsx)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:t=>P(t,e.html),onDragStart:t=>F(t,e.html),onMouseEnter:()=>Fe({html:e.html,title:e.title}),onMouseLeave:Me,children:(0,C.jsx)("div",{className:"blocks-search__result-html",dangerouslySetInnerHTML:{__html:o},style:{transform:"scale("+207/660+")"}})})},"commenMenu")},e.id+t.toString())})):!(ee.tags||ee.name||ee.type)&&oe&&!(ae||le)&&!o&&(0,C.jsxs)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:[O("You don`t have any saved blocks yet."),(0,C.jsx)("br",{}),(0,C.jsx)("br",{}),O("To add a block from the dashboard click the"),(0,C.jsx)("br",{}),(0,C.jsx)("svg",{style:{position:"relative",top:"2px"},xmlns:"http://www.w3.org/2000/svg",focusable:"false",viewBox:"0 0 448 512",width:"1em",height:"1em",fill:"currentColor",children:(0,C.jsx)("path",{d:"M433.9 129.9l-83.9-83.9A48 48 0 0 0 316.1 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V163.9a48 48 0 0 0 -14.1-33.9zM272 80v80H144V80h128zm122 352H54a6 6 0 0 1 -6-6V86a6 6 0 0 1 6-6h42v104c0 13.3 10.7 24 24 24h176c13.3 0 24-10.7 24-24V83.9l78.2 78.2a6 6 0 0 1 1.8 4.2V426a6 6 0 0 1 -6 6zM224 232c-48.5 0-88 39.5-88 88s39.5 88 88 88 88-39.5 88-88-39.5-88-88-88zm0 128c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40z"})})," ",O("Save to Blocks button.")]}))}),(ae||le)&&(0,C.jsx)(c.A,{active:!0})]})]}),o&&(null===ne||void 0===ne?void 0:ne.length)>0&&(null===G||void 0===G?void 0:G.length)>0&&(0,C.jsx)(m.A,{className:"blocks-search__result-divider"}),("template"===t||o)&&e&&(0,C.jsxs)(C.Fragment,{children:[!!be.length&&!o&&(0,C.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,C.jsxs)("ul",{children:[(0,C.jsx)("li",{"data-type":"",className:"active",onClick:Re,children:O("All")},"templateBlocksSections_All"),be.map((e=>(0,C.jsx)("li",{"data-type":e,onClick:Re,children:O(k.jg[e])},"templateBlocksSections_"+e)))]})}),(0,C.jsxs)("div",{className:_()("blocks-search__blocks-wrapper",{is_search:o}),ref:K,children:[(0,C.jsxs)("div",{className:"blocks-search__result-holder",children:[G&&!xe&&!ve&&null!==fe&&void 0!==fe&&fe.length?(0,C.jsx)(C.Fragment,{children:fe.map(((e,t)=>{const o=E('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+e.html+"</table>");return(0,C.jsx)("div",{className:"blocks-search__result","data-type":e.type,children:(0,C.jsx)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:t=>P(t,e.html),onDragStart:t=>F(t,e.html),onMouseEnter:()=>Fe({html:e.html,title:e.title}),onMouseLeave:()=>Me(),children:(0,C.jsx)("div",{className:"blocks-search__result-html",dangerouslySetInnerHTML:{__html:o},style:{transform:"scale("+207/660+")"}})})},e.id+t.toString())}))}):!o&&!Se&&!ve&&(0,C.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:O("No related blocks found.")})," "]}),(xe||ve)&&(0,C.jsx)(c.A,{active:!0})]})]}),o&&(null===G||void 0===G?void 0:G.length)>0&&(null===Ce||void 0===Ce?void 0:Ce.length)>0&&(0,C.jsx)(m.A,{className:"blocks-search__result-divider"}),("common"===t||o)&&(0,C.jsxs)(C.Fragment,{children:[!(null===Ie||void 0===Ie||!Ie.length)&&!o&&(0,C.jsx)("div",{className:"blocks-search__type-wrapper",children:(0,C.jsxs)("ul",{children:[(0,C.jsx)("li",{"data-type":"",className:"active",onClick:Re,children:O("All")},"commonBlocksSections_All"),Ie.map((e=>(0,C.jsx)("li",{"data-type":e,onClick:Re,children:O(k.jg[e])},"commonBlocksSections_"+e)))]})}),(0,C.jsxs)("div",{className:_()("blocks-search__blocks-wrapper",{is_search:o}),ref:Z,children:[(0,C.jsxs)("div",{className:"blocks-search__result-holder",children:[Ae&&!(null===Ee||void 0===Ee||!Ee.length)&&!(we||Se)&&(0,C.jsx)(C.Fragment,{children:Ee.map(((e,t)=>{const o=E('<table cellspacing="0" cellpadding="0" border="0" width="100%">'+e.html+"</table>");return(0,C.jsx)("div",{className:"blocks-search__result","data-type":e.type,children:(0,C.jsx)("div",{className:"ant-card-hoverable blocks-search__result-body",draggable:!0,onClick:t=>P(t,e.html),onDragStart:t=>F(t,e.html),onMouseEnter:()=>Fe({html:e.html,title:e.title}),onMouseLeave:()=>Me(),children:(0,C.jsx)("div",{className:"blocks-search__result-html",dangerouslySetInnerHTML:{__html:o},style:{transform:"scale("+207/660+")"}})})},e.id+t.toString())}))})," "]}),(Se||we)&&(0,C.jsx)(c.A,{active:!0})]})]}),De&&(0,C.jsx)("div",{className:"blocks-search__type",style:{padding:"10px 0 20px"},children:O("There are no blocks for this request.")})]})]})}},29067:(e,t,o)=>{o.d(t,{A:()=>$});var s=o(92810),a=o(95838),l=o(33206),n=o(81e3),i=o(66522),r=o(4800),d=o(49246),c=o(29234),m=o(21349),u=o(33151),p=o(71157),h=o(9452),g=o(82013),x=o(9588),v=o(79612),f=o(10900),b=o(85677),_=o(20350),j=o(64586),y=o(8114),A=o(74267),k=o(64617),S=o(94822),w=o(45934),C=o(23287),E=o(38883),I=o.n(E),N=o(57903),T=o(43063),B=o(72981),L=o(55701),R=o(34524),P=o(7760),F=o(86286),M=o(32269),D=o(31844),z=o(85163),O=o(70082);const{useToken:H}=a.A,V=(e,t)=>`${e.pathname}/${t.id}`,q=24,$=({projectId:e,emailsView:t,createPage:o=!1,currentFolderId:a,foldersList:E,refetchProjectFolders:$,projectTags:X=[],activeTagId:G,setActiveTagHandler:U,projectEmailsCounter:W=0})=>{var Y,K,Z,J,Q,ee,te,oe;const{__:se,_x:ae}=(0,C.s9)(),le=(0,w.wA)(),ne=(0,w.d4)(R.D2),ie=(0,w.d4)(R.dV),re=(0,w.d4)(F.C1),de=(0,w.d4)(R.NP),ce=(0,w.d4)(R.qM),me=(0,w.d4)(R.ux),ue=(0,w.d4)(P.b9);let pe=(0,k.zy)();const{owner:he,admin:ge}=(0,D.A)(),xe=(0,k.Zp)(),{token:ve}=H(),{modal:fe}=l.A.useApp(),be=(0,p.hN)(),{confirm:_e}=fe,je=(0,w.Pj)(),[ye,Ae]=(0,S.ok)(),{refetch:ke}=(0,k.KC)(),Se=+ye.get("page"),we=ye.get("folder"),Ce=+ye.get("tag"),[Ee,Ie]=(0,L.pP)(),[Ne]=(0,L.R2)(),[Te]=(0,L.OZ)(),[Be,Le]=(0,s.useState)(!1),Re=a&&a===z.UW,Pe=a===z.y2&&!Ce;(0,s.useEffect)((()=>{le((0,R.FC)())}),[le]);const[Fe,Me]=(0,s.useState)({projectId:e,page:Pe?Se:1,pageSize:q,notEmbed:!0,tags:null,folderTag:null}),{isLoading:De,isSuccess:ze,isError:Oe,isFetching:He,refetch:Ve,error:qe}=(0,L.SB)({...Fe,folderTag:null,tags:null,status:"main"},{skip:o||!(null===(Y=Fe.name)||void 0===Y||!Y.length)&&a!==z.y2}),[$e,Xe]=(0,s.useState)({page:Se||1,pageSize:q,folderTag:null,tags:[]}),{isLoading:Ge,isSuccess:Ue,isError:We,isFetching:Ye,data:Ke=[],refetch:Ze,error:Je}=(0,L.kz)($e,{skip:!o||(Math.ceil(ne/q)||1)<$e.page}),[Qe,et]=(0,s.useState)({projectId:e,page:1,pageSize:q,notEmbed:!0,tags:Ce&&[Ce],folderTag:a}),{isLoading:tt,isSuccess:ot,isError:st,isFetching:at,error:lt}=(0,L.SB)({...Qe,tags:a&&Qe.folderTag?null:Qe.tags,status:"custom"},{skip:o||Re||a===z.y2||Qe.folderTag!==a||!(null===(K=Qe.name)||void 0===K||!K.length)&&(Re||a===z.y2)}),[nt,it]=(0,s.useState)({projectId:e,page:Re?Se:1,pageSize:q,notEmbed:!0,tags:Ce&&[Ce],folderTag:null,status:"trash"}),[rt,dt]=(0,s.useState)(!1),{isLoading:ct,isSuccess:mt,isError:ut,isFetching:pt,data:ht,refetch:gt,error:xt}=(0,L.SB)({...nt,status:"trash",folderTag:null,page:rt?nt.page:1},{skip:o||(Math.ceil(ie/q)||1)<nt.page||!(null===(Z=nt.name)||void 0===Z||!Z.length)&&!Re||!(null===(J=nt.tags)||void 0===J||!J[0])&&me>0});(0,s.useEffect)((()=>{dt(!!ht||Math.ceil(ie/q)>=nt.page)}),[ht,nt.page,ie]);const vt=o?$e:Re?nt:Pe?Fe:Qe,ft=o?Ue:Re?mt:Pe?ze:ot,bt=o?Ge:Re?ct:Pe?De:tt,_t=o?We:Re?ut:Pe?Oe:st,jt=o?Ye:Re?pt:Pe?He:at,yt=o?Ze:Re?gt:Pe?Ve:()=>{var e;return le(L.VM.endpoints.getBlocks.initiate({...vt,folderTag:a||(null===(e=vt.tags)||void 0===e?void 0:e[0])||!1}))},At=o?Je:Re?xt:Pe?qe:lt,kt=(o?ne:Re?ie:Pe?ne:null===de||void 0===de||null===(Q=de[a||(null===(ee=Qe.tags)||void 0===ee?void 0:ee[0])])||void 0===Q?void 0:Q.total)||0,St=o?Ke:Re?me:Pe?ce:null===de||void 0===de||null===(te=de[a||(null===(oe=Qe.tags)||void 0===oe?void 0:oe[0])])||void 0===te?void 0:te.list,wt=(0,s.useCallback)((e=>{o?Xe((t=>({...t,...e}))):Re?it((t=>({...t,...e}))):Pe?Me((t=>({...t,...e}))):et((t=>({...t,...e})))}),[o,Re,Pe]);(0,s.useEffect)((()=>{var e;"rest_post_invalid_page_number"===(null===At||void 0===At||null===(e=At.data)||void 0===e?void 0:e.code)&&wt({page:1})}),[At,wt]),(0,s.useEffect)((()=>{if(!o){(we&&we!==a||G&&Ce!==G)&&wt({folderTag:a,page:1});let e={page:we===a&&vt.page?vt.page:1};a&&!Ce&&(e.blockfolder=a),G&&(e.tag=G),Ae(e,{replace:!0})}}),[vt.page,xe,o,we,a,G,Ce,wt,Ae]);const Ct=e=>{_e({maskClosable:!0,centered:!0,title:ae(Re?"Are you sure to irrevocably delete the \u201c":"Are you sure you want to delete the \u201c","block")+e.title+se("\u201d block?"),icon:(0,O.jsx)(h.A,{style:{color:"#ff4d4f"}}),okText:se("Yes"),cancelText:se("No"),onOk:()=>(e=>je.dispatch(L.VM.endpoints.deleteBlock.initiate({id:e.id,force:Re})).then((e=>{e.error?(0,M.p6)(e,be):e.data&&((0,M.wB)(se("The block \u201c")+e.data.title+ae("\u201d was successfully removed.","block"),be),yt(),$(),gt(),ke())})))(e)})},Et=e=>{Le(!0),Te({blockId:null===e||void 0===e?void 0:e.id,status:"publish"}).then((t=>{t.error?be.error({message:(0,O.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.code}}),description:(0,O.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.message}}),placement:"bottomRight"}):(e.blockfolder[0]?yt():Ve(),$(),gt(),ke(),be.success({message:se("The block \u201c")+e.title+ae("\u201d was successfully recovered.","recovery"),placement:"bottomRight"})),Le(!1)}))},It=e=>{Le(!0),Ne(null===e||void 0===e?void 0:e.id).then((e=>{const t=e.data;Ee({title:(0,M.fq)(t.title),blocktags:t.blocktags,blockfolder:t.blockfolder,project:t.project,subject:t.subject,description:t.description,html:(0,M.el)(t.html||"",t.title),type:t.type?t.type:"Other"}).then((e=>{e.error?be.error({message:(0,O.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.code}}),description:(0,O.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.message}}),placement:"bottomRight"}):(Ve(),be.success({message:se("The copy of block \u201c")+t.title+ae("\u201d was successfully created.","block"),placement:"bottomRight"})),Le(!1)}))}))},Nt=(e,t)=>{Te({blockId:t.id,blockfolder:e.key===z.y2?[]:[e.key]}).then((e=>{var o,s;(null===e||void 0===e||null===(o=e.data)||void 0===o?void 0:o.blockfolder[0])&&le(L.VM.endpoints.getBlocks.initiate({...vt,folderTag:(null===e||void 0===e||null===(s=e.data)||void 0===s?void 0:s.blockfolder[0])||null})),a!==z.y2&&(le((0,R.wK)({blockfolder:a,blockId:t.id})),le(L.VM.endpoints.getBlocks.initiate({...vt,folderTag:a||null}))),Ve(),$()})).catch((e=>console.warn("err",e)))},Tt=[{width:"26%",title:se("Block"),dataIndex:"title",render:(e,t,o)=>(0,O.jsx)(S.N_,{to:V(pe,t),children:e})},{width:"14%",title:se("Type"),dataIndex:"type",render:(e,t,o)=>e},{width:"20%",title:se("Tags"),dataIndex:"blocktags",render:(e,t,o)=>(0,O.jsx)(n.A,{wrap:!0,size:10,children:e&&e.map((e=>{const t=null===X||void 0===X?void 0:X.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:ve.colorPrimary,style:{cursor:"pointer",borderRadius:6,marginRight:0},onClick:()=>U(null,t.id),children:t.name},t.id)||null}))})},{width:"3%",title:"",dataIndex:"lock",render:(e,t,o)=>{var s,a;return e&&(0,O.jsx)(g.A,{className:I()("lock-icon",{"lock-icon__disabled":!(he||ge||(null===(s=re.id)||void 0===s?void 0:s.toString())===(null===(a=t.author)||void 0===a?void 0:a.toString()))})})}},{width:"16%",title:se("Creator"),dataIndex:["_embedded","author"],render:(e,t,o)=>{var s;return(null===e||void 0===e||null===(s=e[0])||void 0===s?void 0:s.name)||""}},{width:"9%",title:ae("Created","block"),className:"nobr",dataIndex:"date",render:(e,t,o)=>(0,M.Yq)((0,A.A)(e),se),sorter:!0,sortOrder:(0,M.Np)(vt.order)},{width:"3%",title:"",dataIndex:"",key:"x",onCell:()=>({style:{padding:0}}),render:(e,t)=>{var o,s,a,l,n,i,d,c;const m=t.blockfolder[0]||null,u={icon:(0,O.jsx)(x.A,{style:{fontSize:18}}),label:se("New blocks"),key:z.y2,onClick:e=>Nt(e,t)},p=null===E||void 0===E?void 0:E.map((e=>({icon:(0,O.jsx)(v.A,{style:{fontSize:18}}),label:e.name,key:e.id,className:e.id,onClick:e=>Nt(e,t)}))),A=(null===p||void 0===p?void 0:p.filter((e=>!m||e.key!==m)))||[];m&&(null===A||void 0===A||A.unshift(u));let k=[];return(he||ge||(null===(o=re.id)||void 0===o?void 0:o.toString())===(null===(s=t.author)||void 0===s?void 0:s.toString()))&&!Re&&k.push({label:(0,O.jsx)(N.A,{element:t},"Lock"),icon:t.lock?(0,O.jsx)(f.A,{style:{fontSize:"16px"}}):(0,O.jsx)(g.A,{style:{fontSize:"16px"}})}),(he||ge||(null===(a=re.id)||void 0===a?void 0:a.toString())===(null===(l=t.author)||void 0===l?void 0:l.toString()))&&!Re&&A.length>0&&k.push({label:se("Transfer to folder"),icon:(0,O.jsx)(v.A,{style:{fontSize:"16px"}}),children:A}),!Re&&k.push({label:(0,O.jsx)(S.N_,{to:V(pe,t),children:se("Edit")}),icon:(0,O.jsx)(b.A,{style:{fontSize:"16px"}}),key:"Export",className:"em-analytics__block-enter"},{label:se("Clone"),key:"Clone",icon:(0,O.jsx)(_.A,{style:{fontSize:"16px"}}),className:"em-analytics__block-clone",disabled:Ie.isLoading,onClick:()=>It(t)}),(he||ge||(null===(n=re.id)||void 0===n?void 0:n.toString())===(null===(i=t.author)||void 0===i?void 0:i.toString()))&&Re&&k.push({label:se("Recover"),icon:(0,O.jsx)(j.A,{style:{fontSize:"16px"}}),key:"Recover",onClick:()=>Et(t)}),(he||ge||(null===(d=re.id)||void 0===d?void 0:d.toString())===(null===(c=t.author)||void 0===c?void 0:c.toString()))&&k.push({label:se("Remove"),icon:(0,O.jsx)(h.A,{style:{fontSize:"16px"}}),key:"Remove",className:"em-analytics__block-remove",style:{color:"#ff4d4f"},onClick:()=>Ct(t)}),(0,O.jsx)(r.A,{arrow:"true",placement:"bottomRight",menu:{items:k},trigger:["hover"],children:(0,O.jsx)("span",{className:"projects-table__actions",children:(0,O.jsx)(y.A,{})})})}}],[Bt,Lt]=(0,s.useState)(!1);return(0,s.useEffect)((()=>{var e;for(let t in ue)if(t||""===t||0===t.length){Lt(!0),wt({...ue,folderTag:a,page:1});break}(null!==(e=ue.tags)&&void 0!==e&&e.length||ue.name)&&wt({...ue,folderTag:a,page:1})}),[ue,le,a,Re,wt,o]),(0,O.jsxs)("div",{className:"project-blocks-page__list",children:[bt&&!(null!==St&&void 0!==St&&St.length)&&(0,O.jsx)(d.A,{active:!0}),_t&&(0,O.jsx)(c.A,{message:se("Error"),description:se("Error when receiving data. Try again (reload page) or contact support."),type:"error",showIcon:!0}),!bt&&!jt&&0===(null===St||void 0===St?void 0:St.length)&&(Bt||W>0?(0,O.jsx)(c.A,{message:se("Blocks not found"),description:"",type:"info",showIcon:!0}):a!==z.y2?(0,O.jsx)(c.A,{message:se("You don't have any blocks in this folder."),description:se("Add your first block to the folder..."),type:"info",showIcon:!0}):(0,O.jsx)(c.A,{message:se("You don't have any blocks yet."),description:se("Add your first block by clicking the Create a new block button."),type:"info",showIcon:!0})),(null===St||void 0===St?void 0:St.length)>0&&t===z.rl&&(0,O.jsx)(m.A,{rowKey:e=>e.id,bordered:!0,dataSource:St,columns:Tt,loading:jt||Be,onChange:(e,t,{order:o,field:s},{action:a})=>{"sort"===a&&wt(o?{page:vt.page||1,order:(0,M.gq)(o),orderby:s,pageSize:q}:{page:vt.page||1,pageSize:q})},showSizeChanger:!1,pageSize:q,pagination:{current:vt.page||1,total:kt,hideOnSinglePage:!0,showSizeChanger:!1,pageSize:q,position:["bottomLeft"],onChange:(t,o)=>wt({projectId:e,page:t,pageSize:o})}}),((null===St||void 0===St?void 0:St.length)>0||ft)&&t===z.Y$&&(0,O.jsxs)(O.Fragment,{children:[De&&(0,O.jsx)(d.A,{active:!0}),(jt||Be)&&(0,O.jsx)("div",{className:"project-blocks-page__loader",children:(0,O.jsx)(B.A,{small:!0})}),(0,O.jsx)("div",{className:"project-blocks-page__cards-grid",children:St&&St.map((e=>(0,O.jsx)(T.A,{element:e,setSearchFilters:U,isTrash:Re,foldersList:E,refetch:Ve,projectTags:X,foldersHandlers:{handleRemove:Ct,handleRecover:Et,handleClone:It,handlerChangeFolder:Nt}},e.id)))}),(0,O.jsx)(u.A,{current:vt.page||1,total:kt,hideOnSinglePage:!0,showSizeChanger:!1,pageSize:q,onChange:(t,o)=>wt({projectId:e,page:t,pageSize:o})})]})]})}},21731:(e,t,o)=>{o.d(t,{A:()=>ae});o(92810);var s=o(33206),a=o(81e3),l=o(4800),n=o(43005),i=o(66726),r=o(71157),d=o(64617),c=o(46312),m=o(63531),u=o(81304),p=o(44335),h=o(9452),g=o(20350),x=o(3625),v=o(10900),f=o(82013),b=o(65953),_=o(80925),j=o(55348),y=o(27071),A=o(60015),k=o(73259),S=o(66282),w=o(4907),C=o(45934),E=o(23287),I=o(59287),N=o(83953),T=o(57903),B=o(62303),L=o(86286),R=o(36404),P=o(32269),F=o(56991),M=o(47381),D=o(14598),z=o(58689),O=o(17581),H=o(4115),V=o(93563),q=o(64936),$=o(62677),X=o(48426),G=o(85163),U=o(76207),W=o(31844),Y=o(32411),K=o(90070),Z=o(85974),J=o(90854),Q=o(7205),ee=o(93982),te=o(13522),oe=o(44824),se=o(70082);const ae=({email:e,autoSaveEmailResult:t,autoSaveBlockResult:o})=>{var ae,le,ne,ie,re,de,ce,me;const{__:ue,_x:pe}=(0,E.s9)(),he=(0,C.wA)(),[ge]=(0,c.mI)(),[xe]=(0,m.dS)();let ve=(0,d.Zp)();const{owner:fe,admin:be}=(0,W.A)(),_e=(0,C.d4)(L.C1),{modal:je}=s.A.useApp(),ye=(0,r.hN)(),{confirm:Ae}=je,ke=(0,C.Pj)(),Se=(0,K.p6)(),we=(0,F.rD)(),{projectId:Ce}=(0,d.g)(),Ee=(0,ee.ml)(te.A.ON_EMAIL_CLONE_ID),Ie=(0,C.d4)(R.yN),[Ne]=(0,$.N)(),Te=(0,M.u)(),[Be,Le]=(0,O.Kh)(),[Re]=(0,H.ri)(),[Pe]=(0,H.cA)(),[Fe]=(0,X.m)(),{data:Me}=(0,d.KC)(),{data:De,refetch:ze}=(0,V.Jz)({parent:null===(ae=Me.folder)||void 0===ae?void 0:ae[0]},{skip:!(null!==(le=Me.folder)&&void 0!==le&&le[0])}),Oe=()=>null===e.title?ue("New email title"):e.title,He=(0,Y.fn)(),Ve=(e,t=(null===He||void 0===He?void 0:He.getValue())||"")=>Re({file:t,title:Oe(),notification:ye}).then((t=>{if(t.error)return ye.error({message:(0,se.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.code}}),description:(0,se.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,(()=>Pe({id:s.id,notification:ye})))}})),qe=(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,z.SR)(e).finally(t))),$e=async e=>{const t=e.querySelectorAll("[em-operation=exportAsPicture]"),o=new Map;for(let a=0,l=t.length;a<l;a++){const e=t[a];e.setAttribute("em-export-id",a),o.set(`[em-export-id='${a}']`,e)}if(o.size)try{const{data:t,dispose:a}=await((e,t,o=2)=>Ve(((t,s)=>({data:e.map((e=>({selector:e,href:(0,I.Wv)(G.Tm,(null===Me||void 0===Me?void 0:Me.id)||0,t.id,void 0,!1,o,e)}))),dispose:s})),t))([...o.keys()],(0,J.b6)(e),2);try{const s=t.map((async({href:t,selector:s},a)=>{const l=o.get(s);if("TD"===l.tagName){l.removeAttribute("style");for(const e of[...l.classList])e.startsWith("em-mob-")&&l.classList.remove(e)}const n=await(async(e,t)=>{var o;const s="string"===typeof e?null===(o=await ge({url:e}))||void 0===o?void 0:o.data:e;if(t.split(".").length<2){const e=p.extension(s.type);e&&(t=`${t}.${e}`)}const a=new File([s],t.toLowerCase()),l=await xe({user_id:_e.id,folder:Me.id,file:a});var n,i,r;return l.error||400===(null===(n=l.data.data)||void 0===n?void 0:n.status)?"string"===typeof e?e:"":null===(i=l.data)||void 0===i||null===(r=i[0])||void 0===r?void 0:r.file_url})(t,`${a}-${l.tagName.toLowerCase()}.png`),i=parseInt(getComputedStyle(l).width);let r=new Image(i);r.setAttribute("border","0"),r.setAttribute("style",`display: block; width: 100%; max-width: ${i}px;`),r.alt="",r.src=n;const d=l.querySelector("a");if(d){const t=e.createElement("a");t.setAttribute("target","_blank"),t.setAttribute("href",d.getAttribute("href")),t.appendChild(r),r=t}if("TD"===l.tagName){const e=l.cloneNode();e.removeAttribute("em-operation"),e.appendChild(r),r=e}l.replaceWith(r)}));await Promise.all(s)}catch(s){console.log(s)}finally{a()}}catch(s){console.log(s)}},Xe=t=>{var o,s;if("0"===(null===Me||void 0===Me||null===(o=Me.limits)||void 0===o?void 0:o.preview_limit)&&Ce&&(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",a=`<a href="${`https://racs.rest/v3/link?app=emailmaker&project=${Ce}&email=${e.id}&link=${s}`}" target="_blank"><img src="https://racs.rest/v3/pixel/123.png?image=${o}&project=${Ce}&email=${e.id}" width="150" height="50" border="0" alt="" style="display: inline-block; width: 100%; max-width: 150px;"></a>`;t.querySelector("body > table:last-child > tbody:last-child > tr:last-child, body > div > table:last-child > tbody:last-child > tr:last-child")&&t.querySelector("body > table:last-child > tbody:last-child > tr:last-child, body > div > table:last-child > tbody:last-child > tr:last-child").insertAdjacentHTML("afterend",`<tr em="block" class="em-powered-logo">\n <td align="center" bgcolor="#FFFFFF">${a}</td>\n </tr>`)}return t},Ge=t=>{Te({event:"click",action:"export_email",export_type:"HTML"});const o=document.querySelector(".email-preview"),s=getComputedStyle(o);(0,z.PJ)(null===He||void 0===He?void 0:He.getValue(),[s.width],e.utm_parameters,(async e=>{await $e(e),Xe(e),await(0,oe.e)(e,t)})).then((e=>{const t=new Blob([e],{type:"text/html;charset=utf-8"});(0,U.saveAs)(t,`${Oe()}.html`)})).catch((e=>console.log(e)))},Ue=t=>{Te({event:"click",action:"export_email",export_type:"Clipboard"});const o=document.querySelector(".email-preview"),s=getComputedStyle(o);(0,z.PJ)(null===He||void 0===He?void 0:He.getValue(),[s.width],e.utm_parameters,(async e=>{await $e(e),Xe(e),await(0,oe.e)(e,t)})).then((e=>navigator.clipboard.writeText(e).then((function(){(0,P.wB)(ue("The email has been copied to the clipboard."),ye)})))).catch((e=>console.log(e)))},We=e=>new Promise(((t,o)=>{fetch(e).then((e=>t(e.blob())),(()=>(e=>{const t=Se.get(G.A9.em_token);return fetch(`https://app.emailmaker.ru/api/wp-json/cors-proxy/v1/get?url=${encodeURIComponent(e)}`,{headers:{authorization:`Bearer ${t}`}}).then((e=>e.blob()))})(e).then(t,o))).catch((()=>{}))})),Ye=t=>{Te({event:"click",action:"export_email",export_type:"ZIP"});const o=document.querySelector(".email-preview"),s=getComputedStyle(o);(0,z.Mp)(null===He||void 0===He?void 0:He.getValue(),[s.width],e.utm_parameters,We,(async e=>{await $e(e),Xe(e),await(0,oe.e)(e,t)})).then((e=>(0,U.saveAs)(e,`${Oe()}.zip`))).catch((e=>console.log(e)))},Ke=()=>{e.isNew?(G.EW.isPlugin||ve(`/projects/${Me.id}/emails`),(0,P.wB)(ue("The draft of the email has been deleted."),ye)):Ze(e,ve)},Ze=(e,t)=>{Ae({maskClosable:!0,centered:!0,title:pe("Are you sure to delete \u201c","email")+e.title+ue("\u201d email?"),icon:(0,se.jsx)(h.A,{style:{color:"#ff4d4f"}}),okText:ue("Yes"),cancelText:ue("No"),onOk:()=>((e,t)=>ke.dispatch(O.GY.endpoints.deleteEmail.initiate(e.id)).then((o=>{o.error&&(0,P.p6)(o,ye),e.project&&!G.EW.isPlugin&&t(`/projects/${e.project}/emails`),(0,P.wB)(ue("The email \u201c")+o.data.title+pe("\u201d was successfully removed.","email"),ye)})))(e,t)})},Je=()=>{(0,D.QM)("application/zip, message/rfc822, text/html",Qe)},Qe=async e=>{const t=e[0];try{const e=await(0,D.q2)(t,(async(e,t)=>{let o;if("string"===typeof e)try{var s;e=(0,Q.A)(e),o=null===(s=await ge({url:e}))||void 0===s?void 0:s.data}catch(d){return e}else o=e;if(t.split(".").length<2){const e=p.extension(o.type);e&&(t=`${t}.${e}`)}const a=new File([o],t.toLowerCase()),l=await xe({user_id:_e.id,folder:Me.id,file:a});var n,i,r;if(!l.error&&400!==(null===(n=l.data.data)||void 0===n?void 0:n.status))return null===(i=l.data)||void 0===i||null===(r=i[0])||void 0===r?void 0:r.file_url;return"string"===typeof e?e:""}),(e=>{e.title||(e.title=(0,z.Ay)(t.name)[0])}));He.setValue(e)}catch(o){const e=o instanceof Error?o.message:o;ye.error({message:(0,se.jsx)("div",{dangerouslySetInnerHTML:{__html:e}}),placement:"bottomRight"})}Te({event:"upload_file",action:"import_email"})};let et=[];we.emailDropdownMenuClone&&et.push({label:ue("Clone"),icon:(0,se.jsx)(g.A,{style:{fontSize:"16px"}}),key:"Clone",className:"em-analytics__email-clone",disabled:Le.isLoading,onClick:async()=>{if(e.isNew)ye.warning({message:ue("To create a copy, you need to save the email."),placement:"bottomRight"});else{var t,o,s,a,l;if((await Ee.fire(e)).some((e=>!1===e)))return;Be({title:(0,P.fq)(e.title),project:null===Me||void 0===Me?void 0:Me.id,description:e.description,html:(0,P.el)((null===He||void 0===He?void 0:He.getValue())||"",e.title),parent_email:e.parent_email||G.iU,common_styles:e.common_styles||"",utm_parameters:{utm_source:null===(t=e.utm_parameters)||void 0===t?void 0:t.utm_source,utm_medium:null===(o=e.utm_parameters)||void 0===o?void 0:o.utm_medium,utm_campaign:null===(s=e.utm_parameters)||void 0===s?void 0:s.utm_campaign,utm_term:null===(a=e.utm_parameters)||void 0===a?void 0:a.utm_term,utm_content:null===(l=e.utm_parameters)||void 0===l?void 0:l.utm_content},emailtags:e.emailtags,folder:e.folder}).then((t=>{t.error?ye.error({message:(0,se.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.code}}),description:(0,se.jsx)("div",{dangerouslySetInnerHTML:{__html:t.error.data.message}}),placement:"bottomRight"}):(ve(`/projects/${Me.id}/emails/${t.data.id}`),ye.success({message:ue("The copy of email \u201c")+e.title+ue("\u201d was successfully created."),placement:"bottomRight"}),De&&ze())}))}}}),we.emailDropdownMenuImport&&et.push({label:pe("Import","verb"),icon:(0,se.jsx)(x.A,{style:{fontSize:"16px"}}),key:"Import",className:"em-analytics__editor-page__import",onClick:()=>{Te({event:"click",action:"import_email"}),Je()}}),(fe||be||(null===(ne=_e.id)||void 0===ne?void 0:ne.toString())===(null===(ie=e.author)||void 0===ie?void 0:ie.toString()))&&(we.emailDropdownMenuLock&&et.push({label:(0,se.jsx)(T.A,{element:e},"Lock"),icon:e.lock?(0,se.jsx)(v.A,{style:{fontSize:"16px"}}):(0,se.jsx)(f.A,{style:{fontSize:"16px"}}),disabled:e.isNew}),we.emailDropdownMenuRemove&&et.push({label:ue("Remove"),icon:(0,se.jsx)(h.A,{style:{fontSize:"16px"}}),key:"Remove",className:"em-analytics__email-remove",style:{color:"#ff4d4f"},onClick:Ke}));const tt=e.isAmp;let ot=[];return we.exportHtmlEnabled&&ot.push({key:"html",label:ue("Code"),icon:(0,se.jsx)(b.A,{style:{fontSize:"16px"}}),...tt?{children:[{key:"\u0441ode_html",label:ue("AMP"),onClick:()=>Ge("amp")},{key:"html_amp",label:ue("HTML"),onClick:()=>Ge("html")}]}:{onClick:()=>Ge()}}),we.exportZipEnabled&&ot.push({key:"zip",label:ue("ZIP"),icon:(0,se.jsx)(_.A,{style:{fontSize:"16px"}}),...tt?{children:[{key:"zip_html",label:ue("AMP"),onClick:()=>Ye("amp")},{key:"zip_amp",label:ue("HTML"),onClick:()=>Ye("html")}]}:{onClick:()=>Ye()}}),we.exportClipboardEnabled&&ot.push({key:"clipboard",label:ue("Clipboard"),icon:(0,se.jsx)(j.A,{style:{fontSize:"16px"}}),...tt?{children:[{key:"clipboard_html",label:ue("AMP"),onClick:()=>Ue("amp")},{key:"clipboard_amp",label:ue("HTML"),onClick:()=>Ue("html")}]}:{onClick:()=>Ue()}}),!G.EW.isPlugin&&we.exportWebHookEnabled&&ot.push({key:"webhook",icon:(0,se.jsx)(B.A,{icon:"WebHook",style:{fontSize:"16px"}}),label:ue("WebHook"),onClick:()=>{Ie.webhook?(Te({event:"click",action:"export_email",export_type:"webhook"}),Ne({url:Ie.webhook,body:(0,u.E)(e,ke)}).then((e=>{e.error?200===e.error.originalStatus?ye.success({message:ue("Success!"),description:ue("WebHook successfully sent!"),placement:"bottomRight"}):ye.error({message:(0,se.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.status}}),description:(0,se.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.error}}),placement:"bottomRight"}):ye.success({message:ue("Success!"),description:ue("WebHook successfully sent!"),placement:"bottomRight"})}))):(he((0,q.YF)("webhooksettings")),he((0,q.qf)(G.lx.EDIT_PROJECT_MODAL)))}}),we.exportOutlookEnabled&&ot.push({key:"outlook",icon:(0,se.jsx)(y.A,{style:{fontSize:"16px"}}),label:ue("Outlook"),onClick:()=>(t=>{Te({event:"click",action:"export_email",export_type:"Outlook"});const o=document.querySelector(".email-preview"),s=getComputedStyle(o),a=async(e,t)=>{if("amp"===t){for(const t of e.querySelectorAll(".em-amp-show-disabled"))t.remove();await(0,Z.Sc)(e,{mappedTags:{script:"___script"}})}else if("html"===t){for(const t of e.querySelectorAll(".em-amp-show-only"))t.remove();(0,Z.Km)(e,{mappedTags:{script:"___script"}})}await $e(e),Xe(e)};(0,z.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=>a(e,"amp"),"text/x-amp-html;charset=utf-8":e=>a(e,"html")}:a).then((e=>{const t=new Blob([e],{type:"text/html;charset=utf-8"});(0,U.saveAs)(t,`${Oe()}.eml`)})).catch((e=>console.log(e)))})(tt)}),we.exportPdfEnabled&&ot.push({key:"pdf",icon:(0,se.jsx)(A.A,{style:{fontSize:"16px"}}),label:ue("PDF"),onClick:async()=>{const t=null===e||void 0===e?void 0:e.html;try{const e=await Fe({htmlContent:t,notification:ye}).unwrap(),o=window.URL.createObjectURL(new Blob([e],{type:"application/pdf"})),s=document.createElement("a");s.href=o,s.setAttribute("download",`${Oe()}.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)}}}),we.exportPngEnabled&&ot.push({key:"img",icon:(0,se.jsx)(k.A,{style:{fontSize:"16px"}}),label:ue("PNG"),onClick:()=>qe(1).then(z.gZ).then((e=>(0,U.saveAs)(e,`${Oe()}.png`))).then(Te({event:"click",action:"export_email",export_type:"Image"}))}),(0,se.jsxs)(a.A,{children:[we.emailDropdownMenuEnabled?(0,se.jsx)(l.A,{arrow:{pointAtCenter:!0},placement:"bottom",menu:{items:et},children:(0,se.jsx)(n.Ay,{type:"default",block:!1,className:"email-page-header__btn email-page-header__btn_extra",onClick:()=>{},children:(0,se.jsx)(S.A,{})})},"Actions"):we.emailDropdownMenuImport&&(0,se.jsx)(i.A,{title:pe("Import","verb"),placement:"bottom",children:(0,se.jsx)(n.Ay,{className:"em-analytics__editor-page__import",type:"text",icon:(0,se.jsx)(x.A,{style:{fontSize:20}}),onClick:()=>{Te({event:"click",action:"import_email"}),Je()}})}),we.emailExportEnabled&&(0,se.jsx)(l.A,{arrow:{pointAtCenter:!0},placement:"bottom",menu:{items:ot},children:(0,se.jsx)(n.Ay,{className:"em-analytics__email-page__export",type:"default",icon:(0,se.jsx)(w.A,{}),children:ue("Export")},"Export")},"Export"),!e.hasOwnProperty("type")&&(0,se.jsx)(I.Ay,{autoSaveEmailResult:t,email:e,isEditableRights:fe||be||(null===(re=_e.id)||void 0===re?void 0:re.toString())===(null===(de=e.author)||void 0===de?void 0:de.toString())},"Save"),!!e.hasOwnProperty("type")&&(0,se.jsx)(N.A,{block:e,isEditableRights:fe||be||(null===(ce=_e.id)||void 0===ce?void 0:ce.toString())===(null===(me=e.author)||void 0===me?void 0:me.toString()),autoSaveBlockResult:o},"Save")]})}},30961:(e,t,o)=>{o.d(t,{A:()=>C});var s=o(92810),a=o(95838),l=o(12280),n=o(2018),i=o(55039),r=o(81662),d=o(77406),c=o(81500),m=o(45934),u=o(64617),p=o(23287),h=o(84568),g=o(17581),x=o(55701),v=o(7760),f=o(65983),b=o(32269),_=o(85163),j=o(70082);const{useToken:y}=a.A,{name:A,type:k,tags:S}={name:"name",type:"type",tags:"tags"},w={[A]:"",[k]:[],[S]:[]},C=({isBlocks:e=!1,templateEmailId:t=!1})=>{const{__:o}=(0,p.s9)(),{projectId:a}=(0,u.g)(),[C]=l.A.useForm(),{data:E}=(0,x.h1)(),I=(0,m.wA)(),N=(0,m.d4)(v.b9),T=(0,m.d4)(f.CT),{token:B}=y(),L=(0,m.Pj)(),R=e?N:T,{isSuccess:P,data:F}=h.Nq.endpoints.getProject.select(+a)(L.getState(),{skip:t}),{isSuccess:M,data:D}=(0,g.sl)(+t,{skip:!t}),z=(0,s.useCallback)((()=>{I(e?(0,v.om)({}):(0,f.om)({}))}),[I,e]);(0,s.useEffect)((()=>{z()}),[z]),(0,s.useEffect)((()=>{}),[M,D,t]),(0,s.useEffect)((()=>{}),[P,F,e,t]);const[O,H]=(0,s.useState)([]);let V;(0,s.useEffect)((()=>{if(E){const e=E.schema.properties.acf.properties.type.items.enum;let t=[];for(let s in e)t.push({label:o(_.jg[e[s]]),value:e[s]});H(t)}}),[E,o]);const[q,$]=(0,s.useState)(!1);return(0,s.useEffect)((()=>{const o=t?M&&(0,b._q)(D,_.zh).filter((e=>{var t;return null===R||void 0===R||null===(t=R.tags)||void 0===t?void 0:t.includes(e.id)})).map((e=>e.name))||[]:P&&(0,b._q)(F,e?_.YY:_.zh).filter((e=>{var t;return null===R||void 0===R||null===(t=R.tags)||void 0===t?void 0:t.includes(e.id)})).map((e=>e.name))||[];C.setFieldsValue({tags:o})}),[P,R,e,C,F,M,D,t]),(0,j.jsx)("div",{className:"cards-search",children:(0,j.jsx)(l.A,{form:C,name:"cards_search_form",initialValues:{...w},onValuesChange:o=>{const s=Object.keys(o)[0],a=C.getFieldsValue(!0);switch(s){case S:const l=t?(0,b._q)(D,_.zh).filter((e=>o[s].includes(e.name))).map((e=>e.id))||null:(0,b._q)(F,e?_.YY:_.zh).filter((e=>o[s].includes(e.name))).map((e=>e.id))||null;I(e?(0,v.om)({...R,tags:l}):(0,f.om)({...R,tags:l}));break;case k:I(e?(0,v.om)({...R,type:a.type||null}):(0,f.om)({...R,type:a.type||null}));break;case A:V&&window.clearTimeout(V),V=window.setTimeout((function(){I(e?(0,v.om)({...R,name:a.name}):(0,f.om)({...R,name:a.name}))}),100)}},autoComplete:"off",children:(0,j.jsxs)(n.A,{wrap:!1,gutter:0,children:[(0,j.jsx)(l.A.Item,{className:"cards-search__by-title",name:A,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)(r.A,{placeholder:o("Filter by type"),options:O,getPopupContainer:e=>e.parentNode,suffixIcon:(0,j.jsx)(c.A,{style:{fontSize:"16px",color:B.colorText},onClick:()=>$(!q),className:"input-icon"}),allowClear:!0,open:q,onDropdownVisibleChange:e=>{$(e)}})})]})})})}},26238:(e,t,o)=>{o.d(t,{A:()=>v});var s=o(92810),a=o(2018),l=o(7744),n=o(43005),i=o(71086),r=o(64588),d=o(55039),c=o(38883),m=o.n(c),u=o(45934),p=o(23287),h=o(62303),g=o(65983),x=(o(23081),o(70082));const v=({id:e,onChange:t,value:o,alignRight:c,placeholder:v,isDisabled:f=!1,usedColors:b=[],codeMode:_=!1})=>{const{__:j}=(0,p.s9)(),y=(0,u.d4)(g.iy),[A,k]=(0,s.useState)(!0),S=(0,s.useRef)(null),w=(0,s.useRef)(null),C=(0,s.useRef)(t);(0,s.useEffect)((()=>{"undefined"===typeof EyeDropper&&k(!1)}),[o]);const E=async()=>{try{if("undefined"===typeof EyeDropper)return void alert("Your browser does not support the EyeDropper API.");const e=new EyeDropper,t=(await e.open()).sRGBHex.toUpperCase();C.current&&C.current(t),S.current&&(S.current.style.backgroundColor=t),w.current&&(w.current.input.value=t)}catch(e){console.error("Error picking the color: ",e)}};return(0,x.jsx)("div",{className:"color-picker-input",children:(0,x.jsxs)("div",{className:m()("color-picker-input__control-wrap",{"color-picker-input__empty":!o}),children:[(0,x.jsx)(r.A,{disabledAlpha:!0,format:"hex",defaultFormat:"hex",getPopupContainer:e=>e.closest(_?".selected_text_common_form_mobile":".email-pane__collapse-wrapper"),className:"color-picker-input__btn-wrap",rootClassName:"verticalColorpicker",value:""===o?null:o,onChange:e=>{const t=e.toHexString().toUpperCase();C.current&&C.current(t),S.current&&(S.current.style.backgroundColor=t),w.current&&(w.current.input.value=t)},panelRender:(e,{components:{Picker:t,Presets:o}})=>(0,x.jsxs)(a.A,{justify:"space-between",wrap:!1,children:[(0,x.jsxs)(l.A,{flex:"auto",children:[(0,x.jsx)(t,{}),A&&(0,x.jsx)(n.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,x.jsx)(h.A,{icon:"Colorize",style:{position:"relative",top:-2}})})]}),(0,x.jsx)(i.A,{type:"vertical",style:{height:"auto"}}),(0,x.jsx)(l.A,{span:8,children:(0,x.jsx)(o,{})})]}),presets:[{label:j("Used"),colors:b},{label:j("Recommended"),colors:["#000000","#595959","#BFBFBF","#E5E5E5","#F5F5F5","#F5222D","#FA8C16","#FADB14","#8BBB11","#52C41A","#13A8A8","#1677FF","#2F54EB"]}]}),""===o&&(0,x.jsx)("div",{className:"color-picker-input__empty-bg"}),(0,x.jsx)(d.A,{allowClear:!0,id:e,disabled:y||f,className:"color-picker-input__control",placeholder:v||j("Select color"),value:o,ref:w,onChange:t})]})})}},26254:(e,t,o)=>{o.d(t,{A:()=>yt});var s=o(92810),a=o(95838),l=o(20648),n=o(33206),i=o(45934),r=o(49497),d=o(64617),c=o(19817),m=o(59297),u=o(12280),p=o(71086),h=o(55039),g=o(43005),x=o(81e3),v=o(96492),f=o(86889),b=o(71157),_=o(82013),j=o(9588),y=o(94822),A=o(38883),k=o.n(A),S=o(23287),w=o(29993);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 N=o(83351),T=o(15865),B=o(39990),L=o(1779),R=o(141),P=o(85163),F=o(47381),M=o(90070);const D="sign_in_form",z="sign_up_form",O=({className:e})=>{const{__:t}=(0,S.s9)(),o=(0,d.Zp)(),a=(0,i.wA)(),{search:l}=(0,d.zy)(),[n]=(0,B.Lj)(),[r]=(0,N.uX)(),[c,m]=(0,s.useState)(D),A=(0,b.hN)(),C=(0,M.p6)(),[O]=(0,L.p)(),[H]=(0,R.x)(),V=(0,F.u)(),q={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)(_.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)(j.A,{style:{fontSize:16,color:"#1890FF"}})},X=[{name:D,tabTitle:t("Sign In"),fields:[$,q],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[G,U]=(0,s.useState)(""),W={[D]:{onFinish:(e,t=!1)=>{U(P.F5),a(B.Q2.util.resetApiState());(t?O({code:e.access_token}):r({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"}),U(P.ff),w.wd("Something went wrong in auth 1",{extra:t.error.data}),new Error(P.ff);if(401===(null===(o=t.data.data)||void 0===o?void 0:o.status))throw A.error({message:(0,E.jsx)("div",{dangerouslySetInnerHTML:{__html:t.data.code}}),description:(0,E.jsx)("div",{dangerouslySetInnerHTML:{__html:t.data.message}}),placement:"bottomRight"}),U(P.ff),w.wd("Something went wrong in auth 1 because of no email in yan or gmail",{extra:t.data}),new Error(P.ff);C.set(P.A9.em_token,t.data.token,{expires:e.rememberMe?30:1});let s=t;return a(B.Q2.endpoints.getMe.initiate()).then((e=>({result:e,tokenData:s})))})).then((e=>{var s,l,n,i,r,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"}),U(P.ff),w.wd("Something went wrong in auth 2",{extra:null===(u=c.error)||void 0===u?void 0:u.data}),new Error(P.ff);const p=C.get(P.A9.promocode);p&&(C.remove(P.A9.promocode),a(T.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}),V({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===(n=c.data)||void 0===n?void 0:n.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===(r=c.data)||void 0===r?void 0:r.id,email_subscription_consent:null===c||void 0===c||null===(d=c.data)||void 0===d?void 0:d.email_subscription_consent})})).catch((e=>{var t;U(P.ff),w.wd("Something went wrong in auth 3",{extra:null===(t=e.error)||void 0===t?void 0:t.data})}))},onFinishFailed:e=>{w.wd("onFinishFailed SIGN_IN",{extra:e})}},[z]:{onFinish:e=>{U(P.F5),a(B.Q2.util.resetApiState()),n({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"}),U(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"}),U(P.ff),w.wd("Something went wrong in auth 4",{extra:null===(o=t.error)||void 0===o?void 0:o.data}),new Error(P.ff);return C.set(P.A9.em_token,t.data.token,{expires:1}),a(B.Q2.endpoints.editMe.initiate({privacy_policy_agreement:e.privacyPolicy,newsletter_consent:e.newsletterConsent}))})).then((e=>{var t,s,a,l,n;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===(n=e.error)||void 0===n?void 0:n.data}),new Error(P.ff);o("/projects?status=newbie",{replace:!0}),V({type:"Default",event:"submit_form",action:"registration",user_email:null===e||void 0===e||null===(t=e.data)||void 0===t?void 0:t.email,carrotquest_hash:null===e||void 0===e||null===(s=e.data)||void 0===s?void 0:s.carrotquest_hash,user_id:null===e||void 0===e||null===(a=e.data)||void 0===a?void 0:a.id,email_subscription_consent:null===e||void 0===e||null===(l=e.data)||void 0===l?void 0:l.email_subscription_consent})})).catch((e=>{var t;w.wd("Something went wrong in auth 6",{extra:null===(t=e.error)||void 0===t?void 0:t.data}),U(P.ff)}))},onFinishFailed:e=>{w.wd("onFinishFailed SIGN_UP",{extra:e})}}};let Y=[];return X.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:W[e.name].onFinish,onFinishFailed:W[e.name].onFinishFailed,autoComplete:"off",children:[(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(u.A.Item,{children:(0,E.jsx)(E.Fragment,{})}),(0,E.jsx)(p.A,{plain:!0,children:t("or")})]}),e.fields.map((o=>(0,E.jsx)(u.A.Item,{style:{marginBottom:10},name:o.name,extra:e.name===z&&"password"===o.name&&t("At least 8 characters in both cases, including letters, numbers, and special characters."),validateTrigger:["onSubmit"],rules:"password"===o.name&&e.name===z?[{required:!0,message:t("Please enter your password")},()=>({validator:(e,o)=>o.length>=8&&/[0-9]/.test(o)&&/[a-z]/.test(o)&&/[A-Z]/.test(o)&&/\W+|_/g.test(o)?Promise.resolve():Promise.reject(new Error(t("The password does not meet the requirements:")))})]:o.rules,children:"password"===o.name?(0,E.jsx)(h.A.Password,{style:{border:"none",borderRadius:5,height:39,marginBottom:10},variant:"borderless",size:"large",disabled:G===P.F5,type:o.name,placeholder:e.name===D?o.placeholderForSignIn:o.placeholderForCreate,prefix:o.prefix,autoComplete:e.name===D?"":"new-password"}):(0,E.jsx)(h.A,{style:{border:"none",borderRadius:5,height:39},variant:"borderless",size:"large",disabled:G===P.F5,placeholder:o.placeholder,prefix:o.prefix,autoComplete:"off"})},o.name))),(0,E.jsx)(u.A.Item,{children:(0,E.jsx)(g.Ay,{style:{height:44,borderRadius:5,marginTop:10,marginBottom:16,fontSize:18},size:"large",loading:G===P.F5,block:!0,type:"primary",htmlType:"submit",className:e.name===D?"em-analytics__sign-in":"em-analytics__sign-up",children:e.tabTitle})}),e.name===D&&(0,E.jsx)(u.A.Item,{children:(0,E.jsxs)(x.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)(v.A,{disabled:G===P.F5,children:t("Remember me")})}),(0,E.jsx)(y.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)(v.A,{disabled:G===P.F5,children:[t("I agree to the")," ",(0,E.jsx)("a",{href:"https://emailmaker.ru/terms/",target:"_blank",rel:"noopener noreferrer",children:t("Terms")})," ",t("and"),"\xa0",(0,E.jsx)("a",{href:"https://emailmaker.ru/privacy-policy/",target:"_blank",rel:"noopener noreferrer",children:t("Privacy Policy.")})]})}),(0,E.jsx)(u.A.Item,{name:"newsletterConsent",valuePropName:"checked",className:"auth-form__checkbox",children:(0,E.jsx)(v.A,{disabled:G===P.F5,className:"em-analytics__receive-updates-emailmaker",children:t("I would like to receive updates from EmailMaker.")})})]})]})}))),(0,E.jsxs)("div",{className:k()("auth-form",{[e]:e}),children:[(0,E.jsx)("div",{className:"yandex-button",children:(0,E.jsx)(I,{yandexHandler:e=>{W[D].onFinish(e,!0)}})}),(0,E.jsx)(f.A,{activeKey:c,className:"auth-form__tabs",defaultActiveKey:c,onChange:e=>m(e),items:Y})]})},H=()=>(0,E.jsx)(m.A,{className:"auth-page",children:(0,E.jsx)(O,{className:"auth-page__form"})}),V=()=>((0,s.useEffect)((()=>{window.YaSendSuggestToken(`https://${document.location.host}/auth`,{flag:!0})}),[]),(0,E.jsx)(E.Fragment,{}));var q=o(79381),$=o(36852),X=o(24420),G=o(44338),U=o(32983),W=o(21999),Y=o(4519),K=o(41919),Z=o(76662),J=o(66726),Q=o(2018),ee=o(7744),te=o(58013),oe=o(98655),se=o(30961),ae=o(20757),le=o(32269);const{Content:ne}=K.A,{Paragraph:ie}=Z.A,re=()=>{const{__:e}=(0,S.s9)(),{projectId:t,emailId:o}=(0,d.g)(),a=(0,M.p6)();let l=(0,d.Zp)();const n=a.get(P.A9.em_template_email)||o;(0,s.useEffect)((()=>{document.body.classList.remove("editor")}),[]);const i=(0,E.jsx)(E.Fragment,{children:(0,E.jsxs)(x.A,{size:10,children:[(0,E.jsx)(J.A,{title:e("To emails"),placement:"left",children:(0,E.jsx)(g.Ay,{type:"text",icon:(0,E.jsx)(te.A,{}),onClick:()=>(0,le.XZ)(l,`/projects/${t}`),shape:"circle"})}),(0,E.jsx)(ie,{className:"ant-page-header-heading-title",children:e("Select email template")}),(0,E.jsx)(se.A,{isBlocks:!1,templateEmailId:n})]})}),r=(0,E.jsx)(E.Fragment,{});return(0,E.jsxs)(K.A,{className:"template-page",children:[(0,E.jsx)(ae.A,{leftBlock:i,rightBlock:r}),(0,E.jsx)(ne,{className:"template-page__container",children:(0,E.jsx)("div",{className:"template-page__content container",children:(0,E.jsx)(Q.A,{gutter:50,children:(0,E.jsx)(ee.A,{span:24,children:(0,E.jsx)(oe.A,{projectId:t,emailsView:P.Y$,createPage:!0})})})})})]})};var de=o(19263),ce=o(24239),me=o(85879),ue=o(25072),pe=o(72981),he=o(77242),ge=o(4800),xe=o(9452),ve=o(20350),fe=o(10900),be=o(85677),_e=o(66282),je=o(83953),ye=o(57903),Ae=o(2491),ke=o(55701),Se=o(7760),we=o(47358),Ce=o(65983),Ee=o(87790),Ie=o(86286),Ne=o(32411),Te=o(31844),Be=o(22197);const{Paragraph:Le}=Z.A,{useToken:Re}=a.A,Pe=({block:e,autoSaveBlockResult:t})=>{var o,s,a,l,r,c;const{__:m,_x:u}=(0,S.s9)();let p=(0,i.wA)(),h=(0,d.Zp)();const v=(0,i.d4)(Ie.C1),{modal:f}=n.A.useApp(),j=(0,b.hN)(),{confirm:y}=f,{token:A}=Re(),w=(0,i.d4)(we.yy),C=e.hasOwnProperty("type")?P.IE:P.Tm,I=(0,i.d4)(Ce.qX),N=(0,i.d4)(Se.qX),T=C===P.Tm?I:N,B=(0,i.d4)(we.Fv),{data:L}=(0,d.KC)(),{owner:R,admin:F}=(0,Te.A)(),M=(0,i.Pj)(),D=(e,t)=>{y({maskClosable:!0,centered:!0,title:u("Are you sure you want to delete the \u201c","block")+e.title+m("\u201d block?"),icon:(0,E.jsx)(xe.A,{}),okText:m("Yes"),cancelText:m("No"),onOk:()=>((e,t)=>M.dispatch(ke.VM.endpoints.deleteBlock.initiate(e.id)).then((o=>{o.error&&j.fromError("BLOCK_REMOVING_ERROR",(0,b.x_)(e),o.error),t(`/projects/${e.project}/blocks`),j.success({id:"BLOCK_REMOVING_SUCCESS",message:m("The block \u201c")+o.data.title+u("\u201d was successfully removed.","block"),data:(0,b.x_)(e)})})))(e,t)})},[z,O]=(0,ke.pP)(),H=(0,Ne.fn)();let V=[];V.push({label:m("Clone"),icon:(0,E.jsx)(ve.A,{style:{fontSize:"16px"}}),key:"Clone",className:"em-analytics__block-clone",disabled:O.isLoading,onClick:()=>{e.isNew?j.warning({id:"COPY_NOT_SAVED",payload:e,message:m("To create a copy, you need to save the block."),placement:"bottomRight"}):z({title:(0,le.fq)(e.title),blocktags:e.blocktags,project:L.id,subject:e.subject,description:e.description,html:(null===H||void 0===H?void 0:H.getValue())||"",type:e.type?e.type:"Other"}).then((t=>{t.error?j.error({id:"BLOCK_CLONING_ERROR",data:(0,b.x_)(e),innerException:t.error,message:(0,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}`),j.success({id:"BLOCK_CLONING_SUCCESS",data:(0,b.x_)(e),message:m("The copy of block \u201c")+e.title+u("\u201d was successfully created.","block"),placement:"bottomRight"}))}))}}),(R||F||(null===(o=v.id)||void 0===o?void 0:o.toString())===(null===(s=e.author)||void 0===s?void 0:s.toString()))&&V.push({label:(0,E.jsx)(ye.A,{element:e},"Lock"),icon:e.lock?(0,E.jsx)(fe.A,{style:{fontSize:"16px"}}):(0,E.jsx)(_.A,{style:{fontSize:"16px"}}),disabled:e.isNew},{label:m("Remove"),icon:(0,E.jsx)(xe.A,{style:{fontSize:"16px"}}),key:"Remove",className:"em-analytics__block-remove",onClick:()=>{e.isNew?(h(`/projects/${L.id}/blocks`),j.success({id:"BLOCK_REMOVING_SUCCESS",message:m("The draft of the block has been deleted."),data:(0,b.x_)(e)})):D(e,h)},style:{color:"#ff4d4f"}}),(0,Be.A)(null===e.title?m("New block title"):e.title);const q=(0,E.jsx)(E.Fragment,{children:(0,E.jsxs)(x.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)(te.A,{}),onClick:()=>{h(`/projects/${L.id}/blocks`)},shape:"circle"})}),(0,E.jsx)(Le,{className:"ant-page-header-heading-title",editable:{triggerType:["text","icon"],icon:(0,E.jsx)(be.A,{className:"email-page-header__icon-edit"}),onChange:t=>{e.isNew?p((0,Ee.qT)(t)):p(ke.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)(Ae.A,{emailElement:e}),e.lock?(0,E.jsx)(_.A,{className:k()("lock-icon",{"lock-icon__disabled":!(R||F||(null===(a=v.id)||void 0===a?void 0:a.toString())===(null===(l=e.author)||void 0===l?void 0:l.toString()))}),style:{color:A.colorPrimary,fontSize:"16px"}},"Lock"):null,(0,E.jsx)(ge.A,{arrow:"true",menu:{items:V},children:(0,E.jsx)(g.Ay,{className:"block-page-header__btn block-page-header__btn_extra",onClick:()=>{},children:(0,E.jsx)(_e.A,{})})},"Actions"),(0,E.jsx)(je.A,{className:"em-analytics__block-save",block:e,isEditableRights:R||F||(null===(r=v.id)||void 0===r?void 0:r.toString())===(null===(c=e.author)||void 0===c?void 0:c.toString()),autoSaveBlockResult:t},"Save")]});return(0,E.jsx)(ae.A,{leftBlock:q,rightBlock:$,className:"header_blocks",isHeaderCodeMenuOpen:((null===T||void 0===T?void 0:T.type)===P.bV.TEXT||(null===T||void 0===T?void 0:T.type)===P.bV.LINK||T.type===P.bV.BUTTON)&&B&&"bottom"!==w})};var Fe=o(53204),Me=o(39738),De=o(64037),ze=o(45695),Oe=o(9653);const{Content:He}=K.A,Ve=()=>{const{__:e}=(0,S.s9)(),t=(0,ze.XW)(),{blockId:o,projectId:a}=(0,d.g)(),l=(0,i.wA)();let n=(0,d.Zp)();const r=(0,Ne.fn)(),c=(0,M.p6)(),m=(0,i.d4)(Se.gm),u=(0,i.d4)(Ee.ah),p=(0,i.d4)(Ie.C1),h=(0,i.d4)(Fe.M),x=(0,i.d4)(we.Wm),v=(0,i.d4)(Me.p1),[f]=(0,ke.yW)(),b=c.get(P.A9.em_new_block),{isSuccess:_,data:j}=(0,ke.bg)(+b,{skip:!b}),[y,A]=(0,s.useState)(!1);(0,s.useEffect)((()=>{b&&_&&(l((0,Ee.Bp)(j)),A(!0))}),[b,_,l,j]);const{isLoading:k,isSuccess:w,isError:C,error:I}=(0,ke.bg)(o,{skip:!o}),N=b?_:w,T=w&&null!==m&&void 0!==m&&m.id?m:_&&u,B=(0,s.useRef)(0),{isSuccess:L,isLoading:R}=(0,ke.J4)({blockId:+o},{skip:!o}),[F,D]=(0,s.useState)(null);(0,s.useEffect)((()=>{if(L&&!R&&null!==v&&void 0!==v&&v.length){var e;const s=v[0];if((null===F||void 0===F?void 0:F.toString())!==(null===(e=T.id)||void 0===e?void 0:e.toString())){var t;if(null!==(t=s.slug)&&void 0!==t&&t.includes("autosave")&&r){var o;const e=null===(o=s.html)||void 0===o?void 0:o.replaceAll("\r\n","\n");l((0,Se.DL)(e))}D(T.id)}}}),[l,v,L,R,T,F,r,o]),(0,Oe.U)(T);const z=(0,s.useCallback)((()=>{const e=()=>{f({blockId:null===m||void 0===m?void 0:m.id,body:{title:null===m||void 0===m?void 0:m.title,emailId:null===m||void 0===m?void 0:m.id,project:null===m||void 0===m?void 0:m.project,html:null===r||void 0===r?void 0:r.getValue(),excerpt:null===m||void 0===m?void 0:m.date_gmt}}).then((e=>{})).catch((e=>{console.log(e)}))};if(v&&v.length>0){const t=[...v].sort(((e,t)=>Date.parse(null===t||void 0===t?void 0:t.modified)-Date.parse(null===e||void 0===e?void 0:e.modified)))[0];(Date.parse(new Date)-Date.parse(null===t||void 0===t?void 0:t.modified))/1e3>30&&x&&!h&&e()}else x&&!h&&e()}),[v,f,m,h,x,r]);(0,s.useEffect)((()=>{m&&null!==p&&void 0!==p&&p.autosaves&&!h&&(clearTimeout(B.current),B.current=setTimeout(z,1e4))}),[m,z,p,h]);const O=(0,Ne.aD)(r),H=(0,s.useCallback)((()=>{O.undo()}),[O]),V=(0,s.useCallback)((()=>{O.redo()}),[O]),q=(0,s.useRef)();(0,s.useEffect)((()=>{q.current!==(null===T||void 0===T?void 0:T.id)&&(O.clear(),q.current=null===T||void 0===T?void 0:T.id)}),[T,O]);const $=(0,s.useCallback)((e=>{(window.navigator.appVersion.indexOf("Mac")&&e.metaKey||e.ctrlKey)&&"KeyZ"===e.code&&(e.preventDefault(),e.shiftKey?V():H())}),[H,V]);(0,s.useEffect)((()=>(document.body.classList.add("editor"),()=>{l((0,Fe.rI)()),l((0,Me.qX)()),l((0,we.PM)(P.Bv))})),[l]);(0,De.A)((e=>{const t=e.data.operation,o=e.data.action,s=document.getElementById("iframe-scroll-top"),a=document.getElementById("iframe-scroll-bottom");if(t===P.Ru.APPLICATION_ACTION&&("undo"===o?H():"redo"===o&&V()),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,a=o.getClientRects()[0];a.top<0&&(e.style.display="block"),a.top+a.height>s&&(t.style.display="block")}t===P.Ru.APPLICATION_SCROLL_BLOCK_HIDE&&(s.style.display="none",a.style.display="none")}));const X=e=>{e.preventDefault(),e.target&&t({operation:P.Ru.SANDBOX_DRAG_CANCEL})},G=()=>{},U=e=>{e.preventDefault();const t=document.getElementById("iframe-scroll-top"),o=document.getElementById("iframe-scroll-bottom"),s=document.getElementById("pane-content-iframe"),a=document.getElementById("email_iframe"),{height:l,top:n}=a.getBoundingClientRect(),i=document.body.getBoundingClientRect().height;n>1?"block"===t.style.display&&(t.style.display="none"):"none"===t.style.display&&(t.style.display="block"),l-i+n<1?"block"===o.style.display&&(o.style.display="none"):"none"===o.style.display&&(o.style.display="block"),e.target===t&&s.scrollBy(0,-20),e.target===o&&s.scrollBy(0,20)},W=()=>{const e=document.getElementById("iframe-scroll-top"),t=document.getElementById("iframe-scroll-bottom");e&&t&&(e.style.display="none",t.style.display="none")};return(0,s.useEffect)((()=>(window.addEventListener("dragstart",G),window.addEventListener("drop",X),window.addEventListener("dragend",W),window.addEventListener("dragover",U),window.addEventListener("keydown",$),window.addEventListener("dragenter dragleave",(e=>{e.preventDefault()})),()=>{window.removeEventListener("dragstart",G),window.removeEventListener("drop",X),window.removeEventListener("dragover",U),window.removeEventListener("dragend",W),window.removeEventListener("keydown",$),window.removeEventListener("dragenter dragleave",(e=>{e.preventDefault()}))}))),(0,E.jsxs)(K.A,{className:"block-page",children:[T&&(0,E.jsx)(Pe,{block:T}),k&&(0,E.jsx)(pe.A,{}),C&&I&&(0,E.jsx)(K.A,{children:(0,E.jsx)(He,{style:{paddingTop:"40px"},children:(0,E.jsx)("div",{className:"container",children:(0,E.jsx)(ue.Ay,{status:I.status,title:I.status,subTitle:I.data.message,extra:(0,E.jsx)(g.Ay,{type:"primary",onClick:()=>{n(`/projects/${a}/blocks`)},children:e("Back To Project")})})})})}),(!o&&(!b||y&&u)||w&&m)&&(0,E.jsx)(he.A,{emailElement:T,isSuccess:N})]})};var qe=o(6099),$e=o(24495),Xe=o(17445),Ge=o(24293),Ue=o(49246),We=o(20984),Ye=o(69417),Ke=o(8701),Ze=o(13338),Je=o(79716),Qe=o(41564),et=o(90775),tt=o(64936),ot=o(76793),st=o(843),at=o(35317);const{Paragraph:lt}=Z.A,{Content:nt}=K.A,it="Early",rt="Monthly",dt=(e,t)=>t?e>100?"#FF4D4F":e<100?"#52c41a":100===e?"rgba(0, 0, 0, 0.25)":void 0:"transparent",ct=()=>{const{__:e,_n:t}=(0,S.s9)();let o=(0,d.Zp)();const a=(0,i.wA)(),l=(0,i.d4)(Ie.C1),n=(0,i.d4)(tt.cL),[r,c]=(0,ot.Cl)(),[m,p]=(0,st.IJ)(),[v,f]=(0,at.O)(),{isSuccess:_,isLoading:j,data:y}=(0,B.W5)(),[A]=(0,B.on)(),w=(0,b.hN)(),[C,I]=(0,s.useState)(!1),[N]=u.A.useForm(),L=(0,M.p6)(),[R,F]=(0,s.useState)({discount:null,promocode:null,expiration:null}),{counters:{emails_counter:D,projects_counter:z,users_counter:O,preview_counter:H,payments_counter:V,optimization_counter:q},subscription:$,subscription_end:X,recurring_payments:G,subscription_id:U,promocode:W,subscription_amount:Y,enterprise_users_limit:Z,enterprise_price:Q,enterprise_12_price:ee,email:oe,name:se}=l,[ne,ie]=(0,s.useState)(it);(0,s.useEffect)((()=>{var e,t;(null===$||void 0===$||null===(e=$.post_title)||void 0===e?void 0:e.split(" ").length)>1?ie(it):1===(null===$||void 0===$||null===(t=$.post_title)||void 0===t?void 0:t.split(" ").length)&&ie(rt)}),[null===$||void 0===$?void 0:$.post_title]);const[re,de]=(0,s.useState)([]);(0,s.useEffect)((()=>{de([3891,ne===rt?13719:13720,ne===rt?3892:5295,ne===rt?3893:5294,ne===rt?3894:5296])}),[ne]);const[ce,me]=(0,s.useState)(null),ue=null===ce||void 0===ce?void 0:ce.limits,pe=null===ce||void 0===ce?void 0:ce.title.split(" ")[0];(0,s.useEffect)((()=>{_&&y&&me(y.find((e=>{var t,o;return(null===(t=e.id)||void 0===t?void 0:t.toString())===(null===$||void 0===$||null===(o=$.ID)||void 0===o?void 0:o.toString())})))}),[y,_,$]),(0,s.useEffect)((()=>{{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)(""),xe=(e,t,o,s)=>{ge(e);const n=L.get(P.A9.em_token);if("Personal"!==t&&"Advanced"!==t&&"Pro"!==t&&!s||"Community"!==pe&&"Free"!==pe)document.body.classList.remove("editor"),a((0,tt.qf)(P.lx.SWITCH_TO_PLAN_MODAL));else{{const s=new cp.CloudPayments,a={},i=new Date;i.setMonth(i.getMonth()+(ne===it?12:1)),i.setDate(i.getDate()-1);const r=`\u041e\u043f\u043b\u0430\u0442\u0430 ${ne===it?"\u0433\u043e\u0434\u043e\u0432\u043e\u0439":"\u043c\u0435\u0441\u044f\u0447\u043d\u043e\u0439"} \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0438 ${t}${ne===it?` (${ye(o)}\u20bd\xa0x\xa012)`:""}${R.promocode?" \u043f\u043e\xa0\u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434\u0443 "+R.promocode:" "}`,d=ne===it?12*o:+o,c={Items:[{label:r,price:d,quantity:1,amount:ye(d),vat:0}],calculationPlace:"https://emailmaker.ru",taxationSystem:1,email:l.email,amounts:{electronic:ye(d)}},m={Items:[{label:r,price:d,quantity:1,amount:d,vat:0}],calculationPlace:"https://emailmaker.ru",taxationSystem:1,email:l.email,amounts:{electronic:d}},u={interval:"Month",period:ne===it?12:1,customerReceipt:m,PersonalDate:i};a.CloudPayments={CustomerReceipt:c,recurrent:u,subscription:e,token:n,promocode:R.promocode?R.promocode:""},a.CloudPayments.CustomerReceipt.Items[0].amount=d,s.pay("charge",{publicId:"pk_e8c7c303759283dc35cf4ad7b396c",description:r,amount:ye(d),currency:"RUB",accountId:l.email,email:l.email,data:a,promocode:R.promocode||null},{onSuccess:function(e){},onFail:function(e,t){},onComplete:function(e,t){e.success&&setTimeout((()=>A()),3e3)}})}0}},[ve,fe]=(0,s.useState)(!1);(0,s.useEffect)((()=>{fe(G)}),[G]);(0,s.useEffect)((()=>{const e=setInterval((()=>{A()}),1e4);return()=>clearInterval(e)}),[A]);const be=(0,E.jsxs)(x.A,{size:10,children:[(0,E.jsx)(g.Ay,{type:"text",icon:(0,E.jsx)(te.A,{}),onClick:()=>(0,le.XZ)(o,"/projects"),shape:"circle"}),(0,E.jsx)(lt,{className:"ant-page-header-heading-title",children:e("Billing")})]}),_e=(0,E.jsx)(E.Fragment,{}),je=(0,s.useCallback)((e=>{I(!0),a(T.So.endpoints.checkPromo.initiate({code:e,type:"self"})).then((({data:t})=>400===(null===t||void 0===t?void 0:t.status)?{error:{data:t}}:e?a(T.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,le.p6)(e,w),null!==e&&void 0!==e&&e.data){let t={...e.data};const a=new Date(e.data.expiration),l=new Date;var o,s;if(t.promocode=e.data.promocode.toUpperCase(),a>l)F(t),(null===e||void 0===e||null===(o=e.data)||void 0===o?void 0:o.message)&&(0,le.wB)(null===e||void 0===e||null===(s=e.data)||void 0===s?void 0:s.message,w)}else R.promocode||F({...R,promocode:""})})).catch((e=>{(0,le.p6)(e,w),console.warn("error",e)})).finally((()=>{I(!1)}))}),[a,R,w]),ye=e=>{return R.discount&&e?(t=e-e*R.discount/100,"emailmaker"===P.oy?Math.round(t):10*Math.floor(t/10)):e;var t};(0,s.useEffect)((()=>{!+V&&W&&"Free"===pe&&null===R.promocode&&je(W)}),[je,V,W,pe,R.promocode]);const Ae=(0,E.jsx)(Je.A,{style:{fontSize:48},spin:!0});return(0,E.jsxs)(K.A,{className:"billing-page",children:[(0,E.jsx)(ae.A,{leftBlock:be,rightBlock:_e}),(f.isLoading||f.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)(Ge.A,{size:"large",indicator:Ae})}),(0,E.jsx)(nt,{className:"billing-page__container",children:(0,E.jsxs)("div",{className:"billing-page__content container",children:[j&&(0,E.jsx)(Ue.A,{active:!0}),ue&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(We.Ay.Group,{defaultValue:it,value:ne,style:{marginBottom:32,marginRight:25},onChange:e=>{ie(e.target.value)},children:[(0,E.jsx)(We.Ay.Button,{value:it,children:e("Bill yearly (-15%)")}),(0,E.jsx)(We.Ay.Button,{value:rt,children:e("Bill monthly")})]}),"Free"===pe&&!+V&&(0,E.jsxs)(u.A,{form:N,layout:"inline",name:"promo_code_form",autoComplete:"off",initialValues:{promocode:""},onFinish:({promocode:e})=>{N.resetFields(),e&&je(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)(Je.A,{}):(0,E.jsx)(Qe.A,{})})})]}),(0,E.jsx)("div",{className:"billing-page__cards-list",children:re.map((o=>{const{title:s,limits:{emails_limit:a,projects_limit:l,users_limit:n},price:i}=null===y||void 0===y?void 0:y.find((e=>{var t;return(null===(t=e.id)||void 0===t?void 0:t.toString())===(null===o||void 0===o?void 0:o.toString())})),r=a&&D>a||l&&z>l||n&&O>n,d=s.split(" ")[0];let c=null,m=null;return Z&&Q&&"Enterprise"===s&&(c=!0),Z&&ee&&"Enterprise 12"===s&&(m=!0),(0,E.jsxs)(Ye.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&&R.discount&&!+V||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?ye(i):c?ye(Q):m?ye(ee):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 ",a||"\u221e"," ",t(" email"," emails",a)]}),(0,E.jsxs)("li",{children:["\u2022 ",l||"\u221e"," ",t(" project"," projects",l)]}),(0,E.jsxs)("li",{children:["\u2022"," ","Enterprise"===d&&(c||m)&&Z||n||"\u221e"," ",t(" member"," members",n)]})]}),(0,E.jsx)(J.A,{className:"billing-page__tooltip",placement:"topLeft",title:"Community"!==pe&&"Free"!==pe||!r?"":e("Switching is not possible due to exceeding the limit"),children:(0,E.jsx)(g.Ay,{className:k()("billing-page__card-button",{"billing-page__card-button_current":s===ce.title}),type:s===ce.title?"default":"primary",size:"large",onClick:()=>xe(s,d,i||c&&Q||m&&ee,c||m),disabled:("Community"===pe||"Free"===pe)&&r,title:"Community"!==pe&&"Free"!==pe||!r?"":e("Switching is not possible due to exceeding the limit"),children:s===ce.title?e("Current plan"):e("Enterprise"!==d||c||m?"Switch to this plan":"Contact us")})})]},s)}))}),R.promocode&&R.discount&&!+V&&"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: ")," ",R.promocode]}),R.description&&(0,E.jsx)("div",{style:{marginBottom:"-45px"},dangerouslySetInnerHTML:{__html:R.description}})]}),"Community"!==pe&&"Free"!==pe&&X&&(0,E.jsxs)("div",{className:"billing-page__paid-block",children:[(0,E.jsxs)("div",{className:"billing-page__paid-data",children:[e("Paid until: "),X]}),U&&(0,E.jsxs)("div",{className:"billing-page__recurring-switch-wrapper",children:[(0,E.jsx)(Ke.A,{className:"billing-page__recurring-switch",checked:ve,onChange:(e,t)=>{t.preventDefault(),e?(()=>{const e={sid:U,uid:l.id};m(e).then((e=>{var t,o;e.isSuccess&&200===(null===e||void 0===e||null===(t=e.data)||void 0===t||null===(o=t.data)||void 0===o?void 0:o.status)?(fe(!0),A().then((t=>{var o;t.data&&(0,le.wB)(null===e||void 0===e||null===(o=e.data)||void 0===o?void 0:o.message,w)}))):(fe(!1),(0,le.p6)(e,w))}))})():(()=>{const e={sid:U,uid:l.id};r(e).then((e=>{var t,o;e.isSuccess&&200===(null===e||void 0===e||null===(t=e.data)||void 0===t||null===(o=t.data)||void 0===o?void 0:o.status)?(fe(!1),A().then((t=>{var o;t.data&&(0,le.wB)(null===e||void 0===e||null===(o=e.data)||void 0===o?void 0:o.message,w)}))):(fe(!0),(0,le.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)(Ze.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:dt(D/ue.emails_limit*100,ue.emails_limit)}),(0,E.jsx)(Ze.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:dt(z/ue.projects_limit*100,ue.projects_limit)}),(0,E.jsx)(Ze.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:dt(O/(ue.users_limit||"Enterprise"===pe&&Z)*100,ue.users_limit||"Enterprise"===pe&&Z)}),(0,E.jsx)(Ze.A,{percent:H/ue.preview_limit*100,format:()=>(0,E.jsx)("span",{className:"billing-page__progress-block-counts",children:`${H} ${e("of")} ${ue.preview_limit} ${t(" preview"," previews",ue.preview_limit)}`}),size:"medium",strokeColor:dt(H/ue.preview_limit*100,ue.preview_limit)}),(0,E.jsx)(Ze.A,{percent:q/ue.optimization_limit*100,format:()=>(0,E.jsx)("span",{className:"billing-page__progress-block-counts",children:`${q} ${e("of")} ${ue.optimization_limit>0?ue.optimization_limit:"\u221e"} ${t(" optimisation"," optimisations",ue.optimization_limit)}`}),size:"medium",strokeColor:dt(q/ue.optimization_limit*100,ue.optimization_limit)})]})]})]})}),(0,E.jsx)(et.A,{isModalVisible:n===P.lx.SWITCH_TO_PLAN_MODAL,userEmail:oe,subscriptionRequest:he,userName:se,currentPlane:null===ce||void 0===ce?void 0:ce.title})]})};var mt=o(84568),ut=o(18398),pt=o(56991),ht=o(47271);d.BV.propTypes={};const gt=()=>{const e=(0,i.wA)(),t=(0,M.p6)(),o=(0,i.d4)(Ie.C1);(0,s.useEffect)((()=>{const t=null===o||void 0===o?void 0:o.code_editor;t&&e((0,Ie.ww)(t))}),[o,e]),(0,s.useEffect)((()=>{const o=t.get(P.A9.em_token),s=t.get(P.A9.promocode);o&&s&&(e(T.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,a=(0,ht.iU)(o),l=a.exp,n=a.iat;l&&l-s<86400?(t.remove(P.A9.em_token),e(B.Q2.util.resetApiState())):s-n>216e4&&t.set(P.A9.em_token,o,{expires:30})}}}),[e,t]);const[a,l]=(0,s.useState)(null),n=(0,i.d4)(ut.s0),r=n.project?(0,pt.Mu)(n):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(mt.Nq.endpoints.getProjects.initiate()).then((e=>{var t;l((null===(t=e.data)||void 0===t?void 0:t[0].id)||!1)})).catch((()=>l(!1)))}}),[o,e,t]),(0,b.O5)(),P.EW.isPlugin&&void 0===r?(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)(H,{})})}),(0,E.jsx)(d.qh,{path:"/yandex-login",element:(0,E.jsx)(V,{})}),(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)(Xe.A,{})}),(0,E.jsxs)(d.qh,{path:"/",element:(0,E.jsx)(c.A,{children:(0,E.jsx)(q.A,{})}),children:[(0,E.jsx)(d.qh,{path:"/billing",element:(0,E.jsx)(ct,{})}),(0,E.jsx)(d.qh,{index:!0,element:(0,E.jsx)(U.A,{to:r||"projects"})}),(0,E.jsxs)(d.qh,{path:"emails",children:[(0,E.jsx)(d.qh,{index:!0,element:(0,E.jsx)(W.A,{lastProjectId:a})}),(0,E.jsx)(d.qh,{path:"new",element:(0,E.jsx)(W.A,{lastProjectId:a})})]}),(0,E.jsxs)(d.qh,{path:"projects",children:[(0,E.jsx)(d.qh,{index:!0,element:(0,E.jsx)(X.A,{})}),(0,E.jsxs)(d.qh,{path:":projectId",element:(0,E.jsx)(qe.A,{}),children:[(0,E.jsxs)(d.qh,{path:"emails",children:[(0,E.jsx)(d.qh,{index:!0,element:(0,E.jsx)(G.A,{})}),(0,E.jsx)(d.qh,{path:":emailId",element:(0,E.jsx)(me.A,{}),children:(0,E.jsx)(d.qh,{path:":preview",element:(0,E.jsx)(me.A,{})})}),(0,E.jsx)(d.qh,{path:"new",element:(0,E.jsx)(me.A,{})}),(0,E.jsxs)(d.qh,{path:"new_from",children:[(0,E.jsx)(d.qh,{index:!0,element:(0,E.jsx)(X.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)(re,{})})})]}),(0,E.jsxs)(d.qh,{path:"blocks",children:[(0,E.jsx)(d.qh,{index:!0,element:(0,E.jsx)(de.A,{})}),(0,E.jsx)(d.qh,{path:":blockId",element:(0,E.jsx)(Ve,{})}),(0,E.jsx)(d.qh,{path:"new",element:(0,E.jsx)(Ve,{})})]}),(0,E.jsx)(d.qh,{path:"members",element:(0,E.jsx)($e.A,{})})]})]}),(0,E.jsx)(d.qh,{path:"*",element:(0,E.jsx)(ce.A,{})})]})]})};var xt=o(69156),vt=o(4701),ft=o(17126);const bt=(0,o(84869).A)(),_t={hashed:!1,algorithm:a.A.defaultAlgorithm,token:{colorLink:"#1677ff",colorInfo:"#722ed1",colorTextBase:"#000000",colorBgLayout:"#f0f2f5",borderRadiusXL:16,borderRadiusLG:12,borderRadius:8,borderRadiusSM:6,colorDarken1:"rgba(0, 0, 0, 0.08)",colorFillSecondaryDarken:"rgba(0, 0, 0, 0.1)",formControlHeight:34,borderWidth:1,borderColorHover:"#C5C5C5",formItemMarginBottomMD:20,formItemMarginBottomXS:8,colorSecondaryH:265.03,colorSecondaryS:"63.92%",colorSecondaryL:"50%",colorSecondaryBgH:273,colorSecondaryBgS:"100%",colorSecondaryBgL:"93%",appZoom:1},components:{Progress:{colorFillSecondary:"#ffffff"},Tabs:{titleFontSize:16,titleFontSizeSM:16,fontSize:16,fontSizeLG:16}}},jt={hashed:!1,algorithm:a.A.darkAlgorithm,token:{colorBgBase:"#1F1F1F",colorInfo:"#9254de",colorLink:"#1890ff",colorLinkHover:"#69c0ff",wireframe:!1,borderRadiusXL:16,borderRadiusLG:12,borderRadius:8,borderRadiusSM:6,borderWidth:1,colorDarken1:"rgba(0, 0, 0, 0.9)",colorFillSecondaryDarken:"rgba(255, 255, 255, 0.16)",formControlHeight:34,borderColorHover:"rgba(255, 255, 255, 0.3)",formItemMarginBottomMD:20,formItemMarginBottomXS:8,appZoom:1},components:{Tabs:{titleFontSize:16,titleFontSizeSM:16,fontSize:16,fontSizeLG:16}}};const yt=function(){const e=(0,i.d4)(Ce.Up),t=(0,i.d4)(Ie.C1),o=window.localStorage.getItem(P.V0.em_color_scheme),a=matchMedia(P.F3).matches?P.nd:P.T,[d,c]=(0,s.useState)(o||a),m=(0,pt.rD)(),u=(0,i.wA)(),p=(0,xt.c8)();(0,s.useEffect)((()=>{const e=P.EW.isPlugin?null===t||void 0===t?void 0:t.theme:o||a;c(e),(0,xt.A5)(e),u((0,Ce.eX)(e===P.nd?`vs-${e}`:P.T)),p()}),[o,e,a,null===t||void 0===t?void 0:t.theme,m.pathEnabled,u,p]);const h=(0,s.useCallback)((e=>{e&&e!==P.IJ?((0,xt.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 x=(0,i.d4)(ut.RP),[v,f]=(0,s.useState)("light"===d?_t:jt),[b]=(0,s.useState)(1);(0,s.useEffect)((()=>{const e="light"===d?_t:jt,t=x[d],o=t?(0,vt.TJ)(e,t):e;f({...o,token:{...o.token,appZoom:b}})}),[f,d,x,b]);const _=(0,ft.LG)(),j=(0,s.useCallback)((()=>_),[_]);return(0,E.jsx)(l.Ay,{theme:v,getPopupContainer:j,children:(0,E.jsx)(r.N7,{transformers:[bt],children:(0,E.jsx)(n.A,{children:(0,E.jsx)(gt,{})})})})}},45927:(e,t,o)=>{o.d(t,{A:()=>H});var s=o(92810),a=o(38883),l=o.n(a),n=o(95838),i=o(12280),r=o(29234),d=o(66726),c=o(2018),m=o(7744),u=o(71086),p=o(81e3),h=o(43005),g=o(7166),x=o(28348),v=o(29756),f=o(62767),b=o(6391),_=o(69372),j=o(62342),y=o(14461),A=o(82013),k=o(23287),S=o(45934),w=o(88296),C=o(26238),E=o(68031),I=o(21519),N=o(71495),T=o(44997),B=o(65983),L=o(47358),R=o(45695),P=o(56991),F=o(85163),M=o(47520),D=o(70082);const{useToken:z}=n.A,O=({className:e,email:t})=>{const{__:o}=(0,k.s9)(),a=(0,R.XW)(),[n]=i.A.useForm(),[O,H]=(0,s.useState)({}),[V,q]=(0,s.useState)(!0),[$,X]=(0,s.useState)(!1),G=(0,S.d4)(B.uJ),U=(0,P.rD)(),{token:W}=z(),Y={buttonsPaddingTop:"top",buttonsPaddingLeft:"left",buttonsPaddingRight:"right",buttonsPaddingBottom:"bottom"},K=t.common_styles&&"{}"!==t.common_styles?JSON.parse(t.common_styles):F.BD,[Z,J]=(0,s.useState)(null),Q=!!t.common_styles&&"{}"!==t.common_styles,ee=(0,S.d4)(L.Wm);(0,s.useEffect)((()=>{ee||J(null)}),[K,J,ee]),(0,s.useEffect)((()=>{!Z&&J({textFontFamily:K.text.fontFamily,textFontSize:K.text.fontSize,textFontSizeDim:K.text.fontSizeDim,textLineHeight:K.text.lineHeight,textLineHeightDim:K.text.lineHeightDim,textColor:K.text.color,textAlign:K.text.textAlign,textPaddingBottom:K.text.paddingBottom,textPaddingBottomDim:K.text.paddingBottomDim,headingFontFamily:K.headings.fontFamily,headingFontSize:K.headings.fontSize,headingFontSizeDim:K.headings.fontSizeDim,headingLineHeight:K.headings.lineHeight,headingLineHeightDim:K.headings.lineHeightDim,headingColor:K.headings.color,headingAlign:K.headings.textAlign,headingPaddingTop:K.headings.paddingTop,headingPaddingTopDim:K.headings.paddingTopDim,headingPaddingBottom:K.headings.paddingBottom,headingPaddingBottomDim:K.headings.paddingBottomDim,headingLetterSpacing:K.headings.letterSpacing,headingLetterSpacingDim:K.headings.letterSpacingDim,headingBold:K.headings.bold,headingItalic:K.headings.italic,linkColor:K.links.color,linkUnderline:K.links.underline,buttonsFontFamily:K.buttons.fontFamily,buttonsFontSize:K.buttons.fontSize,buttonsFontSizeDim:K.buttons.fontSizeDim,buttonsLetterSpacing:K.buttons.letterSpacing,buttonsLetterSpacingDim:K.buttons.letterSpacingDim,buttonsColor:K.buttons.color,buttonsBold:K.buttons.bold,buttonsItalic:K.buttons.italic,buttonsBackgroundColor:K.buttons.backgroundColor,buttonsMarginTop:K.buttons.marginTop,buttonsMarginTopDim:K.buttons.marginTopDim,buttonsMarginBottom:K.buttons.marginBottom,buttonsMarginBottomDim:K.buttons.marginBottomDim,buttonsBorder:K.buttons.border,buttonsAlign:K.buttons.textAlign,buttonsBorderRadius:K.buttons.borderRadius,buttonsPadding:K.buttons.padding})}),[K,Z]);const[te,oe]=(0,s.useState)(K.headings.fontSize-1),[se,ae]=(0,s.useState)(K.text.fontSize+1);(0,s.useEffect)((()=>{if(Z){var e,t,o,s;const a=Z.buttonsBorder;H(a);const l=Object.keys(a).find((e=>{var t,o,s;return(null===(t=a[e])||void 0===t?void 0:t.width)||(null===(o=a[e])||void 0===o?void 0:o.style)||(null===(s=a[e])||void 0===s?void 0:s.color)}));n.setFieldsValue({borderPosition:l||"all",borderWidth:null!==(null===(e=a[l])||void 0===e?void 0:e.width)?null===(t=a[l])||void 0===t?void 0:t.width:"",borderColor:(null===(o=a[l])||void 0===o?void 0:o.color)||"",borderStyle:(null===(s=a[l])||void 0===s?void 0:s.style)||"",borderRadiusAll:(0,M.ok)(Z.buttonsBorderRadius.all),borderRadiusTopLeft:(0,M.ok)(Z.buttonsBorderRadius.topLeft),borderRadiusBottomLeft:(0,M.ok)(Z.buttonsBorderRadius.bottomLeft),borderRadiusTopRight:(0,M.ok)(Z.buttonsBorderRadius.topRight),borderRadiusBottomRight:(0,M.ok)(Z.buttonsBorderRadius.bottomRight)}),!(0,M.ok)(Z.buttonsBorderRadius.all)&&((0,M.ok)(Z.buttonsBorderRadius.topLeft)||(0,M.ok)(Z.buttonsBorderRadius.bottomLeft)||(0,M.ok)(Z.buttonsBorderRadius.topRight)||(0,M.ok)(Z.buttonsBorderRadius.bottomRight))?q(!1):q(!0),Z.buttonsPadding&&!(0,M.ok)(Z.buttonsPadding.all)&&((0,M.ok)(Z.buttonsPadding.bottom)||(0,M.ok)(Z.buttonsPadding.right)||(0,M.ok)(Z.buttonsPadding.left)||(0,M.ok)(Z.buttonsPadding.top))&&X(!1)}}),[n,Z]);const le=e=>{const t=e.target.closest("button"),o=t.name;t.className=t.classList.contains("selected-td-form__button--active")?"ant-btn ant-btn-default":"ant-btn ant-btn-default selected-td-form__button--active",t.blur(),a({operation:F.Ru.SANDBOX_EMAIL_SETTINGS_SET,settings:{[o]:t.classList.contains("selected-td-form__button--active")}})};return Z&&(0,D.jsx)("div",{className:l()("appearance-panel",{[e]:e}),children:(0,D.jsxs)(i.A,{form:n,layout:"vertical",name:"content_appearance_panel_form",initialValues:Z,onValuesChange:e=>{const t=n.getFieldsValue(!0),o=Object.keys(e)[0];let s={};switch(o){case"headingFontSize":oe(t.headingFontSize-1),s=e;break;case"textFontSize":ae(t.textFontSize+1),s=e;break;case"borderStyle":s={buttonsBorder:{[t.borderPosition]:{...O[t.borderPosition],style:e[o]}}},"all"===t.borderPosition?H((s=>({...F.iV,[t.borderPosition]:{...s[t.borderPosition],style:e[o]}}))):H((s=>({...s,[t.borderPosition]:{...s[t.borderPosition],style:e[o]}})));break;case"borderColor":s={buttonsBorder:{[t.borderPosition]:{...O[t.borderPosition],color:e[o]}}},"all"===t.borderPosition?H((s=>({...F.iV,[t.borderPosition]:{...s[t.borderPosition],color:e[o]}}))):H((s=>({...s,[t.borderPosition]:{...s[t.borderPosition],color:e[o]}})));break;case"borderWidth":s={buttonsBorder:{[t.borderPosition]:{...O[t.borderPosition],width:e[o]}}},"all"===t.borderPosition?H((s=>({...F.iV,[t.borderPosition]:{...s[t.borderPosition],width:e[o]}}))):H((s=>({...s,[t.borderPosition]:{...s[t.borderPosition],width:e[o]}})));break;case"borderPosition":n.setFieldsValue({borderWidth:O[e[o]].width||"",borderColor:O[e[o]].color||"",borderStyle:O[e[o]].style||""});break;case"borderRadiusAll":case"borderRadiusTopLeft":case"borderRadiusBottomLeft":case"borderRadiusTopRight":case"borderRadiusBottomRight":s={buttonsBorderRadius:{[F.wF[o]]:+e[o]}};break;case"buttonsPaddingTop":case"buttonsPaddingLeft":case"buttonsPaddingRight":case"buttonsPaddingBottom":$?(s={padding:{all:+e[o]}},n.setFieldsValue({paddingTop:e[o],paddingLeft:e[o],paddingRight:e[o],paddingBottom:e[o]})):s={buttonsPadding:{[Y[o]]:+e[o]}};break;default:s=e}"borderPosition"!==o&&a({operation:F.Ru.SANDBOX_EMAIL_SETTINGS_SET,settings:s})},autoComplete:"off",className:"element-controls",children:[Q?null:(0,D.jsx)(r.A,{style:{marginBottom:"24px"},message:o("It looks like the email was not created in our service, so the content styles won`t work. Read more about content styles in the help."),type:"info"}),(0,D.jsx)("div",{className:"form-group-title",style:{paddingTop:0},children:o("General text")}),(0,D.jsx)(d.A,{trigger:["hover"],title:o("Font of the general text"),placement:"bottom",children:(0,D.jsx)(i.A.Item,{name:"textFontFamily",style:{marginBottom:W.formItemMarginBottomXS},children:(0,D.jsx)(w.A,{value:Z.textFontFamily})})}),(0,D.jsxs)(c.A,{gutter:10,children:[(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Font size of the general text"),placement:"bottom",children:(0,D.jsx)(i.A.Item,{name:"textFontSize",children:(0,D.jsx)(T.A,{min:0,max:te,placeholder:o("Font size"),prefix:(0,D.jsx)(g.A,{}),addonAfter:"px"})})})}),(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Line height of the general text"),placement:"bottom",children:(0,D.jsx)(i.A.Item,{name:"textLineHeight",children:(0,D.jsx)(T.A,{min:0,placeholder:o("Line height"),prefix:(0,D.jsx)(x.A,{}),addonAfter:"px"})})})})]}),(0,D.jsxs)(c.A,{gutter:10,style:{paddingBottom:4},children:[(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Color of the general text"),placement:"bottom",children:(0,D.jsx)(i.A.Item,{name:"textColor",children:(0,D.jsx)(C.A,{placeholder:o("Text color"),usedColors:G.usedColors})})})}),(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Bottom padding of the general text"),placement:"bottom",children:(0,D.jsx)(i.A.Item,{name:"textPaddingBottom",children:(0,D.jsx)(T.A,{min:0,placeholder:o("Bottom padding"),prefix:(0,D.jsx)(v.A,{}),addonAfter:"px"})})})})]}),(0,D.jsx)(u.A,{className:"selected-td-form__divider"}),(0,D.jsx)("div",{className:"form-group-title",children:o("Headings")}),(0,D.jsx)(d.A,{trigger:["hover"],title:o("Heading font"),placement:"left",children:(0,D.jsx)(i.A.Item,{name:"headingFontFamily",style:{marginBottom:W.formItemMarginBottomXS},children:(0,D.jsx)(w.A,{})})}),(0,D.jsxs)(c.A,{gutter:10,children:[(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Heading font size"),placement:"bottom",children:(0,D.jsx)(i.A.Item,{name:"headingFontSize",style:{marginBottom:W.formItemMarginBottomXS},children:(0,D.jsx)(T.A,{min:se,placeholder:o("Font size"),prefix:(0,D.jsx)(g.A,{}),addonAfter:"px"})})})}),(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Heading line height"),placement:"bottom",children:(0,D.jsx)(i.A.Item,{name:"headingLineHeight",style:{marginBottom:W.formItemMarginBottomXS},children:(0,D.jsx)(T.A,{min:0,placeholder:o("Line height"),prefix:(0,D.jsx)(x.A,{}),addonAfter:"px"})})})})]}),(0,D.jsxs)(c.A,{gutter:10,children:[(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Heading letter spacing"),placement:"bottom",children:(0,D.jsx)(i.A.Item,{name:"headingLetterSpacing",children:(0,D.jsx)(T.A,{min:0,placeholder:o("Letter spacing"),prefix:(0,D.jsx)(f.A,{}),addonAfter:"px"})})})}),(0,D.jsx)(m.A,{span:12,children:(0,D.jsxs)(p.A,{children:[(0,D.jsx)(h.Ay,{className:l()({"selected-td-form__button--active":Z.headingBold}),type:"default",name:"headingBold",onClick:le,children:(0,D.jsx)(b.A,{})}),(0,D.jsx)(h.Ay,{className:l()({"selected-td-form__button--active":Z.headingItalic}),type:"default",name:"headingItalic",onClick:le,children:(0,D.jsx)(_.A,{})})]})})]}),(0,D.jsxs)(c.A,{gutter:10,children:[(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Heading color"),placement:"bottom",children:(0,D.jsx)(i.A.Item,{name:"headingColor",children:(0,D.jsx)(C.A,{placeholder:o("Heading color"),usedColors:G.usedColors})})})}),(0,D.jsx)(m.A,{span:12})]}),(0,D.jsxs)(c.A,{gutter:10,style:{paddingBottom:4},children:[(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Top padding"),placement:"bottom",children:(0,D.jsx)(i.A.Item,{name:"headingPaddingTop",children:(0,D.jsx)(T.A,{min:0,placeholder:o("Top padding"),prefix:(0,D.jsx)(j.A,{}),addonAfter:"px"})})})}),(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Bottom padding"),placement:"bottom",children:(0,D.jsx)(i.A.Item,{name:"headingPaddingBottom",children:(0,D.jsx)(T.A,{min:0,placeholder:o("Bottom padding"),prefix:(0,D.jsx)(v.A,{}),addonAfter:"px"})})})})]}),(0,D.jsx)(u.A,{className:"selected-td-form__divider"}),(0,D.jsx)("div",{className:"form-group-title",children:o("Links")}),(0,D.jsxs)(c.A,{gutter:10,style:{paddingBottom:4},children:[(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Link color"),placement:"left",children:(0,D.jsx)(i.A.Item,{name:"linkColor",children:(0,D.jsx)(C.A,{placeholder:o("Link color"),usedColors:G.usedColors})})})}),(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(h.Ay,{className:l()({"selected-td-form__button--active":Z.linkUnderline}),type:"default",name:"linkUnderline",onClick:le,children:(0,D.jsx)(y.A,{})})})]}),(0,D.jsx)(u.A,{className:"selected-td-form__divider"}),(0,D.jsxs)("div",{className:"form-group-title",children:[o("Buttons")," ",(0,D.jsx)("span",{className:"form-group-title__bull",children:"\u2022"})," ",o("Text")]}),(0,D.jsx)(d.A,{trigger:["hover"],title:o("Buttons font"),placement:"left",children:(0,D.jsx)(i.A.Item,{name:"buttonsFontFamily",style:{marginBottom:W.formItemMarginBottomXS},children:(0,D.jsx)(w.A,{})})}),(0,D.jsxs)(c.A,{gutter:10,children:[(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Buttons font size"),placement:"bottom",children:(0,D.jsx)(i.A.Item,{name:"buttonsFontSize",style:{marginBottom:W.formItemMarginBottomXS},children:(0,D.jsx)(T.A,{min:0,placeholder:o("Font size"),prefix:(0,D.jsx)(g.A,{}),addonAfter:"px"})})})}),(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Buttons letter spacing"),placement:"bottom",children:(0,D.jsx)(i.A.Item,{name:"buttonsLetterSpacing",style:{marginBottom:W.formItemMarginBottomXS},children:(0,D.jsx)(T.A,{min:0,placeholder:o("Letter spacing"),prefix:(0,D.jsx)(f.A,{}),addonAfter:"px"})})})})]}),(0,D.jsxs)(c.A,{gutter:10,style:{paddingBottom:4},children:[(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Buttons text color"),placement:"bottom",children:(0,D.jsx)(i.A.Item,{name:"buttonsColor",children:(0,D.jsx)(C.A,{placeholder:o("Buttons text color"),usedColors:G.usedColors})})})}),(0,D.jsx)(m.A,{span:12,children:(0,D.jsxs)(p.A,{children:[(0,D.jsx)(h.Ay,{className:l()({"selected-td-form__button--active":Z.buttonsBold}),type:"default",name:"buttonsBold",onClick:le,children:(0,D.jsx)(b.A,{})}),(0,D.jsx)(h.Ay,{className:l()({"selected-td-form__button--active":Z.buttonsItalic}),type:"default",name:"buttonsItalic",onClick:le,children:(0,D.jsx)(_.A,{})})]})}),U.formButtonFieldTextAlignEnabled&&(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(E.A,{form:n,elementSettings:{textAlign:"",type:"email"},imgParent:!1,name:"buttonsAlign"})})]}),(0,D.jsx)(u.A,{className:"selected-td-form__divider"}),(0,D.jsxs)("div",{className:"form-group-title",children:[o("Buttons")," ",(0,D.jsx)("span",{className:"form-group-title__bull",children:"\u2022"})," ",o("Paddings & Background")]}),(0,D.jsxs)(c.A,{gutter:30,style:{paddingBottom:4},children:[U.formButtonFieldPaddingsEnabled&&(0,D.jsx)(D.Fragment,{children:(0,D.jsx)(m.A,{children:(0,D.jsxs)(p.A,{size:W.formItemMarginBottomXS,direction:"vertical",children:[(0,D.jsx)(c.A,{children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Top padding"),placement:"top",children:(0,D.jsx)(i.A.Item,{name:"buttonsPaddingTop",className:"selected-td-form__padding-input",style:{margin:"auto"},children:(0,D.jsx)(T.A,{min:0,className:"selected-td-form__padding-input"})})})}),(0,D.jsx)(c.A,{children:(0,D.jsxs)(p.A,{size:W.formItemMarginBottomXS,children:[(0,D.jsx)(d.A,{trigger:["hover"],title:o("Left padding"),placement:"left",children:(0,D.jsx)(i.A.Item,{name:"buttonsPaddingLeft",className:"selected-td-form__padding-input",style:{marginBottom:0},children:(0,D.jsx)(T.A,{min:0})})}),(0,D.jsx)(h.Ay,{className:l()("selected-td-form__button",{"selected-td-form__button--active":$}),onClick:()=>{X((e=>!e))},children:(0,D.jsx)(A.A,{style:{fontSize:"16px"}})}),(0,D.jsx)(d.A,{trigger:["hover"],title:o("Right padding"),placement:"right",children:(0,D.jsx)(i.A.Item,{name:"buttonsPaddingRight",className:"selected-td-form__padding-input",style:{marginBottom:0},children:(0,D.jsx)(T.A,{min:0})})})]})}),(0,D.jsx)(c.A,{children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Bottom padding"),placement:"bottom",children:(0,D.jsx)(i.A.Item,{name:"buttonsPaddingBottom",className:"selected-td-form__padding-input",style:{margin:"0 auto 20px"},children:(0,D.jsx)(T.A,{min:0})})})})]})})}),(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Buttons background color"),placement:"left",children:(0,D.jsx)(i.A.Item,{name:"buttonsBackgroundColor",children:(0,D.jsx)(C.A,{placeholder:o("Background color"),usedColors:G.usedColors})})})})]}),U.formFieldBorderEnabled&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(u.A,{className:"selected-td-form__divider"}),(0,D.jsxs)("div",{className:"form-group-title",children:[o("Buttons")," ",(0,D.jsx)("span",{className:"form-group-title__bull",children:"\u2022"})," ",o("Borders")]}),(0,D.jsx)("div",{style:{paddingBottom:4},children:(0,D.jsx)(I.A,{borders:Z.buttonsBorder})})]}),U.formFieldBorderRadiusEnabled&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(u.A,{className:"selected-td-form__divider"}),(0,D.jsxs)("div",{className:"form-group-title",children:[o("Buttons")," ",(0,D.jsx)("span",{className:"form-group-title__bull",children:"\u2022"})," ",o("Border radius")]}),(0,D.jsx)("div",{style:{paddingBottom:4},children:(0,D.jsx)(N.A,{form:n,oneBorderRadiusValue:V,setOneBorderRadiusValue:q,elementSettings:Z})})]}),(0,D.jsx)(u.A,{className:"selected-td-form__divider"}),(0,D.jsxs)("div",{className:"form-group-title",children:[o("Buttons")," ",(0,D.jsx)("span",{className:"form-group-title__bull",children:"\u2022"})," ",o("Margins")]}),(0,D.jsxs)(c.A,{gutter:10,style:{paddingBottom:4},children:[(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Top margin"),placement:"top",children:(0,D.jsx)(i.A.Item,{name:"buttonsMarginTop",children:(0,D.jsx)(T.A,{min:0,placeholder:o("Top margin"),prefix:(0,D.jsx)(j.A,{}),addonAfter:"px"})})})}),(0,D.jsx)(m.A,{span:12,children:(0,D.jsx)(d.A,{trigger:["hover"],title:o("Bottom margin"),placement:"top",children:(0,D.jsx)(i.A.Item,{name:"buttonsMarginBottom",children:(0,D.jsx)(T.A,{min:0,placeholder:o("Bottom margin"),prefix:(0,D.jsx)(v.A,{}),addonAfter:"px"})})})})]})]})})};O.defaultProps={className:""};const H=O},88296:(e,t,o)=>{o.d(t,{A:()=>c});var s=o(92810),a=o(79579),l=o(23287),n=o(42642),i=o(70082);const r=[{label:"Segoe UI, Helvetica Neue, Helvetica, Roboto, Arial, sans-serif",value:"-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif",className:"Segoe"},{label:"Helvetica, Roboto, Arial, sans-serif",value:"Helvetica, Roboto, Arial, sans-serif",className:"Helvetica"},{label:"Arial Black, Gadget, sans-serif",value:"'Arial Black', Gadget, sans-serif",className:"ArialBlack"},{label:"Comic Sans MS, cursive",value:"'Comic Sans MS', cursive",className:"ComicSans"},{label:"Courier New, Courier, monospace",value:"'Courier New', Courier, monospace",className:"CourierNew"},{label:"Georgia, serif",value:"Georgia, serif",className:"Georgia"},{label:"Impact, Charcoal, sans-serif",value:"Impact, Charcoal, sans-serif",className:"Impact"},{label:"Lucida Console, Monaco, monospace",value:"'Lucida Console', Monaco, monospace",className:"LucidaConsole"},{label:"Lucida Sans Unicode, Lucida Grande, sans-serif",value:"'Lucida Sans Unicode', 'Lucida Grande', sans-serif",className:"LucidaSans"},{label:"Palatino Linotype, Book Antiqua, Palatino, serif",value:"'Palatino Linotype', 'Book Antiqua', Palatino, serif",className:"Palatino"},{label:"Tahoma, Geneva, sans-serif",value:"Tahoma, Geneva, sans-serif",className:"Tahoma"},{label:"Times New Roman, Times, serif",value:"'Times New Roman', Times, serif",className:"TimesNewRoman"},{label:"Trebuchet MS, Helvetica, sans-serif",value:"'Trebuchet MS', Helvetica, sans-serif",className:"Trebuchet"},{label:"Verdana, Geneva, sans-serif",value:"Verdana, Geneva, sans-serif",className:"Verdana"}],d={100:"Thin","100i":"Thin Italic",200:"ExtraLight","200i":"ExtraLight Italic",300:"Light","300i":"Light Italic",400:"Regular","400i":"Regular Italic",500:"Medium","500i":"Medium Italic",600:"SemiBold","600i":"SemiBold Italic",700:"Bold","700i":"Bold Italic",800:"ExtraBold","800i":"ExtraBold Italic",900:"Black","900i":"Black Italic"},c=({value:e,onChange:t,textEditor:o=!1,codeMode:c=!1})=>{const{__:m}=(0,l.s9)(),u=[],p=[],[h,g]=(0,s.useState)(),[x,v]=(0,s.useState)(e),f=n.Mz.filter((e=>e.subsets.includes("cyrillic")&&"Sans Serif"===e.category&&e.popularity<100));f.forEach((e=>{u.push({label:e.family,value:e.family,children:Object.keys(e.fonts).filter((e=>d[e])).map((e=>({label:d[e],value:d[e]})))})}));const b=n.Mz.filter((e=>e.subsets.includes("cyrillic")&&"Serif"===e.category&&e.popularity<100));return b.forEach((e=>p.push({label:e.family,value:e.family,children:Object.keys(e.fonts).filter((e=>d[e])).map((e=>({label:d[e],value:d[e]})))}))),(0,s.useEffect)((()=>{if(o&&e!==x)if(e)if("Sans Serif"===e[1]){var t;g(["Google Fonts","Sans Serif",null===(t=f.find((t=>(null===t||void 0===t?void 0:t.family.replace(/\s/g,""))===e[2].replace(/\s/g,""))))||void 0===t?void 0:t.family,e[3].replace(/Italic/g," Italic")])}else if("Serif"===e[1]){var s;g(["Google Fonts","Serif",null===(s=b.find((t=>(null===t||void 0===t?void 0:t.family.replace(/\s/g,""))===e[2].replace(/\s/g,""))))||void 0===s?void 0:s.family,e[3].replace(/Italic/g," Italic")])}else"Safe Fonts"!==e[0]&&void 0!==h||g(e);else g([""]);else void 0===h&&x&&g(e);o||g(e),v(e)}),[e,f,b,h,o,x]),(0,i.jsx)(a.A,{allowClear:!1,showSearch:!0,value:h,placement:"bottomRight",options:[{label:m("Safe Fonts"),value:"Safe Fonts",children:r},{label:m("Google Fonts"),value:"Google Fonts",children:[{label:m("Sans Serif"),value:"Sans Serif",children:u},{label:m("Serif"),value:"Serif",children:p}]}],getPopupContainer:e=>e.closest(c?".selected_text_common_form_mobile":o?".email-pane__collapse-wrapper":".email-pane__content-col"),onChange:t})}},97562:(e,t,o)=>{o.d(t,{A:()=>D});var s=o(92810),a=o(95838),l=o(55039),n=o(33206),i=o(57806),r=o(29234),d=o(4800),c=o(12280),m=o(81e3),u=o(92328),p=o(43005),h=o(66726),g=o(28964),x=o(45934),v=o(37792),f=o(66170),b=o(64586),_=o(85677),j=o(9452),y=o(23287),A=o(85163),k=o(86286),S=o(64037),w=o(62303),C=o(18777),E=o(17581),I=o(55701),N=o(45695),T=o(32269),B=o(32411),L=o(38883),R=o.n(L),P=o(70082);const{useToken:F}=a.A,{TextArea:M}=l.A,D=({comments:e,subjectId:t,isLoggedIn:o,projectTitle:a="",emailElementType:L,email:D})=>{const{__:z,_n:O}=(0,y.s9)(),H=(0,N.XW)(),{modal:V}=n.A.useApp(),{error:q,notification:$}=V,{token:X}=F(),G=(0,s.useRef)(null),[U,W]=(0,s.useState)(""),[Y,K]=(0,s.useState)("ADD"),[Z,J]=(0,s.useState)(!1),[Q,ee]=(0,s.useState)(null),[te,oe]=(0,s.useState)(null),[se,ae]=(0,s.useState)(""),[le,ne]=(0,s.useState)(""),[ie,re]=(0,s.useState)(!1),[de,ce]=(0,s.useState)(""),[me,ue]=(0,C.z2)(),[pe,he]=(0,C.HI)(),[ge,xe]=(0,C.kk)(),[ve,fe]=(0,C.vn)(),[be]=(0,E.LX)(),[_e]=(0,I.yW)(),je=(0,x.d4)(k.C1),ye=(0,B.fn)(),Ae=()=>{const e={title:null===D||void 0===D?void 0:D.title,emailId:null===D||void 0===D?void 0:D.id,project:null===D||void 0===D?void 0:D.project,html:null===ye||void 0===ye?void 0:ye.getValue(),excerpt:null===D||void 0===D?void 0:D.date_gmt};"email"===L?be({emailId:null===D||void 0===D?void 0:D.id,body:e}).catch((e=>{console.log(e)})):_e({blockId:null===D||void 0===D?void 0:D.id,body:e}).catch((e=>{console.log(e)}))};function ke(e){oe(Q),ae(""),K("REPLY")}const Se=()=>{q({maskClosable:!0,centered:!0,title:z("Please log in"),content:z(`To leave comments you must be logged into EmailMaker and added to the project "${a}".`),okText:z("Okay. I'll log in.")})};async function we(){o?(await ge({commentId:te,content:le,targetId:de}).unwrap(),K("ADD"),ne(""),oe(0),re(!1),J(!1),ce(""),H({operation:A.Ru.SANDBOX_DISCUSS_RESET})):Se()}const Ce=e=>{K("ADD"),ne(""),oe(0),re(!1),J(!1),ce(""),H({operation:A.Ru.SANDBOX_DISCUSS_RESET})},Ee=async()=>{o?((U||se)&&await me({subjectId:t,author:je.id,parent:"ADD"===Y?"0":te,content:U||se,author_name:je.name,author_email:je.email,targetId:de}).then((e=>{e.error&&$.error({message:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.code}}),description:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:e.error.data.message}}),placement:"bottomRight"})})),ce(""),K("ADD"),ae(""),W(""),oe(0),re(!1),J(!1),H({operation:A.Ru.SANDBOX_DISCUSS_RESET})):Se()};function Ie(){ie?(J(!1),re(!1),H({operation:A.Ru.SANDBOX_DISCUSS_REMOVE_TARGET,value:de})):(J(!Z),H({operation:A.Ru.SANDBOX_DISCUSS_SET_TARGET,value:!Z}),Z&&re(!1))}(0,S.A)((e=>{const t=e.data.operation;if(t===A.Ru.APPLICATION_DISCUSS_SET_ID&&(ce(e.data.settings.value),""!==e.data.settings.value?(re(!0),J(!1)):(re(!1),J(!0))),t===A.Ru.APPLICATION_DISCUSS_SAVE_TARGET&&Ae(),t===A.Ru.APPLICATION_DISCUSS_GET_COMMENT)if(document.querySelector('.comment-icon-target[target-id="'+e.data.settings.targetId+'"]')){let t=document.querySelector('.comment-icon-target[target-id="'+e.data.settings.targetId+'"]').closest(".ant-comment");document.querySelector(".comment-block")?document.querySelector(".comment-block").scrollTo(0,t.offsetTop):document.querySelector(".em-analytics__email-tab-discuss .ant-tabs-content").scrollTo(0,t.offsetTop),t.classList.add("active"),setTimeout((()=>{t.classList.remove("active")}),2e3)}else H({operation:A.Ru.SANDBOX_DISCUSS_REMOVE_TARGET,value:e.data.settings.targetId}),$.error({message:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:z("There's no such comment.")}}),placement:"bottomRight"});t===A.Ru.APPLICATION_DISCUSS_NO_COMMENT&&$.error({message:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:z("There's no such element in the email.")}}),placement:"bottomRight"})}));const Ne=e=>{H({operation:A.Ru.SANDBOX_DISCUSS_GET_TARGET,value:e})},Te=e=>(null===e||void 0===e||e.sort(((e,t)=>e.date>t.date?1:-1)),(0,P.jsx)(P.Fragment,{children:e&&!!e.length&&(0,P.jsx)(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)(r.A,{description:z("Comment was removed."),type:"info"}),children:Te(e.children)}),"deleted"!==e.status&&(0,P.jsx)(P.Fragment,{children:(0,P.jsx)(g.A,{author_id:e.author_id,author:e.author_name,avatar:e.author_avatar_urls&&e.author_avatar_urls[48]||"",className:R()(e.target_id&&"targetted-comment-item",(!e.author_avatar_urls||!e.author_avatar_urls[48])&&"comment-item-noavatar"),content:(0,P.jsx)(d.A,{placement:"left",onOpenChange:()=>ee(e.id),menu:{items:e.author===je.id?Re:Pe},overlayStyle:{minWidth:"auto",paddingRight:6},children:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:e.content}})},"commenMenu"),datetime:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)("span",{dangerouslySetInnerHTML:{__html:e.date&&(0,T.Yq)((0,T.Cl)(e.date),O,!0)}}),e.target_id&&(0,P.jsx)("span",{className:"comment-icon-target","target-id":e.target_id,onClick:()=>Ne(e.target_id),children:(0,P.jsx)(v.A,{style:{color:X.colorInfo,top:-2,position:"relative"}})})]}),children:(0,P.jsxs)(P.Fragment,{children:["REPLY"===Y&&te===e.id&&Le,"EDIT"===Y&&te===e.id&&Be,Te(e.children)]})})})]})})})})})),Be=(0,P.jsxs)(c.A,{onFinish:we,className:"commentForm",children:[(0,P.jsx)(c.A.Item,{style:{marginBottom:10},children:(0,P.jsx)(M,{className:"textarea-reply",value:le,onChange:e=>ne(e.target.value),rows:4,placeholder:z("Editing comments"),onKeyDown:e=>"Escape"===e.key&&Ce(),onPressEnter:e=>"Enter"===e.key&&e.ctrlKey&&we(),ref:G})}),(0,P.jsx)(c.A.Item,{className:"buttons",children:(0,P.jsxs)(m.A,{children:[ie?(0,P.jsx)(u.A,{title:z("Are you sure?"),okText:z("Yes"),cancelText:z("No"),onConfirm:function(e){ve(te),re(!1),ce(""),H({operation:A.Ru.SANDBOX_DISCUSS_REMOVE_TARGET,value:de})},children:(0,P.jsx)(p.Ay,{loading:fe.isLoading,type:Z||ie&&"EDIT"===Y&&""!==de?"primary":"default",className:"button-target "+(Z&&!ie?"button-target_choose":""),style:ie&&"EDIT"===Y&&""!==de?{background:X.colorInfo}:{},children:(0,P.jsx)(v.A,{className:"icon-target"})})}):(0,P.jsx)(p.Ay,{onClick:Ie,loading:fe.isLoading,type:Z||ie&&"EDIT"===Y&&""!==de?"primary":"default",className:"button-target "+(Z&&!ie?"button-target_choose":""),style:ie&&"EDIT"===Y&&""!==de?{background:X.colorInfo}:{},children:(0,P.jsx)(v.A,{className:"icon-target"})}),(0,P.jsxs)(p.Ay,{className:"button-reply",type:"primary",loading:xe.isLoading,htmlType:"submit",children:[z("Save")," ",(0,P.jsx)(f.A,{})]}),(0,P.jsx)(p.Ay,{onClick:Ce,className:"button-reply",children:z("Cancel")})]})})]}),Le=(0,P.jsxs)(c.A,{name:"reply",className:"commentForm",onFinish:Ee,children:[(0,P.jsx)(c.A.Item,{style:{marginBottom:10},children:(0,P.jsx)(M,{className:"textarea-reply",value:se,onChange:e=>ae(e.target.value),rows:4,placeholder:z("Reply to the comment"),onKeyDown:e=>"Escape"===e.key&&Ce(),onPressEnter:e=>"Enter"===e.key&&e.ctrlKey&&Ee(),ref:G})}),(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:X.colorInfo}:{},children:(0,P.jsx)(v.A,{className:"icon-target"})})}),(0,P.jsxs)(p.Ay,{className:"button-reply",type:"primary",loading:"REPLY"===Y&&ue.isLoading,htmlType:"submit",children:[z("Reply")," ",(0,P.jsx)(w.A,{icon:"SendOutlined"})]}),(0,P.jsx)(p.Ay,{onClick:Ce,className:"button-reply",ghost:!0,type:"primary",children:z("Cancel")})]})})]});(0,s.useEffect)((()=>{"REPLY"===Y&&G.current.focus({cursor:"start"}),"EDIT"===Y&&G.current.focus({cursor:"end"})}),[Y]);let Re=[];Re.push({key:"Reply to comment",icon:(0,P.jsx)(b.A,{style:{fontSize:"16px"}}),label:z("Reply"),onClick:ke},{key:"Edit comment",icon:(0,P.jsx)(_.A,{style:{fontSize:"16px"}}),label:z("Edit"),onClick:function(t){var o,s,a,l,n;oe(Q),re(Boolean(null===(o=e.find((e=>{var t;return(null===(t=e.id)||void 0===t?void 0:t.toString())===Q})))||void 0===o||null===(s=o.target_id)||void 0===s?void 0:s.toString())),ne(null===(a=e.find((e=>{var t;return(null===(t=e.id)||void 0===t?void 0:t.toString())===Q})))||void 0===a||null===(l=a.content)||void 0===l||null===(n=l.slice(3,-5))||void 0===n?void 0:n.toString()),K("EDIT")}},{key:"Delete comment",icon:(0,P.jsx)(j.A,{style:{fontSize:"16px"}}),label:z("Delete"),style:{color:X.colorError},onClick:function(){var t,o;oe(Q),e.filter((e=>e.parent===Q)).length?ge({commentId:Q,status:"deleted"}).unwrap():pe(Q),(null===(t=document.querySelector('.discuss-main li[id="'+Q+'"] .comment-icon-target'))||void 0===t?void 0:t.getAttribute("target-id"))&&H({operation:A.Ru.SANDBOX_DISCUSS_REMOVE_TARGET,value:null===(o=document.querySelector('.discuss-main li[id="'+Q+'"] .comment-icon-target'))||void 0===o?void 0:o.getAttribute("target-id")}),Ae(),ce("")}});let Pe=[];return Pe.push({key:"Reply to comment",icon:(0,P.jsx)(b.A,{style:{fontSize:"16px"}}),label:z("Reply"),onClick:ke}),(0,P.jsxs)("div",{className:"discuss-main",children:[e.length>0&&(0,P.jsx)(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 a=0,l=t.length;a<l;++a){let e=t[a],l=s.get(e.id);if(l&&!Array.isArray(l)||(l&&(e.children=l),s.set(e.id,e)),"0"===String(e.parent))o.push(e);else{let t=s.get(e.parent);if(t){(Array.isArray(t)?t:t.children=t.children||[]).push(e)}else s.set(e.parent,[e])}}return o.forEach((e=>{"deleted"!==e.status||e.children||!he.isUninitialized&&!he.isSuccess||pe(e.id).unwrap().catch((e=>{}))})),o}(e),renderItem:e=>(0,P.jsxs)("li",{id:e.id,children:["deleted"===e.comment_status&&(0,P.jsx)(g.A,{className:"deletedComment",content:(0,P.jsx)(r.A,{description:z("Comment was removed."),type:"info"}),children:Te(e.children)}),"deleted"!==e.comment_status&&(0,P.jsx)(P.Fragment,{children:(0,P.jsx)(g.A,{author_id:e.author_id,author:e.author_name,avatar:e.author_avatar_urls&&e.author_avatar_urls[48]||"",className:R()(e.target_id&&"targetted-comment-item",(!e.author_avatar_urls||!e.author_avatar_urls[48])&&"comment-item-noavatar"),content:(0,P.jsx)(d.A,{placement:"left",destroyPopupOnHide:!0,onOpenChange:()=>ee(e.id),menu:{items:e.author===je.id?Re:Pe},overlayStyle:{minWidth:"auto"},children:(0,P.jsx)("div",{dangerouslySetInnerHTML:{__html:e.content}})},"commenMenu"),datetime:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)("span",{dangerouslySetInnerHTML:{__html:e.date&&(0,T.Yq)((0,T.Cl)(e.date),O,!0)}}),e.target_id&&(0,P.jsx)("span",{className:"comment-icon-target","target-id":e.target_id,onClick:()=>Ne(e.target_id),children:(0,P.jsx)(v.A,{style:{color:X.colorInfo,top:-2,position:"relative"}})})]}),children:(0,P.jsxs)(P.Fragment,{children:["REPLY"===Y&&te===e.id&&Le,"EDIT"===Y&&te===e.id&&Be,Te(e.children)]})})})]})}),(0,P.jsxs)(c.A,{onFinish:Ee,className:"ADD"===Y?"addMode":"replyEditMode",children:[(0,P.jsx)(c.A.Item,{style:{marginBottom:10},children:(0,P.jsx)(M,{value:U,onChange:e=>W(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:X.colorInfo}:{},children:(0,P.jsx)(v.A,{className:"icon-target"})})}),(0,P.jsxs)(p.Ay,{className:"button-add",type:"primary",loading:"ADD"===Y&&ue.isLoading,htmlType:"submit",children:[z("Send")," ",(0,P.jsx)(w.A,{icon:"SendOutlined"})]})]})]})]})}},63719:(e,t,o)=>{o.d(t,{A:()=>R});var s=o(92810),a=o(55039),l=o(66726),n=o(57806),i=o(12280),r=o(43005),d=o(4800),c=o(14852),m=o(71157),u=o(28964),p=o(23287),h=o(74267),g=o(25984),x=o(64617),v=o(45934),f=o(81325),b=o(79716),_=o(70082);const j=e=>{const{__:t}=(0,p.s9)();return[{key:"\ud83d\udce7",label:(0,_.jsxs)("div",{onClick:()=>{e("theme-and-preheader-generator")},children:["\ud83d\udce7 ",t("Subject line & preheader generator")]})},{key:"\ud83c\udf0e",label:(0,_.jsxs)("div",{onClick:()=>{e("translator")},children:["\ud83c\udf0e ",t("Translator")]})},{key:"\ud83d\udcc4",label:(0,_.jsxs)("div",{onClick:()=>{e("writer")},children:["\ud83d\udcc4 ",t("Copywriter")]})},{key:"\ud83d\udd0e",label:(0,_.jsxs)("div",{onClick:()=>{e("corrector")},children:["\ud83d\udd0e ",t("Proofreader")]})},{key:"\ud83e\udde0",label:(0,_.jsxs)("div",{onClick:()=>{e("psychologist")},children:["\ud83e\udde0 ",t("Psychologist")]})},{key:"\ud83d\udcc8",label:(0,_.jsxs)("div",{onClick:()=>{e("marketolog")},children:["\ud83d\udcc8 ",t("Marketer")]})},{key:"\u2728",label:(0,_.jsxs)("div",{onClick:()=>{e("email-generator")},children:["\u2728 ",t("Email generator")]})}]};var y=o(62303),A=o(84612),k=o(58819),S=o(86286),w=o(65983),C=o(45695),E=o(32269),I=o(47381),N=o(85163),T=o(32411),B=o(58689);const{TextArea:L}=a.A,R=({messages:e})=>{const{__:t,_n:o}=(0,p.s9)(),a=(0,v.wA)(),R=(0,C.XW)(),P=(0,C.QC)(),{projectId:F,emailId:M}=(0,x.g)(),[D,z]=(0,A.EQ)(),[O]=(0,A.YG)(),[H,{data:V=[]}]=(0,k.y4)(),[q,$]=(0,s.useState)(null),[X,G]=(0,s.useState)(!1),[U,W]=(0,s.useState)(null),[Y]=(0,k.MN)(),K=(0,I.u)(),Z=(0,v.d4)(w.Hs),J=(0,v.d4)(S.C1),Q=(0,m.hN)(),ee=(0,T.fn)(),[te,oe]=(0,s.useState)([]),[se,ae]=(0,s.useState)(""),le=(0,s.useRef)(null),[ne,ie]=(0,s.useState)(!1),[re,de]=(0,s.useState)(!1),ce={cursor:re?"not-allowed":"default",pointerEvents:re?"none":"auto"},me=async()=>await P.sendAsync(N.Ru.SANDBOX_IS_EMAIL_EMPTY),ue=()=>{G(!0),de(!0),Y({task_id:U,entity_id:M,status:"started"}).then((()=>{he()}))},pe=(0,s.useCallback)((()=>{var e;const t=null===(e=le.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)}),[le]),he=(0,s.useCallback)((()=>{O({entity_id:M}).then((e=>{oe(e.data.documents),pe()}))}),[M,O,oe,pe]);(0,s.useEffect)((()=>{let e;if(X){var t,o;const s=null===(t=V[V.length-1])||void 0===t||null===(o=t.processing)||void 0===o?void 0:o.email;if(s){let t=V[V.length-1].status;if(e=setInterval(ee.setValue(s),500),0===t){Y({task_id:U,entity_id:M,status:"completed"}).then((()=>{he()})),de(!1)}}q&&(clearInterval(e),a((0,w.AJ)(s)),G(!1),$(!1))}return()=>{clearInterval(e)}}),[ee,q,a,V,X,Z,M,U,he,Y,z]),(0,s.useEffect)(pe,[pe]),(0,s.useEffect)((()=>{(null===e||void 0===e?void 0:e.length)>0&&oe(e),R({operation:N.Ru.SANDBOX_EMAIL_CONTENT_GET})}),[e,R]),(0,s.useEffect)((()=>{const e=P.onInit((()=>{P.send({operation:N.Ru.SANDBOX_LOCK_EDIT,data:re}),P.send({operation:N.Ru.SANDBOX_LOCK_DISCUSS,value:re})}));return()=>e.dispose()}),[re,P]);const ge=async()=>{if(se){const e=se.replaceAll(/\n/g,"<br>"),o={project_id:F,connection:"chat",entity_id:M,message:e,locale:J.locale.slice(0,2),subject:Z.subject||"",preheader:Z.preheader||"",textContent:(0,B.T5)(ee.getValue())};K({event:"submit_form",action:"chat_whit_ai_assistant",entity_id:o.entity_id,project_id:o.project_id});const s=[{data:{role:"user",message:e,userInfo:{display_name:J.first_name+" "+J.last_name,avatar_url:J.avatar_urls[24]}}},{data:{role:"assistant",message:"\u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442",isLoading:!0}}];oe((e=>[...e,...s])),D({body:o}).then((e=>{if(401===e.data.status)throw new Error(N.ff);if(e.data.task_id){let t=e.data.task_id;W(t),H({id:t,setError:$}),me().then((e=>{e?ue():ie(!0)}))}he()})).catch((e=>{var o,s;Q.error({message:(0,_.jsx)("div",{dangerouslySetInnerHTML:{__html:(null===e||void 0===e||null===(o=e.data)||void 0===o?void 0:o.code)||t("Error")}}),description:(0,_.jsx)("div",{dangerouslySetInnerHTML:{__html:(null===e||void 0===e||null===(s=e.data)||void 0===s?void 0:s.message)||t("Something went wrong.")}}),placement:"bottomRight"})})),ae("")}},xe=e=>{const t={data:{role:"assistant",message:"\u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442",isLoading:!0}};oe((e=>[...e,t]));const o={project_id:F,connection:"chat",entity_id:M,context:e,locale:J.locale.slice(0,2),subject:Z.subject||"",preheader:Z.preheader||"",textContent:(0,B.T5)(ee.getValue())};K({event:"select",action:"select_ai_assistant_role",context:o.context,entity_id:o.entity_id,project_id:o.project_id}),D({body:o}).then((e=>{if(401===e.data.status)throw new Error(N.ff);he()})).catch((e=>{var t,o;Q.error({message:(0,_.jsx)("div",{dangerouslySetInnerHTML:{__html:(null===e||void 0===e||null===(t=e.data)||void 0===t?void 0:t.code)||"Error"}}),description:(0,_.jsx)("div",{dangerouslySetInnerHTML:{__html:(null===e||void 0===e||null===(o=e.data)||void 0===o?void 0:o.message)||"Something went wrong"}}),placement:"bottomRight"})}))},ve={replace:e=>{var o,s,a,n,i,r,d,c;if(null!==(o=e.attribs)&&void 0!==o&&null!==(s=o.class)&&void 0!==s&&s.split(" ").includes("ai-response-title"))return(0,_.jsx)(l.A,{placement:"left",title:t("Replace the title"),children:(0,_.jsx)("div",{onClick:()=>(e=>{const o=e.children[0].data;P.send(N.Ru.SANDBOX_SUBJECT_UPDATE,{value:e.children[0].data,guid:Z.renderGuid,fromAI:!0}),Q.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",message:t("Title copied to email settings"),placement:"bottomRight",data:o})})(e),children:(0,_.jsx)("span",{className:"ai-response-title",children:(0,g.zd)(e.children,ve)})})});if(null!==(a=e.attribs)&&void 0!==a&&null!==(n=a.class)&&void 0!==n&&n.split(" ").includes("ai-response-preheader"))return(0,_.jsx)(l.A,{placement:"left",title:t("Replace the preheader"),children:(0,_.jsx)("div",{onClick:()=>(e=>{const o=e.children[0].data;P.send(N.Ru.SANDBOX_PREHEADER_UPDATE,{value:e.children[0].data,guid:Z.renderGuid,fromAI:!0}),Q.success({id:"EMAIL_TITLE_UPDATED_FROM_AI",message:t("Preheader copied to email settings"),placement:"bottomRight",data:o,duration:300})})(e),children:(0,_.jsx)("span",{className:"ai-response-preheader",children:(0,g.zd)(e.children,ve)})})});if(null!==(i=e.attribs)&&void 0!==i&&null!==(r=i.class)&&void 0!==r&&r.split(" ").includes("ai-response-copy"))return(0,_.jsx)(l.A,{placement:"left",title:t("Copy to clipboard"),children:(0,_.jsx)("div",{onClick:()=>(e=>{const o=e.children[0].data;navigator.clipboard.writeText(o).then((()=>{Q.success({id:"TEXT_COPIED_TO_CLIPBOARD",message:t("Text copied to clipboard"),placement:"bottomRight",data:o})})).catch((e=>{console.error("\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0442\u0435\u043a\u0441\u0442\u0430: ",e)}))})(e),children:(0,_.jsx)("span",{className:"ai-response-copy",children:(0,g.zd)(e.children,ve)})})});if(null!==(d=e.attribs)&&void 0!==d&&null!==(c=d.class)&&void 0!==c&&c.split(" ").includes("ai-response-user-message")){var m,u,p,h,x;const t=(null===(m=e.attribs)||void 0===m?void 0:m.data)||(null===(u=e.children)||void 0===u||null===(p=u[0])||void 0===p?void 0:p.data);return(0,_.jsx)("li",{className:null===(h=e.attribs)||void 0===h?void 0:h.class,data:null===(x=e.attribs)||void 0===x?void 0:x.data,onClick:()=>(e=>{const t={data:{role:"user",message:e,userInfo:{display_name:J.first_name+" "+J.last_name,avatar_url:J.avatar_urls[24]}}};oe((e=>[...e,t]));const o={data:{role:"assistant",message:"\u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442",isLoading:!0}};oe((e=>[...e,o]));const s={project_id:F,connection:"chat",entity_id:M,message:e,locale:J.locale.slice(0,2),subject:Z.subject||"",preheader:Z.preheader||"",textContent:(0,B.T5)(ee.getValue())};D({body:s}).then((e=>{if(401===e.data.status)throw new Error(N.ff);if(e.data.task_id){let t=e.data.task_id;W(t),H({id:t,setError:$}),me().then((e=>{e?ue():ie(!0)}))}he()})).catch((e=>{var t,o;Q.error({message:(0,_.jsx)("div",{dangerouslySetInnerHTML:{__html:(null===e||void 0===e||null===(t=e.data)||void 0===t?void 0:t.code)||"Error"}}),description:(0,_.jsx)("div",{dangerouslySetInnerHTML:{__html:(null===e||void 0===e||null===(o=e.data)||void 0===o?void 0:o.message)||"Something went wrong"}}),placement:"bottomRight"})}))})(t),children:(0,g.zd)(e.children,ve)})}}};return(0,_.jsxs)("div",{ref:le,className:"discuss-main",children:[te.length>0&&(0,_.jsx)(n.A,{onClick:e=>{"string"===typeof e.target.className&&e.target.className.includes("ai-response-change-context")&&(z.isLoading||xe(e.target.role))},className:"comment-list",itemLayout:"horizontal",dataSource:te,renderItem:e=>{var s,a,l;return(0,_.jsx)("li",{id:e._id,children:(0,_.jsx)(u.A,{className:e.data.userInfo?"":"ai-comment",avatar:"assistant"===e.data.role?(0,_.jsx)(y.A,{icon:"ChatGpt",className:"anticon-robot",style:{color:"#ffffff",width:24,height:24,borderRadius:"50%",justifyContent:"center"}}):!e.data.userInfo||!e.data._modified&&N.EW.isPlugin?J.avatar_urls[24]||(0,_.jsx)(f.A,{style:{color:"#ffffff",width:24,height:24,borderRadius:"50%",justifyContent:"center"}}):e.data.userInfo.avatar_url,author:(0,_.jsx)("div",{style:ce,children:"user"===(null===e||void 0===e||null===(s=e.data)||void 0===s?void 0:s.role)?N.EW.isPlugin?(null===J||void 0===J?void 0:J.username)||t("User"):null===(a=e.data)||void 0===a||null===(l=a.userInfo)||void 0===l?void 0:l.display_name:t("AI Assistant")}),datetime:e._created?(0,_.jsx)("span",{dangerouslySetInnerHTML:{__html:(0,E.Yq)((0,h.A)(e._created),o,!0)}}):null,content:e.data.isLoading?(0,_.jsx)("div",{className:"spin",children:(0,_.jsx)(b.A,{style:{fontSize:24},spin:!0})}):(0,_.jsx)("div",{style:ce,children:(0,g.Ay)(e.data.message,ve)})})},e._id)}}),(0,_.jsxs)(i.A,{onFinish:ge,className:"addMode",children:[(0,_.jsx)(i.A.Item,{style:{marginBottom:10},children:(0,_.jsx)(L,{disabled:re,value:se,onChange:e=>ae(e.target.value),rows:4,placeholder:t("Type your request"),className:"textarea-comment",onPressEnter:e=>"Enter"===e.key&&e.ctrlKey&&ge(),spellCheck:"false"})}),(0,_.jsxs)(i.A.Item,{children:[(0,_.jsx)(r.Ay,{disabled:z.isLoading||re,type:"default",style:{background:"var(--colorInfo)",color:"#ffffff"},className:"button-target",children:(0,_.jsx)(d.A,{placement:"top",disabled:re,arrow:{pointAtCenter:!0},menu:{items:j(xe)},children:(0,_.jsxs)("div",{disabled:re,style:{margin:0,padding:0},children:[(0,_.jsx)(y.A,{icon:"ChatGpt"}),t("Role")]})},"Export")}),(0,_.jsxs)(r.Ay,{disabled:z.isLoading||re,className:"button-add",type:"primary",htmlType:"submit",children:[t("Send")," ",(0,_.jsx)(y.A,{icon:"SendOutlined"})]})]})]}),(0,_.jsx)(c.A,{title:t("Warning"),centered:!0,open:ne,onOk:()=>{ue(),ie(!1)},onCancel:()=>{ie(!1)},children:(0,_.jsx)("p",{children:t("The current template will be changed to the generated one, are you sure about this?")})})]})}},44997:(e,t,o)=>{o.d(t,{A:()=>i});var s=o(92810),a=o(78159),l=o(70082);const n=s.forwardRef(((e,t)=>{const[o,n]=(0,s.useState)(!1),[i,r]=(0,s.useState)(0),[d,c]=(0,s.useState)(e.value||e.defaultValue),[m,u]=(0,s.useState)(e.value||e.defaultValue),p=()=>n(!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")&&(n(!0),r(e.clientX),c(m))},children:[(0,l.jsx)(a.A,{...e,ref:t,value:m,className:"input-draggable"}),o&&(0,l.jsx)("div",{style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",cursor:"ew-resize"},onMouseUp:p})]})}));n.defaultProps={dragspeed:1};const i=n},65052:(e,t,o)=>{o.d(t,{A:()=>R});var s=o(92810),a=o(45934),l=o(81662),n=o(12280),i=o(2018),r=o(7744),d=o(55039),c=o(8701),m=o(14852),u=o(43005),p=o(86889),h=o(71157),g=o(39110),x=o(55782),v=o(28372),f=o(5031),b=o(81325),_=o(23287),j=o(64936),y=o(86286),A=o(65983),k=o(39990),S=o(83351),w=o(44997),C=o(32269),E=o(69156),I=o(45695),N=o(85163),T=o(70082);const{Option:B}=l.A,L="profile",R=({isModalVisible:e})=>{const{__:t}=(0,_.s9)(),o=(0,a.d4)(y.C1),R=(0,a.d4)(y.yf),[P,F]=(0,k.hZ)(),[M]=(0,S.uX)(),D=(0,h.hN)(),z=(0,I.XW)(),O=(0,a.wA)(),[H]=n.A.useForm(),[V,q]=(0,s.useState)([]),[$,X]=(0,s.useState)([]),[G,U]=(0,s.useState)(L),[W,Y]=(0,s.useState)({currentPassword:!1,newPassword:!1,confirmPassword:!1}),[K,Z]=(0,s.useState)((()=>o.locale)),[J,Q]=(0,k.b9)(),ee=(0,s.useRef)(null),te=t("If you turn the switch off, lines of code will not wrap. If you turn the switch on, lines of code will wrap at the viewport.");(0,s.useEffect)((()=>{if(H&&e){U(L),P(void 0,!0);const e=o.code_editor;Z(o.locale),H.setFieldsValue({firstName:o.first_name,lastName:o.last_name,email:o.email,theme:o.theme,currentPassword:"",newPassword:"",confirmPassword:"",autosaves:Boolean(o.autosaves),hideMergetags:Boolean(o.hide_mergetags),language:o.locale,newsLetterConsent:Boolean(o.newsletter_consent),codeEditor:{fontSize:e.font_size||10,fontFamily:e.font_family,tabSize:e.tab_size||2,wordWrap:Boolean(e.word_wrap),minimap:Boolean(e.minimap),insertSpaces:Boolean(e.insert_spaces)}})}}),[o,H,e,P,Z]),(0,s.useEffect)((()=>{if(H&&e){if(F.isSuccess){var t,o,s,a;let e=null===(t=(0,C.EU)(R,["acf","theme"]))||void 0===t||null===(o=t.items)||void 0===o?void 0:o.enum;const l=null===(s=(0,C.EU)(R,["acf","code_editor","font_family"]))||void 0===s||null===(a=s.items)||void 0===a?void 0:a.enum;q((0,C.d_)(e)),X((0,C.d_)(l))}F.isError&&(0,C.p6)(F,D)}}),[F,H,e,R,D]);const oe=()=>{const e=window.localStorage.getItem(N.V0.em_color_scheme),s=matchMedia(N.F3).matches?N.nd:N.T;z({operation:N.Ru.UPDATE_PREVIEW,theme:e||s}),H.validateFields().then((e=>{const s=e.codeEditor;e.currentPassword&&e.newPassword?M({username:o.email,password:e.currentPassword}).then((o=>{o.error?(H.setFieldsValue({currentPassword:"",newPassword:"",confirmPassword:""}),ee.current.focus({cursor:"start"}),D.error({message:(0,T.jsx)("div",{dangerouslySetInnerHTML:{__html:t("You entered the current password incorrectly.")}}),description:(0,T.jsx)("div",{dangerouslySetInnerHTML:{__html:t("Please, try to change your password again.")}}),placement:"bottomRight"})):J({password:e.newPassword})})):J({first_name:e.firstName,last_name:e.lastName,email:e.email,locale:e.language,autosaves:e.autosaves,hide_mergetags:e.hideMergetags,theme:e.theme,newsletter_consent:e.newsLetterConsent,code_editor:s?{font_size:s.fontSize,font_family:s.fontFamily,tab_size:s.tabSize,word_wrap:s.wordWrap,minimap:s.minimap,insert_spaces:s.insertSpaces}:null})}))};(0,s.useEffect)((()=>{Q.isError&&(0,C.p6)(Q,D)}),[Q,D]),(0,s.useEffect)((()=>{Q.isSuccess&&((0,C.wB)(t("Your profile was successfully updated."),D),O((0,j.Oo)()))}),[O,Q,t,D]);const[se,ae]=(0,s.useState)("");(0,s.useEffect)((()=>{const t=window.localStorage.getItem(N.V0.em_color_scheme);e&&(H.setFieldsValue({theme:null!==t?t:N.IJ}),ae(null!==t?t:N.IJ))}),[H,e]);const le=(0,s.useCallback)((e=>{let t;if((0,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;O((0,A.eX)(t===N.nd?`vs-${t}`:N.T)),(0,E.A5)(t)}),[O]),ne=(0,s.useCallback)((()=>{se!==H.getFieldValue("theme")&&le(se),O((0,y.ww)(o.code_editor)),O((0,y.ko)(K)),O((0,j.Oo)())}),[o.code_editor,O,H,se,le,K]);let ie=[{label:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(g.A,{}),t("Profile")]}),key:L,className:"em-analytics__profile-user",children:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(i.A,{gutter:16,children:[(0,T.jsxs)(r.A,{span:12,children:[" ",(0,T.jsx)(n.A.Item,{label:t("First name"),name:"firstName",children:(0,T.jsx)(d.A,{placeholder:t("Enter your first name")})})]}),(0,T.jsx)(r.A,{span:12,children:(0,T.jsx)(n.A.Item,{label:t("Last name"),name:"lastName",children:(0,T.jsx)(d.A,{placeholder:t("Enter your last name")})})})]}),(0,T.jsxs)(i.A,{gutter:16,children:[(0,T.jsx)(r.A,{span:12,children:(0,T.jsx)(n.A.Item,{label:t("Email"),name:"email",children:(0,T.jsx)(d.A,{disabled:!0,placeholder:t("Enter your email")})})}),(0,T.jsx)(r.A,{span:12,children:(0,T.jsx)(n.A.Item,{label:t("Theme"),name:"theme",children:(0,T.jsx)(l.A,{placeholder:t("Select a theme"),children:V.map((e=>{let o="";switch(e.value){case"light":o=t("Light");break;case"dark":o=t("Dark");break;default:o=t("System")}return(0,T.jsx)(B,{value:e.value,children:o},e.value)}))})})})]}),(0,T.jsxs)(i.A,{gutter:16,children:[(0,T.jsx)(r.A,{span:12,children:(0,T.jsx)(n.A.Item,{label:t("Newsletter Subscription"),valuePropName:"checked",name:["newsLetterConsent"],children:(0,T.jsx)(c.A,{})})}),(0,T.jsx)(r.A,{span:12,children:(0,T.jsx)(n.A.Item,{label:t("Autosave in editor"),valuePropName:"checked",name:["autosaves"],children:(0,T.jsx)(c.A,{})})})]})]})},{label:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(x.A,{}),t("Code editor")]}),key:"editor",className:"account-settings-codeiditor-tab-content em-analytics__profile-code-editor",children:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(i.A,{gutter:16,children:[(0,T.jsx)(r.A,{span:8,children:(0,T.jsx)(n.A.Item,{label:t("Font size"),name:["codeEditor","fontSize"],children:(0,T.jsx)(w.A,{min:6,max:100})})}),(0,T.jsx)(r.A,{span:8,children:(0,T.jsx)(n.A.Item,{label:t("Tab size"),name:["codeEditor","tabSize"],children:(0,T.jsx)(w.A,{min:1,max:10})})}),(0,T.jsx)(r.A,{span:8,children:(0,T.jsx)(n.A.Item,{label:t("Font family"),name:["codeEditor","fontFamily"],children:(0,T.jsx)(l.A,{placeholder:t("Select a font family"),children:$.map((e=>(0,T.jsx)(B,{value:e.value,children:e.label},e.value)))})})})]}),(0,T.jsxs)(i.A,{gutter:16,children:[(0,T.jsx)(r.A,{span:8,children:(0,T.jsx)(n.A.Item,{label:t("Line wrap"),valuePropName:"checked",name:["codeEditor","wordWrap"],tooltip:{title:te,icon:(0,T.jsx)(v.A,{})},children:(0,T.jsx)(c.A,{})})}),(0,T.jsx)(r.A,{span:8,children:(0,T.jsx)(n.A.Item,{label:t("Minimap"),valuePropName:"checked",name:["codeEditor","minimap"],tooltip:{title:t("Display the minimap."),icon:(0,T.jsx)(v.A,{})},children:(0,T.jsx)(c.A,{})})}),(0,T.jsx)(r.A,{span:8,children:(0,T.jsx)(n.A.Item,{label:t("Insert spaces"),valuePropName:"checked",name:["codeEditor","insertSpaces"],tooltip:{title:t("Prefer spaces over tabs."),icon:(0,T.jsx)(v.A,{})},children:(0,T.jsx)(c.A,{})})})]})]})},{label:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(f.A,{}),t("Security")]}),key:"security",className:"account-settings-security-tab-content em-analytics__profile-code-editor",children:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(i.A,{gutter:16,children:(0,T.jsx)(r.A,{span:12,children:(0,T.jsx)(n.A.Item,{label:t("Current password"),name:"currentPassword",children:(0,T.jsx)(d.A.Password,{readOnly:!W.currentPassword,onFocus:()=>Y((e=>({...e,currentPassword:!0}))),ref:ee,placeholder:t("Enter your current password")})})})}),(0,T.jsxs)(i.A,{gutter:16,children:[(0,T.jsx)(r.A,{span:12,children:(0,T.jsx)(n.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"===G){return e("currentPassword")?s.length>=8&&/[0-9]/.test(s)&&/[a-z]/.test(s)&&/[A-Z]/.test(s)&&/\W+|_/g.test(s)?Promise.resolve():Promise.reject(new Error(t("The password is too simple."))):Promise.reject(new Error("Enter your current password"))}return Promise.resolve()}})],children:(0,T.jsx)(d.A.Password,{readOnly:!W.newPassword,onFocus:()=>Y((e=>({...e,newPassword:!0}))),placeholder:t("Enter your new password")})})}),(0,T.jsx)(r.A,{span:12,children:(0,T.jsx)(n.A.Item,{label:t("Confirmation"),name:"confirmPassword",validateTrigger:["onSubmit"],rules:[{required:"security"===G,message:t("Repeat the new password")},({getFieldValue:e})=>({validator:(o,s)=>s&&e("newPassword")!==s?Promise.reject(new Error(t("The two passwords that you entered do not match!"))):Promise.resolve()})],children:(0,T.jsx)(d.A.Password,{readOnly:!W.confirmPassword,onFocus:()=>Y((e=>({...e,confirmPassword:!0}))),placeholder:t("Repeat the new password")})})})]})]})}];return(0,T.jsx)(m.A,{width:572,className:"account-settings blocks-modal",title:(0,T.jsxs)("div",{children:[(0,T.jsx)(b.A,{})," ",t("Account settings")]}),open:e,onOk:oe,onCancel:ne,centered:!0,footer:[(0,T.jsx)(u.Ay,{size:"large",className:"em-analytics__profile-save",type:"primary",loading:Q.isLoading,onClick:oe,children:t("Update")},"Update")],children:(0,T.jsx)(n.A,{form:H,layout:"vertical",name:"edit_profile_form",onFinish:oe,initialValues:{remember:!1,firstName:"",lastName:"",email:"",theme:"system",currentPassword:"",newPassword:"",confirmPassword:"",autosaves:!1,email_builder_config:"simple",hideMergetags:!0,newsLetterConsent:!1,code_editor:{fontSize:10,fontFamily:"Anonymous Pro",tabSize:2,wordWrap:!0,minimap:!1,insertSpaces:!1}},onValuesChange:e=>{e.theme&&le(e.theme);const t=e.codeEditor;e.language&&O((0,y.ko)(e.language)),e.codeEditor&&O((0,y.ww)({font_size:t.fontSize,font_family:t.fontFamily,tab_size:t.tabSize,word_wrap:t.wordWrap,minimap:t.minimap,insert_spaces:t.insertSpaces}))},autoComplete:"off",children:(0,T.jsx)(p.A,{activeKey:G,onChange:e=>U(e),items:ie})})})}},35285:(e,t,o)=>{o.d(t,{A:()=>N});var s=o(92810),a=o(12280),l=o(2018),n=o(7744),i=o(55039),r=o(96492),d=o(14852),c=o(43005),m=o(86889),u=o(71157),p=o(45934),h=o(23287),g=o(53931),x=o(6790),v=o(31540),f=o(25273),b=o(8375),_=o(84568),j=o(64936),y=o(36404),A=o(85163),k=o(32269),S=o(70082);const w="mainsettings",C="ftpsettings",E="webhooksettings",I=({isModalVisible:e,selectedProject:t=null})=>{const{__:o}=(0,h.s9)(),I=(0,p.wA)(),[N]=a.A.useForm(),T=(0,s.useRef)(null),B=(0,s.useRef)(null),L=(0,s.useRef)(null),R=(0,p.d4)(y.yN),P=(0,p.d4)(j.gU),F=(0,u.hN)(),M=(0,p.d4)(j.cL),[D,z]=(0,s.useState)(w),[O,H]=(0,s.useState)(!1),V=t||R,q=[C,w,E].includes(P),[$,X]=(0,_.OD)();(0,s.useEffect)((()=>{if(M===A.lx.EDIT_PROJECT_MODAL){const e={mainsettings:T,ftpsettings:B,webhooksettings:L};setTimeout((()=>{var t;return null===(t=e[D].current)||void 0===t?void 0:t.focus({cursor:"end"})}),200)}}),[M,D]),(0,s.useEffect)((()=>{q&&z(P)}),[P,q,z,I]);let G=[{label:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(g.A,{}),o("Main settings")]}),key:w,className:"em-analytics__mainsettings-project",children:(0,S.jsx)(S.Fragment,{children:(0,S.jsx)(l.A,{gutter:24,children:(0,S.jsx)(n.A,{span:24,children:(0,S.jsx)(a.A.Item,{label:o("Project name"),name:"name",extra:o("This can be\xa0the name of\xa0your company, department, website, project, marketing campaign, or\xa0other activity."),rules:[{required:!0,message:o("Please type the project name.")}],children:(0,S.jsx)(i.A,{ref:T,placeholder:o("Type the project name"),style:{marginBottom:5}})})})})})},{label:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(x.A,{}),o("FTP settings")]}),key:C,className:"em-analytics__ftpsettings-project",children:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(l.A,{gutter:24,children:[(0,S.jsx)(n.A,{span:12,children:(0,S.jsx)(a.A.Item,{label:o("Host"),name:["ftpSettings","host"],children:(0,S.jsx)(i.A,{ref:B,placeholder:o("Type the FTP host"),disabled:O})})}),(0,S.jsx)(n.A,{span:12,children:(0,S.jsx)(a.A.Item,{label:o("Port"),name:["ftpSettings","port"],children:(0,S.jsx)(i.A,{placeholder:o("Type the FTP port"),disabled:O})})})]}),(0,S.jsxs)(l.A,{gutter:24,children:[(0,S.jsx)(n.A,{span:12,children:(0,S.jsx)(a.A.Item,{label:o("Directory"),name:["ftpSettings","directory"],children:(0,S.jsx)(i.A,{placeholder:o("Type the file directory"),disabled:O})})}),(0,S.jsx)(n.A,{span:12,children:(0,S.jsx)(a.A.Item,{label:o("URL catalog"),name:["ftpSettings","domain"],children:(0,S.jsx)(i.A,{placeholder:o("Type the URL catalog"),disabled:O})})})]}),(0,S.jsxs)(l.A,{gutter:24,children:[(0,S.jsx)(n.A,{span:12,children:(0,S.jsx)(a.A.Item,{label:o("Login"),name:["ftpSettings","login"],children:(0,S.jsx)(i.A,{placeholder:o("Type the FTP login"),disabled:O})})}),(0,S.jsx)(n.A,{span:12,children:(0,S.jsx)(a.A.Item,{label:o("Password"),name:["ftpSettings","password"],children:(0,S.jsx)(i.A.Password,{placeholder:o("Type the FTP password"),disabled:O,iconRender:e=>e?(0,S.jsx)(v.A,{}):(0,S.jsx)(f.A,{})})})})]}),(0,S.jsx)(l.A,{gutter:24,children:(0,S.jsx)(n.A,{span:24,children:(0,S.jsx)(a.A.Item,{noStyle:!0,children:(0,S.jsx)(r.A,{checked:O,onChange:e=>H(Boolean(e.target.checked)),children:o("Use default CDN")})})})})]})},{label:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(g.A,{}),o("WebHook settings")]}),key:E,className:"em-analytics__mainsettings-project",children:(0,S.jsx)(S.Fragment,{children:(0,S.jsx)(l.A,{gutter:24,children:(0,S.jsx)(n.A,{span:24,children:(0,S.jsx)(a.A.Item,{label:o("WebHook settings"),name:"webhook",extra:o("Before exporting the project you must fill in the url where the webHook request will be sent to"),rules:[{type:"url",message:o("Please enter correct url.")},q&&{required:!0,message:o("Please type the webhook url.")}],children:(0,S.jsx)(i.A,{ref:L,placeholder:o("Type the project webHook"),style:{marginBottom:5}})})})})})}];(0,s.useEffect)((()=>{if(e&&V){const e=V.ftp_settings;H(e.use_default_cdn),N.setFieldsValue({name:V.title,webhook:V.webhook||"",ftpSettings:{host:e.host||"",port:e.port||"",directory:e.directory||"",domain:e.domain||"",login:e.login||"",password:e.password||""}})}}),[N,V,e]);const U=()=>{N.validateFields().then((e=>{const t=e.ftpSettings;V&&$({projectId:V.id,title:e.name,webhook:e.webhook?e.webhook:"",ftp_settings:t?{host:t.host,port:t.port,directory:t.directory,domain:t.domain,login:t.login,password:t.password,use_default_cdn:O}:null}).then((({data:e,error:t})=>{e?e.title!==V.title?F.success({message:o("The project \u201c")+V.title+o("\u201d was successfully changed to \u201c")+e.title+o("\u201d."),placement:"bottomRight"}):F.success({message:o("The project settings was successfully saved."),placement:"bottomRight"}):t&&(0,k.p6)({error:t},F),I((0,j.YF)("")),I((0,j.Oo)())}))}))};return(0,S.jsx)(d.A,{title:(0,S.jsxs)("div",{children:[(0,S.jsx)(b.A,{})," ",o("Project settings")]}),className:"blocks-modal",open:e,onOk:U,onCancel:()=>{I((0,j.YF)("")),I((0,j.Oo)())},centered:!0,footer:[(0,S.jsx)(c.Ay,{size:"large",className:"em-analytics__project-save",type:"primary",loading:X.isLoading,onClick:U,children:o("Update")},"submit")],children:(0,S.jsx)(a.A,{form:N,layout:"vertical",name:`edit_project_form_${null===V||void 0===V?void 0:V.id}`,onFinish:U,initialValues:{remember:!1,name:""},autoComplete:"off",children:(0,S.jsx)(m.A,{activeKey:D,onChange:z,items:G})})})};I.defaultProps={selectedProject:null};const N=I}}]);
@@ -0,0 +1 @@
1
+ "use strict";(globalThis.webpackChunkemail_maker=globalThis.webpackChunkemail_maker||[]).push([[2299],{37444:(e,t,n)=>{n.d(t,{F:()=>$,y:()=>_});var s=n(90536),i=n(31052),r=n(53369),c=n(39990),o=n(83351),a=n(65119),d=n(84568),u=n(93563),l=n(17581),f=n(21981),p=n(53200),m=n(63531),g=n(55701),h=n(47036),y=n(94381),v=n(18777),j=n(141),w=n(1779),I=n(40869),C=n(56920),b=n(76793),E=n(843),S=n(35317),x=n(95679),O=n(88528),M=n(62689),P=n(46312),A=n(84612),k=n(58819),Q=n(15865),D=n(62677),N=n(48426),T=n(4115);const $=[c.Q2,o.OV,w.S,j.k,a.yR,d.Nq,u.kE,l.GY,f.m4,p.B,g.VM,h.f,y.Ad,v.Jg,I.M,C.F,b.KA,E.Sd,S.y,x.CL,O.tO,M.vx,P.Z8,m.yH,A.Zs,k.Uu,Q.So,D.C,N.N,T.U8];function _(){const e=(0,s.configureStore)({reducer:r.A,middleware:e=>e({serializableCheck:!1}).concat($.map((e=>e.middleware)))});return(0,i.$k)(e.dispatch),e}},90070:(e,t,n)=>{n.d(t,{W0:()=>o,p6:()=>r});var s=n(33288);const i=s.di.createIdentifier(),r=()=>s.di.useInstance(i);class c{constructor(){this._storage=Object.create(null)}get(e){const t=this._storage[e];return t&&(!t.expires||t.expires<Date.now())?t.value:""}set(e,t,n){this._storage[e]={value:t,expires:n.expires?1e3*n.expires+Date.now():void 0}}remove(e){delete this._storage[e]}}const o=e=>s.di.inject(e,i,new c)},33288:(e,t,n)=>{n.d(t,{di:()=>c});var s=n(95152),i=n(41664),r=n(23580);const c={getContainer:r.My,createIdentifier:i.Q,reducer:r.Ff,reducerPath:r.IP,getInstance:function(e,t){return(e instanceof s.m?e:(0,r.My)(e)).getInstance(t)},getInstanceAsync:function(e,t){return(e instanceof s.m?e:(0,r.My)(e)).getInstanceAsync(t)},getOrCreateInstance:function(e,t,n){return(e instanceof s.m?e:(0,r.My)(e)).getOrCreateInstance(t,n)},inject:function(e,t,n,s){return(0,r.My)(e).inject(t,n)},addService:function(e,t,n){return(0,r.My)(e).addService(t,n)},getServices:function(e,t){return(0,r.My)(e).getServices(t)},useInject:r.lg,useInstance:r.Nj,useInstanceAsync:r.rl,useServices:r.A$}},23580:(e,t,n)=>{n.d(t,{A$:()=>m,Ff:()=>d,IP:()=>a,My:()=>u,Nj:()=>f,if:()=>o,lg:()=>l,rl:()=>p});var s=n(92810),i=n(45934),r=n(82375),c=n(41664);const o="INJECTION",a=o,d=(e,t)=>{if(!e){const e=r.Q.createChild(),t=(0,c.Q)();return r.Q.inject(t,e),t}return e};function u(e){const t=e.getState()[o];return t&&r.Q.getInstance(t)}function l(){const e=u((0,i.Pj)());return function(t,n){e.inject(t,n)}}function f(e){return u((0,i.Pj)()).getInstance(e)}function p(e){const[t,n]=(0,s.useState)(),r=(0,i.Pj)(),c=(0,s.useRef)(Promise.resolve()),o=u(r);return(0,s.useEffect)((()=>{const t=c.current=c.current.then((()=>o.getInstanceAsync(e))).then((e=>{t===c.current&&n(e)}),(e=>console.log(e)))}),[n,e,r,o]),t}function m(e){return u((0,i.Pj)()).getServices(e)}},93982:(e,t,n)=>{n.d(t,{Zc:()=>d,_q:()=>u,cZ:()=>o,dB:()=>a,ml:()=>l});var s=n(45934),i=n(41664),r=n(23580),c=n(55654);function o(e){return(0,i.Q)(e)}function a(e,t){return(0,r.My)(e).getOrCreateInstance(t,(()=>new c.lt))}function d(e,t){return(0,r.My)(e).getOrCreateInstance(t,(()=>new c.lt)).event}function u(e){return l(e).event}function l(e){return a((0,s.Pj)(),e)}},39217:(e,t,n)=>{n.d(t,{CJ:()=>g,eT:()=>a,ft:()=>m,jY:()=>l,mg:()=>u,no:()=>p,qT:()=>c});var s=n(14315),i=n(44141),r=n(33288);function c(e){for(;e.endsWith("/");)e=e.slice(0,e.length-1);return`${e}/wp-json`}const o={baseUrl:"https://app.emailmaker.ru/api//wp-json",baseApiParams:{secure:!0,credentials:"same-origin",format:"json"},securityWorker:()=>({credentials:"same-origin"})};o.baseUrl=c("https://app.emailmaker.ru/api/");const a=r.di.createIdentifier();function d(e){return r.di.getOrCreateInstance(e,a,(()=>function(e=o){const t=new Map;return{create(n){const i=new s.RQ({...e,...n});return t.set(i,n),i},getOptions:()=>e,setOptions(n){e=n;for(const[s,i]of t)Object.assign(s,{...e,...i})}}}()))}function u(e,t={}){return d(e).create(t)}const l=r.di.createIdentifier(),f=r.di.createIdentifier(),p=r.di.createIdentifier(),m=e=>{var t;t=e,r.di.inject(t,p,{execute:async(e,n={})=>{const s=r.di.getServices(t,l),i=new Request(e,n);for(const t of s)await t.execute(i);let c=await fetch(i);const o=r.di.getServices(t,f);for(const t of o)c=await t.execute(c);return c}});const n=r.di.getInstance(e,p);r.di.inject(e,i.Pz,u(e,{customFetch:(null===n||void 0===n?void 0:n.execute)||fetch}))};let g;!function(e){const t="https://racs.rest/v3";e.post=function(e,n){const s={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(n)};return fetch(`${t}?resource=${e}&dataset=${document.location.hostname}`,s)},e.getAll=async function(e,n=0){const s={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:`{"filter":{},"limit":${n}}`},i=await fetch(`${t}/get?resource=${e}&dataset=${document.location.hostname}`,s);return await i.json()}}(g||(g={}))},15230:(e,t,n)=>{n.d(t,{Cd:()=>o,Lz:()=>c,ax:()=>a,f5:()=>i,sZ:()=>r});var s=n(41664);const i="Not implemented in plugin",r=(0,s.Q)(),c=(0,s.Q)(),o=(0,s.Q)(),a=(0,s.Q)();(0,s.Q)(),(0,s.Q)()},12299:(e,t,n)=>{n.r(t),n.d(t,{init:()=>E});var s=n(39217),i=n(90070),r=n(37444),c=n(77509),o=n(33288),a=n(15230),d=n(14386),u=n(8671),l=n(55853),f=n(19209),p=n(33746),m=n(25565),g=n(62410),h=n(63772),y=n(37e3),v=n(1383),j=n(1281),w=n(85163),I=n(93982),C=n(13522);w.EW.isPlugin=!0;const b=(0,d.E)([u.e,l.E,f.F,v.h,p.F,j.Z,m.i,g.r,h.Z,y.JR]);async function E(e){const t=(0,r.y)(),n=new c.j,d=await(0,y.qF)(e.element,n),u=y.sC.get(d);if(u){const t=await u;if(t.getElement()===d)return await t.reset(e)}const l=async function(){if(o.di.inject(t,a.ax,t),e.standaloneKey){o.di.inject(t,m.E,e.standaloneKey);const s=(0,I.Zc)(t,C.A.FILE_PROXY_EVENT_ID);n.addDisposable(s((async({url:e})=>(await fetch(e)).blob()),Number.MIN_VALUE))}o.di.inject(t,a.Lz,n),(0,i.W0)(t),(0,s.ft)(t);const r=await b(t);return await r.setOptions(e),o.di.inject(t,a.Cd,r),r.instance}();return d&&y.sC.set(d,l),l}},37e3:(e,t,n)=>{n.d(t,{JR:()=>y,qF:()=>v,sC:()=>j});n(57650),n(57964);var s=n(26254),i=n(89949),r=n(92810),c=n(97716),o=n(45934),a=n(64617),d=n(82212),u=n(32269),l=n(14386),f=n(893),p=n(33288),m=n(15230),g=n(17126),h=n(70082);const y=(0,l.l)((e=>{let t=null;const n=p.di.getInstance(e,m.Lz);let l;return{instance:{getElement:()=>t},async setOptions(y){let w=await v(y.element,n);const{instance:I}=p.di.getInstance(e,m.Cd)||{};if(t!==w){if(t&&j.delete(t),!(w&&j.has(w)&&I)){if(l&&l.dispose(),t=w,l=n.addDisposable(new u.jG),w)j.set(w,I);else{const e=document.createElement("div");e.style.position="absolute",e.style.left="-10000px",document.body.appendChild(e);const t=()=>{e.isConnected&&document.body.removeChild(e)};l.addDispose(t),w=e}return(t=>new Promise(((n,u)=>{var p;if(null!==(p=l)&&void 0!==p&&p.isDisposed())n();else{const u=(0,c.H)(t);u.render((0,h.jsx)(r.StrictMode,{children:(0,h.jsx)(o.Kq,{store:e,children:(0,h.jsx)(i.R,{onLoad:n,children:(0,h.jsx)(g.or.Provider,{value:{element:t},children:(0,h.jsx)(a.fS,{children:(0,h.jsx)(d.Y,{children:(0,h.jsx)(f.m,{children:(0,h.jsx)(s.A,{})})})})})})})})),l.addDispose(n),l.addDispose((()=>u.unmount()))}})))(w)}console.log("multiple init call on single HTMLELEMENT")}},dispose(){var e;null===(e=l)||void 0===e||e.dispose()}}}));function v(e,t){if("undefined"!==typeof e){if("string"===typeof e){if(e=document.querySelector(e))return e;const n=t.addDisposable(new u.jG);return new Promise(((t,s)=>{const i=new MutationObserver((()=>{(e=document.querySelector(e))&&(n.dispose(),t(e))}));i.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),n.addDisposable({dispose:()=>i.disconnect()})}))}return e}return e}const j=new Map},25565:(e,t,n)=>{n.d(t,{E:()=>u,i:()=>l});var s=n(20116),i=n(55084),r=n(14386),c=n(97001),o=n(44376),a=n(91738),d=n(33288);const u=d.di.createIdentifier(),l=(0,r.l)((async e=>{const t=d.di.getInstance(e,u);if(t){const s=(await n.e(9640).then(n.bind(n,76794))).injectStandaloneMocks;await s(e,t)}(0,s.BD)(e,i.A);const r=new c.P(e),l=new o.y(e);return{async setOptions(e){l.setOptions(e),await r.show(e.content)},instance:{...l.get(),show:e=>r.show(e),save:()=>r.save(),getEmail:()=>r.getEmail(),getBlocks:()=>r.getBlocks(),getEmailRevisions:()=>r.getEmailRevisions(),getComments:()=>r.getComments(),compileEmail:async e=>e?(0,a.AU)(e):await r.compileEmail(),getCodeErrors:()=>r.getCodeErrors()}}}))}}]);